|
| BLEController (NimBLEAddress address) |
| BLEController (const std::string &address) |
bool | begin () |
| Initializes a controller instance and NimBLE stack if it's not already initialized.
|
bool | isConnected () const |
| Is controller connected to the board.
|
NimBLEAddress | getAddress () const |
| Returns one of the following:
|
void | onConnect (const OnConnect &callback) |
| Sets the callback to be invoked when the controller connects.
|
void | onDisconnect (const OnDisconnect &callback) |
| Sets the callback to be invoked when the controller disconnects.
|
void | readControls (BLEControlsEvent &event) const |
| Read the controls state from the connected controller.
|
void | onControlsUpdate (const OnControlsUpdate &callback) |
| Sets the callback to be invoked when the controller sends update to the controls state.
|
void | readBattery (BLEBatteryEvent &event) const |
| Read the battery state from the connected controller.
|
void | onBatteryUpdate (const OnBatteryUpdate &callback) |
| Sets the callback to be invoked when the controller sends update to the battery state.
|
void | writeVibrations (const BLEVibrationsCommand &cmd) const |
| Send the vibrations command to the connected controller.
|
◆ begin()
bool BLEController::begin |
( |
| ) |
|
Initializes a controller instance and NimBLE stack if it's not already initialized.
- Returns
- True if initialization was successful.
◆ getAddress()
NimBLEAddress BLEController::getAddress |
( |
| ) |
const |
Returns one of the following:
- The address of the currently connected controller (if connected)
- The address of the controller allowed to be assigned to this instance (if predefined via constructor param)
- A null address (a NimBLEAddress instance for which method isNull() returns true)
- Returns
- The relevant address based on the current connection or configuration state.
◆ isConnected()
bool BLEController::isConnected |
( |
| ) |
const |
Is controller connected to the board.
- Returns
- True if controller is connected, false otherwise.
◆ onBatteryUpdate()
void BLEController::onBatteryUpdate |
( |
const OnBatteryUpdate & | callback | ) |
|
Sets the callback to be invoked when the controller sends update to the battery state.
- Parameters
-
callback | Reference to the callback function. |
◆ onConnect()
void BLEController::onConnect |
( |
const OnConnect & | callback | ) |
|
Sets the callback to be invoked when the controller connects.
- Parameters
-
callback | Reference to a callback function. |
◆ onControlsUpdate()
void BLEController::onControlsUpdate |
( |
const OnControlsUpdate & | callback | ) |
|
Sets the callback to be invoked when the controller sends update to the controls state.
- Parameters
-
callback | Reference to the callback function. |
◆ onDisconnect()
void BLEController::onDisconnect |
( |
const OnDisconnect & | callback | ) |
|
Sets the callback to be invoked when the controller disconnects.
- Parameters
-
callback | Reference to the callback function. |
◆ readBattery()
Read the battery state from the connected controller.
- Parameters
-
[out] | event | Reference to the event instance where the data will be written. |
◆ readControls()
Read the controls state from the connected controller.
- Parameters
-
[out] | event | Reference to the event instance where the data will be written. |
◆ writeVibrations()
Send the vibrations command to the connected controller.
- Parameters
-
cmd | Command enabling specific motors in the controller. |
The documentation for this class was generated from the following files: