3#include <NimBLEAddress.h>
4#include "BLEBatteryEvent.h"
5#include "BLEControllerInternal.h"
6#include "BLEControlsEvent.h"
7#include "BLEVibrationsCommand.h"
12 explicit BLEController(NimBLEAddress address);
13 explicit BLEController(
const std::string& address);
14 ~BLEController() =
default;
18 void onConnect(
const OnConnect& callback);
28 NimBLEAddress _allowedAddress;
30 OnDisconnect _onDisconnect;
31 OnControlsUpdate _onControlsUpdate;
32 bool _onControlsUpdateIsSet;
33 OnBatteryUpdate _onBatteryUpdate;
34 bool _onBatteryUpdateIsSet;
Definition BLEControllerInternal.h:15
void writeVibrations(const BLEVibrationsCommand &cmd) const
Send the vibrations command to the connected controller.
Definition BLEController.cpp:148
void onConnect(const OnConnect &callback)
Sets the callback to be invoked when the controller connects.
Definition BLEController.cpp:82
void onBatteryUpdate(const OnBatteryUpdate &callback)
Sets the callback to be invoked when the controller sends update to the battery state.
Definition BLEController.cpp:136
void readBattery(BLEBatteryEvent &event) const
Read the battery state from the connected controller.
Definition BLEController.cpp:126
bool begin()
Initializes a controller instance and NimBLE stack if it's not already initialized.
Definition BLEController.cpp:22
NimBLEAddress getAddress() const
Returns one of the following:
Definition BLEController.cpp:70
void onControlsUpdate(const OnControlsUpdate &callback)
Sets the callback to be invoked when the controller sends update to the controls state.
Definition BLEController.cpp:114
void onDisconnect(const OnDisconnect &callback)
Sets the callback to be invoked when the controller disconnects.
Definition BLEController.cpp:93
bool isConnected() const
Is controller connected to the board.
Definition BLEController.cpp:54
void readControls(BLEControlsEvent &event) const
Read the controls state from the connected controller.
Definition BLEController.cpp:104
Definition BLEBatteryEvent.h:5
Definition BLEControlsEvent.h:5
Definition BLEVibrationsCommand.h:3