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

Backends reading the transferred objects. More...

Modules

 Core dump storage
 Backend reading the most recent core dump from flash.
 
 File storage
 Backend reading a PFS file.
 
 Flash storage
 Backend reading a raw flash region.
 

Data Structures

struct  GetBytesStorage
 Storage of an object being transferred. More...
 
struct  GetBytesStorageInfo
 Request parameters passed to the backend setup. More...
 

Typedefs

typedef struct GetBytesStorageImplementation GetBytesStorageImplementation
 Backend operations, private to the get bytes service.
 

Enumerations

enum  GetBytesStorageType { GetBytesStorageTypeUnknown , GetBytesStorageTypeCoredump , GetBytesStorageTypeFile , GetBytesStorageTypeFlash }
 Storage backend type. More...
 

Functions

bool gb_storage_setup (GetBytesStorage *storage, GetBytesObjectType object_type, GetBytesStorageInfo *info)
 Set up the storage of an object, e.g.
 
GetBytesInfoErrorCode gb_storage_get_size (GetBytesStorage *storage, uint32_t *size)
 Get the size of the object.
 
bool gb_storage_read_next_chunk (GetBytesStorage *storage, uint8_t *buffer, uint32_t len)
 Read the next chunk of the object.
 
void gb_storage_cleanup (GetBytesStorage *storage, bool successful)
 Release the storage.
 

Detailed Description

Backends reading the transferred objects.

Each GetBytesObjectType maps to a backend implementing setup, size, read and cleanup. File and flash backends are not built in release or recovery firmware.


Data Structure Documentation

◆ GetBytesStorage

struct GetBytesStorage

Storage of an object being transferred.

Data Fields
uint32_t current_offset Offset of the next byte to read, advanced by gb_storage_read_next_chunk().
const GetBytesStorageImplementation * impl Backend operations.
void * impl_data Backend private data.

◆ GetBytesStorageInfo

struct GetBytesStorageInfo

Request parameters passed to the backend setup.

Data Fields
char * filename File name, for GetBytesStorageTypeFile.
uint32_t flash_len Length in bytes, for GetBytesStorageTypeFlash.
uint32_t flash_start_addr Start address, for GetBytesStorageTypeFlash.
bool only_get_new_coredump Only return a core dump not read yet, for GetBytesStorageTypeCoredump.

Typedef Documentation

◆ GetBytesStorageImplementation

Backend operations, private to the get bytes service.

Enumeration Type Documentation

◆ GetBytesStorageType

Storage backend type.

Enumerator
GetBytesStorageTypeUnknown 

Unknown.

GetBytesStorageTypeCoredump 

Core dump flash region.

GetBytesStorageTypeFile 

PFS file.

GetBytesStorageTypeFlash 

Raw flash.

Function Documentation

◆ gb_storage_cleanup()

void gb_storage_cleanup ( GetBytesStorage *  storage,
bool  successful 
)

Release the storage.

Parameters
storageStorage.
successfulThe whole object was sent. A sent core dump is marked as read.

◆ gb_storage_get_size()

GetBytesInfoErrorCode gb_storage_get_size ( GetBytesStorage *  storage,
uint32_t *  size 
)

Get the size of the object.

Parameters
storageStorage.
[out]sizeObject size in bytes.
Returns
GET_BYTES_OK, or the error to report to the phone.

◆ gb_storage_read_next_chunk()

bool gb_storage_read_next_chunk ( GetBytesStorage *  storage,
uint8_t *  buffer,
uint32_t  len 
)

Read the next chunk of the object.

Parameters
storageStorage.
[out]bufferDestination.
lenNumber of bytes to read.
Returns
true on success.

◆ gb_storage_setup()

bool gb_storage_setup ( GetBytesStorage *  storage,
GetBytesObjectType  object_type,
GetBytesStorageInfo *  info 
)

Set up the storage of an object, e.g.

allocate memory or open a file.

Parameters
[out]storageStorage.
object_typeObject type, selecting the backend.
infoRequest parameters.
Returns
true on success.