ACKme Logo WiConnect Host Library- API Reference Guide
 
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
NetworkInterface.h
1 
29 #pragma once
30 
31 
32 #include "WiconnectTypes.h"
33 #include "types/ScanResultList.h"
34 
35 
36 namespace wiconnect {
37 
38 
50 {
51 public:
75  WiconnectResult startWebSetup(const char *ssid = NULL, const char *password = NULL, const Callback &completeHandler = Callback());
76 
89 
100  WiconnectResult isWebSetupRunning(bool *isRunningPtr);
101 
102 
103  // ------------------------------------------------------------------------
104 
105 
136  WiconnectResult join(const char* ssid = NULL, const char *password = NULL, const Callback &completeHandler = Callback());
137 
149 
161 
173 
174  // ------------------------------------------------------------------------
175 
176 
177 // WiconnectResult startSoftAp(const char* ssid = NULL, const char *password = NULL, const Callback &clientConnectedCallback = Callback());
178 // WiconnectResult stopSoftAp();
179 // WiconnectResult getSoftApClientList();
180 
181 
182  // ------------------------------------------------------------------------
183 
184 
203  WiconnectResult scan(ScanResultList &resultList, const uint8_t *channelList = NULL, const char* ssid = NULL);
204 
218  WiconnectResult ping(const char *domain = NULL, uint32_t *timeMsPtr = NULL);
219 
229  WiconnectResult lookup(const char *domain, uint32_t *ipAddressPtr);
230 
231 
232  // ------------------------------------------------------------------------
233 
234 
242  WiconnectResult setDhcpEnabled(bool enabled);
243 
249  WiconnectResult getDhcpEnabled(bool *enabledPtr);
250 
256  WiconnectResult setIpSettings(uint32_t ip, uint32_t netmask, uint32_t gateway);
257 
263  WiconnectResult setIpSettings(const char* ip, const char* netmask, const char* gateway);
264 
270  WiconnectResult getIpSettings(uint32_t *ip, uint32_t *netmask, uint32_t *gateway);
271 
278 
279 
290  const char* getIpAddress(char *buffer = NULL);
291 
292 
293  // ------------------------------------------------------------------------
294 
295 
301  static bool strToIp(const char *str, uint32_t *intPtr);
302 
308  static const char* ipToStr(uint32_t ip, char *ipStrBuffer = NULL);
309 
315  static const char* networkStatusToStr(NetworkStatus status);
316 
322  static const char* networkJoinResultToStr(NetworkJoinResult joinResult);
323 
329  static const char* signalStrengthToStr(NetworkSignalStrength signalStrenth);
330 
337 
343  static NetworkSecurity strToNetworkSecurity(const char *str);
344 
350  static const char* networkSecurityToStr(NetworkSecurity security);
351 
357  static bool strToSsid(const char *str, Ssid *ssid);
358 
364  static const char* ssidToStr(const Ssid *ssid, char *ssidStrBuffer = NULL);
365 
371  static bool strToMacAddress(const char *str, MacAddress *macAddress);
372 
378  static const char* macAddressToStr(const MacAddress *macAddress, char *macStrBuffer = NULL);
379 
380 protected:
381  NetworkInterface(Wiconnect *wiconnect);
382 
383  WiconnectResult processScanResults(char *resultStr, ScanResultList &resultList);
384 
385 #ifdef WICONNECT_ASYNC_TIMER_ENABLED
386  Callback completeHandler;
387  PeriodicTimer monitorTimer;
388 
389  void webSetupStatusMonitor();
390  void webSetupStatusCheckCallback(WiconnectResult result, void *arg1, void *arg2);
391 
392  void joinStatusMonitor();
393  void joinStatusCheckCallback(WiconnectResult result, void *arg1, void *arg2);
394 
395  //void scanCompleteCallback(WiconnectResult result, void *arg1, void *arg2);
396 #endif
397 
398 private:
399  Wiconnect *wiconnect;
400 };
401 
402 }
WiconnectResult getDhcpEnabled(bool *enabledPtr)
Get if DHCP enabled.
NetworkSecurity
Network security type.
The provides an interface for joining and/or creating a network. It provides other utilities such as ...
WiconnectResult getIpSettings(uint32_t *ip, uint32_t *netmask, uint32_t *gateway)
Get network IP settings.
WiconnectResult
API Result code.
Generic callback function.
Definition: Callback.h:49
WiconnectResult setIpSettings(uint32_t ip, uint32_t netmask, uint32_t gateway)
Set static IP settings.
static const char * networkJoinResultToStr(NetworkJoinResult joinResult)
Convert NetworkJoinResult to string.
static const char * networkSecurityToStr(NetworkSecurity security)
Convert NetworkSecurity to string.
static NetworkSecurity strToNetworkSecurity(const char *str)
Convert string to NetworkSecurity.
Network MAC Address type.
WiconnectResult startWebSetup(const char *ssid=NULL, const char *password=NULL, const Callback &completeHandler=Callback())
Start the WiConnect WiFi module 'web setup' feature.
WiconnectResult ping(const char *domain=NULL, uint32_t *timeMsPtr=NULL)
Ping a WiFi network.
static bool strToIp(const char *str, uint32_t *intPtr)
Convert string to IP address.
const char * getIpAddress(char *buffer=NULL)
Return the current IP address of the module if possible, else return 0.0.0.0.
static const char * networkStatusToStr(NetworkStatus status)
Convert NetworkStatus to string.
WiconnectResult isWebSetupRunning(bool *isRunningPtr)
Return status of WiConnect WiFi module 'web setup' feature.
WiconnectResult getSignalStrength(NetworkSignalStrength *signalStrengthPtr)
Get signal strength to WiFi network.
WiconnectResult setDhcpEnabled(bool enabled)
Set DHCP enabled.
WiconnectResult leave()
Leave a WiFi network.
NetworkSignalStrength
Network RSSI signal level.
static bool strToMacAddress(const char *str, MacAddress *macAddress)
Convert string MacAddress.
WiconnectResult scan(ScanResultList &resultList, const uint8_t *channelList=NULL, const char *ssid=NULL)
Scan for available WiFi networks.
Network SSID type.
NetworkJoinResult
Network connection status.
WiconnectResult getNetworkJoinResult(NetworkJoinResult *joinResultPtr)
Get the result of joining the network.
static const char * macAddressToStr(const MacAddress *macAddress, char *macStrBuffer=NULL)
Convert MacAddress to string.
List of WiFi network scan results.
static const char * signalStrengthToStr(NetworkSignalStrength signalStrenth)
Convert NetworkSignalStrength to string.
WiconnectResult getNetworkStatus(NetworkStatus *statusPtr)
Get connection status to WiFi network.
static bool strToSsid(const char *str, Ssid *ssid)
Convert string Ssid.
The root WiConnect library class. This class inheriets all WiConnect functionality.
static NetworkSignalStrength rssiToSignalStrength(int rssi)
Convert RSSI (in dBm) to NetworkSignalStrength.
WiconnectResult lookup(const char *domain, uint32_t *ipAddressPtr)
Resolve domain name into IP address.
static const char * ssidToStr(const Ssid *ssid, char *ssidStrBuffer=NULL)
Convert Ssid to string.
WiconnectResult stopWebSetup()
Stop the WiConnect WiFi module 'web setup' feature.
NetworkStatus
Network connection status.
WiconnectResult join(const char *ssid=NULL, const char *password=NULL, const Callback &completeHandler=Callback())
Join a WiFi network.
static const char * ipToStr(uint32_t ip, char *ipStrBuffer=NULL)
Convert IP address to string.