Host library for controlling a WiConnect enabled Wi-Fi module.
Dependents: wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more
NetworkInterface.h@13:2b51f5267c92, 2014-08-13 (annotated)
- Committer:
- dan_ackme
- Date:
- Wed Aug 13 03:14:30 2014 -0700
- Revision:
- 13:2b51f5267c92
- Parent:
- 11:ea484e1b7fc4
- Child:
- 16:7f1d6d359787
doc updates
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dan_ackme | 0:ea85c4bb5e1f | 1 | /* |
dan_ackme | 0:ea85c4bb5e1f | 2 | * Copyright 2014, ACKme Networks |
dan_ackme | 0:ea85c4bb5e1f | 3 | * All Rights Reserved. |
dan_ackme | 0:ea85c4bb5e1f | 4 | * |
dan_ackme | 0:ea85c4bb5e1f | 5 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of ACKme Networks; |
dan_ackme | 0:ea85c4bb5e1f | 6 | * the contents of this file may not be disclosed to third parties, copied |
dan_ackme | 0:ea85c4bb5e1f | 7 | * or duplicated in any form, in whole or in part, without the prior |
dan_ackme | 0:ea85c4bb5e1f | 8 | * written permission of ACKme Networks. |
dan_ackme | 0:ea85c4bb5e1f | 9 | */ |
dan_ackme | 0:ea85c4bb5e1f | 10 | |
dan_ackme | 0:ea85c4bb5e1f | 11 | #pragma once |
dan_ackme | 0:ea85c4bb5e1f | 12 | |
dan_ackme | 0:ea85c4bb5e1f | 13 | |
dan_ackme | 0:ea85c4bb5e1f | 14 | #include "WiconnectTypes.h" |
dan_ackme | 0:ea85c4bb5e1f | 15 | #include "types/ScanResultList.h" |
dan_ackme | 0:ea85c4bb5e1f | 16 | |
dan_ackme | 0:ea85c4bb5e1f | 17 | |
dan_ackme | 0:ea85c4bb5e1f | 18 | namespace wiconnect { |
dan_ackme | 0:ea85c4bb5e1f | 19 | |
dan_ackme | 0:ea85c4bb5e1f | 20 | |
dan_ackme | 11:ea484e1b7fc4 | 21 | /** |
dan_ackme | 13:2b51f5267c92 | 22 | * @ingroup api_network_types |
dan_ackme | 11:ea484e1b7fc4 | 23 | * |
dan_ackme | 11:ea484e1b7fc4 | 24 | * @brief The provides an interface for joining and/or creating a network. |
dan_ackme | 11:ea484e1b7fc4 | 25 | * It provides other utilities such as scanning for networks, pinging a network, |
dan_ackme | 11:ea484e1b7fc4 | 26 | * resolving a domain name to IP address. |
dan_ackme | 11:ea484e1b7fc4 | 27 | * |
dan_ackme | 13:2b51f5267c92 | 28 | * @note This class is an interface to the Wiconnect class. It should never be |
dan_ackme | 13:2b51f5267c92 | 29 | * independently instantiated or the parent of another class. |
dan_ackme | 11:ea484e1b7fc4 | 30 | */ |
dan_ackme | 0:ea85c4bb5e1f | 31 | class NetworkInterface |
dan_ackme | 0:ea85c4bb5e1f | 32 | { |
dan_ackme | 0:ea85c4bb5e1f | 33 | public: |
dan_ackme | 11:ea484e1b7fc4 | 34 | /** |
dan_ackme | 11:ea484e1b7fc4 | 35 | * @ingroup api_network_setup |
dan_ackme | 11:ea484e1b7fc4 | 36 | * |
dan_ackme | 11:ea484e1b7fc4 | 37 | * @brief Start the WiConnect WiFi module 'web setup' feature. |
dan_ackme | 13:2b51f5267c92 | 38 | * |
dan_ackme | 13:2b51f5267c92 | 39 | * This command has an optional background processing feature. |
dan_ackme | 13:2b51f5267c92 | 40 | * Background processing is enabled if the completeHandler parameter |
dan_ackme | 13:2b51f5267c92 | 41 | * is specified. If enabled, the library will poll the module every second |
dan_ackme | 13:2b51f5267c92 | 42 | * for the web setup status (essentially it'll call isWebSetupRunning() every |
dan_ackme | 13:2b51f5267c92 | 43 | * second in the background). When the web setup is no longer running the |
dan_ackme | 13:2b51f5267c92 | 44 | * callback will be executed. The background processing is disabled when stopWebSetup() |
dan_ackme | 13:2b51f5267c92 | 45 | * is called. |
dan_ackme | 13:2b51f5267c92 | 46 | * |
dan_ackme | 13:2b51f5267c92 | 47 | * @note only the 'result' parameter of the callback handler is valid. |
dan_ackme | 13:2b51f5267c92 | 48 | * |
dan_ackme | 13:2b51f5267c92 | 49 | * Refer to @ref setting_async_processing for more info. |
dan_ackme | 13:2b51f5267c92 | 50 | * |
dan_ackme | 13:2b51f5267c92 | 51 | * @param[in] ssid Optional, optionally set the SSID of module's softAp |
dan_ackme | 13:2b51f5267c92 | 52 | * @param[in] password Optional, optionally set the WPA2-PSK password for the module'S softap |
dan_ackme | 13:2b51f5267c92 | 53 | * Note: make an OPEN softAp, set this parameter to a null string (i.e. "") |
dan_ackme | 13:2b51f5267c92 | 54 | * @param[in] completeHandler Optional, callback to be executed when module web setup completes. |
dan_ackme | 13:2b51f5267c92 | 55 | * @return Result of method. See @ref WiconnectResult |
dan_ackme | 11:ea484e1b7fc4 | 56 | */ |
dan_ackme | 0:ea85c4bb5e1f | 57 | WiconnectResult startWebSetup(const char *ssid = NULL, const char *password = NULL, const Callback &completeHandler = Callback()); |
dan_ackme | 11:ea484e1b7fc4 | 58 | |
dan_ackme | 11:ea484e1b7fc4 | 59 | /** |
dan_ackme | 11:ea484e1b7fc4 | 60 | * @ingroup api_network_setup |
dan_ackme | 11:ea484e1b7fc4 | 61 | * |
dan_ackme | 11:ea484e1b7fc4 | 62 | * @brief Stop the WiConnect WiFi module 'web setup' feature. |
dan_ackme | 13:2b51f5267c92 | 63 | * |
dan_ackme | 13:2b51f5267c92 | 64 | * This method should be called AFTER startWebSetup() to prematurely terminate |
dan_ackme | 13:2b51f5267c92 | 65 | * web setup. Note that this is not needed if web setup completes by itself |
dan_ackme | 13:2b51f5267c92 | 66 | * (i.e. if the user exits web setup from the webpage). |
dan_ackme | 13:2b51f5267c92 | 67 | * |
dan_ackme | 13:2b51f5267c92 | 68 | * @return Result of method. See @ref WiconnectResult |
dan_ackme | 11:ea484e1b7fc4 | 69 | */ |
dan_ackme | 0:ea85c4bb5e1f | 70 | WiconnectResult stopWebSetup(); |
dan_ackme | 11:ea484e1b7fc4 | 71 | |
dan_ackme | 11:ea484e1b7fc4 | 72 | /** |
dan_ackme | 11:ea484e1b7fc4 | 73 | * @ingroup api_network_setup |
dan_ackme | 11:ea484e1b7fc4 | 74 | * |
dan_ackme | 11:ea484e1b7fc4 | 75 | * @brief Return status of WiConnect WiFi module 'web setup' feature. |
dan_ackme | 13:2b51f5267c92 | 76 | * |
dan_ackme | 13:2b51f5267c92 | 77 | * This may be called at any time (whether web setpu has been stared or not). |
dan_ackme | 13:2b51f5267c92 | 78 | * |
dan_ackme | 13:2b51f5267c92 | 79 | * @param[out] isRunningPtr Pointer to bool to contain TRUE if web setup is running, FALSE else |
dan_ackme | 13:2b51f5267c92 | 80 | * @return Result of method. See @ref WiconnectResult |
dan_ackme | 11:ea484e1b7fc4 | 81 | */ |
dan_ackme | 0:ea85c4bb5e1f | 82 | WiconnectResult isWebSetupRunning(bool *isRunningPtr); |
dan_ackme | 0:ea85c4bb5e1f | 83 | |
dan_ackme | 11:ea484e1b7fc4 | 84 | |
dan_ackme | 11:ea484e1b7fc4 | 85 | // ------------------------------------------------------------------------ |
dan_ackme | 11:ea484e1b7fc4 | 86 | |
dan_ackme | 11:ea484e1b7fc4 | 87 | |
dan_ackme | 11:ea484e1b7fc4 | 88 | /** |
dan_ackme | 11:ea484e1b7fc4 | 89 | * @ingroup api_network_wlan |
dan_ackme | 11:ea484e1b7fc4 | 90 | * |
dan_ackme | 11:ea484e1b7fc4 | 91 | * @brief Join a WiFi network. |
dan_ackme | 13:2b51f5267c92 | 92 | * |
dan_ackme | 13:2b51f5267c92 | 93 | * @note This command is returns when the join sequence has STARTED. |
dan_ackme | 13:2b51f5267c92 | 94 | * To determine if the module has successfully join the network either |
dan_ackme | 13:2b51f5267c92 | 95 | * specify the completeHandler or periodically call getNetworkStatus() |
dan_ackme | 13:2b51f5267c92 | 96 | * |
dan_ackme | 13:2b51f5267c92 | 97 | * This command has an optional background processing feature. |
dan_ackme | 13:2b51f5267c92 | 98 | * Background processing is enabled if the completeHandler parameter |
dan_ackme | 13:2b51f5267c92 | 99 | * is specified. If enabled, the library will poll the module every second |
dan_ackme | 13:2b51f5267c92 | 100 | * for the join status (essentially it'll call getNetworkStatus() every |
dan_ackme | 13:2b51f5267c92 | 101 | * second in the background). When the module join sequence complete the callback will be executed. |
dan_ackme | 13:2b51f5267c92 | 102 | * The background processing is disabled when leave() is called. |
dan_ackme | 13:2b51f5267c92 | 103 | * |
dan_ackme | 13:2b51f5267c92 | 104 | * @note only the 'result' parameter of the callback handler is valid. |
dan_ackme | 13:2b51f5267c92 | 105 | * |
dan_ackme | 13:2b51f5267c92 | 106 | * Refer to @ref setting_async_processing for more info. |
dan_ackme | 13:2b51f5267c92 | 107 | * |
dan_ackme | 13:2b51f5267c92 | 108 | * @param[in] ssid Optional, optionally set the SSID of the network to join |
dan_ackme | 13:2b51f5267c92 | 109 | * @param[in] password Optional, optionally set the passkey of the network to join |
dan_ackme | 13:2b51f5267c92 | 110 | * Note: to join an OPEN network, set this parameter to a null string (i.e. "") |
dan_ackme | 13:2b51f5267c92 | 111 | * @param[in] completeHandler Optional, callback to be executed when the join sequence completes. |
dan_ackme | 13:2b51f5267c92 | 112 | * @return Result of method. See @ref WiconnectResult |
dan_ackme | 11:ea484e1b7fc4 | 113 | */ |
dan_ackme | 0:ea85c4bb5e1f | 114 | WiconnectResult join(const char* ssid = NULL, const char *password = NULL, const Callback &completeHandler = Callback()); |
dan_ackme | 11:ea484e1b7fc4 | 115 | |
dan_ackme | 11:ea484e1b7fc4 | 116 | /** |
dan_ackme | 11:ea484e1b7fc4 | 117 | * @ingroup api_network_wlan |
dan_ackme | 11:ea484e1b7fc4 | 118 | * |
dan_ackme | 11:ea484e1b7fc4 | 119 | * @brief Leave a WiFi network. |
dan_ackme | 13:2b51f5267c92 | 120 | * |
dan_ackme | 13:2b51f5267c92 | 121 | * This method may be called to either terminate a join sequence or |
dan_ackme | 13:2b51f5267c92 | 122 | * leave a previously connected networked. |
dan_ackme | 13:2b51f5267c92 | 123 | * |
dan_ackme | 13:2b51f5267c92 | 124 | * @return Result of method. See @ref WiconnectResult |
dan_ackme | 11:ea484e1b7fc4 | 125 | */ |
dan_ackme | 0:ea85c4bb5e1f | 126 | WiconnectResult leave(); |
dan_ackme | 11:ea484e1b7fc4 | 127 | |
dan_ackme | 11:ea484e1b7fc4 | 128 | /** |
dan_ackme | 11:ea484e1b7fc4 | 129 | * @ingroup api_network_wlan |
dan_ackme | 11:ea484e1b7fc4 | 130 | * |
dan_ackme | 11:ea484e1b7fc4 | 131 | * @brief Get connection status to WiFi network. |
dan_ackme | 13:2b51f5267c92 | 132 | * |
dan_ackme | 13:2b51f5267c92 | 133 | * Refer to @ref NetworkStatus for more info. |
dan_ackme | 13:2b51f5267c92 | 134 | * |
dan_ackme | 13:2b51f5267c92 | 135 | * @param[out] statusPtr Point to a @ref NetworkStatus which will hold current network status of module |
dan_ackme | 13:2b51f5267c92 | 136 | * @return Result of method. See @ref WiconnectResult |
dan_ackme | 11:ea484e1b7fc4 | 137 | */ |
dan_ackme | 0:ea85c4bb5e1f | 138 | WiconnectResult getNetworkStatus(NetworkStatus *statusPtr); |
dan_ackme | 0:ea85c4bb5e1f | 139 | |
dan_ackme | 11:ea484e1b7fc4 | 140 | // ------------------------------------------------------------------------ |
dan_ackme | 11:ea484e1b7fc4 | 141 | |
dan_ackme | 11:ea484e1b7fc4 | 142 | |
dan_ackme | 0:ea85c4bb5e1f | 143 | // WiconnectResult startSoftAp(const char* ssid = NULL, const char *password = NULL, const Callback &clientConnectedCallback = Callback()); |
dan_ackme | 0:ea85c4bb5e1f | 144 | // WiconnectResult stopSoftAp(); |
dan_ackme | 0:ea85c4bb5e1f | 145 | // WiconnectResult getSoftApClientList(); |
dan_ackme | 0:ea85c4bb5e1f | 146 | |
dan_ackme | 11:ea484e1b7fc4 | 147 | |
dan_ackme | 11:ea484e1b7fc4 | 148 | // ------------------------------------------------------------------------ |
dan_ackme | 11:ea484e1b7fc4 | 149 | |
dan_ackme | 11:ea484e1b7fc4 | 150 | |
dan_ackme | 11:ea484e1b7fc4 | 151 | /** |
dan_ackme | 11:ea484e1b7fc4 | 152 | * @ingroup api_network_util |
dan_ackme | 11:ea484e1b7fc4 | 153 | * |
dan_ackme | 11:ea484e1b7fc4 | 154 | * @brief Scan for available WiFi networks. |
dan_ackme | 13:2b51f5267c92 | 155 | * |
dan_ackme | 13:2b51f5267c92 | 156 | * The populate the supplied @ref ScanResultList with @ref ScanResult of each found network. |
dan_ackme | 13:2b51f5267c92 | 157 | * |
dan_ackme | 13:2b51f5267c92 | 158 | * Optionally only scan of specific channels by supplying a null terminated list of channels. |
dan_ackme | 13:2b51f5267c92 | 159 | * Example: |
dan_ackme | 13:2b51f5267c92 | 160 | * @code |
dan_ackme | 13:2b51f5267c92 | 161 | * const uint8_t channelsToScan[] = {1, 6, 11, 0}; |
dan_ackme | 13:2b51f5267c92 | 162 | * @endcode |
dan_ackme | 13:2b51f5267c92 | 163 | * |
dan_ackme | 13:2b51f5267c92 | 164 | * @param[out] resultList List to populate with scan results. |
dan_ackme | 13:2b51f5267c92 | 165 | * @param[in] channelList Optional, null terminated list of channels to scan. |
dan_ackme | 13:2b51f5267c92 | 166 | * @param[in] ssid Optional, specific network name to scan for. |
dan_ackme | 13:2b51f5267c92 | 167 | * @return Result of method. See @ref WiconnectResult |
dan_ackme | 11:ea484e1b7fc4 | 168 | */ |
dan_ackme | 0:ea85c4bb5e1f | 169 | WiconnectResult scan(ScanResultList &resultList, const uint8_t *channelList = NULL, const char* ssid = NULL); |
dan_ackme | 11:ea484e1b7fc4 | 170 | |
dan_ackme | 11:ea484e1b7fc4 | 171 | /** |
dan_ackme | 11:ea484e1b7fc4 | 172 | * @ingroup api_network_util |
dan_ackme | 11:ea484e1b7fc4 | 173 | * |
dan_ackme | 11:ea484e1b7fc4 | 174 | * @brief Ping a WiFi network. |
dan_ackme | 13:2b51f5267c92 | 175 | * |
dan_ackme | 13:2b51f5267c92 | 176 | * Optionally ping a specific server and return the time in milliseconds it took |
dan_ackme | 13:2b51f5267c92 | 177 | * for the network to response. If no domain is supplied, the module pings to gateway |
dan_ackme | 13:2b51f5267c92 | 178 | * (i.e router it's connected to). |
dan_ackme | 13:2b51f5267c92 | 179 | * |
dan_ackme | 13:2b51f5267c92 | 180 | * @param[in] domain Optional, the domain name to ping |
dan_ackme | 13:2b51f5267c92 | 181 | * @param[out] timeMsPtr Optional, pointer to uint32 to hold time in milliseconds the ping took |
dan_ackme | 13:2b51f5267c92 | 182 | * @return Result of method. See @ref WiconnectResult |
dan_ackme | 11:ea484e1b7fc4 | 183 | */ |
dan_ackme | 0:ea85c4bb5e1f | 184 | WiconnectResult ping(const char *domain = NULL, uint32_t *timeMsPtr = NULL); |
dan_ackme | 11:ea484e1b7fc4 | 185 | |
dan_ackme | 11:ea484e1b7fc4 | 186 | /** |
dan_ackme | 11:ea484e1b7fc4 | 187 | * @ingroup api_network_util |
dan_ackme | 11:ea484e1b7fc4 | 188 | * |
dan_ackme | 11:ea484e1b7fc4 | 189 | * @brief Resolve domain name into IP address. |
dan_ackme | 13:2b51f5267c92 | 190 | * |
dan_ackme | 13:2b51f5267c92 | 191 | * @param[in] domain The domain name to resolve |
dan_ackme | 13:2b51f5267c92 | 192 | * @param[out] ipAddressPtr pointer to uint32 to hold resolved IP address. Note, the IP address is in network-byte-order. |
dan_ackme | 13:2b51f5267c92 | 193 | * @return Result of method. See @ref WiconnectResult |
dan_ackme | 11:ea484e1b7fc4 | 194 | */ |
dan_ackme | 0:ea85c4bb5e1f | 195 | WiconnectResult lookup(const char *domain, uint32_t *ipAddressPtr); |
dan_ackme | 0:ea85c4bb5e1f | 196 | |
dan_ackme | 11:ea484e1b7fc4 | 197 | |
dan_ackme | 11:ea484e1b7fc4 | 198 | // ------------------------------------------------------------------------ |
dan_ackme | 11:ea484e1b7fc4 | 199 | |
dan_ackme | 11:ea484e1b7fc4 | 200 | |
dan_ackme | 11:ea484e1b7fc4 | 201 | /** |
dan_ackme | 11:ea484e1b7fc4 | 202 | * @ingroup api_network_settings |
dan_ackme | 11:ea484e1b7fc4 | 203 | * |
dan_ackme | 11:ea484e1b7fc4 | 204 | * @brief Set DHCP enabled. |
dan_ackme | 13:2b51f5267c92 | 205 | * |
dan_ackme | 13:2b51f5267c92 | 206 | * @return Result of method. See @ref WiconnectResult |
dan_ackme | 11:ea484e1b7fc4 | 207 | */ |
dan_ackme | 0:ea85c4bb5e1f | 208 | WiconnectResult setDhcpEnabled(bool enabled); |
dan_ackme | 11:ea484e1b7fc4 | 209 | |
dan_ackme | 11:ea484e1b7fc4 | 210 | /** |
dan_ackme | 11:ea484e1b7fc4 | 211 | * @ingroup api_network_settings |
dan_ackme | 11:ea484e1b7fc4 | 212 | * |
dan_ackme | 11:ea484e1b7fc4 | 213 | * @brief Get if DHCP enabled. |
dan_ackme | 11:ea484e1b7fc4 | 214 | */ |
dan_ackme | 0:ea85c4bb5e1f | 215 | WiconnectResult getDhcpEnabled(bool *enabledPtr); |
dan_ackme | 11:ea484e1b7fc4 | 216 | |
dan_ackme | 11:ea484e1b7fc4 | 217 | /** |
dan_ackme | 11:ea484e1b7fc4 | 218 | * @ingroup api_network_settings |
dan_ackme | 11:ea484e1b7fc4 | 219 | * |
dan_ackme | 11:ea484e1b7fc4 | 220 | * @brief Set static IP settings |
dan_ackme | 11:ea484e1b7fc4 | 221 | */ |
dan_ackme | 0:ea85c4bb5e1f | 222 | WiconnectResult setIpSettings(uint32_t ip, uint32_t netmask, uint32_t gateway); |
dan_ackme | 11:ea484e1b7fc4 | 223 | |
dan_ackme | 11:ea484e1b7fc4 | 224 | /** |
dan_ackme | 11:ea484e1b7fc4 | 225 | * @ingroup api_network_settings |
dan_ackme | 11:ea484e1b7fc4 | 226 | * |
dan_ackme | 11:ea484e1b7fc4 | 227 | * @brief Set static IP settings (with string parameters) |
dan_ackme | 11:ea484e1b7fc4 | 228 | */ |
dan_ackme | 0:ea85c4bb5e1f | 229 | WiconnectResult setIpSettings(const char* ip, const char* netmask, const char* gateway); |
dan_ackme | 11:ea484e1b7fc4 | 230 | |
dan_ackme | 11:ea484e1b7fc4 | 231 | /** |
dan_ackme | 11:ea484e1b7fc4 | 232 | * @ingroup api_network_settings |
dan_ackme | 11:ea484e1b7fc4 | 233 | * |
dan_ackme | 11:ea484e1b7fc4 | 234 | * @brief Get network IP settings |
dan_ackme | 11:ea484e1b7fc4 | 235 | */ |
dan_ackme | 0:ea85c4bb5e1f | 236 | WiconnectResult getIpSettings(uint32_t *ip, uint32_t *netmask, uint32_t *gateway); |
dan_ackme | 11:ea484e1b7fc4 | 237 | |
dan_ackme | 11:ea484e1b7fc4 | 238 | /** |
dan_ackme | 11:ea484e1b7fc4 | 239 | * @ingroup api_network_settings |
dan_ackme | 11:ea484e1b7fc4 | 240 | * |
dan_ackme | 11:ea484e1b7fc4 | 241 | * @brief Get signal strength to WiFi network |
dan_ackme | 11:ea484e1b7fc4 | 242 | */ |
dan_ackme | 0:ea85c4bb5e1f | 243 | WiconnectResult getSignalStrength(NetworkSignalStrength *signalStrengthPtr); |
dan_ackme | 0:ea85c4bb5e1f | 244 | |
dan_ackme | 11:ea484e1b7fc4 | 245 | |
dan_ackme | 11:ea484e1b7fc4 | 246 | // ------------------------------------------------------------------------ |
dan_ackme | 11:ea484e1b7fc4 | 247 | |
dan_ackme | 11:ea484e1b7fc4 | 248 | |
dan_ackme | 11:ea484e1b7fc4 | 249 | /** |
dan_ackme | 11:ea484e1b7fc4 | 250 | * @ingroup conversion_util |
dan_ackme | 11:ea484e1b7fc4 | 251 | * |
dan_ackme | 11:ea484e1b7fc4 | 252 | * @brief Convert string to IP address |
dan_ackme | 11:ea484e1b7fc4 | 253 | */ |
dan_ackme | 0:ea85c4bb5e1f | 254 | static bool strToIp(const char *str, uint32_t *intPtr); |
dan_ackme | 11:ea484e1b7fc4 | 255 | |
dan_ackme | 11:ea484e1b7fc4 | 256 | /** |
dan_ackme | 11:ea484e1b7fc4 | 257 | * @ingroup conversion_util |
dan_ackme | 11:ea484e1b7fc4 | 258 | * |
dan_ackme | 11:ea484e1b7fc4 | 259 | * @brief Convert IP address to string |
dan_ackme | 11:ea484e1b7fc4 | 260 | */ |
dan_ackme | 0:ea85c4bb5e1f | 261 | static const char* ipToStr(uint32_t ip, char *ipStrBuffer = NULL); |
dan_ackme | 11:ea484e1b7fc4 | 262 | |
dan_ackme | 11:ea484e1b7fc4 | 263 | /** |
dan_ackme | 11:ea484e1b7fc4 | 264 | * @ingroup conversion_util |
dan_ackme | 11:ea484e1b7fc4 | 265 | * |
dan_ackme | 11:ea484e1b7fc4 | 266 | * @brief Convert @ref NetworkStatus to string |
dan_ackme | 11:ea484e1b7fc4 | 267 | */ |
dan_ackme | 0:ea85c4bb5e1f | 268 | static const char* networkStatusToStr(NetworkStatus status); |
dan_ackme | 11:ea484e1b7fc4 | 269 | |
dan_ackme | 11:ea484e1b7fc4 | 270 | /** |
dan_ackme | 11:ea484e1b7fc4 | 271 | * @ingroup conversion_util |
dan_ackme | 11:ea484e1b7fc4 | 272 | * |
dan_ackme | 11:ea484e1b7fc4 | 273 | * @brief Convert @ref NetworkSignalStrength to string |
dan_ackme | 11:ea484e1b7fc4 | 274 | */ |
dan_ackme | 0:ea85c4bb5e1f | 275 | static const char* signalStrengthToStr(NetworkSignalStrength signalStrenth); |
dan_ackme | 11:ea484e1b7fc4 | 276 | |
dan_ackme | 11:ea484e1b7fc4 | 277 | /** |
dan_ackme | 11:ea484e1b7fc4 | 278 | * @ingroup conversion_util |
dan_ackme | 11:ea484e1b7fc4 | 279 | * |
dan_ackme | 11:ea484e1b7fc4 | 280 | * @brief Convert RSSI (in dBm) to @ref NetworkSignalStrength |
dan_ackme | 11:ea484e1b7fc4 | 281 | */ |
dan_ackme | 0:ea85c4bb5e1f | 282 | static NetworkSignalStrength rssiToSignalStrength(int rssi); |
dan_ackme | 11:ea484e1b7fc4 | 283 | |
dan_ackme | 11:ea484e1b7fc4 | 284 | /** |
dan_ackme | 11:ea484e1b7fc4 | 285 | * @ingroup conversion_util |
dan_ackme | 11:ea484e1b7fc4 | 286 | * |
dan_ackme | 11:ea484e1b7fc4 | 287 | * @brief Convert string to @ref NetworkSecurity |
dan_ackme | 11:ea484e1b7fc4 | 288 | */ |
dan_ackme | 0:ea85c4bb5e1f | 289 | static NetworkSecurity strToNetworkSecurity(const char *str); |
dan_ackme | 11:ea484e1b7fc4 | 290 | |
dan_ackme | 11:ea484e1b7fc4 | 291 | /** |
dan_ackme | 11:ea484e1b7fc4 | 292 | * @ingroup conversion_util |
dan_ackme | 11:ea484e1b7fc4 | 293 | * |
dan_ackme | 11:ea484e1b7fc4 | 294 | * @brief Convert @ref NetworkSecurity to string |
dan_ackme | 11:ea484e1b7fc4 | 295 | */ |
dan_ackme | 0:ea85c4bb5e1f | 296 | static const char* networkSecurityToStr(NetworkSecurity security); |
dan_ackme | 11:ea484e1b7fc4 | 297 | |
dan_ackme | 11:ea484e1b7fc4 | 298 | /** |
dan_ackme | 11:ea484e1b7fc4 | 299 | * @ingroup conversion_util |
dan_ackme | 11:ea484e1b7fc4 | 300 | * |
dan_ackme | 11:ea484e1b7fc4 | 301 | * @brief Convert string @ref Ssid |
dan_ackme | 11:ea484e1b7fc4 | 302 | */ |
dan_ackme | 0:ea85c4bb5e1f | 303 | static bool strToSsid(const char *str, Ssid *ssid); |
dan_ackme | 11:ea484e1b7fc4 | 304 | |
dan_ackme | 11:ea484e1b7fc4 | 305 | /** |
dan_ackme | 11:ea484e1b7fc4 | 306 | * @ingroup conversion_util |
dan_ackme | 11:ea484e1b7fc4 | 307 | * |
dan_ackme | 11:ea484e1b7fc4 | 308 | * @brief Convert @ref Ssid to string |
dan_ackme | 11:ea484e1b7fc4 | 309 | */ |
dan_ackme | 0:ea85c4bb5e1f | 310 | static const char* ssidToStr(const Ssid *ssid, char *ssidStrBuffer = NULL); |
dan_ackme | 11:ea484e1b7fc4 | 311 | |
dan_ackme | 11:ea484e1b7fc4 | 312 | /** |
dan_ackme | 11:ea484e1b7fc4 | 313 | * @ingroup conversion_util |
dan_ackme | 11:ea484e1b7fc4 | 314 | * |
dan_ackme | 11:ea484e1b7fc4 | 315 | * @brief Convert string @ref MacAddress |
dan_ackme | 11:ea484e1b7fc4 | 316 | */ |
dan_ackme | 0:ea85c4bb5e1f | 317 | static bool strToMacAddress(const char *str, MacAddress *macAddress); |
dan_ackme | 11:ea484e1b7fc4 | 318 | |
dan_ackme | 11:ea484e1b7fc4 | 319 | /** |
dan_ackme | 11:ea484e1b7fc4 | 320 | * @ingroup conversion_util |
dan_ackme | 11:ea484e1b7fc4 | 321 | * |
dan_ackme | 11:ea484e1b7fc4 | 322 | * @brief Convert @ref MacAddress to string |
dan_ackme | 11:ea484e1b7fc4 | 323 | */ |
dan_ackme | 0:ea85c4bb5e1f | 324 | static const char* macAddressToStr(const MacAddress *macAddress, char *macStrBuffer = NULL); |
dan_ackme | 0:ea85c4bb5e1f | 325 | |
dan_ackme | 0:ea85c4bb5e1f | 326 | protected: |
dan_ackme | 0:ea85c4bb5e1f | 327 | NetworkInterface(Wiconnect *wiconnect); |
dan_ackme | 0:ea85c4bb5e1f | 328 | |
dan_ackme | 0:ea85c4bb5e1f | 329 | WiconnectResult processScanResults(char *resultStr, ScanResultList &resultList); |
dan_ackme | 0:ea85c4bb5e1f | 330 | |
dan_ackme | 0:ea85c4bb5e1f | 331 | #ifdef WICONNECT_ASYNC_TIMER_ENABLED |
dan_ackme | 0:ea85c4bb5e1f | 332 | Callback completeHandler; |
dan_ackme | 0:ea85c4bb5e1f | 333 | PeriodicTimer monitorTimer; |
dan_ackme | 0:ea85c4bb5e1f | 334 | |
dan_ackme | 0:ea85c4bb5e1f | 335 | void webSetupStatusMonitor(); |
dan_ackme | 0:ea85c4bb5e1f | 336 | void webSetupStatusCheckCallback(WiconnectResult result, void *arg1, void *arg2); |
dan_ackme | 0:ea85c4bb5e1f | 337 | |
dan_ackme | 0:ea85c4bb5e1f | 338 | void joinStatusMonitor(); |
dan_ackme | 0:ea85c4bb5e1f | 339 | void joinStatusCheckCallback(WiconnectResult result, void *arg1, void *arg2); |
dan_ackme | 0:ea85c4bb5e1f | 340 | |
dan_ackme | 0:ea85c4bb5e1f | 341 | //void scanCompleteCallback(WiconnectResult result, void *arg1, void *arg2); |
dan_ackme | 0:ea85c4bb5e1f | 342 | #endif |
dan_ackme | 0:ea85c4bb5e1f | 343 | |
dan_ackme | 0:ea85c4bb5e1f | 344 | private: |
dan_ackme | 0:ea85c4bb5e1f | 345 | Wiconnect *wiconnect; |
dan_ackme | 0:ea85c4bb5e1f | 346 | }; |
dan_ackme | 0:ea85c4bb5e1f | 347 | |
dan_ackme | 0:ea85c4bb5e1f | 348 | } |