This is a library for creating and parsing HCI packets.
This library is under construction.
This library currently supports Python 3.5 and possibly latter versions.
In [1]: import hci
In [2]: pkt = hci.command.ATT_ExchangeMTUReq(conn_handle=0x0000, client_rx_mtu=100)
In [3]: print(pkt)
Packet Type: 0x1 (COMMAND)
OpCode: 0xfd02 (ATT_EXCHANGE_MTU_REQUEST)
OGF: 0x3f (VENDOR_SPECIFIC)
OCF: 0x102 (258)
Data Length: 0x4 (4)
Connection Handle: 0x0 (0)
Client RX MTU: 0x64 (100)
In [4]: print(pkt.binary)
b'\x01\x02\xfd\x04\x00\x00d\x00'
In [1]: import hci
In [2]: pkts, _ = hci.from_binary(b'\x01\x02\xfd\x04\x00\x00d\x00')
In [3]: print(pkts[0])
Packet Type: 0x1 (COMMAND)
OpCode: 0xfd02 (ATT_EXCHANGE_MTU_REQUEST)
OGF: 0x3f (VENDOR_SPECIFIC)
OCF: 0x102 (258)
Data Length: 0x4 (4)
Connection Handle: 0x0 (0)
Client RX MTU: 0x64 (100)
For installing an official release, you may issue the following command:
pip install hci
If you are interested in the latest (possibly unstable) features, you may issue the following command:
pip install git+https://github.com/acburigo/python-hci
This repository is currently maintained by Arthur Crippa Búrigo and Pedro Gyrão.