MQTT Communication
Smart Factory
Network Class Reference

Handels the WLAN-Connection. More...

#include <Network.h>

Public Member Functions

 Network (String ssid, String password, int WIFI_CS, int WIFI_IRQ, int WIFI_RST, int WIFI_EN)
 Construct a new Network object. More...
 
void init ()
 Intitialize WLan-Hardware. More...
 
void connectToWiFi ()
 Connects to a WiFi with the given Credential. More...
 
void printNetworkInfo ()
 Prints all relevant Network-Information of the connected network to serial. More...
 

Private Member Functions

void printWiFiData ()
 Prints all relevant WiFi-Information of the connected network to serial. More...
 
void printCurrentNet ()
 Prints all relevant Information of the current Network. More...
 
void printMacAddress (byte mac[])
 Pritns Mac-address. More...
 
String decodeWiFistate (int errorcode)
 Decodes the Error Values from Wifi status() and returns a description. More...
 
String decodeEncryptionType (int errorcode)
 Construct a new decode Encryption Type object. More...
 

Private Attributes

String pSsid
 Contains the SSID the WiFi shield is currently connected to. More...
 
String pPassword
 Contains WiFi Password. More...
 
int pWifi_CS
 
int pWiFi_IRQ
 
int pWifi_RST
 
int pWifi_EN
 
IPAddress pIPLocal
 Contains own IP-Adress. More...
 
byte pMacRouter [6]
 Contains MAC Adress of the Router BSSID. More...
 
byte pMac [6]
 Contains own MAC Adress. More...
 
byte pEncryption
 value represents the type of encryption More...
 
long pRssi
 The current RSSI /Received Signal Strength in dBm. More...
 

Detailed Description

Handels the WLAN-Connection.

Definition at line 30 of file Network.h.

Constructor & Destructor Documentation

◆ Network()

Network::Network ( String  ssid,
String  password,
int  WIFI_CS,
int  WIFI_IRQ,
int  WIFI_RST,
int  WIFI_EN 
)

Construct a new Network object.

Parameters
ssid- SSID of the WLan you would like to connect
password- Password of the desired WLAN
WIFI_CS-
WIFI_IRQ-
WIFI_RST-
WIFI_EN-

Definition at line 17 of file Network.cpp.

Member Function Documentation

◆ connectToWiFi()

void Network::connectToWiFi ( )

Connects to a WiFi with the given Credential.

If the Shield isn't already connected a new connection will be established If the Connection fails then there will be a 3 Sec dealy. https://www.arduino.cc/en/Tutorial/Wifi101ConnectWithWPA

Definition at line 40 of file Network.cpp.

◆ decodeEncryptionType()

String Network::decodeEncryptionType ( int  errorcode)
private

Construct a new decode Encryption Type object.

https://www.arduino.cc/en/Reference/WiFi101EncryptionType

2 = TKIP (WPA)
5 = WEP
4 = CCMP (WPA)
7 = NONE
8 = AUTO

Parameters
errorcode- errorvalue from wifi101
Returns
String - Errordescription

Definition at line 152 of file Network.cpp.

◆ decodeWiFistate()

String Network::decodeWiFistate ( int  errorcode)
private

Decodes the Error Values from Wifi status() and returns a description.

Parameters
errorcode- errorvalue from wifi101
Returns
String - Errordescription

Definition at line 118 of file Network.cpp.

◆ init()

void Network::init ( )

Intitialize WLan-Hardware.

Sets Pins from Communication-Config file and checks if a WiFi-Shield is present. If not the programm stops else it calls connectToWiFi()

Definition at line 25 of file Network.cpp.

◆ printCurrentNet()

void Network::printCurrentNet ( )
private

Prints all relevant Information of the current Network.

SSID, BSSID, RSSI and encryptionType

Definition at line 85 of file Network.cpp.

◆ printMacAddress()

void Network::printMacAddress ( byte  mac[])
private

Pritns Mac-address.

Parameters
mac-

Definition at line 105 of file Network.cpp.

◆ printNetworkInfo()

void Network::printNetworkInfo ( )

Prints all relevant Network-Information of the connected network to serial.

IP-Address, MAC address (printWiFiData) SSID, BSSID, RSSI and encryptionType (printCurrentNet)

Definition at line 64 of file Network.cpp.

◆ printWiFiData()

void Network::printWiFiData ( )
private

Prints all relevant WiFi-Information of the connected network to serial.

IP-Address, MAC address

Definition at line 72 of file Network.cpp.

Member Data Documentation

◆ pEncryption

byte Network::pEncryption
private

value represents the type of encryption

Definition at line 132 of file Network.h.

◆ pIPLocal

IPAddress Network::pIPLocal
private

Contains own IP-Adress.

Definition at line 129 of file Network.h.

◆ pMac

byte Network::pMac[6]
private

Contains own MAC Adress.

Definition at line 131 of file Network.h.

◆ pMacRouter

byte Network::pMacRouter[6]
private

Contains MAC Adress of the Router BSSID.

Definition at line 130 of file Network.h.

◆ pPassword

String Network::pPassword
private

Contains WiFi Password.

Definition at line 124 of file Network.h.

◆ pRssi

long Network::pRssi
private

The current RSSI /Received Signal Strength in dBm.

-30 dBm Maximum signal strength, you are probably standing right next to the access point.
-50 dBm Anything down to this level can be considered excellent signal strength.
-60 dBm Good, reliable signal strength.
-67 dBm Reliable signal strength. The minimum for any service depending on a reliable connection and signal strength, such as voice over Wi-Fi and non-HD video streaming.
-70 dBm Not a strong signal. Light browsing and email.
-80 dBm Unreliable signal strength, will not suffice for most services. Connecting to the network.
-90 dBm The chances of even connecting are very low at this level.
Source https://eyesaas.com/wi-fi-signal-strength/

Definition at line 146 of file Network.h.

◆ pSsid

String Network::pSsid
private

Contains the SSID the WiFi shield is currently connected to.

Definition at line 123 of file Network.h.

◆ pWifi_CS

int Network::pWifi_CS
private

Definition at line 125 of file Network.h.

◆ pWifi_EN

int Network::pWifi_EN
private

Definition at line 128 of file Network.h.

◆ pWiFi_IRQ

int Network::pWiFi_IRQ
private

Definition at line 126 of file Network.h.

◆ pWifi_RST

int Network::pWifi_RST
private

Definition at line 127 of file Network.h.


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