2

I am using the IOBluetooth framework provided by Apple in OS X to communicate with an Arduino robot that i built. I've managed to get it working with only one problem, it only works for about 10 seconds before the RFCOMM channel closes for some unknown reason. I've searching through the apple docs but I can't find a way to get some sort of error code or description on why the RFCOMM Channel was closed.

Is there a way to find out why the RFCOMM channel closed?

A Person
  • 801
  • 1
  • 10
  • 22

2 Answers2

3

You could use the packetlogger that comes with XCode. Also you can look at the system logs.

EDIT: enter image description here

Dennis Mathews
  • 6,897
  • 2
  • 26
  • 39
  • Hmmm... the system logs and the packet logger did not tell me anything, however I did find out that my calls to writeSync: would return IOReturnNoDevice before the connection was dropped and the really strange part is that the device MTU is always 0. – A Person Jan 04 '12 at 18:31
  • It seems like the connection is getting dropped - the packet logger should tell you want and why it got dropped.. may be you can post the packet logger view – Dennis Mathews Jan 04 '12 at 18:42
  • I honestly have no clue how to use packet logger and there seems to be no apple support for it anywhere, any tips? – A Person Jan 04 '12 at 19:57
  • you should see packet logger app in /Developer/Applications/Utilities/Bluetooth you can fire it up and capture the bluetooth communication on you mac - let me know if it helps – Dennis Mathews Jan 04 '12 at 20:05
  • I can open the packet logger app but im not sure where to go from there, at first I thought I needed to set something up but now it looks more like the packets should be displayed in the main screen which they never are and I can confirm that data is being sent because the robot moves the packet logger just doesn't see it I guess. One weird thing is that when it starts it says it will not be able to save to disk, maybe that has something to do with it? – A Person Jan 04 '12 at 23:22
  • See above - when the packet logger starts you should see the following - else it is not able to detect the bluetooth device – Dennis Mathews Jan 04 '12 at 23:45
  • I guess its not able to detect the bluetooth device then it only shows the first line, I managed to get this from the console although it rarely does this. [establishKernelConnection] Received an error from IOServiceOpen() - 0x10000003. NULLing out io_service_t – A Person Jan 04 '12 at 23:56
  • Note that PacketLogger is no longer included with Xcode. You have to download the "Additional Tools for Xcode" package from Apple. See https://developer.apple.com/download/more/?=additional%20tools – Kristopher Johnson Jun 20 '18 at 14:59
1

Well after two 2 days of fiddling with the software I realized that it was not software at all. It was actually a hardware issue, the motors on the Arduino were drawing more current from the capacitor than I thought and this caused the Arduino to reboot. All I had to do was put the motors on a separate supply and everything worked! I wish I could have gotten an error message that said "Device dropped connection" that would have saved me a lot of time. But anyways thanks for the help Dennis it really sped things up (:

A Person
  • 801
  • 1
  • 10
  • 22