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

Committer:
dan_ackme
Date:
Thu Oct 23 15:16:06 2014 -0700
Revision:
26:8067e3d463d3
Parent:
21:17bb3eddcbae
Added 'updateFirmware' and 'networkGetJoinResult' api methods
Various bug fixes
Updated documentation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dan_ackme 21:17bb3eddcbae 1 /**
dan_ackme 21:17bb3eddcbae 2 * ACKme WiConnect Host Library is licensed under the BSD licence:
dan_ackme 21:17bb3eddcbae 3 *
dan_ackme 21:17bb3eddcbae 4 * Copyright (c)2014 ACKme Networks.
dan_ackme 21:17bb3eddcbae 5 * All rights reserved.
dan_ackme 21:17bb3eddcbae 6 *
dan_ackme 21:17bb3eddcbae 7 * Redistribution and use in source and binary forms, with or without modification,
dan_ackme 21:17bb3eddcbae 8 * are permitted provided that the following conditions are met:
dan_ackme 21:17bb3eddcbae 9 *
dan_ackme 21:17bb3eddcbae 10 * 1. Redistributions of source code must retain the above copyright notice,
dan_ackme 21:17bb3eddcbae 11 * this list of conditions and the following disclaimer.
dan_ackme 21:17bb3eddcbae 12 * 2. Redistributions in binary form must reproduce the above copyright notice,
dan_ackme 21:17bb3eddcbae 13 * this list of conditions and the following disclaimer in the documentation
dan_ackme 21:17bb3eddcbae 14 * and/or other materials provided with the distribution.
dan_ackme 21:17bb3eddcbae 15 * 3. The name of the author may not be used to endorse or promote products
dan_ackme 21:17bb3eddcbae 16 * derived from this software without specific prior written permission.
dan_ackme 21:17bb3eddcbae 17 *
dan_ackme 21:17bb3eddcbae 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS AND ANY EXPRESS OR IMPLIED
dan_ackme 21:17bb3eddcbae 19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
dan_ackme 21:17bb3eddcbae 20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
dan_ackme 21:17bb3eddcbae 21 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
dan_ackme 21:17bb3eddcbae 22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
dan_ackme 21:17bb3eddcbae 23 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
dan_ackme 21:17bb3eddcbae 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
dan_ackme 21:17bb3eddcbae 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
dan_ackme 21:17bb3eddcbae 26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
dan_ackme 21:17bb3eddcbae 27 * OF SUCH DAMAGE.
dan_ackme 0:ea85c4bb5e1f 28 */
dan_ackme 0:ea85c4bb5e1f 29 #pragma once
dan_ackme 0:ea85c4bb5e1f 30
dan_ackme 0:ea85c4bb5e1f 31
dan_ackme 0:ea85c4bb5e1f 32 #include "WiconnectTypes.h"
dan_ackme 0:ea85c4bb5e1f 33 #include "types/ScanResultList.h"
dan_ackme 0:ea85c4bb5e1f 34
dan_ackme 0:ea85c4bb5e1f 35
dan_ackme 0:ea85c4bb5e1f 36 namespace wiconnect {
dan_ackme 0:ea85c4bb5e1f 37
dan_ackme 0:ea85c4bb5e1f 38
dan_ackme 11:ea484e1b7fc4 39 /**
dan_ackme 13:2b51f5267c92 40 * @ingroup api_network_types
dan_ackme 11:ea484e1b7fc4 41 *
dan_ackme 11:ea484e1b7fc4 42 * @brief The provides an interface for joining and/or creating a network.
dan_ackme 11:ea484e1b7fc4 43 * It provides other utilities such as scanning for networks, pinging a network,
dan_ackme 11:ea484e1b7fc4 44 * resolving a domain name to IP address.
dan_ackme 11:ea484e1b7fc4 45 *
dan_ackme 13:2b51f5267c92 46 * @note This class is an interface to the Wiconnect class. It should never be
dan_ackme 13:2b51f5267c92 47 * independently instantiated or the parent of another class.
dan_ackme 11:ea484e1b7fc4 48 */
dan_ackme 0:ea85c4bb5e1f 49 class NetworkInterface
dan_ackme 0:ea85c4bb5e1f 50 {
dan_ackme 0:ea85c4bb5e1f 51 public:
dan_ackme 11:ea484e1b7fc4 52 /**
dan_ackme 11:ea484e1b7fc4 53 * @ingroup api_network_setup
dan_ackme 11:ea484e1b7fc4 54 *
dan_ackme 11:ea484e1b7fc4 55 * @brief Start the WiConnect WiFi module 'web setup' feature.
dan_ackme 13:2b51f5267c92 56 *
dan_ackme 13:2b51f5267c92 57 * This command has an optional background processing feature.
dan_ackme 13:2b51f5267c92 58 * Background processing is enabled if the completeHandler parameter
dan_ackme 13:2b51f5267c92 59 * is specified. If enabled, the library will poll the module every second
dan_ackme 13:2b51f5267c92 60 * for the web setup status (essentially it'll call isWebSetupRunning() every
dan_ackme 13:2b51f5267c92 61 * second in the background). When the web setup is no longer running the
dan_ackme 13:2b51f5267c92 62 * callback will be executed. The background processing is disabled when stopWebSetup()
dan_ackme 13:2b51f5267c92 63 * is called.
dan_ackme 13:2b51f5267c92 64 *
dan_ackme 13:2b51f5267c92 65 * @note only the 'result' parameter of the callback handler is valid.
dan_ackme 13:2b51f5267c92 66 *
dan_ackme 13:2b51f5267c92 67 * Refer to @ref setting_async_processing for more info.
dan_ackme 13:2b51f5267c92 68 *
dan_ackme 13:2b51f5267c92 69 * @param[in] ssid Optional, optionally set the SSID of module's softAp
dan_ackme 13:2b51f5267c92 70 * @param[in] password Optional, optionally set the WPA2-PSK password for the module'S softap
dan_ackme 13:2b51f5267c92 71 * Note: make an OPEN softAp, set this parameter to a null string (i.e. "")
dan_ackme 13:2b51f5267c92 72 * @param[in] completeHandler Optional, callback to be executed when module web setup completes.
dan_ackme 13:2b51f5267c92 73 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 74 */
dan_ackme 0:ea85c4bb5e1f 75 WiconnectResult startWebSetup(const char *ssid = NULL, const char *password = NULL, const Callback &completeHandler = Callback());
dan_ackme 11:ea484e1b7fc4 76
dan_ackme 11:ea484e1b7fc4 77 /**
dan_ackme 11:ea484e1b7fc4 78 * @ingroup api_network_setup
dan_ackme 11:ea484e1b7fc4 79 *
dan_ackme 11:ea484e1b7fc4 80 * @brief Stop the WiConnect WiFi module 'web setup' feature.
dan_ackme 13:2b51f5267c92 81 *
dan_ackme 13:2b51f5267c92 82 * This method should be called AFTER startWebSetup() to prematurely terminate
dan_ackme 13:2b51f5267c92 83 * web setup. Note that this is not needed if web setup completes by itself
dan_ackme 13:2b51f5267c92 84 * (i.e. if the user exits web setup from the webpage).
dan_ackme 13:2b51f5267c92 85 *
dan_ackme 13:2b51f5267c92 86 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 87 */
dan_ackme 0:ea85c4bb5e1f 88 WiconnectResult stopWebSetup();
dan_ackme 11:ea484e1b7fc4 89
dan_ackme 11:ea484e1b7fc4 90 /**
dan_ackme 11:ea484e1b7fc4 91 * @ingroup api_network_setup
dan_ackme 11:ea484e1b7fc4 92 *
dan_ackme 11:ea484e1b7fc4 93 * @brief Return status of WiConnect WiFi module 'web setup' feature.
dan_ackme 13:2b51f5267c92 94 *
dan_ackme 13:2b51f5267c92 95 * This may be called at any time (whether web setpu has been stared or not).
dan_ackme 13:2b51f5267c92 96 *
dan_ackme 13:2b51f5267c92 97 * @param[out] isRunningPtr Pointer to bool to contain TRUE if web setup is running, FALSE else
dan_ackme 13:2b51f5267c92 98 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 99 */
dan_ackme 0:ea85c4bb5e1f 100 WiconnectResult isWebSetupRunning(bool *isRunningPtr);
dan_ackme 0:ea85c4bb5e1f 101
dan_ackme 11:ea484e1b7fc4 102
dan_ackme 11:ea484e1b7fc4 103 // ------------------------------------------------------------------------
dan_ackme 11:ea484e1b7fc4 104
dan_ackme 11:ea484e1b7fc4 105
dan_ackme 11:ea484e1b7fc4 106 /**
dan_ackme 11:ea484e1b7fc4 107 * @ingroup api_network_wlan
dan_ackme 11:ea484e1b7fc4 108 *
dan_ackme 11:ea484e1b7fc4 109 * @brief Join a WiFi network.
dan_ackme 13:2b51f5267c92 110 *
dan_ackme 13:2b51f5267c92 111 * This command has an optional background processing feature.
dan_ackme 13:2b51f5267c92 112 * Background processing is enabled if the completeHandler parameter
dan_ackme 13:2b51f5267c92 113 * is specified. If enabled, the library will poll the module every second
dan_ackme 13:2b51f5267c92 114 * for the join status (essentially it'll call getNetworkStatus() every
dan_ackme 13:2b51f5267c92 115 * second in the background). When the module join sequence complete the callback will be executed.
dan_ackme 21:17bb3eddcbae 116 * The background processing is disabled when leave() is called.
dan_ackme 21:17bb3eddcbae 117 *
dan_ackme 21:17bb3eddcbae 118 * * If completeHandler parameter is NOT specified:
dan_ackme 21:17bb3eddcbae 119 * This command will BLOCK/return WICONNECT_PROCESSING until the module has
dan_ackme 21:17bb3eddcbae 120 * either successfully joined the network or failed.
dan_ackme 21:17bb3eddcbae 121 * * If the completeHandler parameter IS specified:
dan_ackme 17:7268f365676b 122 * This command will return and use the background processing feature described above.
dan_ackme 13:2b51f5267c92 123 *
dan_ackme 13:2b51f5267c92 124 * @note only the 'result' parameter of the callback handler is valid.
dan_ackme 13:2b51f5267c92 125 *
dan_ackme 13:2b51f5267c92 126 * Refer to @ref setting_async_processing for more info.
dan_ackme 13:2b51f5267c92 127 *
dan_ackme 13:2b51f5267c92 128 * @param[in] ssid Optional, optionally set the SSID of the network to join
dan_ackme 13:2b51f5267c92 129 * @param[in] password Optional, optionally set the passkey of the network to join
dan_ackme 13:2b51f5267c92 130 * Note: to join an OPEN network, set this parameter to a null string (i.e. "")
dan_ackme 13:2b51f5267c92 131 * @param[in] completeHandler Optional, callback to be executed when the join sequence completes.
dan_ackme 26:8067e3d463d3 132 * The 'result' callback parameter contains the WiconnectResult of joining.
dan_ackme 26:8067e3d463d3 133 * The 'arg1' parameter is a @ref NetworkJoinResult of joining.
dan_ackme 13:2b51f5267c92 134 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 135 */
dan_ackme 0:ea85c4bb5e1f 136 WiconnectResult join(const char* ssid = NULL, const char *password = NULL, const Callback &completeHandler = Callback());
dan_ackme 11:ea484e1b7fc4 137
dan_ackme 11:ea484e1b7fc4 138 /**
dan_ackme 11:ea484e1b7fc4 139 * @ingroup api_network_wlan
dan_ackme 11:ea484e1b7fc4 140 *
dan_ackme 11:ea484e1b7fc4 141 * @brief Leave a WiFi network.
dan_ackme 13:2b51f5267c92 142 *
dan_ackme 13:2b51f5267c92 143 * This method may be called to either terminate a join sequence or
dan_ackme 13:2b51f5267c92 144 * leave a previously connected networked.
dan_ackme 13:2b51f5267c92 145 *
dan_ackme 13:2b51f5267c92 146 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 147 */
dan_ackme 0:ea85c4bb5e1f 148 WiconnectResult leave();
dan_ackme 11:ea484e1b7fc4 149
dan_ackme 11:ea484e1b7fc4 150 /**
dan_ackme 11:ea484e1b7fc4 151 * @ingroup api_network_wlan
dan_ackme 11:ea484e1b7fc4 152 *
dan_ackme 11:ea484e1b7fc4 153 * @brief Get connection status to WiFi network.
dan_ackme 13:2b51f5267c92 154 *
dan_ackme 13:2b51f5267c92 155 * Refer to @ref NetworkStatus for more info.
dan_ackme 13:2b51f5267c92 156 *
dan_ackme 13:2b51f5267c92 157 * @param[out] statusPtr Point to a @ref NetworkStatus which will hold current network status of module
dan_ackme 13:2b51f5267c92 158 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 159 */
dan_ackme 0:ea85c4bb5e1f 160 WiconnectResult getNetworkStatus(NetworkStatus *statusPtr);
dan_ackme 0:ea85c4bb5e1f 161
dan_ackme 26:8067e3d463d3 162 /**
dan_ackme 26:8067e3d463d3 163 * @ingroup api_network_wlan
dan_ackme 26:8067e3d463d3 164 *
dan_ackme 26:8067e3d463d3 165 * @brief Get the result of joining the network
dan_ackme 26:8067e3d463d3 166 *
dan_ackme 26:8067e3d463d3 167 * Refer to @ref NetworkJoinResult for more info.
dan_ackme 26:8067e3d463d3 168 *
dan_ackme 26:8067e3d463d3 169 * @param[out] joinResultPtr Point to a @ref NetworkJoinResult which will hold the result of joining the network
dan_ackme 26:8067e3d463d3 170 * @return Result of method. See @ref WiconnectResult
dan_ackme 26:8067e3d463d3 171 */
dan_ackme 26:8067e3d463d3 172 WiconnectResult getNetworkJoinResult(NetworkJoinResult *joinResultPtr);
dan_ackme 26:8067e3d463d3 173
dan_ackme 11:ea484e1b7fc4 174 // ------------------------------------------------------------------------
dan_ackme 11:ea484e1b7fc4 175
dan_ackme 11:ea484e1b7fc4 176
dan_ackme 0:ea85c4bb5e1f 177 // WiconnectResult startSoftAp(const char* ssid = NULL, const char *password = NULL, const Callback &clientConnectedCallback = Callback());
dan_ackme 0:ea85c4bb5e1f 178 // WiconnectResult stopSoftAp();
dan_ackme 0:ea85c4bb5e1f 179 // WiconnectResult getSoftApClientList();
dan_ackme 0:ea85c4bb5e1f 180
dan_ackme 11:ea484e1b7fc4 181
dan_ackme 11:ea484e1b7fc4 182 // ------------------------------------------------------------------------
dan_ackme 11:ea484e1b7fc4 183
dan_ackme 11:ea484e1b7fc4 184
dan_ackme 11:ea484e1b7fc4 185 /**
dan_ackme 11:ea484e1b7fc4 186 * @ingroup api_network_util
dan_ackme 11:ea484e1b7fc4 187 *
dan_ackme 11:ea484e1b7fc4 188 * @brief Scan for available WiFi networks.
dan_ackme 13:2b51f5267c92 189 *
dan_ackme 13:2b51f5267c92 190 * The populate the supplied @ref ScanResultList with @ref ScanResult of each found network.
dan_ackme 13:2b51f5267c92 191 *
dan_ackme 13:2b51f5267c92 192 * Optionally only scan of specific channels by supplying a null terminated list of channels.
dan_ackme 13:2b51f5267c92 193 * Example:
dan_ackme 13:2b51f5267c92 194 * @code
dan_ackme 13:2b51f5267c92 195 * const uint8_t channelsToScan[] = {1, 6, 11, 0};
dan_ackme 13:2b51f5267c92 196 * @endcode
dan_ackme 13:2b51f5267c92 197 *
dan_ackme 13:2b51f5267c92 198 * @param[out] resultList List to populate with scan results.
dan_ackme 13:2b51f5267c92 199 * @param[in] channelList Optional, null terminated list of channels to scan.
dan_ackme 13:2b51f5267c92 200 * @param[in] ssid Optional, specific network name to scan for.
dan_ackme 13:2b51f5267c92 201 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 202 */
dan_ackme 0:ea85c4bb5e1f 203 WiconnectResult scan(ScanResultList &resultList, const uint8_t *channelList = NULL, const char* ssid = NULL);
dan_ackme 11:ea484e1b7fc4 204
dan_ackme 11:ea484e1b7fc4 205 /**
dan_ackme 11:ea484e1b7fc4 206 * @ingroup api_network_util
dan_ackme 11:ea484e1b7fc4 207 *
dan_ackme 11:ea484e1b7fc4 208 * @brief Ping a WiFi network.
dan_ackme 13:2b51f5267c92 209 *
dan_ackme 13:2b51f5267c92 210 * Optionally ping a specific server and return the time in milliseconds it took
dan_ackme 13:2b51f5267c92 211 * for the network to response. If no domain is supplied, the module pings to gateway
dan_ackme 13:2b51f5267c92 212 * (i.e router it's connected to).
dan_ackme 13:2b51f5267c92 213 *
dan_ackme 13:2b51f5267c92 214 * @param[in] domain Optional, the domain name to ping
dan_ackme 13:2b51f5267c92 215 * @param[out] timeMsPtr Optional, pointer to uint32 to hold time in milliseconds the ping took
dan_ackme 13:2b51f5267c92 216 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 217 */
dan_ackme 0:ea85c4bb5e1f 218 WiconnectResult ping(const char *domain = NULL, uint32_t *timeMsPtr = NULL);
dan_ackme 11:ea484e1b7fc4 219
dan_ackme 11:ea484e1b7fc4 220 /**
dan_ackme 11:ea484e1b7fc4 221 * @ingroup api_network_util
dan_ackme 11:ea484e1b7fc4 222 *
dan_ackme 11:ea484e1b7fc4 223 * @brief Resolve domain name into IP address.
dan_ackme 13:2b51f5267c92 224 *
dan_ackme 13:2b51f5267c92 225 * @param[in] domain The domain name to resolve
dan_ackme 13:2b51f5267c92 226 * @param[out] ipAddressPtr pointer to uint32 to hold resolved IP address. Note, the IP address is in network-byte-order.
dan_ackme 13:2b51f5267c92 227 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 228 */
dan_ackme 0:ea85c4bb5e1f 229 WiconnectResult lookup(const char *domain, uint32_t *ipAddressPtr);
dan_ackme 0:ea85c4bb5e1f 230
dan_ackme 11:ea484e1b7fc4 231
dan_ackme 11:ea484e1b7fc4 232 // ------------------------------------------------------------------------
dan_ackme 11:ea484e1b7fc4 233
dan_ackme 11:ea484e1b7fc4 234
dan_ackme 11:ea484e1b7fc4 235 /**
dan_ackme 11:ea484e1b7fc4 236 * @ingroup api_network_settings
dan_ackme 11:ea484e1b7fc4 237 *
dan_ackme 11:ea484e1b7fc4 238 * @brief Set DHCP enabled.
dan_ackme 13:2b51f5267c92 239 *
dan_ackme 13:2b51f5267c92 240 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 241 */
dan_ackme 0:ea85c4bb5e1f 242 WiconnectResult setDhcpEnabled(bool enabled);
dan_ackme 11:ea484e1b7fc4 243
dan_ackme 11:ea484e1b7fc4 244 /**
dan_ackme 11:ea484e1b7fc4 245 * @ingroup api_network_settings
dan_ackme 11:ea484e1b7fc4 246 *
dan_ackme 11:ea484e1b7fc4 247 * @brief Get if DHCP enabled.
dan_ackme 11:ea484e1b7fc4 248 */
dan_ackme 0:ea85c4bb5e1f 249 WiconnectResult getDhcpEnabled(bool *enabledPtr);
dan_ackme 11:ea484e1b7fc4 250
dan_ackme 11:ea484e1b7fc4 251 /**
dan_ackme 11:ea484e1b7fc4 252 * @ingroup api_network_settings
dan_ackme 11:ea484e1b7fc4 253 *
dan_ackme 11:ea484e1b7fc4 254 * @brief Set static IP settings
dan_ackme 11:ea484e1b7fc4 255 */
dan_ackme 0:ea85c4bb5e1f 256 WiconnectResult setIpSettings(uint32_t ip, uint32_t netmask, uint32_t gateway);
dan_ackme 11:ea484e1b7fc4 257
dan_ackme 11:ea484e1b7fc4 258 /**
dan_ackme 11:ea484e1b7fc4 259 * @ingroup api_network_settings
dan_ackme 11:ea484e1b7fc4 260 *
dan_ackme 11:ea484e1b7fc4 261 * @brief Set static IP settings (with string parameters)
dan_ackme 11:ea484e1b7fc4 262 */
dan_ackme 0:ea85c4bb5e1f 263 WiconnectResult setIpSettings(const char* ip, const char* netmask, const char* gateway);
dan_ackme 11:ea484e1b7fc4 264
dan_ackme 11:ea484e1b7fc4 265 /**
dan_ackme 11:ea484e1b7fc4 266 * @ingroup api_network_settings
dan_ackme 11:ea484e1b7fc4 267 *
dan_ackme 11:ea484e1b7fc4 268 * @brief Get network IP settings
dan_ackme 11:ea484e1b7fc4 269 */
dan_ackme 0:ea85c4bb5e1f 270 WiconnectResult getIpSettings(uint32_t *ip, uint32_t *netmask, uint32_t *gateway);
dan_ackme 11:ea484e1b7fc4 271
dan_ackme 11:ea484e1b7fc4 272 /**
dan_ackme 11:ea484e1b7fc4 273 * @ingroup api_network_settings
dan_ackme 11:ea484e1b7fc4 274 *
dan_ackme 11:ea484e1b7fc4 275 * @brief Get signal strength to WiFi network
dan_ackme 11:ea484e1b7fc4 276 */
dan_ackme 0:ea85c4bb5e1f 277 WiconnectResult getSignalStrength(NetworkSignalStrength *signalStrengthPtr);
dan_ackme 0:ea85c4bb5e1f 278
dan_ackme 21:17bb3eddcbae 279
dan_ackme 21:17bb3eddcbae 280 /**
dan_ackme 21:17bb3eddcbae 281 * @ingroup api_network_settings
dan_ackme 21:17bb3eddcbae 282 *
dan_ackme 21:17bb3eddcbae 283 * @note This method is only supported in blocking mode.
dan_ackme 21:17bb3eddcbae 284 *
dan_ackme 21:17bb3eddcbae 285 * @brief Return the current IP address of the module if possible, else
dan_ackme 21:17bb3eddcbae 286 * return 0.0.0.0
dan_ackme 21:17bb3eddcbae 287 * @param[in] buffer Optional, buffer to IP address string. If omitted,
dan_ackme 21:17bb3eddcbae 288 * the IP address string is stored in a local static buffer (this is non-reentrant!)
dan_ackme 21:17bb3eddcbae 289 */
dan_ackme 21:17bb3eddcbae 290 const char* getIpAddress(char *buffer = NULL);
dan_ackme 21:17bb3eddcbae 291
dan_ackme 11:ea484e1b7fc4 292
dan_ackme 11:ea484e1b7fc4 293 // ------------------------------------------------------------------------
dan_ackme 11:ea484e1b7fc4 294
dan_ackme 11:ea484e1b7fc4 295
dan_ackme 11:ea484e1b7fc4 296 /**
dan_ackme 11:ea484e1b7fc4 297 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 298 *
dan_ackme 11:ea484e1b7fc4 299 * @brief Convert string to IP address
dan_ackme 11:ea484e1b7fc4 300 */
dan_ackme 0:ea85c4bb5e1f 301 static bool strToIp(const char *str, uint32_t *intPtr);
dan_ackme 11:ea484e1b7fc4 302
dan_ackme 11:ea484e1b7fc4 303 /**
dan_ackme 11:ea484e1b7fc4 304 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 305 *
dan_ackme 11:ea484e1b7fc4 306 * @brief Convert IP address to string
dan_ackme 11:ea484e1b7fc4 307 */
dan_ackme 0:ea85c4bb5e1f 308 static const char* ipToStr(uint32_t ip, char *ipStrBuffer = NULL);
dan_ackme 11:ea484e1b7fc4 309
dan_ackme 11:ea484e1b7fc4 310 /**
dan_ackme 11:ea484e1b7fc4 311 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 312 *
dan_ackme 11:ea484e1b7fc4 313 * @brief Convert @ref NetworkStatus to string
dan_ackme 11:ea484e1b7fc4 314 */
dan_ackme 0:ea85c4bb5e1f 315 static const char* networkStatusToStr(NetworkStatus status);
dan_ackme 11:ea484e1b7fc4 316
dan_ackme 11:ea484e1b7fc4 317 /**
dan_ackme 11:ea484e1b7fc4 318 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 319 *
dan_ackme 26:8067e3d463d3 320 * @brief Convert @ref NetworkJoinResult to string
dan_ackme 26:8067e3d463d3 321 */
dan_ackme 26:8067e3d463d3 322 static const char* networkJoinResultToStr(NetworkJoinResult joinResult);
dan_ackme 26:8067e3d463d3 323
dan_ackme 26:8067e3d463d3 324 /**
dan_ackme 26:8067e3d463d3 325 * @ingroup conversion_util
dan_ackme 26:8067e3d463d3 326 *
dan_ackme 11:ea484e1b7fc4 327 * @brief Convert @ref NetworkSignalStrength to string
dan_ackme 11:ea484e1b7fc4 328 */
dan_ackme 0:ea85c4bb5e1f 329 static const char* signalStrengthToStr(NetworkSignalStrength signalStrenth);
dan_ackme 11:ea484e1b7fc4 330
dan_ackme 11:ea484e1b7fc4 331 /**
dan_ackme 11:ea484e1b7fc4 332 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 333 *
dan_ackme 11:ea484e1b7fc4 334 * @brief Convert RSSI (in dBm) to @ref NetworkSignalStrength
dan_ackme 11:ea484e1b7fc4 335 */
dan_ackme 0:ea85c4bb5e1f 336 static NetworkSignalStrength rssiToSignalStrength(int rssi);
dan_ackme 11:ea484e1b7fc4 337
dan_ackme 11:ea484e1b7fc4 338 /**
dan_ackme 11:ea484e1b7fc4 339 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 340 *
dan_ackme 11:ea484e1b7fc4 341 * @brief Convert string to @ref NetworkSecurity
dan_ackme 11:ea484e1b7fc4 342 */
dan_ackme 0:ea85c4bb5e1f 343 static NetworkSecurity strToNetworkSecurity(const char *str);
dan_ackme 11:ea484e1b7fc4 344
dan_ackme 11:ea484e1b7fc4 345 /**
dan_ackme 11:ea484e1b7fc4 346 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 347 *
dan_ackme 11:ea484e1b7fc4 348 * @brief Convert @ref NetworkSecurity to string
dan_ackme 11:ea484e1b7fc4 349 */
dan_ackme 0:ea85c4bb5e1f 350 static const char* networkSecurityToStr(NetworkSecurity security);
dan_ackme 11:ea484e1b7fc4 351
dan_ackme 11:ea484e1b7fc4 352 /**
dan_ackme 11:ea484e1b7fc4 353 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 354 *
dan_ackme 11:ea484e1b7fc4 355 * @brief Convert string @ref Ssid
dan_ackme 11:ea484e1b7fc4 356 */
dan_ackme 0:ea85c4bb5e1f 357 static bool strToSsid(const char *str, Ssid *ssid);
dan_ackme 11:ea484e1b7fc4 358
dan_ackme 11:ea484e1b7fc4 359 /**
dan_ackme 11:ea484e1b7fc4 360 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 361 *
dan_ackme 11:ea484e1b7fc4 362 * @brief Convert @ref Ssid to string
dan_ackme 11:ea484e1b7fc4 363 */
dan_ackme 0:ea85c4bb5e1f 364 static const char* ssidToStr(const Ssid *ssid, char *ssidStrBuffer = NULL);
dan_ackme 11:ea484e1b7fc4 365
dan_ackme 11:ea484e1b7fc4 366 /**
dan_ackme 11:ea484e1b7fc4 367 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 368 *
dan_ackme 11:ea484e1b7fc4 369 * @brief Convert string @ref MacAddress
dan_ackme 11:ea484e1b7fc4 370 */
dan_ackme 0:ea85c4bb5e1f 371 static bool strToMacAddress(const char *str, MacAddress *macAddress);
dan_ackme 11:ea484e1b7fc4 372
dan_ackme 11:ea484e1b7fc4 373 /**
dan_ackme 11:ea484e1b7fc4 374 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 375 *
dan_ackme 11:ea484e1b7fc4 376 * @brief Convert @ref MacAddress to string
dan_ackme 11:ea484e1b7fc4 377 */
dan_ackme 0:ea85c4bb5e1f 378 static const char* macAddressToStr(const MacAddress *macAddress, char *macStrBuffer = NULL);
dan_ackme 0:ea85c4bb5e1f 379
dan_ackme 0:ea85c4bb5e1f 380 protected:
dan_ackme 0:ea85c4bb5e1f 381 NetworkInterface(Wiconnect *wiconnect);
dan_ackme 0:ea85c4bb5e1f 382
dan_ackme 0:ea85c4bb5e1f 383 WiconnectResult processScanResults(char *resultStr, ScanResultList &resultList);
dan_ackme 0:ea85c4bb5e1f 384
dan_ackme 0:ea85c4bb5e1f 385 #ifdef WICONNECT_ASYNC_TIMER_ENABLED
dan_ackme 0:ea85c4bb5e1f 386 Callback completeHandler;
dan_ackme 0:ea85c4bb5e1f 387 PeriodicTimer monitorTimer;
dan_ackme 0:ea85c4bb5e1f 388
dan_ackme 0:ea85c4bb5e1f 389 void webSetupStatusMonitor();
dan_ackme 0:ea85c4bb5e1f 390 void webSetupStatusCheckCallback(WiconnectResult result, void *arg1, void *arg2);
dan_ackme 0:ea85c4bb5e1f 391
dan_ackme 0:ea85c4bb5e1f 392 void joinStatusMonitor();
dan_ackme 0:ea85c4bb5e1f 393 void joinStatusCheckCallback(WiconnectResult result, void *arg1, void *arg2);
dan_ackme 0:ea85c4bb5e1f 394
dan_ackme 0:ea85c4bb5e1f 395 //void scanCompleteCallback(WiconnectResult result, void *arg1, void *arg2);
dan_ackme 0:ea85c4bb5e1f 396 #endif
dan_ackme 0:ea85c4bb5e1f 397
dan_ackme 0:ea85c4bb5e1f 398 private:
dan_ackme 0:ea85c4bb5e1f 399 Wiconnect *wiconnect;
dan_ackme 0:ea85c4bb5e1f 400 };
dan_ackme 0:ea85c4bb5e1f 401
dan_ackme 0:ea85c4bb5e1f 402 }