Loading...
Searching...
No Matches
stock_store.h File Reference

Active stock store. It owns the appmessage stock channel and its place on the shared cadence, so a face just hands it the rules (live / poll interval), optionally seeds it, then reads the slots and subscribes for repaints. The phone data flows straight in and nobody wires it. More...

#include <pebble.h>
#include "wire/stock_wire.h"

Go to the source code of this file.

Data Structures

struct  StockConfig
 The rules a face hands the store, built from its own settings so the store names no SETTING_*. More...
struct  StockSeed
 Optional prefill: shown until the first real reading lands, or pinned when live = false. More...

Functions

void stock_store_init (StockConfig cfg, const StockSeed *seed)
 Start the store with its rules. Pass seed = NULL for normal use.
void stock_store_reconfigure (StockConfig cfg)
 Re-apply the rules (e.g. the poll interval changed). Moves the next poll to the new interval, and switching the store off here stops it asking the phone. Only init decides whether the store is live, so one init started with live = false stays on its seed whatever cfg says, and one never started ignores the call.
void stock_store_subscribe (void(*cb)(void))
 Hand it the function to call when a quote changes (the screen redraw).
const StockStrip * stock_store_strip (void)
 The whole watchlist strip. count is 0 until a reading lands.
const StockSlot * stock_store_slot (uint8_t index)
 One slot by index, or NULL when the index is past what is filled.
int stock_store_age_s (void)
 How many seconds since the last reading turned up, or -1 if we have none.

Detailed Description

Active stock store. It owns the appmessage stock channel and its place on the shared cadence, so a face just hands it the rules (live / poll interval), optionally seeds it, then reads the slots and subscribes for repaints. The phone data flows straight in and nobody wires it.