使用BlueZ进行蓝牙编程时需要谨慎的问题
发布时间:2021-12-22 12:45:16 所属栏目:PHP教程 来源:互联网
导读:一:不要用到哪个Bluez头文件中定义的内容就只去包含这个头文件。而应该将bluetooth/bluetooth.h最先加入。类似: #include bluetooth/bluetooth.h //BTPROTO_HCI #include bluetooth/hci.h //struct hci_dev_info #include bluetooth/hci_lib.h //hci_devid(
一:不要用到哪个Bluez头文件中定义的内容就只去包含这个头文件。而应该将bluetooth/bluetooth.h最先加入。类似: #include <bluetooth/bluetooth.h> //BTPROTO_HCI #include <bluetooth/hci.h> //struct hci_dev_info #include <bluetooth/hci_lib.h> //hci_devid() #include <bluetooth/l2cap.h> //l2cap #include <bluetooth/hidp.h> //hidp 二:因为Linux 下Bluetooth实现是通过socket来完成的。sa_family_t会被使用。 bluetooth/hci.h中就用到了。所以必须在include bluetooth header file之前,include socket header file. #include <sys/types.h> #include <sys/socket.h> 否则就会出现类似以下问题: bluetooth/hci.h:1091: error: expected specifier-qualifier-list before 'sa_family_t' ![]() (编辑:云计算网_泰州站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |