forked from FieldFox/Codesys-Mqtt-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mqtt.h
99 lines (92 loc) · 1.93 KB
/
mqtt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
typedef struct
{
BYTE DATA[1501];
DWORD IPOS;
}
BUFFERtyp;
typedef struct
{
BYTE BMESSAGETYPE;
BOOL XDUP_FLAG;
BYTE XQOS;
BOOL XRETAIN;
}
FIXEDHEADERtyp;
typedef struct
{
BOOL XUSERNAME;
BOOL XPASSWORD;
BOOL XWILLRETAIN;
BOOL XWILLQOS1;
BOOL XWILLQOS2;
BOOL XWILLFLAG;
BOOL XCLEANSESSION;
}
CONNECTFLAGStyp;
typedef struct
{
BYTE VERSION;
BYTE RESERVED;
BYTE CONNECT;
BYTE CONNACK;
BYTE PUBLISH;
BYTE PUBACK;
BYTE PUBREC;
BYTE PUBREL;
BYTE PUBCOMP;
BYTE SUBSCRIBE;
BYTE SUBACK;
BYTE UNSUBSCRIBE;
BYTE UNSUBACK;
BYTE PINGREQ;
BYTE PINGRESP;
BYTE DISCONNECT;
BYTE RESERVED2;
INT CONNECTED;
INT NOT_CONNECTED;
INT TIMEOUT;
INT WAIT_RESPONSE;
DWORD CONNECTION_TIMEOUT;
BUFFERtyp SENDBUFFER;
BUFFERtyp RECEIVEBUFFER;
FIXEDHEADERtyp FIXEDHEADER;
BUFFERtyp VARIABLEHEADER;
BUFFERtyp PAYLOAD;
CONNECTFLAGStyp CONNECTFLAGS;
TCP_CLIENTtyp TCPCLIENT;
BOOL XTCPCONNECTED;
BOOL XSTARTSEND;
DINT DIRECEIVECOUNT;
TONtyp CONNECTIONTIMER;
BOOL XTIMEOUT;
BYTE INCOMINGMESSAGETYPE;
INT ESTATE;
BOOL XSTARTTIMER;
char STOPIC[81];
char SPAYLOAD[81];
BOOL XCONNECTED;
BOOL *XPUBLISH;
BOOL *XSUBSCRIBE;
}
MQTT_CLIENTtyp;
/* Enum definitions */
/* The Prototypes */
BOOL BUFFERinit(BUFFERtyp* inst, BOOL bRetain);
BOOL _BUFFER_CONCAT(BUFFERtyp *PTparam, BUFFERtyp *PTCONTACTparam);
;
BOOL _BUFFER_PUSH(BUFFERtyp *PTparam, BYTE INparam);
;
BOOL _BUFFER_PUSH_STRING(BUFFERtyp *PTparam, char* INparam, BOOL INCLUDE_LENGTHparam);
;
BOOL _BUFFER_SET(BUFFERtyp *PTparam, BYTE INparam, WORD POSparam);
;
BOOL FIXEDHEADERinit(FIXEDHEADERtyp* inst, BOOL bRetain);
BOOL CREATE_MESSAGE(BUFFERtyp *PTparam, FIXEDHEADERtyp FIXEDHEADERparam, BUFFERtyp VARIABLEHEADERparam, BUFFERtyp PAYLOADparam);
;
BOOL ENCODE_REMAINING_LENGTH(BUFFERtyp *PTparam, DWORD LENGTHparam);
;
BOOL CONNECTFLAGSinit(CONNECTFLAGStyp* inst, BOOL bRetain);
void MQTT_CLIENT(MQTT_CLIENTtyp* inst);
BOOL MQTT_CLIENTinit(MQTT_CLIENTtyp* inst, BOOL bRetain);
void PLC_PRG(void);
;