12#include <NimBLEDevice.h>
29 void onConnect(NimBLEClient *pClient)
override;
30 void onDisconnect(NimBLEClient *pClient,
int reason)
override;
34 void onHeartRateNotify(NimBLERemoteCharacteristic *, uint8_t *,
size_t,
bool);
36 uint8_t heartRate = -1;
37 bool doConnect =
false;
38 const NimBLEAdvertisedDevice *advDevice =
nullptr;
45class ScanCallbacks :
public NimBLEScanCallbacks
49 void onResult(
const NimBLEAdvertisedDevice *advertisedDevice)
override;
Class to handle Bluetooth client operations.
Definition bluetooth.h:21
void setConnectFlag(const NimBLEAdvertisedDevice *device)
Set the connect flag for the Bluetooth client.
Definition bluetooth.cpp:36
BluetoothClient()
Construct a new Bluetooth Client object.
Definition bluetooth.cpp:23
void begin()
Initialize the Bluetooth client.
Definition bluetooth.cpp:47
void onConnect(NimBLEClient *pClient) override
Callback function for when the client connects to a device.
Definition bluetooth.cpp:111
void loop()
Loop function for the Bluetooth client.
Definition bluetooth.cpp:64
uint8_t getHeartRate() const
Get the heart rate value.
Definition bluetooth.cpp:144
void onDisconnect(NimBLEClient *pClient, int reason) override
Callback function for when the client disconnects from a device.
Definition bluetooth.cpp:125
void onResult(const NimBLEAdvertisedDevice *advertisedDevice) override
Callback function for scan results.
Definition bluetooth.cpp:185