Sentinel
Loading...
Searching...
No Matches
processingTask.cpp File Reference

Processing Task Implementation File. More...

#include "tasks/processingTask.h"
#include "SensorData.h"
#include "config.h"
#include "utils/threadsafe_serial.h"
#include <Arduino.h>

Macros

#define JSON_BUFFER_SIZE   512
 
#define HTTP_QUEUE_SEND_TIMEOUT_MS   2000
 
#define HTTP_QUEUE_SEND_RETRIES   3
 
#define DATA_QUEUE_RECEIVE_TIMEOUT_MS   1000
 

Functions

bool createJson (const sensor_data_t &data, char *buffer, size_t bufferSize)
 Create a Json object.
 
void processingTask (void *pvParameters)
 Processing Task function.
 

Variables

QueueHandle_t dataQueue
 
QueueHandle_t httpQueue
 

Detailed Description

Processing Task Implementation File.

This file contains the implementation of the processingTask function, which is used to handle processing operations in a FreeRTOS task. The task is responsible for processing sensor data and creating a JSON string for network transmission.

Function Documentation

◆ createJson()

bool createJson ( const sensor_data_t & data,
char * buffer,
size_t bufferSize )

Create a Json object.

This function creates a JSON string from the sensor data and stores it in the provided buffer. The JSON string contains the following fields:

  • steps
  • humidity
  • gas
  • fall_detected
  • device_battery
  • heart_rate
  • noise_level
Parameters
data
buffer
bufferSize
Returns
true
false

◆ processingTask()

void processingTask ( void * pvParameters)

Processing Task function.

This function handles processing operations in a FreeRTOS task. It reads sensor data from a queue, processes it, and creates a JSON string for network transmission. The task runs in an infinite loop, waiting for data to be available in the queue. When data is received, it is processed and sent to the HTTP queue for transmission.

Parameters
pvParameters