mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-14 14:08:19 +08:00
up
This commit is contained in:
@@ -46,6 +46,7 @@
|
|||||||
#include "web_log.h"
|
#include "web_log.h"
|
||||||
#include "timed_task/timed_task.h"
|
#include "timed_task/timed_task.h"
|
||||||
#include "ota_server/user_ota.h"
|
#include "ota_server/user_ota.h"
|
||||||
|
#include "mqtt_server/user_mqtt_client.h"
|
||||||
|
|
||||||
static bool is_http_init;
|
static bool is_http_init;
|
||||||
static bool is_handlers_registered;
|
static bool is_handlers_registered;
|
||||||
@@ -108,7 +109,7 @@ static int HttpGetTc1Status(httpd_request_t *req)
|
|||||||
char* tc1_status = malloc(412);
|
char* tc1_status = malloc(412);
|
||||||
sprintf(tc1_status, TC1_STATUS_JSON, sockets, ip_status.mode,
|
sprintf(tc1_status, TC1_STATUS_JSON, sockets, ip_status.mode,
|
||||||
sys_config->micoSystemConfig.ssid, sys_config->micoSystemConfig.user_key,
|
sys_config->micoSystemConfig.ssid, sys_config->micoSystemConfig.user_key,
|
||||||
ap_name, ap_key, MQTT_SERVER, MQTT_PORT, VERSION, ip_status.ip, ip_status.mask, ip_status.gateway, 0L);
|
ap_name, ap_key, MQTT_SERVER, MQTT_SERVER_PORT, VERSION, ip_status.ip, ip_status.mask, ip_status.gateway, 0L);
|
||||||
|
|
||||||
OSStatus err = kNoErr;
|
OSStatus err = kNoErr;
|
||||||
send_http(tc1_status, strlen(tc1_status), exit, &err);
|
send_http(tc1_status, strlen(tc1_status), exit, &err);
|
||||||
@@ -237,12 +238,11 @@ static int HttpSetMqttConfig(httpd_request_t *req)
|
|||||||
|
|
||||||
int buf_size = 97;
|
int buf_size = 97;
|
||||||
char *buf = malloc(buf_size);
|
char *buf = malloc(buf_size);
|
||||||
int mode = -1;
|
|
||||||
|
|
||||||
err = httpd_get_data(req, buf, buf_size);
|
err = httpd_get_data(req, buf, buf_size);
|
||||||
require_noerr(err, exit);
|
require_noerr(err, exit);
|
||||||
|
|
||||||
sscanf(buf, "%s %d", MQTT_SERVER, &MQTT_PORT);
|
sscanf(buf, "%s %d", MQTT_SERVER, &MQTT_SERVER_PORT);
|
||||||
user_mqtt_init();
|
user_mqtt_init();
|
||||||
|
|
||||||
send_http("OK", 2, exit, &err);
|
send_http("OK", 2, exit, &err);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#define MAX_MQTT_SEND_QUEUE_SIZE (10)
|
#define MAX_MQTT_SEND_QUEUE_SIZE (10)
|
||||||
|
|
||||||
char MQTT_SERVER[64] = "192.168.33.219";
|
char MQTT_SERVER[64] = "192.168.33.219";
|
||||||
int MQTT_SERVER_PORT = 1883;
|
int MQTT_SERVER_PORT = 1883;
|
||||||
|
|
||||||
#ifdef MQTT_CLIENT_SSL_ENABLE
|
#ifdef MQTT_CLIENT_SSL_ENABLE
|
||||||
char* mqtt_server_ssl_cert_str =
|
char* mqtt_server_ssl_cert_str =
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
#define MQTT_CMD_TIMEOUT 5000 // 5s
|
#define MQTT_CMD_TIMEOUT 5000 // 5s
|
||||||
#define MQTT_YIELD_TMIE 5000 // 5s
|
#define MQTT_YIELD_TMIE 5000 // 5s
|
||||||
|
|
||||||
|
extern char MQTT_SERVER[64];
|
||||||
|
extern int MQTT_SERVER_PORT;
|
||||||
|
|
||||||
extern OSStatus user_mqtt_init(void);
|
extern OSStatus user_mqtt_init(void);
|
||||||
extern OSStatus user_mqtt_send(char *arg);
|
extern OSStatus user_mqtt_send(char *arg);
|
||||||
|
|||||||
Reference in New Issue
Block a user