2025-11-28 18:26:32 -06:00
|
|
|
#ifndef BLE_H
|
|
|
|
|
#define BLE_H
|
|
|
|
|
|
|
|
|
|
#include "NimBLEDevice.h"
|
2025-12-17 21:52:00 -06:00
|
|
|
#include "cJSON.h"
|
|
|
|
|
#include <atomic>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include "esp_wifi_types.h"
|
2025-11-28 18:26:32 -06:00
|
|
|
|
|
|
|
|
// Global pointers to characteristics for notification support
|
2025-12-18 22:28:55 -06:00
|
|
|
extern std::atomic<NimBLECharacteristic*> ssidListChar;
|
|
|
|
|
extern std::atomic<NimBLECharacteristic*> ssidRefreshChar;
|
2025-12-18 22:19:54 -06:00
|
|
|
extern std::atomic<bool> isBLEClientConnected;
|
2025-11-28 18:26:32 -06:00
|
|
|
|
|
|
|
|
class MyServerCallbacks : public NimBLEServerCallbacks {
|
2025-12-18 22:08:07 -06:00
|
|
|
void onConnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo);
|
|
|
|
|
void onDisconnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo, int reason);
|
2025-11-28 18:26:32 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class MyCharCallbacks : public NimBLECharacteristicCallbacks {
|
2025-12-18 22:08:07 -06:00
|
|
|
void onRead(NimBLECharacteristic* pChar, NimBLEConnInfo& connInfo);
|
2025-12-17 21:52:00 -06:00
|
|
|
void onWrite(NimBLECharacteristic* pChar, NimBLEConnInfo& connInfo);
|
2025-11-28 18:26:32 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NimBLEAdvertising* initBLE();
|
2026-01-08 18:14:36 -06:00
|
|
|
bool BLEtick(NimBLEAdvertising* pAdvertising);
|
2025-11-28 18:26:32 -06:00
|
|
|
|
|
|
|
|
#endif
|