From 5ad566009142cf99dcae7a758b9a83fe7df9a1b7 Mon Sep 17 00:00:00 2001 From: Martin Brabham Date: Thu, 12 Nov 2020 16:39:16 -0800 Subject: [PATCH] HciMatchers: Add OOB Related events. Additionally, add a useful Logger function that assisted with solving the problem. Bug: 162984360 Tag: #gd-refactor Test: cert/run --host SecurityTest Change-Id: I7d3ccb1593295204d09188f3a0b24b3fbdf3fe14 --- gd/cert/matchers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gd/cert/matchers.py b/gd/cert/matchers.py index edeecf6c6..ca181cb86 100644 --- a/gd/cert/matchers.py +++ b/gd/cert/matchers.py @@ -15,6 +15,8 @@ # limitations under the License. import bluetooth_packets_python3 as bt_packets +import logging + from bluetooth_packets_python3 import hci_packets from bluetooth_packets_python3.hci_packets import EventCode from bluetooth_packets_python3 import l2cap_packets @@ -110,6 +112,10 @@ class HciMatchers(object): HciMatchers._extract_matching_le_event(packet_bytes, hci_packets.SubeventCode.ENHANCED_CONNECTION_COMPLETE)) @staticmethod + def LogEventCode(): + return lambda event: logging.info("Received event: %x" % hci_packets.EventPacketView(bt_packets.PacketViewLittleEndian(list(event.event))).GetEventCode()) + + @staticmethod def LinkKeyRequest(): return lambda event: HciMatchers.EventWithCode(EventCode.LINK_KEY_REQUEST) @@ -153,6 +159,10 @@ class HciMatchers(object): def DisconnectionComplete(): return lambda event: HciMatchers.EventWithCode(EventCode.DISCONNECTION_COMPLETE) + @staticmethod + def RemoteOobDataRequest(): + return lambda event: HciMatchers.EventWithCode(EventCode.REMOTE_OOB_DATA_REQUEST) + class NeighborMatchers(object): -- 2.11.0