From 10698ea86098d0fd86654c428c0db767ae201c0f Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 17 Dec 2014 15:38:16 +0100 Subject: [PATCH] emulator: Store own and peer address information for LE connections --- emulator/le.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/emulator/le.c b/emulator/le.c index a09cde270..30daa639f 100644 --- a/emulator/le.c +++ b/emulator/le.c @@ -101,6 +101,9 @@ struct bt_le { uint8_t le_scan_enable; uint8_t le_scan_filter_dup; + uint8_t le_conn_peer_addr_type; + uint8_t le_conn_peer_addr[6]; + uint8_t le_conn_own_addr_type; uint8_t le_conn_enable; uint8_t le_white_list_size; @@ -1008,6 +1011,13 @@ static void cmd_le_create_conn(struct bt_le *hci, return; } + /* Valid range for peer address type is 0x00 to 0x03 */ + if (cmd->peer_addr_type > 0x03) { + cmd_status(hci, BT_HCI_ERR_INVALID_PARAMETERS, + BT_HCI_CMD_LE_CREATE_CONN); + return; + } + /* Valid range for own address type is 0x00 to 0x03 */ if (cmd->own_addr_type > 0x03) { cmd_status(hci, BT_HCI_ERR_INVALID_PARAMETERS, @@ -1015,6 +1025,9 @@ static void cmd_le_create_conn(struct bt_le *hci, return; } + hci->le_conn_peer_addr_type = cmd->peer_addr_type; + memcpy(hci->le_conn_peer_addr, cmd->peer_addr, 6); + hci->le_conn_own_addr_type = cmd->own_addr_type; hci->le_conn_enable = 0x01; cmd_status(hci, BT_HCI_ERR_SUCCESS, BT_HCI_CMD_LE_CREATE_CONN); -- 2.47.3