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.
DuckNet Class Reference

Internal network abstraction. More...

#include <DuckNet.h>

Public Member Functions

void setupWebServer (bool createCaptivePortal=false, String html="")
 Set up the WebServer. More...
 
void setupWifiAp (const char *accessPoint="🆘 DUCK EMERGENCY PORTAL")
 Set up the WiFi access point. More...
 
int setupDns ()
 Set up DNS. More...
 
void setupInternet (String ssid, String password)
 Set up internet access. More...
 
bool ssidAvailable (String val="")
 Checks if the given ssid is available. More...
 
void setSsid (String val)
 Set the WiFi network ssid. More...
 
void setPassword (String val)
 Set the WiFi password. More...
 
String getSsid ()
 Get the WiFi network ssid. More...
 
String getPassword ()
 Get the WiFi password ssid. More...
 
void setDeviceId (String deviceId)
 Set the Duck's device id. More...
 
bool isWifiConnected ()
 Provide Wifi connection status. More...
 

Static Public Member Functions

static DuckNetgetInstance ()
 Get a singletom instance of the DuckNet class. More...
 

Static Public Attributes

static DNSServer dnsServer
 

Detailed Description

Internal network abstraction.

Provides access to Webserver, DNS, WiFi and OTA update functionalities.

Member Function Documentation

◆ getInstance()

static DuckNet* DuckNet::getInstance ( )
static

Get a singletom instance of the DuckNet class.

Returns
A pointer to DuckNet object.

◆ getPassword()

String DuckNet::getPassword ( )

Get the WiFi password ssid.

Returns
a string representing the current network password

◆ getSsid()

String DuckNet::getSsid ( )

Get the WiFi network ssid.

Returns
a string representing the current network ssid

◆ isWifiConnected()

bool DuckNet::isWifiConnected ( )
inline

Provide Wifi connection status.

Returns
true if wifi is connected, false otherwise.

◆ setDeviceId()

void DuckNet::setDeviceId ( String  deviceId)

Set the Duck's device id.

Parameters
deviceIdDuck's device ID string to set

◆ setPassword()

void DuckNet::setPassword ( String  val)

Set the WiFi password.

Parameters
valthe password string to set

◆ setSsid()

void DuckNet::setSsid ( String  val)

Set the WiFi network ssid.

Parameters
valthe ssid string to set

◆ setupDns()

int DuckNet::setupDns ( )

Set up DNS.

Returns
DUCK_ERR_NONE if sucessful, an error code otherwise

◆ setupInternet()

void DuckNet::setupInternet ( String  ssid,
String  password 
)

Set up internet access.

Parameters
ssidthe ssid of the WiFi network
passwordpassword to join the network

◆ setupWebServer()

void DuckNet::setupWebServer ( bool  createCaptivePortal = false,
String  html = "" 
)

Set up the WebServer.

The WebServer is used to communicate with the Duck over ad-hoc WiFi connection.

Parameters
createCaptivePortalset to true if Captive WiFi connection is needed. Defaults to false
htmlA string representing custom HTML code used for the portal. Default is an empty string Default portal web page is used if the string is empty

◆ setupWifiAp()

void DuckNet::setupWifiAp ( const char *  accessPoint = "🆘 DUCK EMERGENCY PORTAL")

Set up the WiFi access point.

Parameters
accessPointa string representing the access point. Default to "🆘 DUCK EMERGENCY PORTAL"

◆ ssidAvailable()

bool DuckNet::ssidAvailable ( String  val = "")

Checks if the given ssid is available.

Parameters
valssid to check, default is an empty string and will use the internal default ssid
Returns
true if the ssid is available, false otherwise.

Member Data Documentation

◆ dnsServer

DNSServer DuckNet::dnsServer
static

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