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 03:14:30 2014 -0700
Revision:
13:2b51f5267c92
Parent:
11:ea484e1b7fc4
Child:
16:7f1d6d359787
doc updates

Who changed what in which revision?

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