Loom 4 v4.5
Arduino library for Internet of Things Rapid Prototyping in environmental sensing
|
#include <Loom_Wifi.h>
Public Member Functions | |
Loom_WIFI (Manager &man, CommunicationMode mode, const char *name="", const char *password="", int connectionRetries=5) | |
Loom_WIFI (Manager &man) | |
void | loadConfigFromJSON (char *json) |
WiFiClient & | getClient () |
WiFiUDP * | getUDP () |
bool | verifyConnection () |
void | connect_to_network () |
void | start_ap () |
void | storeNewWiFiCreds (const char *name, const char *password) |
IPAddress | getIPAddress () |
IPAddress | getSubnetMask () |
IPAddress | getGateway () |
IPAddress | getBroadcast () |
bool | isConnected () |
void | useMax () |
void | setBatchSD (Loom_BatchSD &batch) |
void | setMaxRetries (int retries) |
void | ipToString (IPAddress ip, char array[16]) |
Public Member Functions inherited from Module | |
Module (const char *modName) | |
void | setModuleName (const char *modName) |
virtual const char * | getModuleName () |
virtual void | printModuleName (const char *message) |
virtual void | initialize ()=0 |
virtual void | measure ()=0 |
virtual void | package ()=0 |
virtual void | power_up ()=0 |
virtual void | power_down ()=0 |
virtual void | display_data () |
Protected Member Functions | |
void | measure () override |
void | initialize () override |
void | package () override |
void | power_up () override |
void | power_down () override |
Additional Inherited Members | |
Public Attributes inherited from Module | |
bool | moduleInitialized = true |
int | module_address = -1 |
WiFi 101 library integrated with the manager to allow for easy sleep
Loom_WIFI::Loom_WIFI | ( | Manager & | man, |
CommunicationMode | mode, | ||
const char * | name = "" , |
||
const char * | password = "" , |
||
int | connectionRetries = 5 |
||
) |
Construct a new WiFi Manager
man | Reference to the manager to control all aspects of every module |
mode | Whether or not to try to connect to an access point or create our own |
name | The name of the WiFi access point we are going to connect to |
password | The password (if applicable) to connect to the access point |
Loom_WIFI::Loom_WIFI | ( | Manager & | man | ) |
Construct a new WiFi manager, passing the credentials in as a json document
man | Reference to the manager |
jsonString | JSON string to pull the credentials from |
void Loom_WIFI::connect_to_network | ( | ) |
Connect to an already existing access point
IPAddress Loom_WIFI::getBroadcast | ( | ) |
Get the broadcast IP of the network
|
inline |
Returns a reference to the WifiClient
IPAddress Loom_WIFI::getGateway | ( | ) |
Get the gateway IP of the network
IPAddress Loom_WIFI::getIPAddress | ( | ) |
Get the IP address of the WiFi module
IPAddress Loom_WIFI::getSubnetMask | ( | ) |
Get the subnet mask of the connected network
|
inline |
Get a reference to the UDP communication handler
|
overrideprotectedvirtual |
Implements Module.
|
inline |
Convert an IP address to a string
bool Loom_WIFI::isConnected | ( | ) |
Return the current connection state of the WiFi module
void Loom_WIFI::loadConfigFromJSON | ( | char * | json | ) |
Load the Wifi credentials from a JSON string, used to pull credentials from a file
This automatically frees the input json
jsonString | JSON formatted string containing the SSID and password |
|
inlineoverrideprotectedvirtual |
Implements Module.
|
overrideprotectedvirtual |
Implements Module.
|
overrideprotectedvirtual |
Implements Module.
|
overrideprotectedvirtual |
Implements Module.
|
inline |
Set an instance of BatchSD to check if we need to power up
|
inline |
Set the number of connection retries
void Loom_WIFI::start_ap | ( | ) |
Create our own access point
|
inline |
Called by max to ignore WiFi verification requests
bool Loom_WIFI::verifyConnection | ( | ) |
Attempt to ping Google, this tests if we are truly connected to the internet