Reputation: 149
I am writing an android app to communicate with a BLE device. The app is a recreation of an iOS version however any write request raises a GATT_REQUEST_NOT_SUPPORTED response inside onCharacteristicWrite
WORKING Objective C Code
const uint8_t bytes[] = {0x01,0x02,0x00,0x00};
NSData *data = [NSData dataWithBytes:bytes length:sizeof(bytes)];
[_device writeValue:data forCharacteristic:_dataCommsCharacteristic type:CBCharacteristicWriteWithResponse];
Equivalent Android/java code which recieves a GATT_REQUEST_NOT_SUPPORTED
byte bytes[] = {0x01,0x02,0x00,0x00};
dataCommsCharacteristic.setValue(bytes);
boolean writeStatus = mGatt.writeCharacteristic(dataCommsCharacteristic);
then
@Override
public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic
characteristic, int status) {
if (status == BluetoothGatt.GATT_REQUEST_NOT_SUPPORTED){
Log.d(TAG,"Request not supported");
}
}
Am I missing something glaringly obvious here?! To me the above 2 snippets are essentially the same thing however the device doesn't recognise the android one but does recognise the iOS one.
Any thoughts are greatly appreciated!!!
Upvotes: 2
Views: 1128
Reputation: 149
It appears this ended up being a device problem. As a last resort I restarted the Galaxy S5 I was testing wth and all worked perfectly.
Should have tried that first I suppose!!!
Upvotes: 2