BLEMiBand2Helper.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:mi-band-2 作者:
public void readData(UUID service, UUID Characteristics) {
    if (!isConnectedToGatt || myGatBand == null) {
        Log.d(TAG, "Cant read from BLE, not initialized.");
        return;
    }

    Log.d(TAG, "* Getting gatt service, UUID:" + service.toString());
    BluetoothGattService myGatService =
            myGatBand.getService(service /*Consts.UUID_SERVICE_GENERIC*/);
    if (myGatService != null) {
        Log.d(TAG, "* Getting gatt Characteristic. UUID: " + Characteristics.toString());

        BluetoothGattCharacteristic myGatChar
                = myGatService.getCharacteristic(Characteristics /*Consts.UUID_CHARACTERISTIC_DEVICE_NAME*/);
        if (myGatChar != null) {
            Log.d(TAG, "* Reading data");

            boolean status =  myGatBand.readCharacteristic(myGatChar);
            Log.d(TAG, "* Read status :" + status);
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号