commit | author | age
|
e30a4c
|
1 |
/******************************************************************************** |
GW |
2 |
* Copyright: (C) 2021 LingYun IoT System Studio |
|
3 |
* All rights reserved. |
|
4 |
* |
|
5 |
* Filename: mqtt.h |
|
6 |
* Description: This head file is MQTT subscriber and publisher thread code |
|
7 |
* |
|
8 |
* Version: 1.0.0(20/04/21) |
|
9 |
* Author: Guo Wenxue <guowenxue@gmail.com> |
|
10 |
* ChangeLog: 1, Release initial version on "20/04/21 15:46:42" |
|
11 |
* |
|
12 |
********************************************************************************/ |
|
13 |
#ifndef _MQTT_H_ |
|
14 |
#define _MQTT_H_ |
|
15 |
|
|
16 |
|
|
17 |
typedef struct mqtt_ctx_s |
|
18 |
{ |
|
19 |
char id[32]; /* production ID */ |
|
20 |
|
|
21 |
/* Broker settings */ |
|
22 |
char host[128]; /* MQTT broker server name */ |
|
23 |
int port; /* MQTT broker listen port */ |
|
24 |
char uid[64]; /* username */ |
|
25 |
char pwd[64]; /* password */ |
|
26 |
int keepalive; /* MQTT broker send PING message to subsciber/publisher keepalive timeout<seconds> */ |
|
27 |
|
|
28 |
/* Subscriber settings */ |
|
29 |
int sub_enable; /* Subscriber enable or not */ |
|
30 |
char subTopic[256]; /* Subscriber topic */ |
|
31 |
int subQos; /* Subscriber Qos */ |
|
32 |
|
|
33 |
/* Publisher settings */ |
|
34 |
int pub_enable; /* Publisher enable or not */ |
|
35 |
char pubTopic[256]; /* Publisher topic */ |
|
36 |
int pubQos; /* Publisher Qos */ |
|
37 |
int interval; /* Publish interval */ |
|
38 |
} mqtt_ctx_t; |
|
39 |
|
|
40 |
|
|
41 |
extern void *mqtt_pub_worker(void *args); |
|
42 |
extern void *mqtt_sub_worker(void *args); |
|
43 |
|
|
44 |
#endif /* ----- #ifndef _MQTT_H_ ----- */ |
|
45 |
|