WowWeeLabs/MiP-BLE-Protocol

BLE protocol implementation issues

Closed this issue · 13 comments

Our initial testing (on OSX Yosemite) revealed that the BLE protocol documentation is misleading and perhaps does not work correctly? We were however able to get IOS SDK implementations working, but OSX is where we are trying to get the low-level BLE working.

Per the WowWee BLE Protocol documentation, services exposed are expected to be FFE0 and FFE5, however, the actual services we are seeing published are FFF0 and FFB0. Further, attempting to connect to these services fails with connection timeouts. Interesting to point out that after disconnecting, you can hear the Robot sound indicating disconnect , which indicates that 'something' must have been connected ;)

First attempt using OSX BLE on Yosemite is a bust, but we will keep trying :) if you can provide further assistance or recommendation, we would be VERY happy :)

best,
--don

2014-12-21 17:16:29.553 CoreBluetoothOSXCentral[2948:2284027] didDiscoverPeripheral: Peripheral CFUUID: <CFUUID 0x600000032a20> 39D11F31-750E-4D78-9D01-B1F5737C0819
2014-12-21 17:16:29.554 CoreBluetoothOSXCentral[2948:2284027] didDiscoverPeripheral: Peripheral CBUUID: Unknown (<39d11f31 750e4d78 9d01b1f5 737c0819>)
2014-12-21 17:16:29.554 CoreBluetoothOSXCentral[2948:2284027] didDiscoverPeripheral: Name: WowWee-MiP-2594
2014-12-21 17:16:29.555 CoreBluetoothOSXCentral[2948:2284027] didDiscoverPeripheral: Advertisment Data: {
kCBAdvDataIsConnectable = 1;
kCBAdvDataManufacturerData = <00050100 00000000 00000000 00000000 0000>;
kCBAdvDataServiceUUIDs = (
"Unknown ()",
"Unknown ()"
);
}
2014-12-21 17:16:29.555 CoreBluetoothOSXCentral[2948:2284027] didDiscoverPeripheral: RSSI: -54
2014-12-21 17:16:29.556 CoreBluetoothOSXCentral[2948:2284027] Connecting ... Unknown (<39d11f31 750e4d78 9d01b1f5 737c0819>)
2014-12-21 17:16:49.558 CoreBluetoothOSXCentral[2948:2284027] connectionDidTimeout: <CFUUID 0x600000032a20> 39D11F31-750E-4D78-9D01-B1F5737C0819
2014-12-21 17:16:49.558 CoreBluetoothOSXCentral[2948:2284027] Error: Error Domain=net.liquidx.LXCBCentralClient Code=-1 "Unable to connect to BTLE device." UserInfo=0x600000066b00 {NSLocalizedDescription=Unable to connect to BTLE device.}

kCBAdvDataIsConnectable = 1;
kCBAdvDataManufacturerData = <00050100 00000000 00000000 00000000 0000>;
kCBAdvDataServiceUUIDs =     (
    "Unknown (<fff0>)",
    "Unknown (<ffb0>)"
);

I'm seeing the same thing as well. Running "cylon-ble-info" on my MIP's UUID gets me:
Local Name = WowWee-MiP-2858
Manufacturer Data = 000501000000000000000000000000000000
Service Data =
Service UUIDs = fff0,ffb0

but it fails to return any data for "services and characteristics". I'm also on Yosemite.

@carlchan I get the same thing on Yosemite as well.

Thanks for the bug report, I see now that it's slightly confusing, I'll try to update the documentation to clarify a little bit.

Please ignore the broadcast data showing services of fff0,ffb0. This is a small bug.

You will not be able to find these services until you connect to the device. Then do a search for all available services and you should get these:

  • Receive Data Service: 0xFFE0
  • Send Data Service: 0xFFE5

Other services will come up as well, you can ignore the other services.

Please re-open this issue if you're still having problems.

@hongkongkiwi I am still unable to get it to work on Yosemite. Is there something that I need to change? Thanks for any help you can provide.

Just to confirm, are you running the latest Mac with Bluetooth Low Energy? Older Mac's do not include BLE built in, only Bluetooth Classic.

So presuming you are using the latest mac with BLE, then I have to ask you to paste me your code to take a look at. Can you do a Gist for us to look at?

Also, you might want to take a look at this link:
hybridgroup/cylon-mip#1

Looks like @rigado wrote a comment about BLE on Yosemite:

A bit of info on this that may or may not be related to this problem. CoreBluetooth on both iOS and OS > X do not issue a callback at the operating system level if the data sent to a BLE Characteristic is sent > as WriteWithoutResponse. From the apple documentation at > https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBPeripheral_Class/inde> x.html#//apple_ref/occ/instm/CBPeripheral/writeValue:forCharacteristic:type:

If you specify the write type as CBCharacteristicWriteWithoutResponse and the write does not succeed, > you are not notified nor do you receive an error indicating the cause of the failure. The data passed into > the data parameter is copied, and you can dispose of it after the method returns.
In my experience, this also means that even if the write DOES succeed, you also do not get notified. Thus, in this case, it's more of an as designed problem.

So, I'm not sure if the writes are being sent as WriteWithoutResponse at the low level, but if they are, the noble callback will never occur because the OS does not issue one. I have gotten around this by either doing the BLE writes as WriteWithResponse or by simply inserting a delay with setTimeout and then forcing the callback.

Yes, I am using OS X 10.10.1 on a Mac Book Pro retina display. I’ve tried it with the built in Bluetooth as well as an external Bluetooth dongle.

As described by the others, the MIP connects and disconnects successfully but none of the commands seem to work. The code I am using is the sample provided: https://github.com/hybridgroup/cylon-mip/blob/master/examples/mip-drive/mip-drive.js.

I would really appreciate any help you can provide.
Thanks,

var Cylon = require('cylon');
Cylon.robot({
connections: { bluetooth: {adaptor: 'central', uuid: '4fd2e1752cfe4c7ea0d4709e6eca32eb', module: 'cylon-ble'}},
devices: {mip: {driver: 'mip'}},
work: function(my) {
my.mip.setHeadLED(0, 0, 0, 0);
after((3).seconds(), function() {
my.mip.driveDistance(0, 100, 0, 0);
});
after((3).seconds(), function() {
my.mip.setHeadLED(0, 0, 0, 2);
});
}
}).start();

Andy, I updated to OSX 10.10.2 beta last night and it seems to have resolved some of the Bluetooth issues on Yosemite. Will test some more and let you know.

Solved in OSX 10.10.2+

I am on OSX 10.11.5 and this facing this issue. I was able to connect o my MIP and get the light on, but beyond that, I am not able to execute commands. It does make the "aww" sound when I disconnect, so I know that I was able to successfully connect. Do we have a resolution for the commands?

There could be many reasons why it's not working, perhaps you're not actually sending the commands correctly. Without looking at your code I couldn't say.

For a standard debugging proceedure, I would try the following:

  1. Connect using the official iOS or Android app. Can it connect? Can you drive it around?
  2. Test it using an already working framework.... for example we also provide a Node.js framework, iOS and Android. Try one of those, does the example project work correctly?
  3. If 'yes' for the above, then it looks like your just not sending commands in the correct format, please check out the note about ASCII, perhaps that could be your issue.
  4. If your still having issues, then maybe post some sample code.....