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

Commit 6d141b5c authored by Zach Johnson's avatar Zach Johnson Committed by Gerrit Code Review
Browse files

Merge "use common data + payload for hci & hal facades"

parents 92b6b1fe f280adfc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -46,8 +46,8 @@ from cert.os_utils import is_subprocess_alive
from cert.os_utils import make_ports_available
from cert.os_utils import TerminalColor
from facade import rootservice_pb2_grpc as facade_rootservice_pb2_grpc
from hal import facade_pb2_grpc as hal_facade_pb2_grpc
from hci.facade import facade_pb2_grpc as hci_facade_pb2_grpc
from hal import hal_facade_pb2_grpc
from hci.facade import hci_facade_pb2_grpc
from hci.facade import acl_manager_facade_pb2_grpc
from hci.facade import controller_facade_pb2_grpc
from hci.facade import le_acl_manager_facade_pb2_grpc
+4 −4
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ from cert.closable import Closable
from cert.closable import safeClose
from cert.captures import HciCaptures
from cert.truth import assertThat
from hal import facade_pb2 as hal_facade
from bluetooth_packets_python3.hci_packets import WriteScanEnableBuilder
from bluetooth_packets_python3.hci_packets import ScanEnable
from bluetooth_packets_python3.hci_packets import AclBuilder
@@ -50,6 +49,7 @@ from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingEnable
from bluetooth_packets_python3.hci_packets import LeSetExtendedScanEnableBuilder
from bluetooth_packets_python3.hci_packets import EnabledSet
from bluetooth_packets_python3.hci_packets import OpCode
from facade import common_pb2 as common


class PyHalAclConnection(IEventStream):
@@ -61,7 +61,7 @@ class PyHalAclConnection(IEventStream):

    def send(self, pb_flag, b_flag, data):
        acl = AclBuilder(self.handle, pb_flag, b_flag, RawBuilder(data))
        self.device.hal.SendAcl(hal_facade.AclPacket(payload=bytes(acl.Serialize())))
        self.device.hal.SendAcl(common.Data(payload=bytes(acl.Serialize())))

    def send_first(self, data):
        self.send(PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE, BroadcastFlag.POINT_TO_POINT, bytes(data))
@@ -138,11 +138,11 @@ class PyHal(Closable):
        return self.acl_stream

    def send_hci_command(self, command):
        self.device.hal.SendCommand(hal_facade.Command(payload=bytes(command.Serialize())))
        self.device.hal.SendCommand(common.Data(payload=bytes(command.Serialize())))

    def send_acl(self, handle, pb_flag, b_flag, data):
        acl = AclBuilder(handle, pb_flag, b_flag, RawBuilder(data))
        self.device.hal.SendAcl(hal_facade.AclPacket(payload=bytes(acl.Serialize())))
        self.device.hal.SendAcl(common.Data(payload=bytes(acl.Serialize())))

    def send_acl_first(self, handle, data):
        self.send_acl(handle, PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE, BroadcastFlag.POINT_TO_POINT, data)
+8 −6
Original line number Diff line number Diff line
@@ -23,7 +23,8 @@ from cert.closable import safeClose
from cert.captures import HciCaptures
from bluetooth_packets_python3 import hci_packets
from cert.truth import assertThat
from hci.facade import facade_pb2 as hci_facade
from hci.facade import hci_facade_pb2 as hci_facade
from facade import common_pb2 as common
from cert.matchers import HciMatchers
from bluetooth_packets_python3.hci_packets import FilterDuplicates
from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingLegacyParametersBuilder
@@ -44,6 +45,8 @@ from bluetooth_packets_python3.hci_packets import LeSetExtendedAdvertisingEnable
from bluetooth_packets_python3.hci_packets import LeSetExtendedScanEnableBuilder
from bluetooth_packets_python3.hci_packets import EnabledSet
from bluetooth_packets_python3.hci_packets import OpCode
from bluetooth_packets_python3.hci_packets import AclBuilder
from bluetooth_packets_python3 import RawBuilder


class PyHciAclConnection(IEventStream):
@@ -55,9 +58,8 @@ class PyHciAclConnection(IEventStream):
        self.our_acl_stream = FilteringEventStream(acl_stream, None)

    def send(self, pb_flag, b_flag, data):
        acl_msg = hci_facade.AclPacket(
            handle=self.handle, packet_boundary_flag=int(pb_flag), broadcast_flag=int(b_flag), data=data)
        self.device.hci.SendAcl(acl_msg)
        acl = AclBuilder(self.handle, pb_flag, b_flag, RawBuilder(data))
        self.device.hci.SendAcl(common.Data(payload=bytes(acl.Serialize())))

    def send_first(self, data):
        self.send(hci_packets.PacketBoundaryFlag.FIRST_AUTOMATICALLY_FLUSHABLE,
@@ -149,10 +151,10 @@ class PyHci(Closable):
            self.device.hci.RequestLeSubevent(hci_facade.EventRequest(code=int(event_code)))

    def send_command_with_complete(self, command):
        self.device.hci.SendCommandWithComplete(hci_facade.Command(payload=bytes(command.Serialize())))
        self.device.hci.SendCommandWithComplete(common.Data(payload=bytes(command.Serialize())))

    def send_command_with_status(self, command):
        self.device.hci.SendCommandWithStatus(hci_facade.Command(payload=bytes(command.Serialize())))
        self.device.hci.SendCommandWithStatus(common.Data(payload=bytes(command.Serialize())))

    def enable_inquiry_and_page_scan(self):
        self.send_command_with_complete(
+0 −1
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ from cert.truth import assertThat
from datetime import timedelta
from facade import common_pb2 as common
from google.protobuf import empty_pb2 as empty_proto
from hci.facade import facade_pb2 as hci_facade
from security.facade_pb2 import IoCapabilityMessage
from security.facade_pb2 import AuthenticationRequirementsMessage
from security.facade_pb2 import LeAuthRequirementsMessage
+0 −1
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ from cert.event_stream import EventStream
from cert.truth import assertThat
from facade import common_pb2 as common
from google.protobuf import empty_pb2 as empty_proto
from hci.facade import facade_pb2 as hci_facade

from security.facade_pb2 import AuthenticationRequirements
from security.facade_pb2 import AuthenticationRequirementsMessage
Loading