Pebble Foundation Classes  0.2.0
C++ for Pebble
pebble_worker.h
1 #pragma once
2 
3 #include <locale.h>
4 #include <stdlib.h>
5 #include <stdint.h>
6 #include <stdio.h>
7 #include <stdbool.h>
8 #include <string.h>
9 //#include <time.h>
10 
11 #include "pebble_warn_unsupported_functions.h"
12 #include "pebble_worker_sdk_version.h"
13 
14 #ifndef __FILE_NAME__
15 #define __FILE_NAME__ __FILE__
16 #endif
17 
21 #define ARRAY_LENGTH(array) (sizeof((array))/sizeof((array)[0]))
22 
23 struct tm;
24 typedef struct tm tm;
25 
29 #define IS_SIGNED(var) (__builtin_choose_expr( \
30  __builtin_types_compatible_p(__typeof__(var), unsigned char), false, \
31  __builtin_choose_expr( \
32  __builtin_types_compatible_p(__typeof__(var), unsigned short), false, \
33  __builtin_choose_expr( \
34  __builtin_types_compatible_p(__typeof__(var), unsigned int), false, \
35  __builtin_choose_expr( \
36  __builtin_types_compatible_p(__typeof__(var), unsigned long), false, \
37  __builtin_choose_expr( \
38  __builtin_types_compatible_p(__typeof__(var), unsigned long long), false, true))))) \
39 )
40 
43 
50 
52 typedef enum {
63 
64  WATCH_INFO_MODEL__MAX
66 
68 typedef enum {
75 
78 
82 
86 
90 
96 
102 
105 
109 
110  WATCH_INFO_COLOR__MAX
112 
116 typedef struct {
117  uint8_t major;
118  uint8_t minor;
119  uint8_t patch;
121 
125 
129 
130 WatchInfoColor watch_info_get_color(void);
131 
133 
136 
139 #define TRIG_MAX_RATIO 0xffff
140 
144 #define TRIG_MAX_ANGLE 0x10000
145 
149 #define TRIGANGLE_TO_DEG(trig_angle) (((trig_angle) * 360) / TRIG_MAX_ANGLE)
150 
154 #define DEG_TO_TRIGANGLE(angle) (((angle) * TRIG_MAX_ANGLE) / 360)
155 
159 int32_t sin_lookup(int32_t angle);
160 
165 int32_t cos_lookup(int32_t angle);
166 
169 int32_t atan2_lookup(int16_t y, int16_t x);
170 
172 
179 
181 typedef enum {
182  TODAY = 0,
190 } WeekDay;
191 
198 void clock_copy_time_string(char *buffer, uint8_t size);
199 
203 bool clock_is_24h_style(void);
204 
214 time_t clock_to_timestamp(WeekDay day, int hour, int minute);
215 
218 bool clock_is_timezone_set(void);
219 
221 #define TIMEZONE_NAME_LENGTH 32
222 
228 void clock_get_timezone(char *timezone, const size_t buffer_size);
229 
231 
234 
235 typedef enum PlatformType {
236  PlatformTypeAplite,
237  PlatformTypeBasalt,
238  PlatformTypeChalk,
239  PlatformTypeDiorite,
240  PlatformTypeEmery,
241 } PlatformType;
242 
243 #define PBL_PLATFORM_TYPE_CURRENT PlatformTypeBasalt
244 
245 #define PBL_PLATFORM_SWITCH_DEFAULT(PLAT, DEFAULT, APLITE, BASALT, CHALK, DIORITE, EMERY) (\
246  ((PLAT) == PlatformTypeEmery) ? (EMERY) : \
247  ((PLAT) == PlatformTypeDiorite) ? (DIORITE) : \
248  ((PLAT) == PlatformTypeChalk) ? (CHALK) : \
249  ((PLAT) == PlatformTypeBasalt) ? (BASALT) : \
250  ((PLAT) == PlatformTypeBasalt) ? (APLITE) : \
251  (DEFAULT) \
252 )
253 
254 #define PBL_PLATFORM_SWITCH(PLAT, APLITE, BASALT, CHALK, DIORITE, EMERY) \
255  PBL_PLATFORM_SWITCH_DEFAULT(PLAT, APLITE, APLITE, BASALT, CHALK, DIORITE, EMERY)
256 
258 
261 
288 
289 typedef void (*ConnectionHandler)(bool connected);
290 
291 typedef struct {
295  ConnectionHandler pebble_app_connection_handler;
297  ConnectionHandler pebblekit_connection_handler;
299 
303 
307 
315 
319 
321 
334 
336 typedef struct {
338  uint8_t charge_percent;
340  bool is_charging;
342  bool is_plugged;
344 
347 typedef void (*BatteryStateHandler)(BatteryChargeState charge);
348 
353 
357 
361 
363 
376 
379 typedef struct __attribute__((__packed__)) AccelData {
381  int16_t x;
383  int16_t y;
385  int16_t z;
386 
388  bool did_vibrate;
389 
391  uint64_t timestamp;
392 } AccelData;
393 
395 typedef struct __attribute__((__packed__)) {
397  int16_t x;
399  int16_t y;
401  int16_t z;
402 } AccelRawData;
403 
405 typedef enum {
415 } AccelAxisType;
416 
420 typedef void (*AccelDataHandler)(AccelData *data, uint32_t num_samples);
421 
426 typedef void (*AccelRawDataHandler)(AccelRawData *data, uint32_t num_samples, uint64_t timestamp);
427 
431 typedef void (*AccelTapHandler)(AccelAxisType axis, int32_t direction);
432 
434 typedef enum {
444 
450 int accel_service_peek(AccelData *data);
451 
455 
458 int accel_service_set_samples_per_update(uint32_t num_samples);
459 
465 void accel_data_service_subscribe(uint32_t samples_per_update, AccelDataHandler handler);
466 
470 
475 
479 
485 void accel_raw_data_service_subscribe(uint32_t samples_per_update, AccelRawDataHandler handler);
486 
488 
510 
512 typedef enum {
522 } CompassStatus;
523 
529 typedef int32_t CompassHeading;
530 
532 typedef struct {
536  CompassHeading magnetic_heading;
538  CompassHeading true_heading;
540  CompassStatus compass_status;
542  bool is_declination_valid;
544 
547 typedef void (*CompassHeadingHandler)(CompassHeadingData heading);
548 
558 
566 
570 void compass_service_unsubscribe(void);
571 
576 
578 
586 
589 typedef enum {
591  SECOND_UNIT = 1 << 0,
593  MINUTE_UNIT = 1 << 1,
595  HOUR_UNIT = 1 << 2,
597  DAY_UNIT = 1 << 3,
599  MONTH_UNIT = 1 << 4,
601  YEAR_UNIT = 1 << 5
602 } TimeUnits;
603 
607 typedef void (*TickHandler)(struct tm *tick_time, TimeUnits units_changed);
608 
615 void tick_timer_service_subscribe(TimeUnits tick_units, TickHandler handler);
616 
620 
622 
630 
633 typedef enum {
652 } HealthMetric;
653 
655 typedef int32_t HealthValue;
656 
660 
669 HealthValue health_service_sum(HealthMetric metric, time_t time_start, time_t time_end);
670 
675 
685 
687 typedef enum {
699 
725 HealthValue health_service_sum_averaged(HealthMetric metric, time_t time_start, time_t time_end,
726  HealthServiceTimeScope scope);
727 
730 typedef enum {
745 
785  time_t time_end, HealthAggregation aggregation,
786  HealthServiceTimeScope scope);
787 
789 typedef uint32_t HealthActivityMask;
790 
792 #define HealthActivityMaskAll ((HealthActivityOpenWorkout << 1) - 1)
793 
795 typedef enum {
809 
814 
822 typedef bool (*HealthActivityIteratorCB)(HealthActivity activity, time_t time_start,
823  time_t time_end, void *context);
824 
830 typedef enum {
836 
847 void health_service_activities_iterate(HealthActivityMask activity_mask, time_t time_start,
848  time_t time_end, HealthIterationDirection direction,
849  HealthActivityIteratorCB callback, void *context);
850 
855 typedef enum {
866 
881  HealthMetric metric, time_t time_start, time_t time_end);
882 
898  HealthMetric metric, time_t time_start, time_t time_end, HealthServiceTimeScope scope);
899 
912  HealthMetric metric, time_t time_start, time_t time_end, HealthAggregation aggregation,
913  HealthServiceTimeScope scope);
914 
925  HealthActivityMask activity_mask, time_t time_start, time_t time_end);
926 
928 typedef enum {
944 
949 typedef void (*HealthEventHandler)(HealthEventType event, void *context);
950 
958 bool health_service_events_subscribe(HealthEventHandler handler, void *context);
959 
963 
984 bool health_service_set_heart_rate_sample_period(uint16_t interval_sec);
985 
992 
1011 
1017 
1019 typedef enum AmbientLightLevel {
1020  AmbientLightLevelUnknown = 0,
1021  AmbientLightLevelVeryDark,
1022  AmbientLightLevelDark,
1023  AmbientLightLevelLight,
1024  AmbientLightLevelVeryLight,
1026 
1034 typedef struct {
1035  uint8_t steps;
1036  uint8_t orientation;
1037  uint16_t vmc;
1038  bool is_invalid: 1;
1039  AmbientLightLevel light: 3;
1041  uint8_t padding: 4;
1042  uint8_t heart_rate_bpm;
1043  uint8_t reserved[6];
1045 
1065 uint32_t health_service_get_minute_history(HealthMinuteData *minute_data, uint32_t max_records,
1066  time_t *time_start, time_t *time_end);
1067 
1070 #define PBL_IF_HEALTH_ELSE(if_true, if_false) (if_true)
1071 
1073 typedef enum {
1081 
1087 
1089 
1091 
1134 
1135 typedef void *DataLoggingSessionRef;
1136 
1139 typedef enum {
1149 
1151 typedef enum {
1160 
1170 DataLoggingSessionRef data_logging_create(uint32_t tag, DataLoggingItemType item_type,
1171  uint16_t item_length, bool resume);
1172 
1179 void data_logging_finish(DataLoggingSessionRef logging_session);
1180 
1203 DataLoggingResult data_logging_log(DataLoggingSessionRef logging_session, const void *data,
1204  uint32_t num_items);
1205 
1207 
1210 
1213 
1214 typedef struct __attribute__((__packed__)) {
1215  uint8_t byte0;
1216  uint8_t byte1;
1217  uint8_t byte2;
1218  uint8_t byte3;
1219  uint8_t byte4;
1220  uint8_t byte5;
1221  uint8_t byte6;
1222  uint8_t byte7;
1223  uint8_t byte8;
1224  uint8_t byte9;
1225  uint8_t byte10;
1226  uint8_t byte11;
1227  uint8_t byte12;
1228  uint8_t byte13;
1229  uint8_t byte14;
1230  uint8_t byte15;
1231 } Uuid;
1232 
1233 #define UUID_SIZE 16
1234 
1237 #define UuidMake(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15) ((Uuid) {p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15})
1238 
1241 #define UuidMakeFromBEBytes(b) ((Uuid) { b[0], b[1], b[2], b[3], \
1242  b[4], b[5], b[6], b[7], \
1243  b[8], b[9], b[10], b[11], \
1244  b[12], b[13], b[14], b[15] })
1245 
1248 #define UuidMakeFromLEBytes(b) ((Uuid) { b[15], b[14], b[13], b[12], \
1249  b[11], b[10], b[9], b[8], \
1250  b[7], b[6], b[5], b[4], \
1251  b[3], b[2], b[1], b[0] })
1252 
1255 bool uuid_equal(const Uuid *uu1, const Uuid *uu2);
1256 
1261 void uuid_to_string(const Uuid *uuid, char *buffer);
1262 
1264 #define UUID_STRING_BUFFER_LENGTH (32 + 4 + 2 + 1)
1265 
1267 
1269 
1281 
1282 void app_log(uint8_t log_level, const char* src_filename, int src_line_number, const char* fmt,
1283  ...);
1284 
1289 #define APP_LOG(level, fmt, args...) \
1290  app_log(level, __FILE_NAME__, __LINE__, fmt, ## args)
1291 
1293 typedef enum {
1304 } AppLogLevel;
1305 
1307 
1399 
1401 typedef enum {
1403  DICT_OK = 0,
1414 
1416 typedef enum {
1427 } TupleType;
1428 
1432 typedef struct __attribute__((__packed__)) {
1434  uint32_t key;
1436  TupleType type:8;
1438  uint16_t length;
1445  union {
1447  uint8_t data[0];
1449  char cstring[0];
1452  uint8_t uint8;
1455  uint16_t uint16;
1458  uint32_t uint32;
1461  int8_t int8;
1464  int16_t int16;
1467  int32_t int32;
1468  } value[];
1469 } Tuple;
1470 
1471 struct Dictionary;
1472 typedef struct Dictionary Dictionary;
1473 
1479 typedef struct {
1480  Dictionary *dictionary;
1481  const void *end;
1482  Tuple *cursor;
1488 
1500 uint32_t dict_calc_buffer_size(const uint8_t tuple_count, ...);
1501 
1507 uint32_t dict_size(DictionaryIterator* iter);
1508 
1517 DictionaryResult dict_write_begin(DictionaryIterator *iter, uint8_t * const buffer, const uint16_t size);
1518 
1527 DictionaryResult dict_write_data(DictionaryIterator *iter, const uint32_t key, const uint8_t * const data, const uint16_t size);
1528 
1536 DictionaryResult dict_write_cstring(DictionaryIterator *iter, const uint32_t key, const char * const cstring);
1537 
1547 DictionaryResult dict_write_int(DictionaryIterator *iter, const uint32_t key, const void *integer, const uint8_t width_bytes, const bool is_signed);
1548 
1559 DictionaryResult dict_write_uint8(DictionaryIterator *iter, const uint32_t key, const uint8_t value);
1560 
1561 DictionaryResult dict_write_uint16(DictionaryIterator *iter, const uint32_t key, const uint16_t value);
1562 
1563 DictionaryResult dict_write_uint32(DictionaryIterator *iter, const uint32_t key, const uint32_t value);
1564 
1565 DictionaryResult dict_write_int8(DictionaryIterator *iter, const uint32_t key, const int8_t value);
1566 
1567 DictionaryResult dict_write_int16(DictionaryIterator *iter, const uint32_t key, const int16_t value);
1568 
1569 DictionaryResult dict_write_int32(DictionaryIterator *iter, const uint32_t key, const int32_t value);
1570 
1575 uint32_t dict_write_end(DictionaryIterator *iter);
1576 
1583 Tuple * dict_read_begin_from_buffer(DictionaryIterator *iter, const uint8_t * const buffer, const uint16_t size);
1584 
1588 Tuple * dict_read_next(DictionaryIterator *iter);
1589 
1593 Tuple * dict_read_first(DictionaryIterator *iter);
1594 
1601 typedef struct Tuplet {
1604  TupleType type;
1606  uint32_t key;
1610  union {
1612  struct {
1614  const uint8_t *data;
1616  const uint16_t length;
1617  } bytes;
1619  struct {
1621  const char *data;
1623  const uint16_t length;
1624  } cstring;
1626  struct {
1629  uint32_t storage;
1631  const uint16_t width;
1632  } integer;
1633  };
1634 } Tuplet;
1635 
1640 #define TupletBytes(_key, _data, _length) \
1641 ((const Tuplet) { .type = TUPLE_BYTE_ARRAY, .key = _key, .bytes = { .data = _data, .length = _length }})
1642 
1646 #define TupletCString(_key, _cstring) \
1647 ((const Tuplet) { .type = TUPLE_CSTRING, .key = _key, .cstring = { .data = _cstring, .length = _cstring ? strlen(_cstring) + 1 : 0 }})
1648 
1652 #define TupletInteger(_key, _integer) \
1653 ((const Tuplet) { .type = IS_SIGNED(_integer) ? TUPLE_INT : TUPLE_UINT, .key = _key, .integer = { .storage = _integer, .width = sizeof(_integer) }})
1654 
1660 typedef void (*DictionarySerializeCallback)(const uint8_t * const data, const uint16_t size, void *context);
1661 
1671 DictionaryResult dict_serialize_tuplets(DictionarySerializeCallback callback, void *context, const Tuplet * const tuplets, const uint8_t tuplets_count);
1672 
1681 DictionaryResult dict_serialize_tuplets_to_buffer(const Tuplet * const tuplets, const uint8_t tuplets_count, uint8_t *buffer, uint32_t *size_in_out);
1682 
1691 DictionaryResult dict_serialize_tuplets_to_buffer_with_iter(DictionaryIterator *iter, const Tuplet * const tuplets, const uint8_t tuplets_count, uint8_t *buffer, uint32_t *size_in_out);
1692 
1697 DictionaryResult dict_write_tuplet(DictionaryIterator *iter, const Tuplet * const tuplet);
1698 
1706 uint32_t dict_calc_buffer_size_from_tuplets(const Tuplet * const tuplets, const uint8_t tuplets_count);
1707 
1721 typedef void (*DictionaryKeyUpdatedCallback)(const uint32_t key, const Tuple *new_tuple, const Tuple *old_tuple, void *context);
1722 
1733 DictionaryResult dict_merge(DictionaryIterator *dest, uint32_t *dest_max_size_in_out,
1734  DictionaryIterator *source,
1735  const bool update_existing_keys_only,
1736  const DictionaryKeyUpdatedCallback key_callback, void *context);
1737 
1742 Tuple *dict_find(const DictionaryIterator *iter, const uint32_t key);
1743 
1745 
1748 
1751 void worker_event_loop(void);
1752 
1754 void worker_launch_app(void);
1755 
1757 
1761 
1763 typedef enum {
1776 } AppWorkerResult;
1777 
1779 typedef struct {
1780  uint16_t data0;
1781  uint16_t data1;
1782  uint16_t data2;
1784 
1787 bool app_worker_is_running(void);
1788 
1793 
1798 
1802 typedef void (*AppWorkerMessageHandler)(uint16_t type, AppWorkerMessage *data);
1803 
1809 
1813 
1817 void app_worker_send_message(uint8_t type, AppWorkerMessage *data);
1818 
1820 
1824 
1827 void psleep(int millis);
1828 
1829 struct AppTimer;
1830 typedef struct AppTimer AppTimer;
1831 
1834 typedef void (*AppTimerCallback)(void* data);
1835 
1841 AppTimer* app_timer_register(uint32_t timeout_ms, AppTimerCallback callback, void* callback_data);
1842 
1847 bool app_timer_reschedule(AppTimer *timer_handle, uint32_t new_timeout_ms);
1848 
1851 void app_timer_cancel(AppTimer *timer_handle);
1852 
1854 
1859 
1862 size_t heap_bytes_free(void);
1863 
1866 size_t heap_bytes_used(void);
1867 
1875 void memory_cache_flush(void *start, size_t size);
1876 
1878 
1901 
1903 #define PERSIST_DATA_MAX_LENGTH 256
1904 
1906 #define PERSIST_STRING_MAX_LENGTH PERSIST_DATA_MAX_LENGTH
1907 
1909 typedef enum StatusCode {
1912 
1914  E_ERROR = -1,
1915 
1918 
1921 
1924 
1927 
1930 
1933 
1935  E_RANGE = -8,
1936 
1939 
1942 
1944  E_BUSY = -11,
1945 
1947  E_AGAIN = -12,
1948 
1950  S_TRUE = 1,
1951 
1953  S_FALSE = 0,
1954 
1957 
1960 
1961 } StatusCode;
1962 
1964 typedef int32_t status_t;
1965 
1969 bool persist_exists(const uint32_t key);
1970 
1975 int persist_get_size(const uint32_t key);
1976 
1981 bool persist_read_bool(const uint32_t key);
1982 
1988 int32_t persist_read_int(const uint32_t key);
1989 
1997 int persist_read_data(const uint32_t key, void *buffer, const size_t buffer_size);
1998 
2007 int persist_read_string(const uint32_t key, char *buffer, const size_t buffer_size);
2008 
2013 status_t persist_write_bool(const uint32_t key, const bool value);
2014 
2020 status_t persist_write_int(const uint32_t key, const int32_t value);
2021 
2028 int persist_write_data(const uint32_t key, const void *data, const size_t size);
2029 
2035 int persist_write_string(const uint32_t key, const char *cstring);
2036 
2039 status_t persist_delete(const uint32_t key);
2040 
2042 
2044 
2047 
2049 
2052 
2062 
2063 #define TZ_LEN 6
2064 
2065 #define SECONDS_PER_MINUTE (60)
2066 
2067 #define MINUTES_PER_HOUR (60)
2068 
2069 #define SECONDS_PER_HOUR (SECONDS_PER_MINUTE * MINUTES_PER_HOUR)
2070 
2071 #define HOURS_PER_DAY (24)
2072 
2073 #define MINUTES_PER_DAY (HOURS_PER_DAY * MINUTES_PER_HOUR)
2074 
2075 #define SECONDS_PER_DAY (MINUTES_PER_DAY * SECONDS_PER_MINUTE)
2076 
2079 struct tm {
2080  int tm_sec;
2081  int tm_min;
2082  int tm_hour;
2083  int tm_mday;
2084  int tm_mon;
2085  int tm_year;
2086  int tm_wday;
2087  int tm_yday;
2088  int tm_isdst;
2090  int tm_gmtoff;
2091  char tm_zone[TZ_LEN];
2092 };
2093 
2101 int strftime(char* s, size_t maxsize, const char* format, const struct tm* tm_p);
2102 
2108 struct tm *localtime(const time_t *timep);
2109 
2114 struct tm *gmtime(const time_t *timep);
2115 
2120 time_t mktime(struct tm *tb);
2121 
2127 time_t time(time_t *tloc);
2128 
2140 double difftime(time_t end, time_t beginning);
2141 
2151 uint16_t time_ms(time_t *t_utc, uint16_t *out_ms);
2152 
2155 time_t time_start_of_today(void);
2156 
2158 
2160 
battery_state_service_unsubscribe
void battery_state_service_unsubscribe(void)
clock_is_timezone_set
bool clock_is_timezone_set(void)
DATA_LOGGING_INTERNAL_ERR
@ DATA_LOGGING_INTERNAL_ERR
An internal error occurred.
Definition: pebble_worker.h:1158
HealthEventHeartRateUpdate
@ HealthEventHeartRateUpdate
Value of HealthMetricHeartRateBPM or HealthMetricHeartRateRawBPM has changed.
Definition: pebble_worker.h:942
accel_tap_service_unsubscribe
void accel_tap_service_unsubscribe(void)
connection_service_subscribe
void connection_service_subscribe(ConnectionHandlers conn_handlers)
compass_service_subscribe
void compass_service_subscribe(CompassHeadingHandler handler)
HealthServiceAccessibilityMaskNoPermission
@ HealthServiceAccessibilityMaskNoPermission
The user hasn't granted permission.
Definition: pebble_worker.h:859
AmbientLightLevel
AmbientLightLevel
Light level enum.
Definition: pebble.h:1245
HealthMetricRestingKCalories
@ HealthMetricRestingKCalories
The number of kcal (Calories) burned while resting due to resting metabolism.
Definition: pebble_worker.h:645
HealthActivitySleep
@ HealthActivitySleep
The 'sleeping' activity.
Definition: pebble_worker.h:799
E_DOES_NOT_EXIST
@ E_DOES_NOT_EXIST
Target of operation does not exist.
Definition: pebble_worker.h:1938
ACCEL_SAMPLING_25HZ
@ ACCEL_SAMPLING_25HZ
25 HZ sampling rate [Default]
Definition: pebble_worker.h:438
data_logging_create
DataLoggingSessionRef data_logging_create(uint32_t tag, DataLoggingItemType item_type, uint16_t item_length, bool resume)
WATCH_INFO_COLOR_ORANGE
@ WATCH_INFO_COLOR_ORANGE
Orange.
Definition: pebble_worker.h:73
HealthMinuteData
Definition: pebble.h:1260
app_timer_reschedule
bool app_timer_reschedule(AppTimer *timer_handle, uint32_t new_timeout_ms)
WATCH_INFO_MODEL_UNKNOWN
@ WATCH_INFO_MODEL_UNKNOWN
Unknown model.
Definition: pebble_worker.h:53
TUESDAY
@ TUESDAY
Tuesday.
Definition: pebble_worker.h:185
time
time_t time(time_t *tloc) noexcept
E_AGAIN
@ E_AGAIN
Operation not completed; try again.
Definition: pebble_worker.h:1947
localtime
struct tm * localtime(const time_t *timep)
watch_info_get_model
WatchInfoModel watch_info_get_model(void)
WATCH_INFO_COLOR_PEBBLE_2_HR_BLACK
@ WATCH_INFO_COLOR_PEBBLE_2_HR_BLACK
Pebble 2 HR, Black / Charcoal.
Definition: pebble_worker.h:97
HealthActivityIteratorCB
bool(* HealthActivityIteratorCB)(HealthActivity activity, time_t time_start, time_t time_end, void *context)
Definition: pebble_worker.h:822
HealthActivity
HealthActivity
Health-related activities that can be accessed using.
Definition: pebble_worker.h:795
WatchInfoModel
WatchInfoModel
The different watch models.
Definition: pebble_worker.h:52
HealthServiceAccessibilityMask
HealthServiceAccessibilityMask
Definition: pebble_worker.h:855
HealthMetric
HealthMetric
Definition: pebble_worker.h:633
CompassStatusCalibrating
@ CompassStatusCalibrating
Compass is calibrating: the data is valid but the calibration is still being refined.
Definition: pebble_worker.h:519
AppWorkerMessageHandler
void(* AppWorkerMessageHandler)(uint16_t type, AppWorkerMessage *data)
Definition: pebble_worker.h:1802
ConnectionHandlers
Definition: pebble.h:445
tm::tm_min
int tm_min
Definition: pebble.h:8313
dict_write_tuplet
DictionaryResult dict_write_tuplet(DictionaryIterator *iter, const Tuplet *const tuplet)
WATCH_INFO_COLOR_PEBBLE_2_SE_BLACK
@ WATCH_INFO_COLOR_PEBBLE_2_SE_BLACK
Pebble 2 SE, Black / Charcoal.
Definition: pebble_worker.h:103
WATCH_INFO_COLOR_PEBBLE_2_HR_FLAME
@ WATCH_INFO_COLOR_PEBBLE_2_HR_FLAME
Pebble 2 HR, Charcoal / Red.
Definition: pebble_worker.h:99
dict_calc_buffer_size_from_tuplets
uint32_t dict_calc_buffer_size_from_tuplets(const Tuplet *const tuplets, const uint8_t tuplets_count)
ACCEL_AXIS_X
@ ACCEL_AXIS_X
Definition: pebble_worker.h:408
HealthMetricWalkedDistanceMeters
@ HealthMetricWalkedDistanceMeters
The distance walked, in meters.
Definition: pebble_worker.h:639
WATCH_INFO_COLOR_TIME_ROUND_ROSE_GOLD_14
@ WATCH_INFO_COLOR_TIME_ROUND_ROSE_GOLD_14
Time Round 14mm lug size, Rose Gold.
Definition: pebble_worker.h:95
atan2_lookup
int32_t atan2_lookup(int16_t y, int16_t x)
mktime
time_t mktime(struct tm *tb)
app_worker_is_running
bool app_worker_is_running(void)
HealthEventMetricAlert
@ HealthEventMetricAlert
A metric has crossed the threshold set by health_service_register_metric_alert.
Definition: pebble_worker.h:940
HealthEventMovementUpdate
@ HealthEventMovementUpdate
Definition: pebble_worker.h:935
HealthMetricSleepRestfulSeconds
@ HealthMetricSleepRestfulSeconds
The number of sleep seconds in the 'restful' or deep sleep state.
Definition: pebble_worker.h:643
WATCH_INFO_MODEL_PEBBLE_2_SE
@ WATCH_INFO_MODEL_PEBBLE_2_SE
Pebble 2 SE.
Definition: pebble_worker.h:61
APP_LOG_LEVEL_ERROR
@ APP_LOG_LEVEL_ERROR
Error level log message.
Definition: pebble_worker.h:1295
HealthAggregationMax
@ HealthAggregationMax
Definition: pebble_worker.h:743
health_service_metric_accessible
HealthServiceAccessibilityMask health_service_metric_accessible(HealthMetric metric, time_t time_start, time_t time_end)
TickHandler
void(* TickHandler)(struct tm *tick_time, TimeUnits units_changed)
Definition: pebble_worker.h:607
dict_read_first
Tuple * dict_read_first(DictionaryIterator *iter)
WATCH_INFO_COLOR_PEBBLE_2_HR_AQUA
@ WATCH_INFO_COLOR_PEBBLE_2_HR_AQUA
Pebble 2 HR, White / Turquoise.
Definition: pebble_worker.h:101
dict_calc_buffer_size
uint32_t dict_calc_buffer_size(const uint8_t tuple_count,...)
dict_find
Tuple * dict_find(const DictionaryIterator *iter, const uint32_t key)
Tuplet
struct Tuplet Tuplet
tm::tm_wday
int tm_wday
Definition: pebble.h:8318
health_service_get_minute_history
uint32_t health_service_get_minute_history(HealthMinuteData *minute_data, uint32_t max_records, time_t *time_start, time_t *time_end)
accel_data_service_subscribe
void accel_data_service_subscribe(uint32_t samples_per_update, AccelDataHandler handler)
HealthMetricSleepSeconds
@ HealthMetricSleepSeconds
The number of seconds spent sleeping.
Definition: pebble_worker.h:641
HealthEventType
HealthEventType
Health event enum. Passed into the HealthEventHandler.
Definition: pebble_worker.h:928
APP_WORKER_RESULT_ASKING_CONFIRMATION
@ APP_WORKER_RESULT_ASKING_CONFIRMATION
The user will be asked for confirmation.
Definition: pebble_worker.h:1775
health_service_any_activity_accessible
HealthServiceAccessibilityMask health_service_any_activity_accessible(HealthActivityMask activity_mask, time_t time_start, time_t time_end)
AccelDataHandler
void(* AccelDataHandler)(AccelData *data, uint32_t num_samples)
Definition: pebble_worker.h:420
WATCH_INFO_COLOR_WHITE
@ WATCH_INFO_COLOR_WHITE
White.
Definition: pebble_worker.h:71
WATCH_INFO_COLOR_PEBBLE_TIME_2_BLACK
@ WATCH_INFO_COLOR_PEBBLE_TIME_2_BLACK
Pebble Time 2, Black.
Definition: pebble_worker.h:106
dict_write_cstring
DictionaryResult dict_write_cstring(DictionaryIterator *iter, const uint32_t key, const char *const cstring)
HealthMetricActiveSeconds
@ HealthMetricActiveSeconds
The number of seconds spent active (i.e. not resting).
Definition: pebble_worker.h:637
APP_WORKER_RESULT_ALREADY_RUNNING
@ APP_WORKER_RESULT_ALREADY_RUNNING
The worker is already running.
Definition: pebble_worker.h:1773
accel_service_set_sampling_rate
int accel_service_set_sampling_rate(AccelSamplingRate rate)
health_service_peek_current_activities
HealthActivityMask health_service_peek_current_activities(void)
WEDNESDAY
@ WEDNESDAY
Wednesday.
Definition: pebble_worker.h:186
WATCH_INFO_COLOR_TIME_ROUND_BLACK_14
@ WATCH_INFO_COLOR_TIME_ROUND_BLACK_14
Time Round 14mm lug size, Black.
Definition: pebble_worker.h:92
HealthActivityNone
@ HealthActivityNone
No special activity.
Definition: pebble_worker.h:797
health_service_sum_averaged
HealthValue health_service_sum_averaged(HealthMetric metric, time_t time_start, time_t time_end, HealthServiceTimeScope scope)
WATCH_INFO_MODEL_PEBBLE_TIME_ROUND_14
@ WATCH_INFO_MODEL_PEBBLE_TIME_ROUND_14
Pebble Time Round, 14mm lug size.
Definition: pebble_worker.h:58
Tuplet::data
const uint8_t * data
Pointer to the data.
Definition: pebble.h:1840
Tuplet::cstring
struct Tuplet::@0::@3 cstring
Valid when .type. is TUPLE_CSTRING.
HealthAggregationSum
@ HealthAggregationSum
Definition: pebble_worker.h:734
AppLogLevel
AppLogLevel
Suggested log level values.
Definition: pebble_worker.h:1293
E_INVALID_ARGUMENT
@ E_INVALID_ARGUMENT
The function was not called correctly.
Definition: pebble_worker.h:1923
WATCH_INFO_MODEL_PEBBLE_TIME_ROUND_20
@ WATCH_INFO_MODEL_PEBBLE_TIME_ROUND_20
Pebble Time Round, 20mm lug size.
Definition: pebble_worker.h:59
E_UNKNOWN
@ E_UNKNOWN
No idea what went wrong.
Definition: pebble_worker.h:1917
WATCH_INFO_COLOR_TIME_ROUND_SILVER_20
@ WATCH_INFO_COLOR_TIME_ROUND_SILVER_20
Time Round 20mm lug size, Silver.
Definition: pebble_worker.h:93
HealthEventSleepUpdate
@ HealthEventSleepUpdate
Definition: pebble_worker.h:938
time_ms
uint16_t time_ms(time_t *t_utc, uint16_t *out_ms)
APP_WORKER_RESULT_SUCCESS
@ APP_WORKER_RESULT_SUCCESS
Success.
Definition: pebble_worker.h:1765
HealthActivityRun
@ HealthActivityRun
The 'run' activity.
Definition: pebble_worker.h:805
HealthIterationDirectionFuture
@ HealthIterationDirectionFuture
Iterate into the future.
Definition: pebble_worker.h:834
tm::tm_sec
int tm_sec
Definition: pebble.h:8312
AccelSamplingRate
AccelSamplingRate
Valid accelerometer sampling rates, in Hz.
Definition: pebble_worker.h:434
HealthIterationDirectionPast
@ HealthIterationDirectionPast
Iterate into the past.
Definition: pebble_worker.h:832
health_service_get_measurement_system_for_display
MeasurementSystem health_service_get_measurement_system_for_display(HealthMetric metric)
data_logging_log
DataLoggingResult data_logging_log(DataLoggingSessionRef logging_session, const void *data, uint32_t num_items)
DataLoggingItemType
DataLoggingItemType
Definition: pebble_worker.h:1139
HealthEventSignificantUpdate
@ HealthEventSignificantUpdate
Definition: pebble_worker.h:932
S_NO_ACTION_REQUIRED
@ S_NO_ACTION_REQUIRED
No action was taken as none was required.
Definition: pebble_worker.h:1959
tm::tm_zone
char tm_zone[TZ_LEN]
Definition: pebble.h:8323
SUNDAY
@ SUNDAY
Sunday.
Definition: pebble_worker.h:183
tm::tm_mon
int tm_mon
Definition: pebble.h:8316
WATCH_INFO_MODEL_PEBBLE_2_HR
@ WATCH_INFO_MODEL_PEBBLE_2_HR
Pebble 2 HR.
Definition: pebble_worker.h:60
app_worker_message_subscribe
bool app_worker_message_subscribe(AppWorkerMessageHandler handler)
CompassHeadingData
Structure containing a single heading towards magnetic and true north.
Definition: pebble.h:758
DATA_LOGGING_SUCCESS
@ DATA_LOGGING_SUCCESS
Successful operation.
Definition: pebble_worker.h:1152
tm::tm_mday
int tm_mday
Definition: pebble.h:8315
WATCH_INFO_COLOR_STAINLESS_STEEL
@ WATCH_INFO_COLOR_STAINLESS_STEEL
Stainless Steel.
Definition: pebble_worker.h:76
WATCH_INFO_COLOR_TIME_ROUND_SILVER_14
@ WATCH_INFO_COLOR_TIME_ROUND_SILVER_14
Time Round 14mm lug size, Silver.
Definition: pebble_worker.h:91
persist_read_data
int persist_read_data(const uint32_t key, void *buffer, const size_t buffer_size)
persist_get_size
int persist_get_size(const uint32_t key)
sin_lookup
int32_t sin_lookup(int32_t angle)
HealthServiceTimeScopeDaily
@ HealthServiceTimeScopeDaily
Compute average across all days of the week.
Definition: pebble_worker.h:697
WATCH_INFO_COLOR_TIME_WHITE
@ WATCH_INFO_COLOR_TIME_WHITE
Time White.
Definition: pebble_worker.h:83
TUPLE_INT
@ TUPLE_INT
Definition: pebble_worker.h:1426
worker_event_loop
void worker_event_loop(void)
accel_service_set_samples_per_update
int accel_service_set_samples_per_update(uint32_t num_samples)
tm::tm_hour
int tm_hour
Definition: pebble.h:8314
BatteryChargeState
Structure for retrieval of the battery charge state.
Definition: pebble.h:562
cos_lookup
int32_t cos_lookup(int32_t angle)
MeasurementSystemMetric
@ MeasurementSystemMetric
The metric measurement system.
Definition: pebble_worker.h:1077
TupleType
TupleType
Values representing the type of data that the value field of a Tuple contains.
Definition: pebble_worker.h:1416
DataLoggingResult
DataLoggingResult
Enumerated values describing the possible outcomes of data logging operations.
Definition: pebble_worker.h:1151
health_service_peek_current_value
HealthValue health_service_peek_current_value(HealthMetric metric)
MeasurementSystemImperial
@ MeasurementSystemImperial
The imperial measurement system.
Definition: pebble_worker.h:1079
HealthAggregationMin
@ HealthAggregationMin
Definition: pebble_worker.h:740
S_SUCCESS
@ S_SUCCESS
Operation completed successfully.
Definition: pebble_worker.h:1911
APP_WORKER_RESULT_NO_WORKER
@ APP_WORKER_RESULT_NO_WORKER
No worker found for the current app.
Definition: pebble_worker.h:1767
WATCH_INFO_COLOR_PINK
@ WATCH_INFO_COLOR_PINK
Pink.
Definition: pebble_worker.h:81
dict_serialize_tuplets_to_buffer
DictionaryResult dict_serialize_tuplets_to_buffer(const Tuplet *const tuplets, const uint8_t tuplets_count, uint8_t *buffer, uint32_t *size_in_out)
WatchInfoVersion
Definition: pebble.h:270
SATURDAY
@ SATURDAY
Saturday.
Definition: pebble_worker.h:189
CompassStatusCalibrated
@ CompassStatusCalibrated
Compass data is valid and the calibration has completed.
Definition: pebble_worker.h:521
health_service_sum
HealthValue health_service_sum(HealthMetric metric, time_t time_start, time_t time_end)
APP_LOG_LEVEL_DEBUG_VERBOSE
@ APP_LOG_LEVEL_DEBUG_VERBOSE
Verbose Debug level log message.
Definition: pebble_worker.h:1303
DictionarySerializeCallback
void(* DictionarySerializeCallback)(const uint8_t *const data, const uint16_t size, void *context)
Definition: pebble_worker.h:1660
WATCH_INFO_COLOR_UNKNOWN
@ WATCH_INFO_COLOR_UNKNOWN
Unknown color.
Definition: pebble_worker.h:69
DictionaryIterator
Definition: pebble.h:1705
clock_copy_time_string
void clock_copy_time_string(char *buffer, uint8_t size)
heap_bytes_used
size_t heap_bytes_used(void)
WATCH_INFO_COLOR_TIME_STEEL_GOLD
@ WATCH_INFO_COLOR_TIME_STEEL_GOLD
Time Steel Gold.
Definition: pebble_worker.h:89
persist_write_int
status_t persist_write_int(const uint32_t key, const int32_t value)
tm::tm_isdst
int tm_isdst
Definition: pebble.h:8320
DATA_LOGGING_FULL
@ DATA_LOGGING_FULL
No more space to save data.
Definition: pebble_worker.h:1154
DICT_NOT_ENOUGH_STORAGE
@ DICT_NOT_ENOUGH_STORAGE
There was not enough backing storage to complete the operation.
Definition: pebble_worker.h:1405
Tuplet
Definition: pebble.h:1827
YEAR_UNIT
@ YEAR_UNIT
Flag to represent the "years" time unit.
Definition: pebble_worker.h:601
APP_LOG_LEVEL_INFO
@ APP_LOG_LEVEL_INFO
Info level log message.
Definition: pebble_worker.h:1299
compass_service_unsubscribe
void compass_service_unsubscribe(void)
WATCH_INFO_COLOR_MATTE_BLACK
@ WATCH_INFO_COLOR_MATTE_BLACK
Matte Black.
Definition: pebble_worker.h:77
APP_WORKER_RESULT_DIFFERENT_APP
@ APP_WORKER_RESULT_DIFFERENT_APP
A worker for a different app is already running.
Definition: pebble_worker.h:1769
HealthServiceAccessibilityMaskAvailable
@ HealthServiceAccessibilityMaskAvailable
Return values are available and represent the collected health information.
Definition: pebble_worker.h:857
CompassHeadingHandler
void(* CompassHeadingHandler)(CompassHeadingData heading)
Definition: pebble_worker.h:547
dict_write_uint8
DictionaryResult dict_write_uint8(DictionaryIterator *iter, const uint32_t key, const uint8_t value)
TimeUnits
TimeUnits
Definition: pebble_worker.h:589
ACCEL_SAMPLING_10HZ
@ ACCEL_SAMPLING_10HZ
10 HZ sampling rate
Definition: pebble_worker.h:436
WATCH_INFO_COLOR_PEBBLE_2_SE_WHITE
@ WATCH_INFO_COLOR_PEBBLE_2_SE_WHITE
Pebble 2 SE, White / Gray.
Definition: pebble_worker.h:104
battery_state_service_subscribe
void battery_state_service_subscribe(BatteryStateHandler handler)
HealthServiceTimeScopeWeekly
@ HealthServiceTimeScopeWeekly
Definition: pebble_worker.h:692
HealthMetricActiveKCalories
@ HealthMetricActiveKCalories
The number of kcal (Calories) burned while active.
Definition: pebble_worker.h:647
persist_exists
bool persist_exists(const uint32_t key)
WATCH_INFO_COLOR_GRAY
@ WATCH_INFO_COLOR_GRAY
Gray.
Definition: pebble_worker.h:74
compass_service_peek
int compass_service_peek(CompassHeadingData *data)
E_OUT_OF_RESOURCES
@ E_OUT_OF_RESOURCES
Insufficient resources available.
Definition: pebble_worker.h:1932
Tuplet::integer
struct Tuplet::@0::@4 integer
Valid when .type. is TUPLE_INT or TUPLE_UINT.
health_service_sum_today
HealthValue health_service_sum_today(HealthMetric metric)
app_timer_register
AppTimer * app_timer_register(uint32_t timeout_ms, AppTimerCallback callback, void *callback_data)
tick_timer_service_subscribe
void tick_timer_service_subscribe(TimeUnits tick_units, TickHandler handler)
WATCH_INFO_COLOR_TIME_RED
@ WATCH_INFO_COLOR_TIME_RED
Time Red.
Definition: pebble_worker.h:85
health_service_register_metric_alert
HealthMetricAlert * health_service_register_metric_alert(HealthMetric metric, HealthValue threshold)
difftime
double difftime(time_t end, time_t beginning) noexcept
connection_service_unsubscribe
void connection_service_unsubscribe(void)
HealthActivityOpenWorkout
@ HealthActivityOpenWorkout
The 'generic' activity.
Definition: pebble_worker.h:807
battery_state_service_peek
BatteryChargeState battery_state_service_peek(void)
health_service_activities_iterate
void health_service_activities_iterate(HealthActivityMask activity_mask, time_t time_start, time_t time_end, HealthIterationDirection direction, HealthActivityIteratorCB callback, void *context)
persist_write_string
int persist_write_string(const uint32_t key, const char *cstring)
HealthMetricStepCount
@ HealthMetricStepCount
The number of steps counted.
Definition: pebble_worker.h:635
psleep
void psleep(int millis)
persist_write_data
int persist_write_data(const uint32_t key, const void *data, const size_t size)
persist_write_bool
status_t persist_write_bool(const uint32_t key, const bool value)
MONDAY
@ MONDAY
Monday.
Definition: pebble_worker.h:184
DATA_LOGGING_INT
@ DATA_LOGGING_INT
Signed integer. This may be a 1, 2, or 4 byte integer depending on the item_length parameter.
Definition: pebble_worker.h:1147
health_service_get_heart_rate_sample_period_expiration_sec
uint16_t health_service_get_heart_rate_sample_period_expiration_sec(void)
CompassStatusUnavailable
@ CompassStatusUnavailable
The Compass Service is unavailable.
Definition: pebble_worker.h:514
dict_size
uint32_t dict_size(DictionaryIterator *iter)
app_worker_message_unsubscribe
bool app_worker_message_unsubscribe(void)
watch_info_get_firmware_version
WatchInfoVersion watch_info_get_firmware_version(void)
app_timer_cancel
void app_timer_cancel(AppTimer *timer_handle)
HealthActivityRestfulSleep
@ HealthActivityRestfulSleep
The 'restful sleeping' activity.
Definition: pebble_worker.h:801
HealthServiceAccessibilityMaskNotSupported
@ HealthServiceAccessibilityMaskNotSupported
Definition: pebble_worker.h:862
persist_delete
status_t persist_delete(const uint32_t key)
DICT_INVALID_ARGS
@ DICT_INVALID_ARGS
One or more arguments were invalid or uninitialized.
Definition: pebble_worker.h:1407
WatchInfoColor
WatchInfoColor
The different watch colors.
Definition: pebble_worker.h:68
S_FALSE
@ S_FALSE
Equivalent of boolean false.
Definition: pebble_worker.h:1953
WATCH_INFO_MODEL_PEBBLE_TIME_STEEL
@ WATCH_INFO_MODEL_PEBBLE_TIME_STEEL
Pebble Time Steel.
Definition: pebble_worker.h:57
ACCEL_AXIS_Z
@ ACCEL_AXIS_Z
Definition: pebble_worker.h:414
HealthServiceTimeScopeDailyWeekdayOrWeekend
@ HealthServiceTimeScopeDailyWeekdayOrWeekend
Definition: pebble_worker.h:695
MONTH_UNIT
@ MONTH_UNIT
Flag to represent the "months" time unit.
Definition: pebble_worker.h:599
status_t
int32_t status_t
Return value for system operations. See StatusCode for possible values.
Definition: pebble_worker.h:1964
HealthEventHandler
void(* HealthEventHandler)(HealthEventType event, void *context)
Definition: pebble_worker.h:949
MeasurementSystemUnknown
@ MeasurementSystemUnknown
The measurement system is unknown, or does not apply to the chosen metric.
Definition: pebble_worker.h:1075
uuid_to_string
void uuid_to_string(const Uuid *uuid, char *buffer)
AccelAxisType
AccelAxisType
Enumerated values defining the three accelerometer axes.
Definition: pebble_worker.h:405
Tuplet::length
const uint16_t length
Length of the data.
Definition: pebble.h:1842
dict_serialize_tuplets
DictionaryResult dict_serialize_tuplets(DictionarySerializeCallback callback, void *context, const Tuplet *const tuplets, const uint8_t tuplets_count)
data_logging_finish
void data_logging_finish(DataLoggingSessionRef logging_session)
dict_write_end
uint32_t dict_write_end(DictionaryIterator *iter)
FRIDAY
@ FRIDAY
Friday.
Definition: pebble_worker.h:188
heap_bytes_free
size_t heap_bytes_free(void)
accel_service_peek
int accel_service_peek(AccelData *data)
dict_write_data
DictionaryResult dict_write_data(DictionaryIterator *iter, const uint32_t key, const uint8_t *const data, const uint16_t size)
health_service_aggregate_averaged
HealthValue health_service_aggregate_averaged(HealthMetric metric, time_t time_start, time_t time_end, HealthAggregation aggregation, HealthServiceTimeScope scope)
HealthServiceAccessibilityMaskNotAvailable
@ HealthServiceAccessibilityMaskNotAvailable
No samples were recorded for the given time span.
Definition: pebble_worker.h:864
DATA_LOGGING_UINT
@ DATA_LOGGING_UINT
Unsigned integer. This may be a 1, 2, or 4 byte integer depending on the item_length parameter.
Definition: pebble_worker.h:1145
app_worker_launch
AppWorkerResult app_worker_launch(void)
CompassHeading
int32_t CompassHeading
Definition: pebble_worker.h:529
AccelRawDataHandler
void(* AccelRawDataHandler)(AccelRawData *data, uint32_t num_samples, uint64_t timestamp)
Definition: pebble_worker.h:426
clock_get_timezone
void clock_get_timezone(char *timezone, const size_t buffer_size)
TODAY
@ TODAY
Today.
Definition: pebble_worker.h:182
connection_service_peek_pebble_app_connection
bool connection_service_peek_pebble_app_connection(void)
WATCH_INFO_COLOR_TIME_BLACK
@ WATCH_INFO_COLOR_TIME_BLACK
Time Black.
Definition: pebble_worker.h:84
CompassStatusDataInvalid
@ CompassStatusDataInvalid
Definition: pebble_worker.h:517
E_OUT_OF_MEMORY
@ E_OUT_OF_MEMORY
Insufficient allocatable memory available.
Definition: pebble_worker.h:1926
HealthActivityMask
uint32_t HealthActivityMask
Expresses a set of HealthActivity values as a bitmask.
Definition: pebble_worker.h:789
AppWorkerMessage
Generic structure of a worker message that can be sent between an app and its worker.
Definition: pebble.h:2756
AccelTapHandler
void(* AccelTapHandler)(AccelAxisType axis, int32_t direction)
Definition: pebble_worker.h:431
WATCH_INFO_COLOR_PEBBLE_2_HR_WHITE
@ WATCH_INFO_COLOR_PEBBLE_2_HR_WHITE
Pebble 2 HR, White / Gray.
Definition: pebble_worker.h:100
WATCH_INFO_MODEL_PEBBLE_STEEL
@ WATCH_INFO_MODEL_PEBBLE_STEEL
Pebble Steel.
Definition: pebble_worker.h:55
WATCH_INFO_COLOR_BLACK
@ WATCH_INFO_COLOR_BLACK
Black.
Definition: pebble_worker.h:70
health_service_set_heart_rate_sample_period
bool health_service_set_heart_rate_sample_period(uint16_t interval_sec)
dict_write_int
DictionaryResult dict_write_int(DictionaryIterator *iter, const uint32_t key, const void *integer, const uint8_t width_bytes, const bool is_signed)
health_service_metric_averaged_accessible
HealthServiceAccessibilityMask health_service_metric_averaged_accessible(HealthMetric metric, time_t time_start, time_t time_end, HealthServiceTimeScope scope)
HealthServiceTimeScope
HealthServiceTimeScope
Used by health_service_sum_averaged() to specify how the average is computed.
Definition: pebble_worker.h:687
TUPLE_UINT
@ TUPLE_UINT
Definition: pebble_worker.h:1423
DATA_LOGGING_BUSY
@ DATA_LOGGING_BUSY
Someone else is writing to this logging session.
Definition: pebble_worker.h:1153
tm::tm_gmtoff
int tm_gmtoff
Definition: pebble.h:8322
E_INTERNAL
@ E_INTERNAL
There was a generic internal logic error.
Definition: pebble_worker.h:1920
WATCH_INFO_COLOR_PEBBLE_TIME_2_SILVER
@ WATCH_INFO_COLOR_PEBBLE_TIME_2_SILVER
Pebble Time 2, Silver.
Definition: pebble_worker.h:107
health_service_metric_aggregate_averaged_accessible
HealthServiceAccessibilityMask health_service_metric_aggregate_averaged_accessible(HealthMetric metric, time_t time_start, time_t time_end, HealthAggregation aggregation, HealthServiceTimeScope scope)
S_TRUE
@ S_TRUE
Equivalent of boolean true.
Definition: pebble_worker.h:1950
TUPLE_CSTRING
@ TUPLE_CSTRING
The value is a zero-terminated, UTF-8 C-string.
Definition: pebble_worker.h:1420
health_service_events_unsubscribe
bool health_service_events_unsubscribe(void)
WATCH_INFO_MODEL_PEBBLE_TIME_2
@ WATCH_INFO_MODEL_PEBBLE_TIME_2
Pebble Time 2.
Definition: pebble_worker.h:62
S_NO_MORE_ITEMS
@ S_NO_MORE_ITEMS
For list-style requests. At end of list.
Definition: pebble_worker.h:1956
E_ERROR
@ E_ERROR
An error occurred (no description).
Definition: pebble_worker.h:1914
MeasurementSystem
MeasurementSystem
Types of measurement system a HealthMetric may be measured in.
Definition: pebble_worker.h:1073
dict_read_begin_from_buffer
Tuple * dict_read_begin_from_buffer(DictionaryIterator *iter, const uint8_t *const buffer, const uint16_t size)
WATCH_INFO_COLOR_GREEN
@ WATCH_INFO_COLOR_GREEN
Green.
Definition: pebble_worker.h:80
Tuplet::storage
uint32_t storage
Definition: pebble.h:1855
persist_read_bool
bool persist_read_bool(const uint32_t key)
BatteryStateHandler
void(* BatteryStateHandler)(BatteryChargeState charge)
Definition: pebble_worker.h:347
health_service_events_subscribe
bool health_service_events_subscribe(HealthEventHandler handler, void *context)
dict_serialize_tuplets_to_buffer_with_iter
DictionaryResult dict_serialize_tuplets_to_buffer_with_iter(DictionaryIterator *iter, const Tuplet *const tuplets, const uint8_t tuplets_count, uint8_t *buffer, uint32_t *size_in_out)
DictionaryKeyUpdatedCallback
void(* DictionaryKeyUpdatedCallback)(const uint32_t key, const Tuple *new_tuple, const Tuple *old_tuple, void *context)
Definition: pebble_worker.h:1721
StatusCode
StatusCode
Status codes. See status_t.
Definition: pebble.h:2926
DICT_INTERNAL_INCONSISTENCY
@ DICT_INTERNAL_INCONSISTENCY
The lengths and/or count of the dictionary its tuples are inconsistent.
Definition: pebble_worker.h:1409
HealthServiceTimeScopeOnce
@ HealthServiceTimeScopeOnce
No average computed. The result is the same as calling health_service_sum().
Definition: pebble_worker.h:689
WATCH_INFO_COLOR_RED
@ WATCH_INFO_COLOR_RED
Red.
Definition: pebble_worker.h:72
time_start_of_today
time_t time_start_of_today(void)
accel_tap_service_subscribe
void accel_tap_service_subscribe(AccelTapHandler handler)
persist_read_int
int32_t persist_read_int(const uint32_t key)
Tuplet::width
const uint16_t width
Width of the integer.
Definition: pebble.h:1857
DATA_LOGGING_CLOSED
@ DATA_LOGGING_CLOSED
The logging session was made inactive.
Definition: pebble_worker.h:1156
ACCEL_SAMPLING_100HZ
@ ACCEL_SAMPLING_100HZ
100 HZ sampling rate
Definition: pebble_worker.h:442
tm
Definition: pebble.h:8311
ACCEL_SAMPLING_50HZ
@ ACCEL_SAMPLING_50HZ
50 HZ sampling rate
Definition: pebble_worker.h:440
DICT_OK
@ DICT_OK
The operation returned successfully.
Definition: pebble_worker.h:1403
E_RANGE
@ E_RANGE
Argument out of range (may be dynamic).
Definition: pebble_worker.h:1935
ACCEL_AXIS_Y
@ ACCEL_AXIS_Y
Definition: pebble_worker.h:411
health_service_cancel_metric_alert
bool health_service_cancel_metric_alert(HealthMetricAlert *alert)
SECOND_UNIT
@ SECOND_UNIT
Flag to represent the "seconds" time unit.
Definition: pebble_worker.h:591
tm::tm_year
int tm_year
Definition: pebble.h:8317
HealthMetricHeartRateBPM
@ HealthMetricHeartRateBPM
The heart rate, in beats per minute. This is a filtered value that is at most 15 minutes old.
Definition: pebble_worker.h:649
E_BUSY
@ E_BUSY
Another operation prevented this one.
Definition: pebble_worker.h:1944
E_INVALID_OPERATION
@ E_INVALID_OPERATION
Operation not allowed (may depend on state).
Definition: pebble_worker.h:1941
AppWorkerResult
AppWorkerResult
Possible error codes from app_worker_launch, app_worker_kill.
Definition: pebble_worker.h:1763
HealthMetricHeartRateRawBPM
@ HealthMetricHeartRateRawBPM
The raw heart rate value of the most recent sample, in beats per minute.
Definition: pebble_worker.h:651
clock_is_24h_style
bool clock_is_24h_style(void)
HealthIterationDirection
HealthIterationDirection
Definition: pebble_worker.h:830
worker_launch_app
void worker_launch_app(void)
Launch the foreground app for this worker.
accel_raw_data_service_subscribe
void accel_raw_data_service_subscribe(uint32_t samples_per_update, AccelRawDataHandler handler)
connection_service_peek_pebblekit_connection
bool connection_service_peek_pebblekit_connection(void)
uuid_equal
bool uuid_equal(const Uuid *uu1, const Uuid *uu2)
WATCH_INFO_COLOR_TIME_STEEL_SILVER
@ WATCH_INFO_COLOR_TIME_STEEL_SILVER
Time Steel Silver.
Definition: pebble_worker.h:87
gmtime
struct tm * gmtime(const time_t *timep)
WATCH_INFO_COLOR_BLUE
@ WATCH_INFO_COLOR_BLUE
Blue.
Definition: pebble_worker.h:79
compass_service_set_heading_filter
int compass_service_set_heading_filter(CompassHeading filter)
APP_WORKER_RESULT_NOT_RUNNING
@ APP_WORKER_RESULT_NOT_RUNNING
The worker is not running.
Definition: pebble_worker.h:1771
Tuplet::bytes
struct Tuplet::@0::@2 bytes
Valid when .type. is TUPLE_BYTE_ARRAY.
tm::tm_yday
int tm_yday
Definition: pebble.h:8319
WATCH_INFO_COLOR_PEBBLE_2_HR_LIME
@ WATCH_INFO_COLOR_PEBBLE_2_HR_LIME
Pebble 2 HR, Charcoal / Sorbet Green.
Definition: pebble_worker.h:98
DictionaryResult
DictionaryResult
Return values for dictionary write/conversion functions.
Definition: pebble_worker.h:1401
strftime
int strftime(char *s, size_t maxsize, const char *format, const struct tm *tm_p)
WeekDay
WeekDay
Weekday values.
Definition: pebble_worker.h:181
memory_cache_flush
void memory_cache_flush(void *start, size_t size)
app_worker_kill
AppWorkerResult app_worker_kill(void)
AppTimerCallback
void(* AppTimerCallback)(void *data)
Definition: pebble_worker.h:1834
HealthAggregationAvg
@ HealthAggregationAvg
Definition: pebble_worker.h:737
WATCH_INFO_COLOR_PEBBLE_TIME_2_GOLD
@ WATCH_INFO_COLOR_PEBBLE_TIME_2_GOLD
Pebble Time 2, Gold.
Definition: pebble_worker.h:108
dict_write_begin
DictionaryResult dict_write_begin(DictionaryIterator *iter, uint8_t *const buffer, const uint16_t size)
DATA_LOGGING_NOT_FOUND
@ DATA_LOGGING_NOT_FOUND
The logging session does not exist.
Definition: pebble_worker.h:1155
dict_merge
DictionaryResult dict_merge(DictionaryIterator *dest, uint32_t *dest_max_size_in_out, DictionaryIterator *source, const bool update_existing_keys_only, const DictionaryKeyUpdatedCallback key_callback, void *context)
__attribute__
struct __attribute__((__packed__))
Definition: pebble_worker.h:1214
E_OUT_OF_STORAGE
@ E_OUT_OF_STORAGE
Insufficient long-term storage available.
Definition: pebble_worker.h:1929
THURSDAY
@ THURSDAY
Thursday.
Definition: pebble_worker.h:187
HOUR_UNIT
@ HOUR_UNIT
Flag to represent the "hours" time unit.
Definition: pebble_worker.h:595
Tuplet::key
uint32_t key
The key.
Definition: pebble.h:1832
HealthAggregation
HealthAggregation
Definition: pebble_worker.h:730
app_worker_send_message
void app_worker_send_message(uint8_t type, AppWorkerMessage *data)
HealthValue
int32_t HealthValue
Type used to represent HealthMetric values.
Definition: pebble_worker.h:655
WATCH_INFO_COLOR_TIME_ROUND_BLACK_20
@ WATCH_INFO_COLOR_TIME_ROUND_BLACK_20
Time Round 20mm lug size, Black.
Definition: pebble_worker.h:94
WATCH_INFO_COLOR_TIME_STEEL_BLACK
@ WATCH_INFO_COLOR_TIME_STEEL_BLACK
Time Steel Black.
Definition: pebble_worker.h:88
CompassStatus
CompassStatus
Enum describing the current state of the Compass Service.
Definition: pebble_worker.h:512
MINUTE_UNIT
@ MINUTE_UNIT
Flag to represent the "minutes" time unit.
Definition: pebble_worker.h:593
DATA_LOGGING_BYTE_ARRAY
@ DATA_LOGGING_BYTE_ARRAY
Definition: pebble_worker.h:1143
Tuplet::type
TupleType type
Definition: pebble.h:1830
tick_timer_service_unsubscribe
void tick_timer_service_unsubscribe(void)
APP_LOG_LEVEL_DEBUG
@ APP_LOG_LEVEL_DEBUG
Debug level log message.
Definition: pebble_worker.h:1301
accel_data_service_unsubscribe
void accel_data_service_unsubscribe(void)
HealthMetricAlert
struct HealthMetricAlert HealthMetricAlert
Definition: pebble.h:885
WATCH_INFO_MODEL_PEBBLE_TIME
@ WATCH_INFO_MODEL_PEBBLE_TIME
Pebble Time.
Definition: pebble_worker.h:56
dict_read_next
Tuple * dict_read_next(DictionaryIterator *iter)
clock_to_timestamp
time_t clock_to_timestamp(WeekDay day, int hour, int minute)
DICT_MALLOC_FAILED
@ DICT_MALLOC_FAILED
Definition: pebble_worker.h:1412
TUPLE_BYTE_ARRAY
@ TUPLE_BYTE_ARRAY
The value is an array of bytes.
Definition: pebble_worker.h:1418
APP_LOG_LEVEL_WARNING
@ APP_LOG_LEVEL_WARNING
Warning level log message.
Definition: pebble_worker.h:1297
DAY_UNIT
@ DAY_UNIT
Flag to represent the "days" time unit.
Definition: pebble_worker.h:597
WATCH_INFO_MODEL_PEBBLE_ORIGINAL
@ WATCH_INFO_MODEL_PEBBLE_ORIGINAL
Original Pebble.
Definition: pebble_worker.h:54
persist_read_string
int persist_read_string(const uint32_t key, char *buffer, const size_t buffer_size)
HealthActivityWalk
@ HealthActivityWalk
The 'walk' activity.
Definition: pebble_worker.h:803
DATA_LOGGING_INVALID_PARAMS
@ DATA_LOGGING_INVALID_PARAMS
An invalid parameter was passed to one of the functions.
Definition: pebble_worker.h:1157