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/
Metadata
Release files for bcodparser 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bcodparser-1.0.1.tar.gz | 4.4 kB | Details |
Release files / bcodparser-1.0.1.tar.gz
| Download URL | bcodparser-1.0.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29391013ea1f16bac5475b0b7cb97556a4ef80fc076e36aebbfd108277707d5b
|
|
BLAKE2b-256 checksum How to use checksums |
39f60646fe16b0f17bab8d21350707ab072661c3810bb00b08eceb3f11dadb8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|