@Override
public void onServicesDiscovered(final BluetoothGatt gatt, int status) {
super.onServicesDiscovered(gatt, status);
if (status == BluetoothGatt.GATT_SUCCESS) {
List<BluetoothGattCharacteristic> characteristics = null;
List<BluetoothGattService> services = gatt.getServices();
//I am getting all services
for (final BluetoothGattService service : services) {
characteristics = service.getCharacteristics();
//I am getting all characteristics for each services
}
}
}
I am able to connect with BLE device and I am getting all services and characteristics, now I have send some commands, like to turn on LED light I have to send "read slonn:" command and in response light will be ON, so how to do that and some time I also have to show current on my UI show for that command is like "read batti:", show how can I get current value and show my UI dashboard.
Please, help me I am totally do not know how to proceed.
Thanks in advance.
来源:https://stackoverflow.com/questions/38935479/how-to-send-command-to-ble-device-and-show-result