Bluetooth: Add skeleton for handling LE conn complete event

This patch adds a basic event handler for the LE Connection Complete
HCI event.

Change-Id: Iea099fe1b8c87fcd00d13e8793ebce8ced7adec6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2015-04-18 18:44:38 +03:00 committed by Anas Nashif
commit 391260d03c
2 changed files with 25 additions and 0 deletions

View file

@ -190,4 +190,17 @@ struct bt_hci_evt_le_meta_event {
uint8_t subevent;
} PACK_STRUCT;
#define BT_HCI_EVT_LE_CONN_COMPLETE 0x01
struct bt_hci_evt_le_conn_complete {
uint8_t status;
uint16_t handle;
uint8_t role;
uint8_t peer_addr_type;
uint8_t peer_addr[6];
uint16_t interval;
uint16_t latency;
uint16_t supv_timeout;
uint8_t clock_accuracy;
} PACK_STRUCT;
#endif /* __BT_HCI_H */

View file

@ -435,6 +435,15 @@ static void hci_num_completed_packets(struct bt_buf *buf)
}
}
static void le_conn_complete(struct bt_buf *buf)
{
struct bt_hci_evt_le_conn_complete *evt = (void *)buf->data;
uint16_t handle = sys_le16_to_cpu(evt->handle);
BT_DBG("status %u handle %u role %u peer_type %u\n", evt->status,
handle, evt->role, evt->peer_addr_type);
}
static void hci_le_meta_event(struct bt_buf *buf)
{
struct bt_hci_evt_le_meta_event *evt = (void *)buf->data;
@ -442,6 +451,9 @@ static void hci_le_meta_event(struct bt_buf *buf)
bt_buf_pull(buf, sizeof(*evt));
switch (evt->subevent) {
case BT_HCI_EVT_LE_CONN_COMPLETE:
le_conn_complete(buf);
break;
default:
BT_DBG("Unhandled LE event %x\n", evt->subevent);
break;