Pebble Foundation Classes
0.2.0
C++ for Pebble
|
11 #include "pebble_warn_unsupported_functions.h"
12 #include "pebble_worker_sdk_version.h"
15 #define __FILE_NAME__ __FILE__
21 #define ARRAY_LENGTH(array) (sizeof((array))/sizeof((array)[0]))
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))))) \
110 WATCH_INFO_COLOR__MAX
139 #define TRIG_MAX_RATIO 0xffff
144 #define TRIG_MAX_ANGLE 0x10000
149 #define TRIGANGLE_TO_DEG(trig_angle) (((trig_angle) * 360) / TRIG_MAX_ANGLE)
154 #define DEG_TO_TRIGANGLE(angle) (((angle) * TRIG_MAX_ANGLE) / 360)
221 #define TIMEZONE_NAME_LENGTH 32
235 typedef enum PlatformType {
243 #define PBL_PLATFORM_TYPE_CURRENT PlatformTypeBasalt
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) : \
254 #define PBL_PLATFORM_SWITCH(PLAT, APLITE, BASALT, CHALK, DIORITE, EMERY) \
255 PBL_PLATFORM_SWITCH_DEFAULT(PLAT, APLITE, APLITE, BASALT, CHALK, DIORITE, EMERY)
289 typedef void (*ConnectionHandler)(
bool connected);
295 ConnectionHandler pebble_app_connection_handler;
297 ConnectionHandler pebblekit_connection_handler;
338 uint8_t charge_percent;
542 bool is_declination_valid;
792 #define HealthActivityMaskAll ((HealthActivityOpenWorkout << 1) - 1)
823 time_t time_end,
void *context);
881 HealthMetric metric, time_t time_start, time_t time_end);
1020 AmbientLightLevelUnknown = 0,
1021 AmbientLightLevelVeryDark,
1022 AmbientLightLevelDark,
1023 AmbientLightLevelLight,
1024 AmbientLightLevelVeryLight,
1036 uint8_t orientation;
1042 uint8_t heart_rate_bpm;
1043 uint8_t reserved[6];
1066 time_t *time_start, time_t *time_end);
1070 #define PBL_IF_HEALTH_ELSE(if_true, if_false) (if_true)
1135 typedef void *DataLoggingSessionRef;
1171 uint16_t item_length,
bool resume);
1204 uint32_t num_items);
1233 #define UUID_SIZE 16
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})
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] })
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] })
1255 bool uuid_equal(
const Uuid *uu1,
const Uuid *uu2);
1264 #define UUID_STRING_BUFFER_LENGTH (32 + 4 + 2 + 1)
1282 void app_log(uint8_t log_level,
const char* src_filename,
int src_line_number,
const char* fmt,
1289 #define APP_LOG(level, fmt, args...) \
1290 app_log(level, __FILE_NAME__, __LINE__, fmt, ## args)
1472 typedef struct Dictionary Dictionary;
1480 Dictionary *dictionary;
1614 const uint8_t *
data;
1631 const uint16_t
width;
1640 #define TupletBytes(_key, _data, _length) \
1641 ((const Tuplet) { .type = TUPLE_BYTE_ARRAY, .key = _key, .bytes = { .data = _data, .length = _length }})
1646 #define TupletCString(_key, _cstring) \
1647 ((const Tuplet) { .type = TUPLE_CSTRING, .key = _key, .cstring = { .data = _cstring, .length = _cstring ? strlen(_cstring) + 1 : 0 }})
1652 #define TupletInteger(_key, _integer) \
1653 ((const Tuplet) { .type = IS_SIGNED(_integer) ? TUPLE_INT : TUPLE_UINT, .key = _key, .integer = { .storage = _integer, .width = sizeof(_integer) }})
1735 const bool update_existing_keys_only,
1830 typedef struct AppTimer AppTimer;
1903 #define PERSIST_DATA_MAX_LENGTH 256
1906 #define PERSIST_STRING_MAX_LENGTH PERSIST_DATA_MAX_LENGTH
1997 int persist_read_data(
const uint32_t key,
void *buffer,
const size_t buffer_size);
2065 #define SECONDS_PER_MINUTE (60)
2067 #define MINUTES_PER_HOUR (60)
2069 #define SECONDS_PER_HOUR (SECONDS_PER_MINUTE * MINUTES_PER_HOUR)
2071 #define HOURS_PER_DAY (24)
2073 #define MINUTES_PER_DAY (HOURS_PER_DAY * MINUTES_PER_HOUR)
2075 #define SECONDS_PER_DAY (MINUTES_PER_DAY * SECONDS_PER_MINUTE)
2101 int strftime(
char* s,
size_t maxsize,
const char* format,
const struct tm* tm_p);
2114 struct tm *
gmtime(
const time_t *timep);
2127 time_t
time(time_t *tloc);
2140 double difftime(time_t end, time_t beginning);
2151 uint16_t
time_ms(time_t *t_utc, uint16_t *out_ms);
void battery_state_service_unsubscribe(void)
bool clock_is_timezone_set(void)
@ DATA_LOGGING_INTERNAL_ERR
An internal error occurred.
Definition: pebble_worker.h:1158
@ HealthEventHeartRateUpdate
Value of HealthMetricHeartRateBPM or HealthMetricHeartRateRawBPM has changed.
Definition: pebble_worker.h:942
void accel_tap_service_unsubscribe(void)
void connection_service_subscribe(ConnectionHandlers conn_handlers)
void compass_service_subscribe(CompassHeadingHandler handler)
@ HealthServiceAccessibilityMaskNoPermission
The user hasn't granted permission.
Definition: pebble_worker.h:859
AmbientLightLevel
Light level enum.
Definition: pebble.h:1245
@ HealthMetricRestingKCalories
The number of kcal (Calories) burned while resting due to resting metabolism.
Definition: pebble_worker.h:645
@ HealthActivitySleep
The 'sleeping' activity.
Definition: pebble_worker.h:799
@ E_DOES_NOT_EXIST
Target of operation does not exist.
Definition: pebble_worker.h:1938
@ ACCEL_SAMPLING_25HZ
25 HZ sampling rate [Default]
Definition: pebble_worker.h:438
DataLoggingSessionRef data_logging_create(uint32_t tag, DataLoggingItemType item_type, uint16_t item_length, bool resume)
@ WATCH_INFO_COLOR_ORANGE
Orange.
Definition: pebble_worker.h:73
Definition: pebble.h:1260
bool app_timer_reschedule(AppTimer *timer_handle, uint32_t new_timeout_ms)
@ WATCH_INFO_MODEL_UNKNOWN
Unknown model.
Definition: pebble_worker.h:53
@ TUESDAY
Tuesday.
Definition: pebble_worker.h:185
time_t time(time_t *tloc) noexcept
@ E_AGAIN
Operation not completed; try again.
Definition: pebble_worker.h:1947
struct tm * localtime(const time_t *timep)
WatchInfoModel watch_info_get_model(void)
@ WATCH_INFO_COLOR_PEBBLE_2_HR_BLACK
Pebble 2 HR, Black / Charcoal.
Definition: pebble_worker.h:97
bool(* HealthActivityIteratorCB)(HealthActivity activity, time_t time_start, time_t time_end, void *context)
Definition: pebble_worker.h:822
HealthActivity
Health-related activities that can be accessed using.
Definition: pebble_worker.h:795
WatchInfoModel
The different watch models.
Definition: pebble_worker.h:52
HealthServiceAccessibilityMask
Definition: pebble_worker.h:855
HealthMetric
Definition: pebble_worker.h:633
@ CompassStatusCalibrating
Compass is calibrating: the data is valid but the calibration is still being refined.
Definition: pebble_worker.h:519
void(* AppWorkerMessageHandler)(uint16_t type, AppWorkerMessage *data)
Definition: pebble_worker.h:1802
int tm_min
Definition: pebble.h:8313
DictionaryResult dict_write_tuplet(DictionaryIterator *iter, const Tuplet *const tuplet)
@ WATCH_INFO_COLOR_PEBBLE_2_SE_BLACK
Pebble 2 SE, Black / Charcoal.
Definition: pebble_worker.h:103
@ WATCH_INFO_COLOR_PEBBLE_2_HR_FLAME
Pebble 2 HR, Charcoal / Red.
Definition: pebble_worker.h:99
uint32_t dict_calc_buffer_size_from_tuplets(const Tuplet *const tuplets, const uint8_t tuplets_count)
@ ACCEL_AXIS_X
Definition: pebble_worker.h:408
@ HealthMetricWalkedDistanceMeters
The distance walked, in meters.
Definition: pebble_worker.h:639
@ WATCH_INFO_COLOR_TIME_ROUND_ROSE_GOLD_14
Time Round 14mm lug size, Rose Gold.
Definition: pebble_worker.h:95
int32_t atan2_lookup(int16_t y, int16_t x)
time_t mktime(struct tm *tb)
bool app_worker_is_running(void)
@ HealthEventMetricAlert
A metric has crossed the threshold set by health_service_register_metric_alert.
Definition: pebble_worker.h:940
@ HealthEventMovementUpdate
Definition: pebble_worker.h:935
@ HealthMetricSleepRestfulSeconds
The number of sleep seconds in the 'restful' or deep sleep state.
Definition: pebble_worker.h:643
@ WATCH_INFO_MODEL_PEBBLE_2_SE
Pebble 2 SE.
Definition: pebble_worker.h:61
@ APP_LOG_LEVEL_ERROR
Error level log message.
Definition: pebble_worker.h:1295
@ HealthAggregationMax
Definition: pebble_worker.h:743
HealthServiceAccessibilityMask health_service_metric_accessible(HealthMetric metric, time_t time_start, time_t time_end)
void(* TickHandler)(struct tm *tick_time, TimeUnits units_changed)
Definition: pebble_worker.h:607
Tuple * dict_read_first(DictionaryIterator *iter)
@ WATCH_INFO_COLOR_PEBBLE_2_HR_AQUA
Pebble 2 HR, White / Turquoise.
Definition: pebble_worker.h:101
uint32_t dict_calc_buffer_size(const uint8_t tuple_count,...)
Tuple * dict_find(const DictionaryIterator *iter, const uint32_t key)
int tm_wday
Definition: pebble.h:8318
uint32_t health_service_get_minute_history(HealthMinuteData *minute_data, uint32_t max_records, time_t *time_start, time_t *time_end)
void accel_data_service_subscribe(uint32_t samples_per_update, AccelDataHandler handler)
@ HealthMetricSleepSeconds
The number of seconds spent sleeping.
Definition: pebble_worker.h:641
HealthEventType
Health event enum. Passed into the HealthEventHandler.
Definition: pebble_worker.h:928
@ APP_WORKER_RESULT_ASKING_CONFIRMATION
The user will be asked for confirmation.
Definition: pebble_worker.h:1775
HealthServiceAccessibilityMask health_service_any_activity_accessible(HealthActivityMask activity_mask, time_t time_start, time_t time_end)
void(* AccelDataHandler)(AccelData *data, uint32_t num_samples)
Definition: pebble_worker.h:420
@ WATCH_INFO_COLOR_WHITE
White.
Definition: pebble_worker.h:71
@ WATCH_INFO_COLOR_PEBBLE_TIME_2_BLACK
Pebble Time 2, Black.
Definition: pebble_worker.h:106
DictionaryResult dict_write_cstring(DictionaryIterator *iter, const uint32_t key, const char *const cstring)
@ HealthMetricActiveSeconds
The number of seconds spent active (i.e. not resting).
Definition: pebble_worker.h:637
@ APP_WORKER_RESULT_ALREADY_RUNNING
The worker is already running.
Definition: pebble_worker.h:1773
int accel_service_set_sampling_rate(AccelSamplingRate rate)
HealthActivityMask health_service_peek_current_activities(void)
@ WEDNESDAY
Wednesday.
Definition: pebble_worker.h:186
@ WATCH_INFO_COLOR_TIME_ROUND_BLACK_14
Time Round 14mm lug size, Black.
Definition: pebble_worker.h:92
@ HealthActivityNone
No special activity.
Definition: pebble_worker.h:797
HealthValue health_service_sum_averaged(HealthMetric metric, time_t time_start, time_t time_end, HealthServiceTimeScope scope)
@ WATCH_INFO_MODEL_PEBBLE_TIME_ROUND_14
Pebble Time Round, 14mm lug size.
Definition: pebble_worker.h:58
const uint8_t * data
Pointer to the data.
Definition: pebble.h:1840
struct Tuplet::@0::@3 cstring
Valid when .type. is TUPLE_CSTRING.
@ HealthAggregationSum
Definition: pebble_worker.h:734
AppLogLevel
Suggested log level values.
Definition: pebble_worker.h:1293
@ E_INVALID_ARGUMENT
The function was not called correctly.
Definition: pebble_worker.h:1923
@ WATCH_INFO_MODEL_PEBBLE_TIME_ROUND_20
Pebble Time Round, 20mm lug size.
Definition: pebble_worker.h:59
@ E_UNKNOWN
No idea what went wrong.
Definition: pebble_worker.h:1917
@ WATCH_INFO_COLOR_TIME_ROUND_SILVER_20
Time Round 20mm lug size, Silver.
Definition: pebble_worker.h:93
@ HealthEventSleepUpdate
Definition: pebble_worker.h:938
uint16_t time_ms(time_t *t_utc, uint16_t *out_ms)
@ APP_WORKER_RESULT_SUCCESS
Success.
Definition: pebble_worker.h:1765
@ HealthActivityRun
The 'run' activity.
Definition: pebble_worker.h:805
@ HealthIterationDirectionFuture
Iterate into the future.
Definition: pebble_worker.h:834
int tm_sec
Definition: pebble.h:8312
AccelSamplingRate
Valid accelerometer sampling rates, in Hz.
Definition: pebble_worker.h:434
@ HealthIterationDirectionPast
Iterate into the past.
Definition: pebble_worker.h:832
MeasurementSystem health_service_get_measurement_system_for_display(HealthMetric metric)
DataLoggingResult data_logging_log(DataLoggingSessionRef logging_session, const void *data, uint32_t num_items)
DataLoggingItemType
Definition: pebble_worker.h:1139
@ HealthEventSignificantUpdate
Definition: pebble_worker.h:932
@ S_NO_ACTION_REQUIRED
No action was taken as none was required.
Definition: pebble_worker.h:1959
char tm_zone[TZ_LEN]
Definition: pebble.h:8323
@ SUNDAY
Sunday.
Definition: pebble_worker.h:183
int tm_mon
Definition: pebble.h:8316
@ WATCH_INFO_MODEL_PEBBLE_2_HR
Pebble 2 HR.
Definition: pebble_worker.h:60
bool app_worker_message_subscribe(AppWorkerMessageHandler handler)
Structure containing a single heading towards magnetic and true north.
Definition: pebble.h:758
@ DATA_LOGGING_SUCCESS
Successful operation.
Definition: pebble_worker.h:1152
int tm_mday
Definition: pebble.h:8315
@ WATCH_INFO_COLOR_STAINLESS_STEEL
Stainless Steel.
Definition: pebble_worker.h:76
@ WATCH_INFO_COLOR_TIME_ROUND_SILVER_14
Time Round 14mm lug size, Silver.
Definition: pebble_worker.h:91
int persist_read_data(const uint32_t key, void *buffer, const size_t buffer_size)
int persist_get_size(const uint32_t key)
int32_t sin_lookup(int32_t angle)
@ HealthServiceTimeScopeDaily
Compute average across all days of the week.
Definition: pebble_worker.h:697
@ WATCH_INFO_COLOR_TIME_WHITE
Time White.
Definition: pebble_worker.h:83
@ TUPLE_INT
Definition: pebble_worker.h:1426
void worker_event_loop(void)
int accel_service_set_samples_per_update(uint32_t num_samples)
int tm_hour
Definition: pebble.h:8314
Structure for retrieval of the battery charge state.
Definition: pebble.h:562
int32_t cos_lookup(int32_t angle)
@ MeasurementSystemMetric
The metric measurement system.
Definition: pebble_worker.h:1077
TupleType
Values representing the type of data that the value field of a Tuple contains.
Definition: pebble_worker.h:1416
DataLoggingResult
Enumerated values describing the possible outcomes of data logging operations.
Definition: pebble_worker.h:1151
HealthValue health_service_peek_current_value(HealthMetric metric)
@ MeasurementSystemImperial
The imperial measurement system.
Definition: pebble_worker.h:1079
@ HealthAggregationMin
Definition: pebble_worker.h:740
@ S_SUCCESS
Operation completed successfully.
Definition: pebble_worker.h:1911
@ APP_WORKER_RESULT_NO_WORKER
No worker found for the current app.
Definition: pebble_worker.h:1767
@ WATCH_INFO_COLOR_PINK
Pink.
Definition: pebble_worker.h:81
DictionaryResult dict_serialize_tuplets_to_buffer(const Tuplet *const tuplets, const uint8_t tuplets_count, uint8_t *buffer, uint32_t *size_in_out)
@ SATURDAY
Saturday.
Definition: pebble_worker.h:189
@ CompassStatusCalibrated
Compass data is valid and the calibration has completed.
Definition: pebble_worker.h:521
HealthValue health_service_sum(HealthMetric metric, time_t time_start, time_t time_end)
@ APP_LOG_LEVEL_DEBUG_VERBOSE
Verbose Debug level log message.
Definition: pebble_worker.h:1303
void(* DictionarySerializeCallback)(const uint8_t *const data, const uint16_t size, void *context)
Definition: pebble_worker.h:1660
@ WATCH_INFO_COLOR_UNKNOWN
Unknown color.
Definition: pebble_worker.h:69
Definition: pebble.h:1705
void clock_copy_time_string(char *buffer, uint8_t size)
size_t heap_bytes_used(void)
@ WATCH_INFO_COLOR_TIME_STEEL_GOLD
Time Steel Gold.
Definition: pebble_worker.h:89
status_t persist_write_int(const uint32_t key, const int32_t value)
int tm_isdst
Definition: pebble.h:8320
@ DATA_LOGGING_FULL
No more space to save data.
Definition: pebble_worker.h:1154
@ DICT_NOT_ENOUGH_STORAGE
There was not enough backing storage to complete the operation.
Definition: pebble_worker.h:1405
Definition: pebble.h:1827
@ YEAR_UNIT
Flag to represent the "years" time unit.
Definition: pebble_worker.h:601
@ APP_LOG_LEVEL_INFO
Info level log message.
Definition: pebble_worker.h:1299
void compass_service_unsubscribe(void)
@ WATCH_INFO_COLOR_MATTE_BLACK
Matte Black.
Definition: pebble_worker.h:77
@ APP_WORKER_RESULT_DIFFERENT_APP
A worker for a different app is already running.
Definition: pebble_worker.h:1769
@ HealthServiceAccessibilityMaskAvailable
Return values are available and represent the collected health information.
Definition: pebble_worker.h:857
void(* CompassHeadingHandler)(CompassHeadingData heading)
Definition: pebble_worker.h:547
DictionaryResult dict_write_uint8(DictionaryIterator *iter, const uint32_t key, const uint8_t value)
TimeUnits
Definition: pebble_worker.h:589
@ ACCEL_SAMPLING_10HZ
10 HZ sampling rate
Definition: pebble_worker.h:436
@ WATCH_INFO_COLOR_PEBBLE_2_SE_WHITE
Pebble 2 SE, White / Gray.
Definition: pebble_worker.h:104
void battery_state_service_subscribe(BatteryStateHandler handler)
@ HealthServiceTimeScopeWeekly
Definition: pebble_worker.h:692
@ HealthMetricActiveKCalories
The number of kcal (Calories) burned while active.
Definition: pebble_worker.h:647
bool persist_exists(const uint32_t key)
@ WATCH_INFO_COLOR_GRAY
Gray.
Definition: pebble_worker.h:74
int compass_service_peek(CompassHeadingData *data)
@ E_OUT_OF_RESOURCES
Insufficient resources available.
Definition: pebble_worker.h:1932
struct Tuplet::@0::@4 integer
Valid when .type. is TUPLE_INT or TUPLE_UINT.
HealthValue health_service_sum_today(HealthMetric metric)
AppTimer * app_timer_register(uint32_t timeout_ms, AppTimerCallback callback, void *callback_data)
void tick_timer_service_subscribe(TimeUnits tick_units, TickHandler handler)
@ WATCH_INFO_COLOR_TIME_RED
Time Red.
Definition: pebble_worker.h:85
HealthMetricAlert * health_service_register_metric_alert(HealthMetric metric, HealthValue threshold)
double difftime(time_t end, time_t beginning) noexcept
void connection_service_unsubscribe(void)
@ HealthActivityOpenWorkout
The 'generic' activity.
Definition: pebble_worker.h:807
BatteryChargeState battery_state_service_peek(void)
void health_service_activities_iterate(HealthActivityMask activity_mask, time_t time_start, time_t time_end, HealthIterationDirection direction, HealthActivityIteratorCB callback, void *context)
int persist_write_string(const uint32_t key, const char *cstring)
@ HealthMetricStepCount
The number of steps counted.
Definition: pebble_worker.h:635
int persist_write_data(const uint32_t key, const void *data, const size_t size)
status_t persist_write_bool(const uint32_t key, const bool value)
@ MONDAY
Monday.
Definition: pebble_worker.h:184
@ 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
uint16_t health_service_get_heart_rate_sample_period_expiration_sec(void)
@ CompassStatusUnavailable
The Compass Service is unavailable.
Definition: pebble_worker.h:514
uint32_t dict_size(DictionaryIterator *iter)
bool app_worker_message_unsubscribe(void)
WatchInfoVersion watch_info_get_firmware_version(void)
void app_timer_cancel(AppTimer *timer_handle)
@ HealthActivityRestfulSleep
The 'restful sleeping' activity.
Definition: pebble_worker.h:801
@ HealthServiceAccessibilityMaskNotSupported
Definition: pebble_worker.h:862
status_t persist_delete(const uint32_t key)
@ DICT_INVALID_ARGS
One or more arguments were invalid or uninitialized.
Definition: pebble_worker.h:1407
WatchInfoColor
The different watch colors.
Definition: pebble_worker.h:68
@ S_FALSE
Equivalent of boolean false.
Definition: pebble_worker.h:1953
@ WATCH_INFO_MODEL_PEBBLE_TIME_STEEL
Pebble Time Steel.
Definition: pebble_worker.h:57
@ ACCEL_AXIS_Z
Definition: pebble_worker.h:414
@ HealthServiceTimeScopeDailyWeekdayOrWeekend
Definition: pebble_worker.h:695
@ MONTH_UNIT
Flag to represent the "months" time unit.
Definition: pebble_worker.h:599
int32_t status_t
Return value for system operations. See StatusCode for possible values.
Definition: pebble_worker.h:1964
void(* HealthEventHandler)(HealthEventType event, void *context)
Definition: pebble_worker.h:949
@ MeasurementSystemUnknown
The measurement system is unknown, or does not apply to the chosen metric.
Definition: pebble_worker.h:1075
void uuid_to_string(const Uuid *uuid, char *buffer)
AccelAxisType
Enumerated values defining the three accelerometer axes.
Definition: pebble_worker.h:405
const uint16_t length
Length of the data.
Definition: pebble.h:1842
DictionaryResult dict_serialize_tuplets(DictionarySerializeCallback callback, void *context, const Tuplet *const tuplets, const uint8_t tuplets_count)
void data_logging_finish(DataLoggingSessionRef logging_session)
uint32_t dict_write_end(DictionaryIterator *iter)
@ FRIDAY
Friday.
Definition: pebble_worker.h:188
size_t heap_bytes_free(void)
int accel_service_peek(AccelData *data)
DictionaryResult dict_write_data(DictionaryIterator *iter, const uint32_t key, const uint8_t *const data, const uint16_t size)
HealthValue health_service_aggregate_averaged(HealthMetric metric, time_t time_start, time_t time_end, HealthAggregation aggregation, HealthServiceTimeScope scope)
@ HealthServiceAccessibilityMaskNotAvailable
No samples were recorded for the given time span.
Definition: pebble_worker.h:864
@ 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
AppWorkerResult app_worker_launch(void)
int32_t CompassHeading
Definition: pebble_worker.h:529
void(* AccelRawDataHandler)(AccelRawData *data, uint32_t num_samples, uint64_t timestamp)
Definition: pebble_worker.h:426
void clock_get_timezone(char *timezone, const size_t buffer_size)
@ TODAY
Today.
Definition: pebble_worker.h:182
bool connection_service_peek_pebble_app_connection(void)
@ WATCH_INFO_COLOR_TIME_BLACK
Time Black.
Definition: pebble_worker.h:84
@ CompassStatusDataInvalid
Definition: pebble_worker.h:517
@ E_OUT_OF_MEMORY
Insufficient allocatable memory available.
Definition: pebble_worker.h:1926
uint32_t HealthActivityMask
Expresses a set of HealthActivity values as a bitmask.
Definition: pebble_worker.h:789
Generic structure of a worker message that can be sent between an app and its worker.
Definition: pebble.h:2756
void(* AccelTapHandler)(AccelAxisType axis, int32_t direction)
Definition: pebble_worker.h:431
@ WATCH_INFO_COLOR_PEBBLE_2_HR_WHITE
Pebble 2 HR, White / Gray.
Definition: pebble_worker.h:100
@ WATCH_INFO_MODEL_PEBBLE_STEEL
Pebble Steel.
Definition: pebble_worker.h:55
@ WATCH_INFO_COLOR_BLACK
Black.
Definition: pebble_worker.h:70
bool health_service_set_heart_rate_sample_period(uint16_t interval_sec)
DictionaryResult dict_write_int(DictionaryIterator *iter, const uint32_t key, const void *integer, const uint8_t width_bytes, const bool is_signed)
HealthServiceAccessibilityMask health_service_metric_averaged_accessible(HealthMetric metric, time_t time_start, time_t time_end, HealthServiceTimeScope scope)
HealthServiceTimeScope
Used by health_service_sum_averaged() to specify how the average is computed.
Definition: pebble_worker.h:687
@ TUPLE_UINT
Definition: pebble_worker.h:1423
@ DATA_LOGGING_BUSY
Someone else is writing to this logging session.
Definition: pebble_worker.h:1153
int tm_gmtoff
Definition: pebble.h:8322
@ E_INTERNAL
There was a generic internal logic error.
Definition: pebble_worker.h:1920
@ WATCH_INFO_COLOR_PEBBLE_TIME_2_SILVER
Pebble Time 2, Silver.
Definition: pebble_worker.h:107
HealthServiceAccessibilityMask health_service_metric_aggregate_averaged_accessible(HealthMetric metric, time_t time_start, time_t time_end, HealthAggregation aggregation, HealthServiceTimeScope scope)
@ S_TRUE
Equivalent of boolean true.
Definition: pebble_worker.h:1950
@ TUPLE_CSTRING
The value is a zero-terminated, UTF-8 C-string.
Definition: pebble_worker.h:1420
bool health_service_events_unsubscribe(void)
@ WATCH_INFO_MODEL_PEBBLE_TIME_2
Pebble Time 2.
Definition: pebble_worker.h:62
@ S_NO_MORE_ITEMS
For list-style requests. At end of list.
Definition: pebble_worker.h:1956
@ E_ERROR
An error occurred (no description).
Definition: pebble_worker.h:1914
MeasurementSystem
Types of measurement system a HealthMetric may be measured in.
Definition: pebble_worker.h:1073
Tuple * dict_read_begin_from_buffer(DictionaryIterator *iter, const uint8_t *const buffer, const uint16_t size)
@ WATCH_INFO_COLOR_GREEN
Green.
Definition: pebble_worker.h:80
uint32_t storage
Definition: pebble.h:1855
bool persist_read_bool(const uint32_t key)
void(* BatteryStateHandler)(BatteryChargeState charge)
Definition: pebble_worker.h:347
bool health_service_events_subscribe(HealthEventHandler handler, void *context)
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)
void(* DictionaryKeyUpdatedCallback)(const uint32_t key, const Tuple *new_tuple, const Tuple *old_tuple, void *context)
Definition: pebble_worker.h:1721
StatusCode
Status codes. See status_t.
Definition: pebble.h:2926
@ DICT_INTERNAL_INCONSISTENCY
The lengths and/or count of the dictionary its tuples are inconsistent.
Definition: pebble_worker.h:1409
@ HealthServiceTimeScopeOnce
No average computed. The result is the same as calling health_service_sum().
Definition: pebble_worker.h:689
@ WATCH_INFO_COLOR_RED
Red.
Definition: pebble_worker.h:72
time_t time_start_of_today(void)
void accel_tap_service_subscribe(AccelTapHandler handler)
int32_t persist_read_int(const uint32_t key)
const uint16_t width
Width of the integer.
Definition: pebble.h:1857
@ DATA_LOGGING_CLOSED
The logging session was made inactive.
Definition: pebble_worker.h:1156
@ ACCEL_SAMPLING_100HZ
100 HZ sampling rate
Definition: pebble_worker.h:442
Definition: pebble.h:8311
@ ACCEL_SAMPLING_50HZ
50 HZ sampling rate
Definition: pebble_worker.h:440
@ DICT_OK
The operation returned successfully.
Definition: pebble_worker.h:1403
@ E_RANGE
Argument out of range (may be dynamic).
Definition: pebble_worker.h:1935
@ ACCEL_AXIS_Y
Definition: pebble_worker.h:411
bool health_service_cancel_metric_alert(HealthMetricAlert *alert)
@ SECOND_UNIT
Flag to represent the "seconds" time unit.
Definition: pebble_worker.h:591
int tm_year
Definition: pebble.h:8317
@ 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
Another operation prevented this one.
Definition: pebble_worker.h:1944
@ E_INVALID_OPERATION
Operation not allowed (may depend on state).
Definition: pebble_worker.h:1941
AppWorkerResult
Possible error codes from app_worker_launch, app_worker_kill.
Definition: pebble_worker.h:1763
@ HealthMetricHeartRateRawBPM
The raw heart rate value of the most recent sample, in beats per minute.
Definition: pebble_worker.h:651
bool clock_is_24h_style(void)
HealthIterationDirection
Definition: pebble_worker.h:830
void worker_launch_app(void)
Launch the foreground app for this worker.
void accel_raw_data_service_subscribe(uint32_t samples_per_update, AccelRawDataHandler handler)
bool connection_service_peek_pebblekit_connection(void)
bool uuid_equal(const Uuid *uu1, const Uuid *uu2)
@ WATCH_INFO_COLOR_TIME_STEEL_SILVER
Time Steel Silver.
Definition: pebble_worker.h:87
struct tm * gmtime(const time_t *timep)
@ WATCH_INFO_COLOR_BLUE
Blue.
Definition: pebble_worker.h:79
int compass_service_set_heading_filter(CompassHeading filter)
@ APP_WORKER_RESULT_NOT_RUNNING
The worker is not running.
Definition: pebble_worker.h:1771
struct Tuplet::@0::@2 bytes
Valid when .type. is TUPLE_BYTE_ARRAY.
int tm_yday
Definition: pebble.h:8319
@ WATCH_INFO_COLOR_PEBBLE_2_HR_LIME
Pebble 2 HR, Charcoal / Sorbet Green.
Definition: pebble_worker.h:98
DictionaryResult
Return values for dictionary write/conversion functions.
Definition: pebble_worker.h:1401
int strftime(char *s, size_t maxsize, const char *format, const struct tm *tm_p)
WeekDay
Weekday values.
Definition: pebble_worker.h:181
void memory_cache_flush(void *start, size_t size)
AppWorkerResult app_worker_kill(void)
void(* AppTimerCallback)(void *data)
Definition: pebble_worker.h:1834
@ HealthAggregationAvg
Definition: pebble_worker.h:737
@ WATCH_INFO_COLOR_PEBBLE_TIME_2_GOLD
Pebble Time 2, Gold.
Definition: pebble_worker.h:108
DictionaryResult dict_write_begin(DictionaryIterator *iter, uint8_t *const buffer, const uint16_t size)
@ DATA_LOGGING_NOT_FOUND
The logging session does not exist.
Definition: pebble_worker.h:1155
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)
struct __attribute__((__packed__))
Definition: pebble_worker.h:1214
@ E_OUT_OF_STORAGE
Insufficient long-term storage available.
Definition: pebble_worker.h:1929
@ THURSDAY
Thursday.
Definition: pebble_worker.h:187
@ HOUR_UNIT
Flag to represent the "hours" time unit.
Definition: pebble_worker.h:595
uint32_t key
The key.
Definition: pebble.h:1832
HealthAggregation
Definition: pebble_worker.h:730
void app_worker_send_message(uint8_t type, AppWorkerMessage *data)
int32_t HealthValue
Type used to represent HealthMetric values.
Definition: pebble_worker.h:655
@ WATCH_INFO_COLOR_TIME_ROUND_BLACK_20
Time Round 20mm lug size, Black.
Definition: pebble_worker.h:94
@ WATCH_INFO_COLOR_TIME_STEEL_BLACK
Time Steel Black.
Definition: pebble_worker.h:88
CompassStatus
Enum describing the current state of the Compass Service.
Definition: pebble_worker.h:512
@ MINUTE_UNIT
Flag to represent the "minutes" time unit.
Definition: pebble_worker.h:593
@ DATA_LOGGING_BYTE_ARRAY
Definition: pebble_worker.h:1143
TupleType type
Definition: pebble.h:1830
void tick_timer_service_unsubscribe(void)
@ APP_LOG_LEVEL_DEBUG
Debug level log message.
Definition: pebble_worker.h:1301
void accel_data_service_unsubscribe(void)
struct HealthMetricAlert HealthMetricAlert
Definition: pebble.h:885
@ WATCH_INFO_MODEL_PEBBLE_TIME
Pebble Time.
Definition: pebble_worker.h:56
Tuple * dict_read_next(DictionaryIterator *iter)
time_t clock_to_timestamp(WeekDay day, int hour, int minute)
@ DICT_MALLOC_FAILED
Definition: pebble_worker.h:1412
@ TUPLE_BYTE_ARRAY
The value is an array of bytes.
Definition: pebble_worker.h:1418
@ APP_LOG_LEVEL_WARNING
Warning level log message.
Definition: pebble_worker.h:1297
@ DAY_UNIT
Flag to represent the "days" time unit.
Definition: pebble_worker.h:597
@ WATCH_INFO_MODEL_PEBBLE_ORIGINAL
Original Pebble.
Definition: pebble_worker.h:54
int persist_read_string(const uint32_t key, char *buffer, const size_t buffer_size)
@ HealthActivityWalk
The 'walk' activity.
Definition: pebble_worker.h:803
@ DATA_LOGGING_INVALID_PARAMS
An invalid parameter was passed to one of the functions.
Definition: pebble_worker.h:1157