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

Active phone store: the phone's own battery, as a Pebble app plugin on the phone reports it. More...

#include <pebble.h>
#include "wire/phone_level.h"

Go to the source code of this file.

Data Structures

struct  PhoneConfig
 The rules a face hands the store. More...
struct  PhoneSeed
 Optional prefill, or pinned state when live = false. More...

Functions

void phone_store_init (PhoneConfig cfg, const PhoneSeed *seed)
 Start the store with its rules. Pass seed = NULL for normal use.
void phone_store_subscribe (void(*cb)(void))
 Hand it the function to call when the level changes (the screen redraw).
int phone_store_battery (void)
 The phone's battery level.
bool phone_store_no_plugin (void)
 Whether the phone said no plugin on it serves the battery.

Detailed Description

Active phone store: the phone's own battery, as a Pebble app plugin on the phone reports it.

It is kept apart from the system store, which holds the watch's own battery and its link to the phone. The level is not saved to flash, since a phone battery an hour old is worse than none. It clears when the phone drops, since the watch can no longer know it, and the store asks the phone again when the link comes back and once at launch.

The phone also says when no plugin on it serves the battery, such as with plugins off in the Pebble app. The level then reads as none, and phone_store_no_plugin() says why, so a face can show its own words, such as "PLUGINS OFF", in place of the "--" that readout_phone_battery() writes.

It is built only for a face that declares PHONE_BATTERY and PHONE_REQUEST, which the build allows only with PLUGIN_PHONE in the appinfo's defines. On any other face it does nothing and the level reads as none.