![]() |
Firmware for an ad-hoc mesh network of Internet-of-Things devices based on LoRa (Long Range radio) that can be deployed quickly and cheaply.
|
Internal LoRa chip abstraction. More...
#include <DuckLora.h>
Public Member Functions | |
int | setupLoRa (LoraConfigParams config, String deviceId) |
Initialize the LoRa chip. More... | |
int | handlePacket () |
Handle a Duck LoRa packet. More... | |
String | getPacketData (int pSize) |
Get the last received LoRa packet. More... | |
int | sendPayloadStandard (String msg="", String topic="", String senderId="", String messageId="", String path="") |
Send a message out into the LoRa mesh network. More... | |
Packet | getLastPacket () |
Get the last received LoRa packet. More... | |
void | couple (byte byteCode, String outgoing) |
Append a chunk to the packet. More... | |
bool | idInPath (String path) |
Determine if a Duck device_id is present in the path. More... | |
bool | loraPacketReceived () |
Check if a received packet is available for processing. More... | |
int | startReceive () |
Set the Duck to be ready to recieve LoRa packets. More... | |
int | transmitData () |
Set the Duck to be ready to transmit LoRa packets. More... | |
int | getRSSI () |
Get the current RSSI value. More... | |
void | resetPacketIndex () |
Reset the index of the received Packet buffer. More... | |
int | getPacketIndex () |
Get the current packet buffer index. More... | |
byte * | getTransmissionBuffer () |
Get the transmission buffer. More... | |
byte | getTransmitedByte (int index) |
Get the transmited byte at the given index in the transmission buffer. More... | |
int | ping () |
Transmit a ping message. More... | |
int | standBy () |
Set the LoRa chip in standby mode. More... | |
void | resetTransmissionBuffer () |
Clear and Reset the transmission buffer. More... | |
Static Public Member Functions | |
static DuckLora * | getInstance () |
Get a singletom instance of the DuckLora class,. More... | |
Internal LoRa chip abstraction.
Provides internal access to the LoRa chip driver. This class is used by other components of the CDP implementation.
void DuckLora::couple | ( | byte | byteCode, |
String | outgoing | ||
) |
Append a chunk to the packet.
A chunk is part of the Duck LoRa packet and is formated as [tag][length][payload] where a tag is a single byte identifying the chunk. Currently supported tags:
byteCode | identifies the tag to append |
outgoing | the payload for the tag to be appended to the LoRa packet |
|
static |
Packet DuckLora::getLastPacket | ( | ) |
Get the last received LoRa packet.
String DuckLora::getPacketData | ( | int | pSize | ) |
Get the last received LoRa packet.
pSize | size of the packet |
|
inline |
Get the current packet buffer index.
int DuckLora::getRSSI | ( | ) |
Get the current RSSI value.
|
inline |
Get the transmission buffer.
|
inline |
Get the transmited byte at the given index in the transmission buffer.
index | position in the transmission buffer |
int DuckLora::handlePacket | ( | ) |
Handle a Duck LoRa packet.
bool DuckLora::idInPath | ( | String | path | ) |
Determine if a Duck device_id is present in the path.
path | path retrieved from the LoRa packet |
bool DuckLora::loraPacketReceived | ( | ) |
Check if a received packet is available for processing.
int DuckLora::ping | ( | ) |
Transmit a ping message.
|
inline |
Reset the index of the received Packet buffer.
void DuckLora::resetTransmissionBuffer | ( | ) |
Clear and Reset the transmission buffer.
int DuckLora::sendPayloadStandard | ( | String | msg = "" , |
String | topic = "" , |
||
String | senderId = "" , |
||
String | messageId = "" , |
||
String | path = "" |
||
) |
Send a message out into the LoRa mesh network.
msg | payload representing the message |
topic | the message topic |
senderId | the device_id of the sender |
messageId | the id of the message |
path | a comma separated list of devide ids having seens the message |
int DuckLora::setupLoRa | ( | LoraConfigParams | config, |
String | deviceId | ||
) |
Initialize the LoRa chip.
config | lora configurstion parameters |
deviceId | device id |
int DuckLora::standBy | ( | ) |
Set the LoRa chip in standby mode.
int DuckLora::startReceive | ( | ) |
Set the Duck to be ready to recieve LoRa packets.
int DuckLora::transmitData | ( | ) |
Set the Duck to be ready to transmit LoRa packets.