summaryrefslogtreecommitdiff
path: root/lib/hci.c
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2010-07-08 16:09:37 -0300
committerVinicius Costa Gomes <vinicius.gomes@openbossa.org>2010-07-08 21:05:36 -0300
commit0e20e20eebd88393b212d65aca3e8e184b98c6f7 (patch)
treef0de28a88fcfaa6e5b4162c98b088f27c58336a7 /lib/hci.c
parent032fc6f086809f64366a9754e13fc64093b21480 (diff)
downloadbluez-0e20e20eebd88393b212d65aca3e8e184b98c6f7.tar.gz
Add support for LE Events to libbluetooth
Now we can receive and deal with LE Events, which are encoded inside a LE Meta Event, using the low-level libbluetooth.
Diffstat (limited to 'lib/hci.c')
-rw-r--r--lib/hci.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/hci.c b/lib/hci.c
index 3b2baf964..a1538ac0c 100644
--- a/lib/hci.c
+++ b/lib/hci.c
@@ -1093,6 +1093,7 @@ int hci_send_req(int dd, struct hci_request *r, int to)
hci_filter_set_ptype(HCI_EVENT_PKT, &nf);
hci_filter_set_event(EVT_CMD_STATUS, &nf);
hci_filter_set_event(EVT_CMD_COMPLETE, &nf);
+ hci_filter_set_event(EVT_LE_META_EVENT, &nf);
hci_filter_set_event(r->event, &nf);
hci_filter_set_opcode(opcode, &nf);
if (setsockopt(dd, SOL_HCI, HCI_FILTER, &nf, sizeof(nf)) < 0)
@@ -1106,6 +1107,7 @@ int hci_send_req(int dd, struct hci_request *r, int to)
evt_cmd_complete *cc;
evt_cmd_status *cs;
evt_remote_name_req_complete *rn;
+ evt_le_meta_event *me;
remote_name_req_cp *cp;
int len;
@@ -1186,6 +1188,17 @@ int hci_send_req(int dd, struct hci_request *r, int to)
memcpy(r->rparam, ptr, r->rlen);
goto done;
+ case EVT_LE_META_EVENT:
+ me = (void *) ptr;
+
+ if (me->subevent != r->event)
+ continue;
+
+ len -= 1;
+ r->rlen = MIN(len, r->rlen);
+ memcpy(r->rparam, me->data, r->rlen);
+ goto done;
+
default:
if (hdr->evt != r->event)
break;