我是bluez的新用户,我正在尝试使用bluez API并使用NDK开发本机代码c,以使android 4.0.3支持BLE

我阅读了Bluez的代码源,但找不到与连接GATT一样的确切功能.

任何帮助将不胜感激.

谢谢!

解决方法:

我认为您在尝试通过阅读Bluez源代码来弄清所需内容时走了正确的路,但是您需要确切地了解要查找的内容.如果您只想实现BLE功能,请从here获取bluez包,并查看实现大多数BLE功能的两个特定源文件:

>工具/hcitool.c

> attrib / gatttool.c

通常,基本的blueZ shell命令为:

hcitool lescan #scanning for LE devices

hcitool lecc #connecting to LE devices

hcitool ledc #disconnecting from LE devices

gatttool -b --primary #discover primary services

gatttool -b --characteristics #discover characteristics

gatttool -b --char-read #read characteristic value

gatttool -b --char-write #write to a characteristic value

然后,您可以通过在上述源文件中查找那些命令并查看其执行方式来进行一些反向工程.

我希望这至少可以为您指明正确的方向.

标签:bluetooth-lowenergy,bluez,linux,android

来源: https://codeday.me/bug/20191121/2055816.html

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