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 "api/types/ScanResultList.h"
34 
35 
36 namespace wiconnect {
37 
38 
39 #ifdef WICONNECT_USE_DEFAULT_STRING_BUFFERS
40 #define ALLOW_NULL_STRING_BUFFER = NULL
41 #else
42 #define ALLOW_NULL_STRING_BUFFER
43 #endif
44 
56 {
57 public:
81  WiconnectResult startWebSetup(const char *ssid = NULL, const char *password = NULL, const Callback &completeHandler = Callback());
82 
95 
106  WiconnectResult isWebSetupRunning(bool *isRunningPtr);
107 
108 
109  // ------------------------------------------------------------------------
110 
111 
142  WiconnectResult join(const char* ssid = NULL, const char *password = NULL, const Callback &completeHandler = Callback());
143 
155 
167 
179 
186 
192  WiconnectResult getRssi(int32_t *rssiPtr);
193 
200 
201 
202  // ------------------------------------------------------------------------
203 
204 
205 // WiconnectResult startSoftAp(const char* ssid = NULL, const char *password = NULL, const Callback &clientConnectedCallback = Callback());
206 // WiconnectResult stopSoftAp();
207 // WiconnectResult getSoftApClientList();
208 
209 
210  // ------------------------------------------------------------------------
211 
212 
231  WiconnectResult scan(ScanResultList &resultList, const uint8_t *channelList = NULL, const char* ssid = NULL);
232 
246  WiconnectResult ping(const char *domain = NULL, uint32_t *timeMsPtr = NULL);
247 
257  WiconnectResult lookup(const char *domain, uint32_t *ipAddressPtr);
258 
259 
260  // ------------------------------------------------------------------------
261 
262 
270  WiconnectResult setDhcpEnabled(bool enabled);
271 
277  WiconnectResult getDhcpEnabled(bool *enabledPtr);
278 
284  WiconnectResult setIpSettings(uint32_t ip, uint32_t netmask, uint32_t gateway);
285 
291  WiconnectResult setIpSettings(const char* ip, const char* netmask, const char* gateway);
292 
298  WiconnectResult getIpSettings(uint32_t *ip, uint32_t *netmask, uint32_t *gateway);
299 
305  WiconnectResult setDnsAddress(uint32_t dnsAddress);
306 
312  WiconnectResult getDnsAddress(uint32_t *dnsAddress);
313 
324  const char* getIpAddress(char *buffer ALLOW_NULL_STRING_BUFFER);
325 
326 
327  // ------------------------------------------------------------------------
328 
329 
335  static bool strToIp(const char *str, uint32_t *intPtr);
336 
342  static const char* ipToStr(uint32_t ip, char *ipStrBuffer ALLOW_NULL_STRING_BUFFER);
343 
344 
350  static const char* networkStatusToStr(NetworkStatus status);
351 
357  static const char* networkJoinResultToStr(NetworkJoinResult joinResult);
358 
364  static const char* signalStrengthToStr(NetworkSignalStrength signalStrenth);
365 
372 
378  static NetworkSecurity strToNetworkSecurity(const char *str);
379 
385  static const char* networkSecurityToStr(NetworkSecurity security);
386 
392  static bool strToSsid(const char *str, Ssid *ssid);
393 
399  static const char* ssidToStr(const Ssid *ssid, char *ssidStrBuffer ALLOW_NULL_STRING_BUFFER);
400 
406  static bool strToMacAddress(const char *str, MacAddress *macAddress);
407 
413  static const char* macAddressToStr(const MacAddress *macAddress, char *macStrBuffer ALLOW_NULL_STRING_BUFFER);
414 
415 protected:
416  NetworkInterface(Wiconnect *wiconnect);
417 
418  WiconnectResult processScanResults(char *resultStr, ScanResultList &resultList);
419 
420 #ifdef WICONNECT_ASYNC_TIMER_ENABLED
421  Callback completeHandler;
422  PeriodicTimer monitorTimer;
423 
424  void webSetupStatusMonitor();
425  void webSetupStatusCheckCallback(WiconnectResult result, void *arg1, void *arg2);
426 
427  void joinStatusMonitor();
428  void joinStatusCheckCallback(WiconnectResult result, void *arg1, void *arg2);
429 
430  //void scanCompleteCallback(WiconnectResult result, void *arg1, void *arg2);
431 #endif
432 
433 private:
434  Wiconnect *wiconnect;
435 };
436 
437 }
WiconnectResult getDhcpEnabled(bool *enabledPtr)
Get if DHCP enabled.
WiconnectResult getRssi(int32_t *rssiPtr)
Get the RSSI in dBm of WiFi network.
NetworkSecurity
Network security type.
const char * getIpAddress(char *buffer ALLOW_NULL_STRING_BUFFER)
Return the current IP address of the module if possible, else return 0.0.0.0.
The provides an interface for joining and/or creating a network. It provides other utilities such as ...
static const char * ipToStr(uint32_t ip, char *ipStrBuffer ALLOW_NULL_STRING_BUFFER)
Convert IP address to string.
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 getSignalStrength(NetworkSignalStrength *signalStrengthPtr)
Get NetworkSignalStrength of WiFi network module is connected.
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.
static const char * ssidToStr(const Ssid *ssid, char *ssidStrBuffer ALLOW_NULL_STRING_BUFFER)
Convert Ssid to string.
WiconnectResult startWebSetup(const char *ssid=NULL, const char *password=NULL, const Callback &completeHandler=Callback())
Start the WiConnect WiFi module 'web setup' feature.
WiconnectResult getDnsAddress(uint32_t *dnsAddress)
Get the static DNS address.
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.
static const char * networkStatusToStr(NetworkStatus status)
Convert NetworkStatus to string.
WiconnectResult isWebSetupRunning(bool *isRunningPtr)
Return status of WiConnect WiFi module 'web setup' feature.
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.
static const char * macAddressToStr(const MacAddress *macAddress, char *macStrBuffer ALLOW_NULL_STRING_BUFFER)
Convert MacAddress to string.
WiconnectResult getNetworkJoinResult(NetworkJoinResult *joinResultPtr)
Get the result of joining the network.
List of WiFi network scan results.
WiconnectResult setDnsAddress(uint32_t dnsAddress)
Set static DNS Address.
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.
WiconnectResult stopWebSetup()
Stop the WiConnect WiFi module 'web setup' feature.
NetworkStatus
Network connection status.
WiconnectResult getMacAddress(MacAddress *macAddress)
Get MAC address of the WiFi module.
WiconnectResult join(const char *ssid=NULL, const char *password=NULL, const Callback &completeHandler=Callback())
Join a WiFi network.