Pebble Foundation Classes  0.2.0
C++ for Pebble
TickTimerService

Handling time components. More...

Collaboration diagram for TickTimerService:

Classes

class  Pebble::TickTimer
 

Typedefs

typedef void(* TickHandler) (struct tm *tick_time, TimeUnits units_changed)
 
typedef void(* TickHandler) (struct tm *tick_time, TimeUnits units_changed)
 

Enumerations

enum  TimeUnits {
  SECOND_UNIT = 1 << 0, MINUTE_UNIT = 1 << 1, HOUR_UNIT = 1 << 2, DAY_UNIT = 1 << 3,
  MONTH_UNIT = 1 << 4, YEAR_UNIT = 1 << 5, SECOND_UNIT = 1 << 0, MINUTE_UNIT = 1 << 1,
  HOUR_UNIT = 1 << 2, DAY_UNIT = 1 << 3, MONTH_UNIT = 1 << 4, YEAR_UNIT = 1 << 5
}
 
enum  TimeUnits {
  SECOND_UNIT = 1 << 0, MINUTE_UNIT = 1 << 1, HOUR_UNIT = 1 << 2, DAY_UNIT = 1 << 3,
  MONTH_UNIT = 1 << 4, YEAR_UNIT = 1 << 5, SECOND_UNIT = 1 << 0, MINUTE_UNIT = 1 << 1,
  HOUR_UNIT = 1 << 2, DAY_UNIT = 1 << 3, MONTH_UNIT = 1 << 4, YEAR_UNIT = 1 << 5
}
 

Functions

void tick_timer_service_subscribe (TimeUnits tick_units, TickHandler handler)
 
void tick_timer_service_unsubscribe (void)
 

Detailed Description

Handling time components.

The TickTimerService allows your app to be called every time one Time component has changed. This is extremely important for watchfaces. Your app can choose on which time component change a tick should occur. Time components are defined by a TimeUnits enum bitmask.

Typedef Documentation

◆ TickHandler [1/2]

typedef void(* TickHandler) (struct tm *tick_time, TimeUnits units_changed)

Callback type for tick timer events

Parameters
tick_timethe time at which the tick event was triggered
units_changedwhich unit change triggered this tick event

◆ TickHandler [2/2]

typedef void(* TickHandler) (struct tm *tick_time, TimeUnits units_changed)

Callback type for tick timer events

Parameters
tick_timethe time at which the tick event was triggered
units_changedwhich unit change triggered this tick event

Enumeration Type Documentation

◆ TimeUnits [1/2]

enum TimeUnits

Time unit flags that can be used to create a bitmask for use in tick_timer_service_subscribe(). This will also be passed to TickHandler.

Enumerator
SECOND_UNIT 

Flag to represent the "seconds" time unit.

MINUTE_UNIT 

Flag to represent the "minutes" time unit.

HOUR_UNIT 

Flag to represent the "hours" time unit.

DAY_UNIT 

Flag to represent the "days" time unit.

MONTH_UNIT 

Flag to represent the "months" time unit.

YEAR_UNIT 

Flag to represent the "years" time unit.

SECOND_UNIT 

Flag to represent the "seconds" time unit.

MINUTE_UNIT 

Flag to represent the "minutes" time unit.

HOUR_UNIT 

Flag to represent the "hours" time unit.

DAY_UNIT 

Flag to represent the "days" time unit.

MONTH_UNIT 

Flag to represent the "months" time unit.

YEAR_UNIT 

Flag to represent the "years" time unit.

◆ TimeUnits [2/2]

enum TimeUnits

Time unit flags that can be used to create a bitmask for use in tick_timer_service_subscribe(). This will also be passed to TickHandler.

Enumerator
SECOND_UNIT 

Flag to represent the "seconds" time unit.

MINUTE_UNIT 

Flag to represent the "minutes" time unit.

HOUR_UNIT 

Flag to represent the "hours" time unit.

DAY_UNIT 

Flag to represent the "days" time unit.

MONTH_UNIT 

Flag to represent the "months" time unit.

YEAR_UNIT 

Flag to represent the "years" time unit.

SECOND_UNIT 

Flag to represent the "seconds" time unit.

MINUTE_UNIT 

Flag to represent the "minutes" time unit.

HOUR_UNIT 

Flag to represent the "hours" time unit.

DAY_UNIT 

Flag to represent the "days" time unit.

MONTH_UNIT 

Flag to represent the "months" time unit.

YEAR_UNIT 

Flag to represent the "years" time unit.

Function Documentation

◆ tick_timer_service_subscribe()

void tick_timer_service_subscribe ( TimeUnits  tick_units,
TickHandler  handler 
)

Subscribe to the tick timer event service. Once subscribed, the handler gets called on every requested unit change. Calling this function multiple times will override the units and handler (i.e., only  the last tick_units and handler passed will be used).

Parameters
handlerThe callback to be executed on tick events
tick_unitsa bitmask of all the units that have changed

◆ tick_timer_service_unsubscribe()

void tick_timer_service_unsubscribe ( void  )

Unsubscribe from the tick timer event service. Once unsubscribed, the previously registered handler will no longer be called.