BLOB Storage#

Provides an API for storing binary large objects (BLOB) via the bootloader. The number and size of the bootloader slots determines the number and maximum size of BLOBs that can be stored on the device. Please check the bootloader configuration. This component is prepared for integration into SOC applications. This is a No-Code component, if it is used with either BLOB transfer Client or Server components.

Modules#

sl_btmesh_blob_storage_slot_metadata_cache_t

Enumerations#

enum
SL_BTMESH_BLOB_STORAGE_STATUS_EMPTY
SL_BTMESH_BLOB_STORAGE_STATUS_CORRUPTED
SL_BTMESH_BLOB_STORAGE_STATUS_INVALIDATED
SL_BTMESH_BLOB_STORAGE_STATUS_OCCUPIED
SL_BTMESH_BLOB_STORAGE_STATUS_INTERNAL_ERROR
}
enum
SL_BTMESH_BLOB_STORAGE_DELETE_INACTIVE
SL_BTMESH_BLOB_STORAGE_DELETE_BUSY
SL_BTMESH_BLOB_STORAGE_DELETE_FAILED
SL_BTMESH_BLOB_STORAGE_DELETE_SUCCESS
}

Functions#

sl_status_t
sl_btmesh_blob_storage_read(sl_bt_uuid_64_t const *blob_id, uint32_t offset, uint32_t *len, void *buffer)
sl_status_t
sl_btmesh_blob_storage_write_start(sl_bt_uuid_64_t const *blob_id, uint32_t size)
sl_status_t
sl_btmesh_blob_storage_write(uint32_t offset, uint32_t len, void *data)
void
sl_btmesh_blob_storage_get_cache(sl_btmesh_blob_storage_slot_metadata_cache_t const **cache, uint32_t *len)
sl_status_t
sl_btmesh_blob_storage_invalidate(sl_bt_uuid_64_t const *blob_id)
sl_status_t
sl_status_t
sl_btmesh_blob_storage_delete(sl_bt_uuid_64_t const *blob_id)
sl_status_t
sl_btmesh_blob_storage_delete_start(sl_bt_uuid_64_t const *blob_id)
sl_status_t
bool
sl_btmesh_blob_storage_is_present(sl_bt_uuid_64_t const *blob_id)
sl_status_t
sl_btmesh_blob_storage_get_blob_size(sl_bt_uuid_64_t const *blob_id, uint32_t *blob_size)
uint32_t
sl_btmesh_blob_storage_calc_app_footer_size(uint16_t footer_data_length)
sl_status_t
sl_btmesh_blob_storage_write_app_footer(sl_bt_uuid_64_t const *blob_id, void const *footer, uint16_t app_id, uint16_t length)
sl_status_t
sl_btmesh_blob_storage_get_app_footer_length(sl_bt_uuid_64_t const *blob_id, uint16_t app_id, uint16_t *length)
sl_status_t
sl_btmesh_blob_storage_get_app_footer(sl_bt_uuid_64_t const *blob_id, uint16_t app_id, void *buffer, uint16_t *length)
sl_status_t
sl_btmesh_blob_storage_set_managed(sl_bt_uuid_64_t const *blob_id, uint16_t owner_id)
bool
sl_btmesh_blob_storage_is_managed(sl_bt_uuid_64_t const *blob_id)
bool
sl_btmesh_blob_storage_is_managed_by_owner(sl_bt_uuid_64_t const *blob_id, uint16_t owner_id)
sl_status_t
sl_btmesh_blob_storage_get_blob_id_by_owner(uint16_t owner_id, uint32_t occurrence_idx, sl_bt_uuid_64_t *blob_id)
sl_status_t
sl_btmesh_blob_storage_get_blob_id_by_footer(uint16_t app_id, const void *expected_footer, uint16_t length, sl_bt_uuid_64_t *blob_id)
uint32_t
sl_btmesh_blob_storage_get_remaining_space(bool include_unmanaged_blobs)
uint32_t
sl_btmesh_blob_storage_get_max_blob_size_free(bool include_unmanaged_blobs)
sl_btmesh_blob_storage_delete_state_t
uint32_t
sl_btmesh_blob_storage_calculate_checksum(const uint8_t *data, uint16_t length, uint32_t initial_value)

Macros#

