Author Topic: Discovering and connecting to wiimote  (Read 2673 times)

Offline TL

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Discovering and connecting to wiimote
« on: December 12, 2011, 03:15:47 PM »
Hello,

The WCL toolkit looks great and I am trying to run the wii demo (from developer trial demo download).
Initially my Thinkpad w520 (broadcom chipset) and Win 7 Pro dropped the wiimote connection a few seconds after discovery.  I tried holding down the sync button through the whole process until the device appeared in Win 7 device manager, but no luck.  I switched to Bluesolei (latest version) and windows can now reliably discover and connect and the device appears in the system. 
When I run the wii demo I press the 1+2 buttons (lights flash) and I press the discover button on the demo.  The software finds the id of the device and I select it then press connect.  The demo reports that the "function is not implemented". 

Is this a limitation of the trial version or am I doing something wrong in setting up the wiimote connection?  Is it correct to have windows discover and connect and then repeat these steps in the wii demo?  How long/when should I be pressing the 1+2 buttons on the wiimote?  The wiimote is the latest model with integrated motionplus.  Any suggestions?

Thanks,
TL.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3053
  • Karma: 1000
    • Soft Service Company
Re: Discovering and connecting to wiimote
« Reply #1 on: December 12, 2011, 03:24:33 PM »
Hello,

WCL supports WiiMote with BlueSoleil only in "HID" mode. You have to connect to Wiimote with BlueSoleil tool and then check "HID" checkbox in Wiimote demo. Then connect,

With WidComm(WinXP)/Toshiba(Any): Wiimote is supported in "HID" and "native" modes. So press 1+2 on Wiimote then discover it. You do not need pair or do anything else with Wiimote before using it with WCL+Toshiba/WidComm. As Wiimote can be in discoverable.connectable  mode just a few seconds its not bad idea to wait when it switched off after discovered and press 1+2 once again. Of course, if you discovered it once or know its MAC you can connect without rediscovering. So press 1+2 second time and click "Connect" in Wiimote demo.

Microsoft(Any)/WidComm(Win7): The same as above.

Do not press "Sync" button on Wiimote (except you use BalanceBoard) because it requires pairing. Simple press 1+2.

Offline TL

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Discovering and connecting to wiimote
« Reply #2 on: December 21, 2011, 06:17:25 PM »
Mike,
Thank you that worked perfectly.

One more related question...

Suppose I wanted to modify the Wiimote demo to support using two or more wiimotes at one time.

Would I need to do...
a) create multiple objects of type CwclWiimote, one per user.
b) Would each instance of CwclWiimote need to load the CWL API?
c) Call the following for each user, but change the value of playerNum to be 0, 1, 2, etc?

Adapted from wii demo method - void CWiimoteDemoDlg::OnBnClickedButtonConnect()

  if (!wclShowError(m_Wiimote.EnumHID(Wiis)))
    if (Wiis.GetCount() > 0)
      {
        m_Wiimote.SetTransport(wtHID);
         m_Wiimote.GetHIDParams()->SetDevicePath(Wiis.GetItems(playerNum));
         wclShowError(m_Wiimote.Connect());
      }

thanks

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3053
  • Karma: 1000
    • Soft Service Company
Re: Discovering and connecting to wiimote
« Reply #3 on: December 21, 2011, 08:08:41 PM »
Hi,

a) create multiple objects of type CwclWiimote, one per user.

Yes, one per user/Wiimote.

b) Would each instance of CwclWiimote need to load the CWL API?

No, only one wclAPI per Application.

c) Call the following for each user, but change the value of playerNum to be 0, 1, 2, etc?

Adapted from wii demo method - void CWiimoteDemoDlg::OnBnClickedButtonConnect()

  if (!wclShowError(m_Wiimote.EnumHID(Wiis)))
    if (Wiis.GetCount() > 0)
      {
        m_Wiimote.SetTransport(wtHID);
         m_Wiimote.GetHIDParams()->SetDevicePath(Wiis.GetItems(playerNum));
         wclShowError(m_Wiimote.Connect());
      }

You can call EnumHID from any wclWiimote instance. It returns all Wiimote HIDs in system. Then open returned HIDs with each wclWiimote instance. However, if you use MS/Toshiba/WidComm it's recomended to use native bluetooth connection method so use wclBluetoothDiscovery as in Wiimote demo to find all Wiimote devices.

 

Sitemap 1 2 3 4 5 6 7 8 9