PebbleOS
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions
App fetch endpoint

Fetches app binaries from the phone. More...

Data Structures

struct  AppFetchError
 Result of the last app fetch. More...
 

Enumerations

enum  AppFetchResult {
  AppFetchResultSuccess , AppFetchResultTimeoutError , AppFetchResultGeneralFailure , AppFetchResultPhoneBusy ,
  AppFetchResultUUIDInvalid , AppFetchResultNoBluetooth , AppFetchResultPutBytesFailure , AppFetchResultNoData ,
  AppFetchResultUserCancelled , AppFetchResultIncompatibleJSFailure
}
 Outcome of an app fetch. More...
 

Functions

void app_fetch_binaries (const Uuid *uuid, AppInstallId app_id, bool has_worker)
 Request the binaries of an app from the phone.
 
void app_fetch_cancel (AppInstallId app_id)
 Cancel a fetch in progress.
 
void app_fetch_cancel_from_system_task (AppInstallId app_id)
 Cancel a fetch in progress, synchronously.
 
bool app_fetch_in_progress (void)
 Check whether a fetch is in progress.
 
void app_fetch_put_bytes_event_handler (PebblePutBytesEvent *pb_event)
 Handle a put_bytes event.
 
AppFetchError app_fetch_get_previous_error (void)
 Get the result of the last fetch.
 

Detailed Description

Fetches app binaries from the phone.

The watch sends an install request for an app to the phone, which then pushes the app, worker and resources over put_bytes. Progress, completion and errors are reported with PEBBLE_APP_FETCH_EVENT events; once all parts are received the app is added to the app cache. Only one fetch can be in progress at a time. The work runs on KernelBackground.


Data Structure Documentation

◆ AppFetchError

struct AppFetchError

Result of the last app fetch.

Data Fields
AppFetchResult error Outcome of the fetch.
AppInstallId id App that was fetched.

Enumeration Type Documentation

◆ AppFetchResult

Outcome of an app fetch.

Enumerator
AppFetchResultSuccess 

All parts were received and the app was added to the app cache.

AppFetchResultTimeoutError 

The phone did not start or continue the put_bytes transfer in time.

AppFetchResultGeneralFailure 

Unexpected message, unexpected put_bytes object or failure to update the app cache.

AppFetchResultPhoneBusy 

The phone is busy.

AppFetchResultUUIDInvalid 

The phone does not know the requested UUID.

AppFetchResultNoBluetooth 

The request could not be sent to the phone.

AppFetchResultPutBytesFailure 

The put_bytes transfer failed.

AppFetchResultNoData 

The phone has no data for the app, e.g.

no internet connection.

AppFetchResultUserCancelled 

The fetch was cancelled.

AppFetchResultIncompatibleJSFailure 

The app's JavaScript is incompatible.

Function Documentation

◆ app_fetch_binaries()

void app_fetch_binaries ( const Uuid *  uuid,
AppInstallId  app_id,
bool  has_worker 
)

Request the binaries of an app from the phone.

Ignored if a fetch is already in progress.

Parameters
uuidUUID of the app.
app_idInstall id of the app.
has_workertrue if the app has a worker binary to fetch.

◆ app_fetch_cancel()

void app_fetch_cancel ( AppInstallId  app_id)

Cancel a fetch in progress.

The cancellation runs asynchronously on KernelBackground.

Parameters
app_idApp whose fetch is cancelled; INSTALL_ID_INVALID cancels any fetch.

◆ app_fetch_cancel_from_system_task()

void app_fetch_cancel_from_system_task ( AppInstallId  app_id)

Cancel a fetch in progress, synchronously.

Must be called from KernelBackground.

Parameters
app_idApp whose fetch is cancelled; INSTALL_ID_INVALID cancels any fetch.

◆ app_fetch_get_previous_error()

AppFetchError app_fetch_get_previous_error ( void  )

Get the result of the last fetch.

Returns
Result and app of the last fetch.

◆ app_fetch_in_progress()

bool app_fetch_in_progress ( void  )

Check whether a fetch is in progress.

Returns
true if a fetch is in progress.

◆ app_fetch_put_bytes_event_handler()

void app_fetch_put_bytes_event_handler ( PebblePutBytesEvent *  pb_event)

Handle a put_bytes event.

Tracks the progress and completion of the fetched parts. Called from KernelMain; ignored if no fetch is in progress.

Parameters
pb_eventPut bytes event, copied before processing.