from bluetooth_packets_python3.hci_packets import ResetBuilder
from bluetooth_packets_python3.hci_packets import Lap
from bluetooth_packets_python3.hci_packets import OpCode
+from bluetooth_packets_python3.hci_packets import AclPacketBuilder
+from bluetooth_packets_python3 import RawBuilder
class DirectHciTest(GdBaseTestClass):
self.dut.hci.SendAcl(acl_msg)
def send_hal_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 test_local_hci_cmd_and_event(self):
# Loopback mode responds with ACL and SCO connection complete
py::class_<BasePacketBuilder, std::shared_ptr<BasePacketBuilder>>(m, "BasePacketBuilder");
py::class_<RawBuilder, BasePacketBuilder, std::shared_ptr<RawBuilder>>(m, "RawBuilder")
.def(py::init([](std::vector<uint8_t> bytes) { return std::make_unique<RawBuilder>(bytes); }))
+ .def(py::init([](std::string bytes) {
+ return std::make_unique<RawBuilder>(std::vector<uint8_t>(bytes.begin(), bytes.end()));
+ }))
.def("Serialize", [](RawBuilder& builder) {
std::vector<uint8_t> packet;
BitInserter it(packet);