Loading...
Searching...
No Matches
stock_store.h
Go to the documentation of this file.
1
11#pragma once
12#include <pebble.h>
13
14#include "wire/stock_wire.h"
15
20
25typedef struct
26{
27 bool live;
29 uint32_t persist_key;
31
36typedef struct
37{
39} StockSeed;
40
47void stock_store_init(StockConfig cfg, const StockSeed *seed);
48
56
58void stock_store_subscribe(void (*cb)(void));
59
61const StockStrip *stock_store_strip(void);
62
69const StockSlot *stock_store_slot(uint8_t index);
70
72int stock_store_age_s(void);
73
void stock_store_subscribe(void(*cb)(void))
Hand it the function to call when a quote changes (the screen redraw).
Definition stock_store.c:122
const StockSlot * stock_store_slot(uint8_t index)
One slot by index, or NULL when the index is past what is filled.
Definition stock_store.c:188
const StockStrip * stock_store_strip(void)
The whole watchlist strip. count is 0 until a reading lands.
Definition stock_store.c:183
int stock_store_age_s(void)
How many seconds since the last reading turned up, or -1 if we have none.
Definition stock_store.c:197
void stock_store_init(StockConfig cfg, const StockSeed *seed)
Start the store with its rules. Pass seed = NULL for normal use.
Definition stock_store.c:127
void stock_store_reconfigure(StockConfig cfg)
Re-apply the rules (e.g. the poll interval changed). Moves the next poll to the new interval,...
Definition stock_store.c:176
The watchlist as the phone packs it, and the reader that unpacks it.
The rules a face hands the store, built from its own settings so the store names no SETTING_*.
Definition stock_store.h:26
int poll_min
Minutes between stock requests.
Definition stock_store.h:28
uint32_t persist_key
Slot for the last good strip so the face owns the key instead of the store.
Definition stock_store.h:29
bool live
True subscribes the channel and polls. False just keeps the fake data for screenshots.
Definition stock_store.h:27
Optional prefill: shown until the first real reading lands, or pinned when live = false.
Definition stock_store.h:37
const StockStrip * strip
The slots to show, or NULL for none.
Definition stock_store.h:38
One quote slot. When ok is false the symbol field carries a short status word ("RATE LIMIT" and frien...
Definition stock_wire.h:32
The watchlist strip. count is 0 until a reading lands.
Definition stock_wire.h:41