且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在使用不同版本的android设备进行扫描时,获取相同的BLE设备的不同byte [] scanRecorddata数据

更新时间:2023-01-03 20:25:53

这在BLE世界中很常见.当BLE设备 发布 多个 服务 时-扫描程序可以***进行 过滤 它需要什么或与此相关.我在HRM(心率监视器)设备中看到了类似的行为,该设备也可以同时用作Food Pod(配置文件-RSCP)-因此可以同时实现2种服务.

This is pretty common in BLE world. When a BLE device advertises multiple services - The scanner is free to filter what it needs or is relevant to it. I have seen similar behavior in a HRM (Heart Rate Monitor) device which doubles up as a Food Pod (profile - RSCP) as well - Hence implementing 2 services at the same time.

对于此类设备(托管多个服务),对BLE扫描结果制定类型解析策略是一种好习惯-例如,这可能是一个优先顺序:-

For such devices (hosting multiple services) it is a good practice to have a type resolution policy for BLE scan results - for example this may be an order of precedence:-

1. GAP Appearance  
2. GATT Service  

我上面提到的健身传感器( TICKR RUN (来自Wahoo )将GAP外观设置为833型HRM,并播发2个UUID s-HRP和RSCP.因此,从纯粹的扫描(广告)结果来看,我们得出的结论是,它仅是一种HRM设备.只有在连接到它以获取GATT服务后,您才获得完整的GATT UUID,并且事实证明它支持 RSCP (运行速度和踏频配置文件)和 HRP (心脏)费率资料)

The fitness sensor I mentioned above (TICKR RUN from Wahoo) sets GAP appearance to 833 belt type HRM and advertises 2 UUID s- HRP and RSCP. So going by sheer scan (advertisement) results we concluded it to be a HRM device only. Only after you connect to it for retrieving GATT services you get the full set of GATT UUIDs and it turned out to support RSCP (Running Speed and Cadence Profile) and HRP (Heart Rate Profile)

现在从扫描的角度来看-在发现阶段连接到每台设备都是昂贵的游戏,因此可以使用设备正在宣传的主要服务

Now from the perspective of scanning - it's a costly game to connect to each and every device in the discovery phase hence it might be OK to go with the primary service the device is advertising

HTH!