extend test message content
This commit is contained in:
parent
479b8968e1
commit
897ee0fec2
|
|
@ -51,6 +51,9 @@ typedef int mqtt_app_err_t;
|
||||||
#define UPLINK_SUBTOPIC "UPLINK" // Device publish to this topic
|
#define UPLINK_SUBTOPIC "UPLINK" // Device publish to this topic
|
||||||
#define DOWNLINK_SUBTOPIC "DWLINK" // Device listen from this topic
|
#define DOWNLINK_SUBTOPIC "DWLINK" // Device listen from this topic
|
||||||
|
|
||||||
|
#define MQTT1 0
|
||||||
|
#define MQTT2 1
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char topic[CONFIG_WEBGUIAPP_MQTT_MAX_TOPIC_LENGTH];
|
char topic[CONFIG_WEBGUIAPP_MQTT_MAX_TOPIC_LENGTH];
|
||||||
|
|
|
||||||
52
src/MQTT.c
52
src/MQTT.c
|
|
@ -209,12 +209,59 @@ mqtt_app_err_t PublicTestMQTT(int idx)
|
||||||
GetISO8601Time(time);
|
GetISO8601Time(time);
|
||||||
jwObj_string(&jwc, "time", time);
|
jwObj_string(&jwc, "time", time);
|
||||||
jwObj_int(&jwc, "msgtype", DATA_MESSAGE_TYPE_COMMAND);
|
jwObj_int(&jwc, "msgtype", DATA_MESSAGE_TYPE_COMMAND);
|
||||||
jwObj_int(&jwc, "payloadtype", 1);
|
jwObj_int(&jwc, "payloadtype", 1000);
|
||||||
jwObj_object(&jwc, "payload");
|
jwObj_object(&jwc, "payload");
|
||||||
jwObj_int(&jwc, "applytype", 0);
|
jwObj_int(&jwc, "applytype", 0);
|
||||||
jwObj_object(&jwc, "variables");
|
jwObj_object(&jwc, "variables");
|
||||||
|
|
||||||
jwObj_string(&jwc, "event", "MQTT_TEST_MESSAGE)");
|
rest_var_types tp = VAR_STRING;
|
||||||
|
GetConfVar("dev_id", resp, &tp);
|
||||||
|
jwObj_string(&jwc, "dev_id", resp);
|
||||||
|
GetConfVar("ser_num", resp, &tp);
|
||||||
|
jwObj_string(&jwc, "ser_num", resp);
|
||||||
|
GetConfVar("model_name", resp, &tp);
|
||||||
|
jwObj_string(&jwc, "model_name", resp);
|
||||||
|
GetConfVar("hw_rev", resp, &tp);
|
||||||
|
jwObj_string(&jwc, "hw_rev", resp);
|
||||||
|
|
||||||
|
tp = VAR_FUNCT;
|
||||||
|
GetConfVar("time", resp, &tp);
|
||||||
|
jwObj_raw(&jwc, "time", resp);
|
||||||
|
GetConfVar("lat", resp, &tp);
|
||||||
|
jwObj_raw(&jwc, "lat", resp);
|
||||||
|
GetConfVar("lon", resp, &tp);
|
||||||
|
jwObj_raw(&jwc, "lon", resp);
|
||||||
|
GetConfVar("uptime", resp, &tp);
|
||||||
|
jwObj_raw(&jwc, "uptime", resp);
|
||||||
|
GetConfVar("free_ram", resp, &tp);
|
||||||
|
jwObj_raw(&jwc, "free_ram", resp);
|
||||||
|
GetConfVar("free_ram_min", resp, &tp);
|
||||||
|
jwObj_raw(&jwc, "free_ram_min", resp);
|
||||||
|
GetConfVar("def_interface", resp, &tp);
|
||||||
|
jwObj_raw(&jwc, "def_interface", resp);
|
||||||
|
|
||||||
|
GetConfVar("fw_rev", resp, &tp);
|
||||||
|
jwObj_raw(&jwc, "fw_rev", resp);
|
||||||
|
GetConfVar("idf_rev", resp, &tp);
|
||||||
|
jwObj_raw(&jwc, "idf_rev", resp);
|
||||||
|
#if CONFIG_WEBGUIAPP_WIFI_ENABLE
|
||||||
|
GetConfVar("wifi_stat", resp, &tp);
|
||||||
|
jwObj_raw(&jwc, "wifi_stat", resp);
|
||||||
|
GetConfVar("wifi_level", resp, &tp);
|
||||||
|
jwObj_raw(&jwc, "wifi_level", resp);
|
||||||
|
tp = VAR_INT;
|
||||||
|
GetConfVar("wifi_mode", resp, &tp);
|
||||||
|
jwObj_raw(&jwc, "wifi_mode", resp);
|
||||||
|
tp = VAR_STRING;
|
||||||
|
GetConfVar("wifi_ap_ssid", resp, &tp);
|
||||||
|
jwObj_string(&jwc, "wifi_ap_ssid", resp);
|
||||||
|
GetConfVar("wifi_sta_ssid", resp, &tp);
|
||||||
|
jwObj_string(&jwc, "wifi_sta_ssid", resp);
|
||||||
|
#endif
|
||||||
|
#if CONFIG_WEBGUIAPP_GPRS_ENABLE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
strcpy(resp, "mqtt://");
|
strcpy(resp, "mqtt://");
|
||||||
strcat(resp, GetSysConf()->mqttStation[idx].ServerAddr);
|
strcat(resp, GetSysConf()->mqttStation[idx].ServerAddr);
|
||||||
itoa(GetSysConf()->mqttStation[idx].ServerPort, tmp, 10);
|
itoa(GetSysConf()->mqttStation[idx].ServerPort, tmp, 10);
|
||||||
|
|
@ -226,7 +273,6 @@ mqtt_app_err_t PublicTestMQTT(int idx)
|
||||||
ComposeTopic(resp, idx, SERVICE_NAME, DOWNLINK_SUBTOPIC);
|
ComposeTopic(resp, idx, SERVICE_NAME, DOWNLINK_SUBTOPIC);
|
||||||
jwObj_string(&jwc, "rx_topic", resp);
|
jwObj_string(&jwc, "rx_topic", resp);
|
||||||
|
|
||||||
|
|
||||||
jwEnd(&jwc); //close variables
|
jwEnd(&jwc); //close variables
|
||||||
jwEnd(&jwc); //close payload
|
jwEnd(&jwc); //close payload
|
||||||
jwEnd(&jwc); //close data
|
jwEnd(&jwc); //close data
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user