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

AppMessage transport. Decodes the inbox and notifies the app through per-channel handlers, and queues the outbound weather, stock, calendar, phone battery, and now playing requests through one outbox. More...

#include <pebble.h>
#include "io/long_text.h"
#include "weather/weather_reading.h"

Go to the source code of this file.

Typedefs

typedef void(*) WeatherHandler(const WeatherMessage *msg)
 Called with one weather message, holding every group of readings it carried.
typedef void(*) CoordsHandler(const char *lat, const char *lon)
 Called with a fresh pair of coordinates.
typedef void(*) SettingsChangedHandler(bool time_or_date_changed)
 Called after a settings save that changed something.
typedef void(*) UnitChangedHandler(bool fahrenheit)
 Called when the wearer switches the temperature unit on the settings page.
typedef void(*) StockStripHandler(const uint8_t *buf, uint16_t len)
 Called with a packed watchlist strip. The handler owns the wire format.
typedef void(*) CalendarStripHandler(const uint8_t *buf, uint16_t len)
 Called with a packed agenda strip. The store owns the wire format.
typedef void(*) PhoneBatteryHandler(int level)
 Called with the phone's battery level.
typedef void(*) MusicHandler(const char *title, const char *artist, bool playing)
 Called with what the phone is playing.
typedef void(*) MusicNoPluginHandler(bool no_plugin)
 Called with whether the phone says no plugin on it serves now playing, which it sends as WIRE_NO_PLUGIN in place of playing.
typedef void(*) MusicArtHandler(const uint8_t *buf, uint16_t len)
 Called with the album art the phone sent, as raw wire bytes.
typedef void(*) InboxCompleteHandler(void)
 Called once after every inbox message is fully handled.

Functions

void appmessage_on_weather (WeatherHandler cb)
 One weather message, every group it carried.
void appmessage_on_coords (CoordsHandler cb)
 Latitude and longitude.
void appmessage_on_settings_changed (SettingsChangedHandler cb)
 A setting changed on the phone.
void appmessage_on_unit_changed (UnitChangedHandler cb)
 The wearer switched the temperature unit.
void appmessage_on_stock_strip (StockStripHandler cb)
 Packed watchlist strip.
void appmessage_on_calendar_strip (CalendarStripHandler cb)
 Packed agenda strip.
void appmessage_on_phone_battery (PhoneBatteryHandler cb)
 The phone's battery. Does nothing on a face without the phone keys.
void appmessage_on_music (MusicHandler cb)
 What the phone is playing. Does nothing on a face without the music keys.
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 the music keys.
void appmessage_on_music_art (MusicArtHandler cb)
 Album art. Does nothing on a face without the album art key.
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.
void appmessage_add_inbox_complete (InboxCompleteHandler cb)
 Adds work to run once after a whole inbound message is handled, after every channel in it.
void appmessage_open (uint32_t inbox_size)
 Register the SDK callbacks and open the inbox and outbox.
void appmessage_request_weather (void)
 Asks the phone for a fresh weather reading. The weather store calls this on its turn on the shared cadence. On a face that does not declare the weather keys it sends nothing and logs one warning the first time it is called. The weather keys are WEATHER_REQUEST, WEATHER_TEMPERATURE, WEATHER_CONDITIONS, and WEATHER_OK, and a face that declares only some of them fails to build, with each missing one named.
void appmessage_request_stock (void)
 Asks the phone for fresh quotes. The stock store calls this on its turn on the shared cadence. Does nothing on faces that do not declare the stock keys.
void appmessage_request_calendar (void)
 Asks the phone for a fresh agenda. The calendar store calls this on its turn on the shared cadence. Does nothing on faces that do not declare the calendar keys.
void appmessage_request_phone (void)
 Asks the phone for its battery level. The phone battery store calls this at launch and when the phone comes back. Does nothing on a face that does not declare PHONE_BATTERY and PHONE_REQUEST.
void appmessage_release_phone (void)
 Tells the phone the face no longer shows the phone's battery, so it ends its subscription and stops waking the watch on every change in the level. The phone battery store calls this when a face starts it not live. Goes out as PHONE_REQUEST 0, and does nothing on a face without the keys.
void appmessage_request_music (void)
 Asks the phone what it is playing. The now playing store calls this at launch and when the phone comes back. Does nothing on a face that does not declare the four music keys.
void appmessage_release_music (void)
 Tells the phone the face no longer shows what is playing, so it ends its subscription and stops waking the watch on every change of track. The now playing store calls this when a face starts it not live. Goes out as MUSIC_REQUEST 0, and does nothing on a face without the keys.

Detailed Description

AppMessage transport. Decodes the inbox and notifies the app through per-channel handlers, and queues the outbound weather, stock, calendar, phone battery, and now playing requests through one outbox.