кучка мелких фиксов + добавление перезагрузки модема и сброса настроек
This commit is contained in:
@@ -58,6 +58,12 @@ std::pair<std::string, std::string> splitIpAndMask(const std::string& input) {
|
||||
return std::make_pair(ip, mask_str);
|
||||
}
|
||||
|
||||
static inline void rtrim(std::string &s) {
|
||||
s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}).base(), s.end());
|
||||
}
|
||||
|
||||
class TerminalNetworkSettings {
|
||||
public:
|
||||
std::string managementIp, managementGateway, mode, dataIp;
|
||||
@@ -103,6 +109,7 @@ private:
|
||||
|
||||
CP_GetNetwork(sid, "version", &version);
|
||||
CP_GetNetwork(sid, "chip_id", &chip_id);
|
||||
rtrim(chip_id);
|
||||
CP_GetNetwork(sid, "serial", &sn);
|
||||
CP_GetNetwork(sid, "mac_eth0", &mac0);
|
||||
CP_GetNetwork(sid, "mac_eth1", &mac1);
|
||||
@@ -468,6 +475,13 @@ public:
|
||||
CP_GetDmaDebug(sid, "reset_cnt_rx", &tmp);
|
||||
}
|
||||
|
||||
void resetDefaultSettings() {
|
||||
std::lock_guard lock(this->cpApiMutex);
|
||||
CP_SetDmaDebug(sid, "begin_save_config", " ");
|
||||
CP_SetDmaDebug(sid, "default_params", "");
|
||||
CP_SetDmaDebug(sid, "save_config", " ");
|
||||
}
|
||||
|
||||
~TerminalApiDaemon() {
|
||||
try {
|
||||
daemon.interrupt();
|
||||
@@ -873,6 +887,10 @@ void api_driver::ApiDriver::setDebugSendSettings(boost::property_tree::ptree &pt
|
||||
boost::ignore_unused(pt);
|
||||
}
|
||||
|
||||
void api_driver::ApiDriver::resetDefaultSettings() {
|
||||
daemon->resetDefaultSettings();
|
||||
}
|
||||
|
||||
bool api_driver::ApiDriver::getIsCinC() const {
|
||||
modulator_settings s{};
|
||||
daemon->getSettings(&s, nullptr, nullptr, nullptr, nullptr);
|
||||
|
Reference in New Issue
Block a user