Add handle and timeout parameters to hci_le_create_conn

Now hci_le_create_conn is more consistent with hci_create_conn, both
have a handle out parameter and a timeout.
This commit is contained in:
Vinicius Costa Gomes 2010-07-09 19:33:49 -03:00
parent 239e874de0
commit 71716c2a00
3 changed files with 12 additions and 5 deletions

View File

@ -2701,7 +2701,8 @@ int hci_le_create_conn(int dd, uint16_t interval, uint16_t window,
bdaddr_t peer_bdaddr, uint8_t own_bdaddr_type,
uint16_t min_interval, uint16_t max_interval,
uint16_t latency, uint16_t supervision_timeout,
uint16_t min_ce_length, uint16_t max_ce_length)
uint16_t min_ce_length, uint16_t max_ce_length,
uint16_t *handle, int to)
{
struct hci_request rq;
le_create_connection_cp create_conn_cp;
@ -2730,7 +2731,7 @@ int hci_le_create_conn(int dd, uint16_t interval, uint16_t window,
rq.rparam = &conn_complete_rp;
rq.rlen = EVT_CONN_COMPLETE_SIZE;
if (hci_send_req(dd, &rq, 1000) < 0)
if (hci_send_req(dd, &rq, to) < 0)
return -1;
if (conn_complete_rp.status) {
@ -2738,5 +2739,8 @@ int hci_le_create_conn(int dd, uint16_t interval, uint16_t window,
return -1;
}
if (handle)
*handle = conn_complete_rp.handle;
return 0;
}

View File

@ -125,7 +125,8 @@ int hci_le_create_conn(int dd, uint16_t interval, uint16_t window,
bdaddr_t peer_bdaddr, uint8_t own_bdaddr_type,
uint16_t min_interval, uint16_t max_interval,
uint16_t latency, uint16_t supervision_timeout,
uint16_t min_ce_length, uint16_t max_ce_length);
uint16_t min_ce_length, uint16_t max_ce_length,
uint16_t *handle, int to);
int hci_for_each_dev(int flag, int(*func)(int dd, int dev_id, long arg), long arg);
int hci_get_route(bdaddr_t *bdaddr);

View File

@ -2485,7 +2485,7 @@ static void cmd_lecc(int dev_id, int argc, char **argv)
int err, opt, dd;
bdaddr_t bdaddr;
uint16_t interval, latency, max_ce_length, max_interval, min_ce_length;
uint16_t min_interval, supervision_timeout, window;
uint16_t min_interval, supervision_timeout, window, handle;
uint8_t initiator_filter, own_bdaddr_type, peer_bdaddr_type;
for_each_opt(opt, lecc_options, NULL) {
@ -2527,12 +2527,14 @@ static void cmd_lecc(int dev_id, int argc, char **argv)
err = hci_le_create_conn(dd, interval, window, initiator_filter,
peer_bdaddr_type, bdaddr, own_bdaddr_type, min_interval,
max_interval, latency, supervision_timeout,
min_ce_length, max_ce_length);
min_ce_length, max_ce_length, &handle, 25000);
if (err < 0) {
perror("Could not create connection");
exit(1);
}
printf("Connection handle %d\n", handle);
hci_close_dev(dd);
}