SD card packet logger — SPP consumer service implementation. More...
#include "spp/services/datalogger/datalogger.h"#include "spp/hal/storage/storage.h"#include "spp/hal/spi/spi.h"#include "spp/core/packet.h"#include "spp/services/log/log.h"#include "spp/core/types.h"#include "spp/services/fsm/fsm.h"#include <string.h>Go to the source code of this file.
Functions | |
| static SPP_RetVal_t | SPP_SERVICES_DATALOGGER_init (void) |
| Initialise the SD card and open the log file for writing. | |
| static SPP_RetVal_t | SPP_SERVICES_DATALOGGER_deliverToMailbox (const SPP_Packet_t packet) |
| Receive a packet from the pub/sub router into the consumer mailbox. | |
| static SPP_RetVal_t | SPP_SERVICES_DATALOGGER_consumeData (void *p_data) |
| Consume a packet from the mailbox and write it to the SD card log file. | |
| const SPP_SERVICE_ConsumerContract_t * | SPP_SERVICES_DATALOGGER_getConsumerContract (void) |
| SPP_RetVal_t | SPP_SERVICES_DATALOGGER_getInitStatus (void) |
Variables | |
| static SPP_Packet_t | s_packetBuffer [K_DATALOGGER_BUFFER_SIZE] |
| static spp_uint8_t | s_packetIndex = 0 |
| static spp_uint32_t | s_currentDataSector = 0 |
| static spp_uint16_t | s_blocksWritten = 0 |
| static SPP_RetVal_t | s_initStatus = K_SPP_ERROR_NOT_INITIALIZED |
| static const SPP_SERVICE_ConsumerContract_t | g_dataloggerConsumerContract |
SD card packet logger — SPP consumer service implementation.
Definition in file datalogger.c.
|
static |
Initialise the SD card and open the log file for writing.
Definition at line 67 of file datalogger.c.
References K_DATALOGGER_FIRST_SECTOR, K_SPP_ERROR_NULL_POINTER, K_SPP_OK, s_blocksWritten, s_currentDataSector, s_initStatus, s_packetIndex, SPP_CORE_FSM_getErrorsBit(), SPP_HAL_STORAGE_init(), and SPP_SERVICES_DATALOGGER_init().
Referenced by SPP_SERVICES_DATALOGGER_init().
|
static |
Receive a packet from the pub/sub router into the consumer mailbox.
| p_pkt | Packet dispatched by the router. |
Definition at line 94 of file datalogger.c.
References K_SPP_OK, s_packetBuffer, s_packetIndex, SPP_Packet_t, and SPP_SERVICES_DATALOGGER_deliverToMailbox().
Referenced by SPP_SERVICES_DATALOGGER_deliverToMailbox().
|
static |
Consume a packet from the mailbox and write it to the SD card log file.
| p_data | Unused (context pointer reserved for future use). |
Definition at line 107 of file datalogger.c.
References K_DATALOGGER_BUFFER_SIZE, K_SPP_OK, K_SPP_TOTAL_PACKET_SIZE, s_blocksWritten, s_currentDataSector, s_packetBuffer, s_packetIndex, SPP_HAL_STORAGE_write(), and SPP_SERVICES_DATALOGGER_consumeData().
Referenced by SPP_SERVICES_DATALOGGER_consumeData().
| const SPP_SERVICE_ConsumerContract_t * SPP_SERVICES_DATALOGGER_getConsumerContract | ( | void | ) |
Definition at line 50 of file datalogger.c.
References g_dataloggerConsumerContract, and SPP_SERVICES_DATALOGGER_getConsumerContract().
Referenced by SPP_SERVICES_DATALOGGER_getConsumerContract().
| SPP_RetVal_t SPP_SERVICES_DATALOGGER_getInitStatus | ( | void | ) |
Definition at line 55 of file datalogger.c.
References s_initStatus, and SPP_SERVICES_DATALOGGER_getInitStatus().
Referenced by SPP_SERVICES_DATALOGGER_getInitStatus().
|
static |
Definition at line 20 of file datalogger.c.
|
static |
Index of the next packet to be written to the buffer.
Definition at line 21 of file datalogger.c.
Referenced by SPP_SERVICES_DATALOGGER_consumeData(), SPP_SERVICES_DATALOGGER_deliverToMailbox(), and SPP_SERVICES_DATALOGGER_init().
|
static |
Current sector of the data log.
Definition at line 22 of file datalogger.c.
Referenced by SPP_SERVICES_DATALOGGER_consumeData(), and SPP_SERVICES_DATALOGGER_init().
|
static |
Number of blocks written to the current sector.
Definition at line 23 of file datalogger.c.
Referenced by SPP_SERVICES_DATALOGGER_consumeData(), and SPP_SERVICES_DATALOGGER_init().
|
static |
Definition at line 24 of file datalogger.c.
Referenced by SPP_SERVICES_DATALOGGER_getInitStatus(), and SPP_SERVICES_DATALOGGER_init().
|
static |
Definition at line 37 of file datalogger.c.
Referenced by SPP_SERVICES_DATALOGGER_getConsumerContract().