Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adde methods to se if static IP addresses were configured, and what those addresses are #1720

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions WiFiManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2783,6 +2783,61 @@ void WiFiManager::setSTAStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn,
_sta_static_dns = dns;
}

/**
* [isStaticIp description]
* @access public
* @param {[type]} void
* @return bool true if static network configuration was configured, false if DHCP was configured
* provides static or dhcp network configuration
*/
bool WiFiManager::isStaticIp(void) {
return _sta_static_ip ? true : false;
}

/**
* [getStaticIp description]
* @access public
* @param {[type]} IPAddress* staticIp
* @return void
* provides static host ip address provided method isStaticIp() returns true
*/
void WiFiManager::getStaticIp(IPAddress* staticIp) {
*staticIp = _sta_static_ip;
}

/**
* [getStaticGw description]
* @access public
* @param {[type]} IPAddress* staticGw
* @return void
* provides static gateway ip address provided method isStaticIp() returns true
*/
void WiFiManager::getStaticGw(IPAddress* staticGw) {
*staticGw = _sta_static_gw;
}

/**
* [getStaticSn description]
* @access public
* @param {[type]} IPAddress* staticSn
* @return void
* provides static host network mask provided method isStaticIp() returns true
*/
void WiFiManager::getStaticSn(IPAddress* staticSn) {
*staticSn = _sta_static_sn;
}

/**
* [getStaticDns description]
* @access public
* @param {[type]} IPAddress* staticDns
* @return void
* provides static dns address provided method isStaticIp() returns true
*/
void WiFiManager::getStaticDns(IPAddress* staticDns) {
*staticDns = _sta_static_dns;
}

/**
* [setMinimumSignalQuality description]
* @access public
Expand Down
17 changes: 16 additions & 1 deletion WiFiManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,24 @@ class WiFiManager

//sets config for a static IP
void setSTAStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn);

//sets config for a static IP with DNS
void setSTAStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn, IPAddress dns);

//check if static network configuration is set
bool isStaticIp(void);

//provides static host ip address provided method isStaticIp() returns true
void getStaticIp(IPAddress* staticIp);

//provides static gateway ip address provided method isStaticIp() returns true
void getStaticGw(IPAddress* staticGw);

//provides static network mask provided method isStaticIp() returns true
void getStaticSn(IPAddress* staticSn);

//provides static DNS ip address provided method isStaticIp() returns true
void getStaticDns(IPAddress* staticDns);

//if this is set, it will exit after config, even if connection is unsuccessful.
void setBreakAfterConfig(boolean shouldBreak);
Expand Down