#define
BLOB_STORAGE_OWNER_ID_FW_DIST_SERVER 0x1000

Reserved BLOB Storage owner ID of FW Distribution Server.

#define
BLOB_STORAGE_APP_ID_DFU_FWID 0x1001

Reserved BLOB Storage app ID of Firmware ID (BT Mesh DFU)

#define
BLOB_STORAGE_APP_ID_DFU_METADATA 0x1002

Reserved BLOB Storage app ID of Metadata (BT Mesh DFU)

#define
BLOB_STORAGE_APP_ID_MANAGED_FLAG 0x8000

Reserved BLOB Storage app ID of managed flag.

Enumeration Documentation#

sl_btmesh_blob_storage_status_e#

sl_btmesh_blob_storage_status_e
Enumerator
SL_BTMESH_BLOB_STORAGE_STATUS_EMPTY

Slot is empty.

SL_BTMESH_BLOB_STORAGE_STATUS_CORRUPTED

Slot data is corrupted

  • Data present, but no footer

  • Footer present, but no data

  • Footer and data present, but one or more app footer metadata is corrupted or missing

SL_BTMESH_BLOB_STORAGE_STATUS_INVALIDATED

Slot has valid data but footer was invalidated by application.

SL_BTMESH_BLOB_STORAGE_STATUS_OCCUPIED

Slot has data and is valid.

SL_BTMESH_BLOB_STORAGE_STATUS_INTERNAL_ERROR

Internal API error.


sl_btmesh_blob_storage_delete_state_e#

sl_btmesh_blob_storage_delete_state_e
Enumerator
SL_BTMESH_BLOB_STORAGE_DELETE_INACTIVE

Asynchronous delete inactive.

SL_BTMESH_BLOB_STORAGE_DELETE_BUSY

Asynchronous delete active and busy.

SL_BTMESH_BLOB_STORAGE_DELETE_FAILED

Asynchronous delete has failed.

SL_BTMESH_BLOB_STORAGE_DELETE_SUCCESS

Asynchronous delete has succeeded.


Typedef Documentation#

sl_btmesh_blob_storage_status_t#

typedef enum sl_btmesh_blob_storage_status_e sl_btmesh_blob_storage_status_t

sl_btmesh_blob_storage_delete_state_t#

typedef enum sl_btmesh_blob_storage_delete_state_e sl_btmesh_blob_storage_delete_state_t

Function Documentation#

sl_btmesh_blob_storage_init#

