Skip to main content

HCI Packet Parser

Project description

# HCI Protocol
This is a Python package for parsing and building HCI packets.

HCI (Host Controller Interface) is the protocol used for communications between a BT/BLE controller (i.e. USB dongle) and a host computer such as a RPi.
Currently **only part of the protocol is implemented in this package**

## Usage Examples
1. Hci Sniffer (Linux only): `python -m hci_protocol.hci_sniffer --hci 0`
2. Building a packet:
```python
from hci_protocol import hci_functions
hci_functions.create_le_connection_comlete_packet(peer_address='AA:BB:CC:DD:EE:FF', connection_handle=70)
# ==> '\x04>\x13\x01\x00F\x00\x00\x01\xff\xee\xdd\xcc\xbb\xaa8\x00\x00\x00*\x00\x00'
```

3. Parsing a packet:
```python
from hci_protocol.hci_protocol import HciPacket
print HciPacket.parse('\x04>\x13\x01\x00F\x00\x00\x01\xff\xee\xdd\xcc\xbb\xaa8\x00\x00\x00*\x00\x00')
# ==>
# Container:
# type = EVENT_PACKET (total 12)
# payload = Container:
# event = LE_META_EVENT (total 13)
# length = 19
# payload = Container:
# subevent = LE_CONNECTION_COMPLETED (total 23)
# payload = Container:
# status = 0
# handle = 70
# role = 0
# peer_bdaddr_type = 1
# peer_bdaddr = aa:bb:cc:dd:ee:ff (total 17)
# interval = 56
# latency = 0
# supervision_timeout = 42
# master_clock_accuracy = 0
```

## Contribute
This package is in a preliminary stage and there is still a lot of work to do. Feel free to fork and submit your pull requests.

For more information about the HCI protocol, check out the [Blutooth Core Specifications](https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=421043&_ga=2.29692863.121228451.1498147116-1432843607.1484151012)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hci-protocol-0.0.5.tar.gz (11.8 kB view details)

Uploaded Source

File details

Details for the file hci-protocol-0.0.5.tar.gz.

File metadata

File hashes

Hashes for hci-protocol-0.0.5.tar.gz
Algorithm Hash digest
SHA256 99498e7c9c6b5dd18c7a9a9bd3145f3922bfc123aadc38a68943a981b91d4489
MD5 6393108e1fa90910e143fd9c2acc5277
BLAKE2b-256 aaa18e6ecbb4f3e0db4bc941b18d5c19fa90817f87e9db0d98dca0e33e2f3d44

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page