BluetoothManager

Bluetooth interface for lifecycle management

#include <BluetoothManager.h>

Public Member Functions

 BluetoothManager ()
 
 ~BluetoothManager ()=default
 
void init ()
 
void update ()
 
void shutdown ()
 
bool isConnected () const
 
bool isAdvertising () const
 
BluetoothState getState () const
 
String getDeviceName () const
 
bool isInitialized () const
 
BleKeyboard * getBleKeyboard ()
 
const BleKeyboard * getBleKeyboard () const
 

Detailed Description

Bluetooth Manager

Network layer abstraction for BLE connection management. Exposes BleKeyboard instance for application layer usage.

Constructor & Destructor Documentation

◆ BluetoothManager()

CloudMouse::Network::BluetoothManager::BluetoothManager ( )

Constructor - prepares Bluetooth manager instance Initializes state but does not start BLE stack

◆ ~BluetoothManager()

CloudMouse::Network::BluetoothManager::~BluetoothManager ( )
default

Member Function Documentation

◆ getBleKeyboard() [1/2]

BleKeyboard* CloudMouse::Network::BluetoothManager::getBleKeyboard ( )
inline

Get BleKeyboard instance for application layer Use this to send keys, media commands, etc.

Example: if (bt.isConnected()) { bt.getBleKeyboard()->write(KEY_MEDIA_VOLUME_UP); bt.getBleKeyboard()->press(KEY_LEFT_CTRL); }

Returns
Pointer to BleKeyboard instance (nullptr if not initialized)

◆ getBleKeyboard() [2/2]

const BleKeyboard* CloudMouse::Network::BluetoothManager::getBleKeyboard ( ) const
inline

Get BleKeyboard instance (const version)

Returns
Const pointer to BleKeyboard instance (nullptr if not initialized)

◆ getDeviceName()

String CloudMouse::Network::BluetoothManager::getDeviceName ( ) const
inline

Get Bluetooth device name

Returns
Device name being advertised

◆ getState()

BluetoothState CloudMouse::Network::BluetoothManager::getState ( ) const
inline

Get current Bluetooth state

Returns
Current state in lifecycle

◆ init()

void CloudMouse::Network::BluetoothManager::init ( )

Initialize Bluetooth and start advertising Configures BLE HID device and begins advertising for pairing

Device name format: "CloudMouse-XXXXXXXX" (using MAC address) Manufacturer: "CloudMouse"

Call once during system initialization

◆ isAdvertising()

bool CloudMouse::Network::BluetoothManager::isAdvertising ( ) const

Check if currently advertising

Returns
true if advertising and waiting for connection

◆ isConnected()

bool CloudMouse::Network::BluetoothManager::isConnected ( ) const

Check if device is connected to a host

Returns
true if BLE connection is active

◆ isInitialized()

bool CloudMouse::Network::BluetoothManager::isInitialized ( ) const
inline

Check if Bluetooth is initialized

Returns
true if init() was called successfully

◆ shutdown()

void CloudMouse::Network::BluetoothManager::shutdown ( )

Shutdown Bluetooth and free resources Disconnects any active connection and stops advertising

◆ update()

void CloudMouse::Network::BluetoothManager::update ( )

Update Bluetooth connection state Monitors connection changes and updates internal state Call regularly in main loop (every 10-50ms recommended)