Попытка сделать следующее при настройке Characteristi c Уведомление
override fun onServicesDiscovered(gatt: BluetoothGatt?, status: Int) {
super.onServicesDiscovered(gatt, status)
if (gatt != null)
for (bluetoothService: BluetoothGattService in gatt.services)
for (bluetoothGattChar: BluetoothGattCharacteristic in bluetoothService.characteristics)
when (bluetoothGattChar.uuid.toString()) {
GATT_REQ_UUID -> {
d("GattCallback", "GATT REQ UUID found")
requestCharacteristic = bluetoothGattChar
}
GATT_RESP_UUID -> {
d("GattCallback", "GATT RESP UUID found")
responseCharacteristic = bluetoothGattChar
for (descriptor in responseCharacteristic.descriptors) {
descriptor.value = ENABLE_NOTIFICATION_VALUE
val writeStatus = gatt.writeDescriptor(descriptor)
d("GattCallback", "GATT RESP CHAR Write: $writeStatus")
}
val notifyStatus = gatt.setCharacteristicNotification(responseCharacteristic, true)
d("GattCallback", "GATT RESP CHAR Notify: $notifyStatus")
}
}
}
в настоящее время получает следующее в моих журналах
2020-04-07 17:09:43.921 802-26191/? I/vendor.qti.bluetooth@1.0-ibs_handler: ProcessIbsCmd: Received IBS_WAKE_IND: 0xFD
2020-04-07 17:09:43.921 802-26191/? I/vendor.qti.bluetooth@1.0-ibs_handler: ProcessIbsCmd: Writing IBS_WAKE_ACK
2020-04-07 17:09:43.923 26143-26195/? I/bt_stack: [INFO:gatt_main.cc(916)] gatt_data_process op_code = 1, msg_len = 4
2020-04-07 17:09:43.926 4135-4154/com.my.app D/GattCallback: DESCRIPTOR WRITE STATUS: 1
Этот код состояния не появляется в android документы, и я не могу найти значение op_code 1 для gatt_data_process.
Может кто-нибудь указать мне правильное направление?