Loading...
Searching...
No Matches
appmessage.h
Go to the documentation of this file.
1
9#pragma once
10#include <pebble.h>
11
12#include "io/long_text.h"
14
19
20// per-channel handler types. a store or a face registers only the channels it cares about, so
21// the appmessage pipeline stays separate from who reads the data
22
31typedef void (*WeatherHandler)(const WeatherMessage *msg);
32
39typedef void (*CoordsHandler)(const char *lat, const char *lon);
40
47typedef void (*SettingsChangedHandler)(bool time_or_date_changed);
48
56typedef void (*UnitChangedHandler)(bool fahrenheit);
57
64typedef void (*StockStripHandler)(const uint8_t *buf, uint16_t len);
65
72typedef void (*CalendarStripHandler)(const uint8_t *buf, uint16_t len);
73
80typedef void (*PhoneBatteryHandler)(int level);
81
91typedef void (*MusicHandler)(const char *title, const char *artist, bool playing);
92
102typedef void (*MusicNoPluginHandler)(bool no_plugin);
103
113typedef void (*MusicArtHandler)(const uint8_t *buf, uint16_t len);
114
121typedef void (*InboxCompleteHandler)(void);
122
123// each channel holds one handler, and a later call replaces it. NULL clears it, so the channel's
124// messages are dropped
135
162void appmessage_set_long_text(uint32_t key, uint16_t cap, LongTextProvider provider, LongTextReceiver receiver);
163
174
191void appmessage_open(uint32_t inbox_size);
192
201
207void appmessage_request_stock(void);
208
214
219void appmessage_request_phone(void);
220
226void appmessage_release_phone(void);
227
232void appmessage_request_music(void);
233
239void appmessage_release_music(void);
240
void appmessage_on_phone_battery(PhoneBatteryHandler cb)
The phone's battery. Does nothing on a face without the phone keys.
Definition appmessage.c:66
void(*) LongTextReceiver(const char *text)
Called with a long text setting the phone sent, for the face to store.
Definition long_text.h:38
void appmessage_release_phone(void)
Tells the phone the face no longer shows the phone's battery, so it ends its subscription and stops w...
Definition appmessage.c:368
void appmessage_on_music_no_plugin(MusicNoPluginHandler cb)
Whether no plugin serves now playing, just before each music message. Does nothing on a face without ...
Definition appmessage.c:84
void appmessage_on_calendar_strip(CalendarStripHandler cb)
Packed agenda strip.
Definition appmessage.c:64
void(*) MusicArtHandler(const uint8_t *buf, uint16_t len)
Called with the album art the phone sent, as raw wire bytes.
Definition appmessage.h:113
void appmessage_on_stock_strip(StockStripHandler cb)
Packed watchlist strip.
Definition appmessage.c:63
void appmessage_on_music_art(MusicArtHandler cb)
Album art. Does nothing on a face without the album art key.
Definition appmessage.c:93
void appmessage_add_inbox_complete(InboxCompleteHandler cb)
Adds work to run once after a whole inbound message is handled, after every channel in it.
Definition appmessage.c:107
void(*) CoordsHandler(const char *lat, const char *lon)
Called with a fresh pair of coordinates.
Definition appmessage.h:39
void(*) WeatherHandler(const WeatherMessage *msg)
Called with one weather message, holding every group of readings it carried.
Definition appmessage.h:31
void appmessage_request_phone(void)
Asks the phone for its battery level. The phone battery store calls this at launch and when the phone...
Definition appmessage.c:360
void appmessage_set_long_text(uint32_t key, uint16_t cap, LongTextProvider provider, LongTextReceiver receiver)
Sets up one text setting too long for the settings blob, on a message key of the face's own.
Definition appmessage.c:102
void(*) UnitChangedHandler(bool fahrenheit)
Called when the wearer switches the temperature unit on the settings page.
Definition appmessage.h:56
void appmessage_on_music(MusicHandler cb)
What the phone is playing. Does nothing on a face without the music keys.
Definition appmessage.c:75
void appmessage_release_music(void)
Tells the phone the face no longer shows what is playing, so it ends its subscription and stops wakin...
Definition appmessage.c:384
void appmessage_on_coords(CoordsHandler cb)
Latitude and longitude.
Definition appmessage.c:60
void appmessage_on_weather(WeatherHandler cb)
One weather message, every group it carried.
Definition appmessage.c:59
void(*) MusicHandler(const char *title, const char *artist, bool playing)
Called with what the phone is playing.
Definition appmessage.h:91
void(*) LongTextProvider(char *out, size_t size)
Called to write the long text setting the face holds, for the settings reply and to tell a save that ...
Definition long_text.h:47
void appmessage_request_music(void)
Asks the phone what it is playing. The now playing store calls this at launch and when the phone come...
Definition appmessage.c:376
void(*) SettingsChangedHandler(bool time_or_date_changed)
Called after a settings save that changed something.
Definition appmessage.h:47
void(*) StockStripHandler(const uint8_t *buf, uint16_t len)
Called with a packed watchlist strip. The handler owns the wire format.
Definition appmessage.h:64
void(*) InboxCompleteHandler(void)
Called once after every inbox message is fully handled.
Definition appmessage.h:121
void(*) PhoneBatteryHandler(int level)
Called with the phone's battery level.
Definition appmessage.h:80
void appmessage_on_unit_changed(UnitChangedHandler cb)
The wearer switched the temperature unit.
Definition appmessage.c:62
void appmessage_open(uint32_t inbox_size)
Register the SDK callbacks and open the inbox and outbox.
Definition appmessage.c:827
void appmessage_request_calendar(void)
Asks the phone for a fresh agenda. The calendar store calls this on its turn on the shared cadence....
Definition appmessage.c:353
void appmessage_request_stock(void)
Asks the phone for fresh quotes. The stock store calls this on its turn on the shared cadence....
Definition appmessage.c:346
void appmessage_on_settings_changed(SettingsChangedHandler cb)
A setting changed on the phone.
Definition appmessage.c:61
void(*) MusicNoPluginHandler(bool no_plugin)
Called with whether the phone says no plugin on it serves now playing, which it sends as WIRE_NO_PLUG...
Definition appmessage.h:102
void(*) CalendarStripHandler(const uint8_t *buf, uint16_t len)
Called with a packed agenda strip. The store owns the wire format.
Definition appmessage.h:72
void appmessage_request_weather(void)
Asks the phone for a fresh weather reading. The weather store calls this on its turn on the shared ca...
Definition appmessage.c:330
One text setting too long for the settings blob, which rides its own message key and the face's own s...
One weather message as the transport read it, before anything is kept.
Definition weather_reading.h:43
One weather message off the phone, and the reading it leaves behind.