The persist API. A per-face SettingField table drives versioned load and save, sanitizing, the typed reads, and the AppMessage round trip, so the shared code never names or hardcodes a single field. More...
#include <pebble.h>Go to the source code of this file.
Data Structures | |
| struct | SettingField |
| Blueprint for a single setting. More... | |
| struct | SettingsSchema |
| A face's persistence identity. More... | |
| struct | SettingsInbound |
| Carries what an inbound settings message changed, so the caller can react. More... | |
Macros | |
| #define | SETTINGS_BLOB_SIZE(blob) |
| The size of a settings struct, for a schema's blob_size, and a build that stops when the struct is too big to save. | |
Typedefs | |
| typedef struct SettingsSchema | SettingsSchema |
| A face's persistence identity. | |
Enumerations | |
| enum | SettingId { SETTING_TEMPERATURE_UNIT , SETTING_DATE_FORMAT , SETTING_THEME , SETTING_STEPS_MODE , SETTING_DISTANCE_UNIT , SETTING_TIME_FORMAT , SETTING_BLUETOOTH_ICON , SETTING_QUIET_TIME_ICON , SETTING_BLUETOOTH_VIBE_CONNECT , SETTING_BLUETOOTH_VIBE_DISCONNECT , SETTING_HOURLY_VIBE , SETTING_BATTERY_DISPLAY , SETTING_HEADER_FONT , SETTING_COUNT } |
| Identity of a known (shared) setting, used for typed reads and indexing. More... | |
| enum | SettingType { SETTING_BOOL , SETTING_ENUM_U8 , SETTING_CSTRING , SETTING_COLOR } |
| How a setting encodes on the wire and how the sanitize pass clamps it. More... | |
Functions | |
| void | settings_init (const SettingsSchema *schema) |
| Load a face's settings from their saved blobs, applying defaults first. | |
| bool | settings_was_fresh (void) |
| Whether the watch booted with no saved settings, because storage was wiped by a fresh install or an update. Lets the phone know it should push its own config back rather than trust the watch's defaults. | |
| void | settings_save (void) |
| Persist the active face's structs under their keys (the whole chain). | |
| void | settings_mark_restored (void) |
| Clears settings_was_fresh once a save or restore from the settings page has been saved. | |
| uint8_t | settings_u8 (SettingId id) |
| Read a known uint8/bool setting by id. | |
| const char * | settings_str (SettingId id) |
| Read a known string setting by id. | |
| void | settings_set_u8 (SettingId id, uint8_t value) |
| Write a known uint8 or enum setting by id. In memory only, does not persist. | |
| uint8_t | settings_enum_count (SettingId id) |
| How many values an enum setting allows (its sanitize ceiling). | |
| uint32_t | settings_serialized_size_max (void) |
| The most outbox bytes every field of the active face could ever take once written. | |
| bool | settings_serialize (DictionaryIterator *iter) |
| Write every field of the active face into an outbox iterator. | |
| SettingsInbound | settings_apply_inbox (DictionaryIterator *iter) |
| Apply any settings present in an inbox message to the active face. | |
The persist API. A per-face SettingField table drives versioned load and save, sanitizing, the typed reads, and the AppMessage round trip, so the shared code never names or hardcodes a single field.