Pebble Foundation Classes  0.2.0
C++ for Pebble
App Glance

API for the application to modify its glance. More...

Collaboration diagram for App Glance:

Classes

struct  AppGlanceSlice
 

Macros

#define APP_GLANCE_SLICE_NO_EXPIRATION   ((time_t)0)
 Can be used for the expiration_time of an AppGlanceSlice so that the slice never expires.
 
#define APP_GLANCE_SLICE_DEFAULT_ICON   ((PublishedId)0)
 

Typedefs

typedef uint32_t PublishedId
 The ID of a published app resource defined within the publishedMedia section of package.json.
 
typedef struct AppGlanceSlice AppGlanceSlice
 
typedef enum AppGlanceResult AppGlanceResult
 Bitfield enum describing the result of trying to add an AppGlanceSlice to an app's glance.
 
typedef struct AppGlanceReloadSession AppGlanceReloadSession
 
typedef void(* AppGlanceReloadCallback) (AppGlanceReloadSession *session, size_t limit, void *context)
 

Enumerations

enum  AppGlanceResult {
  APP_GLANCE_RESULT_SUCCESS = 0, APP_GLANCE_RESULT_INVALID_TEMPLATE_STRING = 1 << 0, APP_GLANCE_RESULT_TEMPLATE_STRING_TOO_LONG = 1 << 1, APP_GLANCE_RESULT_INVALID_ICON = 1 << 2,
  APP_GLANCE_RESULT_SLICE_CAPACITY_EXCEEDED = 1 << 3, APP_GLANCE_RESULT_EXPIRES_IN_THE_PAST = 1 << 4, APP_GLANCE_RESULT_INVALID_SESSION = 1 << 5
}
 Bitfield enum describing the result of trying to add an AppGlanceSlice to an app's glance. More...
 

Functions

AppGlanceResult app_glance_add_slice (AppGlanceReloadSession *session, AppGlanceSlice slice)
 
void app_glance_reload (AppGlanceReloadCallback callback, void *context)
 

Detailed Description

API for the application to modify its glance.

Macro Definition Documentation

◆ APP_GLANCE_SLICE_DEFAULT_ICON

#define APP_GLANCE_SLICE_DEFAULT_ICON   ((PublishedId)0)

Can be used for the icon of an AppGlanceSlice so that the slice displays the app's default icon.

Typedef Documentation

◆ AppGlanceReloadCallback

typedef void(* AppGlanceReloadCallback) (AppGlanceReloadSession *session, size_t limit, void *context)

User-provided callback for reloading the slices in the app's glance.

Parameters
sessionA session variable that must be passed to app_glance_add_slice when adding slices to the app's glance; it becomes invalid when the AppGlanceReloadCallback returns
limitThe number of entries that can be added to the app's glance
contextUser-provided context provided when calling app_glance_reload()

◆ AppGlanceSlice

An app's glance can change over time as defined by zero or more app glance slices that each describe the state of the app glance at a particular point in time. Slices are displayed in the order they are added, and they are removed at the specified expiration time.

Enumeration Type Documentation

◆ AppGlanceResult

Bitfield enum describing the result of trying to add an AppGlanceSlice to an app's glance.

Enumerator
APP_GLANCE_RESULT_SUCCESS 

The slice was successfully added to the app's glance.

APP_GLANCE_RESULT_INVALID_TEMPLATE_STRING 

The subtitle_template_string provided in the slice was invalid.

APP_GLANCE_RESULT_TEMPLATE_STRING_TOO_LONG 

The subtitle_template_string provided in the slice was longer than 150 bytes.

APP_GLANCE_RESULT_INVALID_ICON 

The icon provided in the slice was invalid.

APP_GLANCE_RESULT_SLICE_CAPACITY_EXCEEDED 

The provided slice would exceed the app glance's slice capacity.

APP_GLANCE_RESULT_EXPIRES_IN_THE_PAST 

The expiration_time provided in the slice expires in the past.

APP_GLANCE_RESULT_INVALID_SESSION 

The AppGlanceReloadSession provided was invalid.

Function Documentation

◆ app_glance_add_slice()

AppGlanceResult app_glance_add_slice ( AppGlanceReloadSession *  session,
AppGlanceSlice  slice 
)

Add a slice to the app's glance. This function will only succeed if called with a valid AppGlanceReloadSession that is provided in an AppGlanceReloadCallback.

Parameters
sessionThe session variable provided in an AppGlanceReloadCallback
sliceThe slice to add to the app's glance
Returns
The result of trying to add the slice to the app's glance

◆ app_glance_reload()

void app_glance_reload ( AppGlanceReloadCallback  callback,
void *  context 
)

Clear any existing slices in the app's glance and trigger a reload via the provided callback.

Parameters
callbackA function that will be called to add new slices to the app's glance; even if the provided callback is NULL, any existing slices will still be cleared from the app's glance
contextUser-provided context that will be passed to the callback