I am confused with how can I use Android app to write 20 bytes to CC2540.
I can write one byte(to one byte characteristic of 2540)easily by using the codes as bellow:
if ((charaProp | BluetoothGattCharacteristic.PROPERTY_WRITE) > 0) {
// If there is an active notification on a characteristic, clear
// it first so it doesn't update the data field on the user interface.
if (mNotifyCharacteristic != null) {
mBluetoothLeService.setCharacteristicNotification(mNotifyCharacteristic, false);
mNotifyCharacteristic = null;
}
byte[] writev = {0x0c};
characteristic.setValue(writev);
mBluetoothLeService.writeCharacteristic(characteristic);
}
But if I want to write 20 bytes to a 20-bytes characteristic of 2540 , It seems wrong by changing the codes as follows:
String Mysend = "11111111111111111111";//20bytes
byte[] writev = Mysend.getBytes();
characteristic.setValue(writev);
mBluetoothLeService.writeCharacteristic(characteristic);
So, how can I use Android BLE app to write 20 bytes to CC2540?
Thanks! Callon