Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8335e15 authored by Martin Brabham's avatar Martin Brabham
Browse files

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
parent e9eaa367
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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
@@ -109,6 +111,10 @@ class HciMatchers(object):
        return hci_packets.LeEnhancedConnectionCompleteView(
            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):