BresserWeatherSensorLW
Bresser 868 MHz Weather Sensor Radio Receiver based on ESP32/RP2040 and SX1262/SX1276/LR1121 - sends data to a LoRaWAN Network
Loading...
Searching...
No Matches
AppLayer Class Reference

LoRaWAN node application layer. More...

#include <AppLayer.h>

Inheritance diagram for AppLayer:
Collaboration diagram for AppLayer:

Public Member Functions

 AppLayer (SystemContext *sysCtx)
 Constructor.
void begin (void)
 AppLayer initialization.
uint8_t decodeDownlink (uint8_t port, uint8_t *payload, size_t size)
 Decode app layer specific downlink messages.
void genPayload (uint8_t port, LoraEncoder &encoder)
 Generate payload (by emulation).
void getPayloadStage1 (uint8_t &port, LoraEncoder &encoder)
 Prepare / get payload at startup.
void getPayloadStage2 (uint8_t &port, LoraEncoder &encoder)
 Get payload before uplink.
void getConfigPayload (uint8_t cmd, uint8_t &port, LoraEncoder &encoder)
 Get configuration data for uplink.
uint8_t getAppStatusUplinkInterval (void)
 Get sensor status message uplink interval.
void setAppPayloadCfg (uint8_t *bytes, uint8_t size)
bool getAppPayloadCfg (uint8_t *bytes, uint8_t size)
Public Member Functions inherited from PayloadBresser
 PayloadBresser (SystemContext *sysCtx)
 Constructor.
void begin (void)
 Bresser sensors startup code.
void scanBresser (uint8_t ws_scantime, LoraEncoder &encoder)
 Scan for Bresser sensors.
void encodeBresser (uint8_t *appPayloadCfg, uint8_t *appStatus, LoraEncoder &encoder)
 Encode Bresser sensor data for LoRaWAN transmission.

Additional Inherited Members

Public Attributes inherited from PayloadBresser
WeatherSensor weatherSensor
 Bresser Weather Sensor Receiver.
uint8_t ws_scantime = 0
 Weather Sensor Scan Request.
uint8_t ws_postproc_interval = 0
 Weather Sensor Post-Processing Update Rate (0: auto, 1..255: minutes).
const uint8_t payloadSize [16]
 Payload size in bytes per sensor type.
const char * sensorTypes [16]
 Map sensor type ID to name.
RainGauge rainGauge
 Rain data statistics.
Lightning lightningProc
 Lightning sensor post-processing.

Detailed Description

LoRaWAN node application layer.

Contains all device specific methods and attributes

Constructor & Destructor Documentation

◆ AppLayer()

AppLayer::AppLayer ( SystemContext * sysCtx)
inline

Constructor.

Parameters
sysCtxSystem Context object
Here is the call graph for this function:

Member Function Documentation

◆ decodeDownlink()

uint8_t AppLayer::decodeDownlink ( uint8_t port,
uint8_t * payload,
size_t size )

Decode app layer specific downlink messages.

Parameters
portdownlink message port
payloaddownlink message payload
sizepayload size in bytes
Returns
config uplink request or 0
Here is the call graph for this function:

◆ genPayload()

void AppLayer::genPayload ( uint8_t port,
LoraEncoder & encoder )

Generate payload (by emulation).

Parameters
portLoRaWAN port
encoderuplink encoder object

◆ getAppPayloadCfg()

bool AppLayer::getAppPayloadCfg ( uint8_t * bytes,
uint8_t size )

Get AppLayer payload config from Preferences

Parameters
bytesbuffer
sizebuffer size in bytes
Returns
true if available in Preferences, else false

◆ getAppStatusUplinkInterval()

uint8_t AppLayer::getAppStatusUplinkInterval ( void )
inline

Get sensor status message uplink interval.

Returns
status uplink interval in frame counts (0: disabled)

◆ getConfigPayload()

void AppLayer::getConfigPayload ( uint8_t cmd,
uint8_t & port,
LoraEncoder & encoder )

Get configuration data for uplink.

Get the configuration data requested in a downlink command and prepare it as payload in an uplink response.

Parameters
cmdcommand
portuplink port
encoderuplink data encoder object
Here is the call graph for this function:

◆ getPayloadStage1()

void AppLayer::getPayloadStage1 ( uint8_t & port,
LoraEncoder & encoder )

Prepare / get payload at startup.

Use this if

  • A sensor needs some time for warm-up or data acquisition
  • The data acquisition has to be done directly after startup
  • The radio transceiver is used for sensor communication before starting LoRaWAN activities.
Parameters
portLoRaWAN port
encoderuplink encoder object
Here is the call graph for this function:

◆ getPayloadStage2()

void AppLayer::getPayloadStage2 ( uint8_t & port,
LoraEncoder & encoder )

Get payload before uplink.

Use this if

  • The radio transceiver is NOT used for sensor communication
  • The sensor preparation has been started in stage1
  • The data aquistion has to be done immediately before uplink
Parameters
portLoRaWAN port
encoderuplink encoder object

◆ setAppPayloadCfg()

void AppLayer::setAppPayloadCfg ( uint8_t * bytes,
uint8_t size )

Set AppLayer payload config in Preferences

Parameters
bytesbuffer
sizebuffer size in bytes

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