Android Open Source - BLEService B T L E Command Write Characteristic

From Project

Back to project page BLEService.


The source code is released under:

Copyright (c) 2014, Ratio LLC. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...

If you think the Android project BLEService listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ratio.deviceService.command;
/*www . j  a v  a 2s.c o  m*/
import android.bluetooth.BluetoothGattCharacteristic;

import com.ratio.deviceService.BTLEDeviceManager;
import com.ratio.exceptions.DeviceManagerException;

 * queued command to write a characteristic
 * @author mreynolds
public class BTLECommandWriteCharacteristic extends BTLECommand {
  protected BluetoothGattCharacteristic mCharacteristic;
  public BTLECommandWriteCharacteristic(BTLEDeviceManager.BTDeviceInfo  deviceInfo,
                      BluetoothGattCharacteristic     characteristic) {
    mCharacteristic = characteristic;
  public boolean execute(BTLEDeviceManager deviceManager) throws DeviceManagerException {
    return mDeviceInfo.getGatt().writeCharacteristic(mCharacteristic);
  public String toString() {
    return BTLECommandWriteCharacteristic.class.getSimpleName() + " addr:" + mDeviceInfo.getDeviceAddress() +
         " characteristic:" + mCharacteristic.getUuid();

Java Source Code List