How wrobell/btzen works
Main Components
a. Core Library Components:
• Connection Manager (represented by _cm.pyx and cm.py)
• D-Bus Interface Layer (_sd_bus.pyx and _sd_bus.pxd)
• Device Management Layer (device.py)
• Service Layer (service.py)
• Session Management (session.py)
b. External Components:
• Bluez Daemon (with experimental features)
• D-Bus System Bus
• Physical Bluetooth Devices
Component Relationships
Layer 1 (Application Layer):
• User applications/scripts (from scripts/ directory)
• To BTZen Public API
Layer 2 (BTZen Public API):
• Device-specific modules (sensortag.py, thingy52.py, btweight.py)
• Async interface
Layer 3 (Core Services):
• Connection Manager
• Session Manager
• Device Manager
• Service Handler
Layer 4 (Low-Level Interface):
• D-Bus Interface
• Bluez Integration
Layer 5 (System Level):
• Bluez Daemon
• Physical Bluetooth Devices
Important Architectural Aspects to Highlight
a. Asynchronous Nature:
• Async communication paths
• Parallel device handling capability
b. Connection Management:
• Automatic reconnection logic
• Connection state management
c. Device Support:
• Extensibility for different device types
• Standard and non-standard device handling
Specific Features
• GATT notification interface
• Automatic reconnection paths
• Serial device support (Stollmann protocol)
• Device-specific implementations
• Battery level monitoring
• Connection management flows
Technical Details
• Python 3.11+ requirement
• Cython integration points
• Bluez 5.68 dependency
• sd-bus system interface
• uvloop compatibility
Notes Section
Important notes about:
• Experimental Bluez API requirement
• Connection management constraints
• MAC address requirements
• Performance considerations
Remember to emphasize the library's key strengths:
• Parallel device handling
• Efficient resource usage
• Integration with asyncio
• Extensible device support
• Low-level optimization with Cython