我有一个在 BLE 外围设备上运行的纯 C 应用程序,它再现了一些 bluez 代码。
在 le_set_advertising_parameters_cp 中,我看到了 min_interval 和 max_interval 但我没有看到任何监督超时字段。
typedef struct {
uint16_t min_interval;
uint16_t max_interval;
uint8_t advtype;
uint8_t own_bdaddr_type;
uint8_t direct_bdaddr_type;
bdaddr_t direct_bdaddr;
uint8_t chan_map;
uint8_t filter;
} __attribute__ ((packed)) le_set_advertising_parameters_cp;
是否还有其他具有监督超时功能的广告参数(扩展???)?
我知道 hcitool 中的以下代码:
hci_write_link_supervision_timeout(device_handle, htobs(cr->conn_info->handle), timeout, 1000);
但是在我自己的代码中,一旦建立连接,我就无法获得中央设备的句柄——我也想知道在连接后更改监督超时是否为时不晚。
ioctl(device_handle, HCIGETCONNINFO, (unsigned long) cr);
失败并出现“没有这样的文件或目录”错误,尽管我确定中央设备已连接。
我也试过玩:
/sys/kernel/debug/bluetooth/hci0/supervision_timeout
但是没有效果。
如何从用户空间更改监督超时?