5bb864e1fc775087
V2EX  ›  问与答

安卓开发低功耗蓝牙有个小问题请教下

  •  
  •   5bb864e1fc775087 · Feb 8, 2020 · 761 views
    This topic created in 2292 days ago, the information mentioned may be changed or developed.

    我想判断某个 Service 的某个 Characteristic 能不能用 notify 连接

    已知某个 Characteristic 的 property 为 48
    安卓内部类 android.bluetooth.BluetoothGattCharacteristic 里面有个常量 PROPERTY_NOTIFY 的值的十进制为 16

    通过下面这样判断对不对?

    int property = 48
    boolean canNotify = (int)(property & android.bluetooth.BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3142 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 12:40 · PVG 20:40 · LAX 05:40 · JFK 08:40
    ♥ Do have faith in what you're doing.