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

Commit b7c787a0 authored by Zach Johnson's avatar Zach Johnson
Browse files

Simplify ACL sending in SimpleHalTest

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --host
Change-Id: Ie9108602b0b23701a0cf9c98c4a3f314db389dd1
parent 9e612045
Loading
Loading
Loading
Loading
+6 −16
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ from facade import rootservice_pb2 as facade_rootservice_pb2
from hal import facade_pb2 as hal_facade_pb2
from bluetooth_packets_python3 import hci_packets
import bluetooth_packets_python3 as bt_packets
from bluetooth_packets_python3.hci_packets import AclPacketBuilder
from bluetooth_packets_python3 import RawBuilder

_GRPC_TIMEOUT = 10

@@ -49,24 +51,12 @@ class SimpleHalTest(GdBaseTestClass):
        super().teardown_test()

    def send_cert_acl_data(self, handle, pb_flag, b_flag, acl):
        lower = handle & 0xff
        upper = (handle >> 8) & 0xf
        upper = upper | int(pb_flag) & 0x3
        upper = upper | ((int(b_flag) & 0x3) << 2)
        lower_length = len(acl) & 0xff
        upper_length = (len(acl) & 0xff00) >> 8
        concatenated = bytes([lower, upper, lower_length, upper_length] + list(acl))
        self.cert_hal.send_acl(concatenated)
        acl_msg = AclPacketBuilder(handle, pb_flag, b_flag, RawBuilder(acl))
        self.cert_hal.send_acl(acl_msg.Serialize())

    def send_dut_acl_data(self, handle, pb_flag, b_flag, acl):
        lower = handle & 0xff
        upper = (handle >> 8) & 0xf
        upper = upper | int(pb_flag) & 0x3
        upper = upper | ((int(b_flag) & 0x3) << 2)
        lower_length = len(acl) & 0xff
        upper_length = (len(acl) & 0xff00) >> 8
        concatenated = bytes([lower, upper, lower_length, upper_length] + list(acl))
        self.dut_hal.send_acl(concatenated)
        acl_msg = AclPacketBuilder(handle, pb_flag, b_flag, RawBuilder(acl))
        self.dut_hal.send_acl(acl_msg.Serialize())

    def test_fetch_hci_event(self):
        self.dut_hal.send_hci_command(