LoRa-BLE-Sensor
Loading...
Searching...
No Matches
Classes | Macros | Enumerations | Functions
sensor_app.h File Reference

A library to manage sensor applications. Working between power configurations, data configurations, and scheduling for sensor reading. As well as LoRaWAN initialization, scheduling, and data transmission. This library also handles the BLE services for the device, sensor, and LoRaWAN. More...

#include "sensor_id.h"
#include <stdint.h>
Include dependency graph for sensor_app.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sensor_app_config_t
 Structure for the sensor app configuration. This is used to store the sensor configuration and state. More...
 

Macros

#define SENSOR_VOLTAGE_NAME_LENGTH   20
 
#define SENSOR_TYPE_NAME_LENGTH   20
 

Enumerations

enum  sensor_app_state { SENSOR_APP_STATE_CONFIGURATION , SENSOR_APP_STATE_RUNNING , SENSOR_APP_STATE_ERROR }
 Enum for the sensor app state. This is used to track the state of the sensor app.
 
enum  sensor_nvs_address {
  SENSOR_NVS_ADDRESS_DEVICE_NAME , SENSOR_NVS_ADDRESS_APP_STATE , SENSOR_NVS_ADDRESS_LORAWAN_ENABLED , SENSOR_NVS_ADDRESS_LORAWAN_FREQUENCY ,
  SENSOR_NVS_ADDRESS_LORAWAN_DEV_EUI , SENSOR_NVS_ADDRESS_LORAWAN_JOIN_EUI , SENSOR_NVS_ADDRESS_LORAWAN_APP_KEY , SENSOR_NVS_ADDRESS_LORAWAN_DEV_NONCE ,
  SENSOR_NVS_ADDRESS_LORAWAN_JOIN_ATTEMPTS , SENSOR_NVS_ADDRESS_LORAWAN_SEND_ATTEMPTS , SENSOR_NVS_ADDRESS_SENSOR_1_ENABLED , SENSOR_NVS_ADDRESS_SENSOR_1_POWER ,
  SENSOR_NVS_ADDRESS_SENSOR_1_TYPE , SENSOR_NVS_ADDRESS_SENSOR_1_FREQUENCY , SENSOR_NVS_ADDRESS_SENSOR_2_ENABLED , SENSOR_NVS_ADDRESS_SENSOR_2_POWER ,
  SENSOR_NVS_ADDRESS_SENSOR_2_TYPE , SENSOR_NVS_ADDRESS_SENSOR_2_FREQUENCY , SENSOR_NVS_ADDRESS_LIMIT
}
 Enum for the NVS addresses for the sensor app. This is used to store the sensor app configuration in NVS.
 

Functions

int sensor_app_init (sensor_app_config_t *config)
 Initialize the sensor app, handle anything that needs to be initialized for the app such as timers, nvs, etc.
 
int sensor_app_configuration_state (void)
 Execute the sensor app configuration state.
 
int sensor_app_running_state (void)
 Execute the sensor app running state.
 
int sensor_app_error_state (void)
 Execute the sensor app error state.
 
int sensor_app_ble_start (void)
 Start the BLE advertising and services.
 

Detailed Description

A library to manage sensor applications. Working between power configurations, data configurations, and scheduling for sensor reading. As well as LoRaWAN initialization, scheduling, and data transmission. This library also handles the BLE services for the device, sensor, and LoRaWAN.

Author
Tyler Garcia
Version
0.1
Date
2025-04-28

Function Documentation

◆ sensor_app_ble_start()

int sensor_app_ble_start ( void  )

Start the BLE advertising and services.

Returns
int 0 on success, -1 on failure

◆ sensor_app_configuration_state()

int sensor_app_configuration_state ( void  )

Execute the sensor app configuration state.

Returns
int 0 on success, -1 on failure

◆ sensor_app_error_state()

int sensor_app_error_state ( void  )

Execute the sensor app error state.

Returns
int 0 on success, -1 on failure

◆ sensor_app_init()

int sensor_app_init ( sensor_app_config_t config)

Initialize the sensor app, handle anything that needs to be initialized for the app such as timers, nvs, etc.

Returns
int 0 on success, -1 on failure

◆ sensor_app_running_state()

int sensor_app_running_state ( void  )

Execute the sensor app running state.

Returns
int 0 on success, -1 on failure