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.
package com.ratio.deviceService.command; // ww w .j av a 2s .co m import android.bluetooth.BluetoothGattDescriptor; import com.ratio.BTDeviceService.R; import com.ratio.deviceService.BTLEDeviceManager; import com.ratio.exceptions.DeviceManagerException; /** * queued command to write to a BTLE descriptor * @author mreynolds * */ public class BTLECommandReadDescriptor extends BTLECommand { protected BluetoothGattDescriptor mDescriptor; public BTLECommandReadDescriptor(BTLEDeviceManager.BTDeviceInfo deviceInfo, BluetoothGattDescriptor descriptor) { super(deviceInfo); mDescriptor = descriptor; } public boolean execute(BTLEDeviceManager deviceManager) throws DeviceManagerException { if (!mDeviceInfo.getGatt().readDescriptor(mDescriptor)) { throw new DeviceManagerException(String.format("%s %s %s", deviceManager.getContext().getString(R.string.read_descriptor_failed), mDeviceInfo.getDeviceAddress(), mDescriptor.getUuid())); } return true; } public String toString() { return BTLECommandReadDescriptor.class.getSimpleName() + " addr:" + mDeviceInfo.getDeviceAddress() + " characteristic:" + mDescriptor.getCharacteristic().getUuid() + " descriptor:" + mDescriptor.getUuid(); } }