本文整理匯總了Java中android.bluetooth.BluetoothGattCharacteristic.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java BluetoothGattCharacteristic.equals方法的具體用法?Java BluetoothGattCharacteristic.equals怎麽用?Java BluetoothGattCharacteristic.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.bluetooth.BluetoothGattCharacteristic
的用法示例。
在下文中一共展示了BluetoothGattCharacteristic.equals方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCharacteristicReadRequest
import android.bluetooth.BluetoothGattCharacteristic; //導入方法依賴的package包/類
@Override
public void onCharacteristicReadRequest(
BluetoothDevice device,
int requestId,
int offset,
BluetoothGattCharacteristic chr) {
int status = BluetoothGatt.GATT_FAILURE;
byte[] bytes = null;
if (offset != 0) {
status = BluetoothGatt.GATT_INVALID_OFFSET;
} else if (chr.equals(U2FGattService.U2F_CONTROL_POINT_LENGTH)) {
status = BluetoothGatt.GATT_SUCCESS;
bytes = new byte[] { 0x02, 0x00 }; /* Length == 512, see U2F BT 6.1 */
} else if (chr.equals(U2FGattService.U2F_SERVICE_REVISION_BITFIELD)) {
status = BluetoothGatt.GATT_SUCCESS;
bytes = new byte[] { 0x40 }; /* Version == 1.2, see U2F BT 6.1 */
}
Log.d(getClass().getCanonicalName(), Integer.valueOf(bytes.length).toString());
mGattServer.sendResponse(device, requestId, status, 0, bytes);
}
示例2: onCharacteristicWriteRequest
import android.bluetooth.BluetoothGattCharacteristic; //導入方法依賴的package包/類
@Override
public void onCharacteristicWriteRequest(
BluetoothDevice device,
int requestId,
BluetoothGattCharacteristic chr,
boolean preparedWrite,
boolean responseNeeded,
int offset,
byte[] value) {
int status = BluetoothGatt.GATT_FAILURE;
if (offset != 0) {
status = BluetoothGatt.GATT_INVALID_OFFSET;
} else if (chr.equals(U2FGattService.U2F_CONTROL_POINT)) {
status = BluetoothGatt.GATT_SUCCESS;
// TODO
} else if (chr.equals(U2FGattService.U2F_SERVICE_REVISION_BITFIELD)) {
status = BluetoothGatt.GATT_SUCCESS;
}
mGattServer.sendResponse(device, requestId, status, 0, null);
}
示例3: onCharacteristicWrite
import android.bluetooth.BluetoothGattCharacteristic; //導入方法依賴的package包/類
@Override
public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
super.onCharacteristicWrite(gatt, characteristic, status);
if (characteristic.equals(charSerial) && status == BluetoothGatt.GATT_SUCCESS) {
messenger.obtainMessage(MessageConstants.ACTION, ActionCode.WriteNext).sendToTarget();
} else {
messenger.obtainMessage(MessageConstants.ERROR, ErrorCode.Send).sendToTarget();
}
}
示例4: onCharacteristicChanged
import android.bluetooth.BluetoothGattCharacteristic; //導入方法依賴的package包/類
@Override
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
super.onCharacteristicChanged(gatt, characteristic);
if (characteristic.equals(charSerial)) {
messenger.obtainMessage(MessageConstants.READ, characteristic.getValue()).sendToTarget();
}
}