Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
TDF data logger APIs

TDF data logger API . More...

Macros

#define TDF_DATA_LOGGER_LOG(logger_mask, tdf_id, tdf_time, data)
 Type safe wrapper around tdf_data_logger_log.
 
#define TDF_DATA_LOGGER_LOG_ARRAY(logger_mask, tdf_id, tdf_num, tdf_time, period, data)
 Type safe wrapper around tdf_data_logger_log_array.
 

Enumerations

enum  tdf_data_logger_mask {
  TDF_DATA_LOGGER_FLASH = BIT(_TDF_DATA_LOGGER_FLASH_OFFSET) , TDF_DATA_LOGGER_REMOVABLE = BIT(_TDF_DATA_LOGGER_REMOVABLE_OFFSET) , TDF_DATA_LOGGER_SERIAL = BIT(_TDF_DATA_LOGGER_SERIAL_OFFSET) , TDF_DATA_LOGGER_UDP = BIT(_TDF_DATA_LOGGER_UDP_OFFSET) ,
  TDF_DATA_LOGGER_BT_ADV = BIT(_TDF_DATA_LOGGER_BT_ADV_OFFSET) , TDF_DATA_LOGGER_BT_PERIPHERAL = BIT(_TDF_DATA_LOGGER_BT_PERIPHERAL_OFFSET)
}
 TDF data logger backends. More...
 

Functions

int tdf_data_logger_log_core_dev (const struct device *dev, uint16_t tdf_id, uint8_t tdf_len, uint8_t tdf_num, enum tdf_data_format format, uint64_t time, uint32_t idx_period, const void *data)
 Add multiple TDFs to a data logger.
 
void tdf_data_logger_log_core (uint8_t logger_mask, uint16_t tdf_id, uint8_t tdf_len, uint8_t tdf_num, enum tdf_data_format format, uint64_t time, uint32_t idx_period, const void *data)
 Add multiple TDFs to multiple data loggers.
 
static int tdf_data_logger_log_array_dev (const struct device *dev, uint16_t tdf_id, uint8_t tdf_len, uint8_t tdf_num, uint64_t time, uint32_t period, const void *data)
 Add multiple TDFs to a data logger.
 
static void tdf_data_logger_log_array (uint8_t logger_mask, uint16_t tdf_id, uint8_t tdf_len, uint8_t tdf_num, uint64_t time, uint32_t period, const void *data)
 Add multiple TDFs to multiple data loggers.
 
static int tdf_data_logger_log_dev (const struct device *dev, uint16_t tdf_id, uint8_t tdf_len, uint64_t time, const void *data)
 Add a single TDF to a data logger.
 
static void tdf_data_logger_log (uint8_t logger_mask, uint16_t tdf_id, uint8_t tdf_len, uint64_t time, const void *data)
 Add a single TDF to multiple data loggers.
 
int tdf_data_logger_block_bytes_pending (const struct device *dev)
 Query the number of bytes pending on the current block.
 
int tdf_data_logger_block_bytes_remaining (const struct device *dev)
 Query the number of bytes remaining until the logger block will be flushed.
 
int tdf_data_logger_flush_dev (const struct device *dev)
 Flush any pending TDFs to backend.
 
void tdf_data_logger_flush (uint8_t logger_mask)
 Flush any pending TDFs to multiple backends.
 
int tdf_data_logger_remote_id_set (const struct device *dev, uint64_t remote_id)
 Set the remote ID associated with the logger.
 

Detailed Description

TDF data logger API .

Macro Definition Documentation

◆ TDF_DATA_LOGGER_LOG

#define TDF_DATA_LOGGER_LOG ( logger_mask,
tdf_id,
tdf_time,
data )

#include <infuse/data_logger/high_level/tdf.h>

Value:
tdf_data_logger_log(logger_mask, tdf_id, sizeof(TDF_TYPE(tdf_id)), tdf_time, data); \
do { \
__maybe_unused const TDF_TYPE(tdf_id) *_data = data; \
} while (0)
#define TDF_TYPE(tdf_id)
Get type associated with a given TDF ID.
Definition tdf.h:110
static void tdf_data_logger_log(uint8_t logger_mask, uint16_t tdf_id, uint8_t tdf_len, uint64_t time, const void *data)
Add a single TDF to multiple data loggers.
Definition tdf.h:173

