-
Notifications
You must be signed in to change notification settings - Fork 12
/
mqtt.api
105 lines (96 loc) · 3.36 KB
/
mqtt.api
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
100
101
102
103
104
//--------------------------------------------------------------------------------------------------
/**
* Configure the session
*/
//--------------------------------------------------------------------------------------------------
FUNCTION Config
(
string brokerUrl[256] IN,
int32 portNumber IN,
int32 keepAlive IN,
int32 QoS IN
);
//--------------------------------------------------------------------------------------------------
/**
* Open a MQTT session
*/
//--------------------------------------------------------------------------------------------------
FUNCTION Connect
(
string password[32] IN
);
//--------------------------------------------------------------------------------------------------
/**
* Close MQTT session
*/
//--------------------------------------------------------------------------------------------------
FUNCTION Disconnect();
//--------------------------------------------------------------------------------------------------
/**
* Send data (key, value) to MQTT broker
*/
//--------------------------------------------------------------------------------------------------
FUNCTION Send
(
string key[128] IN,
string value[128] IN,
int32 errCode OUT
);
//--------------------------------------------------------------------------------------------------
/**
* Publish the provided payload on the provided topic
*
* @return
* the return value description
*
* @note
* The Publish function provides a more general and lower level interface than the Send
* function.
*/
//--------------------------------------------------------------------------------------------------
FUNCTION le_result_t Publish
(
string topic[128] IN,
uint8 payload[2048] IN
);
//--------------------------------------------------------------------------------------------------
/**
* Handler for session state changes
*/
//--------------------------------------------------------------------------------------------------
HANDLER SessionStateHandler
(
bool isConnected IN, ///< Session State: connected or disconnected
int32 connectErrorCode IN, ///< connection returned code
int32 subErrorCode ///< subscribe returned code
);
//--------------------------------------------------------------------------------------------------
/**
* This event provides information on session state changes
*/
//--------------------------------------------------------------------------------------------------
EVENT SessionState
(
SessionStateHandler sessionStateHandler
);
//--------------------------------------------------------------------------------------------------
/**
* Handler for Incoming message
*/
//--------------------------------------------------------------------------------------------------
HANDLER IncomingMessageHandler
(
string topicName[128] IN, ///< Name of the subscribed topic
string key[128] IN, ///< Key Name of the data
string value[128] IN, ///< Value of the data
string timestamp[16] IN ///< Timestamp of the data
);
//--------------------------------------------------------------------------------------------------
/**
* This event provides information on the incoming MQTT message
*/
//--------------------------------------------------------------------------------------------------
EVENT IncomingMessage
(
IncomingMessageHandler incomingMessageHandler
);