PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches
Timeline resources

Resolves timeline resource ids to image resources. More...

Data Structures

struct  TimelineResourceInfo
 Timeline resource to resolve. More...
 
struct  AppResourceInfo
 Resolved image resource. More...
 
struct  AppResourceId
 Resource in a resource bank. More...
 
struct  TimelineLutEntry
 Row of an app's timeline resource lookup table. More...
 

Macros

#define SYSTEM_RESOURCE_FLAG   0x80000000
 Flag marking a TimelineResourceId as a system resource.
 
#define TIMELINE_RESOURCE_PBW_SUPPORT_FIRST_SDK_VERSION_MAJOR   (0x5)
 Major version of the first SDK supporting timeline icons in PBWs.
 
#define TIMELINE_RESOURCE_PBW_SUPPORT_FIRST_SDK_VERSION_MINOR   (0x3d)
 Minor version of the first SDK supporting timeline icons in PBWs.
 
#define TLUT_SIGNATURE   PBL_FOURCC('T', 'L', 'U', 'T')
 Signature at the start of an app's timeline resource lookup table.
 
#define TLUT_DATA_OFFSET   sizeof(TLUT_SIGNATURE)
 Offset of the first TimelineLutEntry in the lookup table.
 
#define TLUT_RESOURCE_ID   1
 Resource id of the lookup table in an app's resource pack.
 
#define TIMELINE_TINY_RESOURCE_SIZE   (GSize(25, 25))
 Size of tiny timeline icons.
 
#define TIMELINE_SMALL_RESOURCE_SIZE   (GSize(50, 50))
 Size of small timeline icons.
 
#define TIMELINE_LARGE_RESOURCE_SIZE   (GSize(80, 80))
 Size of large timeline icons.
 

Enumerations

enum  TimelineResourceSize { TimelineResourceSizeTiny , TimelineResourceSizeSmall , TimelineResourceSizeLarge , TimelineResourceSizeCount }
 Sizes of timeline icons. More...
 

Functions

static GSize timeline_resources_get_gsize (TimelineResourceSize size)
 Get the dimensions of an icon size.
 
bool timeline_resources_is_system (TimelineResourceId timeline_id)
 Check whether a timeline resource id is a system resource.
 
bool timeline_resources_get_id_system (TimelineResourceId timeline_id, TimelineResourceSize size, ResAppNum res_app_num, AppResourceInfo *res_info_out)
 Resolve a timeline resource id in a given app resource bank.
 
void timeline_resources_get_id (const TimelineResourceInfo *timeline_res, TimelineResourceSize size, AppResourceInfo *res_info_out)
 Resolve a timeline resource, falling back to its fallback system resource.
 
void sys_timeline_resources_get_id (const TimelineResourceInfo *timeline_res, TimelineResourceSize size, AppResourceInfo *res_info_out)
 Syscall version of timeline_resources_get_id().
 

Detailed Description

Resolves timeline resource ids to image resources.

Timeline icons are referred to by a TimelineResourceId with a size. Ids with SYSTEM_RESOURCE_FLAG set are system icons, looked up in a table generated with the system resources. Other ids are published by an app: its resource pack holds a lookup table (resource TLUT_RESOURCE_ID, starting with the TLUT_SIGNATURE) of TimelineLutEntry rows indexed by the id.


Data Structure Documentation

◆ TimelineResourceInfo

struct TimelineResourceInfo

Timeline resource to resolve.

Data Fields
const Uuid * app_id App that published res_id.
TimelineResourceId fallback_id System resource used if res_id cannot be resolved.
TimelineResourceId res_id Timeline resource id.

◆ AppResourceInfo

struct AppResourceInfo

Resolved image resource.

Data Fields
ResAppNum res_app_num Resource bank: the system or an app.
uint32_t res_id Resource id within the bank.

◆ AppResourceId

struct AppResourceId

Resource in a resource bank.

Data Fields
ResAppNum res_app_num Resource bank.
uint32_t resource_id Resource id within the bank.

◆ TimelineLutEntry

struct TimelineLutEntry

Row of an app's timeline resource lookup table.

Data Fields
uint32_t large Resource id of the large icon.
uint32_t small Resource id of the small icon.
uint32_t tiny Resource id of the tiny icon.

Macro Definition Documentation

◆ SYSTEM_RESOURCE_FLAG

#define SYSTEM_RESOURCE_FLAG   0x80000000

Flag marking a TimelineResourceId as a system resource.

◆ TIMELINE_LARGE_RESOURCE_SIZE

#define TIMELINE_LARGE_RESOURCE_SIZE   (GSize(80, 80))

Size of large timeline icons.

◆ TIMELINE_RESOURCE_PBW_SUPPORT_FIRST_SDK_VERSION_MAJOR

#define TIMELINE_RESOURCE_PBW_SUPPORT_FIRST_SDK_VERSION_MAJOR   (0x5)

Major version of the first SDK supporting timeline icons in PBWs.

◆ TIMELINE_RESOURCE_PBW_SUPPORT_FIRST_SDK_VERSION_MINOR

#define TIMELINE_RESOURCE_PBW_SUPPORT_FIRST_SDK_VERSION_MINOR   (0x3d)

Minor version of the first SDK supporting timeline icons in PBWs.

◆ TIMELINE_SMALL_RESOURCE_SIZE

#define TIMELINE_SMALL_RESOURCE_SIZE   (GSize(50, 50))

Size of small timeline icons.

◆ TIMELINE_TINY_RESOURCE_SIZE

#define TIMELINE_TINY_RESOURCE_SIZE   (GSize(25, 25))

Size of tiny timeline icons.

◆ TLUT_DATA_OFFSET

#define TLUT_DATA_OFFSET   sizeof(TLUT_SIGNATURE)

Offset of the first TimelineLutEntry in the lookup table.

◆ TLUT_RESOURCE_ID

#define TLUT_RESOURCE_ID   1

Resource id of the lookup table in an app's resource pack.

◆ TLUT_SIGNATURE

#define TLUT_SIGNATURE   PBL_FOURCC('T', 'L', 'U', 'T')

Signature at the start of an app's timeline resource lookup table.

Enumeration Type Documentation

◆ TimelineResourceSize

Sizes of timeline icons.

Enumerator
TimelineResourceSizeTiny 

25x25 pixels.

TimelineResourceSizeSmall 

50x50 pixels.

TimelineResourceSizeLarge 

80x80 pixels.

TimelineResourceSizeCount 

Number of sizes.

Function Documentation

◆ sys_timeline_resources_get_id()

void sys_timeline_resources_get_id ( const TimelineResourceInfo *  timeline_res,
TimelineResourceSize  size,
AppResourceInfo *  res_info_out 
)

Syscall version of timeline_resources_get_id().

Validates the buffers of unprivileged callers.

Parameters
timeline_resTimeline resource and the app that published it.
sizeIcon size.
[out]res_info_outResolved resource; zeroed on invalid arguments.

◆ timeline_resources_get_gsize()

static GSize timeline_resources_get_gsize ( TimelineResourceSize  size)
inlinestatic

Get the dimensions of an icon size.

Parameters
sizeIcon size.
Returns
Dimensions, GSizeZero for an invalid size.

References TIMELINE_LARGE_RESOURCE_SIZE, TIMELINE_SMALL_RESOURCE_SIZE, TIMELINE_TINY_RESOURCE_SIZE, TimelineResourceSizeLarge, TimelineResourceSizeSmall, and TimelineResourceSizeTiny.

◆ timeline_resources_get_id()

void timeline_resources_get_id ( const TimelineResourceInfo *  timeline_res,
TimelineResourceSize  size,
AppResourceInfo *  res_info_out 
)

Resolve a timeline resource, falling back to its fallback system resource.

Parameters
timeline_resTimeline resource and the app that published it.
sizeIcon size.
[out]res_info_outResolved resource; both fields 0 if neither the resource nor the fallback could be resolved.

◆ timeline_resources_get_id_system()

bool timeline_resources_get_id_system ( TimelineResourceId  timeline_id,
TimelineResourceSize  size,
ResAppNum  res_app_num,
AppResourceInfo *  res_info_out 
)

Resolve a timeline resource id in a given app resource bank.

Does not check that the app was built with an SDK supporting published timeline resources; use timeline_resources_get_id() unless that is already known. App icons must be bitmaps or PDC images of at most 700 bytes.

Parameters
timeline_idTimeline resource id.
sizeIcon size.
res_app_numApp resource bank, used if timeline_id is not a system resource.
[out]res_info_outResolved resource, set only on success; may be NULL.
Returns
true if timeline_id is valid for size and res_app_num.

◆ timeline_resources_is_system()

bool timeline_resources_is_system ( TimelineResourceId  timeline_id)

Check whether a timeline resource id is a system resource.

Parameters
timeline_idTimeline resource id.
Returns
true if SYSTEM_RESOURCE_FLAG is set.