ClusterDuck Protocol
Public Types | Public Member Functions | List of all members
PapaDuck Class Reference
Inheritance diagram for PapaDuck:
Duck

Public Types

using callbackFunc = void(*)(Packet)
 Papa Duck callback function signature.
 

Public Member Functions

void onReceiveDuckData (callbackFunc cb)
 Register callback for handling data received from duck devices. More...
 
void run ()
 Provide the PapaDuck specific implementation of the base run() method.
 
void setupWithDefaults (String ssid="", String password="")
 Override the default setup method to match MamaDuck specific defaults. More...
 
int reconnectWifi (String ssid, String password)
 Reconnect the device's WiFi access point. More...
 
 Duck ()
 Construct a new Duck object.
 
 Duck (String id)
 Construct a new Duck object. More...
 
- Public Member Functions inherited from Duck
 Duck ()
 Construct a new Duck object.
 
 Duck (String id)
 Construct a new Duck object. More...
 
void setupSerial (int baudRate=115200)
 Setup serial connection. More...
 
void setupRadio (float band=CDPCFG_RF_LORA_FREQ, int ss=CDPCFG_PIN_LORA_CS, int rst=CDPCFG_PIN_LORA_RST, int di0=CDPCFG_PIN_LORA_DIO0, int di1=CDPCFG_PIN_LORA_DIO1, int txPower=CDPCFG_RF_LORA_TXPOW)
 Setup the radio component. More...
 
void setupWifi (const char *ap="🆘 DUCK EMERGENCY PORTAL")
 Setup WiFi access point. More...
 
int setupDns ()
 Setup DNS. More...
 
void setupWebServer (bool createCaptivePortal=false, String html="")
 Setup web server. More...
 
void setupInternet (String ssid, String password)
 Setup internet access. More...
 
void setupOTA ()
 
int sendPayloadStandard (String msg="", String topic="", String senderId="", String messageId="", String path="")
 Send a duck LoRa message. More...
 
bool isWifiConnected ()
 Check wifi connection status. More...
 
bool ssidAvailable (String ssid)
 Check if the give access point is available. More...
 
String getSsid ()
 Get the access point ssid. More...
 
String getPassword ()
 Get the wifi access point password. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Duck
int startReceive ()
 Tell the duck radio to start receiving packets from the mesh network. More...
 
int startTransmit ()
 Tell the duck radio to start receiving packets from the mesh network. More...
 
void processPortalRequest ()
 Handle request from emergency portal.
 
void handleOtaUpdate ()
 Handle over the air firmware update.
 
- Static Protected Member Functions inherited from Duck
static void toggleReceiveFlag ()
 
static void setReceiveFlag (bool value)
 
static bool getReceiveFlag ()
 
static void onPacketReceived ()
 
static bool imAlive (void *)
 
static bool reboot (void *)
 
- Protected Attributes inherited from Duck
String deviceId
 
DuckLoraduckLora = DuckLora::getInstance()
 
DuckNetduckNet = DuckNet::getInstance()
 
- Static Protected Attributes inherited from Duck
static volatile bool receivedFlag = false
 

Member Function Documentation

◆ Duck()

Duck::Duck

Construct a new Duck object.

Parameters
ida unique id

◆ onReceiveDuckData()

void PapaDuck::onReceiveDuckData ( callbackFunc  cb)
inline

Register callback for handling data received from duck devices.

Parameters
cba callback to handle data received by the papa duck

◆ reconnectWifi()

int PapaDuck::reconnectWifi ( String  ssid,
String  password 
)
virtual

Reconnect the device's WiFi access point.

Allows a Wifi capable device to reconnect the wifi access point if it is lost.

Parameters
ssid
password
Returns
DUCK_ERR_NONE if the reconnection is successful, an error code otherwise.

Reimplemented from Duck.

◆ setupWithDefaults()

void PapaDuck::setupWithDefaults ( String  ssid = "",
String  password = "" 
)
virtual

Override the default setup method to match MamaDuck specific defaults.

In addition to Serial component, the Radio component is also initialized. When ssid and password are provided the duck will setup the wifi related components.

Parameters
ssidwifi access point ssid (defaults to an empty string if not provided)
passwordwifi password (defaults to an empty string if not provided)

Reimplemented from Duck.


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