Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
Hey all ...
Im not by nature a mac programmer and think i need a little help. Im trying to write a wrapper for the framework so i can plug it into the Neko virtual machine, this will then let me pass messages from wiimote to flash. ok.
I have it all working up to a point.. but after 5 seconds or so the wiimote will disconnect...
heres a dump from the mac bluetooth packet capture
[23:59:35.583] [HIIr] HID Interrupt: [a1] Unknown  Event Data [ 40 60 72 72 86 ff ff ff ff ff ff ff ff ff ff 7f 72 80 6d 6e 2f ]
[23:59:35.592] [HIIr] HID Interrupt: [a1] Unknown  Event Data [ 40 20 72 72 86 ff ff ff ff ff ff ff ff ff ff 7f 72 80 6d 6e 2f ]
[23:59:35.599] [HIIr] HID Interrupt: [a1] Unknown  Event Data [ 40 20 72 72 86 ff ff ff ff ff ff ff ff ff ff 7f 72 80 6d 6e 2f ]
[23:59:35.613] [HIIr] HID Interrupt: [a1] Unknown  Event Data [ 40 20 72 72 86 ff ff ff ff ff ff ff ff ff ff 7f 72 80 6d 6e 2f ]
[23:59:35.615] [L2Cr] Code: 6 Disconnection Request [Identifier: 92 Length: 0004]
[23:59:35.615] [L2Cs] Code: 7 Disconnection Response [Identifier: 92 Length: 0004]
[23:59:35.616] [L2Cr] Code: 6 Disconnection Request [Identifier: 93 Length: 0004]
[23:59:35.616] [L2Cs] Code: 7 Disconnection Response [Identifier: 93 Length: 0004]
[23:59:35.622] [HCIe] Event_Code: 13 Number of Completed Packets
Im at a real loss as to why this may be - i can reconnect even and the packets start streaming through - but again it disconnects after a few seconds, my first guess would be the 20 sec time out.. but the wiimote is sending data - i can get position packets joystick all of it... anyone have any deas where i can *start* looking??
Hmmm... I'm not sure I can help, but here goes.
What are you using to dump the Bluetooth packets?
If you link DarwiinRemote with the Framework does it exhibit the same behavior?
I've been moving things around in the 0.4 Framework pretty heavily (that's how I learn). I've been able to clean up a few things and make the performance more stable in some areas. You might be hitting a bug in the framework. I know that sometimes when I plug in or unplug the nunchuk I lose commication with the Wiimote; I haven't figured out why yet.
It looks like you're getting report 37 - wiimote buttons, wiimote acceleration, IR sensor, Expansion port. Nothing odd there that I can see.
I have seen that if the delegate doesn't respond to a certain message/function call, it can cause things to lock up. When you compile make sure you don't have any "might not respond to this message" warnings.
Hi Jasen ,
I was using the bluetooth packet logger that comes with xcode (/developer/applications/utilities/bluetooth
Ive compiled the darwin remote with the same version of the framework and DONT get the error.
Ive spoken to Rob Terrell (the guy who got it working in torque) very briefly and he mentions:
"I found that, when used via the Cocoa ingterface, the bluetooth stack throws a SIGALRM for its timeouts, so you should set up a signal handler to catch that, otherwise your process will probably terminate."
does the darwin remote app (or cocoa) somehow deal with this - and perhaps my c app is not?
heres what i do right now.
from c, init an instance of an obj-c wrapper class...
this wrapper baicaly implements the discovery and wii handler callbacks as AppController does in darmin remote.
My main C code goes into a nonEnding loop with
So that the discovery can continue...
I messed around with the framework a bunch more this weekend. One thing that seems to cause my framework to stop working is 0x20 reports. See http://www.wiili.org/index.php/Wiimote#Batteries. The framework is set up to request 0x20s every sixty seconds (via 0x15), and it can also be received unsolicited. I see a situation where the I get two 0x20s very close together and it confuses the framework and causes comms to be lost.
Also, on occasion I get kIOReturnNoDevice from sendCommand. Once that happens comms are down. I continue to receive reports from the Wiimote, but nothing can be sent to it. I've been tearing the framework apart trying to make these couple of issues go away, but no luck so far.
Jason sorry for late reply - but had orginaly posted just b4 my vacation, and im just back.
When i came back i picked up my wiimote, and couldnt get any lights on, changing batterys sorted it... and... dada.. also fixed my issue! if just seen your reply so i guess you where spot on, its low batterie notifications. Oddly this didnt seem to happen in the darwinRemote app...
I am also trying to do a c, c++ wrapper for WiiRemote.
Do you have any example code that I can take a look at.