refactor(external-interface): update telemetry configuration and transport settings
- Reorder and rename configuration options for better clarity - Set default local host to 0.0.0.0 for both HostInfo and Telemetry - Update default UDP ports to 12500 for both HostInfo and Telemetry - Fix port value parsing in external_interface.cpp
This commit is contained in:
parent
7c7827fddb
commit
08166b15ab
|
@ -6,17 +6,21 @@ Log_Level = DEBUG
|
||||||
Enable_Alarm_Code = 1 ; 0: Disable, 1: Enable
|
Enable_Alarm_Code = 1 ; 0: Disable, 1: Enable
|
||||||
|
|
||||||
HostInfo_Transport_Open = 1 ; 0: Disable, 1: Enable
|
HostInfo_Transport_Open = 1 ; 0: Disable, 1: Enable
|
||||||
HostInfo_Transport_Mode = COM ; COM, UDP, UNIX_UDP
|
HostInfo_Enable_Telemetry = 1 ; 0: Disable, 1: Enable
|
||||||
|
HostInfo_Transport_Mode = UDP ; COM, UDP, UNIX_UDP
|
||||||
HostInfo_COM_Path = /dev/ttyUSB0
|
HostInfo_COM_Path = /dev/ttyUSB0
|
||||||
HostInfo_COM_Baudrate = 115200
|
HostInfo_COM_Baudrate = 115200
|
||||||
HostInfo_Enable_Telemetry = 1 ; 0: Disable, 1: Enable
|
HostInfo_UDP_Local_Host = 0.0.0.0
|
||||||
|
HostInfo_UDP_Local_Port = 12500
|
||||||
|
HostInfo_UDP_Remote_Host = localhost
|
||||||
|
HostInfo_UDP_Remote_Port = 12500
|
||||||
|
|
||||||
Telemetry_Transport_Open = 1 ; 0: Disable, 1: Enable
|
Telemetry_Transport_Open = 1 ; 0: Disable, 1: Enable
|
||||||
Telemetry_Transport_Mode = UDP ; COM, UDP, UNIX_UDP
|
Telemetry_Enable_Telemetry = 1 ; 0: Disable, 1: Enable
|
||||||
|
Telemetry_Transport_Mode = COM ; COM, UDP, UNIX_UDP
|
||||||
Telemetry_COM_Path = /dev/ttyUSB1
|
Telemetry_COM_Path = /dev/ttyUSB1
|
||||||
Telemetry_COM_Baudrate = 115200
|
Telemetry_COM_Baudrate = 115200
|
||||||
Telemetry_UDP_Local_Host = localhost
|
Telemetry_UDP_Local_Host = 0.0.0.0
|
||||||
Telemetry_UDP_Local_Port = 5000
|
Telemetry_UDP_Local_Port = 12500
|
||||||
Telemetry_UDP_Remote_Host = localhost
|
Telemetry_UDP_Remote_Host = localhost
|
||||||
Telemetry_UDP_Remote_Port = 5001
|
Telemetry_UDP_Remote_Port = 12500
|
||||||
Telemetry_Enable_Telemetry = 1 ; 0: Disable, 1: Enable
|
|
||||||
|
|
|
@ -83,12 +83,12 @@ static int read_config(const char* config_path) {
|
||||||
transport_var = std::unique_ptr<Transport>(\
|
transport_var = std::unique_ptr<Transport>(\
|
||||||
new transport::SerialPortTransport<ComframeProtocol>(com_path, baudrate)\
|
new transport::SerialPortTransport<ComframeProtocol>(com_path, baudrate)\
|
||||||
);\
|
);\
|
||||||
} else if (strcasecmp(transport_mode, "datagram") == 0 || strcasecmp(transport_mode, "udp")) {\
|
} else if (strcasecmp(transport_mode, "datagram") == 0 || strcasecmp(transport_mode, "udp") == 0) {\
|
||||||
const char* host = "0.0.0.0";\
|
const char* host = "0.0.0.0";\
|
||||||
if (!config.getValue(config_section, #prefix "_UDP_Local_Host", host)) {\
|
if (!config.getValue(config_section, #prefix "_UDP_Local_Host", host)) {\
|
||||||
logger.error("failed to read [%s]:" #prefix "_UDP_Local_Host in %s", config_section, config_path); \
|
logger.error("failed to read [%s]:" #prefix "_UDP_Local_Host in %s", config_section, config_path); \
|
||||||
}\
|
}\
|
||||||
long port = 5000; \
|
long port = 125000; \
|
||||||
if (!config.getIntValue(config_section, #prefix "_UDP_Local_Port", port)) {\
|
if (!config.getIntValue(config_section, #prefix "_UDP_Local_Port", port)) {\
|
||||||
logger.error("failed to read [%s]:" #prefix "_UDP_Local_Port in %s", config_section, config_path); \
|
logger.error("failed to read [%s]:" #prefix "_UDP_Local_Port in %s", config_section, config_path); \
|
||||||
}\
|
}\
|
||||||
|
@ -96,7 +96,7 @@ static int read_config(const char* config_path) {
|
||||||
if (!config.getValue(config_section, #prefix "_UDP_Remote_Host", remote_host)) {\
|
if (!config.getValue(config_section, #prefix "_UDP_Remote_Host", remote_host)) {\
|
||||||
logger.error("failed to read [%s]:" #prefix "_UDP_Remote_Host in %s", config_section, config_path); \
|
logger.error("failed to read [%s]:" #prefix "_UDP_Remote_Host in %s", config_section, config_path); \
|
||||||
}\
|
}\
|
||||||
long remote_port = 5000; \
|
long remote_port = 125000; \
|
||||||
if (!config.getIntValue(config_section, #prefix "_UDP_Remote_Port", remote_port)) {\
|
if (!config.getIntValue(config_section, #prefix "_UDP_Remote_Port", remote_port)) {\
|
||||||
logger.error("failed to read [%s]:" #prefix "_UDP_Remote_Port in %s", config_section, config_path); \
|
logger.error("failed to read [%s]:" #prefix "_UDP_Remote_Port in %s", config_section, config_path); \
|
||||||
}\
|
}\
|
||||||
|
|
Loading…
Reference in New Issue