-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBleepingCustomConfig.ino
More file actions
executable file
·54 lines (39 loc) · 1.47 KB
/
BleepingCustomConfig.ino
File metadata and controls
executable file
·54 lines (39 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
BleepingCustomConfig
An example ESP32 sketch using the Bleep App and Library
This example will start a BLE server allowing a user to configure WiFi credentials.
It uses methods exposed by the BleepingLibrary to implement custom configuration properties.
Read more in the Getting Started guide.
https://github.com/MClarkDev/BleepingLibrary/blob/master/GettingStarted.md
*/
#include "BleepingLibrary.h"
BleepingLibrary bLib;
BleepingUUID myUUID_R = BleepingUUID("00000000-0000-beef-002f-a00001000000");
BleepingUUID myUUID_W = BleepingUUID("00000000-0000-beef-002f-a00002000000");
BleepingUUID myUUID_RW = BleepingUUID("00000000-0000-beef-002f-a00003000000");
BleepingUUID uuids[] = { myUUID_R, myUUID_W, myUUID_RW };
void setup() {
// Initialize
int boots = bLib.init();
ESP_LOGI(_BLib, "Boots: %d", boots);
// Setup BLE server
BleepingServer* server = bLib.getServer();
server->setDeviceName("BleepingDevice");
server->startServer();
// Custom Config Parameters
server->startCustomPropertyService(uuids, 3);
/**
Implement your code below!
*/
ESP_LOGI(_BLib, "Now running my Bleeping App!");
ESP_LOGI(_BLib, "Setup mode is still running!");
int timeout = millis() + (5 * 60 * 1000);
while (millis() < timeout) {
String val = bLib.getConfig()->getString(myUUID_RW, "_default_");
ESP_LOGI(_BLib, "Got: %s", val.c_str());
delay(1000);
}
ESP.restart();
}
void loop() {
}