类型为STEP_COUNT_DELTA时找不到BLE设备 [英] Unable to find BLE device when type is STEP_COUNT_DELTA
问题描述
我正在使用Google fit API连接Sony Smartband2频段. 我现在想做的就是扫描并索取设备.
I am using the Google fit API to connect with a Sony Smartband2 band. All I am trying to do right now, is scan and claim a device.
(遵循本健身ble指南)
当我将数据类型设置为TYPE_HEART_RATE_BPM时,我可以找到并声明我的设备的所有权.但是,当我将其设置为TYPE_STEP_COUNT_DELTA或TYPE_STEP_COUNT_CUMULATIVE时,无法找到该设备.
I can find and claim my device, when I set the data type as TYPE_HEART_RATE_BPM. However, when I set it to TYPE_STEP_COUNT_DELTA or TYPE_STEP_COUNT_CUMULATIVE, I am unable to find the device.
可能是什么问题? 我知道以后我还需要使用Sensors API,但是要找到该设备,我不需要它,对吧?
What maybe the issue? I know that later I will also need to use the Sensors API, but to find the device, I do not need it, right?
要构建api客户端,请执行以下操作:
To build the api client:
mApiClient = new GoogleApiClient.Builder(this)
.addApi(Fitness.BLE_API)
.addApi(Fitness.SENSORS_API)
.addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE))
.addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ))
.addScope(new Scope(Scopes.FITNESS_LOCATION_READ))
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
要扫描BLE设备:
PendingResult<Status> pendingResult = Fitness.BleApi.startBleScan(
mApiClient,
new StartBleScanRequest.Builder()
.setDataTypes(DataType.TYPE_HEART_RATE_BPM)
//.setDataTypes(DataType.TYPE_STEP_COUNT_DELTA)
//.setDataTypes(DataType.TYPE_STEP_COUNT_CUMULATIVE)
.setBleScanCallback(bleScanCallback)
.build());
在这里,当我使用任何注释的语句时,都不会得到任何结果.
Here, when I use any of the commented statements, I do not get any results.
任何帮助将不胜感激,谢谢.
Any help will be greatly appreciated, thank you.
推荐答案
SmartBand 2不会通过Sensors API传递步数.大多数乐队都没有.您可以从历史记录API中以更大的块(大约1分钟)获得步数,并将其与Sensor API中的BPM相匹配.
SmartBand 2 doesn't deliver step count through the Sensors API. Most bands don't. You can obtain step count from the History API in bigger chunks (EG ~1 min) and match that with BPM from the Sensor API.
我正在与多个品牌和乐队进行测试,但大多数都没有采取措施. SmartBand 2具有我测试过的所有频段中最高分辨率的BPM,包括售价是其价格的4倍的频段,因此,SmartBand 2是我日常使用和测试的个人选择-但我真的希望Sony可以添加实时升级到SmartBand 2或发布新的SmartBand.
I'm testing with multiple brands and bands and most don't deliver steps. The SmartBand 2 has the highest resolution BPM of any band I've tested, including bands that sell for 4x the price, and because of that the SmartBand 2 is my personal choice for everyday use and testing - but I really wish Sony would either add live steps to the SmartBand 2 or release a new SmartBand with it.
这篇关于类型为STEP_COUNT_DELTA时找不到BLE设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!