You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-22Lines changed: 30 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,7 +109,7 @@ platform = espressif32
109
109
board = node32s
110
110
```
111
111
112
-
This is largley left as an exersise for the reader as everyone's requirements will vary.
112
+
This is left as an exersise for the reader as everyone's requirements will vary.
113
113
114
114
### Running the interface locally
115
115
@@ -325,15 +325,15 @@ void loop() {
325
325
326
326
### Developing with the framework
327
327
328
-
The framework promotes a modular design and exposes features you may re-use to speed up the development of your project. Where possible it is recommended that you use the features the frameworks supplies. These are documented below.
328
+
The framework promotes a modular design and exposes features you may re-use to speed up the development of your project. Where possible it is recommended that you use the features the frameworks supplies. These are documented in this section and a comprenensive example is provided by the demo project.
329
329
330
-
The following diagram visualises how the framework's modular components fit together. They are described in detail below.
330
+
The following diagram visualises how the framework's modular components fit together, each feature is described in detail below.
The [SettingsService.h](lib/framework/SettingsService.h) class is a responsible for managing settings and interfacing with code which wants to control or respond to changes in those settings. You can define a data class to hold settings then build a SettingsService instance to manage them:
336
+
The [SettingsService.h](lib/framework/SettingsService.h) class is a responsible for managing settings and interfacing with code which wants to change or respond to changes in them. You can define a data class to hold settings then build a SettingsService instance to manage them:
337
337
338
338
```cpp
339
339
classLightSettings {
@@ -346,7 +346,7 @@ class LightSettingsService : public SettingsService<LightSettings> {
346
346
};
347
347
```
348
348
349
-
You may listen for changes to settings by registering an update handler callback. It is possible to remove an update handler later if required. An "origin" pointer is passed to the update handler which may point to the client or object which made the update.
349
+
You may listen for changes to settings by registering an update handler callback. It is possible to remove an update handler later if required.
An "originId" is passed to the update handler which may be used to identify the origin of the update. The default origin values the framework provides are:
364
+
365
+
Origin | Description
366
+
----------------- | -----------
367
+
endpoint | An update over REST (SettingsEndpoint)
368
+
broker | An update sent over MQTT (SettingsBroker)
369
+
socket:{clientId} | An update sent over WebSocket (SettingsSocket)
370
+
363
371
SettingsService exposes a read function which you may use to safely read the settings. This function takes care of protecting against parallel access to the settings in multi-core enviornments such as the ESP32.
SettingsService also exposes an update function which allows the caller to update the settings. The update function takes care of calling the registered update handler callbacks once the update is complete.
379
+
SettingsService also exposes an update function which allows the caller to update the settings with a callback. This approach automatically calls the registered update handlers when complete. The example below turns on the lights using the arbitrary origin "timer":
@@ -447,7 +455,7 @@ class LightSettingsService : public SettingsService<LightSettings> {
447
455
448
456
The framework has security features to prevent unauthorized use of the device. This is driven by [SecurityManager.h](lib/framework/SecurityManager.h).
449
457
450
-
On successful authentication, the /rest/signIn endpoint issues a JWT which is then sent using Bearer Authentication. The framework come with builtin predicates for verifying a users access level. The built in AuthenticationPredicates can be found in [SecurityManager.h](lib/framework/SecurityManager.h):
458
+
On successful authentication, the /rest/signIn endpoint issues a JWT which is then sent using Bearer Authentication. The framework come with built-in predicates for verifying a users access privileges. The built in AuthenticationPredicates can be found in [SecurityManager.h](lib/framework/SecurityManager.h) and are as follows:
451
459
452
460
Predicate | Description
453
461
-------------------- | -----------
@@ -480,32 +488,32 @@ getMQTTClient() | Provides direct access to the MQTT client instanc
480
488
481
489
These can be used to observe changes to settings. They can also be used to fetch or update settings.
0 commit comments