Expand description
Bluetooth Low Energy communication traits. Bluetooth Low Energy (BLE) Hardware Abstraction Layer
This module defines the platform-agnostic trait for BLE functionality. Platform implementations (ESP32, nRF52, STM32WB) must implement this trait to provide BLE capabilities.
§Architecture
┌──────────────────────────────────────────────┐
│ Application (firmware) │
└─────────────────┬────────────────────────────┘
│ uses
┌─────────────────▼────────────────────────────┐
│ BluetoothProvider trait (THIS FILE) │
│ - start_advertising() │
│ - is_connected() │
│ - send() / receive() │
└─────────────────┬────────────────────────────┘
│ implements
┌─────────────────▼────────────────────────────┐
│ Platform Implementation │
│ - Esp32Bluetooth (esp-idf BLE) │
│ - Nrf52Bluetooth (TrouBLE/nrf-softdevice) │
│ - Stm32wbBluetooth (ST BLE stack) │
└──────────────────────────────────────────────┘§Usage
use feagi_hal::hal::BluetoothProvider;
// Platform layer provides the implementation
let mut ble: Esp32Bluetooth = /* platform init */;
// Start advertising
ble.start_advertising("FEAGI-robot").unwrap();
// Wait for connection
while !ble.is_connected() {
// Poll or sleep
}
// Send/receive data
ble.send(b"Hello FEAGI").unwrap();
let mut buf = [0u8; 64];
if let Ok(len) = ble.receive(&mut buf) {
// Process received data
}Enums§
- Connection
Status - Connection status for BLE
Traits§
- Bluetooth
Provider - Bluetooth Low Energy provider trait