diff --git a/Network.cpp b/Network.cpp new file mode 100644 index 0000000..c41c3b1 --- /dev/null +++ b/Network.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2017 by Lieven De Samblanx ON7LDS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "Network.h" +#include "Log.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + + +void CNetworkInfo::getNetworkInterface(unsigned char* info) +{ +#define IFLISTSIZ 25 + + LogInfo("Interfaces Info"); + struct ifaddrs *ifaddr, *ifa; + int family, s, n, ifnr; + char host[NI_MAXHOST]; + char text[50+INET6_ADDRSTRLEN]; + char interfacelist[IFLISTSIZ][50+INET6_ADDRSTRLEN]; + char *p; + + strcpy(text,"(interface lookup failed)"); + for(n=0;nifa_next, n++) { + if (ifa->ifa_addr == NULL) + continue; + + family = ifa->ifa_addr->sa_family; + + if (family == AF_INET || family == AF_INET6) { + s = getnameinfo(ifa->ifa_addr, + (family == AF_INET) ? sizeof(struct sockaddr_in) : + sizeof(struct sockaddr_in6), + host, NI_MAXHOST, + NULL, 0, NI_NUMERICHOST); + if (s != 0) { + LogInfo("getnameinfo() failed: %s\n", gai_strerror(s)); + continue; + } + if (family == AF_INET) { + sprintf(interfacelist[ifnr], "%s: %s", ifa->ifa_name,host); + LogInfo(" IPv4: %s", interfacelist[ifnr] ); + } else { + sprintf(interfacelist[ifnr], "%s: %s", ifa->ifa_name,host); + LogInfo(" IPv6: %s", interfacelist[ifnr] ); + } + ifnr++; + } + } + freeifaddrs(ifaddr); + for(n=0;n<(ifnr);n++) { + p=strchr(interfacelist[n],'%'); + if (p!=NULL) *p=0; + if (strstr(interfacelist[n],"lo")==NULL) { + strcpy((char*)info,interfacelist[n]); + break; + } + } + LogInfo(" IP to show: %s", info ); + } +} + diff --git a/Network.h b/Network.h new file mode 100644 index 0000000..0d639b6 --- /dev/null +++ b/Network.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2017 by Lieven De Samblanx ON7LDS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#if !defined(NETWORK_H) +#define NETWORK_H + + +class CNetworkInfo { +public: + + void getNetworkInterface(unsigned char* info); + + +}; + +#endif diff --git a/Nextion_ON7LDS/NEXTION_V106_HOR24_ON7LDS.tft b/Nextion_ON7LDS/NEXTION_V106_HOR24_ON7LDS.tft new file mode 100644 index 0000000..64a6e50 Binary files /dev/null and b/Nextion_ON7LDS/NEXTION_V106_HOR24_ON7LDS.tft differ diff --git a/Nextion_ON7LDS/NEXTION_V106_HOR28_ON7LDS.tft b/Nextion_ON7LDS/NEXTION_V106_HOR28_ON7LDS.tft new file mode 100644 index 0000000..fe3e4c2 Binary files /dev/null and b/Nextion_ON7LDS/NEXTION_V106_HOR28_ON7LDS.tft differ diff --git a/Nextion_ON7LDS/NEXTION_V106_HOR32_ON7LDS.tft b/Nextion_ON7LDS/NEXTION_V106_HOR32_ON7LDS.tft new file mode 100644 index 0000000..9e1ca79 Binary files /dev/null and b/Nextion_ON7LDS/NEXTION_V106_HOR32_ON7LDS.tft differ diff --git a/Nextion_ON7LDS/NEXTION_V106_HOR35_ON7LDS.tft b/Nextion_ON7LDS/NEXTION_V106_HOR35_ON7LDS.tft new file mode 100644 index 0000000..6a7e3b9 Binary files /dev/null and b/Nextion_ON7LDS/NEXTION_V106_HOR35_ON7LDS.tft differ