PebbleOS
Loading...
Searching...
No Matches
Modules | Data Structures | Typedefs | Enumerations | Functions
Put bytes

Transfer of firmware, resources, apps and files from the phone to the watch. More...

Modules

 Put bytes storage
 Backends storing received objects.
 

Data Structures

struct  PbInstallStatus
 Progress of a partially written object. More...
 

Typedefs

typedef struct PebbleCommSessionEvent PebbleCommSessionEvent
 Communication session event, see PebbleCommSessionEvent.
 

Enumerations

enum  PutBytesObjectType {
  ObjectUnknown = 0x00 , ObjectFirmware = 0x01 , ObjectRecovery = 0x02 , ObjectSysResources = 0x03 ,
  ObjectAppResources = 0x04 , ObjectWatchApp = 0x05 , ObjectFile = 0x06 , ObjectWatchWorker = 0x07 ,
  NumObjects
}
 Object types. More...
 

Functions

void put_bytes_init (void)
 Initialize put bytes.
 
void put_bytes_cancel (void)
 Cancel an ongoing app, app resources or worker transfer.
 
void put_bytes_deinit (void)
 Reset all put bytes state, for unit tests only.
 
void put_bytes_expect_init (uint32_t timeout_ms)
 Expect an Init request within a timeout.
 
void put_bytes_handle_comm_session_event (const PebbleCommSessionEvent *app_event)
 Handle a communication session event.
 

Detailed Description

Transfer of firmware, resources, apps and files from the phone to the watch.

A Pebble Protocol endpoint driven by the phone. Every request is answered with an ack or nack carrying the transfer token; multi-byte fields are big-endian. One transfer runs at a time and is cleaned up after 30 s without requests, or when the system session disconnects.

phone watch
Init(type, total_size, bank index / cookie / filename)
----> storage set up (flash erased for raw objects)
<---- Ack(token)
Put(token, length, data) ----> data appended to storage
<---- Ack(token)
... repeated until total_size bytes are sent ...
Commit(token, legacy CRC-32 of the data) ----> CRC checked, object marked installable
<---- Ack(token)
Install(token) ----> boot bits set (firmware + system resources,
recovery), transfer finished
<---- Ack(token)

Abort(token) cancels a transfer. Firmware, recovery and system resources are only accepted during a firmware update, are written raw to flash and can resume an interrupted transfer from an append offset in the Init request (see pb_storage_get_status()). Other objects are written to PFS files.


Data Structure Documentation

◆ PbInstallStatus

struct PbInstallStatus

Progress of a partially written object.

Data Fields
uint32_t crc_of_bytes Legacy CRC-32 of the bytes written.
uint32_t num_bytes_written Number of bytes written.

Typedef Documentation

◆ PebbleCommSessionEvent

Communication session event, see PebbleCommSessionEvent.

Enumeration Type Documentation

◆ PutBytesObjectType

Object types.

Enumerator
ObjectUnknown 

Unknown.

ObjectFirmware 

Firmware image.

ObjectRecovery 

Recovery firmware image.

ObjectSysResources 

System resources.

ObjectAppResources 

App resources.

ObjectWatchApp 

App binary.

ObjectFile 

PFS file.

ObjectWatchWorker 

Worker binary.

NumObjects 

Number of object types.

Function Documentation

◆ put_bytes_cancel()

void put_bytes_cancel ( void  )

Cancel an ongoing app, app resources or worker transfer.

Does nothing when idle or for other object types. The phone's next requests are nacked. Must be called from KernelBG.

◆ put_bytes_deinit()

void put_bytes_deinit ( void  )

Reset all put bytes state, for unit tests only.

◆ put_bytes_expect_init()

void put_bytes_expect_init ( uint32_t  timeout_ms)

Expect an Init request within a timeout.

If none arrives in time, a put bytes init timeout event is raised. Does nothing if a transfer is in progress.

Parameters
timeout_msTimeout in milliseconds.

◆ put_bytes_handle_comm_session_event()

void put_bytes_handle_comm_session_event ( const PebbleCommSessionEvent *  app_event)

Handle a communication session event.

Cancels the ongoing transfer when the system session closes.

Parameters
app_eventSession event.

◆ put_bytes_init()

void put_bytes_init ( void  )

Initialize put bytes.