|
PebbleOS
|
#include <applib/data_logging.h>#include <pbl/drivers/rtc.h>#include <flash_region/flash_region.h>#include <kernel/pebble_tasks.h>#include <pbl/kernel/mutex.h>#include <pbl/services/comm_session/protocol.h>#include <system/hexdump.h>#include <pbl/kernel/compiler.h>#include <pbl/util/shared_cbuf.h>#include <pbl/util/units.h>#include <pbl/util/uuid.h>#include <stdint.h>#include <stdlib.h>#include <time.h>Data Structures | |
| struct | DataLoggingSessionStorage |
| Location of a session's data in its file. More... | |
| struct | DataLoggingSessionComm |
| Endpoint state of a session. More... | |
| struct | DataLoggingActiveState |
| State of an active session. More... | |
| struct | DataLoggingSession |
| Data logging session. More... | |
Macros | |
| #define | DLS_FILE_NAME_PREFIX "dls_storage_" |
| Prefix of session file names, followed by the decimal session ID. | |
| #define | DLS_MAX_DATA_BYTES (DLS_TOTAL_STORAGE_BYTES - (DLS_MAX_NUM_SESSIONS * DLS_FILE_INIT_SIZE_BYTES)) |
| Space available to session files beyond their initial size. | |
| #define | DLS_INVALID_FILE (-1) |
| Value of DataLoggingSessionStorage::fd when the session has no open file. | |
| #define | DLS_SESSION_MAX_BUFFERED_ITEM_SIZE 300U |
| Largest item size, and largest dls_log() write, for buffered sessions. | |
| #define | DLS_SESSION_MIN_BUFFER_SIZE (DLS_SESSION_MAX_BUFFERED_ITEM_SIZE + 1) |
| Size of a buffered session's buffer. | |
Enumerations | |
| enum | DataLoggingStatus { DataLoggingStatusActive = 0x01 , DataLoggingStatusInactive = 0x02 } |
| Session status. More... | |
| enum | DataLoggingEndpointCmd { DataLoggingEndpointCmdOpen = 0x01 , DataLoggingEndpointCmdData = 0x02 , DataLoggingEndpointCmdClose = 0x03 , DataLoggingEndpointCmdReport = 0x04 , DataLoggingEndpointCmdAck = 0x05 , DataLoggingEndpointCmdNack = 0x06 , DataLoggingEndpointCmdTimeout = 0x07 , DataLoggingEndpointCmdEmptySession = 0x08 , DataLoggingEndpointCmdGetSendEnableReq = 0x09 , DataLoggingEndpointCmdGetSendEnableRsp = 0x0A , DataLoggingEndpointCmdSetSendEnable = 0x0B } |
| Data logging endpoint commands. More... | |
| enum | DataLoggingSessionCommState { DataLoggingSessionCommStateOpening , DataLoggingSessionCommStateIdle , DataLoggingSessionCommStateSending } |
| Endpoint state of a session. More... | |
Functions | |
| bool | dls_private_send_session (DataLoggingSession *logging_session, bool empty) |
| Send the next chunk of a session's stored data to the phone. | |
| void | dls_private_handle_disconnect (void *data) |
| Reset the endpoint state of all sessions after a disconnection. | |
| int | dls_test_read (DataLoggingSession *logging_session, uint8_t *buffer, int num_bytes) |
| Read session data, for unit tests only. | |
| int | dls_test_consume (DataLoggingSession *logging_session, int num_bytes) |
| Consume session data, for unit tests only. | |
| int | dls_test_get_num_bytes (DataLoggingSession *logging_session) |
| Get the number of unread bytes, for unit tests only. | |
| int | dls_test_get_tag (DataLoggingSession *logging_session) |
| Get the session tag, for unit tests only. | |
| uint8_t | dls_test_get_session_id (DataLoggingSession *logging_session) |
| Get the session ID, for unit tests only. | |
Variables | |
| static const uint32_t | DLS_FILE_NAME_MAX_LEN = 20 |
| Size of a buffer holding a session file name. | |
| static const uint32_t | DLS_FILE_INIT_SIZE_BYTES = PBL_KIB(4) |
| Initial size of a session file. | |
| static const uint32_t | DLS_MIN_FILE_FREE_BYTES = PBL_KIB(8) |
| Minimum free space added when a session file grows. | |
| static const uint32_t | DLS_MAX_FILE_FREE_BYTES = PBL_KIB(100) |
| Maximum free space added when a session file grows. | |
| static const uint32_t | DLS_MIN_FREE_BYTES = PBL_KIB(1) |
| Free space left at the end of a session file below which the file is grown. | |
| static const uint32_t | DLS_MAX_NUM_SESSIONS = 20 |
| Maximum number of sessions. | |
| static const uint32_t | DLS_TOTAL_STORAGE_BYTES = PBL_KIB(640) |
| Maximum file system space used by all session files. | |
| static const uint8_t | DLS_ENDPOINT_CMD_MASK = 0x7f |
| Mask of the command in the first byte of an endpoint message. | |
| static const uint32_t | DLS_ENDPOINT_MAX_PAYLOAD |
| Largest data message payload, and largest item size for unbuffered sessions. | |