добавил установку всех параметров
This commit is contained in:
parent
46497bfda0
commit
2c9d513613
50
src/main.cpp
50
src/main.cpp
@ -286,7 +286,7 @@ public:
|
||||
}
|
||||
}));
|
||||
|
||||
s.resources.emplace_back(std::make_unique<http::auth::AuthRequiredResource>("/api/set/bucLnb", this->auth, http::auth::User::SUPERUSER, [this](const auto& req, auto& rep) {
|
||||
s.resources.emplace_back(std::make_unique<http::auth::AuthRequiredResource>("/api/set/buclnb", this->auth, http::auth::User::SUPERUSER, [this](const auto& req, auto& rep) {
|
||||
if (req.method != "POST") {
|
||||
http::server::stockReply(http::server::bad_request, rep);
|
||||
}
|
||||
@ -308,7 +308,7 @@ public:
|
||||
result += "}";
|
||||
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
|
||||
} catch (std::exception& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "WebHandle(/api/set/bucLnb): Can't set settings: " << e.what();
|
||||
BOOST_LOG_TRIVIAL(error) << "WebHandle(/api/set/buclnb): Can't set BUC LNB settings: " << e.what();
|
||||
const std::string result = R"({"status":"error"})";
|
||||
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
|
||||
}
|
||||
@ -392,35 +392,7 @@ public:
|
||||
result += "}";
|
||||
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
|
||||
} catch (std::exception& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "WebHandle(/api/set/rxtx): Can't set RX/TX settings: " << e.what();
|
||||
const std::string result = R"({"status":"error"})";
|
||||
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
|
||||
}
|
||||
}));
|
||||
|
||||
s.resources.emplace_back(std::make_unique<http::auth::AuthRequiredResource>("/api/set/debugSend", this->auth, http::auth::User::EDIT_SETTINGS, [this](const auto& req, auto& rep) {
|
||||
if (req.method != "POST") {
|
||||
http::server::stockReply(http::server::bad_request, rep);
|
||||
}
|
||||
|
||||
rep.status = http::server::ok;
|
||||
rep.headers.clear();
|
||||
rep.headers.push_back({.name = "Content-Type", .value = toString(mime_types::json)});
|
||||
|
||||
try {
|
||||
std::stringstream ss;
|
||||
ss.str(std::string(req.payload.begin(), req.payload.end()));
|
||||
boost::property_tree::ptree pt;
|
||||
read_json(ss, pt);
|
||||
|
||||
api->setDebugSendSettings(pt);
|
||||
|
||||
std::string result = R"({"status":"ok","settings":)";
|
||||
result += api->loadSettings();
|
||||
result += "}";
|
||||
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
|
||||
} catch (std::exception& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "WebHandle(/api/set/rxtx): Can't set RX/TX settings: " << e.what();
|
||||
BOOST_LOG_TRIVIAL(error) << "WebHandle(/api/set/network): Can't set network settings: " << e.what();
|
||||
const std::string result = R"({"status":"error"})";
|
||||
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
|
||||
}
|
||||
@ -485,16 +457,16 @@ public:
|
||||
|
||||
s.resources.emplace_back(std::make_unique<http::auth::AuthRequiredResource>("/dev", this->auth, http::auth::User::SUPERUSER, [this](const auto& req, auto& rep) {
|
||||
boost::ignore_unused(req);
|
||||
sf->serve(INTERNET_JPG, rep);
|
||||
sf->serve(DEV_HTML, rep);
|
||||
}));
|
||||
|
||||
s.resources.emplace_back(std::make_unique<http::auth::AuthRequiredResource>("/dev/fetchParams", this->auth, http::auth::User::SUPERUSER, [this](const auto& req, auto& rep) {
|
||||
rep.headers.push_back({.name = "Content-Type", .value = toString(mime_types::json)});
|
||||
std::string result = R"({"status":"ok","fwsize":)";
|
||||
result += std::to_string(req.payload.size());
|
||||
result += R"(,"sha256":")";
|
||||
result += "\"}";
|
||||
}));
|
||||
// s.resources.emplace_back(std::make_unique<http::auth::AuthRequiredResource>("/dev/fetchParams", this->auth, http::auth::User::SUPERUSER, [this](const auto& req, auto& rep) {
|
||||
// rep.headers.push_back({.name = "Content-Type", .value = toString(mime_types::json)});
|
||||
// std::string result = R"({"status":"ok","fwsize":)";
|
||||
// result += std::to_string(req.payload.size());
|
||||
// result += R"(,"sha256":")";
|
||||
// result += "\"}";
|
||||
// }));
|
||||
}
|
||||
|
||||
~ServerResources() = default;
|
||||
|
@ -801,52 +801,52 @@ void api_driver::ApiDriver::resetPacketStatistics() const {
|
||||
|
||||
#ifdef MODEM_IS_SCPC
|
||||
struct ModcodDef_t {const char* modulation; const char* speed;};
|
||||
const static ModcodDef_t defs[] = {
|
||||
{.modulation = "DUMMY", .speed = "0"},
|
||||
{.modulation = "QPSK", .speed = "1/4"},
|
||||
{.modulation = "QPSK", .speed = "1/3"},
|
||||
{.modulation = "QPSK", .speed = "2/5"},
|
||||
{.modulation = "QPSK", .speed = "1/2"},
|
||||
{.modulation = "QPSK", .speed = "3/5"},
|
||||
{.modulation = "QPSK", .speed = "2/3"},
|
||||
{.modulation = "QPSK", .speed = "3/4"},
|
||||
{.modulation = "QPSK", .speed = "4/5"},
|
||||
{.modulation = "QPSK", .speed = "5/6"},
|
||||
{.modulation = "QPSK", .speed = "8/9"},
|
||||
{.modulation = "QPSK", .speed = "9/10"},
|
||||
{.modulation = "8PSK", .speed = "3/5"},
|
||||
{.modulation = "8PSK", .speed = "2/3"},
|
||||
{.modulation = "8PSK", .speed = "3/4"},
|
||||
{.modulation = "8PSK", .speed = "5/6"},
|
||||
{.modulation = "8PSK", .speed = "8/9"},
|
||||
{.modulation = "8PSK", .speed = "9/10"},
|
||||
{.modulation = "16APSK", .speed = "2/3"},
|
||||
{.modulation = "16APSK", .speed = "3/4"},
|
||||
{.modulation = "16APSK", .speed = "4/5"},
|
||||
{.modulation = "16APSK", .speed = "5/6"},
|
||||
{.modulation = "16APSK", .speed = "8/9"},
|
||||
{.modulation = "16APSK", .speed = "9/10"},
|
||||
{.modulation = "32APSK", .speed = "3/4"},
|
||||
{.modulation = "32APSK", .speed = "4/5"},
|
||||
{.modulation = "32APSK", .speed = "5/6"},
|
||||
{.modulation = "32APSK", .speed = "8/9"},
|
||||
{.modulation = "32APSK", .speed = "9/10"},
|
||||
const static ModcodDef_t ModcodDefs[] = {
|
||||
{.modulation = "dummy", .speed = "0"},
|
||||
{.modulation = "qpsk", .speed = "1/4"},
|
||||
{.modulation = "qpsk", .speed = "1/3"},
|
||||
{.modulation = "qpsk", .speed = "2/5"},
|
||||
{.modulation = "qpsk", .speed = "1/2"},
|
||||
{.modulation = "qpsk", .speed = "3/5"},
|
||||
{.modulation = "qpsk", .speed = "2/3"},
|
||||
{.modulation = "qpsk", .speed = "3/4"},
|
||||
{.modulation = "qpsk", .speed = "4/5"},
|
||||
{.modulation = "qpsk", .speed = "5/6"},
|
||||
{.modulation = "qpsk", .speed = "8/9"},
|
||||
{.modulation = "qpsk", .speed = "9/10"},
|
||||
{.modulation = "8psk", .speed = "3/5"},
|
||||
{.modulation = "8psk", .speed = "2/3"},
|
||||
{.modulation = "8psk", .speed = "3/4"},
|
||||
{.modulation = "8psk", .speed = "5/6"},
|
||||
{.modulation = "8psk", .speed = "8/9"},
|
||||
{.modulation = "8psk", .speed = "9/10"},
|
||||
{.modulation = "16apsk", .speed = "2/3"},
|
||||
{.modulation = "16apsk", .speed = "3/4"},
|
||||
{.modulation = "16apsk", .speed = "4/5"},
|
||||
{.modulation = "16apsk", .speed = "5/6"},
|
||||
{.modulation = "16apsk", .speed = "8/9"},
|
||||
{.modulation = "16apsk", .speed = "9/10"},
|
||||
{.modulation = "32apsk", .speed = "3/4"},
|
||||
{.modulation = "32apsk", .speed = "4/5"},
|
||||
{.modulation = "32apsk", .speed = "5/6"},
|
||||
{.modulation = "32apsk", .speed = "8/9"},
|
||||
{.modulation = "32apsk", .speed = "9/10"},
|
||||
};
|
||||
|
||||
static const char* extractModcodModulation(uint32_t modcod, bool defaultQpsk1_4 = true) {
|
||||
modcod >>= 2;
|
||||
const auto* d = defaultQpsk1_4 ? defs : defs + 1;
|
||||
const auto* d = defaultQpsk1_4 ? ModcodDefs : ModcodDefs + 1;
|
||||
if (modcod < 28) {
|
||||
d = defs + modcod;
|
||||
d = ModcodDefs + modcod;
|
||||
}
|
||||
return d->modulation;
|
||||
}
|
||||
|
||||
static const char* extractModcodSpeed(uint32_t modcod, bool defaultQpsk1_4 = true) {
|
||||
modcod >>= 2;
|
||||
const auto* d = defaultQpsk1_4 ? defs : defs + 1;
|
||||
const auto* d = defaultQpsk1_4 ? ModcodDefs : ModcodDefs + 1;
|
||||
if (modcod < 28) {
|
||||
d = defs + modcod;
|
||||
d = ModcodDefs + modcod;
|
||||
}
|
||||
return d->speed;
|
||||
}
|
||||
@ -978,6 +978,26 @@ std::string api_driver::ApiDriver::loadFirmwareVersion() const {
|
||||
return result.str();
|
||||
}
|
||||
|
||||
#ifdef MODEM_IS_SCPC
|
||||
static uint32_t buildModcodFromPt(const boost::property_tree::ptree& pt, const std::string& name, bool isShortFrame) {
|
||||
uint32_t modcod = 0;
|
||||
const auto mod = pt.get<std::string>(name + "Modulation");
|
||||
const auto speed = pt.get<std::string>(name + "Speed");
|
||||
uint32_t _index = 0;
|
||||
for (const auto& m: ModcodDefs) {
|
||||
if (mod == m.modulation) {
|
||||
if (modcod == 0) modcod = _index;
|
||||
if (speed == m.speed) {
|
||||
modcod = _index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_index++;
|
||||
}
|
||||
return (modcod << 2) | (isShortFrame ? 2 : 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void api_driver::ApiDriver::setRxTxSettings(boost::property_tree::ptree &pt) {
|
||||
modulator_settings mod{};
|
||||
demodulator_settings demod{};
|
||||
@ -991,54 +1011,45 @@ void api_driver::ApiDriver::setRxTxSettings(boost::property_tree::ptree &pt) {
|
||||
// для модулятора
|
||||
#ifdef MODEM_IS_SCPC
|
||||
mod.is_cinc = pt.get<bool>("isCinC");
|
||||
mod.tx_is_on = pt.get<bool>(json_path("general.txEn", '/'));
|
||||
auto tmp = pt.get<std::string>(json_path("general.modulatorMode", '/'));
|
||||
if (tmp == "normal") { mod.is_carrier = true; }
|
||||
else if (tmp == "test") { mod.is_carrier = false; }
|
||||
else { throw std::runtime_error("api_driver::ApiDriver::setRxTxSettings(): Wrong carrier mode: " + tmp); }
|
||||
mod.is_save_current_state = pt.get<bool>(json_path("general.autoStartTx", '/'));
|
||||
mod.is_test_data = pt.get<bool>(json_path("general.isTestInputData", '/'));
|
||||
mod.attenuation = pt.get<double>(json_path("tx.attenuation", '/'));
|
||||
mod.rollof = pt.get<double>(json_path("tx.rolloff", '/')) / 100.0;
|
||||
mod.baudrate = pt.get<uint32_t>(json_path("tx.cymRate", '/'));
|
||||
mod.central_freq_in_kGz = pt.get<double>(json_path("tx.centerFreq", '/'));
|
||||
#endif
|
||||
mod.tx_is_on = pt.get<bool>("txEn");
|
||||
#ifdef MODEM_IS_SCPC
|
||||
mod.is_save_current_state = pt.get<bool>("txAutoStart");
|
||||
mod.is_carrier = !pt.get<bool>("txModulatorIsTest");
|
||||
#endif
|
||||
mod.is_test_data = pt.get<bool>("txIsTestInput");
|
||||
mod.central_freq_in_kGz = pt.get<double>("txCentralFreq");
|
||||
mod.baudrate = pt.get<uint32_t>("txBaudrate");
|
||||
mod.rollof = pt.get<int>("txRolloff") / 100.0;
|
||||
#ifdef MODEM_IS_SCPC
|
||||
//mod.qold_seq_is_active = pt.get<bool>("isCinC");
|
||||
#endif
|
||||
mod.attenuation = pt.get<double>("txAttenuation");
|
||||
|
||||
const bool acmIsShortFrame = !pt.get<bool>(json_path("dvbs2.frameSizeNormal", '/'));
|
||||
mod.modcod_tx = (pt.get<uint32_t>(json_path("dvbs2.ccm_modcod", '/')) << 2) | (acmIsShortFrame ? 2 : 0);
|
||||
#else
|
||||
mod.tx_is_on = pt.get<bool>(json_path("tx.txEn", '/'));
|
||||
mod.is_test_data = pt.get<bool>(json_path("tx.isTestInputData", '/'));
|
||||
mod.central_freq_in_kGz = pt.get<double>(json_path("tx.centerFreq", '/'));
|
||||
mod.baudrate = pt.get<uint32_t>(json_path("tx.cymRate", '/'));
|
||||
mod.attenuation = pt.get<double>(json_path("tx.attenuation", '/'));
|
||||
#ifdef MODEM_IS_SCPC
|
||||
const bool acmIsShortFrame = !pt.get<bool>("txFrameSizeNormal");
|
||||
mod.modcod_tx = buildModcodFromPt(pt, "dvbCcm", acmIsShortFrame);
|
||||
#endif
|
||||
|
||||
// демодулятор
|
||||
#ifdef MODEM_IS_SCPC
|
||||
tmp = pt.get<std::string>(json_path("rx.gainMode", '/'));
|
||||
#else
|
||||
auto tmp = pt.get<std::string>(json_path("rx.gainMode", '/'));
|
||||
#endif
|
||||
if (tmp == "auto") { demod.is_aru_on = true; }
|
||||
else if (tmp == "manual") { demod.is_aru_on = false; }
|
||||
else { throw std::runtime_error("api_driver::ApiDriver::setRxTxSettings(): Wrong gain mode: " + tmp); }
|
||||
demod.gain = pt.get<double>(json_path("rx.manualGain", '/'));
|
||||
demod.baudrate = pt.get<uint32_t>(json_path("rx.cymRate", '/'));
|
||||
demod.is_rvt_iq = pt.get<bool>(json_path("rx.spectrumInversion", '/'));
|
||||
demod.rollof = pt.get<double>(json_path("rx.rolloff", '/')) / 100.0;
|
||||
demod.central_freq_in_kGz = pt.get<double>(json_path("rx.centerFreq", '/'));
|
||||
demod.is_aru_on = pt.get<bool>("rxAgcEn");
|
||||
demod.gain = pt.get<bool>("rxManualGain");
|
||||
demod.is_rvt_iq = pt.get<bool>("aupcEn");
|
||||
demod.central_freq_in_kGz = pt.get<double>("rxCentralFreq");
|
||||
demod.baudrate = pt.get<uint32_t>("rxBaudrate");
|
||||
demod.rollof = pt.get<int>("rxRolloff") / 100.0;
|
||||
|
||||
#ifdef MODEM_IS_SCPC
|
||||
// ACM
|
||||
acm.enable = pt.get<bool>(json_path("dvbs2.isAcm", '/'));
|
||||
acm.max_modcod = (pt.get<uint32_t>(json_path("dvbs2.acm_maxModcod", '/')) << 2) | (acmIsShortFrame ? 2 : 0);
|
||||
acm.min_modcod = (pt.get<uint32_t>(json_path("dvbs2.acm_minModcod", '/')) << 2) | (acmIsShortFrame ? 2 : 0);
|
||||
acm.snr_treashold_acm = pt.get<double>(json_path("dvbs2.snrReserve", '/')); // запас ОСШ
|
||||
acm.period_pack = pt.get<uint32_t>(json_path("dvbs2.servicePacketPeriod", '/'));
|
||||
acm.enable_auto_atten = pt.get<bool>(json_path("acm.en", '/'));
|
||||
acm.max_attenuation = pt.get<double>(json_path("acm.maxAttenuation", '/'));
|
||||
acm.min_attenuation = pt.get<double>(json_path("acm.minAttenuation", '/'));
|
||||
acm.snr_treashold = pt.get<double>(json_path("acm.requiredSnr", '/')); // требуемый ОСШ
|
||||
acm.period_pack = pt.get<uint32_t>("dvbServicePacketPeriod");
|
||||
acm.enable = pt.get<bool>("rxAgcEn");
|
||||
acm.min_modcod = buildModcodFromPt(pt, "dvbAcmMin", acmIsShortFrame);
|
||||
acm.max_modcod = buildModcodFromPt(pt, "dvbAcmMax", acmIsShortFrame);
|
||||
acm.snr_treashold_acm = pt.get<double>("dvbSnrReserve"); // запас ОСШ
|
||||
acm.enable_auto_atten = pt.get<bool>(json_path("aupcEn", '/'));
|
||||
acm.min_attenuation = pt.get<int>("aupcMinAttenuation");
|
||||
acm.max_attenuation = pt.get<int>("aupcMaxAttenuation");
|
||||
acm.snr_treashold = pt.get<double>("aupcRequiredSnr");
|
||||
|
||||
daemon->setSettingsRxTx(mod, demod, acm);
|
||||
#else
|
||||
@ -1050,30 +1061,23 @@ void api_driver::ApiDriver::setRxTxSettings(boost::property_tree::ptree &pt) {
|
||||
void api_driver::ApiDriver::setCincSettings(boost::property_tree::ptree &pt) {
|
||||
DPDI_parmeters s{};
|
||||
|
||||
//result << ",\n\"cinc.mode\":" << (dpdiSettings.is_delay_window ? "\"delay\"" : "\"positional\"");
|
||||
auto tmp = pt.get<std::string>(json_path("cinc.mode", '/'));
|
||||
if (tmp == "delay") { s.is_delay_window = true; }
|
||||
else if (tmp == "positional") { s.is_delay_window = false; }
|
||||
else {
|
||||
throw std::runtime_error("Wrong CinC mode: " + tmp);
|
||||
}
|
||||
s.is_delay_window = !pt.get<bool>("cincIsPositional");
|
||||
s.freq_offset = pt.get<uint32_t>("cincSearchBandwidth");
|
||||
|
||||
auto ctmp = translateCoordinates(pt.get<double>(json_path("cinc.position.station.latitude", '/')));
|
||||
auto ctmp = translateCoordinates(pt.get<double>("cincPositionStationLatitude"));
|
||||
s.latitude_station_grad = std::get<0>(ctmp);
|
||||
s.latitude_station_minute = std::get<1>(ctmp);
|
||||
|
||||
ctmp = translateCoordinates(pt.get<double>(json_path("cinc.position.station.longitude", '/')));
|
||||
ctmp = translateCoordinates(pt.get<double>("cincPositionStationLongitude"));
|
||||
s.longitude_station_grad = std::get<0>(ctmp);
|
||||
s.longitude_station_minute = std::get<1>(ctmp);
|
||||
|
||||
ctmp = translateCoordinates(pt.get<double>(json_path("cinc.position.satelliteLongitude", '/')));
|
||||
ctmp = translateCoordinates(pt.get<double>("cincPositionSatelliteLongitude"));
|
||||
s.longitude_sattelite_grad = std::get<0>(ctmp);
|
||||
s.longitude_sattelite_minute = std::get<1>(ctmp);
|
||||
|
||||
s.max_delay = pt.get<uint32_t>(json_path("cinc.delayMax", '/'));
|
||||
s.min_delay = pt.get<uint32_t>(json_path("cinc.delayMin", '/'));
|
||||
|
||||
s.freq_offset = pt.get<uint32_t>(json_path("cinc.searchBandwidth", '/'));
|
||||
s.min_delay = pt.get<uint32_t>("cincDelayMin");
|
||||
s.max_delay = pt.get<uint32_t>("cincDelayMax");
|
||||
|
||||
this->daemon->setSettingsCinc(s);
|
||||
}
|
||||
@ -1081,19 +1085,13 @@ void api_driver::ApiDriver::setCincSettings(boost::property_tree::ptree &pt) {
|
||||
|
||||
void api_driver::ApiDriver::setBucLnbSettings(boost::property_tree::ptree &pt) {
|
||||
buc_lnb_settings s{};
|
||||
#ifdef MODEM_IS_SCPC
|
||||
daemon->getSettings(nullptr, nullptr, nullptr, nullptr, &s);
|
||||
#else
|
||||
daemon->getSettings(nullptr, nullptr, &s);
|
||||
#endif
|
||||
|
||||
auto tmp = pt.get<int>(json_path("lnb.powering", '/'));
|
||||
switch (tmp) {
|
||||
case 13: s.lnb = voltage_lnb::_13V; break;
|
||||
case 18: s.lnb = voltage_lnb::_18V; break;
|
||||
case 24: s.lnb = voltage_lnb::_24V; break;
|
||||
case 0:
|
||||
default:
|
||||
s.lnb = voltage_lnb::DISABLE;
|
||||
}
|
||||
s.is_ref_10MHz_lnb = pt.get<bool>(json_path("lnb.refClk10M", '/'));
|
||||
|
||||
tmp = pt.get<int>(json_path("buc.powering", '/'));
|
||||
auto tmp = pt.get<int>("bucPowering");
|
||||
switch (tmp) {
|
||||
case 24: s.buc = voltage_buc::_24V; break;
|
||||
#ifdef MODEM_IS_SCPC
|
||||
@ -1103,11 +1101,21 @@ void api_driver::ApiDriver::setBucLnbSettings(boost::property_tree::ptree &pt) {
|
||||
default:
|
||||
s.lnb = voltage_lnb::DISABLE;
|
||||
}
|
||||
s.is_ref_10MHz_buc = pt.get<bool>("bucRefClk10M");
|
||||
|
||||
s.is_ref_10MHz_buc = pt.get<bool>(json_path("buc.refClk10M", '/'));
|
||||
tmp = pt.get<int>("lnbPowering");
|
||||
switch (tmp) {
|
||||
case 13: s.lnb = voltage_lnb::_13V; break;
|
||||
case 18: s.lnb = voltage_lnb::_18V; break;
|
||||
case 24: s.lnb = voltage_lnb::_24V; break;
|
||||
case 0:
|
||||
default:
|
||||
s.lnb = voltage_lnb::DISABLE;
|
||||
}
|
||||
s.is_ref_10MHz_lnb = pt.get<bool>("lnbRefClk10M");
|
||||
|
||||
s.is_ref_10MHz_output = pt.get<bool>(json_path("serviceSettings.refClk10M", '/'));
|
||||
s.is_save_current_state = pt.get<bool>(json_path("serviceSettings.autoStart", '/'));
|
||||
s.is_ref_10MHz_output = pt.get<bool>("srvRefClk10M");
|
||||
s.is_save_current_state = pt.get<bool>("bucLnbAutoStart");
|
||||
|
||||
this->daemon->setSettingsBucLnb(s);
|
||||
}
|
||||
@ -1124,19 +1132,17 @@ void api_driver::ApiDriver::setQosSettings(boost::property_tree::ptree &pt) {
|
||||
|
||||
void api_driver::ApiDriver::setNetworkSettings(boost::property_tree::ptree &pt) {
|
||||
TerminalNetworkSettings s;
|
||||
s.managementIp = pt.get<std::string>(json_path("network.managementIp", '/'));
|
||||
s.managementGateway = pt.get<std::string>(json_path("network.managementGateway", '/'));
|
||||
s.isL2 = pt.get<bool>(json_path("network.mode", '/'));
|
||||
s.dataIp = pt.get<std::string>(json_path("network.dataIp", '/'));
|
||||
s.dataMtu = pt.get<unsigned int>(json_path("network.dataMtu", '/'));
|
||||
daemon->getNetworkSettings(s);
|
||||
|
||||
s.managementIp = pt.get<std::string>("netManagementIp");
|
||||
// s.managementGateway = pt.get<std::string>(json_path("network.managementGateway", '/'));
|
||||
s.isL2 = pt.get<bool>("netIsL2");
|
||||
s.dataIp = pt.get<std::string>("netDataIp");
|
||||
s.dataMtu = pt.get<unsigned int>("netDataMtu");
|
||||
|
||||
daemon->setNetworkSettings(s);
|
||||
}
|
||||
|
||||
void api_driver::ApiDriver::setDebugSendSettings(boost::property_tree::ptree &pt) {
|
||||
boost::ignore_unused(pt);
|
||||
}
|
||||
|
||||
void api_driver::ApiDriver::resetDefaultSettings() {
|
||||
daemon->resetDefaultSettings();
|
||||
}
|
||||
@ -1178,8 +1184,8 @@ std::string api_driver::ApiDriver::loadSysInfo() {
|
||||
result << ",\"load15min\":"; writeDouble(result, f_load * static_cast<double>(info.loads[2]), 2);
|
||||
result << ",\"totalram\":" << ((info.totalram * info.mem_unit) >> 20); // Mb
|
||||
result << ",\"freeram\":" << ((info.freeram * info.mem_unit) >> 20); // Mb
|
||||
result << ",\"sharedram\":" << ((info.sharedram * info.mem_unit) >> 20); // Mb
|
||||
result << ",\"bufferram\":" << ((info.bufferram * info.mem_unit) >> 20); // Mb
|
||||
// result << ",\"sharedram\":" << ((info.sharedram * info.mem_unit) >> 20); // Mb
|
||||
// result << ",\"bufferram\":" << ((info.bufferram * info.mem_unit) >> 20); // Mb
|
||||
// result << ",\"totalswap\":" << info.totalswap * info.mem_unit;
|
||||
// result << ",\"freeswap\":" << info.freeswap * info.mem_unit;
|
||||
result << ",\"procs\":" << static_cast<long>(info.procs);
|
||||
|
Loading…
x
Reference in New Issue
Block a user