gpt4 book ai didi

Android 如何读取 BLE 属性 Readable Writable Notifiable GATT Characteristics

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:00:16 25 4
gpt4 key购买 nike

如何读取 BluetoothGattCharacteristic 属性,例如 ReadableWritableNotifiable

最佳答案

    /**
* @return Returns <b>true</b> if property is writable
*/
public static boolean isCharacteristicWritable(BluetoothGattCharacteristic pChar) {
return (pChar.getProperties() & (BluetoothGattCharacteristic.PROPERTY_WRITE | BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE)) != 0;
}

/**
* @return Returns <b>true</b> if property is Readable
*/
public static boolean isCharacteristicReadable(BluetoothGattCharacteristic pChar) {
return ((pChar.getProperties() & BluetoothGattCharacteristic.PROPERTY_READ) != 0);
}

/**
* @return Returns <b>true</b> if property is supports notification
*/
public boolean isCharacteristicNotifiable(BluetoothGattCharacteristic pChar) {
return (pChar.getProperties() & BluetoothGattCharacteristic.PROPERTY_NOTIFY) != 0;
}

关于Android 如何读取 BLE 属性 Readable Writable Notifiable GATT Characteristics,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21300915/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com