From 0b55b2997d17bbce5bea3ebe1f5700dca184574f Mon Sep 17 00:00:00 2001 From: Serhii Voloshynov Date: Wed, 15 May 2024 16:20:54 +0300 Subject: [MTX-5302] MTR3 R.7.0: Serial IP functionality support GP-2336 --- include/Device/Device.h | 23 ++++++++++++++++++++--- include/General.h | 1 + 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/Device/Device.h b/include/Device/Device.h index bcf0cff..a1c0b1b 100644 --- a/include/Device/Device.h +++ b/include/Device/Device.h @@ -23,8 +23,6 @@ class Device { static std::map capabilityList; static std::map ethSwitchList; static std::map deviceInfoList; - static std::vector dInputs; - static std::vector dOutputs; static const std::regex apFilters; static const std::regex serialModeFilter; @@ -33,6 +31,8 @@ class Device { static const std::regex mtcdt3HwVersionFilters; static const std::regex iotRtrVersionFilters; static const std::regex mtrFilters; + static std::string extIoStr; + static std::string serialStr; const unsigned int accessoryCardsListSize = 7; @@ -150,6 +150,18 @@ class Device { std::vector> accessoryCardsList; + const std::string SERIAL_MODE = "mode"; + const std::string SERIAL_TERMINATION = "rs4xx-term-res"; + const std::string SERIAL_MODE_RS232 = "rs232"; + const std::string SERIAL_MODE_RS485 = "rs485-half"; + const std::map mModes = {{SERIAL_MODE_RS232, 0}, {SERIAL_MODE_RS485, 0}}; + + const std::string CONTROL_PIN_SERIAL_MODE = "MXC2_RS485_EN"; + const std::string CONTROL_PIN_TERMINATION = "MXC2_RS485_TERM_EN"; + const std::string HW_VERSION_FILE = "/sys/devices/platform/mts-io/hw-version"; + std::string program_name; + std::string hw_version; + public: Device(); void getSystemTreeJson(const char *dir_name); @@ -169,7 +181,7 @@ class Device { std::vector &results); void printJson(); void printVersion(std::string name); - void printUsage(std::string program); + void printUsage(); void show(std::string program); void showTrigger(std::string name); void sortAccessoryCards(); @@ -181,6 +193,11 @@ class Device { void writeJson(const rapidjson::Document &json, const std::string &file); bool readJson(rapidjson::Document &json, const std::string &file); void simpleError(std::string msg, int error, int exitval); + void setSerialModesMTR3(const std::string &mode, const std::string &value); + void showSerialModesMTR3(const std::string &mode); + int getPinValue(const std::string &name); + void setProgramName(const std::string &name); + void setHWVersion(); }; #endif /* DEVICE_H_ */ diff --git a/include/General.h b/include/General.h index 4429b3d..58c2a09 100644 --- a/include/General.h +++ b/include/General.h @@ -76,6 +76,7 @@ typedef unsigned int uint; // 32 bit - even on 64 bit machines #define KEY_EXTIO "extIo" #define KEY_DOUTPUTS "dOutputs" #define KEY_DINPUTS "dInputs" +#define KEY_SERIALS "serialPorts" enum HardwareType { HARDWARE_MTCDT, -- cgit v1.2.3