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 <stddef.h>
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 
87 
93 #define WICONNECT_FAILED(result, func) ((int)(result = (func)) < (int)wiconnect::WICONNECT_SUCCESS)
94 
100 #define WICONNECT_SUCCEEDED(result, func) ((result = (func)) == wiconnect::WICONNECT_SUCCESS)
101 
107 #define WICONNECT_IS_PROCESSING(result, func) ((result = (func)) == wiconnect::WICONNECT_PROCESSING)
108 
113 #define WICONNECT_MAX_CMD_SIZE 128
114 
118 #define WICONNECT_MAX_VERSION_SIZE 96
119 
123 #define WICONNECT_MAX_SOCKETS 8
124 
128 #define WICONNECT_MAX_HOST_SIZE 64
129 
133 #define WICONNECT_MAX_FILENAME_SIZE 96
134 
138 #define WICONNECT_WAIT_FOREVER 0xFFFFFFFFUL
139 
143 #define WICONNECT_NO_WAIT 0
144 
148 #define WICONNECT_FIRMWARE_UPDATE_TIMEOUT 90000UL
149 
154 #define SOCKET_ANY_PORT (uint16_t)0
155 
159 #define SOCKET_INVALID_HANDLE ((uint8_t)0xFF)
160 
161 
166 typedef enum
167 {
168  // Status Codes
173 
174  // Error codes
181 // WICONNECT_RESPONSE_HANDLER_NULL = -7, ///<
195 
196 
197 
206 typedef int8_t (*PinToGpioMapper)(Pin pin);
207 
212 typedef unsigned long TimerTimeout;
213 
214 
220 typedef struct
221 {
222  int size;
223  uint8_t *buffer;
224  uint8_t *ptr;
225  int bytesPending;
226  bool allocated;
227 } Buffer;
228 
229 
230 // ----------------------------------------------------------------------------
231 
232 
233 
238 typedef enum
239 {
244 } NetworkStatus;
245 
250 typedef enum
251 {
262 
267 typedef enum
268 {
276 
281 typedef enum
282 {
283  NETWORK_SECURITY_OPEN,
284  NETWORK_SECURITY_WEP_PSK,
285  NETWORK_SECURITY_WPA_AES_PSK,
286  NETWORK_SECURITY_WPA_TKIP_PSK,
287  NETWORK_SECURITY_WPA2_AES_PSK,
288  NETWORK_SECURITY_WPA2_MIXED_PSK,
289  NETWORK_SECURITY_WPA2_TKIP_PSK,
290  NETWORK_SECURITY_UNKNOWN
292 
297 typedef struct
298 {
299  uint8_t val[32];
300  uint8_t len;
301 } Ssid;
302 
307 typedef struct
308 {
309  uint8_t octet[6];
310 } MacAddress;
311 
316 typedef char MacAddressStrBuffer[18];
317 
322 typedef char SsidStrBuffer[129];
323 
328 typedef char IpStrBuffer[18];
329 
330 
331 // ----------------------------------------------------------------------------
332 
333 
338 typedef enum
339 {
347 } SocketType;
348 
353 typedef enum
354 {
359 
364 typedef struct
365 {
366  const char *contextType;
367  const char *certName;
368  bool openOnly;
371 
372 
373 // ----------------------------------------------------------------------------
374 
375 
380 typedef enum
381 {
383 
384  FILE_FLAG_VALID = (1 << 0),
385  FILE_FLAG_EXECUTABLE = (1 << 1),
386  FILE_FLAG_ENCRYPTED = (1 << 2),
387  FILE_FLAG_INTERNAL = (1 << 3),
388  FILE_FLAG_BOOTABLE = (1 << 4),
389  FILE_FLAG_USER = (1 << 5),
390  FILE_FLAG_ESSENTIAL = (1 << 6),
391 
393 } FileFlags;
394 
399 typedef enum
400 {
403 
405 
408 
416  FILE_TYPE_ANY = FILE_TYPE_UNKNOWN
417 } FileType;
418 
419 
420 // ----------------------------------------------------------------------------
421 
426 typedef enum
427 {
428  GHM_VALUE_INT,
429  GHM_VALUE_STR
431 
436 typedef struct
437 {
438  const char *elementName;
439  GhmElementValueType type;
440  union
441  {
442  const char *strValue;
443  uint32_t intValue;
444  } u;
445 } GhmElement;
446 
451 typedef struct
452 {
453  uint16_t count;
454  GhmElement elements[1];
456 
461 typedef enum
462 {
466 } GhmSyncType;
467 
472 typedef enum
473 {
478 
479 
480 
481 // ----------------------------------------------------------------------------
482 
483 
484 // Forward declarations
485 
486 class Wiconnect;
487 class TimeoutTimer;
488 class PeriodicTimer;
489 class QueuedCommand;
490 class CommandQueue;
491 class LogFunc;
492 class ReaderFunc;
493 class ReaderFuncCallback;
494 class Callback;
495 class ScanResult;
496 class ScanResultList;
497 class WiconnectSocket;
498 class WiconnectSerial;
499 class WiconnectFile;
500 class FileList;
501 class Gpio;
502 class SocketIrqHandlerMap;
503 class WiconnectUdpServer;
504 class GhmMessageList;
505 class GhmMessage;
506 
507 }
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.
Only pull controls from remote server.
Only push streams and controls to remote server.
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.
Push and pull all streams and controls.
WiconnectResult
API Result code.
File flags invalid.
Haven't attempted to join.
goHACK.me stream or control value
Network MAC Address type.
UDP Server Socket type.
HttpSocketType
HTTP Socket sub-type.
GhmMessageGetType
goHACK.me message GET 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.
GhmElementValueType
goHACK.me stream or control value type
Only GET the message data.
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:134
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.
goHACK.me message type
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.
GhmSyncType
goHACK.me sychronization type
Command was aborted.
Get the message body. This is JSON formatted.
HTTP GET Request socket type.
unsigned long TimerTimeout
Timeout 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.
Array of goHACK.me stream or control values.
NetworkStatus
Network connection status.
Failed to join the network.
WiConnect command help file.
Get entire message. This includes headers. Is JSON formatted.
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.