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:
Wed Aug 13 04:41:04 2014 -0700
Revision:
16:7f1d6d359787
Parent:
13:2b51f5267c92
Child:
17:7268f365676b
updated documentation and copyright

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dan_ackme 16:7f1d6d359787 1 /**
dan_ackme 16:7f1d6d359787 2 * ACKme WiConnect Host Library is licensed under the BSD licence:
dan_ackme 16:7f1d6d359787 3 *
dan_ackme 16:7f1d6d359787 4 * Copyright (c)2014 ACKme Networks.
dan_ackme 16:7f1d6d359787 5 * All rights reserved.
dan_ackme 16:7f1d6d359787 6 *
dan_ackme 16:7f1d6d359787 7 * Redistribution and use in source and binary forms, with or without modification,
dan_ackme 16:7f1d6d359787 8 * are permitted provided that the following conditions are met:
dan_ackme 16:7f1d6d359787 9 *
dan_ackme 16:7f1d6d359787 10 * 1. Redistributions of source code must retain the above copyright notice,
dan_ackme 16:7f1d6d359787 11 * this list of conditions and the following disclaimer.
dan_ackme 16:7f1d6d359787 12 * 2. Redistributions in binary form must reproduce the above copyright notice,
dan_ackme 16:7f1d6d359787 13 * this list of conditions and the following disclaimer in the documentation
dan_ackme 16:7f1d6d359787 14 * and/or other materials provided with the distribution.
dan_ackme 16:7f1d6d359787 15 * 3. The name of the author may not be used to endorse or promote products
dan_ackme 16:7f1d6d359787 16 * derived from this software without specific prior written permission.
dan_ackme 16:7f1d6d359787 17 *
dan_ackme 16:7f1d6d359787 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS AND ANY EXPRESS OR IMPLIED
dan_ackme 16:7f1d6d359787 19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
dan_ackme 16:7f1d6d359787 20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
dan_ackme 16:7f1d6d359787 21 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
dan_ackme 16:7f1d6d359787 22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
dan_ackme 16:7f1d6d359787 23 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
dan_ackme 16:7f1d6d359787 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
dan_ackme 16:7f1d6d359787 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
dan_ackme 16:7f1d6d359787 26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
dan_ackme 16:7f1d6d359787 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 * @note This command is returns when the join sequence has STARTED.
dan_ackme 13:2b51f5267c92 112 * To determine if the module has successfully join the network either
dan_ackme 13:2b51f5267c92 113 * specify the completeHandler or periodically call getNetworkStatus()
dan_ackme 13:2b51f5267c92 114 *
dan_ackme 13:2b51f5267c92 115 * This command has an optional background processing feature.
dan_ackme 13:2b51f5267c92 116 * Background processing is enabled if the completeHandler parameter
dan_ackme 13:2b51f5267c92 117 * is specified. If enabled, the library will poll the module every second
dan_ackme 13:2b51f5267c92 118 * for the join status (essentially it'll call getNetworkStatus() every
dan_ackme 13:2b51f5267c92 119 * second in the background). When the module join sequence complete the callback will be executed.
dan_ackme 13:2b51f5267c92 120 * The background processing is disabled when leave() is called.
dan_ackme 13:2b51f5267c92 121 *
dan_ackme 13:2b51f5267c92 122 * @note only the 'result' parameter of the callback handler is valid.
dan_ackme 13:2b51f5267c92 123 *
dan_ackme 13:2b51f5267c92 124 * Refer to @ref setting_async_processing for more info.
dan_ackme 13:2b51f5267c92 125 *
dan_ackme 13:2b51f5267c92 126 * @param[in] ssid Optional, optionally set the SSID of the network to join
dan_ackme 13:2b51f5267c92 127 * @param[in] password Optional, optionally set the passkey of the network to join
dan_ackme 13:2b51f5267c92 128 * Note: to join an OPEN network, set this parameter to a null string (i.e. "")
dan_ackme 13:2b51f5267c92 129 * @param[in] completeHandler Optional, callback to be executed when the join sequence completes.
dan_ackme 13:2b51f5267c92 130 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 131 */
dan_ackme 0:ea85c4bb5e1f 132 WiconnectResult join(const char* ssid = NULL, const char *password = NULL, const Callback &completeHandler = Callback());
dan_ackme 11:ea484e1b7fc4 133
dan_ackme 11:ea484e1b7fc4 134 /**
dan_ackme 11:ea484e1b7fc4 135 * @ingroup api_network_wlan
dan_ackme 11:ea484e1b7fc4 136 *
dan_ackme 11:ea484e1b7fc4 137 * @brief Leave a WiFi network.
dan_ackme 13:2b51f5267c92 138 *
dan_ackme 13:2b51f5267c92 139 * This method may be called to either terminate a join sequence or
dan_ackme 13:2b51f5267c92 140 * leave a previously connected networked.
dan_ackme 13:2b51f5267c92 141 *
dan_ackme 13:2b51f5267c92 142 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 143 */
dan_ackme 0:ea85c4bb5e1f 144 WiconnectResult leave();
dan_ackme 11:ea484e1b7fc4 145
dan_ackme 11:ea484e1b7fc4 146 /**
dan_ackme 11:ea484e1b7fc4 147 * @ingroup api_network_wlan
dan_ackme 11:ea484e1b7fc4 148 *
dan_ackme 11:ea484e1b7fc4 149 * @brief Get connection status to WiFi network.
dan_ackme 13:2b51f5267c92 150 *
dan_ackme 13:2b51f5267c92 151 * Refer to @ref NetworkStatus for more info.
dan_ackme 13:2b51f5267c92 152 *
dan_ackme 13:2b51f5267c92 153 * @param[out] statusPtr Point to a @ref NetworkStatus which will hold current network status of module
dan_ackme 13:2b51f5267c92 154 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 155 */
dan_ackme 0:ea85c4bb5e1f 156 WiconnectResult getNetworkStatus(NetworkStatus *statusPtr);
dan_ackme 0:ea85c4bb5e1f 157
dan_ackme 11:ea484e1b7fc4 158 // ------------------------------------------------------------------------
dan_ackme 11:ea484e1b7fc4 159
dan_ackme 11:ea484e1b7fc4 160
dan_ackme 0:ea85c4bb5e1f 161 // WiconnectResult startSoftAp(const char* ssid = NULL, const char *password = NULL, const Callback &clientConnectedCallback = Callback());
dan_ackme 0:ea85c4bb5e1f 162 // WiconnectResult stopSoftAp();
dan_ackme 0:ea85c4bb5e1f 163 // WiconnectResult getSoftApClientList();
dan_ackme 0:ea85c4bb5e1f 164
dan_ackme 11:ea484e1b7fc4 165
dan_ackme 11:ea484e1b7fc4 166 // ------------------------------------------------------------------------
dan_ackme 11:ea484e1b7fc4 167
dan_ackme 11:ea484e1b7fc4 168
dan_ackme 11:ea484e1b7fc4 169 /**
dan_ackme 11:ea484e1b7fc4 170 * @ingroup api_network_util
dan_ackme 11:ea484e1b7fc4 171 *
dan_ackme 11:ea484e1b7fc4 172 * @brief Scan for available WiFi networks.
dan_ackme 13:2b51f5267c92 173 *
dan_ackme 13:2b51f5267c92 174 * The populate the supplied @ref ScanResultList with @ref ScanResult of each found network.
dan_ackme 13:2b51f5267c92 175 *
dan_ackme 13:2b51f5267c92 176 * Optionally only scan of specific channels by supplying a null terminated list of channels.
dan_ackme 13:2b51f5267c92 177 * Example:
dan_ackme 13:2b51f5267c92 178 * @code
dan_ackme 13:2b51f5267c92 179 * const uint8_t channelsToScan[] = {1, 6, 11, 0};
dan_ackme 13:2b51f5267c92 180 * @endcode
dan_ackme 13:2b51f5267c92 181 *
dan_ackme 13:2b51f5267c92 182 * @param[out] resultList List to populate with scan results.
dan_ackme 13:2b51f5267c92 183 * @param[in] channelList Optional, null terminated list of channels to scan.
dan_ackme 13:2b51f5267c92 184 * @param[in] ssid Optional, specific network name to scan for.
dan_ackme 13:2b51f5267c92 185 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 186 */
dan_ackme 0:ea85c4bb5e1f 187 WiconnectResult scan(ScanResultList &resultList, const uint8_t *channelList = NULL, const char* ssid = NULL);
dan_ackme 11:ea484e1b7fc4 188
dan_ackme 11:ea484e1b7fc4 189 /**
dan_ackme 11:ea484e1b7fc4 190 * @ingroup api_network_util
dan_ackme 11:ea484e1b7fc4 191 *
dan_ackme 11:ea484e1b7fc4 192 * @brief Ping a WiFi network.
dan_ackme 13:2b51f5267c92 193 *
dan_ackme 13:2b51f5267c92 194 * Optionally ping a specific server and return the time in milliseconds it took
dan_ackme 13:2b51f5267c92 195 * for the network to response. If no domain is supplied, the module pings to gateway
dan_ackme 13:2b51f5267c92 196 * (i.e router it's connected to).
dan_ackme 13:2b51f5267c92 197 *
dan_ackme 13:2b51f5267c92 198 * @param[in] domain Optional, the domain name to ping
dan_ackme 13:2b51f5267c92 199 * @param[out] timeMsPtr Optional, pointer to uint32 to hold time in milliseconds the ping took
dan_ackme 13:2b51f5267c92 200 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 201 */
dan_ackme 0:ea85c4bb5e1f 202 WiconnectResult ping(const char *domain = NULL, uint32_t *timeMsPtr = NULL);
dan_ackme 11:ea484e1b7fc4 203
dan_ackme 11:ea484e1b7fc4 204 /**
dan_ackme 11:ea484e1b7fc4 205 * @ingroup api_network_util
dan_ackme 11:ea484e1b7fc4 206 *
dan_ackme 11:ea484e1b7fc4 207 * @brief Resolve domain name into IP address.
dan_ackme 13:2b51f5267c92 208 *
dan_ackme 13:2b51f5267c92 209 * @param[in] domain The domain name to resolve
dan_ackme 13:2b51f5267c92 210 * @param[out] ipAddressPtr pointer to uint32 to hold resolved IP address. Note, the IP address is in network-byte-order.
dan_ackme 13:2b51f5267c92 211 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 212 */
dan_ackme 0:ea85c4bb5e1f 213 WiconnectResult lookup(const char *domain, uint32_t *ipAddressPtr);
dan_ackme 0:ea85c4bb5e1f 214
dan_ackme 11:ea484e1b7fc4 215
dan_ackme 11:ea484e1b7fc4 216 // ------------------------------------------------------------------------
dan_ackme 11:ea484e1b7fc4 217
dan_ackme 11:ea484e1b7fc4 218
dan_ackme 11:ea484e1b7fc4 219 /**
dan_ackme 11:ea484e1b7fc4 220 * @ingroup api_network_settings
dan_ackme 11:ea484e1b7fc4 221 *
dan_ackme 11:ea484e1b7fc4 222 * @brief Set DHCP enabled.
dan_ackme 13:2b51f5267c92 223 *
dan_ackme 13:2b51f5267c92 224 * @return Result of method. See @ref WiconnectResult
dan_ackme 11:ea484e1b7fc4 225 */
dan_ackme 0:ea85c4bb5e1f 226 WiconnectResult setDhcpEnabled(bool enabled);
dan_ackme 11:ea484e1b7fc4 227
dan_ackme 11:ea484e1b7fc4 228 /**
dan_ackme 11:ea484e1b7fc4 229 * @ingroup api_network_settings
dan_ackme 11:ea484e1b7fc4 230 *
dan_ackme 11:ea484e1b7fc4 231 * @brief Get if DHCP enabled.
dan_ackme 11:ea484e1b7fc4 232 */
dan_ackme 0:ea85c4bb5e1f 233 WiconnectResult getDhcpEnabled(bool *enabledPtr);
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 static IP settings
dan_ackme 11:ea484e1b7fc4 239 */
dan_ackme 0:ea85c4bb5e1f 240 WiconnectResult setIpSettings(uint32_t ip, uint32_t netmask, uint32_t gateway);
dan_ackme 11:ea484e1b7fc4 241
dan_ackme 11:ea484e1b7fc4 242 /**
dan_ackme 11:ea484e1b7fc4 243 * @ingroup api_network_settings
dan_ackme 11:ea484e1b7fc4 244 *
dan_ackme 11:ea484e1b7fc4 245 * @brief Set static IP settings (with string parameters)
dan_ackme 11:ea484e1b7fc4 246 */
dan_ackme 0:ea85c4bb5e1f 247 WiconnectResult setIpSettings(const char* ip, const char* netmask, const char* gateway);
dan_ackme 11:ea484e1b7fc4 248
dan_ackme 11:ea484e1b7fc4 249 /**
dan_ackme 11:ea484e1b7fc4 250 * @ingroup api_network_settings
dan_ackme 11:ea484e1b7fc4 251 *
dan_ackme 11:ea484e1b7fc4 252 * @brief Get network IP settings
dan_ackme 11:ea484e1b7fc4 253 */
dan_ackme 0:ea85c4bb5e1f 254 WiconnectResult getIpSettings(uint32_t *ip, uint32_t *netmask, uint32_t *gateway);
dan_ackme 11:ea484e1b7fc4 255
dan_ackme 11:ea484e1b7fc4 256 /**
dan_ackme 11:ea484e1b7fc4 257 * @ingroup api_network_settings
dan_ackme 11:ea484e1b7fc4 258 *
dan_ackme 11:ea484e1b7fc4 259 * @brief Get signal strength to WiFi network
dan_ackme 11:ea484e1b7fc4 260 */
dan_ackme 0:ea85c4bb5e1f 261 WiconnectResult getSignalStrength(NetworkSignalStrength *signalStrengthPtr);
dan_ackme 0:ea85c4bb5e1f 262
dan_ackme 11:ea484e1b7fc4 263
dan_ackme 11:ea484e1b7fc4 264 // ------------------------------------------------------------------------
dan_ackme 11:ea484e1b7fc4 265
dan_ackme 11:ea484e1b7fc4 266
dan_ackme 11:ea484e1b7fc4 267 /**
dan_ackme 11:ea484e1b7fc4 268 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 269 *
dan_ackme 11:ea484e1b7fc4 270 * @brief Convert string to IP address
dan_ackme 11:ea484e1b7fc4 271 */
dan_ackme 0:ea85c4bb5e1f 272 static bool strToIp(const char *str, uint32_t *intPtr);
dan_ackme 11:ea484e1b7fc4 273
dan_ackme 11:ea484e1b7fc4 274 /**
dan_ackme 11:ea484e1b7fc4 275 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 276 *
dan_ackme 11:ea484e1b7fc4 277 * @brief Convert IP address to string
dan_ackme 11:ea484e1b7fc4 278 */
dan_ackme 0:ea85c4bb5e1f 279 static const char* ipToStr(uint32_t ip, char *ipStrBuffer = NULL);
dan_ackme 11:ea484e1b7fc4 280
dan_ackme 11:ea484e1b7fc4 281 /**
dan_ackme 11:ea484e1b7fc4 282 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 283 *
dan_ackme 11:ea484e1b7fc4 284 * @brief Convert @ref NetworkStatus to string
dan_ackme 11:ea484e1b7fc4 285 */
dan_ackme 0:ea85c4bb5e1f 286 static const char* networkStatusToStr(NetworkStatus status);
dan_ackme 11:ea484e1b7fc4 287
dan_ackme 11:ea484e1b7fc4 288 /**
dan_ackme 11:ea484e1b7fc4 289 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 290 *
dan_ackme 11:ea484e1b7fc4 291 * @brief Convert @ref NetworkSignalStrength to string
dan_ackme 11:ea484e1b7fc4 292 */
dan_ackme 0:ea85c4bb5e1f 293 static const char* signalStrengthToStr(NetworkSignalStrength signalStrenth);
dan_ackme 11:ea484e1b7fc4 294
dan_ackme 11:ea484e1b7fc4 295 /**
dan_ackme 11:ea484e1b7fc4 296 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 297 *
dan_ackme 11:ea484e1b7fc4 298 * @brief Convert RSSI (in dBm) to @ref NetworkSignalStrength
dan_ackme 11:ea484e1b7fc4 299 */
dan_ackme 0:ea85c4bb5e1f 300 static NetworkSignalStrength rssiToSignalStrength(int rssi);
dan_ackme 11:ea484e1b7fc4 301
dan_ackme 11:ea484e1b7fc4 302 /**
dan_ackme 11:ea484e1b7fc4 303 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 304 *
dan_ackme 11:ea484e1b7fc4 305 * @brief Convert string to @ref NetworkSecurity
dan_ackme 11:ea484e1b7fc4 306 */
dan_ackme 0:ea85c4bb5e1f 307 static NetworkSecurity strToNetworkSecurity(const char *str);
dan_ackme 11:ea484e1b7fc4 308
dan_ackme 11:ea484e1b7fc4 309 /**
dan_ackme 11:ea484e1b7fc4 310 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 311 *
dan_ackme 11:ea484e1b7fc4 312 * @brief Convert @ref NetworkSecurity to string
dan_ackme 11:ea484e1b7fc4 313 */
dan_ackme 0:ea85c4bb5e1f 314 static const char* networkSecurityToStr(NetworkSecurity security);
dan_ackme 11:ea484e1b7fc4 315
dan_ackme 11:ea484e1b7fc4 316 /**
dan_ackme 11:ea484e1b7fc4 317 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 318 *
dan_ackme 11:ea484e1b7fc4 319 * @brief Convert string @ref Ssid
dan_ackme 11:ea484e1b7fc4 320 */
dan_ackme 0:ea85c4bb5e1f 321 static bool strToSsid(const char *str, Ssid *ssid);
dan_ackme 11:ea484e1b7fc4 322
dan_ackme 11:ea484e1b7fc4 323 /**
dan_ackme 11:ea484e1b7fc4 324 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 325 *
dan_ackme 11:ea484e1b7fc4 326 * @brief Convert @ref Ssid to string
dan_ackme 11:ea484e1b7fc4 327 */
dan_ackme 0:ea85c4bb5e1f 328 static const char* ssidToStr(const Ssid *ssid, char *ssidStrBuffer = NULL);
dan_ackme 11:ea484e1b7fc4 329
dan_ackme 11:ea484e1b7fc4 330 /**
dan_ackme 11:ea484e1b7fc4 331 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 332 *
dan_ackme 11:ea484e1b7fc4 333 * @brief Convert string @ref MacAddress
dan_ackme 11:ea484e1b7fc4 334 */
dan_ackme 0:ea85c4bb5e1f 335 static bool strToMacAddress(const char *str, MacAddress *macAddress);
dan_ackme 11:ea484e1b7fc4 336
dan_ackme 11:ea484e1b7fc4 337 /**
dan_ackme 11:ea484e1b7fc4 338 * @ingroup conversion_util
dan_ackme 11:ea484e1b7fc4 339 *
dan_ackme 11:ea484e1b7fc4 340 * @brief Convert @ref MacAddress to string
dan_ackme 11:ea484e1b7fc4 341 */
dan_ackme 0:ea85c4bb5e1f 342 static const char* macAddressToStr(const MacAddress *macAddress, char *macStrBuffer = NULL);
dan_ackme 0:ea85c4bb5e1f 343
dan_ackme 0:ea85c4bb5e1f 344 protected:
dan_ackme 0:ea85c4bb5e1f 345 NetworkInterface(Wiconnect *wiconnect);
dan_ackme 0:ea85c4bb5e1f 346
dan_ackme 0:ea85c4bb5e1f 347 WiconnectResult processScanResults(char *resultStr, ScanResultList &resultList);
dan_ackme 0:ea85c4bb5e1f 348
dan_ackme 0:ea85c4bb5e1f 349 #ifdef WICONNECT_ASYNC_TIMER_ENABLED
dan_ackme 0:ea85c4bb5e1f 350 Callback completeHandler;
dan_ackme 0:ea85c4bb5e1f 351 PeriodicTimer monitorTimer;
dan_ackme 0:ea85c4bb5e1f 352
dan_ackme 0:ea85c4bb5e1f 353 void webSetupStatusMonitor();
dan_ackme 0:ea85c4bb5e1f 354 void webSetupStatusCheckCallback(WiconnectResult result, void *arg1, void *arg2);
dan_ackme 0:ea85c4bb5e1f 355
dan_ackme 0:ea85c4bb5e1f 356 void joinStatusMonitor();
dan_ackme 0:ea85c4bb5e1f 357 void joinStatusCheckCallback(WiconnectResult result, void *arg1, void *arg2);
dan_ackme 0:ea85c4bb5e1f 358
dan_ackme 0:ea85c4bb5e1f 359 //void scanCompleteCallback(WiconnectResult result, void *arg1, void *arg2);
dan_ackme 0:ea85c4bb5e1f 360 #endif
dan_ackme 0:ea85c4bb5e1f 361
dan_ackme 0:ea85c4bb5e1f 362 private:
dan_ackme 0:ea85c4bb5e1f 363 Wiconnect *wiconnect;
dan_ackme 0:ea85c4bb5e1f 364 };
dan_ackme 0:ea85c4bb5e1f 365
dan_ackme 0:ea85c4bb5e1f 366 }