|
PebbleOS
|
Session data stored in a PFS file per session. More...
Functions | |
| void | dls_storage_invalidate_all (void) |
| Delete the storage files of all sessions. | |
| void | dls_storage_delete_logging_storage (DataLoggingSession *session) |
| Delete the storage file of a session. | |
| int32_t | dls_storage_read (DataLoggingSession *logging_session, uint8_t *buffer, int32_t num_bytes, uint32_t *new_read_offset) |
| Read data from a session without consuming it. | |
| int32_t | dls_storage_consume (DataLoggingSession *logging_session, int32_t num_bytes) |
| Consume data from a session without reading it. | |
| bool | dls_storage_write_session (DataLoggingSession *session) |
| Move the data from a buffered session's RAM buffer to flash. | |
| bool | dls_storage_write_data (DataLoggingSession *session, const void *data, uint32_t num_bytes) |
| Write data directly to a session's file. | |
| void | dls_storage_rebuild (void) |
| Recreate the sessions stored in flash, called at boot from dls_init(). | |
Session data stored in a PFS file per session.
All functions must be called from KernelBG, except during dls_storage_rebuild() at boot. On a write error the session's file is deleted.
| int32_t dls_storage_consume | ( | DataLoggingSession * | logging_session, |
| int32_t | num_bytes | ||
| ) |
Consume data from a session without reading it.
| logging_session | Session to consume from. |
| num_bytes | Number of bytes to consume. 0 only resynchronizes the read offset with the data already consumed, as done when rebuilding sessions at boot. |
| void dls_storage_delete_logging_storage | ( | DataLoggingSession * | session | ) |
Delete the storage file of a session.
The file must not be open.
| session | Session. |
| void dls_storage_invalidate_all | ( | void | ) |
Delete the storage files of all sessions.
| int32_t dls_storage_read | ( | DataLoggingSession * | logging_session, |
| uint8_t * | buffer, | ||
| int32_t | num_bytes, | ||
| uint32_t * | new_read_offset | ||
| ) |
Read data from a session without consuming it.
Only whole items are read, so fewer bytes than requested may be returned.
| logging_session | Session to read from. | |
| [out] | buffer | Destination, or NULL to only get the number of bytes available. |
| num_bytes | Maximum number of bytes to read, ignored when buffer is NULL. | |
| [out] | new_read_offset | File offset of the byte following the data read. |
| void dls_storage_rebuild | ( | void | ) |
Recreate the sessions stored in flash, called at boot from dls_init().
| bool dls_storage_write_data | ( | DataLoggingSession * | session, |
| const void * | data, | ||
| uint32_t | num_bytes | ||
| ) |
Write data directly to a session's file.
Used for unbuffered sessions; the session must be locked with dls_lock_session().
| session | Session. |
| data | Data to write. |
| num_bytes | Length of data in bytes. |
| bool dls_storage_write_session | ( | DataLoggingSession * | session | ) |
Move the data from a buffered session's RAM buffer to flash.
Must be called with the list mutex held. Does nothing for inactive or unbuffered sessions.
| session | Session. |