PebbleOS
Loading...
Searching...
No Matches
Functions

Backend writing objects to PFS files. More...

Functions

bool pb_storage_file_init (PutBytesStorage *storage, PutBytesObjectType object_type, uint32_t total_size, PutBytesStorageInfo *info, uint32_t append_offset)
 Initialize storage, see pb_storage_init().
 
uint32_t pb_storage_file_get_max_size (PutBytesObjectType object_type)
 Get the largest object size supported.
 
void pb_storage_file_write (PutBytesStorage *storage, uint32_t offset, const uint8_t *buffer, uint32_t length)
 Write data, see pb_storage_write().
 
uint32_t pb_storage_file_calculate_crc (PutBytesStorage *storage, PutBytesCrcType crc_type)
 Compute the CRC of the data written, see pb_storage_calculate_crc().
 
void pb_storage_file_deinit (PutBytesStorage *storage, bool is_success)
 Release storage, see pb_storage_deinit().
 

Detailed Description

Backend writing objects to PFS files.

Function Documentation

◆ pb_storage_file_calculate_crc()

uint32_t pb_storage_file_calculate_crc ( PutBytesStorage *  storage,
PutBytesCrcType  crc_type 
)

Compute the CRC of the data written, see pb_storage_calculate_crc().

Only PutBytesCrcType_Legacy is supported.

Parameters
storageStorage.
crc_typeCRC algorithm.
Returns
CRC.

◆ pb_storage_file_deinit()

void pb_storage_file_deinit ( PutBytesStorage *  storage,
bool  is_success 
)

Release storage, see pb_storage_deinit().

Closes the file, deleting it on failure.

Parameters
storageStorage.
is_successWhether the transfer succeeded.

◆ pb_storage_file_get_max_size()

uint32_t pb_storage_file_get_max_size ( PutBytesObjectType  object_type)

Get the largest object size supported.

Free PFS space.

Parameters
object_typeObject type.
Returns
Maximum size in bytes.

◆ pb_storage_file_init()

bool pb_storage_file_init ( PutBytesStorage *  storage,
PutBytesObjectType  object_type,
uint32_t  total_size,
PutBytesStorageInfo *  info,
uint32_t  append_offset 
)

Initialize storage, see pb_storage_init().

Replaces any existing file with the name in info. A zero-sized object creates no file.

Parameters
[out]storageStorage.
object_typeObject type.
total_sizeObject size in bytes.
infoObject information.
append_offsetOffset to resume at, 0 to start over.
Returns
true on success.

◆ pb_storage_file_write()

void pb_storage_file_write ( PutBytesStorage *  storage,
uint32_t  offset,
const uint8_t *  buffer,
uint32_t  length 
)

Write data, see pb_storage_write().

Only supports writing at PutBytesStorage::current_offset.

Parameters
storageStorage.
offsetOffset within the storage.
bufferData.
lengthLength of buffer in bytes.