Golioth Zephyr SDK
|
Data Structures | |
struct | golioth_settings_value |
A setting value. More... | |
struct | golioth_settings |
Settings state data, placed in struct golioth_client. More... | |
Typedefs | |
typedef enum golioth_settings_status(* | golioth_settings_cb) (const char *key, const struct golioth_settings_value *value) |
Callback for an individual setting. More... | |
Enumerations | |
enum | golioth_settings_status { GOLIOTH_SETTINGS_SUCCESS = 0 , GOLIOTH_SETTINGS_KEY_NOT_RECOGNIZED = 1 , GOLIOTH_SETTINGS_KEY_NOT_VALID = 2 , GOLIOTH_SETTINGS_VALUE_FORMAT_NOT_VALID = 3 , GOLIOTH_SETTINGS_VALUE_OUTSIDE_RANGE = 4 , GOLIOTH_SETTINGS_VALUE_STRING_TOO_LONG = 5 , GOLIOTH_SETTINGS_GENERAL_ERROR = 6 } |
Enumeration of Settings status codes. More... | |
enum | golioth_settings_value_type { GOLIOTH_SETTINGS_VALUE_TYPE_UNKNOWN , GOLIOTH_SETTINGS_VALUE_TYPE_BOOL , GOLIOTH_SETTINGS_VALUE_TYPE_FLOAT , GOLIOTH_SETTINGS_VALUE_TYPE_STRING , GOLIOTH_SETTINGS_VALUE_TYPE_INT64 } |
Different types of setting values. More... | |
Functions | |
int | golioth_settings_register_callback (struct golioth_client *client, golioth_settings_cb callback) |
Register callback for handling settings. More... | |
int | golioth_settings_observe (struct golioth_client *client) |
Observe for Settings. More... | |
Functions for interacting with the Golioth Settings service
The Settings service is for long-lived persistent configuration data. Settings are configured/written from the cloud and read by the device. The device observes for settings updates, and reports status of applying the settings to the cloud.
Each setting is a key/value pair, where the key is a string and the value can be bool, float, or string.
Overall, the flow is:
This library is responsible for interfacing with the cloud and has no knowledge of the specific settings.
typedef enum golioth_settings_status(* golioth_settings_cb) (const char *key, const struct golioth_settings_value *value) |
Callback for an individual setting.
key | The setting key, NULL-terminated |
value | The setting value |
Definition at line 1 of file settings.h.
Enumeration of Settings status codes.
Definition at line 45 of file settings.h.
Different types of setting values.
Note that there is no "int" type because all numbers sent by the server are formatted as floating point.
Enumerator | |
---|---|
GOLIOTH_SETTINGS_VALUE_TYPE_UNKNOWN | |
GOLIOTH_SETTINGS_VALUE_TYPE_BOOL | |
GOLIOTH_SETTINGS_VALUE_TYPE_FLOAT | |
GOLIOTH_SETTINGS_VALUE_TYPE_STRING | |
GOLIOTH_SETTINGS_VALUE_TYPE_INT64 |
Definition at line 68 of file settings.h.
int golioth_settings_observe | ( | struct golioth_client * | client | ) |
Observe for Settings.
User applications should call this function in the on_connect
callback, if they wish to observe Settings.
Establishes a single observation for the settings endpoint ".c". The handler for this observation will call the callback registered with golioth_settings_register_callback.
client | Client instance |
int golioth_settings_register_callback | ( | struct golioth_client * | client, |
golioth_settings_cb | callback | ||
) |
Register callback for handling settings.
The client will be used to observe for settings from the cloud.
client | Client handle |
callback | Callback function to call for settings changes |