Unable to find BLE device when type is STEP_COUNT_DELTA

♀尐吖头ヾ 提交于 2019-12-25 01:44:52

问题


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.

(Following This Fitness ble guide )

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.

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?

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();

To scan for BLE device:

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.


回答1:


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.

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.



来源:https://stackoverflow.com/questions/46620944/unable-to-find-ble-device-when-type-is-step-count-delta

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!