GPS Device
Loading...
Searching...
No Matches
datalog.c File Reference

Data log module implementation file. Implements the GPS data logging feature of the GPS device. More...

#include <stdbool.h>
#include "datalog.h"
#include "common.h"
#include "configuration.h"
#include "err.h"
#include "init.h"
#include "log.h"
#include "modules.h"
#include "cmd.h"
#include "ff.h"
#include "arm_cortex_m4_systick.h"
#include "neo6.h"
Include dependency graph for datalog.c:

Go to the source code of this file.

Classes

struct  datalog_handle_s
 Internal structure representing a single data log instance. More...
struct  internal_state_s
 Internal state of the SysTick driver. More...

Functions

static ERR_te datalog_cmd_list_handler (uint32_t argc, char **argv)
 CLI handler for the "list" command. Logs the names of all active data log handles.
ERR_te datalog_init_subsys (void)
 Initializes the data log subsystem.
ERR_te datalog_deinit_subsys (void)
 Deinitializes the data log subsystem.
ERR_te datalog_start_subsys (void)
 Starts the data log subsystem.
ERR_te datalog_stop_subsys (void)
 Stops the data log subsystem.
ERR_te datalog_init_handle (DATALOG_CFG_ts const *datalog_cfg, DATALOG_HANDLE_ts **datalog_handle_o)
 Initializes and registers a data log handle.
ERR_te datalog_deinit_handle (DATALOG_HANDLE_ts const *datalog_handle)
 Deinitializes a data log handle.
ERR_te datalog_run_handle (DATALOG_HANDLE_ts *datalog_handle)
 Writes a GPS data entry to the log file if the logging interval has elapsed.

Variables

static struct internal_state_s internal_state
 Singleton instance of the data log subsystem internal state.
CMD_INFO_ts datalog_cmds []
 Table of CLI commands registered by the data log subsystem.
CMD_CLIENT_INFO_ts datalog_cmd_client_info
 Registration descriptor passed to the command subsystem.

Detailed Description

Data log module implementation file. Implements the GPS data logging feature of the GPS device.

Author
github.com/Baksi675
Version
0.1
Date
2026-02-15

Definition in file datalog.c.

Variable Documentation

◆ internal_state

struct internal_state_s internal_state
static

Singleton instance of the data log subsystem internal state.

Definition at line 97 of file datalog.c.

◆ datalog_cmds

CMD_INFO_ts datalog_cmds[]
Initial value:
= {
{
.name = "list",
.help = "Lists active datalog objects, usage: datalog list",
}
}
static ERR_te datalog_cmd_list_handler(uint32_t argc, char **argv)
CLI handler for the "list" command. Logs the names of all active data log handles.
Definition datalog.c:517

Table of CLI commands registered by the data log subsystem.

Registered with the command subsystem via datalog_cmd_client_info during datalog_init_subsys.

Definition at line 109 of file datalog.c.

109 {
110 {
111 .name = "list",
112 .help = "Lists active datalog objects, usage: datalog list",
113 .handler = datalog_cmd_list_handler
114 }
115};

◆ datalog_cmd_client_info

CMD_CLIENT_INFO_ts datalog_cmd_client_info
Initial value:
= {
.cmds_ptr = datalog_cmds,
.num_cmds = sizeof(datalog_cmds) / sizeof(datalog_cmds[0]),
.log_level_ptr = &internal_state.log_level,
.name = "datalog"
}
static struct internal_state_s internal_state
Singleton instance of the SysTick driver internal state.
CMD_INFO_ts datalog_cmds[]
Table of CLI commands registered by the data log subsystem.
Definition datalog.c:109

Registration descriptor passed to the command subsystem.

Bundles the command table, its size, the subsystem name prefix used on the CLI, and a pointer to the runtime log-level variable.

Definition at line 124 of file datalog.c.

124 {
125 .cmds_ptr = datalog_cmds,
126 .num_cmds = sizeof(datalog_cmds) / sizeof(datalog_cmds[0]),
127 .log_level_ptr = &internal_state.log_level,
128 .name = "datalog"
129};