/********************************************************************************
|
* Copyright: (C) 2021 LingYun IoT System Studio
|
* All rights reserved.
|
*
|
* Filename: mqtt.h
|
* Description: This head file is MQTT subscriber and publisher thread code
|
*
|
* Version: 1.0.0(20/04/21)
|
* Author: Guo Wenxue <guowenxue@gmail.com>
|
* ChangeLog: 1, Release initial version on "20/04/21 15:46:42"
|
*
|
********************************************************************************/
|
#ifndef _MQTT_H_
|
#define _MQTT_H_
|
|
|
typedef struct mqtt_ctx_s
|
{
|
char id[32]; /* production ID */
|
|
/* Broker settings */
|
char host[128]; /* MQTT broker server name */
|
int port; /* MQTT broker listen port */
|
char uid[64]; /* username */
|
char pwd[64]; /* password */
|
int keepalive; /* MQTT broker send PING message to subsciber/publisher keepalive timeout<seconds> */
|
|
/* Subscriber settings */
|
int sub_enable; /* Subscriber enable or not */
|
char subTopic[256]; /* Subscriber topic */
|
int subQos; /* Subscriber Qos */
|
|
/* Publisher settings */
|
int pub_enable; /* Publisher enable or not */
|
char pubTopic[256]; /* Publisher topic */
|
int pubQos; /* Publisher Qos */
|
int interval; /* Publish interval */
|
} mqtt_ctx_t;
|
|
|
extern void *mqtt_pub_worker(void *args);
|
extern void *mqtt_sub_worker(void *args);
|
|
#endif /* ----- #ifndef _MQTT_H_ ----- */
|