dunno, changes and stuff
This commit is contained in:
51
net/IP.h
51
net/IP.h
@@ -5,7 +5,8 @@
|
||||
|
||||
#define Port uint16_t
|
||||
|
||||
#if ESP8266
|
||||
|
||||
#if OLD_IS_ESP8266 // RAW
|
||||
|
||||
struct IP4 {
|
||||
|
||||
@@ -13,17 +14,17 @@
|
||||
ip_addr_t addr;
|
||||
|
||||
/** empty ctor */
|
||||
explicit IP4() {
|
||||
explicit IP4() {
|
||||
addr.addr = 0;
|
||||
}
|
||||
|
||||
/** ctor with IP-string */
|
||||
explicit IP4(const char* ipStr) {
|
||||
explicit IP4(const char* ipStr) {
|
||||
set(ipStr);
|
||||
}
|
||||
|
||||
/** ctor with ip_addr_t */
|
||||
explicit IP4(ip_addr addr) : addr(addr) {
|
||||
explicit IP4(ip_addr addr) : addr(addr) {
|
||||
;
|
||||
}
|
||||
|
||||
@@ -47,7 +48,47 @@
|
||||
|
||||
};
|
||||
|
||||
#elif ESP32
|
||||
#elif IS_ESP8266 // freeRTOS
|
||||
|
||||
#include <lwip/ip.h>
|
||||
|
||||
struct IP4 {
|
||||
|
||||
ip4_addr addr;
|
||||
|
||||
/** empty ctor */
|
||||
explicit IP4() {
|
||||
addr.addr = 0;
|
||||
}
|
||||
|
||||
/** ctor with IP-string */
|
||||
explicit IP4(const char* ipStr) {
|
||||
set(ipStr);
|
||||
}
|
||||
|
||||
/** ctor with ip4_addr */
|
||||
explicit IP4(ip4_addr _addr) {
|
||||
addr =_addr;
|
||||
}
|
||||
|
||||
/** set the IP by string: x.x.x.x */
|
||||
void set(const char* ipStr) {
|
||||
ip4addr_aton(ipStr, &addr);
|
||||
}
|
||||
|
||||
/** convert to ip_addr/ip_addr_t */
|
||||
const ip_addr_t* getPtr() const {
|
||||
return &addr;
|
||||
}
|
||||
|
||||
/** convert to string */
|
||||
const char* toString() const {
|
||||
return ipaddr_ntoa(&addr);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#elif IS_ESP32
|
||||
|
||||
#include <lwip/ip.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user