Loading...
Searching...
No Matches
appmessage_features.h
Go to the documentation of this file.
1
25#pragma once
26
27// a face has the settings reply when it declares both settings keys. the phone asks for the
28// watch's settings with SETTINGS_REQUEST, and the watch answers with SETTINGS_FRESH to say it booted
29// with nothing saved, so the phone puts the wearer's settings back rather than copying the watch's
30// defaults over them. a face that declares neither never has its settings sent back or restored.
31// one without the other stops the build with the missing one named
32#if defined(HAS_MESSAGE_KEY_SETTINGS_REQUEST) && defined(HAS_MESSAGE_KEY_SETTINGS_FRESH)
33#define APPMESSAGE_HAS_SETTINGS 1
34#elif defined(HAS_MESSAGE_KEY_SETTINGS_REQUEST)
35#error "settings need SETTINGS_FRESH in messageKeys beside SETTINGS_REQUEST"
36#elif defined(HAS_MESSAGE_KEY_SETTINGS_FRESH)
37#error "settings need SETTINGS_REQUEST in messageKeys beside SETTINGS_FRESH"
38#endif
39
40// a face has weather when it declares all four of these. the watch asks with the first and reads a
41// reading off the other three, so all four are one decision. the ok flag is the one that tells a
42// failed fetch from a reading, and a face without it would show "NO GPS" as a live 0 degrees.
43// a face that declares none opted out of weather and builds without it. a face that declares only
44// some has a typo or a gap, which would otherwise build and go wrong on the watch, so the build
45// stops and names each missing key
46#if defined(HAS_MESSAGE_KEY_WEATHER_REQUEST) && defined(HAS_MESSAGE_KEY_WEATHER_TEMPERATURE) && \
47 defined(HAS_MESSAGE_KEY_WEATHER_CONDITIONS) && defined(HAS_MESSAGE_KEY_WEATHER_OK)
48#define APPMESSAGE_HAS_WEATHER 1
49#elif defined(HAS_MESSAGE_KEY_WEATHER_REQUEST) || defined(HAS_MESSAGE_KEY_WEATHER_TEMPERATURE) || \
50 defined(HAS_MESSAGE_KEY_WEATHER_CONDITIONS) || defined(HAS_MESSAGE_KEY_WEATHER_OK)
51#if !defined(HAS_MESSAGE_KEY_WEATHER_REQUEST)
52#error "weather needs WEATHER_REQUEST in messageKeys. A face with weather declares WEATHER_REQUEST, WEATHER_TEMPERATURE, WEATHER_CONDITIONS, and WEATHER_OK"
53#endif
54#if !defined(HAS_MESSAGE_KEY_WEATHER_TEMPERATURE)
55#error "weather needs WEATHER_TEMPERATURE in messageKeys. A face with weather declares WEATHER_REQUEST, WEATHER_TEMPERATURE, WEATHER_CONDITIONS, and WEATHER_OK"
56#endif
57#if !defined(HAS_MESSAGE_KEY_WEATHER_CONDITIONS)
58#error "weather needs WEATHER_CONDITIONS in messageKeys. A face with weather declares WEATHER_REQUEST, WEATHER_TEMPERATURE, WEATHER_CONDITIONS, and WEATHER_OK"
59#endif
60#if !defined(HAS_MESSAGE_KEY_WEATHER_OK)
61#error "weather needs WEATHER_OK in messageKeys. A face with weather declares WEATHER_REQUEST, WEATHER_TEMPERATURE, WEATHER_CONDITIONS, and WEATHER_OK"
62#endif
63#endif
64
65// the weather extras, today's forecast, and the air readings are each read whole, so a face that
66// declares only part of one would get none of it and leave those panels on dashes with nothing to
67// say why. the build stops instead and names each missing key
68#if defined(HAS_MESSAGE_KEY_WEATHER_HUMIDITY) && defined(HAS_MESSAGE_KEY_WEATHER_WIND_SPEED) && \
69 defined(HAS_MESSAGE_KEY_WEATHER_WIND_DIR) && defined(HAS_MESSAGE_KEY_WEATHER_SUNRISE) && \
70 defined(HAS_MESSAGE_KEY_WEATHER_SUNSET)
71#define APPMESSAGE_HAS_WEATHER_EXTRAS 1
72#elif defined(HAS_MESSAGE_KEY_WEATHER_HUMIDITY) || defined(HAS_MESSAGE_KEY_WEATHER_WIND_SPEED) || \
73 defined(HAS_MESSAGE_KEY_WEATHER_WIND_DIR) || defined(HAS_MESSAGE_KEY_WEATHER_SUNRISE) || \
74 defined(HAS_MESSAGE_KEY_WEATHER_SUNSET)
75#if !defined(HAS_MESSAGE_KEY_WEATHER_HUMIDITY)
76#error "the weather extras need WEATHER_HUMIDITY in messageKeys. A face with the extras declares WEATHER_HUMIDITY, WEATHER_WIND_SPEED, WEATHER_WIND_DIR, WEATHER_SUNRISE, and WEATHER_SUNSET"
77#endif
78#if !defined(HAS_MESSAGE_KEY_WEATHER_WIND_SPEED)
79#error "the weather extras need WEATHER_WIND_SPEED in messageKeys. A face with the extras declares WEATHER_HUMIDITY, WEATHER_WIND_SPEED, WEATHER_WIND_DIR, WEATHER_SUNRISE, and WEATHER_SUNSET"
80#endif
81#if !defined(HAS_MESSAGE_KEY_WEATHER_WIND_DIR)
82#error "the weather extras need WEATHER_WIND_DIR in messageKeys. A face with the extras declares WEATHER_HUMIDITY, WEATHER_WIND_SPEED, WEATHER_WIND_DIR, WEATHER_SUNRISE, and WEATHER_SUNSET"
83#endif
84#if !defined(HAS_MESSAGE_KEY_WEATHER_SUNRISE)
85#error "the weather extras need WEATHER_SUNRISE in messageKeys. A face with the extras declares WEATHER_HUMIDITY, WEATHER_WIND_SPEED, WEATHER_WIND_DIR, WEATHER_SUNRISE, and WEATHER_SUNSET"
86#endif
87#if !defined(HAS_MESSAGE_KEY_WEATHER_SUNSET)
88#error "the weather extras need WEATHER_SUNSET in messageKeys. A face with the extras declares WEATHER_HUMIDITY, WEATHER_WIND_SPEED, WEATHER_WIND_DIR, WEATHER_SUNRISE, and WEATHER_SUNSET"
89#endif
90#endif
91
92#if defined(HAS_MESSAGE_KEY_WEATHER_UV_INDEX) && defined(HAS_MESSAGE_KEY_WEATHER_TEMP_MAX) && \
93 defined(HAS_MESSAGE_KEY_WEATHER_TEMP_MIN) && defined(HAS_MESSAGE_KEY_WEATHER_PRECIP_CHANCE)
94#define APPMESSAGE_HAS_WEATHER_FORECAST 1
95#elif defined(HAS_MESSAGE_KEY_WEATHER_UV_INDEX) || defined(HAS_MESSAGE_KEY_WEATHER_TEMP_MAX) || \
96 defined(HAS_MESSAGE_KEY_WEATHER_TEMP_MIN) || defined(HAS_MESSAGE_KEY_WEATHER_PRECIP_CHANCE)
97#if !defined(HAS_MESSAGE_KEY_WEATHER_UV_INDEX)
98#error "today's forecast needs WEATHER_UV_INDEX in messageKeys. A face with today's forecast declares WEATHER_UV_INDEX, WEATHER_TEMP_MAX, WEATHER_TEMP_MIN, and WEATHER_PRECIP_CHANCE"
99#endif
100#if !defined(HAS_MESSAGE_KEY_WEATHER_TEMP_MAX)
101#error "today's forecast needs WEATHER_TEMP_MAX in messageKeys. A face with today's forecast declares WEATHER_UV_INDEX, WEATHER_TEMP_MAX, WEATHER_TEMP_MIN, and WEATHER_PRECIP_CHANCE"
102#endif
103#if !defined(HAS_MESSAGE_KEY_WEATHER_TEMP_MIN)
104#error "today's forecast needs WEATHER_TEMP_MIN in messageKeys. A face with today's forecast declares WEATHER_UV_INDEX, WEATHER_TEMP_MAX, WEATHER_TEMP_MIN, and WEATHER_PRECIP_CHANCE"
105#endif
106#if !defined(HAS_MESSAGE_KEY_WEATHER_PRECIP_CHANCE)
107#error "today's forecast needs WEATHER_PRECIP_CHANCE in messageKeys. A face with today's forecast declares WEATHER_UV_INDEX, WEATHER_TEMP_MAX, WEATHER_TEMP_MIN, and WEATHER_PRECIP_CHANCE"
108#endif
109#endif
110
111#if defined(HAS_MESSAGE_KEY_WEATHER_FEELS_LIKE) && defined(HAS_MESSAGE_KEY_WEATHER_PRESSURE) && \
112 defined(HAS_MESSAGE_KEY_WEATHER_DEW_POINT)
113#define APPMESSAGE_HAS_WEATHER_AIR 1
114#elif defined(HAS_MESSAGE_KEY_WEATHER_FEELS_LIKE) || defined(HAS_MESSAGE_KEY_WEATHER_PRESSURE) || \
115 defined(HAS_MESSAGE_KEY_WEATHER_DEW_POINT)
116#if !defined(HAS_MESSAGE_KEY_WEATHER_FEELS_LIKE)
117#error "the air readings need WEATHER_FEELS_LIKE in messageKeys. A face with the air readings declares WEATHER_FEELS_LIKE, WEATHER_PRESSURE, and WEATHER_DEW_POINT"
118#endif
119#if !defined(HAS_MESSAGE_KEY_WEATHER_PRESSURE)
120#error "the air readings need WEATHER_PRESSURE in messageKeys. A face with the air readings declares WEATHER_FEELS_LIKE, WEATHER_PRESSURE, and WEATHER_DEW_POINT"
121#endif
122#if !defined(HAS_MESSAGE_KEY_WEATHER_DEW_POINT)
123#error "the air readings need WEATHER_DEW_POINT in messageKeys. A face with the air readings declares WEATHER_FEELS_LIKE, WEATHER_PRESSURE, and WEATHER_DEW_POINT"
124#endif
125#endif
126
127// a weather group is only read beside a reading, so one declared without the four weather keys
128// would build and never arrive. the build stops instead. a face with some of the four already has
129// an error above for each one it is missing, so this only fires for a face with none of them
130#if !defined(HAS_MESSAGE_KEY_WEATHER_REQUEST) && !defined(HAS_MESSAGE_KEY_WEATHER_TEMPERATURE) && \
131 !defined(HAS_MESSAGE_KEY_WEATHER_CONDITIONS) && !defined(HAS_MESSAGE_KEY_WEATHER_OK) && \
132 (defined(APPMESSAGE_HAS_WEATHER_EXTRAS) || \
133 defined(APPMESSAGE_HAS_WEATHER_FORECAST) || defined(APPMESSAGE_HAS_WEATHER_AIR) || \
134 defined(HAS_MESSAGE_KEY_WEATHER_CONDITION_LABEL) || defined(HAS_MESSAGE_KEY_WEATHER_FORECAST_HOURLY) || \
135 defined(HAS_MESSAGE_KEY_WEATHER_FORECAST_DAILY))
136#error "the weather groups need weather in messageKeys. Declare WEATHER_REQUEST, WEATHER_TEMPERATURE, WEATHER_CONDITIONS, and WEATHER_OK beside them"
137#endif
138
139// a face gets coordinates when it declares both halves of the pair. they arrive together, so one
140// without the other could never make a fix, and the build stops and names the missing half rather
141// than leave the face without coordinates and nothing to say why
142#if defined(HAS_MESSAGE_KEY_LOCATION_LATITUDE) && defined(HAS_MESSAGE_KEY_LOCATION_LONGITUDE)
143#define APPMESSAGE_HAS_LOCATION 1
144#elif defined(HAS_MESSAGE_KEY_LOCATION_LATITUDE)
145#error "coordinates need LOCATION_LONGITUDE in messageKeys beside LOCATION_LATITUDE"
146#elif defined(HAS_MESSAGE_KEY_LOCATION_LONGITUDE)
147#error "coordinates need LOCATION_LATITUDE in messageKeys beside LOCATION_LONGITUDE"
148#endif
149
150// a face shows the phone's battery when it declares both phone keys. the watch asks with one and
151// reads the level off the other, so one without the other could never show a level, and the build
152// stops and names the missing one
153#if defined(HAS_MESSAGE_KEY_PHONE_BATTERY) && defined(HAS_MESSAGE_KEY_PHONE_REQUEST)
154#define APPMESSAGE_HAS_PHONE 1
155#elif defined(HAS_MESSAGE_KEY_PHONE_BATTERY)
156#error "the phone battery needs PHONE_REQUEST in messageKeys beside PHONE_BATTERY"
157#elif defined(HAS_MESSAGE_KEY_PHONE_REQUEST)
158#error "the phone battery needs PHONE_BATTERY in messageKeys beside PHONE_REQUEST"
159#endif
160
161// a face shows what the phone is playing when it declares all four music keys. the phone sends the
162// three values in one message and the watch asks with the fourth, so they are one decision, and a
163// face that declares only some of them stops the build with each missing one named
164#if defined(HAS_MESSAGE_KEY_MUSIC_TITLE) && defined(HAS_MESSAGE_KEY_MUSIC_ARTIST) && \
165 defined(HAS_MESSAGE_KEY_MUSIC_PLAYING) && defined(HAS_MESSAGE_KEY_MUSIC_REQUEST)
166#define APPMESSAGE_HAS_MUSIC 1
167#elif defined(HAS_MESSAGE_KEY_MUSIC_TITLE) || defined(HAS_MESSAGE_KEY_MUSIC_ARTIST) || \
168 defined(HAS_MESSAGE_KEY_MUSIC_PLAYING) || defined(HAS_MESSAGE_KEY_MUSIC_REQUEST)
169#if !defined(HAS_MESSAGE_KEY_MUSIC_TITLE)
170#error "now playing needs MUSIC_TITLE in messageKeys. A face with now playing declares MUSIC_TITLE, MUSIC_ARTIST, MUSIC_PLAYING, and MUSIC_REQUEST"
171#endif
172#if !defined(HAS_MESSAGE_KEY_MUSIC_ARTIST)
173#error "now playing needs MUSIC_ARTIST in messageKeys. A face with now playing declares MUSIC_TITLE, MUSIC_ARTIST, MUSIC_PLAYING, and MUSIC_REQUEST"
174#endif
175#if !defined(HAS_MESSAGE_KEY_MUSIC_PLAYING)
176#error "now playing needs MUSIC_PLAYING in messageKeys. A face with now playing declares MUSIC_TITLE, MUSIC_ARTIST, MUSIC_PLAYING, and MUSIC_REQUEST"
177#endif
178#if !defined(HAS_MESSAGE_KEY_MUSIC_REQUEST)
179#error "now playing needs MUSIC_REQUEST in messageKeys. A face with now playing declares MUSIC_TITLE, MUSIC_ARTIST, MUSIC_PLAYING, and MUSIC_REQUEST"
180#endif
181#endif
182
183// album art rides its own key beside the four now playing keys, for a face that started the phone's
184// music feature with art. art with no track to go beside would never be asked for
185#if defined(APPMESSAGE_HAS_MUSIC) && defined(HAS_MESSAGE_KEY_MUSIC_ARTWORK)
186#define APPMESSAGE_HAS_MUSIC_ART 1
187#elif defined(HAS_MESSAGE_KEY_MUSIC_ARTWORK)
188#error "album art needs MUSIC_TITLE, MUSIC_ARTIST, MUSIC_PLAYING, and MUSIC_REQUEST in messageKeys beside MUSIC_ARTWORK"
189#endif
190
191// a face that keeps a plugin source choice needs the settings reply, since only that hands the
192// wearer's pick back to the phone. without it a reinstall of the Pebble app loses the pick
194#if PLUGIN_SOURCE_KEEPS_ANY && !defined(APPMESSAGE_HAS_SETTINGS)
195#error "a kept plugin source choice needs SETTINGS_REQUEST and SETTINGS_FRESH in messageKeys, since only the settings reply hands it back to the phone"
196#endif
The struct the framework keeps the weather, calendar, and stock source choices in,...