Ares LoRa Serial Driver Core
Loading...
Searching...
No Matches
AresSerial Class Reference

#include <ares_lora_serial.hpp>

Public Member Functions

 AresSerial (const AresSerialConfigs &configs)
 ~AresSerial ()
int setting_set (uint16_t id, uint32_t value)
py::tuple setting_get (uint16_t id)
int send_start (int64_t sec, uint64_t nsec, uint16_t id, bool broadcast)
int lora_config (const AresLoraConfig &config)
void set_response_timeout (const std::chrono::milliseconds &timeout)
std::chrono::milliseconds get_response_timeout () const
py::tuple led (uint8_t id, uint8_t state)
int send_heartbeat (bool ready, uint8_t tx_cnt)
py::tuple send_log (const std::string &log_msg, bool broadcast, uint8_t tx_cnt, uint16_t id)
py::tuple version ()
void set_logging_level (uint32_t level)
void start ()
void stop ()

Detailed Description

Serial driver class for communicating with Ares LoRa devices.

Constructor & Destructor Documentation

◆ AresSerial()

AresSerial::AresSerial ( const AresSerialConfigs & configs)
explicit

Constructor.

Parameters
configsThe configurations for the driver.

◆ ~AresSerial()

AresSerial::~AresSerial ( )

Destructor. Automatically stops the driver and closes any serial connections.

Member Function Documentation

◆ get_response_timeout()

std::chrono::milliseconds AresSerial::get_response_timeout ( ) const
nodiscard

Retrieve the firmware response timeout.

Returns
The firmware response timeout.

◆ led()

py::tuple AresSerial::led ( uint8_t id,
uint8_t state )

Set or retrieve the LED state from firmware.

Parameters
idThe LED number/ID to set/fetch the state for.
stateThe new LED state for the firmware or a fetch state request.
Returns
py::tuple<Fetch LED state | Default LED state, ACK'ed error code>

◆ lora_config()

int AresSerial::lora_config ( const AresLoraConfig & config)

Configure the LoRa modem.

Parameters
configThe new LoRa modem configurations.
Returns
The ACK'ed error code from the firmware.

◆ send_heartbeat()

int AresSerial::send_heartbeat ( bool ready,
uint8_t tx_cnt )

Send a heartbeat message over the LoRa network.

Parameters
readyFlag indicating the system is ready to collect data.
tx_cntThe amount of times to transmit the heartbeat.
Returns
The ACK'ed error code from the firmware.

◆ send_log()

py::tuple AresSerial::send_log ( const std::string & log_msg,
bool broadcast,
uint8_t tx_cnt,
uint16_t id )

Send a logging message over the LoRa network.

Parameters
log_msgThe log message to send.
broadcastFlag indicating if the log message should be broadcasted.
tx_cntThe number of times to send the message or the max attempts.
idThe ID to direct the message to.
Returns
py::tuple<ACK'ed error code, ...>.
Note
If broadcast is true, id is ignored.
If broadcast is false, and id is 0, then id will be overridden to be the claimed master node. If there is no claimed master node, then the broadcast flag will be overridden to be true.
tx_cnt is the number of times the message is sent when broadcasting. If not broadcasting, it is the maximum number of attempts to exchange a logging message chunk with the destination node.

◆ send_start()

int AresSerial::send_start ( int64_t sec,
uint64_t nsec,
uint16_t id,
bool broadcast )

Send a start message over the LoRa network.

Parameters
secThe seconds part of the start time.
nsecThe nanoseconds part of the start time.
idThe ID to send the start message to. Ignored if broadcast is set.
broadcastBroadcast the start time to all the listening nodes.
Returns
The ACK'ed error code from firmware.

◆ set_logging_level()

void AresSerial::set_logging_level ( uint32_t level)

Set the logging level for the core module.

Parameters
levelThe new logging level.

◆ set_response_timeout()

void AresSerial::set_response_timeout ( const std::chrono::milliseconds & timeout)

Set the firmware response timeout.

Parameters
timeoutThe new response timeout.

◆ setting_get()

py::tuple AresSerial::setting_get ( uint16_t id)

Retrieve a setting configuration from firmware.

Parameters
idThe setting ID.
Returns
py::tuple<setting value, ACK'ed error code>

◆ setting_set()

int AresSerial::setting_set ( uint16_t id,
uint32_t value )

Configure a setting on firmware.

Parameters
idThe setting ID.
valueThe new value of the setting.
Returns
The ACK'ed error code from the firmware.

◆ start()

void AresSerial::start ( )

Start driver execution.

◆ stop()

void AresSerial::stop ( )

Stop driver execution.

◆ version()

py::tuple AresSerial::version ( )

Retrieve version information from the firmware.

Returns
py::tuple<app version tuple, ncs version tuple, kernel version tuple>

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