QNBleProtocolDelegate
Bluetooth protocol proxy interface, which is used to implement and manage the Bluetooth connection by itself.
Method
writeCharacteristicValue
Write characteristic value
Parameters
| name | Types of | Explanation |
|---|---|---|
| service_uuid | string | UUID of Bluetooth service |
| characteristic_uuid | string | UUID of eigenvalue |
| data | byte[]/NSData | The data to be written, Android is a byte array, iOS is an NSData object |
Sample code
//Android
//Find the feature value first according to the service UUID and the feature value UUID
characteristic.value = data;
gatt.writeCharacteristic(characteristic)
//iOS swift
//Find the feature value first according to the service UUID and the feature value UUID
peripheral.writeValue(data, for: characteristic, type: CBCharacteristicWriteType.withResponse )
readCharacteristicValue
Read characteristic value
| name | Types of | Explanation |
|---|---|---|
| service_uuid | string | UUID of Bluetooth service |
| characteristic_uuid | string | UUID of eigenvalue |
//Android
//Find the feature value first according to the service UUID and the feature value UUID
gatt.readCharacteristic(characteristic)
//iOS swift
//Find the feature value first according to the service UUID and the feature value UUID
peripheral.readValue(for: characteristic)