Analog Devices Wi-Fi Software Reference Manual  Release 1.0.0
MQTTConnect.h
1 /*******************************************************************************
2  * Copyright (c) 2014 IBM Corp.
3  *
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * and Eclipse Distribution License v1.0 which accompany this distribution.
7  *
8  * The Eclipse Public License is available at
9  * http://www.eclipse.org/legal/epl-v10.html
10  * and the Eclipse Distribution License is available at
11  * http://www.eclipse.org/org/documents/edl-v10.php.
12  *
13  * Contributors:
14  * Ian Craggs - initial API and implementation and/or initial documentation
15  * Xiang Rong - 442039 Add makefile to Embedded C client
16  *******************************************************************************/
17 
18 #ifndef MQTTCONNECT_H_
19 #define MQTTCONNECT_H_
20 
21 #if !defined(DLLImport)
22  #define DLLImport
23 #endif
24 #if !defined(DLLExport)
25  #define DLLExport
26 #endif
27 
28 
29 typedef union
30 {
31  unsigned char all;
32 #if defined(REVERSED)
33  struct
34  {
35  unsigned int username : 1;
36  unsigned int password : 1;
37  unsigned int willRetain : 1;
38  unsigned int willQoS : 2;
39  unsigned int will : 1;
40  unsigned int cleansession : 1;
41  unsigned int : 1;
42  } bits;
43 #else
44  struct
45  {
46  unsigned int : 1;
47  unsigned int cleansession : 1;
48  unsigned int will : 1;
49  unsigned int willQoS : 2;
50  unsigned int willRetain : 1;
51  unsigned int password : 1;
52  unsigned int username : 1;
53  } bits;
54 #endif
63 typedef struct
64 {
66  char struct_id[4];
76  unsigned char retained;
81  char qos;
83 
84 
85 #define MQTTPacket_willOptions_initializer { {'M', 'Q', 'T', 'W'}, 0, {NULL, {0, NULL}}, {NULL, {0, NULL}}, 0, 0 }
86 
87 
88 typedef struct
89 {
91  char struct_id[4];
96  unsigned char MQTTVersion;
97  MQTTString clientID;
98  unsigned short keepAliveInterval;
99  unsigned char cleansession;
100  unsigned char willFlag;
102  MQTTString username;
103  MQTTString password;
105 
106 typedef union
107 {
108  unsigned char all;
109 #if defined(REVERSED)
110  struct
111  {
112  unsigned int sessionpresent : 1;
113  unsigned int : 7;
114  } bits;
115 #else
116  struct
117  {
118  unsigned int : 7;
119  unsigned int sessionpresent : 1;
120  } bits;
121 #endif
124 #define MQTTPacket_connectData_initializer { {'M', 'Q', 'T', 'C'}, 0, 4, {NULL, {0, NULL}}, 60, 1, 0, \
125  MQTTPacket_willOptions_initializer, {NULL, {0, NULL}}, {NULL, {0, NULL}} }
126 
127 DLLExport int MQTTSerialize_connect(unsigned char* buf, int buflen, MQTTPacket_connectData* options);
128 DLLExport int MQTTDeserialize_connect(MQTTPacket_connectData* data, unsigned char* buf, int len);
129 
130 DLLExport int MQTTSerialize_connack(unsigned char* buf, int buflen, unsigned char connack_rc, unsigned char sessionPresent);
131 DLLExport int MQTTDeserialize_connack(unsigned char* sessionPresent, unsigned char* connack_rc, unsigned char* buf, int buflen);
132 
133 DLLExport int MQTTSerialize_disconnect(unsigned char* buf, int buflen);
134 DLLExport int MQTTSerialize_pingreq(unsigned char* buf, int buflen);
135 
136 #endif /* MQTTCONNECT_H_ */
Definition: MQTTConnect.h:29
Definition: MQTTPacket.h:81
Definition: MQTTConnect.h:63
MQTTString topicName
Definition: MQTTConnect.h:70
MQTTString message
Definition: MQTTConnect.h:72
char qos
Definition: MQTTConnect.h:81
unsigned char all
Definition: MQTTConnect.h:31
unsigned char MQTTVersion
Definition: MQTTConnect.h:96
int struct_version
Definition: MQTTConnect.h:68
Definition: MQTTConnect.h:106
unsigned char retained
Definition: MQTTConnect.h:76
int struct_version
Definition: MQTTConnect.h:93
Definition: MQTTConnect.h:88
unsigned char all
Definition: MQTTConnect.h:108