Skip to content
Snippets Groups Projects
Commit 0edbfeaf authored by Pierre Lalet's avatar Pierre Lalet
Browse files

Merge pull request #132 from pebble/pebble-master

Bluetooth: Add HCI LE Create Connection Cancel & HCI Disconnect packets
parents fa299812 1a99f355
No related branches found
No related tags found
No related merge requests found
...@@ -464,6 +464,11 @@ class HCI_Cmd_LE_Set_Scan_Enable(Packet): ...@@ -464,6 +464,11 @@ class HCI_Cmd_LE_Set_Scan_Enable(Packet):
fields_desc = [ ByteField("enable", 1), fields_desc = [ ByteField("enable", 1),
ByteField("filter_dups", 1), ] ByteField("filter_dups", 1), ]
class HCI_Cmd_Disconnect(Packet):
name = "Disconnect"
fields_desc = [ XLEShortField("handle", 0),
ByteField("reason", 0x13), ]
class HCI_Cmd_LE_Create_Connection(Packet): class HCI_Cmd_LE_Create_Connection(Packet):
name = "LE Create Connection" name = "LE Create Connection"
fields_desc = [ LEShortField("interval", 96), fields_desc = [ LEShortField("interval", 96),
...@@ -479,6 +484,9 @@ class HCI_Cmd_LE_Create_Connection(Packet): ...@@ -479,6 +484,9 @@ class HCI_Cmd_LE_Create_Connection(Packet):
LEShortField("min_ce", 0), LEShortField("min_ce", 0),
LEShortField("max_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): class HCI_Cmd_LE_Read_Buffer_Size(Packet):
name = "LE Read Buffer Size" name = "LE Read Buffer Size"
...@@ -610,7 +618,9 @@ bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Set_Advertising_Data, opcode=0x2008) ...@@ -610,7 +618,9 @@ bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Set_Advertising_Data, opcode=0x2008)
bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Set_Advertise_Enable, opcode=0x200a) 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_Parameters, opcode=0x200b)
bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Set_Scan_Enable, opcode=0x200c) bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Set_Scan_Enable, opcode=0x200c)
bind_layers( HCI_Command_Hdr, HCI_Cmd_Disconnect, opcode=0x406)
bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Create_Connection, opcode=0x200d) 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_Reply, opcode=0x201a)
bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Long_Term_Key_Request_Negative_Reply, opcode=0x201b) bind_layers( HCI_Command_Hdr, HCI_Cmd_LE_Long_Term_Key_Request_Negative_Reply, opcode=0x201b)
......
% Scapy Bluetooth layer tests % 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)
= Disconnect
expected_cmd_raw_data = "01060403341213".decode('hex')
cmd_raw_data = str(HCI_Hdr() / HCI_Command_Hdr() / HCI_Cmd_Disconnect(handle=0x1234))
assert(expected_cmd_raw_data == cmd_raw_data)
+ Bluetooth LE Advertising / Scan Response Data Parsing + Bluetooth LE Advertising / Scan Response Data Parsing
= Parse EIR_Flags, EIR_CompleteList16BitServiceUUIDs, EIR_CompleteLocalName and EIR_TX_Power_Level = Parse EIR_Flags, EIR_CompleteList16BitServiceUUIDs, EIR_CompleteLocalName and EIR_TX_Power_Level
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment