Loading system/gd/cert/cert_self_test.py +4 −4 Original line number Diff line number Diff line Loading @@ -182,7 +182,7 @@ class CertSelfTest(BaseTestClass): inside = hci_packets.ReadScanEnableBuilder() logging.debug(inside.Serialize()) logging.debug("building outside") outside = hci_packets.AclPacketBuilder(handle, hci_packets.PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE, outside = hci_packets.AclBuilder(handle, hci_packets.PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE, hci_packets.BroadcastFlag.POINT_TO_POINT, inside) logging.debug(outside.Serialize()) logging.debug("Done!") Loading @@ -199,7 +199,7 @@ class CertSelfTest(BaseTestClass): [mtu_opt, fcs_opt]) request_b_frame = l2cap_packets.BasicFrameBuilder(0x01, request) handle = 123 wrapped = hci_packets.AclPacketBuilder(handle, hci_packets.PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE, wrapped = hci_packets.AclBuilder(handle, hci_packets.PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE, hci_packets.BroadcastFlag.POINT_TO_POINT, request_b_frame) # Size is ACL (4) + L2CAP (4) + Configure (8) + MTU (4) + FCS (3) asserts.assert_true(len(wrapped.Serialize()) == 23, "Packet serialized incorrectly") Loading system/gd/cert/py_hal.py +3 −3 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ 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 AclPacketBuilder from bluetooth_packets_python3.hci_packets import AclBuilder from bluetooth_packets_python3 import RawBuilder from bluetooth_packets_python3.hci_packets import BroadcastFlag from bluetooth_packets_python3.hci_packets import PacketBoundaryFlag Loading Loading @@ -60,7 +60,7 @@ class PyHalAclConnection(IEventStream): self.our_acl_stream = FilteringEventStream(acl_stream, None) def send(self, pb_flag, b_flag, data): acl = AclPacketBuilder(self.handle, pb_flag, b_flag, RawBuilder(data)) acl = AclBuilder(self.handle, pb_flag, b_flag, RawBuilder(data)) self.device.hal.SendAcl(hal_facade.AclPacket(payload=bytes(acl.Serialize()))) def send_first(self, data): Loading Loading @@ -141,7 +141,7 @@ class PyHal(Closable): self.device.hal.SendCommand(hal_facade.Command(payload=bytes(command.Serialize()))) def send_acl(self, handle, pb_flag, b_flag, data): acl = AclPacketBuilder(handle, pb_flag, b_flag, RawBuilder(data)) acl = AclBuilder(handle, pb_flag, b_flag, RawBuilder(data)) self.device.hal.SendAcl(hal_facade.AclPacket(payload=bytes(acl.Serialize()))) def send_acl_first(self, handle, data): Loading system/gd/hal/cert/simple_hal_test.py +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ 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.hci_packets import AclBuilder from bluetooth_packets_python3 import RawBuilder _GRPC_TIMEOUT = 10 Loading system/gd/hal/fuzz/fuzz_hci_hal.cc +2 −2 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ void FuzzHciHal::injectHciEvent(std::vector<uint8_t> data) { } void FuzzHciHal::injectAclData(std::vector<uint8_t> data) { hci::AclPacketView aclPacket = hci::AclPacketView::FromBytes(data); hci::AclView aclPacket = hci::AclView::FromBytes(data); if (!aclPacket.IsValid()) { return; } Loading @@ -94,7 +94,7 @@ void FuzzHciHal::injectAclData(std::vector<uint8_t> data) { } void FuzzHciHal::injectScoData(std::vector<uint8_t> data) { hci::ScoPacketView scoPacket = hci::ScoPacketView::FromBytes(data); hci::ScoView scoPacket = hci::ScoView::FromBytes(data); if (!scoPacket.IsValid()) { return; } Loading system/gd/hci/acl_builder_test.cc +9 −9 Original line number Diff line number Diff line Loading @@ -64,8 +64,8 @@ TEST(AclBuilderTest, buildAclCount) { count_payload->AddOctets(counting_bytes); ASSERT_EQ(counting_bytes.size(), count_payload->size()); std::unique_ptr<AclPacketBuilder> count_packet = AclPacketBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(count_payload)); std::unique_ptr<AclBuilder> count_packet = AclBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(count_payload)); ASSERT_EQ(counting_bytes.size() + 4, count_packet->size()); Loading @@ -74,7 +74,7 @@ TEST(AclBuilderTest, buildAclCount) { count_packet->Serialize(it); PacketView<true> count_packet_bytes_view(count_packet_bytes); AclPacketView count_packet_view = AclPacketView::Create(count_packet_bytes_view); AclView count_packet_view = AclView::Create(count_packet_bytes_view); ASSERT_TRUE(count_packet_view.IsValid()); ASSERT_EQ(handle, count_packet_view.GetHandle()); Loading @@ -97,8 +97,8 @@ TEST(AclBuilderTest, buildAclCountInverted) { counting_down_bytes_payload->AddOctets(counting_down_bytes); ASSERT_EQ(counting_down_bytes.size(), counting_down_bytes_payload->size()); std::unique_ptr<AclPacketBuilder> counting_down_bytes_packet = AclPacketBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(counting_down_bytes_payload)); std::unique_ptr<AclBuilder> counting_down_bytes_packet = AclBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(counting_down_bytes_payload)); ASSERT_EQ(counting_down_bytes.size() + 4, counting_down_bytes_packet->size()); Loading @@ -106,7 +106,7 @@ TEST(AclBuilderTest, buildAclCountInverted) { BitInserter it(*counting_down_bytes_packet_bytes); counting_down_bytes_packet->Serialize(it); PacketView<true> counting_down_bytes_packet_bytes_view(counting_down_bytes_packet_bytes); AclPacketView counting_down_bytes_packet_view = AclPacketView::Create(counting_down_bytes_packet_bytes_view); AclView counting_down_bytes_packet_view = AclView::Create(counting_down_bytes_packet_bytes_view); ASSERT_TRUE(counting_down_bytes_packet_view.IsValid()); ASSERT_EQ(handle, counting_down_bytes_packet_view.GetHandle()); Loading @@ -130,8 +130,8 @@ TEST(AclBuilderTest, buildInformationRequest) { payload->AddOctets(payload_bytes); ASSERT_EQ(payload_bytes.size(), payload->size()); std::unique_ptr<AclPacketBuilder> packet = AclPacketBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(payload)); std::unique_ptr<AclBuilder> packet = AclBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(payload)); ASSERT_EQ(information_request.size(), packet->size()); Loading @@ -139,7 +139,7 @@ TEST(AclBuilderTest, buildInformationRequest) { BitInserter it(*packet_bytes); packet->Serialize(it); PacketView<true> packet_bytes_view(packet_bytes); AclPacketView packet_view = AclPacketView::Create(packet_bytes_view); AclView packet_view = AclView::Create(packet_bytes_view); ASSERT_TRUE(packet_view.IsValid()); ASSERT_EQ(packet_bytes->size(), information_request.size()); Loading Loading
system/gd/cert/cert_self_test.py +4 −4 Original line number Diff line number Diff line Loading @@ -182,7 +182,7 @@ class CertSelfTest(BaseTestClass): inside = hci_packets.ReadScanEnableBuilder() logging.debug(inside.Serialize()) logging.debug("building outside") outside = hci_packets.AclPacketBuilder(handle, hci_packets.PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE, outside = hci_packets.AclBuilder(handle, hci_packets.PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE, hci_packets.BroadcastFlag.POINT_TO_POINT, inside) logging.debug(outside.Serialize()) logging.debug("Done!") Loading @@ -199,7 +199,7 @@ class CertSelfTest(BaseTestClass): [mtu_opt, fcs_opt]) request_b_frame = l2cap_packets.BasicFrameBuilder(0x01, request) handle = 123 wrapped = hci_packets.AclPacketBuilder(handle, hci_packets.PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE, wrapped = hci_packets.AclBuilder(handle, hci_packets.PacketBoundaryFlag.FIRST_NON_AUTOMATICALLY_FLUSHABLE, hci_packets.BroadcastFlag.POINT_TO_POINT, request_b_frame) # Size is ACL (4) + L2CAP (4) + Configure (8) + MTU (4) + FCS (3) asserts.assert_true(len(wrapped.Serialize()) == 23, "Packet serialized incorrectly") Loading
system/gd/cert/py_hal.py +3 −3 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ 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 AclPacketBuilder from bluetooth_packets_python3.hci_packets import AclBuilder from bluetooth_packets_python3 import RawBuilder from bluetooth_packets_python3.hci_packets import BroadcastFlag from bluetooth_packets_python3.hci_packets import PacketBoundaryFlag Loading Loading @@ -60,7 +60,7 @@ class PyHalAclConnection(IEventStream): self.our_acl_stream = FilteringEventStream(acl_stream, None) def send(self, pb_flag, b_flag, data): acl = AclPacketBuilder(self.handle, pb_flag, b_flag, RawBuilder(data)) acl = AclBuilder(self.handle, pb_flag, b_flag, RawBuilder(data)) self.device.hal.SendAcl(hal_facade.AclPacket(payload=bytes(acl.Serialize()))) def send_first(self, data): Loading Loading @@ -141,7 +141,7 @@ class PyHal(Closable): self.device.hal.SendCommand(hal_facade.Command(payload=bytes(command.Serialize()))) def send_acl(self, handle, pb_flag, b_flag, data): acl = AclPacketBuilder(handle, pb_flag, b_flag, RawBuilder(data)) acl = AclBuilder(handle, pb_flag, b_flag, RawBuilder(data)) self.device.hal.SendAcl(hal_facade.AclPacket(payload=bytes(acl.Serialize()))) def send_acl_first(self, handle, data): Loading
system/gd/hal/cert/simple_hal_test.py +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ 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.hci_packets import AclBuilder from bluetooth_packets_python3 import RawBuilder _GRPC_TIMEOUT = 10 Loading
system/gd/hal/fuzz/fuzz_hci_hal.cc +2 −2 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ void FuzzHciHal::injectHciEvent(std::vector<uint8_t> data) { } void FuzzHciHal::injectAclData(std::vector<uint8_t> data) { hci::AclPacketView aclPacket = hci::AclPacketView::FromBytes(data); hci::AclView aclPacket = hci::AclView::FromBytes(data); if (!aclPacket.IsValid()) { return; } Loading @@ -94,7 +94,7 @@ void FuzzHciHal::injectAclData(std::vector<uint8_t> data) { } void FuzzHciHal::injectScoData(std::vector<uint8_t> data) { hci::ScoPacketView scoPacket = hci::ScoPacketView::FromBytes(data); hci::ScoView scoPacket = hci::ScoView::FromBytes(data); if (!scoPacket.IsValid()) { return; } Loading
system/gd/hci/acl_builder_test.cc +9 −9 Original line number Diff line number Diff line Loading @@ -64,8 +64,8 @@ TEST(AclBuilderTest, buildAclCount) { count_payload->AddOctets(counting_bytes); ASSERT_EQ(counting_bytes.size(), count_payload->size()); std::unique_ptr<AclPacketBuilder> count_packet = AclPacketBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(count_payload)); std::unique_ptr<AclBuilder> count_packet = AclBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(count_payload)); ASSERT_EQ(counting_bytes.size() + 4, count_packet->size()); Loading @@ -74,7 +74,7 @@ TEST(AclBuilderTest, buildAclCount) { count_packet->Serialize(it); PacketView<true> count_packet_bytes_view(count_packet_bytes); AclPacketView count_packet_view = AclPacketView::Create(count_packet_bytes_view); AclView count_packet_view = AclView::Create(count_packet_bytes_view); ASSERT_TRUE(count_packet_view.IsValid()); ASSERT_EQ(handle, count_packet_view.GetHandle()); Loading @@ -97,8 +97,8 @@ TEST(AclBuilderTest, buildAclCountInverted) { counting_down_bytes_payload->AddOctets(counting_down_bytes); ASSERT_EQ(counting_down_bytes.size(), counting_down_bytes_payload->size()); std::unique_ptr<AclPacketBuilder> counting_down_bytes_packet = AclPacketBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(counting_down_bytes_payload)); std::unique_ptr<AclBuilder> counting_down_bytes_packet = AclBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(counting_down_bytes_payload)); ASSERT_EQ(counting_down_bytes.size() + 4, counting_down_bytes_packet->size()); Loading @@ -106,7 +106,7 @@ TEST(AclBuilderTest, buildAclCountInverted) { BitInserter it(*counting_down_bytes_packet_bytes); counting_down_bytes_packet->Serialize(it); PacketView<true> counting_down_bytes_packet_bytes_view(counting_down_bytes_packet_bytes); AclPacketView counting_down_bytes_packet_view = AclPacketView::Create(counting_down_bytes_packet_bytes_view); AclView counting_down_bytes_packet_view = AclView::Create(counting_down_bytes_packet_bytes_view); ASSERT_TRUE(counting_down_bytes_packet_view.IsValid()); ASSERT_EQ(handle, counting_down_bytes_packet_view.GetHandle()); Loading @@ -130,8 +130,8 @@ TEST(AclBuilderTest, buildInformationRequest) { payload->AddOctets(payload_bytes); ASSERT_EQ(payload_bytes.size(), payload->size()); std::unique_ptr<AclPacketBuilder> packet = AclPacketBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(payload)); std::unique_ptr<AclBuilder> packet = AclBuilder::Create(handle, packet_boundary_flag, broadcast_flag, std::move(payload)); ASSERT_EQ(information_request.size(), packet->size()); Loading @@ -139,7 +139,7 @@ TEST(AclBuilderTest, buildInformationRequest) { BitInserter it(*packet_bytes); packet->Serialize(it); PacketView<true> packet_bytes_view(packet_bytes); AclPacketView packet_view = AclPacketView::Create(packet_bytes_view); AclView packet_view = AclView::Create(packet_bytes_view); ASSERT_TRUE(packet_view.IsValid()); ASSERT_EQ(packet_bytes->size(), information_request.size()); Loading