Как установить BluetoothGattCharacteristic
имя
fun createBLEService(): BluetoothGattService {
val service = BluetoothGattService(UUID,
BluetoothGattService.SERVICE_TYPE_PRIMARY)
val characteristic = BluetoothGattCharacteristic(VUUID,
//Read-only characteristic, supports notifications
BluetoothGattCharacteristic.PROPERTY_READ or BluetoothGattCharacteristic.PROPERTY_NOTIFY,
BluetoothGattCharacteristic.PERMISSION_READ)
val configDescriptor = BluetoothGattDescriptor(CLIENT_CONFIG,
//Read/write descriptor
BluetoothGattDescriptor.PERMISSION_READ or BluetoothGattDescriptor.PERMISSION_WRITE)
val configDescriptor2 = BluetoothGattDescriptor(USER_DESCRIPTION,
BluetoothGattDescriptor.PERMISSION_READ or BluetoothGattDescriptor.PERMISSION_WRITE)
configDescriptor2.setValue("VSP".toByteArray())
characteristic.addDescriptor(configDescriptor)
characteristic.addDescriptor(configDescriptor2)
service.addCharacteristic(characteristic)
return service
}
BluetoothGattDescriptor
должен иметь возможность добавить описание пользователя для BluetoothGattCharacteristic
. Однако я не могу найти способ сделать это.