Diff between ac2998a117070171de20c5970c973f2700a3ba64 and f61edaad86cdaddbce3ed24b746aa86b8ef1a20b

Changed Files

File Additions Deletions Status
emulator/bthost.c +14 -0 modified
emulator/bthost.h +3 -0 modified

Full Patch

diff --git a/emulator/bthost.c b/emulator/bthost.c
index 0c5836f..03d5d75 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
@@ -1159,6 +1159,20 @@ void bthost_set_adv_enable(struct bthost *bthost, uint8_t enable)
 	send_command(bthost, BT_HCI_CMD_LE_SET_ADV_ENABLE, &enable, 1);
 }
 
+void bthost_le_start_encrypt(struct bthost *bthost, uint16_t handle,
+							const uint8_t ltk[16])
+{
+	struct bt_hci_cmd_le_start_encrypt cmd;
+
+	printf("bthost_le_start_encrypt(handle %u)\n", handle);
+
+	memset(&cmd, 0, sizeof(cmd));
+	cmd.handle = htobs(handle);
+	memcpy(cmd.ltk, ltk, 16);
+
+	send_command(bthost, BT_HCI_CMD_LE_START_ENCRYPT, &cmd, sizeof(cmd));
+}
+
 void bthost_set_server_psm(struct bthost *bthost, uint16_t psm)
 {
 	bthost->server_psm = psm;
diff --git a/emulator/bthost.h b/emulator/bthost.h
index 32b10f9..474ada9 100644
--- a/emulator/bthost.h
+++ b/emulator/bthost.h
@@ -72,6 +72,9 @@ void bthost_write_scan_enable(struct bthost *bthost, uint8_t scan);
 
 void bthost_set_adv_enable(struct bthost *bthost, uint8_t enable);
 
+void bthost_le_start_encrypt(struct bthost *bthost, uint16_t handle,
+							const uint8_t ltk[16]);
+
 void bthost_set_server_psm(struct bthost *bthost, uint16_t psm);
 
 void bthost_start(struct bthost *bthost);