* MDF [dds2mqtt] Change the method to set default configure of topic rules .
@@ -52,12 +52,9 @@ dds_proxy(int argc, char **argv)
/* Read .conf file to get a JSON and fill topics. */
if (argc > 2) {
jso = hocon_parse_file(argv[2]);
- } else if (argc == 2) {
- jso = hocon_parse_file(
- "../../nanomq_cli/dds2mqtt/dds2mqtt.conf");
- }
jso_item_mqtt = cJSON_GetObjectItem(jso, "mqtt");
- jso_item_broker_url = cJSON_GetObjectItem(jso_item_mqtt, "broker_url");
+ jso_item_broker_url =
+ cJSON_GetObjectItem(jso_item_mqtt, "broker_url");
broker_url = jso_item_broker_url->valuestring;
jso_item_topic_rules = cJSON_GetObjectItem(jso, "topic_rules");
// TODO Need to restruct if there is more topics.
@@ -83,6 +80,13 @@ dds_proxy(int argc, char **argv)
// printf("%s\n", mqttcli.mqttsend_topic);
// printf("%s\n", ddscli.ddsrecv_topic);
// printf("%s\n", ddscli.ddssend_topic);
+ } else if (argc == 2) {
+ broker_url = "mqtt-tcp://127.0.0.1:1883";
+ mqttcli.mqttrecv_topic = "DDSCMD/topic1";
+ mqttcli.mqttsend_topic = "DDS/topic1";
+ ddscli.ddsrecv_topic = "MQTTCMD/topic1";
+ ddscli.ddssend_topic = "MQTT/topic1";
+ }
mqtt_connect(&mqttcli, broker_url, &ddscli);
mqtt_subscribe(&mqttcli, mqttcli.mqttrecv_topic, 0);
