¿Cómo enviar datos a través de un enlace Bluetooth de baja energía (BLE)?

Puedo descubrir, conectarme a bluetooth.

Código fuente---

Conéctese a través de Bluetooth al dispositivo remoto:

//Get the device by its serial number
 bdDevice = mBluetoothAdapter.getRemoteDevice(blackBox);

 //for ble connection
 bdDevice.connectGatt(getApplicationContext(), true, mGattCallback);

Gatt CallBack para el estado:

 private BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
    @Override
    public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
    //Connection established
    if (status == BluetoothGatt.GATT_SUCCESS
        && newState == BluetoothProfile.STATE_CONNECTED) {

        //Discover services
        gatt.discoverServices();

    } else if (status == BluetoothGatt.GATT_SUCCESS
        && newState == BluetoothProfile.STATE_DISCONNECTED) {

        //Handle a disconnect event

    }
    }

    @Override
    public void onServicesDiscovered(BluetoothGatt gatt, int status) {

    //Now we can start reading/writing characteristics

    }
};

Ahora quiero enviar comandos al dispositivo BLE remoto, pero no sé cómo hacerlo.

Una vez que el comando se envía al dispositivo BLE, el dispositivo BLE responderá transmitiendo datos que mi aplicación puede recibir.

Respuestas a la pregunta(2)

Su respuesta a la pregunta