Type safe wrapper around tdf_data_logger_log.

Adds compile-time validation that the passed pointer matches the type associated with tdf_id.

Note
Only works for TDF types without trailing variable length arrays
Parameters
logger_maskBitmask of loggers to write to (tdf_data_logger_mask)
tdf_idTDF sensor ID
tdf_timeEpoch time associated with the TDF. 0 for no timestamp.
dataTDF data

◆ TDF_DATA_LOGGER_LOG_ARRAY

#define TDF_DATA_LOGGER_LOG_ARRAY ( logger_mask,
tdf_id,
tdf_num,
tdf_time,
period,
data )

#include <infuse/data_logger/high_level/tdf.h>

Value:
tdf_data_logger_log_array(logger_mask, tdf_id, sizeof(TDF_TYPE(tdf_id)), tdf_num, \
tdf_time, period, data); \
do { \
__maybe_unused const TDF_TYPE(tdf_id) *_data = data; \
} while (0)
static void tdf_data_logger_log_array(uint8_t logger_mask, uint16_t tdf_id, uint8_t tdf_len, uint8_t tdf_num, uint64_t time, uint32_t period, const void *data)
Add multiple TDFs to multiple data loggers.
Definition tdf.h:137

Type safe wrapper around tdf_data_logger_log_array.

Adds compile-time validation that the passed pointer matches the type associated with tdf_id.

Note
Only works for TDF types without trailing variable length arrays
Parameters
logger_maskBitmask of loggers to write to (tdf_data_logger_mask)
tdf_idTDF sensor ID
tdf_numNumber of TDFs to add
tdf_timeEpoch time associated with the TDF. 0 for no timestamp.
periodTime period between the TDF samples
dataTDF data

Enumeration Type Documentation

◆ tdf_data_logger_mask

#include <infuse/data_logger/high_level/tdf.h>

TDF data logger backends.

Enumerator
TDF_DATA_LOGGER_FLASH 

Permanent flash storage device.

TDF_DATA_LOGGER_REMOVABLE 

Removable flash storage device.

TDF_DATA_LOGGER_SERIAL 

Serial communications interface.

TDF_DATA_LOGGER_UDP 

UDP communications interface.

TDF_DATA_LOGGER_BT_ADV 

Bluetooth advertising communications interface.

TDF_DATA_LOGGER_BT_PERIPHERAL 

Bluetooth GATT peripheral communications interface.

Function Documentation

◆ tdf_data_logger_block_bytes_pending()

int tdf_data_logger_block_bytes_pending ( const struct device * dev)

#include <infuse/data_logger/high_level/tdf.h>

Query the number of bytes pending on the current block.

Parameters
devData logger
Returns
int Number of bytes of TDF data currently pending on the block

◆ tdf_data_logger_block_bytes_remaining()

int tdf_data_logger_block_bytes_remaining ( const struct device * dev)

#include <infuse/data_logger/high_level/tdf.h>

Query the number of bytes remaining until the logger block will be flushed.

Parameters
devData logger
Returns
int Number of bytes of TDF data that can be added on the current block

◆ tdf_data_logger_flush()

void tdf_data_logger_flush ( uint8_t logger_mask)

#include <infuse/data_logger/high_level/tdf.h>

Flush any pending TDFs to multiple backends.

Parameters
logger_maskBitmask of loggers to flush (tdf_data_logger_mask)

◆ tdf_data_logger_flush_dev()

int tdf_data_logger_flush_dev ( const struct device * dev)

#include <infuse/data_logger/high_level/tdf.h>

Flush any pending TDFs to backend.

Parameters
devData logger
Return values
0On success (Or no data to flush)
-errnoError code from data_logger_block_write

◆ tdf_data_logger_log()

static void tdf_data_logger_log ( uint8_t logger_mask,
uint16_t tdf_id,
uint8_t tdf_len,
uint64_t time,
const void * data )
inlinestatic

#include <infuse/data_logger/high_level/tdf.h>

Add a single TDF to multiple data loggers.

Parameters
logger_maskBitmask of loggers to write to (tdf_data_logger_mask)
tdf_idTDF sensor ID
tdf_lenLength of a single TDF
timeEpoch time associated with the TDF. 0 for no timestamp.
dataTDF data

