作者herboy (洋葱)
看板AndroidDev
标题[问题] ANDROID BLE Notification s
时间Mon Jul 28 11:53:21 2014
各位前辈好,小弟最近在研究Android BLE
设定Notifications时遇到一些奇怪的问题
我的做法是参考官方SDK的说明
private BluetoothGatt mBluetoothgatt;
BluetoothGattCharacteristic characteristic;
boolean enabled;
...
mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);
...
BluetoothGattDescriptor descriptor = characteristic.getDescriptor(
UUID.formString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
mBluetoothGatt.writeDescriptor(descriptor);
然後callback用onCharacteristicChanged()实现
测试的时候用Battery Level没有问题
可以正确的回传装置电池电量
但是当我把sUUID改成血糖用的Glucose
cUUID改成Glucose Measurement和
Glucose Measurement Context时,
(装置是支援BLE的血糖机)
却发现他连onCharacteristicChanged()这个callback都没有进去...
所以想请问有开发过类似设备app的前辈
在Glucose或Heart Rate等类似Service的Notifications写法是否有不同
我有点不能理解为什麽一样使用setCharacteristicNotification
Battery Level的情况可以,其他却不行
PS : LogCat有显示setChatacteristicNotofication,
但是却没有进到onCharacteristicChanged()
恳请解答,卡了一阵子了…
感谢各位
-----
Sent from JPTT on my Samsung GT-I9300.
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 223.143.182.245
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/AndroidDev/M.1406519607.A.816.html