Allows you to decode the Bluetooth Class of Device (CoD) field and interpret major, minor, and service classes.
Project description
bcodparser
Allows you to decode the Bluetooth Class of Device (CoD) field and interpret major, minor, and service classes.
⚙️ Installation
pip install bcodparser
🖊️ Example
Here is an example of use with pybluez
Code
from bcodparser import decode
import bluetooth # pybluez
# Scan Bluetooth
print("Scanning bluetooth...")
nearby_devices = bluetooth.discover_devices(
lookup_names=True,
lookup_class=True
)
print(f"Found {len(nearby_devices)} devices\n")
# List the Bluetooth devices with informations
for address, name, classe in nearby_devices:
decoded = decode(classe)
print(f"Name: {name}")
print(f"Adress: {address}")
print("Major Device Class: ", decoded["majorClass"])
print("Minor Device Class: ", ", ".join(decoded["minorClass"]))
print("Service Device Classes: ", ", ".join(decoded["serviceClass"]))
print("\n")
Output
Scanning bluetooth...
Found 3 devices
Name: My Headphone
Adress: 11:22:33:44:55:66
Major Device Class: Audio/Video
Minor Device Class: Wearable Headset Device
Service Device Classes: Rendering, Audio
Name: My Phone
Adress: 77:88:99:AA:BB:CC
Major Device Class: Phone
Minor Device Class: Smartphone
Service Device Classes: Networking, Capturing, Object Transfert, Telephony
Name: My Computer
Adress: DD:EE:FF:11:22:33
Major Device Class: Computer
Minor Device Class: Laptop
Service Device Classes: Networking, Capturing, Audio
View PyPi : https://pypi.org/project/bcodparser/ View GitHub : https://github.com/Lou-du-Poitou/bcodparser/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bcodparser-1.0.1.tar.gz
(4.4 kB
view details)
File details
Details for the file bcodparser-1.0.1.tar.gz.
File metadata
- Download URL: bcodparser-1.0.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29391013ea1f16bac5475b0b7cb97556a4ef80fc076e36aebbfd108277707d5b
|
|
| MD5 |
4eee1eadab5f8a78ae28c47929280176
|
|
| BLAKE2b-256 |
39f60646fe16b0f17bab8d21350707ab072661c3810bb00b08eceb3f11dadb8c
|