How weliem/blessed-kotlin works
Main Components
a. Core Components:
• BluetoothCentralManager
• BluetoothPeripheral
• BluetoothPeripheralManager
• BluetoothCentral
b. Supporting Components:
• Utility Classes (BluetoothBytesParser, BluetoothBytesBuilder)
• Callback Interfaces
• Enums and Status Classes
• Android BLE Stack Integration
┌─────────────────────────────────────────────────────────────┐
• Application Layer │
• ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
• Central │ │ Peripheral │ │ Example Applications │ │
• Application │ │ Application │ │ (Sample Usage) │ │
• ┘ └─────────────┘ └─────────────────────┘ │
• ┤
• BLESSED Library Core │
• ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
• Central │ │ Peripheral │ │ Utility Classes │ │
• Manager │◄─►│ Manager │ │ │ │
• ┘ └─────────────┘ │ - BytesParser │ │
• ▲ ▲ │ - BytesBuilder │ │
• ┘ │
• ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
• Bluetooth │ │ Bluetooth │ │ Status Classes │ │
• Peripheral │ │ Central │ │ - GattStatus │ │
• ┘ └─────────────┘ │ - HciStatus │ │
• ┘ │
• ┤
• Android BLE Stack │
• ┘
Connection Flows
• Bidirectional communication between Central and Peripheral
• Callback flows from managers to applications
• Data flow through the BLE stack
Important Details
• MTU handling
• Bonding process flow
• Queue management for commands
• Notification/Indication paths
• Service discovery process
• PHY layer options (Bluetooth 5 support)
Notes for Implementation
• Use UML-style notation for classes and interfaces
• Clear separation between library and application code
• Thread handling (main thread callbacks)
• Public APIs vs internal components