◆ tdf_data_logger_log_array()

static void tdf_data_logger_log_array ( uint8_t logger_mask,
uint16_t tdf_id,
uint8_t tdf_len,
uint8_t tdf_num,
uint64_t time,
uint32_t period,
const void * data )
inlinestatic

#include <infuse/data_logger/high_level/tdf.h>

Add multiple TDFs to multiple data loggers.

Parameters
logger_maskBitmask of loggers to write to (tdf_data_logger_mask)
tdf_idTDF sensor ID
tdf_lenLength of a single TDF
tdf_numNumber of TDFs to add
timeEpoch time associated with the first TDF. 0 for no timestamp.
periodTime period between the TDF samples
dataTDF data array

◆ tdf_data_logger_log_array_dev()

static int tdf_data_logger_log_array_dev ( const struct device * dev,
uint16_t tdf_id,
uint8_t tdf_len,
uint8_t tdf_num,
uint64_t time,
uint32_t period,
const void * data )
inlinestatic

#include <infuse/data_logger/high_level/tdf.h>

Add multiple TDFs to a data logger.

Parameters
devData logger
tdf_idTDF sensor ID
tdf_lenLength of a single TDF
tdf_numNumber of TDFs to add
timeEpoch time associated with the first TDF. 0 for no timestamp.
periodTime period between the TDF samples
dataTDF data array
Return values
0On success
-errnoError code from tdf_add or tdf_data_logger_flush on error

◆ tdf_data_logger_log_core()

void tdf_data_logger_log_core ( uint8_t logger_mask,
uint16_t tdf_id,
uint8_t tdf_len,
uint8_t tdf_num,
enum tdf_data_format format,
uint64_t time,
uint32_t idx_period,
const void * data )

#include <infuse/data_logger/high_level/tdf.h>

Add multiple TDFs to multiple data loggers.

Parameters
logger_maskBitmask of loggers to write to (tdf_data_logger_mask)
tdf_idTDF sensor ID
tdf_lenLength of a single TDF
tdf_numNumber of TDFs to add
formatTDF data encoding format
timeEpoch time associated with the first TDF. 0 for no timestamp.
idx_periodIndex of first sample if format == TDF_DATA_FORMAT_IDX_ARRAY Epoch time between tdfs when tdf_num > 0 otherwise.
dataTDF data array

◆ tdf_data_logger_log_core_dev()

int tdf_data_logger_log_core_dev ( const struct device * dev,
uint16_t tdf_id,
uint8_t tdf_len,
uint8_t tdf_num,
enum tdf_data_format format,
uint64_t time,
uint32_t idx_period,
const void * data )

#include <infuse/data_logger/high_level/tdf.h>

Add multiple TDFs to a data logger.

Parameters
devData logger
tdf_idTDF sensor ID
tdf_lenLength of a single TDF
tdf_numNumber of TDFs to add
formatTDF data encoding format
timeEpoch time associated with the first TDF. 0 for no timestamp.
idx_periodIndex of first sample if format == TDF_DATA_FORMAT_IDX_ARRAY Epoch time between tdfs when tdf_num > 0 otherwise.
dataTDF data array
Return values
0On success
-errnoError code from tdf_add or tdf_data_logger_flush on error

◆ tdf_data_logger_log_dev()

static int tdf_data_logger_log_dev ( const struct device * dev,
uint16_t tdf_id,
uint8_t tdf_len,
uint64_t time,
const void * data )
inlinestatic

#include <infuse/data_logger/high_level/tdf.h>

Add a single TDF to a data logger.

Parameters
devData logger
tdf_idTDF sensor ID
tdf_lenLength of a single TDF
timeEpoch time associated with the TDF. 0 for no timestamp.
dataTDF data
Return values
0On success
-errnoError code from tdf_add or tdf_data_logger_flush on error

◆ tdf_data_logger_remote_id_set()

int tdf_data_logger_remote_id_set ( const struct device * dev,
uint64_t remote_id )

#include <infuse/data_logger/high_level/tdf.h>

Set the remote ID associated with the logger.

If the logger was previously logging a different remote ID, any pending data will be flushed.

Parameters
devTDF logger to update
remote_idID of the remote device
Return values
0on success
-EINVALLogger is not a remote TDF logger