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

One weather message off the phone, and the reading it leaves behind. More...

#include <stdbool.h>
#include <stdint.h>
#include <time.h>
#include "wire/weather_wire.h"

Go to the source code of this file.

Data Structures

struct  WeatherMessage
 One weather message as the transport read it, before anything is kept. More...
struct  WeatherState
 The weather a store keeps, laid out as the blob it saves to flash. More...
struct  WeatherClock
 The watch's clock at the moment a message lands, broken apart. More...

Macros

#define WEATHER_GROUP_CURRENT   (1u << 0)
 The current temperature and sky arrived.
#define WEATHER_GROUP_EXTRA   (1u << 1)
 At least one of the extras (humidity, wind, direction, sunrise, sunset) arrived.
#define WEATHER_GROUP_FORECAST   (1u << 2)
 At least one of today's forecast readings (UV, high, low, rain chance) arrived.
#define WEATHER_GROUP_AIR   (1u << 3)
 At least one of the air readings (feels-like, pressure, dew point) arrived.

Functions

bool weather_reading_apply (WeatherState *state, const WeatherMessage *msg, const WeatherClock *clock)
 Put a message's readings into the kept weather.
void weather_reading_convert (WeatherState *state, bool to_fahrenheit)
 Convert every temperature in the kept weather to the other unit.

Detailed Description

One weather message off the phone, and the reading it leaves behind.

The phone sends weather as one message whose keys come in groups: the current temperature and sky, the extras (humidity, wind, sun times), today's forecast, the air readings, and the two packed strips. A face declares only the groups it shows, and the phone leaves out any value it has none for. Everything that turns that message into the kept reading lives here, off the SDK, so the rules for a group that arrives half filled can be tested on the host.