about bluetooth Ble communication between mac os x and android 5.0

I developed a program which establish communication by BLE. it works normal between mac 、ios、mac。but when try to establish communication between mac osx and android 5.0.x ,it fail。Then I debuged it,it maybe bug:

- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error

{

if (error)

{

NSLog(@"Discovered characteristics for %@ with error: %@", [service.UUID UUIDString], [error localizedDescription]);

return;

}

for (CBCharacteristic *characteristic in service.characteristics)

{

NSLog(@"characteristics uuid:%@",[characteristic.UUID UUIDString]);

if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:READ_CHARACTERISTIC_UUID]]) {

/

int properties = characteristic.properties;

/

int notifyable = properties & 0x10;

if(notifyable!=0){

NSLog(@"准备监听characteristics uuid:%@",[characteristic.UUID UUIDString]);

[peripheral discoverDescriptorsForCharacteristic:characteristic];

/

[peripheral setNotifyValue:YES forCharacteristic:characteristic];

}

}

if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:WRITE_CHARACTERISTIC_UUID]]) {

Device *tmpDevice = [[Device alloc]init];

tmpDevice.mPeripheral = peripheral;

tmpDevice.mName = peripheral.name;

tmpDevice.isConnected = TRUE;

tmpDevice.mWriteCharacteristic = (CBMutableCharacteristic *)characteristic;

mTestDevice = tmpDevice;

[mConnectedDevices addObject:mTestDevice];

}

}

}

- (void)peripheral:(CBPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error{

if(error)

{

NSLog(@"监听characteristics uuid:%@失败",[characteristic.UUID UUIDString]);

NSLog(@"ERROR CODE %ld\n Error changing notification state: %@",(long)error.code,[error localizedDescription]);

}else{

NSLog(@"设置监听特征%@成功",[characteristic.UUID UUIDString]);

}


/

if (![characteristic.UUID isEqual:[CBUUID UUIDWithString:NOTIFY_READ_CHARACTERISTIC_UUID]]) {

return;

}


/

if (characteristic.isNotifying) {

NSLog(@"Notification began on %@", characteristic);

}

else {

NSLog(@"Notification stopped on %@. Disconnecting", characteristic);

[self.mCBCentralManager cancelPeripheralConnection:peripheral];

}

}


always unknown error

2015-06-13 14:28:47.303 Demo[1742:274412] 监听characteristics uuid:2FF1E1FA-558B-EE5D-24D0-FF0A068DC1CC失败

2015-06-13 14:28:47.303 Demo[1742:274412] ERROR CODE 0

Error changing notification state: Unknown error.

so mac osx can not goto auto

- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error

can anyone help me?

mac os as central, android phone as peripheral




That sounds to me like the Android 5 BluetoothGattServer isn't supporting toggling subscription/notification on in some situation. I haven't tried this myself yet, but short of actually getting out a BLE sniffer and examining what's happening during this exchange, that would be my off-the-cuff guess.

it's funy .But I don't why and how to deal with this problem. it has puzzled me those days。

Now ,from OSX 10.0.X HCI log,HCI receive the data,but for resean , my app and bluelight can not automatically get the data. I have submited this bug to apple, but sadlly after several weeks none give me a reply about why or how

about bluetooth Ble communication between mac os x and android 5.0
 
 
Q