From aa46295964be4173b9376ec3e020534c06e60ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martijn=20The=CC=81?= <martijn@pebble.com> Date: Mon, 25 Apr 2016 16:53:51 +0200 Subject: [PATCH] Bluetooth: add LE Create Connection Cancel packet --- scapy/layers/bluetooth.py | 4 ++++ test/bluetooth.uts | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/scapy/layers/bluetooth.py b/scapy/layers/bluetooth.py index d9b258c1..c6081814 100644 --- a/scapy/layers/bluetooth.py +++ b/scapy/layers/bluetooth.py @@ -479,6 +479,9 @@ class HCI_Cmd_LE_Create_Connection(Packet): LEShortField("min_ce", 0), LEShortField("max_ce", 0), ] +class HCI_Cmd_LE_Create_Connection_Cancel(Packet): + name = "LE Create Connection Cancel" + class HCI_Cmd_LE_Read_Buffer_Size(Packet): name = "LE Read Buffer Size" @@ -611,6 +614,7 @@ bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Set_Advertise_Enable, opcode=0x200a) bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Set_Scan_Parameters, opcode=0x200b) bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Set_Scan_Enable, opcode=0x200c) bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Create_Connection, opcode=0x200d) +bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Create_Connection_Cancel, opcode=0x200e) bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Long_Term_Key_Request_Reply, opcode=0x201a) bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Long_Term_Key_Request_Negative_Reply, opcode=0x201b) diff --git a/test/bluetooth.uts b/test/bluetooth.uts index 4613e4e0..0f3e8c02 100644 --- a/test/bluetooth.uts +++ b/test/bluetooth.uts @@ -1,5 +1,12 @@ % Scapy Bluetooth layer tests ++ HCI Commands += LE Create Connection Cancel + +expected_cmd_raw_data = "010e2000".decode('hex') +cmd_raw_data = str(HCI_Hdr() / HCI_Command_Hdr() / HCI_Cmd_LE_Create_Connection_Cancel()) +assert(expected_cmd_raw_data == cmd_raw_data) + + Bluetooth LE Advertising / Scan Response Data Parsing = Parse EIR_Flags, EIR_CompleteList16BitServiceUUIDs, EIR_CompleteLocalName and EIR_TX_Power_Level -- GitLab