简体   繁体   English

使用自定义GATT服务的Web蓝牙?

[英]Web Bluetooth with a Custom GATT Service?

First, the source code for the BLE Peripheral Simulator is a tremendous resource for anyone investigating Web Bluetooth. 首先, BLE外设模拟器源代码对于任何研究Web蓝牙的人来说都是一个巨大的资源。

There is a an approved list of GATT Services . 有一份经批准的关贸总协定服务清单。

When I modified the Android source code to use a custom defined GATT service (easy to do by simply specifying your own UUID in the Android code) pairing from the web page to the Android app running the GATT sever fails. 当我修改Android源代码以使用自定义GATT服务时(通过在Android代码中简单地指定您自己的UUID很容易),从网页到运行GATT服务器的Android应用程序的配对失败。

The Web Bluetooth documentation does state, "If device's advertised Service UUIDs have a non-empty intersection with the set of Service UUIDs, add device to result and abort these sub-steps [for pairing]." Web蓝牙文档确实声明:“如果设备公布的服务UUID与服务UUID集合具有非空交集,则将设备添加到结果并中止这些子步骤[用于配对]。”

Does this mean only services in the approved GATT list are supported? 这是否仅支持批准的关贸总协定清单中的服务? If so, what is the rational? 如果是这样,理性是什么? It seems that such a restriction would limit innovation. 似乎这种限制会限制创新。

If I had done some more research on Stack Overflow I would have realized the UUID spec requires lowercase af. 如果我对Stack Overflow做了更多研究,我会意识到UUID规范要求小写af。 Type of Character generated by UUID UUID生成的字符类型

The following values work for a custom defined service and characteristic: 以下值适用于自定义定义的服务和特征:

private static final UUID SERVICE_UUID = UUID.fromString("29143321-ef6c-4761-947c-c858f9a2e8f1"); private static final UUID SERVICE_UUID = UUID.fromString(“29143321-ef6c-4761-947c-c858​​f9a2e8f1”);

private static final UUID CHARACTERISTIC_UUID = UUID.fromString("92f3131b-ffa8-4dd1-a12b-641d65a78857"); private static final UUID CHARACTERISTIC_UUID = UUID.fromString(“92f3131b-ffa8-4dd1-a12b-641d65a78857”);

I am working with web-bluetooth also and i was able to talk with custom services, yet to read data from them you have to have device docs explaining how to talk to that services. 我也在使用网络蓝牙,我能够与自定义服务交谈,但是要从他们那里读取数据,你必须有设备文档解释如何与该服务进行通信。 I think this approved list is like generally used list which doesn't require unique logic to get data. 我认为这个批准的列表就像一般使用的列表,它不需要唯一的逻辑来获取数据。 However there is difference since some characteristics are blacklisted for web-bluetooth yet available to fetch data from using ios/android stuff. 然而,由于某些特征被列入黑名单,因为有些特征可用于从使用ios / android的东西获取数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM