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:
Sat Sep 06 20:34:01 2014 -0700
Revision:
24:e27e23297f02
Parent:
21:17bb3eddcbae
Child:
27:b63f5a9cdefa
add api to get/set module settings

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 #include <stdint.h>
dan_ackme 0:ea85c4bb5e1f 32 #include <stdarg.h>
dan_ackme 21:17bb3eddcbae 33 #include <cstddef>
dan_ackme 0:ea85c4bb5e1f 34
dan_ackme 0:ea85c4bb5e1f 35 #include "sdk.h"
dan_ackme 0:ea85c4bb5e1f 36
dan_ackme 11:ea484e1b7fc4 37 /**
dan_ackme 11:ea484e1b7fc4 38 * @namespace wiconnect
dan_ackme 11:ea484e1b7fc4 39 *
dan_ackme 11:ea484e1b7fc4 40 * @brief The entire Wiconnect Library is contained within the 'wiconnect' namespace
dan_ackme 11:ea484e1b7fc4 41 */
dan_ackme 0:ea85c4bb5e1f 42 namespace wiconnect {
dan_ackme 0:ea85c4bb5e1f 43
dan_ackme 0:ea85c4bb5e1f 44
dan_ackme 0:ea85c4bb5e1f 45 #ifndef MIN
dan_ackme 11:ea484e1b7fc4 46 /**
dan_ackme 11:ea484e1b7fc4 47 * @ingroup api_core_macro
dan_ackme 11:ea484e1b7fc4 48 * @def MIN(x,y)
dan_ackme 11:ea484e1b7fc4 49 * @brief Computes the minimum of \a x and \a y.
dan_ackme 11:ea484e1b7fc4 50 */
dan_ackme 0:ea85c4bb5e1f 51 #define MIN(x,y) ((x) < (y) ? (x) : (y))
dan_ackme 0:ea85c4bb5e1f 52 #endif
dan_ackme 0:ea85c4bb5e1f 53 #ifndef MAX
dan_ackme 11:ea484e1b7fc4 54 /**
dan_ackme 11:ea484e1b7fc4 55 * @ingroup api_core_macro
dan_ackme 11:ea484e1b7fc4 56 * @def MAX(x,y)
dan_ackme 11:ea484e1b7fc4 57 * @brief Computes the maximum of \a x and \a y.
dan_ackme 11:ea484e1b7fc4 58 */
dan_ackme 0:ea85c4bb5e1f 59 #define MAX(x,y) ((x) > (y) ? (x) : (y))
dan_ackme 0:ea85c4bb5e1f 60 #endif
dan_ackme 11:ea484e1b7fc4 61 /**
dan_ackme 11:ea484e1b7fc4 62 * @ingroup api_core_macro
dan_ackme 11:ea484e1b7fc4 63 * @def ALIGN_n(x, n)
dan_ackme 11:ea484e1b7fc4 64 * @brief Align \a x to \a n bytes (\a n must be power of 2)
dan_ackme 11:ea484e1b7fc4 65 */
dan_ackme 0:ea85c4bb5e1f 66 #define ALIGN_n(x, n) ((((uint32_t)x) + ((n)-1)) & ~((n)-1))
dan_ackme 11:ea484e1b7fc4 67 /**
dan_ackme 11:ea484e1b7fc4 68 * @ingroup api_core_macro
dan_ackme 11:ea484e1b7fc4 69 * @def ALIGN_8(x)
dan_ackme 11:ea484e1b7fc4 70 * @brief Align \a x to 8 bytes
dan_ackme 11:ea484e1b7fc4 71 */
dan_ackme 0:ea85c4bb5e1f 72 #define ALIGN_8(x) ALIGN_n(x, 8)
dan_ackme 11:ea484e1b7fc4 73 /**
dan_ackme 11:ea484e1b7fc4 74 * @ingroup api_core_macro
dan_ackme 11:ea484e1b7fc4 75 * @def ALIGN_4(x)
dan_ackme 11:ea484e1b7fc4 76 * @brief Align \a x to 4 bytes
dan_ackme 11:ea484e1b7fc4 77 */
dan_ackme 0:ea85c4bb5e1f 78 #define ALIGN_4(x) ALIGN_n(x, 4)
dan_ackme 11:ea484e1b7fc4 79 /**
dan_ackme 11:ea484e1b7fc4 80 * @ingroup api_core_macro
dan_ackme 11:ea484e1b7fc4 81 * @def ARRAY_COUNT(x)
dan_ackme 11:ea484e1b7fc4 82 * @brief Return number of elements in static array \a x
dan_ackme 11:ea484e1b7fc4 83 */
dan_ackme 0:ea85c4bb5e1f 84 #define ARRAY_COUNT(x) (sizeof (x) / sizeof *(x))
dan_ackme 0:ea85c4bb5e1f 85
dan_ackme 0:ea85c4bb5e1f 86
dan_ackme 11:ea484e1b7fc4 87 /**
dan_ackme 11:ea484e1b7fc4 88 * @ingroup api_core_macro
dan_ackme 11:ea484e1b7fc4 89 * @def WICONNECT_FAILED(result, func)
dan_ackme 11:ea484e1b7fc4 90 * @brief Populates \a result with return value from \a func, returns TRUE if return value contains error.
dan_ackme 11:ea484e1b7fc4 91 */
dan_ackme 0:ea85c4bb5e1f 92 #define WICONNECT_FAILED(result, func) ((int)(result = (func)) < (int)wiconnect::WICONNECT_SUCCESS)
dan_ackme 11:ea484e1b7fc4 93
dan_ackme 11:ea484e1b7fc4 94 /**
dan_ackme 11:ea484e1b7fc4 95 * @ingroup api_core_macro
dan_ackme 11:ea484e1b7fc4 96 * @def WICONNECT_SUCCEEDED(result, func)
dan_ackme 11:ea484e1b7fc4 97 * @brief Populates \a result with return value from \a func, returns TRUE if return value is WICONNECT_SUCCESS.
dan_ackme 11:ea484e1b7fc4 98 */
dan_ackme 0:ea85c4bb5e1f 99 #define WICONNECT_SUCCEEDED(result, func) ((result = (func)) == wiconnect::WICONNECT_SUCCESS)
dan_ackme 0:ea85c4bb5e1f 100
dan_ackme 0:ea85c4bb5e1f 101
dan_ackme 11:ea484e1b7fc4 102 /**
dan_ackme 11:ea484e1b7fc4 103 * @ingroup api_core_macro
dan_ackme 11:ea484e1b7fc4 104 * @brief The maximum command size that may be sent to the WiConnect WiFi module
dan_ackme 11:ea484e1b7fc4 105 */
dan_ackme 0:ea85c4bb5e1f 106 #define WICONNECT_MAX_CMD_SIZE 128
dan_ackme 11:ea484e1b7fc4 107 /**
dan_ackme 11:ea484e1b7fc4 108 * @ingroup api_core_macro
dan_ackme 11:ea484e1b7fc4 109 * @brief The maximum WiConnect WiFi module version string size
dan_ackme 11:ea484e1b7fc4 110 */
dan_ackme 0:ea85c4bb5e1f 111 #define WICONNECT_MAX_VERSION_SIZE 96
dan_ackme 11:ea484e1b7fc4 112 /**
dan_ackme 11:ea484e1b7fc4 113 * @ingroup api_core_macro
dan_ackme 11:ea484e1b7fc4 114 * @brief The maximum number of simulanteous opened sockets
dan_ackme 11:ea484e1b7fc4 115 */
dan_ackme 0:ea85c4bb5e1f 116 #define WICONNECT_MAX_SOCKETS 8
dan_ackme 11:ea484e1b7fc4 117 /**
dan_ackme 11:ea484e1b7fc4 118 * @ingroup api_core_macro
dan_ackme 11:ea484e1b7fc4 119 * @brief The maximum server string length
dan_ackme 11:ea484e1b7fc4 120 */
dan_ackme 11:ea484e1b7fc4 121 #define WICONNECT_MAX_HOST_SIZE 64
dan_ackme 11:ea484e1b7fc4 122 /**
dan_ackme 11:ea484e1b7fc4 123 * @ingroup api_core_macro
dan_ackme 11:ea484e1b7fc4 124 * @brief The maximum Wiconnect Module flash filesystem filename length
dan_ackme 11:ea484e1b7fc4 125 */
dan_ackme 11:ea484e1b7fc4 126 #define WICONNECT_MAX_FILENAME_SIZE 96
dan_ackme 21:17bb3eddcbae 127 /**
dan_ackme 21:17bb3eddcbae 128 * @ingroup api_core_macro
dan_ackme 21:17bb3eddcbae 129 * @brief Never timeout
dan_ackme 21:17bb3eddcbae 130 */
dan_ackme 21:17bb3eddcbae 131 #define WICONNECT_WAIT_FOREVER 0xFFFFFFFF
dan_ackme 21:17bb3eddcbae 132 /**
dan_ackme 21:17bb3eddcbae 133 * @ingroup api_core_macro
dan_ackme 21:17bb3eddcbae 134 * @brief Timeout immediately
dan_ackme 21:17bb3eddcbae 135 */
dan_ackme 21:17bb3eddcbae 136 #define WICONNECT_NO_WAIT 0
dan_ackme 0:ea85c4bb5e1f 137
dan_ackme 11:ea484e1b7fc4 138
dan_ackme 11:ea484e1b7fc4 139 /**
dan_ackme 11:ea484e1b7fc4 140 * @ingroup api_socket_macro
dan_ackme 11:ea484e1b7fc4 141 * @brief Default which indicates to use the most optimal port
dan_ackme 11:ea484e1b7fc4 142 */
dan_ackme 11:ea484e1b7fc4 143 #define SOCKET_ANY_PORT (uint16_t)0
dan_ackme 11:ea484e1b7fc4 144 /**
dan_ackme 11:ea484e1b7fc4 145 * @ingroup api_socket_macro
dan_ackme 11:ea484e1b7fc4 146 * @brief Default which indicates to use the most optimal port
dan_ackme 11:ea484e1b7fc4 147 */
dan_ackme 0:ea85c4bb5e1f 148 #define SOCKET_INVALID_HANDLE ((uint8_t)0xFF)
dan_ackme 0:ea85c4bb5e1f 149
dan_ackme 0:ea85c4bb5e1f 150
dan_ackme 11:ea484e1b7fc4 151 /**
dan_ackme 13:2b51f5267c92 152 * @ingroup api_core_types
dan_ackme 11:ea484e1b7fc4 153 * @brief API Result code
dan_ackme 11:ea484e1b7fc4 154 */
dan_ackme 0:ea85c4bb5e1f 155 typedef enum
dan_ackme 0:ea85c4bb5e1f 156 {
dan_ackme 11:ea484e1b7fc4 157 // Status Codes
dan_ackme 11:ea484e1b7fc4 158 WICONNECT_ABORTED = 3, ///< Command was aborted
dan_ackme 11:ea484e1b7fc4 159 WICONNECT_IDLE = 2, ///< Library not processing any commands
dan_ackme 11:ea484e1b7fc4 160 WICONNECT_PROCESSING = 1, ///< Library processing current command
dan_ackme 11:ea484e1b7fc4 161 WICONNECT_SUCCESS = 0, ///< Command successfully completed
dan_ackme 11:ea484e1b7fc4 162
dan_ackme 11:ea484e1b7fc4 163 // Error codes
dan_ackme 11:ea484e1b7fc4 164 WICONNECT_ERROR = -1, ///< Generic error
dan_ackme 11:ea484e1b7fc4 165 WICONNECT_CMD_RESPONSE_ERROR = -2, ///< Module returned error code
dan_ackme 11:ea484e1b7fc4 166 WICONNECT_NULL_BUFFER = -3, ///< Null buffer supplied
dan_ackme 11:ea484e1b7fc4 167 WICONNECT_NOT_INITIALIZED = -4, ///< Library not initialed
dan_ackme 11:ea484e1b7fc4 168 WICONNECT_OVERFLOW = -5, ///< Buffer overflowed
dan_ackme 11:ea484e1b7fc4 169 WICONNECT_TIMEOUT = -6, ///< Command timed out
dan_ackme 11:ea484e1b7fc4 170 // WICONNECT_RESPONSE_HANDLER_NULL = -7, ///<
dan_ackme 11:ea484e1b7fc4 171 WICONNECT_RESPONSE_PARSE_ERROR = -8, ///< Failed to parse module response
dan_ackme 11:ea484e1b7fc4 172 WICONNECT_ANOTHER_CMD_EXECUTING = -9, ///< Currently executing another command
dan_ackme 11:ea484e1b7fc4 173 WICONNECT_BAD_ARG = -10, ///< Bad argument supplied
dan_ackme 11:ea484e1b7fc4 174 WICONNECT_UNSUPPORTED = -11, ///< Command / parameter not supported
dan_ackme 11:ea484e1b7fc4 175 WICONNECT_PINNAME_TO_GPIO_MAPPER_NULL = -12, ///< The pinToGpioMapper hasn't been set
dan_ackme 11:ea484e1b7fc4 176 WICONNECT_DUPLICATE = -13, ///< Duplicate value
dan_ackme 11:ea484e1b7fc4 177 WICONNECT_NOT_FOUND = -14, ///< Not found
dan_ackme 11:ea484e1b7fc4 178 WICONNECT_PINNAME_TO_GPIO_NO_MAPPING = -15, ///< No mapping found for given pin
dan_ackme 11:ea484e1b7fc4 179 WICONNECT_NOT_CONNECTED = -16, ///< Not connected
dan_ackme 11:ea484e1b7fc4 180 WICONNECT_UNDERFLOW = -17, ///< Data underflow
dan_ackme 11:ea484e1b7fc4 181 WICONNECT_MONITOR_NOT_AVAILABLE = -18, ///< Background processing monitor is not available (i.e in use)
dan_ackme 11:ea484e1b7fc4 182 WICONNECT_NOT_OPENED_FOR_READING = -19, ///< The file is not open for reading
dan_ackme 0:ea85c4bb5e1f 183 } WiconnectResult;
dan_ackme 0:ea85c4bb5e1f 184
dan_ackme 0:ea85c4bb5e1f 185
dan_ackme 11:ea484e1b7fc4 186 /**
dan_ackme 11:ea484e1b7fc4 187 * @ingroup types_core
dan_ackme 24:e27e23297f02 188 * @brief File type type
dan_ackme 24:e27e23297f02 189 */
dan_ackme 24:e27e23297f02 190 typedef enum
dan_ackme 24:e27e23297f02 191 {
dan_ackme 24:e27e23297f02 192 SETTING_WLAN_CHANNEL_MASK, ///< Mask of channels that are scan when joining a network
dan_ackme 24:e27e23297f02 193 } WiconnectSetting;
dan_ackme 24:e27e23297f02 194
dan_ackme 24:e27e23297f02 195
dan_ackme 24:e27e23297f02 196 /**
dan_ackme 24:e27e23297f02 197 * @ingroup types_core
dan_ackme 11:ea484e1b7fc4 198 * @brief Function pointer for mapping from a host pin to a WiConnect Module GPIO.
dan_ackme 11:ea484e1b7fc4 199 *
dan_ackme 11:ea484e1b7fc4 200 * @param[in] pin A host pin
dan_ackme 11:ea484e1b7fc4 201 * @return The corresponding WiConnect Module GPIO (which the given pin is physically connected).
dan_ackme 11:ea484e1b7fc4 202 * Return -1 if no mapping is available.
dan_ackme 11:ea484e1b7fc4 203 */
dan_ackme 11:ea484e1b7fc4 204 typedef int8_t (*PinToGpioMapper)(Pin pin);
dan_ackme 11:ea484e1b7fc4 205
dan_ackme 11:ea484e1b7fc4 206 /**
dan_ackme 11:ea484e1b7fc4 207 * @brief Generic buffer type
dan_ackme 13:2b51f5267c92 208 *
dan_ackme 13:2b51f5267c92 209 * @note Internal use only
dan_ackme 11:ea484e1b7fc4 210 */
dan_ackme 11:ea484e1b7fc4 211 typedef struct
dan_ackme 11:ea484e1b7fc4 212 {
dan_ackme 11:ea484e1b7fc4 213 int size;
dan_ackme 11:ea484e1b7fc4 214 uint8_t *buffer;
dan_ackme 11:ea484e1b7fc4 215 uint8_t *ptr;
dan_ackme 11:ea484e1b7fc4 216 int bytesPending;
dan_ackme 11:ea484e1b7fc4 217 bool allocated;
dan_ackme 11:ea484e1b7fc4 218 } Buffer;
dan_ackme 11:ea484e1b7fc4 219
dan_ackme 11:ea484e1b7fc4 220
dan_ackme 11:ea484e1b7fc4 221 // ----------------------------------------------------------------------------
dan_ackme 11:ea484e1b7fc4 222
dan_ackme 11:ea484e1b7fc4 223
dan_ackme 11:ea484e1b7fc4 224
dan_ackme 11:ea484e1b7fc4 225 /**
dan_ackme 13:2b51f5267c92 226 * @ingroup api_network_types
dan_ackme 11:ea484e1b7fc4 227 * @brief Network connection status
dan_ackme 11:ea484e1b7fc4 228 */
dan_ackme 0:ea85c4bb5e1f 229 typedef enum
dan_ackme 0:ea85c4bb5e1f 230 {
dan_ackme 11:ea484e1b7fc4 231 NETWORK_STATUS_DOWN, ///< Not connected to network
dan_ackme 11:ea484e1b7fc4 232 NETWORK_STATUS_WIFI_ONLY, ///< Connected to network but don't have IP address
dan_ackme 13:2b51f5267c92 233 NETWORK_STATUS_UP, ///< Conntected to network and have IP address
dan_ackme 13:2b51f5267c92 234 NETWORK_STATUS_JOINING ///< Joining a network
dan_ackme 0:ea85c4bb5e1f 235 } NetworkStatus;
dan_ackme 0:ea85c4bb5e1f 236
dan_ackme 11:ea484e1b7fc4 237 /**
dan_ackme 13:2b51f5267c92 238 * @ingroup api_network_types
dan_ackme 11:ea484e1b7fc4 239 * @brief Network RSSI signal level
dan_ackme 11:ea484e1b7fc4 240 */
dan_ackme 0:ea85c4bb5e1f 241 typedef enum
dan_ackme 0:ea85c4bb5e1f 242 {
dan_ackme 11:ea484e1b7fc4 243 NETWORK_RSSI_EXCELLENT = 0, ///< \> -20 dBm
dan_ackme 11:ea484e1b7fc4 244 NETWORK_RSSI_VERY_GOOD = 1, ///< \> -35 dBm
dan_ackme 11:ea484e1b7fc4 245 NETWORK_RSSI_GOOD = 2, ///< \> -50 dBm
dan_ackme 11:ea484e1b7fc4 246 NETWORK_RSSI_POOR = 3, ///< \> -70 dBm
dan_ackme 0:ea85c4bb5e1f 247 NETWORK_RSSI_VERY_POOR = 4, ///< < -71 dBm
dan_ackme 0:ea85c4bb5e1f 248 NETWORK_RSSI_UNKNOWN = 5 ///< Not available
dan_ackme 0:ea85c4bb5e1f 249 } NetworkSignalStrength;
dan_ackme 0:ea85c4bb5e1f 250
dan_ackme 11:ea484e1b7fc4 251 /**
dan_ackme 13:2b51f5267c92 252 * @ingroup api_network_types
dan_ackme 11:ea484e1b7fc4 253 * @brief Network security type
dan_ackme 11:ea484e1b7fc4 254 */
dan_ackme 0:ea85c4bb5e1f 255 typedef enum
dan_ackme 0:ea85c4bb5e1f 256 {
dan_ackme 0:ea85c4bb5e1f 257 NETWORK_SECURITY_OPEN,
dan_ackme 0:ea85c4bb5e1f 258 NETWORK_SECURITY_WEP_PSK,
dan_ackme 0:ea85c4bb5e1f 259 NETWORK_SECURITY_WPA_AES_PSK,
dan_ackme 0:ea85c4bb5e1f 260 NETWORK_SECURITY_WPA_TKIP_PSK,
dan_ackme 0:ea85c4bb5e1f 261 NETWORK_SECURITY_WPA2_AES_PSK,
dan_ackme 0:ea85c4bb5e1f 262 NETWORK_SECURITY_WPA2_MIXED_PSK,
dan_ackme 0:ea85c4bb5e1f 263 NETWORK_SECURITY_WPA2_TKIP_PSK,
dan_ackme 0:ea85c4bb5e1f 264 NETWORK_SECURITY_UNKNOWN
dan_ackme 0:ea85c4bb5e1f 265 } NetworkSecurity;
dan_ackme 0:ea85c4bb5e1f 266
dan_ackme 11:ea484e1b7fc4 267 /**
dan_ackme 13:2b51f5267c92 268 * @ingroup api_network_types
dan_ackme 11:ea484e1b7fc4 269 * @brief Network SSID type
dan_ackme 11:ea484e1b7fc4 270 */
dan_ackme 0:ea85c4bb5e1f 271 typedef struct
dan_ackme 0:ea85c4bb5e1f 272 {
dan_ackme 11:ea484e1b7fc4 273 uint8_t val[32]; ///< The raw data of the SSID (not necessarily a string)
dan_ackme 11:ea484e1b7fc4 274 uint8_t len; ///< The length in bytes of the SSID raw data
dan_ackme 0:ea85c4bb5e1f 275 } Ssid;
dan_ackme 0:ea85c4bb5e1f 276
dan_ackme 11:ea484e1b7fc4 277 /**
dan_ackme 13:2b51f5267c92 278 * @ingroup api_network_types
dan_ackme 11:ea484e1b7fc4 279 * @brief Network MAC Address type
dan_ackme 11:ea484e1b7fc4 280 */
dan_ackme 0:ea85c4bb5e1f 281 typedef struct
dan_ackme 0:ea85c4bb5e1f 282 {
dan_ackme 0:ea85c4bb5e1f 283 uint8_t octet[6];
dan_ackme 0:ea85c4bb5e1f 284 } MacAddress;
dan_ackme 11:ea484e1b7fc4 285
dan_ackme 11:ea484e1b7fc4 286 /**
dan_ackme 13:2b51f5267c92 287 * @ingroup api_network_types
dan_ackme 11:ea484e1b7fc4 288 * @brief Buffer to hold a MAC address string
dan_ackme 11:ea484e1b7fc4 289 */
dan_ackme 0:ea85c4bb5e1f 290 typedef char MacAddressStrBuffer[18];
dan_ackme 11:ea484e1b7fc4 291
dan_ackme 11:ea484e1b7fc4 292 /**
dan_ackme 13:2b51f5267c92 293 * @ingroup api_network_types
dan_ackme 11:ea484e1b7fc4 294 * @brief Buffer to hold a SSID string
dan_ackme 11:ea484e1b7fc4 295 */
dan_ackme 0:ea85c4bb5e1f 296 typedef char SsidStrBuffer[129];
dan_ackme 11:ea484e1b7fc4 297
dan_ackme 11:ea484e1b7fc4 298 /**
dan_ackme 13:2b51f5267c92 299 * @ingroup api_network_types
dan_ackme 11:ea484e1b7fc4 300 * @brief Buffer to hold an IP address string
dan_ackme 11:ea484e1b7fc4 301 */
dan_ackme 0:ea85c4bb5e1f 302 typedef char IpStrBuffer[18];
dan_ackme 0:ea85c4bb5e1f 303
dan_ackme 0:ea85c4bb5e1f 304
dan_ackme 11:ea484e1b7fc4 305 // ----------------------------------------------------------------------------
dan_ackme 11:ea484e1b7fc4 306
dan_ackme 0:ea85c4bb5e1f 307
dan_ackme 11:ea484e1b7fc4 308 /**
dan_ackme 13:2b51f5267c92 309 * @ingroup api_socket_types
dan_ackme 11:ea484e1b7fc4 310 * @brief Socket type
dan_ackme 11:ea484e1b7fc4 311 */
dan_ackme 0:ea85c4bb5e1f 312 typedef enum
dan_ackme 0:ea85c4bb5e1f 313 {
dan_ackme 11:ea484e1b7fc4 314 SOCKET_TYPE_UNKNOWN, ///< Socket type not known
dan_ackme 11:ea484e1b7fc4 315 SOCKET_TYPE_TCP, ///< TCP Socket type
dan_ackme 11:ea484e1b7fc4 316 SOCKET_TYPE_TLS, ///< TLS Socket type
dan_ackme 11:ea484e1b7fc4 317 SOCKET_TYPE_UDP, ///< UDP Socket type
dan_ackme 11:ea484e1b7fc4 318 SOCKET_TYPE_HTTP, ///< HTTP Socket type
dan_ackme 11:ea484e1b7fc4 319 } SocketType;
dan_ackme 0:ea85c4bb5e1f 320
dan_ackme 11:ea484e1b7fc4 321 /**
dan_ackme 13:2b51f5267c92 322 * @ingroup api_socket_types
dan_ackme 11:ea484e1b7fc4 323 * @brief HTTP Socket sub-type
dan_ackme 11:ea484e1b7fc4 324 */
dan_ackme 0:ea85c4bb5e1f 325 typedef enum
dan_ackme 0:ea85c4bb5e1f 326 {
dan_ackme 11:ea484e1b7fc4 327 SOCKET_HTTP_GET, ///< HTTP GET Request socket type
dan_ackme 11:ea484e1b7fc4 328 SOCKET_HTTP_POST, ///< HTTP POST Request socket type
dan_ackme 11:ea484e1b7fc4 329 SOCKET_HTTP_HEAD, ///< HTTP HEAD Request socket type
dan_ackme 11:ea484e1b7fc4 330 } HttpSocketType;
dan_ackme 0:ea85c4bb5e1f 331
dan_ackme 11:ea484e1b7fc4 332 /**
dan_ackme 13:2b51f5267c92 333 * @ingroup api_socket_types
dan_ackme 11:ea484e1b7fc4 334 * @brief Struct for hold HTTP socket configuration
dan_ackme 11:ea484e1b7fc4 335 */
dan_ackme 11:ea484e1b7fc4 336 typedef struct
dan_ackme 11:ea484e1b7fc4 337 {
dan_ackme 11:ea484e1b7fc4 338 const char *contextType; ///< A POST Request 'context-type' value
dan_ackme 11:ea484e1b7fc4 339 const char *certName; ///< TLS certificate filename on module flash file system
dan_ackme 11:ea484e1b7fc4 340 bool openOnly; ///< Only open the connection, don't issue the request yet
dan_ackme 11:ea484e1b7fc4 341 HttpSocketType type; ///< The type of HTTP connection
dan_ackme 11:ea484e1b7fc4 342 } HttpSocketArgs;
dan_ackme 0:ea85c4bb5e1f 343
dan_ackme 11:ea484e1b7fc4 344
dan_ackme 11:ea484e1b7fc4 345 // ----------------------------------------------------------------------------
dan_ackme 11:ea484e1b7fc4 346
dan_ackme 0:ea85c4bb5e1f 347
dan_ackme 11:ea484e1b7fc4 348 /**
dan_ackme 13:2b51f5267c92 349 * @ingroup api_file_types
dan_ackme 11:ea484e1b7fc4 350 * @brief File flags type
dan_ackme 11:ea484e1b7fc4 351 */
dan_ackme 0:ea85c4bb5e1f 352 typedef enum
dan_ackme 0:ea85c4bb5e1f 353 {
dan_ackme 11:ea484e1b7fc4 354 FILE_FLAG_NONE = 0, ///< No flags
dan_ackme 0:ea85c4bb5e1f 355
dan_ackme 11:ea484e1b7fc4 356 FILE_FLAG_VALID = (1 << 0), ///< File valid
dan_ackme 11:ea484e1b7fc4 357 FILE_FLAG_EXECUTABLE = (1 << 1), ///< File executable
dan_ackme 11:ea484e1b7fc4 358 FILE_FLAG_ENCRYPTED = (1 << 2), ///< File encrypted
dan_ackme 11:ea484e1b7fc4 359 FILE_FLAG_INTERNAL = (1 << 3), ///< File on internal module flash
dan_ackme 11:ea484e1b7fc4 360 FILE_FLAG_BOOTABLE = (1 << 4), ///< File bootable
dan_ackme 11:ea484e1b7fc4 361 FILE_FLAG_USER = (1 << 5), ///< File created by user
dan_ackme 11:ea484e1b7fc4 362 FILE_FLAG_ESSENTIAL = (1 << 6), ///< File is essential
dan_ackme 11:ea484e1b7fc4 363
dan_ackme 11:ea484e1b7fc4 364 FILE_FLAG_INVALID = 0xFFFF ///< File flags invalid
dan_ackme 11:ea484e1b7fc4 365 } FileFlags;
dan_ackme 0:ea85c4bb5e1f 366
dan_ackme 11:ea484e1b7fc4 367 /**
dan_ackme 13:2b51f5267c92 368 * @ingroup api_file_types
dan_ackme 11:ea484e1b7fc4 369 * @brief File type type
dan_ackme 11:ea484e1b7fc4 370 */
dan_ackme 11:ea484e1b7fc4 371 typedef enum
dan_ackme 11:ea484e1b7fc4 372 {
dan_ackme 11:ea484e1b7fc4 373 FILE_TYPE_UPGRADE_APP = 0x00, ///< Internal upgrade application
dan_ackme 11:ea484e1b7fc4 374 FILE_TYPE_WIFI_FW = 0x01, ///< Wifi firmware binary
dan_ackme 11:ea484e1b7fc4 375
dan_ackme 11:ea484e1b7fc4 376 FILE_TYPE_REGULAR_APP = 0x81, ///< Regular application
dan_ackme 0:ea85c4bb5e1f 377
dan_ackme 11:ea484e1b7fc4 378 FILE_TYPE_USER_RANGE_START = 150, ///< User type start index
dan_ackme 11:ea484e1b7fc4 379 FILE_TYPE_USER_RANGE_END = 199, ///< User type end index
dan_ackme 11:ea484e1b7fc4 380
dan_ackme 11:ea484e1b7fc4 381 FILE_TYPE_TEMPORY = 0xF9, ///< Temporary file
dan_ackme 11:ea484e1b7fc4 382 FILE_TYPE_GPIO_CONFIG = 0xFA, ///< GPIO configuration file
dan_ackme 11:ea484e1b7fc4 383 FILE_TYPE_COMMAND_HELP = 0xFB, ///< WiConnect command help file
dan_ackme 11:ea484e1b7fc4 384 FILE_TYPE_SDC_CAPS = 0xFC, ///< SDC / goHACK.me file
dan_ackme 11:ea484e1b7fc4 385 FILE_TYPE_SETUP_SCRIPT = 0xFD, ///< Setup script file
dan_ackme 11:ea484e1b7fc4 386 FILE_TYPE_MISC_FIX_LEN = 0xFE, ///< Miscellaneous fixed length file
dan_ackme 11:ea484e1b7fc4 387 FILE_TYPE_UNKNOWN = 0xFF, ///< Unknown file type
dan_ackme 0:ea85c4bb5e1f 388 FILE_TYPE_ANY = FILE_TYPE_UNKNOWN
dan_ackme 0:ea85c4bb5e1f 389 } FileType;
dan_ackme 0:ea85c4bb5e1f 390
dan_ackme 11:ea484e1b7fc4 391
dan_ackme 11:ea484e1b7fc4 392 // Forward declarations
dan_ackme 11:ea484e1b7fc4 393
dan_ackme 0:ea85c4bb5e1f 394 class Wiconnect;
dan_ackme 0:ea85c4bb5e1f 395 class TimeoutTimer;
dan_ackme 0:ea85c4bb5e1f 396 class PeriodicTimer;
dan_ackme 0:ea85c4bb5e1f 397 class QueuedCommand;
dan_ackme 0:ea85c4bb5e1f 398 class CommandQueue;
dan_ackme 0:ea85c4bb5e1f 399 class LogFunc;
dan_ackme 0:ea85c4bb5e1f 400 class ReaderFunc;
dan_ackme 0:ea85c4bb5e1f 401 class Callback;
dan_ackme 0:ea85c4bb5e1f 402 class ScanResult;
dan_ackme 0:ea85c4bb5e1f 403 class ScanResultList;
dan_ackme 17:7268f365676b 404 class WiconnectSocket;
dan_ackme 0:ea85c4bb5e1f 405 class WiconnectSerial;
dan_ackme 17:7268f365676b 406 class WiconnectFile;
dan_ackme 0:ea85c4bb5e1f 407 class FileList;
dan_ackme 0:ea85c4bb5e1f 408 class Gpio;
dan_ackme 0:ea85c4bb5e1f 409 class SocketIrqHandlerMap;
dan_ackme 0:ea85c4bb5e1f 410
dan_ackme 0:ea85c4bb5e1f 411 }