GATT_REQUEST_NOT_SUPPORTED还有更多可用信息?

时间:2017-03-27 13:11:16

标签: android bluetooth-lowenergy android-bluetooth android-ble bluetooth-gatt

我正在编写一个与BLE设备通信的Android应用程序。该应用程序是iOS版本的重新创建,但任何写入请求都会在onCharacteristicWrite中引发GATT_REQUEST_NOT_SUPPORTED响应

工作目标C代码

const uint8_t bytes[] = {0x01,0x02,0x00,0x00};
NSData *data = [NSData dataWithBytes:bytes length:sizeof(bytes)];
[_device writeValue:data forCharacteristic:_dataCommsCharacteristic type:CBCharacteristicWriteWithResponse];

收到GATT_REQUEST_NOT_SUPPORTED的等效Android / Java代码

byte bytes[] = {0x01,0x02,0x00,0x00};
dataCommsCharacteristic.setValue(bytes);
boolean writeStatus = mGatt.writeCharacteristic(dataCommsCharacteristic);

然后

@Override
    public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic
            characteristic, int status) {
if (status == BluetoothGatt.GATT_REQUEST_NOT_SUPPORTED){
              Log.d(TAG,"Request not supported");
        }
}

我在这里错过了一些明显的东西吗?!对我来说,上面的两个片段基本上是一样的,但是设备不能识别android,但确实识别了iOS。

非常感谢任何想法!!!

1 个答案:

答案 0 :(得分:0)

看来这最终成为设备问题。作为最后的手段,我重新启动了Galaxy S5,我正在测试,并且一切都很完美。

首先我应该尝试过!!!