Listing pages (rated/newest) and per-camera pages are fetched over HTTPS with the certificate bundle; the camera page's Live Feed mode yields the camera's own MJPEG URL (Current Still as fallback), resolved just before playing and cached in favourites. New Provider menu row: insecam / opentopia / mixed. cam_info_t gains provider + title fields and the settings blob a version byte; older favourites and settings still load.
38 lines
1.4 KiB
C
38 lines
1.4 KiB
C
#pragma once
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include "insecam.h"
|
|
|
|
// Persistent settings (NVS namespace "widget"); Kconfig supplies first-boot defaults.
|
|
typedef enum { LISTING_MIXED = 0, LISTING_RATING, LISTING_NEW } listing_pref_t;
|
|
typedef enum { SOURCE_RANDOM = 0, SOURCE_FAVORITES } source_pref_t;
|
|
typedef enum { PROVIDER_PREF_INSECAM = 0, PROVIDER_PREF_OPENTOPIA, PROVIDER_PREF_MIXED } provider_pref_t;
|
|
|
|
typedef struct {
|
|
uint16_t interval_s; // 5..300
|
|
uint8_t lcd_brightness; // 0..100
|
|
uint8_t led_brightness; // 0..255
|
|
uint8_t listing; // listing_pref_t
|
|
uint8_t source; // source_pref_t
|
|
uint8_t caption; // 1 = caption shown
|
|
uint8_t provider; // provider_pref_t (appended; older blobs load with the default)
|
|
uint8_t version; // SETTINGS_VERSION; lets us tell a pre-provider blob apart
|
|
} settings_t;
|
|
#define SETTINGS_VERSION 2
|
|
|
|
extern settings_t settings;
|
|
|
|
void settings_init(void); // nvs_flash_init + load settings and favourites
|
|
void settings_save(void);
|
|
|
|
// One-shot flag: reboot into the Wi-Fi setup hotspot.
|
|
void settings_request_portal(void);
|
|
bool settings_take_portal_request(void);
|
|
|
|
#define FAV_SLOTS 12
|
|
const cam_info_t *fav_get(int slot); // NULL when empty
|
|
void fav_set(int slot, const cam_info_t *cam);
|
|
void fav_clear(int slot);
|
|
int fav_find(const cam_info_t *cam); // slot holding this camera (by id), or -1
|
|
int fav_count(void);
|