1

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!!!

Joel Spencer
  • 129
  • 1
  • 8
  • the iOS one may be upping the security level automatically (I know nothing about the details of either implementation, but that error is sometimes related to making the request at a lower security level than is required) – Tim Tisdall Mar 28 '17 at 12:22

1 Answers1

1

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!!!

Joel Spencer
  • 129
  • 1
  • 8
  • Hi Joel Spencer, i am facing the same problem in android so can you post some example related to this – Amanpal Singh Jan 09 '18 at 11:41
  • now that is just amazing... I thought I bricked my BLE device or something and it was just my phone... Thanks a lot, I never would have thought that it was my phone – katinas Dec 02 '20 at 16:09