|
PebbleOS
|
Weather forecasts sent by the phone. More...
Modules | |
| Weather app preferences | |
| Location ordering stored in the watch app preferences database. | |
| Weather types | |
| Weather conditions and their presentation. | |
Data Structures | |
| struct | WeatherLocationForecast |
| Forecast for one location, as sent by the phone. More... | |
| struct | WeatherDataListNode |
| List node holding the forecast of one location. More... | |
Macros | |
| #define | WEATHER_SERVICE_MAX_SHORT_PHRASE_BUFFER_SIZE (32) |
| Buffer size for a short weather phrase. | |
| #define | WEATHER_SERVICE_MAX_WEATHER_LOCATION_BUFFER_SIZE (64) |
| Buffer size for a location name. | |
| #define | WEATHER_SERVICE_INVALID_DATA_LAST_UPDATE_TIME (0) |
| Last update time marking an entry without valid data. | |
| #define | WEATHER_SERVICE_LOCATION_FORECAST_UNKNOWN_TEMP (INT16_MAX) |
| Temperature value meaning unknown. | |
Typedefs | |
| typedef int | WeatherLocationID |
| Index of a weather location in the user's ordering. | |
Functions | |
| void | weather_service_init (void) |
| Initialize the weather service. | |
| WeatherLocationForecast * | weather_service_create_default_forecast (void) |
| Get a copy of the default location's forecast. | |
| void | weather_service_destroy_default_forecast (WeatherLocationForecast *forecast) |
| Free a forecast created by weather_service_create_default_forecast(). | |
| WeatherDataListNode * | weather_service_locations_list_create (size_t *count_out) |
| Build a list of the forecasts of all valid locations. | |
| WeatherDataListNode * | weather_service_locations_list_get_location_at_index (WeatherDataListNode *head, unsigned int index) |
| Get the list node at an index. | |
| void | weather_service_locations_list_destroy (WeatherDataListNode *head) |
| Free a list created by weather_service_locations_list_create(). | |
| bool | weather_service_supported_by_phone (void) |
| Check whether the connected phone app supports weather. | |
Weather forecasts sent by the phone.
Forecast and location data is pushed from the phone into the weather database; the watch never requests it. Locations are ordered by the weather app preferences, the first one being the default location. Entries last updated before yesterday are ignored. Subscribe to PEBBLE_WEATHER_CHANGED_EVENT to learn about database changes.
| struct WeatherLocationForecast |
Forecast for one location, as sent by the phone.
| Data Fields | ||
|---|---|---|
| int | current_temp | Current temperature. |
| char * | current_weather_phrase | Short description of the current conditions, owned by the forecast. |
| WeatherType | current_weather_type | Current conditions. |
| bool | is_current_location | Whether this is the phone's current location. |
| char * | location_name | Location name, owned by the forecast. |
| time_t | time_updated_utc | Time the forecast was last updated, UTC. |
| int | today_high | Today's high temperature. |
| int | today_low | Today's low temperature. |
| int | tomorrow_high | Tomorrow's high temperature. |
| int | tomorrow_low | Tomorrow's low temperature. |
| WeatherType | tomorrow_weather_type | Tomorrow's conditions. |
| struct WeatherDataListNode |
List node holding the forecast of one location.
| Data Fields | ||
|---|---|---|
| WeatherLocationForecast | forecast | Forecast of the location. |
| WeatherLocationID | id | Position of the location in the user's ordering. |
| ListNode | node | List linkage. |
| #define WEATHER_SERVICE_INVALID_DATA_LAST_UPDATE_TIME (0) |
Last update time marking an entry without valid data.
| #define WEATHER_SERVICE_LOCATION_FORECAST_UNKNOWN_TEMP (INT16_MAX) |
Temperature value meaning unknown.
| #define WEATHER_SERVICE_MAX_SHORT_PHRASE_BUFFER_SIZE (32) |
Buffer size for a short weather phrase.
| #define WEATHER_SERVICE_MAX_WEATHER_LOCATION_BUFFER_SIZE (64) |
Buffer size for a location name.
| typedef int WeatherLocationID |
Index of a weather location in the user's ordering.
| WeatherLocationForecast * weather_service_create_default_forecast | ( | void | ) |
Get a copy of the default location's forecast.
| void weather_service_destroy_default_forecast | ( | WeatherLocationForecast * | forecast | ) |
Free a forecast created by weather_service_create_default_forecast().
| forecast | Forecast to free, may be NULL. |
| void weather_service_init | ( | void | ) |
Initialize the weather service.
Caches the default location's forecast and keeps it up to date on database changes.
| WeatherDataListNode * weather_service_locations_list_create | ( | size_t * | count_out | ) |
Build a list of the forecasts of all valid locations.
The list is sorted by WeatherDataListNode::id. Locations missing from the user's ordering or with invalid or outdated data are skipped.
| [out] | count_out | Number of locations in the list. Left untouched if the location ordering is unavailable. |
| void weather_service_locations_list_destroy | ( | WeatherDataListNode * | head | ) |
Free a list created by weather_service_locations_list_create().
| head | Head of the list, may be NULL. |
| WeatherDataListNode * weather_service_locations_list_get_location_at_index | ( | WeatherDataListNode * | head, |
| unsigned int | index | ||
| ) |
Get the list node at an index.
| head | Head of a list from weather_service_locations_list_create(). |
| index | Index of the node. |
index, or NULL if out of range. | bool weather_service_supported_by_phone | ( | void | ) |
Check whether the connected phone app supports weather.
Always true on QEMU.