Loom_LoRa class
LoRa communication platform module.
Contents
Base classes
- class LoomCommPlat
- Abstract base of communication platform modules.
Protected variables
- RH_RF95 driver
- Underlying rf95 object.
- RHReliableDatagram manager
- Manager for driver.
- uint8_t address
- Device Address (should this be part of LoomCommPlat? – maybe not as each platform handles addresses differently)
- uint8_t power_level
- Power level to send at.
- uint8_t retry_count
- Number of transmission retries allowed.
- uint16_t retry_timeout
- Delay between transmission retries (in milliseconds)
RADIO IMPLEMENTATION
- auto receive_blocking_impl(JsonObject json, uint max_wait_time) -> bool protected override
- Receive, but block until packet received, or timeout reached.
- auto send_impl(JsonObject json, const uint8_t destination) -> bool protected override
- Send json to a specific address.
- auto send_raw(uint8_t* bytes, const uint8_t len, const uint8_t destination) -> bool
- Escape hatch for sending raw bytes.
- auto receive_blocking_raw(uint8_t* dest, const uint8_t maxlen, const uint max_wait_time) -> bool
- Escape hatch for receiving raw bytes.
CONSTRUCTORS / DESTRUCTOR
- Loom_LoRa(LoomManager* device_manager, const uint16_t max_message_len = RH_RF95_MAX_MESSAGE_LEN, const uint8_t address = 0, const uint8_t power_level = 23, const uint8_t retry_count = 3, const uint16_t retry_timeout = 200)
- LoRa module constructor.
- Loom_LoRa(LoomManager* device_manager, JsonArrayConst p)
- Constructor that takes Json Array, extracts args and delegates to regular constructor.
- ~Loom_LoRa() defaulted
- Destructor.
OPERATION
- void add_config(JsonObject json) override
- Add configuration information to JsonObject.
- void power_up() override
- Turn on any hardware.
- void power_down() override
- Turn off any hardware.
PRINT INFORMATION
- void print_config() const override
- Display the configuration settings of the module.
GETTERS
- auto get_address() const -> uint8_t override
- Get the address of this device.
SETTERS
- void set_address(const uint8_t a) override
- Set the address of this device.
Function documentation
bool Loom_ LoRa:: receive_blocking_impl(JsonObject json,
uint max_wait_time) override protected
Receive, but block until packet received, or timeout reached.
Parameters | |
---|---|
json out | Json object to fill with incoming data |
max_wait_time in | Maximum number of milliseconds to block for (can be zero for non-blocking) |
Returns | True if packet received |
bool Loom_ LoRa:: send_impl(JsonObject json,
const uint8_t destination) override protected
Send json to a specific address.
Parameters | |
---|---|
json in | Json package to send |
destination in | Device to send to |
Returns | True if packet sent successfully |
bool Loom_ LoRa:: send_raw(uint8_t* bytes,
const uint8_t len,
const uint8_t destination)
Escape hatch for sending raw bytes.
Parameters | |
---|---|
bytes | |
len in | Number of bytes to send (MUST be less than 251) |
destination in | Address of device to send to |
Returns | True if packet sent successfully |
bool Loom_ LoRa:: receive_blocking_raw(uint8_t* dest,
const uint8_t maxlen,
const uint max_wait_time)
Escape hatch for receiving raw bytes.
Parameters | |
---|---|
dest out | Pointer to byte array to store data |
maxlen in | Maximum length of packet that can be recieved |
max_wait_time in | Maximum number of milliseconds to block for |
Loom_ LoRa:: Loom_LoRa(LoomManager* device_manager,
const uint16_t max_message_len = RH_RF95_MAX_MESSAGE_LEN,
const uint8_t address = 0,
const uint8_t power_level = 23,
const uint8_t retry_count = 3,
const uint16_t retry_timeout = 200)
LoRa module constructor.
Parameters | |
---|---|
device_manager | |
max_message_len in | Set(Int) | <255> | {255("Max length")} | The maximum possible message length |
address in | Int | <01> | [0-99] | This device's LoRa address |
power_level in | Int | <23> | [5-23] | Transmission power level, low to high power |
retry_count in | Int | <3> | [0-15] | Max number of transmission retries |
retry_timeout in | Int | <200>| [20-500] | Delay between retransmissions (ms) |
Loom_ LoRa:: Loom_LoRa(LoomManager* device_manager,
JsonArrayConst p)
Constructor that takes Json Array, extracts args and delegates to regular constructor.
Parameters | |
---|---|
device_manager | |
p in | The array of constuctor args to expand |
void Loom_ LoRa:: add_config(JsonObject json) override
Add configuration information to JsonObject.
Parameters | |
---|---|
json in | Json configuration object to add to |
LoomManager iterates over modules to build complete configuration
uint8_t Loom_ LoRa:: get_address() const override
Get the address of this device.
Returns | The address of this device |
---|
Each platform may have a different addressing scheme
void Loom_ LoRa:: set_address(const uint8_t a) override
Set the address of this device.
Parameters | |
---|---|
a in | The address to set this device to |
Each platform may have a different addressing scheme. Changing the device's address is not recommended.