ACKme Logo WiConnect Host Library- API Reference Guide
 
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
WiconnectTypes.h
1 
29 #pragma once
30 
31 #include <stdint.h>
32 #include <stdarg.h>
33 #include <cstddef>
34 
35 #include "sdk.h"
36 
42 namespace wiconnect {
43 
44 
45 #ifndef MIN
46 
51 #define MIN(x,y) ((x) < (y) ? (x) : (y))
52 #endif
53 #ifndef MAX
54 
59 #define MAX(x,y) ((x) > (y) ? (x) : (y))
60 #endif
61 
66 #define ALIGN_n(x, n) ((((uint32_t)x) + ((n)-1)) & ~((n)-1))
67 
72 #define ALIGN_8(x) ALIGN_n(x, 8)
73 
78 #define ALIGN_4(x) ALIGN_n(x, 4)
79 
84 #define ARRAY_COUNT(x) (sizeof (x) / sizeof *(x))
85 
86 
92 #define WICONNECT_FAILED(result, func) ((int)(result = (func)) < (int)wiconnect::WICONNECT_SUCCESS)
93 
99 #define WICONNECT_SUCCEEDED(result, func) ((result = (func)) == wiconnect::WICONNECT_SUCCESS)
100 
101 
106 #define WICONNECT_MAX_CMD_SIZE 128
107 
111 #define WICONNECT_MAX_VERSION_SIZE 96
112 
116 #define WICONNECT_MAX_SOCKETS 8
117 
121 #define WICONNECT_MAX_HOST_SIZE 64
122 
126 #define WICONNECT_MAX_FILENAME_SIZE 96
127 
131 #define WICONNECT_WAIT_FOREVER 0xFFFFFFFF
132 
136 #define WICONNECT_NO_WAIT 0
137 
141 #define WICONNECT_FIRMWARE_UPDATE_TIMEOUT 90000
142 
147 #define SOCKET_ANY_PORT (uint16_t)0
148 
152 #define SOCKET_INVALID_HANDLE ((uint8_t)0xFF)
153 
154 
159 typedef enum
160 {
161  // Status Codes
166 
167  // Error codes
174 // WICONNECT_RESPONSE_HANDLER_NULL = -7, ///<
188 
189 
190 
199 typedef int8_t (*PinToGpioMapper)(Pin pin);
200 
206 typedef struct
207 {
208  int size;
209  uint8_t *buffer;
210  uint8_t *ptr;
211  int bytesPending;
212  bool allocated;
213 } Buffer;
214 
215 
216 // ----------------------------------------------------------------------------
217 
218 
219 
224 typedef enum
225 {
230 } NetworkStatus;
231 
236 typedef enum
237 {
248 
253 typedef enum
254 {
262 
267 typedef enum
268 {
269  NETWORK_SECURITY_OPEN,
270  NETWORK_SECURITY_WEP_PSK,
271  NETWORK_SECURITY_WPA_AES_PSK,
272  NETWORK_SECURITY_WPA_TKIP_PSK,
273  NETWORK_SECURITY_WPA2_AES_PSK,
274  NETWORK_SECURITY_WPA2_MIXED_PSK,
275  NETWORK_SECURITY_WPA2_TKIP_PSK,
276  NETWORK_SECURITY_UNKNOWN
278 
283 typedef struct
284 {
285  uint8_t val[32];
286  uint8_t len;
287 } Ssid;
288 
293 typedef struct
294 {
295  uint8_t octet[6];
296 } MacAddress;
297 
302 typedef char MacAddressStrBuffer[18];
303 
308 typedef char SsidStrBuffer[129];
309 
314 typedef char IpStrBuffer[18];
315 
316 
317 // ----------------------------------------------------------------------------
318 
319 
324 typedef enum
325 {
331 } SocketType;
332 
337 typedef enum
338 {
343 
348 typedef struct
349 {
350  const char *contextType;
351  const char *certName;
352  bool openOnly;
355 
356 
357 // ----------------------------------------------------------------------------
358 
359 
364 typedef enum
365 {
367 
368  FILE_FLAG_VALID = (1 << 0),
369  FILE_FLAG_EXECUTABLE = (1 << 1),
370  FILE_FLAG_ENCRYPTED = (1 << 2),
371  FILE_FLAG_INTERNAL = (1 << 3),
372  FILE_FLAG_BOOTABLE = (1 << 4),
373  FILE_FLAG_USER = (1 << 5),
374  FILE_FLAG_ESSENTIAL = (1 << 6),
375 
377 } FileFlags;
378 
383 typedef enum
384 {
387 
389 
392 
400  FILE_TYPE_ANY = FILE_TYPE_UNKNOWN
401 } FileType;
402 
403 
404 // Forward declarations
405 
406 class Wiconnect;
407 class TimeoutTimer;
408 class PeriodicTimer;
409 class QueuedCommand;
410 class CommandQueue;
411 class LogFunc;
412 class ReaderFunc;
413 class Callback;
414 class ScanResult;
415 class ScanResultList;
416 class WiconnectSocket;
417 class WiconnectSerial;
418 class WiconnectFile;
419 class FileList;
420 class Gpio;
421 class SocketIrqHandlerMap;
422 
423 }
Miscellaneous fixed length file.
uint8_t len
The length in bytes of the SSID raw data.
SocketType
Socket type.
The specified security type is not supported by the network.
Conntected to network and have IP address.
NetworkSecurity
Network security type.
int8_t(* PinToGpioMapper)(Pin pin)
Function pointer for mapping from a host pin to a WiConnect Module GPIO.
Currently executing another command.
const char * contextType
A POST Request 'context-type' value.
Wifi firmware binary.
WiconnectResult
API Result code.
File flags invalid.
Haven't attempted to join.
Network MAC Address type.
HttpSocketType
HTTP Socket sub-type.
Joining was aborted (via command)
Library processing current command.
Not connected to network.
char SsidStrBuffer[129]
Buffer to hold a SSID string.
Connected to network but don't have IP address.
char MacAddressStrBuffer[18]
Buffer to hold a MAC address string.
HTTP HEAD Request socket type.
The network with the configured SSID was not found.
FileType
File type type.
PinName Pin
Pin name on HOST.
Definition: sdk.h:123
The SSID has not be configured.
Command / parameter not supported.
File created by user.
The network requires a password and none has been set.
Background processing monitor is not available (i.e in use)
Bad argument supplied.
Library not processing any commands.
HTTP POST Request socket type.
GPIO configuration file.
HttpSocketType type
The type of HTTP connection.
Module returned error code.
FileFlags
File flags type.
SDC / goHACK.me file.
NetworkSignalStrength
Network RSSI signal level.
File on internal module flash.
Network SSID type.
NetworkJoinResult
Network connection status.
Command was aborted.
HTTP GET Request socket type.
Failed to parse module response.
const char * certName
TLS certificate filename on module flash file system.
The pinToGpioMapper hasn't been set.
Successfully joined the network.
Command successfully completed.
NetworkStatus
Network connection status.
Failed to join the network.
WiConnect command help file.
char IpStrBuffer[18]
Buffer to hold an IP address string.
Struct for hold HTTP socket configuration.
Currently attempting to join.
bool openOnly
Only open the connection, don't issue the request yet.
The file is not open for reading.
Socket type not known.
Internal upgrade application.