提交 3671647c 编写于 作者: 麦壳饼's avatar 麦壳饼

初始化放到启动部分

上级 c89b2493
......@@ -38,6 +38,12 @@ char* topicPath;
int isStop = 1;
int32_t mqttInitSystem() {
int rc = 0;
return rc;
}
int32_t mqttStartSystem() {
int rc = 0;
uint8_t sendbuf[2048];
uint8_t recvbuf[1024];
recnt_status.sendbuf = sendbuf;
......@@ -70,17 +76,11 @@ int32_t mqttInitSystem() {
int _tpsize = strlen(topicPath) + strlen(_topic) + 1;
recnt_status.topic = calloc(1, _tpsize);
sprintf(recnt_status.topic, "/%s/%s", topicPath, _topic);
recnt_status.client_id = strlen(tsMqttBrokerClientId)<3? tsMqttBrokerClientId:"taos_mqtt";
recnt_status.client_id = strlen(tsMqttBrokerClientId) < 3 ? tsMqttBrokerClientId : "taos_mqtt";
taos_init();
mqttPrint("mqttInitSystem mqtt://%s:%s@%s:%s/%s/", recnt_status.user_name, recnt_status.password,
recnt_status.hostname, recnt_status.port, topicPath);
return rc;
}
int32_t mqttStartSystem() {
int rc = 0;
mqtt_conn = NULL;
mqtt_init_reconnect(&client, mqttReconnectClient, &recnt_status, mqtt_PublishCallback);
if (pthread_create(&client_daemon, NULL, mqttClientRefresher, &client)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册