UdooBluManager.java 文件源码

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

项目:UDOOBluLib-android 作者:
private void setNotification(final String address, final UDOOBLESensor udoobleSensor, final INotificationListener<byte[]> iNotificationListener) {
    if (isBluManagerReady) {
        addOperation(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                UUID servUuid = udoobleSensor.getService();
                UUID dataUuid = udoobleSensor.getData();
                BluetoothGattService serv = mUdooBluService.getService(address, servUuid);

                if (serv != null) {
                    BluetoothGattCharacteristic charac = serv.getCharacteristic(dataUuid);
                    mINotificationListenerMap.put(address + charac.getUuid().toString(), iNotificationListener);
                    mUdooBluService.setCharacteristicNotification(address, charac, true);
                    Log.i(TAG, "setNotification: ");
                } else if (iNotificationListener != null)
                    iNotificationListener.onError(new UdooBluException(UdooBluException.BLU_GATT_SERVICE_NOT_FOUND));
                return null;
            }
        });
    } else if (BuildConfig.DEBUG)
        Log.i(TAG, "BluManager not ready");
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号