Loading...
Searching...
No Matches
stock_wire.h
Go to the documentation of this file.
1
13#pragma once
14#include <stdbool.h>
15#include <stdint.h>
16
21
22// STOCK_SLOTS_MAX and STOCK_SYMBOL_LEN are generated from the phone's cap table, so the two sides
23// of the strip cannot drift. A ticker runs to about six characters and a status word such as
24// "INVALID KEY" to eleven, which is what the label width is sized for
25#include "wire/wire_caps.g.h"
26
31typedef struct
32{
36 bool ok;
37} StockSlot;
38
40typedef struct
41{
42 uint8_t count;
45
60bool stock_wire_decode(const uint8_t *buf, uint16_t len, StockStrip *out);
61
bool stock_wire_decode(const uint8_t *buf, uint16_t len, StockStrip *out)
Unpacks a watchlist off the wire.
Definition stock_wire.c:12
One quote slot. When ok is false the symbol field carries a short status word ("RATE LIMIT" and frien...
Definition stock_wire.h:32
char symbol[STOCK_SYMBOL_LEN]
Ticker, or status text when ok is false, or empty when there is none.
Definition stock_wire.h:33
int price_cents
Last price times 100.
Definition stock_wire.h:34
int change_pct
Percent change times 100, can be negative.
Definition stock_wire.h:35
bool ok
True for a live reading, false for a status message.
Definition stock_wire.h:36
The watchlist strip. count is 0 until a reading lands.
Definition stock_wire.h:41
uint8_t count
How many slots are filled (0 means none yet).
Definition stock_wire.h:42
StockSlot slot[STOCK_SLOTS_MAX]
The quote slots, filled up to count.
Definition stock_wire.h:43
Strip caps and marker values shared by the phone and the watch.
#define STOCK_SYMBOL_LEN
A watchlist label, 11 characters plus its terminator.
Definition wire_caps.g.h:22
#define STOCK_SLOTS_MAX
How many tickers the watchlist strip carries.
Definition wire_caps.g.h:20