Example usage for android.bluetooth BluetoothGattCharacteristic setValue

List of usage examples for android.bluetooth BluetoothGattCharacteristic setValue

Introduction

In this page you can find the example usage for android.bluetooth BluetoothGattCharacteristic setValue.

Prototype

public boolean setValue(String value) 

Source Link

Document

Set the locally stored value of this characteristic.

Usage

From source file:com.mbientlab.metawear.api.MetaWearBleService.java

/**
 * Writes a command to MetaWear via the command register UUID
 * @see Characteristics.MetaWear#COMMAND
 *//*from  w ww.ja v  a2 s .c o  m*/
private void writeCommand(final MetaWearState mwState) {
    gattActions.add(new GattAction() {
        @Override
        public void execAction() {
            byte[] next = mwState.commandBytes.poll();

            if (next != null && mwState.mwGatt != null) {
                BluetoothGattService service = mwState.mwGatt.getService(GATTService.METAWEAR.uuid());
                BluetoothGattCharacteristic command = service.getCharacteristic(MetaWear.COMMAND.uuid());
                command.setValue(next);
                mwState.mwGatt.writeCharacteristic(command);
            } else {
                execGattAction();
            }
        }
    });
}