Rock Monitoring  V 1.0
Lora Class Reference

Class that is used to initialize and communicate between Gateway and Sensornode via LoRa. More...

#include <lora_class.h>

Collaboration diagram for Lora:
Collaboration graph

Classes

struct  loraSettings
 

Public Member Functions

 Lora (Sensors::structSensors *sensorstruct)
 
int8_t init (void)
 
uint8_t getID (void)
 
uint8_t activityDetection (void)
 
uint8_t dataRequest (uint8_t ID)
 
uint8_t waitForDataRequest (void)
 
void collectData (void)
 
uint8_t sendData (void)
 
uint8_t receiveData (void)
 
uint8_t sendDeepSleep (uint8_t ID)
 
uint8_t waitForDeepSleep (void)
 
int8_t wakeUp (void)
 
void convertStruct (void)
 
void convertStructBack (Sensors::structSensors *dest)
 

Public Attributes

struct Lora::loraSettings mySettings
 

Private Attributes

uint8_t stringData [19]
 
Sensors::structSensorslocalSensorStruct
 
uint8_t sendDataCommand =1
 
uint8_t sendCommandToSleep =2
 
uint8_t gatewayID =2
 

Detailed Description

Class that is used to initialize and communicate between Gateway and Sensornode via LoRa.

Definition at line 12 of file lora_class.h.

Constructor & Destructor Documentation

Lora::Lora ( Sensors::structSensors sensorstruct)

Constructor sets all LoRa-paramets to default

Parameters
TxPoweris set to high
Modeis set to 3
CRCand Header are on
Channelis set to Channel 17
void

Definition at line 11 of file lora_class.cpp.

Member Function Documentation

uint8_t Lora::activityDetection ( void  )

Detects any activity on the channel

Returns
0 there has been an activity on the channel
1 there hasn't been an activity on the channel

Definition at line 169 of file lora_class.cpp.

void Lora::collectData ( void  )
void Lora::convertStruct ( void  )

Converts the struct containing the information to send into a uin8t_t array

Definition at line 129 of file lora_class.cpp.

void Lora::convertStructBack ( Sensors::structSensors dest)

Converts the uin8t_t array back into a struct containing all the necessary information

Parameters
destis the destination of the conversion back into an struct

Definition at line 152 of file lora_class.cpp.

uint8_t Lora::dataRequest ( uint8_t  ID)

Gateway sends a request for measurement data to the sensornode

Parameters
IDsays which sensornode should send the data
Returns
0 no error request has been received and acknowledged
1 error request has not been received

Definition at line 182 of file lora_class.cpp.

uint8_t Lora::getID ( void  )

Takes the Input from the terminal to set the ID of the sensornode

Returns
An uint8_t containing the ID given in the terminal is returned

Definition at line 27 of file lora_class.cpp.

int8_t Lora::init ( void  )

Sets the basic settings so that the sensor-node can communicate with the gateway when turned on Gets the SensorNodeID from the EEPROM and turns the RTC, the LoRa and the USB on

Returns
0 settings done
1 error during settings

Definition at line 60 of file lora_class.cpp.

uint8_t Lora::receiveData ( void  )

Gateway receives the data sent by the sensor-node via Lora

Returns
0-> no error Data has been received and acknowledged
1-> error Data has not been received

Definition at line 241 of file lora_class.cpp.

uint8_t Lora::sendData ( void  )

Sensor-node sends the data requested by the gateway

Returns
0 data has been send successful
1 data has not been send successful

Definition at line 224 of file lora_class.cpp.

uint8_t Lora::sendDeepSleep ( uint8_t  ID)

After the gateway has finished uploading the information to the webserver it sends to command to the sensor-node to go to sleep

Parameters
IDwhich sensor-node should go to sleep
Returns
0 sensor-node received command and has acknowledged
1 sensor-node has not received command

Definition at line 311 of file lora_class.cpp.

uint8_t Lora::waitForDataRequest ( void  )

Sensor-node waits for the data-request from the gateway

Returns
0 request has been received and acknowledged
1 error request has not been received

Definition at line 204 of file lora_class.cpp.

uint8_t Lora::waitForDeepSleep ( void  )

After the sensor-node has send the requested data to the gateway, he waits for the deepSleep command

Returns
0 command received
1 command not received

Definition at line 329 of file lora_class.cpp.

int8_t Lora::wakeUp ( void  )

After the deepSleep the LoRa-module needs to be reconfigured, takes all the settings saved in mySettings and restores them

Returns
0 no error during reconfiguration
1 error during reconfiguration

Definition at line 258 of file lora_class.cpp.

Member Data Documentation

uint8_t Lora::gatewayID =2
private

Definition at line 19 of file lora_class.h.

Sensors::structSensors* Lora::localSensorStruct
private

Definition at line 16 of file lora_class.h.

struct Lora::loraSettings Lora::mySettings
uint8_t Lora::sendCommandToSleep =2
private

Definition at line 18 of file lora_class.h.

uint8_t Lora::sendDataCommand =1
private

Definition at line 17 of file lora_class.h.

uint8_t Lora::stringData[19]
private

Definition at line 15 of file lora_class.h.


The documentation for this class was generated from the following files: