Search in sources :

Example 1 with ServerTransactionBuilder

use of nodomain.freeyourgadget.gadgetbridge.service.btle.ServerTransactionBuilder in project Gadgetbridge by Freeyourgadget.

the class CasioGB6900DeviceSupport method onCharacteristicReadRequest.

@Override
public boolean onCharacteristicReadRequest(BluetoothDevice device, int requestId, int offset, BluetoothGattCharacteristic characteristic) {
    if (!characteristic.getUuid().equals(CasioConstants.NAME_OF_APP_CHARACTERISTIC_UUID)) {
        LOG.warn("unexpected read request");
        return false;
    }
    LOG.info("will send response to read request from device: " + device.getAddress());
    try {
        ServerTransactionBuilder builder = performServer("sendNameOfApp");
        builder.writeServerResponse(device, requestId, 0, offset, CasioConstants.MUSIC_MESSAGE.getBytes());
        builder.queue(getQueue());
    } catch (IOException e) {
        LOG.warn("sendMusicInfo failed: " + e.getMessage());
    }
    return true;
}
Also used : IOException(java.io.IOException) ServerTransactionBuilder(nodomain.freeyourgadget.gadgetbridge.service.btle.ServerTransactionBuilder)

Aggregations

IOException (java.io.IOException)1 ServerTransactionBuilder (nodomain.freeyourgadget.gadgetbridge.service.btle.ServerTransactionBuilder)1