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, ///<
196 
197 
198 
207 typedef int8_t (*PinToGpioMapper)(Pin pin);
208 
213 typedef unsigned long TimerTimeout;
214 
215 
221 typedef struct
222 {
223  int size;
224  uint8_t *buffer;
225  uint8_t *ptr;
226  int bytesPending;
227  bool allocated;
228 } Buffer;
229 
230 
231 // ----------------------------------------------------------------------------
232 
233 
234 
239 typedef enum
240 {
245 } NetworkStatus;
246 
251 typedef enum
252 {
263 
268 typedef enum
269 {
277 
282 typedef enum
283 {
284  NETWORK_SECURITY_OPEN,
285  NETWORK_SECURITY_WEP_PSK,
286  NETWORK_SECURITY_WPA_AES_PSK,
287  NETWORK_SECURITY_WPA_TKIP_PSK,
288  NETWORK_SECURITY_WPA2_AES_PSK,
289  NETWORK_SECURITY_WPA2_MIXED_PSK,
290  NETWORK_SECURITY_WPA2_TKIP_PSK,
291  NETWORK_SECURITY_UNKNOWN
293 
298 typedef struct
299 {
300  uint8_t val[32];
301  uint8_t len;
302 } Ssid;
303 
308 typedef struct
309 {
310  uint8_t octet[6];
311 } MacAddress;
312 
317 typedef char MacAddressStrBuffer[18];
318 
323 typedef char SsidStrBuffer[129];
324 
329 typedef char IpStrBuffer[18];
330 
331 
332 // ----------------------------------------------------------------------------
333 
334 
339 typedef enum
340 {
348 } SocketType;
349 
354 typedef enum
355 {
360 
365 typedef struct
366 {
367  const char *contextType;
368  const char *certName;
369  bool openOnly;
372 
373 
374 // ----------------------------------------------------------------------------
375 
376 
381 typedef enum
382 {
384 
385  FILE_FLAG_VALID = (1 << 0),
386  FILE_FLAG_EXECUTABLE = (1 << 1),
387  FILE_FLAG_ENCRYPTED = (1 << 2),
388  FILE_FLAG_INTERNAL = (1 << 3),
389  FILE_FLAG_BOOTABLE = (1 << 4),
390  FILE_FLAG_USER = (1 << 5),
391  FILE_FLAG_ESSENTIAL = (1 << 6),
392 
394 } FileFlags;
395 
400 typedef enum
401 {
404 
406 
409 
417  FILE_TYPE_ANY = FILE_TYPE_UNKNOWN
418 } FileType;
419 
420 
421 // ----------------------------------------------------------------------------
422 
427 typedef enum
428 {
429  GHM_VALUE_INT,
430  GHM_VALUE_STR
432 
437 typedef struct
438 {
439  const char *elementName;
440  GhmElementValueType type;
441  union
442  {
443  const char *strValue;
444  uint32_t intValue;
445  } u;
446 } GhmElement;
447 
452 typedef struct
453 {
454  uint16_t count;
455  GhmElement elements[1];
457 
462 typedef enum
463 {
467 } GhmSyncType;
468 
473 typedef enum
474 {
479 
480 
481 
482 // ----------------------------------------------------------------------------
483 
484 
485 // Forward declarations
486 
487 class Wiconnect;
488 class TimeoutTimer;
489 class PeriodicTimer;
490 class QueuedCommand;
491 class CommandQueue;
492 class LogFunc;
493 class ReaderFunc;
494 class ReaderFuncCallback;
495 class Callback;
496 class ScanResult;
497 class ScanResultList;
498 class WiconnectSocket;
499 class WiconnectSerial;
500 class WiconnectFile;
501 class FileList;
502 class Gpio;
503 class SocketIrqHandlerMap;
504 class WiconnectUdpServer;
505 class GhmMessageList;
506 class GhmMessage;
507 
508 }
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.
The WiFi module's firmware is out-dated. See updateFirmware() to update the firmware.
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:142
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.