diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2011-02-22 18:42:06 -0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2011-02-23 00:27:20 -0300 |
commit | 5edfc482ca039687be3db30340937516f13c4385 (patch) | |
tree | 7f9925ee62010308a3f408c85d43389b268b45bf /lib/hci.c | |
parent | 8e7af67a19addfcb7558fa36f7802d38b2bf185a (diff) | |
download | bluez-5edfc482ca039687be3db30340937516f13c4385.tar.gz |
Add hci utility function to change LE connection parameters
Diffstat (limited to 'lib/hci.c')
-rw-r--r-- | lib/hci.c | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -2767,3 +2767,40 @@ int hci_le_create_conn(int dd, uint16_t interval, uint16_t window, return 0; } + +int hci_le_conn_update(int dd, uint16_t handle, uint16_t min_interval, + uint16_t max_interval, uint16_t latency, + uint16_t supervision_timeout, int to) +{ + evt_le_connection_update_complete evt; + le_connection_update_cp cp; + struct hci_request rq; + + memset(&cp, 0, sizeof(cp)); + cp.handle = handle; + cp.min_interval = min_interval; + cp.max_interval = max_interval; + cp.latency = latency; + cp.supervision_timeout = supervision_timeout; + cp.min_ce_length = htobs(0x0001); + cp.max_ce_length = htobs(0x0001); + + memset(&rq, 0, sizeof(rq)); + rq.ogf = OGF_LE_CTL; + rq.ocf = OCF_LE_CONN_UPDATE; + rq.cparam = &cp; + rq.clen = LE_CONN_UPDATE_CP_SIZE; + rq.event = EVT_LE_CONN_UPDATE_COMPLETE; + rq.rparam = &evt; + rq.rlen = sizeof(evt); + + if (hci_send_req(dd, &rq, to) < 0) + return -1; + + if (evt.status) { + errno = EIO; + return -1; + } + + return 0; +} |