void sl_btmesh_blob_storage_init (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Initializes the storage wrapper


sl_btmesh_blob_storage_deinit#

void sl_btmesh_blob_storage_deinit (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Deinitializes the storage wrapper


sl_btmesh_blob_storage_read#

sl_status_t sl_btmesh_blob_storage_read (sl_bt_uuid_64_t const * blob_id, uint32_t offset, uint32_t * len, void * buffer)
Parameters
TypeDirectionArgument NameDescription
sl_bt_uuid_64_t const *[in]blob_id

Identifier of the BLOB

uint32_t[in]offset

Offset relative to BLOB start, where read should start

uint32_t *[inout]len

Length of the buffer; modified if there's less data then buffer could fit

void *[out]buffer

Buffer in which data is read

Reads data from the identified BLOB into a buffer

Returns

  • Status code

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_NOT_FOUND: In case BLOB isn't found

  • SL_STATUS_FAIL: In case of internal API error


sl_btmesh_blob_storage_write_start#

sl_status_t sl_btmesh_blob_storage_write_start (sl_bt_uuid_64_t const * blob_id, uint32_t size)
Parameters
TypeDirectionArgument NameDescription
sl_bt_uuid_64_t const *[in]blob_id

Identifier of the BLOB about to be written into storage

uint32_t[in]size

Size of the BLOB about to be written into storage

Starts writing procedure

Sets internal state variables to correspond to writing a BLOB. Returns

  • Status code

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_ALREADY_EXISTS: In case BLOB ID already exists in storage

  • SL_STATUS_WOULD_OVERFLOW: In case BLOB is too big to fit

  • SL_STATUS_NO_MORE_RESOURCE: In case no slot is available

  • SL_STATUS_BUSY: In case BLOB Storage is processing an async. request


sl_btmesh_blob_storage_write#

sl_status_t sl_btmesh_blob_storage_write (uint32_t offset, uint32_t len, void * data)
Parameters
TypeDirectionArgument NameDescription
uint32_t[in]offset

Offset of the data inside the BLOB. Must be SL_BTMESH_BLOB_STORAGE_ALIGNMENT_CFG_VAL aligned.

uint32_t[in]len

Length of the data

void *[in]data

Pointer to the data

Writes data into storage.

Returns

  • Result of write operation

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_FLASH_WRITE_INHIBITED: In case of non-word aligned offset

  • SL_STATUS_FLASH_PROGRAM_FAILED: In case storage programming failed


sl_btmesh_blob_storage_get_cache#

void sl_btmesh_blob_storage_get_cache (sl_btmesh_blob_storage_slot_metadata_cache_t const ** cache, uint32_t * len)
Parameters
TypeDirectionArgument NameDescription
sl_btmesh_blob_storage_slot_metadata_cache_t const **[out]cache

Pointer to the buffer of a pointer for cache start

uint32_t *[out]len

Pointer to the length cache

Retrieves a pointer to the cache


sl_btmesh_blob_storage_any_blob_corrupted#

bool sl_btmesh_blob_storage_any_blob_corrupted (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns if any BLOB is corrupted

Returns

Return values

  • true: If at least one BLOB is corrupted

  • false: If no BLOB is corrupted


sl_btmesh_blob_storage_verify#

sl_status_t sl_btmesh_blob_storage_verify (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Verifies the BLOB to be considered consistent

Returns

  • Verification result

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_INVALID_STATE: In case less data has been written than indicated with

  • SL_STATUS_FAIL: In case of internal API error

  • SL_STATUS_FLASH_PROGRAM_FAILED: In case writing validity info into storage has failed


sl_btmesh_blob_storage_invalidate#

sl_status_t sl_btmesh_blob_storage_invalidate (sl_bt_uuid_64_t const * blob_id)
Parameters
TypeDirectionArgument NameDescription
sl_bt_uuid_64_t const *[in]blob_id

Identifier of the BLOB to invalidate

Invalidates BLOB footer

Returns

  • Result code

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_NOT_FOUND: In case BLOB identifier is not found

  • SL_STATUS_FAIL: In case of internal API error

  • SL_STATUS_FLASH_PROGRAM_FAILED: In case storage writing has failed

  • SL_STATUS_BUSY: In case BLOB Storage is processing an async. request


sl_btmesh_blob_storage_invalidate_by_owner#

sl_status_t sl_btmesh_blob_storage_invalidate_by_owner (uint16_t owner_id)
Parameters
TypeDirectionArgument NameDescription
uint16_t[in]owner_id

Identifier of owner

Invalidates all valid BLOB footer which belongs to a specific owner

See Also

Returns

  • Result code

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_FAIL: In case of internal API error

  • SL_STATUS_FLASH_PROGRAM_FAILED: In case storage writing has failed

  • SL_STATUS_BUSY: In case BLOB Storage is processing an async. request


sl_btmesh_blob_storage_invalidate_all#

sl_status_t sl_btmesh_blob_storage_invalidate_all (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Invalidates all valid BLOB footer

Returns

  • Result code

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_FAIL: In case of internal API error

  • SL_STATUS_FLASH_PROGRAM_FAILED: In case storage writing has failed

  • SL_STATUS_BUSY: In case BLOB Storage is processing an async. request


sl_btmesh_blob_storage_delete#

sl_status_t sl_btmesh_blob_storage_delete (sl_bt_uuid_64_t const * blob_id)
Parameters
TypeDirectionArgument NameDescription
sl_bt_uuid_64_t const *[in]blob_id

Identifier of the BLOB to be deleted

Deletes a BLOB from storage

Returns

  • Result of erase

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_NOT_FOUND: In case no BLOB has been identified in storage

  • SL_STATUS_FLASH_ERASE_FAILED: In case erase has failed


sl_btmesh_blob_storage_delete_start#

sl_status_t sl_btmesh_blob_storage_delete_start (sl_bt_uuid_64_t const * blob_id)
Parameters
TypeDirectionArgument NameDescription
sl_bt_uuid_64_t const *[in]blob_id

Identifier of the BLOB to be deleted

Start asynchronous delete of a BLOB

See Also

Returns

  • Request status

Return values

  • SL_BTMESH_OK: Request successful

  • SL_BTMESH_BUSY: Erase handler busy


sl_btmesh_blob_storage_delete_managed_by_owner#

sl_status_t sl_btmesh_blob_storage_delete_managed_by_owner (uint16_t owner_id)
Parameters
TypeDirectionArgument NameDescription
uint16_t[in]owner_id

Identifier of owner

Deletes all BLOB from storage which belongs to a specific owner

See Also

Returns

  • Result of erase

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_NOT_FOUND: No managed slot was found which belongs to the owner

  • SL_STATUS_FLASH_ERASE_FAILED: In case erase has failed


sl_btmesh_blob_storage_delete_managed_by_owner_start#

sl_status_t sl_btmesh_blob_storage_delete_managed_by_owner_start (uint16_t owner_id)
Parameters
TypeDirectionArgument NameDescription
uint16_t[in]owner_id

Identifier of owner

Start asynchronous delete of BLOBs that are unmanaged

See Also

Returns

  • Request status

Return values

  • SL_BTMESH_OK: Request successful

  • SL_BTMESH_BUSY: Erase handler busy


sl_btmesh_blob_storage_delete_all#

sl_status_t sl_btmesh_blob_storage_delete_all (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Deletes all BLOBs from storage

Returns

  • Result of erase

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_FLASH_ERASE_FAILED: In case erase has failed


sl_btmesh_blob_storage_delete_all_start#

sl_status_t sl_btmesh_blob_storage_delete_all_start (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Start asynchronous delete of all BLOBs

See Also

Returns

  • Request status

Return values

  • SL_BTMESH_OK: Request successful

  • SL_BTMESH_BUSY: Erase handler busy


sl_btmesh_blob_storage_delete_invalid_slots#

sl_status_t sl_btmesh_blob_storage_delete_invalid_slots (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Clear slots with invalid data

Returns

  • Result of erase

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_NOT_FOUND: No invalid slot was found

  • SL_STATUS_FLASH_ERASE_FAILED: In case erase has failed


sl_btmesh_blob_storage_delete_invalid_slots_start#

sl_status_t sl_btmesh_blob_storage_delete_invalid_slots_start (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Start asynchronous delete of invalid BLOBs

See Also

Returns

  • Request status

Return values

  • SL_BTMESH_OK: Request successful

  • SL_BTMESH_BUSY: Erase handler busy


sl_btmesh_blob_storage_delete_unmanaged_slots#

sl_status_t sl_btmesh_blob_storage_delete_unmanaged_slots (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Clear slots that are unmanaged

See Also

Returns

  • Result of erase

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_NOT_FOUND: No unmanaged slot was found

  • SL_STATUS_FLASH_ERASE_FAILED: In case erase has failed


sl_btmesh_blob_storage_delete_unmanaged_slots_start#

sl_status_t sl_btmesh_blob_storage_delete_unmanaged_slots_start (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Start asynchronous delete of BLOBs that are unmanaged

See Also

Returns

  • Request status

Return values

  • SL_BTMESH_OK: Request successful

  • SL_BTMESH_BUSY: Erase handler busy


sl_btmesh_blob_storage_set_delete_separation_time#

sl_status_t sl_btmesh_blob_storage_set_delete_separation_time (uint16_t separation_time_ms)
Parameters
TypeDirectionArgument NameDescription
uint16_t[in]separation_time_ms

Separation time between two async erase steps

Set asynchronous delete separation time

Asynchronous delete separation time is measured in milliseconds between two asynchronous delete steps. The BLOB storage async delete is performed in multiple steps and each delete step blocks the code execution. If delete steps are executed too often then it could starve other timing sensitive SW components so delete separation time feature can be used to prevent this scenario.

Returns

  • Request status

Return values

  • SL_STATUS_OK: In case of success


sl_btmesh_blob_storage_is_present#

bool sl_btmesh_blob_storage_is_present (sl_bt_uuid_64_t const * blob_id)
Parameters
TypeDirectionArgument NameDescription
sl_bt_uuid_64_t const *[in]blob_id

Identifier of the BLOB inquired about

Checks whether BLOB identified is present in storage

Returns

  • Boolean value

Return values

  • true: BLOB is present

  • false: BLOB is not present


sl_btmesh_blob_storage_get_blob_size#

sl_status_t sl_btmesh_blob_storage_get_blob_size (sl_bt_uuid_64_t const * blob_id, uint32_t * blob_size)
Parameters
TypeDirectionArgument NameDescription
sl_bt_uuid_64_t const *[in]blob_id

Identifier of the BLOB inquired about

uint32_t *[out]blob_size

Length of the BLOB

Queries the BLOB size

Returns

  • Status code

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_NOT_FOUND: In case no BLOB has been identified


sl_btmesh_blob_storage_calc_app_footer_size#

uint32_t sl_btmesh_blob_storage_calc_app_footer_size (uint16_t footer_data_length)
Parameters
TypeDirectionArgument NameDescription
uint16_t[in]footer_data_length

Length of the application specific footer data

Calculates the size of application specific footer on BLOB storage medium.

Note

  • BLOB storage stores some additional metadata (id, length) with the footer data and it takes into consideration the alignment requirements of the underlying medium.

Returns

  • Size of application specific footer on BLOB storage medium.


sl_btmesh_blob_storage_write_app_footer#

sl_status_t sl_btmesh_blob_storage_write_app_footer (sl_bt_uuid_64_t const * blob_id, void const * footer, uint16_t app_id, uint16_t length)
Parameters
TypeDirectionArgument NameDescription
sl_bt_uuid_64_t const *[in]blob_id

Identifier of the BLOB

void const *[in]footer

Footer data

uint16_t[in]app_id

Identifier of the application data. Must be unique to the application layer user in the compiled software. Used to identify footer.

uint16_t[in]length

Length of the data

Writes application specific footer into storage belonging to identified the BLOB and application

Returns

  • Result of app footer write

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_INVALID_PARAMETER: If app_id or length is invalid

  • SL_STATUS_FLASH_PROGRAM_FAILED: In case write failed

  • SL_STATUS_FULL: If there is no free space for app footer

  • SL_STATUS_NOT_FOUND: If blob_id doesn't identify any footer

  • SL_STATUS_INVALID_SIGNATURE: If any footer is corrupted during search for empty space to write new app footer

  • SL_STATUS_FAIL: In case of internal API error


sl_btmesh_blob_storage_get_app_footer_length#

sl_status_t sl_btmesh_blob_storage_get_app_footer_length (sl_bt_uuid_64_t const * blob_id, uint16_t app_id, uint16_t * length)
Parameters
TypeDirectionArgument NameDescription
sl_bt_uuid_64_t const *[in]blob_id

Identifier of the BLOB

uint16_t[in]app_id

Identifier of the application data

uint16_t *[out]length

Length of application data in case of success

Queries footer information length assigned to a given BLOB, belonging to an application identifier.

Returns

  • Status code

Return values

  • SL_STATUS_OK: In case of successful query

  • SL_STATUS_NOT_FOUND: If app_id and blob_id don't identify a footer

  • SL_STATUS_INVALID_SIGNATURE: In case of corrupted app footer metadata

  • SL_STATUS_FAIL: In case of internal API error


sl_btmesh_blob_storage_get_app_footer#

sl_status_t sl_btmesh_blob_storage_get_app_footer (sl_bt_uuid_64_t const * blob_id, uint16_t app_id, void * buffer, uint16_t * length)
Parameters
TypeDirectionArgument NameDescription
sl_bt_uuid_64_t const *[in]blob_id

Identifier of the BLOB

uint16_t[in]app_id

Identifier of the application data

void *[out]buffer

Pointer to footer buffer

uint16_t *[inout]length

Length of the buffer; contains the length of the data read in case of success

Extracts footer information assigned to a given BLOB, belonging to an application identifier.

Returns

  • Status code

Return values

  • SL_STATUS_OK: In case of successful reading

  • SL_STATUS_NOT_FOUND: If app_id and blob_id don't identify a footer

  • SL_STATUS_INVALID_SIGNATURE: In case of corrupted app footer metadata

  • SL_STATUS_INVALID_PARAMETER: If buffer is too short

  • SL_STATUS_FAIL: In case of internal API error


sl_btmesh_blob_storage_set_managed#

sl_status_t sl_btmesh_blob_storage_set_managed (sl_bt_uuid_64_t const * blob_id, uint16_t owner_id)
Parameters
TypeDirectionArgument NameDescription
sl_bt_uuid_64_t const *[in]blob_id

Identifier of the BLOB

uint16_t[in]owner_id

Identifier of owner which the BLOB belongs to

Set BLOB to be managed, meaning it won't be deleted.

Each managed BLOB is managed by a specific owner which is stored with BLOB. Unmanaged BLOBs will be deleted when out of available space.

Returns

  • Status code

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_FLASH_PROGRAM_FAILED: In case write failed

  • SL_STATUS_FULL: If there is no free space to store owner_id

  • SL_STATUS_NOT_FOUND: If blob_id doesn't identify any footer

  • SL_STATUS_INVALID_SIGNATURE: If any footer is corrupted during search for empty space to write new app footer

  • SL_STATUS_FAIL: In case of internal API error


sl_btmesh_blob_storage_is_managed#

bool sl_btmesh_blob_storage_is_managed (sl_bt_uuid_64_t const * blob_id)
Parameters
TypeDirectionArgument NameDescription
sl_bt_uuid_64_t const *[in]blob_id

Identifier of the BLOB

Check if BLOB is managed.

See Also

Returns

  • Boolean value

Return values

  • true: BLOB is managed

  • false: BLOB isn't managed or BLOB does not exist


sl_btmesh_blob_storage_is_managed_by_owner#

bool sl_btmesh_blob_storage_is_managed_by_owner (sl_bt_uuid_64_t const * blob_id, uint16_t owner_id)
Parameters
TypeDirectionArgument NameDescription
sl_bt_uuid_64_t const *[in]blob_id

Identifier of the BLOB

uint16_t[in]owner_id

Identifier of expected owner

Check if BLOB is managed by a specific owner.

See Also

Returns

  • Boolean value

Return values

  • true: BLOB belongs to the specified owner

  • false: BLOB belongs to another owner or BLOB is not managed or BLOB does not exist


sl_btmesh_blob_storage_get_managed_flag_size#

uint32_t sl_btmesh_blob_storage_get_managed_flag_size (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Return the size of managed flag on BLOB storage medium.

BLOB storage needs to distinguish managed and unmanaged BLOBs so it marks managed BLOBs as such which requires some space on the medium.

Returns

  • Size of managed flag on BLOB storage medium


sl_btmesh_blob_storage_get_blob_id_by_owner#

sl_status_t sl_btmesh_blob_storage_get_blob_id_by_owner (uint16_t owner_id, uint32_t occurrence_idx, sl_bt_uuid_64_t * blob_id)
Parameters
TypeDirectionArgument NameDescription
uint16_t[in]owner_id

Identifier of owner which the BLOB belongs to

uint32_t[in]occurrence_idx

Selects a BLOB from BLOBs managed by the same owner. Zero means the first BLOB with matching owner found during the search.

sl_bt_uuid_64_t *[out]blob_id

Identifier of the BLOB

Searches BLOBs managed by a specific owner and provides the BLOB ID of the requested occurrence.

The search order for managed BLOBs of an owner is not specified but it is guaranteed that the order does not change unless new BLOB is added or an existing BLOB of the same owner is removed (delete, invalidate) from the BLOB storage.

When a managed BLOB belonging to an owner is removed from BLOB storage then occurrence_idx of BLOBs with same owner is decremented if the occurrence_idx of the BLOB was greater than the occurrence_idx of the removed BLOB otherwise the occurrence_idx does not change. In other words the BLOBs are shifted to lower indexes.

If a new managed BLOB is added by an owner to the BLOB storage then the search order of BLOBs with the same owner may change arbitrarily because it is not guaranteed which occurrence_idx the added BLOB is assigned to.

See Also

Returns

  • Result of managed BLOB ID get operation

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_NOT_FOUND: If no BLOBs are found with owner_id or the occurrence_idx is greater or equal to the number of BLOBs managed by owner

  • SL_STATUS_FAIL: In case of internal API error


sl_btmesh_blob_storage_get_blob_id_by_footer#

sl_status_t sl_btmesh_blob_storage_get_blob_id_by_footer (uint16_t app_id, const void * expected_footer, uint16_t length, sl_bt_uuid_64_t * blob_id)
Parameters
TypeDirectionArgument NameDescription
uint16_t[in]app_id

Identifier of the application data

const void *[in]expected_footer

Expected footer data for comparison

uint16_t[in]length

Length of the data

sl_bt_uuid_64_t *[out]blob_id

Identifier of the BLOB of the first match

Searches for a specific app_id and data in the footer of each valid BLOB and returns the BLOB ID of the first match

Returns

  • Result of footer based BLOB ID query (propagates other internal errors)

Return values

  • SL_STATUS_OK: In case of success

  • SL_STATUS_NOT_FOUND: If app_id is not found or the data is different

  • SL_STATUS_FAIL: In case of internal API error


sl_btmesh_blob_storage_get_total_space#

uint32_t sl_btmesh_blob_storage_get_total_space (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Queries total space for BLOB data storage in bytes (used + empty)

Returns

  • Total space in bytes


sl_btmesh_blob_storage_get_remaining_space#

uint32_t sl_btmesh_blob_storage_get_remaining_space (bool include_unmanaged_blobs)
Parameters
TypeDirectionArgument NameDescription
bool[in]include_unmanaged_blobs

If true then unmanaged blobs are calculated into the remaining empty space.

Queries remaining empty bytes in the BLOB storage

Returns

  • Remaining empty bytes


sl_btmesh_blob_storage_get_max_blob_size#

uint32_t sl_btmesh_blob_storage_get_max_blob_size (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Queries maximum BLOB size which can be stored if the whole BLOB storage is empty

Note

  • This might not be available even if one BLOB is stored

Returns

  • Maximum BLOB size


sl_btmesh_blob_storage_get_max_blob_size_free#

uint32_t sl_btmesh_blob_storage_get_max_blob_size_free (bool include_unmanaged_blobs)
Parameters
TypeDirectionArgument NameDescription
bool[in]include_unmanaged_blobs

If true then unmanaged blobs are calculated into the maximum free BLOB size.

Queries maximum BLOB size which can be stored in the free space of BLOB storage

Returns

  • Maximum supported BLOB size in free part of the BLOB storage


sl_btmesh_blob_storage_get_max_blob_count#

uint32_t sl_btmesh_blob_storage_get_max_blob_count (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Queries maximum number of BLOBs which can be stored

Returns

  • Maximum number of BLOBs


sl_btmesh_blob_storage_get_erase_error_code#

sl_btmesh_blob_storage_delete_state_t sl_btmesh_blob_storage_get_erase_error_code (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Queries the error code/state of the asynchronous erase

Returns

  • State of asynchronous erase

Return values

  • SL_BTMESH_BLOB_STORAGE_DELETE_INACTIVE: If erase is inactive

  • SL_BTMESH_BLOB_STORAGE_DELETE_BUSY: If erase is ongoing

  • SL_BTMESH_BLOB_STORAGE_DELETE_FAILED: If erase has failed

  • SL_BTMESH_BLOB_STORAGE_DELETE_SUCCESS: If erase is successful


sl_btmesh_blob_storage_delete_step_handle#

void sl_btmesh_blob_storage_delete_step_handle (void )
Parameters
TypeDirectionArgument NameDescription
voidN/A

Handles the asynchronous erase state machine


sl_btmesh_blob_storage_is_ok_to_sleep#

bool sl_btmesh_blob_storage_is_ok_to_sleep ()

Check if BLOB Storage allows the system to sleep

Returns

  • If it is ok to sleep

Return values

  • true: The system is allowed to sleep

  • false: The system shall be kept awake

Asynchronous erase requires the device to stay awake to finish.


sl_btmesh_blob_storage_calculate_checksum#

uint32_t sl_btmesh_blob_storage_calculate_checksum (const uint8_t * data, uint16_t length, uint32_t initial_value)
Parameters
TypeDirectionArgument NameDescription
const uint8_t *[in]data

Pointer to the app footer data

uint16_t[in]length

Length of the app footer length

uint32_t[in]initial_value

Initial value for checksum calculation

Called when app footer is written to BLOB storage to calculate the checksum over app footer data

This is a callback which can be implemented in the application. Note

  • If no implementation is provided in the application, then the default weak implementation calculates Berger code.

Returns

  • Checksum calculated from app footer data