PDL: Add Python support for Address, ClassOfDevice
Add a type_caster for each custom type to and from std::string. Bug: 143568835 Test: Create packets in Python passing strings: $ python3.8 >>> import bluetooth_packets_python3 as bp3 >>> pview = bp3.PacketViewLittleEndian([14, 10, 1, 9, 16, 0, 1, 2, 3, 4, 5, 6]) >>> event = bp3.hci_packets.EventPacketView(pview) >>> complete = bp3.hci_packets.CommandCompleteView(event) >>> read_complete = bp3.hci_packets.ReadBdAddrCompleteView(complete) >>> address = read_complete.GetBdAddr() >>> print(address) 06:05:04:03:02:01 >>> builder = bp3.hci_packets.ReadBdAddrCompleteBuilder(1, bp3.hci_packets.ErrorCode.SUCCESS, address) >>> builder.Serialize() [14, 10, 1, 9, 16, 0, 1, 2, 3, 4, 5, 6] >>> quit() Change-Id: If0a1639a4c1a162b68e1d0a0bb1cd5ba552a1190
Loading
Please register or sign in to comment