#ifndef MQTT_INIT_H__
#define MQTT_INIT_H__
#include <time.h>
#include "mosquitto.h"
#include "cjson/cJSON.h"

//extern ThreadPool *pool;

#define BROKER_ADDRESS "119.45.167.177"
#define BROKER_PORT 1883
#define USERNAME "admin"    // 替换为你的用户名
#define PASSWORD "admin"       // 替换为你的密码
extern struct mosquitto *mosq;//创建客服端
extern int gPwmCount;  // 计数
extern int gmessage_type;//message消息值

int mqtt_init();//mqtt初始化
int mqtt_create(struct mosquitto *mosq);//创建mqtt客服端
void on_connect(struct mosquitto *mosq, void *obj, int rc);//回调函数
void on_message(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message);//消息回调函数
int mqtt_cycle(struct mosquitto *mosq);//循环
void mqtt_clean(struct mosquitto *mosq);//清理

#endif