I am trying to pair my Wiimotes using 32Feet API and I am successfully in doing so by following code.
var client = new InTheHand.Net.Sockets.BluetoothClient();
var devices = client.DiscoverDevices();
var count = (from d in devices
where d.DeviceName.Contains("Nintendo")
select d).Count();
foreach (var device in devices)
{
if (device.DeviceName.Contains("Nintendo"))
{
if (device.InstalledServices.Length > 0)
{
InTheHand.Net.Bluetooth.BluetoothSecurity.RemoveDevice(device.DeviceAddress);
//while it's being removed
Thread.Sleep(2000);
}
device.SetServiceState(InTheHand.Net.Bluetooth.BluetoothService.HumanInterfaceDevice, false);
device.SetServiceState(InTheHand.Net.Bluetooth.BluetoothService.HumanInterfaceDevice, true);
//Here I am confused! What to do to read from stream?
}
}
The line which I have commented as "Here I am confused!..." is what messing all the time. Can someone help me how to connect to all the wiimotes one by one and then to read from their stream please?