`
mmdev
  • 浏览: 12915732 次
  • 性别: Icon_minigender_1
  • 来自: 大连
文章分类
社区版块
存档分类
最新评论

使用blueZ进行蓝牙编程时需要注意的问题

 
阅读更多
一:不要用到哪个Bluez头文件中定义的内容就只去包含这个头文件。而应该将bluetooth/bluetooth.h最先加入。类似:
#include <bluetooth/bluetooth.h> //BTPROTO_HCI
#include <bluetooth/hci.h><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> //struct hci_dev_info<br> #include &lt;bluetooth/hci_lib.h&gt;<wbr><wbr><wbr><wbr> //hci_devid()<br> #include &lt;bluetooth/l2cap.h&gt;<wbr><wbr><wbr><wbr><wbr> //l2cap<br> #include &lt;bluetooth/hidp.h&gt;<wbr><wbr><wbr><wbr><wbr><wbr> //hidp<br><br><br> 二:因为Linux 下Bluetooth实现是通过socket来完成的。sa_family_t会被使用。<br> bluetooth/hci.h中就用到了。所以必须在include bluetooth header file之前,include socket header file.<br> #include &lt;sys/types.h&gt;<wbr><br> #include &lt;sys/socket.h&gt;<br> 否则就会出现类似以下问题:<br> bluetooth/hci.h:1091: error: expected specifier-qualifier-list before 'sa_family_t'</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics