tags:

views:

50

answers:

1

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?

A: 

Don't try to reinvent the wheel, use an existing library: http://wiimotelib.codeplex.com/

ZippyV
I think I need to correct you. The API you mentioned is what I am currently using but the API is HID wrapper and doesn't allow one to pair wiimotes. 32Feet API allows me to pair as well as read data. If you can tell me the way that would be great.
Umair Ashraf
Can't you use the Wiimotelib after you paired the remote?
ZippyV