Modbus Vault v1.0
Loading...
Searching...
No Matches
telemetry_service.h File Reference

Provide telemetry services. More...

#include "freertos/FreeRTOS.h"
#include "mqtt_bridge.h"
#include "telemetry_pipeline.h"
Include dependency graph for telemetry_service.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TELEMETRY_SERVICE_TASK_NAME   ("TELE_SRVC")
 
#define TELEMETRY_SERVICE_TASK_STACK_DEPTH   (4096U)
 
#define TELEMETRY_SERVICE_TASK_PRIORITY   (4U)
 
#define TELEMETRY_SERVICE_TASK_CPU_AFFINITY   (1U)
 
#define TELEMETRY_SERVICE_TASK_NOTIFY_STOP_BIT   (1U << 0)
 
#define TELEMETRY_SERVICE_TASK_NOTIFY_LIVE_BIT   (1U << 1)
 
#define TELEMETRY_SERVICE_TASK_NOTIFY_REPLAY_BIT   (1U << 2)
 
#define TELEMETRY_SERVICE_TASK_NOTIFY_ONLINE_BIT   (1U << 3)
 

Enumerations

enum  telemetry_service_topics_t { TELEMETRY_SERVICE_TOPICS_LIVE = 0U , TELEMETRY_SERVICE_TOPICS_REPLAY = 1U , TELEMETRY_SERVICE_TOPICS_STATUS = 2U , TELEMETRY_SERVICE_TOPICS_MAX }
 Telemetry service_ topics enum. More...
 

Functions

bool telemetry_service_init (mqtt_bridge_config_t *mqtt_bridge_config_ptr, bool(*replay_check_cb)(void))
 Initialize telemetry service.
 
bool telemetry_service_enqueue_live (const telemetry_pipeline_record_t *payload_ptr)
 Enqueue live record.
 
bool telemetry_service_publish_live (const telemetry_pipeline_record_t *payload_ptr)
 Publish live record.
 
bool telemetry_service_publish_replay (const telemetry_pipeline_record_t *payload_ptr)
 Publish replay record.
 
bool telemetry_service_publish_status (const telemetry_pipeline_record_t *payload_ptr)
 Publish status.
 
void telemetry_service_notify_replay_available (void)
 Send signal replay available.
 
void telemetry_service_set_online (bool online)
 Set online state.
 
bool telemetry_service_is_online (void)
 Get online state.
 
void telemetry_service_deinit (void)
 Deinitialize telemetry service.
 

Detailed Description

Provide telemetry services.

Author
Abanoub Salah
  • Publish live/replay records using it's task
  • Holds MQTT connectivity state

Macro Definition Documentation

◆ TELEMETRY_SERVICE_TASK_CPU_AFFINITY

#define TELEMETRY_SERVICE_TASK_CPU_AFFINITY   (1U)

CPU affinity

◆ TELEMETRY_SERVICE_TASK_NAME

#define TELEMETRY_SERVICE_TASK_NAME   ("TELE_SRVC")

Task name

◆ TELEMETRY_SERVICE_TASK_NOTIFY_LIVE_BIT

#define TELEMETRY_SERVICE_TASK_NOTIFY_LIVE_BIT   (1U << 1)

Task notify for live bit

◆ TELEMETRY_SERVICE_TASK_NOTIFY_ONLINE_BIT

#define TELEMETRY_SERVICE_TASK_NOTIFY_ONLINE_BIT   (1U << 3)

Task notify for online bit

◆ TELEMETRY_SERVICE_TASK_NOTIFY_REPLAY_BIT

#define TELEMETRY_SERVICE_TASK_NOTIFY_REPLAY_BIT   (1U << 2)

Task notify for replay bit

◆ TELEMETRY_SERVICE_TASK_NOTIFY_STOP_BIT

#define TELEMETRY_SERVICE_TASK_NOTIFY_STOP_BIT   (1U << 0)

Task stop bit

◆ TELEMETRY_SERVICE_TASK_PRIORITY

#define TELEMETRY_SERVICE_TASK_PRIORITY   (4U)

Priority

◆ TELEMETRY_SERVICE_TASK_STACK_DEPTH

#define TELEMETRY_SERVICE_TASK_STACK_DEPTH   (4096U)

Stack depth

Enumeration Type Documentation

◆ telemetry_service_topics_t

Telemetry service_ topics enum.

Note
Must be kept contiguous and its used in-order throughout code
Enumerator
TELEMETRY_SERVICE_TOPICS_LIVE 

Live data while connected

TELEMETRY_SERVICE_TOPICS_REPLAY 

Replay of stored data during disconnection

TELEMETRY_SERVICE_TOPICS_STATUS 

Status of system

TELEMETRY_SERVICE_TOPICS_MAX 

Topics count

Function Documentation

◆ telemetry_service_enqueue_live()

bool telemetry_service_enqueue_live ( const telemetry_pipeline_record_t payload_ptr)

Enqueue live record.

Parameters
payload_ptrPointer to record
Returns
true on success false otherwise
Here is the caller graph for this function:

◆ telemetry_service_init()

bool telemetry_service_init ( mqtt_bridge_config_t mqtt_bridge_config_ptr,
bool(*)(void)  replay_check_cb 
)

Initialize telemetry service.

Initialize MQTT bridge instance and create queue

Parameters
mqtt_bridge_config_ptrPointer to MQTT bridge configuration structure
replay_check_cbCallback for replay check
Returns
true on Initialize success false otherwise

< Live queue length

< Publish system's metrics period in micro seconds

Here is the call graph for this function:
Here is the caller graph for this function:

◆ telemetry_service_is_online()

bool telemetry_service_is_online ( void  )

Get online state.

Returns
true on online false otherwise
Here is the caller graph for this function:

◆ telemetry_service_publish_live()

bool telemetry_service_publish_live ( const telemetry_pipeline_record_t payload_ptr)

Publish live record.

Parameters
payload_ptrPointer to record
Returns
true on success false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ telemetry_service_publish_replay()

bool telemetry_service_publish_replay ( const telemetry_pipeline_record_t payload_ptr)

Publish replay record.

Parameters
payload_ptrPointer to record
Returns
true on success false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ telemetry_service_publish_status()

bool telemetry_service_publish_status ( const telemetry_pipeline_record_t payload_ptr)

Publish status.

Parameters
payload_ptrPointer to record
Returns
true on success false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ telemetry_service_set_online()

void telemetry_service_set_online ( bool  online)

Set online state.

Parameters
onlineOnline state
Here is the caller graph for this function: