Here is the code snippet which will send connection parameters update request:
static void UpdateConnParams(uint16_t handle ,uint16_t min, uint16_t max )
{
int dev_id = -1;
uint16_t latency, timeout;
int dd;
printf("\n Connection Parameters update !!");
latency = 0x0007;
timeout = 0x0C80;
if (dev_id < 0)
dev_id = hci_get_route(NULL);
dd = hci_open_dev(dev_id);
if (dd < 0) {
fprintf(stderr, "HCI device open failed\n");
exit(1);
}
if (hci_le_conn_update(dd, htobs(handle), htobs(min), htobs(max),
htobs(latency), htobs(timeout), 5000) < 0) {
int err = -errno;
fprintf(stderr, "Could not change connection params: %s(%d)\n",
strerror(-err), -err);
}
hci_close_dev(dd);
}
static void UpdateConnParams(uint16_t handle ,uint16_t min, uint16_t max )
{
int dev_id = -1;
uint16_t latency, timeout;
int dd;
printf("\n Connection Parameters update !!");
latency = 0x0007;
timeout = 0x0C80;
if (dev_id < 0)
dev_id = hci_get_route(NULL);
dd = hci_open_dev(dev_id);
if (dd < 0) {
fprintf(stderr, "HCI device open failed\n");
exit(1);
}
if (hci_le_conn_update(dd, htobs(handle), htobs(min), htobs(max),
htobs(latency), htobs(timeout), 5000) < 0) {
int err = -errno;
fprintf(stderr, "Could not change connection params: %s(%d)\n",
strerror(-err), -err);
}
hci_close_dev(dd);
}
No comments:
Post a Comment