Compare commits
No commits in common. "6d79d60eb1490115d08257af2d1629538646f1aa" and "5f3d5791da57e4d768c37ccb596f42fa1fb69a2c" have entirely different histories.
6d79d60eb1
...
5f3d5791da
@ -15,16 +15,6 @@ else()
|
||||
message(FATAL_ERROR "You must set build type \"Debug\" or \"Release\". Another build types not supported!")
|
||||
endif()
|
||||
|
||||
if("${MODEM_TYPE}" STREQUAL "SCPC")
|
||||
add_definitions(-DMODEM_IS_SCPC)
|
||||
message(STATUS "Selected SCPC modem")
|
||||
elseif ("${MODEM_TYPE}" STREQUAL "TDMA")
|
||||
add_definitions(-DMODEM_IS_TDMA)
|
||||
message(STATUS "Selected TDMA modem")
|
||||
else()
|
||||
message(FATAL_ERROR "You must set `MODEM_TYPE` \"SCPC\" or \"TDMA\"!")
|
||||
endif()
|
||||
|
||||
add_compile_options(-Wall -Wextra -Wsign-conversion)
|
||||
|
||||
# максимальный размер тела запроса 200mb
|
||||
|
27
src/main.cpp
27
src/main.cpp
@ -104,23 +104,16 @@ class ServerResources {
|
||||
}
|
||||
|
||||
public:
|
||||
#if defined(MODEM_IS_TDMA)
|
||||
static constexpr const char* INDEX_HTML = "/main-tdma.html";
|
||||
#elif defined(MODEM_IS_SCPC)
|
||||
static constexpr const char* INDEX_HTML = "/main-scpc.html";
|
||||
#else
|
||||
#error "Modem type not defined!"
|
||||
#endif
|
||||
static constexpr const char* INDEX_HTML = "/main.html";
|
||||
static constexpr const char* LOGIN_HTML = "/login.html";
|
||||
|
||||
// картинки, их даже можно кешировать
|
||||
static constexpr const char* FAVICON_ICO = "/favicon.ico";
|
||||
static constexpr const char* FAVICON_ICO = "/favicon.png";
|
||||
static constexpr const char* VUE_JS = "/js/vue.js"; // это тоже можно кешировать
|
||||
|
||||
// а эти стили нельзя кешировать в отладочной версии
|
||||
static constexpr const char* STYLE_CSS = "/style.css";
|
||||
static constexpr const char* FIELDS_CSS = "/fields.css";
|
||||
static constexpr const char* INTERNET_JPG = "/internet.jpg";
|
||||
|
||||
ServerResources(const ServerResources&) = delete;
|
||||
|
||||
@ -128,13 +121,12 @@ public:
|
||||
api->startDaemon();
|
||||
auth.users.emplace_back(std::make_shared<http::auth::User>("admin", "", http::auth::User::SUPERUSER));
|
||||
|
||||
sf->registerFile(staticFilesPath + "/favicon.png", FAVICON_ICO, mime_types::image_png, true);
|
||||
sf->registerFile(staticFilesPath + FAVICON_ICO, FAVICON_ICO, mime_types::image_png, true);
|
||||
sf->registerFile(staticFilesPath + VUE_JS, VUE_JS, mime_types::javascript, true);
|
||||
sf->registerFile(staticFilesPath + STYLE_CSS, STYLE_CSS, mime_types::text_css, true);
|
||||
sf->registerFile(staticFilesPath + FIELDS_CSS, FIELDS_CSS, mime_types::text_css, true);
|
||||
sf->registerFile(staticFilesPath + INDEX_HTML, INDEX_HTML, mime_types::text_html, false);
|
||||
sf->registerFile(staticFilesPath + LOGIN_HTML, LOGIN_HTML, mime_types::text_html, true);
|
||||
sf->registerFile(staticFilesPath + INTERNET_JPG, INTERNET_JPG, mime_types::image_jpeg, true);
|
||||
}
|
||||
|
||||
void registerResources(http::server::Server& s) {
|
||||
@ -188,11 +180,10 @@ public:
|
||||
}
|
||||
}));
|
||||
|
||||
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>(FAVICON_ICO, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(FAVICON_ICO, rep); }));
|
||||
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>(STYLE_CSS, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(STYLE_CSS, rep); }));
|
||||
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>(FIELDS_CSS, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(FIELDS_CSS, rep); }));
|
||||
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>(VUE_JS, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(VUE_JS, rep); }));
|
||||
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>(INTERNET_JPG, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(INTERNET_JPG, rep); }));
|
||||
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>("/favicon.ico", [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(FAVICON_ICO, rep); }));
|
||||
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>("/style.css", [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(STYLE_CSS, rep); }));
|
||||
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>("/fields.css", [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(FIELDS_CSS, rep); }));
|
||||
s.resources.emplace_back(std::make_unique<http::resource::GenericResource>("/js/vue.js", [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(VUE_JS, rep); }));
|
||||
|
||||
s.resources.emplace_back(std::make_unique<http::auth::AuthRequiredResource>("/api/get/statistics", this->auth, http::auth::User::WATCH_STATISTICS, [this](const auto& req, auto& rep) {
|
||||
if (req.method != "GET") {
|
||||
@ -302,7 +293,7 @@ public:
|
||||
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
|
||||
}
|
||||
}));
|
||||
#ifdef MODEM_IS_SCPC
|
||||
|
||||
s.resources.emplace_back(std::make_unique<http::auth::AuthRequiredResource>("/api/set/cinc", 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);
|
||||
@ -330,7 +321,7 @@ public:
|
||||
rep.content.insert(rep.content.end(), result.c_str(), result.c_str() + result.size());
|
||||
}
|
||||
}));
|
||||
#endif
|
||||
|
||||
s.resources.emplace_back(std::make_unique<http::auth::AuthRequiredResource>("/api/set/rxtx", 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);
|
||||
|
@ -104,29 +104,23 @@ private:
|
||||
modulator_state modulator{};
|
||||
demodulator_state demodulator{};
|
||||
device_state device{};
|
||||
#ifdef MODEM_IS_SCPC
|
||||
CinC_state cinc{};
|
||||
#endif
|
||||
|
||||
std::lock_guard lock(this->cpApiMutex);
|
||||
CP_GetModulatorState(sid, modulator);
|
||||
CP_GetDemodulatorState(sid, demodulator);
|
||||
CP_GetDeviceState(sid, device);
|
||||
#ifdef MODEM_IS_SCPC
|
||||
bool isCinC = getIsCinC();
|
||||
if (isCinC) {
|
||||
CP_GetCinCState(sid, cinc);
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
std::lock_guard lock2(this->stateMutex);
|
||||
this->modState = modulator;
|
||||
this->demodState = demodulator;
|
||||
this->devState = device;
|
||||
#ifdef MODEM_IS_SCPC
|
||||
this->cincState = cinc;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,29 +129,23 @@ private:
|
||||
// uint32_t modulatorModcod;
|
||||
// CP_GetModulatorParams(sid, "modcod", &modulatorModcod);
|
||||
demodulator_settings demod{};
|
||||
#ifdef MODEM_IS_SCPC
|
||||
ACM_parameters_serv_ acm{};
|
||||
DPDI_parmeters dpdi{};
|
||||
#endif
|
||||
buc_lnb_settings bucLnb{};
|
||||
|
||||
std::lock_guard lock(this->cpApiMutex);
|
||||
CP_GetModulatorSettings(sid, mod);
|
||||
CP_GetDemodulatorSettings(sid, demod);
|
||||
#ifdef MODEM_IS_SCPC
|
||||
CP_GetAcmParams(sid, &acm);
|
||||
CP_GetDpdiParams(sid, &dpdi);
|
||||
#endif
|
||||
CP_GetBUC_LNB_settings(sid, bucLnb);
|
||||
|
||||
{
|
||||
std::lock_guard lock2(this->settingsMutex);
|
||||
this->modSettings = mod;
|
||||
this->demodSettings = demod;
|
||||
#ifdef MODEM_IS_SCPC
|
||||
this->acmSettings = acm;
|
||||
this->dpdiSettings = dpdi;
|
||||
#endif
|
||||
this->bucLnbSettings = bucLnb;
|
||||
}
|
||||
}
|
||||
@ -290,17 +278,13 @@ private:
|
||||
modulator_state modState{};
|
||||
demodulator_state demodState{};
|
||||
device_state devState{};
|
||||
#ifdef MODEM_IS_SCPC
|
||||
CinC_state cincState{};
|
||||
#endif
|
||||
|
||||
std::shared_mutex settingsMutex;
|
||||
modulator_settings modSettings{};
|
||||
demodulator_settings demodSettings{};
|
||||
#ifdef MODEM_IS_SCPC
|
||||
ACM_parameters_serv_ acmSettings{};
|
||||
DPDI_parmeters dpdiSettings{};
|
||||
#endif
|
||||
buc_lnb_settings bucLnbSettings{};
|
||||
|
||||
std::shared_mutex networkSettingsMutex;
|
||||
@ -321,7 +305,6 @@ public:
|
||||
this->qosClassesJson = DEFAULT_QOS_CLASSES;
|
||||
}
|
||||
|
||||
#ifdef MODEM_IS_SCPC
|
||||
/**
|
||||
* Получение статистики, копирует текущие значения в структуры, переданные по указателю. Если передан пустой указатель, копирования не произойдет.
|
||||
* @param mod статистика модулятра
|
||||
@ -338,27 +321,10 @@ public:
|
||||
if (cinc) { *cinc = this->cincState; }
|
||||
}
|
||||
}
|
||||
#else
|
||||
/**
|
||||
* Получение статистики, копирует текущие значения в структуры, переданные по указателю. Если передан пустой указатель, копирования не произойдет.
|
||||
* @param mod статистика модулятра
|
||||
* @param demod статистика демодулятора
|
||||
* @param dev статистика устройства (температуры)
|
||||
*/
|
||||
void getState(modulator_state* mod, demodulator_state* demod, device_state* dev) {
|
||||
if (mod != nullptr || demod != nullptr || dev != nullptr) {
|
||||
std::shared_lock lock(this->stateMutex);
|
||||
if (mod) { *mod = this->modState; }
|
||||
if (demod) { *demod = this->demodState; }
|
||||
if (dev) { *dev = this->devState; }
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Получение настроек, копирует текущие значения в структуры, переданные по указателю. Если передан пустой указатель, копирования не произойдет.
|
||||
*/
|
||||
#ifdef MODEM_IS_SCPC
|
||||
void getSettings(modulator_settings* mod, demodulator_settings* demod, ACM_parameters_serv_* acm, DPDI_parmeters* dpdi, buc_lnb_settings* bucLnb) {
|
||||
if (mod || demod || acm || dpdi || bucLnb) {
|
||||
std::shared_lock lock(this->settingsMutex);
|
||||
@ -369,23 +335,11 @@ public:
|
||||
if (bucLnb) { *bucLnb = this->bucLnbSettings; }
|
||||
}
|
||||
}
|
||||
#else
|
||||
void getSettings(modulator_settings* mod, demodulator_settings* demod, buc_lnb_settings* bucLnb) {
|
||||
if (mod || demod || bucLnb) {
|
||||
std::shared_lock lock(this->settingsMutex);
|
||||
if (mod) { *mod = this->modSettings; }
|
||||
if (demod) { *demod = this->demodSettings; }
|
||||
if (bucLnb) { *bucLnb = this->bucLnbSettings; }
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MODEM_IS_SCPC
|
||||
bool getIsCinC() {
|
||||
std::shared_lock lock(this->settingsMutex);
|
||||
return modSettings.is_cinc;
|
||||
}
|
||||
#endif
|
||||
|
||||
void getNetworkSettings(TerminalNetworkSettings& dest) {
|
||||
std::shared_lock lock(this->networkSettingsMutex);
|
||||
@ -398,7 +352,6 @@ public:
|
||||
json = this->qosClassesJson;
|
||||
}
|
||||
|
||||
#ifdef MODEM_IS_SCPC
|
||||
void setSettingsRxTx(modulator_settings& mod, demodulator_settings& demod, ACM_parameters_serv_& acm, bool readback = true) {
|
||||
std::lock_guard lock(this->cpApiMutex);
|
||||
CP_SetDmaDebug(sid, "begin_save_config", "");
|
||||
@ -418,26 +371,7 @@ public:
|
||||
}
|
||||
CP_SetDmaDebug(sid, "save_config", "");
|
||||
}
|
||||
#else
|
||||
void setSettingsRxTx(modulator_settings& mod, demodulator_settings& demod, bool readback = true) {
|
||||
std::lock_guard lock(this->cpApiMutex);
|
||||
CP_SetDmaDebug(sid, "begin_save_config", "");
|
||||
CP_SetModulatorSettings(this->sid, mod);
|
||||
CP_SetDemodulatorSettings(this->sid, demod);
|
||||
if (readback) {
|
||||
CP_GetModulatorSettings(this->sid, mod);
|
||||
CP_GetDemodulatorSettings(this->sid, demod);
|
||||
{
|
||||
std::lock_guard lock2{this->settingsMutex};
|
||||
this->modSettings = mod;
|
||||
this->demodSettings = demod;
|
||||
}
|
||||
}
|
||||
CP_SetDmaDebug(sid, "save_config", "");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MODEM_IS_SCPC
|
||||
void setSettingsCinc(DPDI_parmeters& s, bool readback = true) {
|
||||
std::lock_guard lock(this->cpApiMutex);
|
||||
CP_SetDmaDebug(sid, "begin_save_config", "");
|
||||
@ -451,7 +385,6 @@ public:
|
||||
}
|
||||
CP_SetDmaDebug(sid, "save_config", "");
|
||||
}
|
||||
#endif
|
||||
|
||||
void setSettingsBucLnb(buc_lnb_settings& bucLnb, bool readback = true) {
|
||||
std::lock_guard lock(this->cpApiMutex);
|
||||
@ -599,7 +532,7 @@ void writeDouble(std::ostream& out, double value, int prec = 2) {
|
||||
out << std::fixed << std::setprecision(prec) << value;
|
||||
}
|
||||
}
|
||||
#ifdef MODEM_IS_SCPC
|
||||
|
||||
double translateCoordinates(uint8_t deg, uint8_t min) {
|
||||
return static_cast<double>(deg) + static_cast<double>(min) / 60;
|
||||
}
|
||||
@ -610,7 +543,6 @@ std::tuple<uint8_t, uint8_t> translateCoordinates(double abs) {
|
||||
auto min = static_cast<uint8_t>(min_double);
|
||||
return std::make_tuple(deg, min);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
std::string api_driver::ApiDriver::loadTerminalState() const {
|
||||
@ -624,37 +556,29 @@ std::string api_driver::ApiDriver::loadTerminalState() const {
|
||||
modulator_state modulator{};
|
||||
demodulator_state demodulator{};
|
||||
device_state device{};
|
||||
#ifdef MODEM_IS_SCPC
|
||||
CinC_state cinc{};
|
||||
daemon->getState(&modulator, &demodulator, &device, &cinc);
|
||||
const bool isCinC = this->daemon->getIsCinC();
|
||||
#else
|
||||
daemon->getState(&modulator, &demodulator, &device);
|
||||
#endif
|
||||
|
||||
#ifdef MODEM_IS_SCPC
|
||||
result << ",\"isCinC\":" << boolAsStr(isCinC);
|
||||
#endif
|
||||
|
||||
// формируем структуру для TX
|
||||
result << ",\n\"tx.state\":" << boolAsStr(modulator.is_tx_on);
|
||||
result << ",\"tx.modcod\":" << modulator.modcod;
|
||||
#ifdef MODEM_IS_SCPC
|
||||
result << ",\"tx.snr\":"; writeDouble(result, modulator.snr_remote);
|
||||
|
||||
if (modulator.is_short) { result << R"(,"tx.frameSizeNormal":false)"; }
|
||||
else { result << R"(,"tx.frameSizeNormal":true)"; }
|
||||
|
||||
if (modulator.is_pilots) { result << R"(,"tx.isPilots":true)"; }
|
||||
else { result << R"(,"tx.isPilots":false)"; }
|
||||
#else
|
||||
{
|
||||
modulator_settings modSet{};
|
||||
daemon->getSettings(&modSet, nullptr, nullptr);
|
||||
result << ",\"tx.centerFreq\":"; writeDouble(result, modSet.central_freq_in_kGz);
|
||||
result << ",\"tx.symSpeed\":"; writeDouble(result, (static_cast<double>(modSet.baudrate) / 1000.0));
|
||||
if (modulator.is_short) {
|
||||
result << R"(,"tx.frameSizeNormal":false)";
|
||||
} else {
|
||||
result << R"(,"tx.frameSizeNormal":true)";
|
||||
}
|
||||
#endif
|
||||
|
||||
if (modulator.is_pilots) {
|
||||
result << R"(,"tx.isPilots":true)";
|
||||
} else {
|
||||
result << R"(,"tx.isPilots":false)";
|
||||
}
|
||||
|
||||
result << ",\"tx.speedOnTxKbit\":"; writeDouble(result, static_cast<double>(modulator.speed_in_bytes_tx) / 128.0);
|
||||
result << ",\"tx.speedOnIifKbit\":"; writeDouble(result, (static_cast<double>(modulator.speed_in_bytes_tx_iface) / 128.0));
|
||||
|
||||
@ -692,7 +616,6 @@ std::string api_driver::ApiDriver::loadTerminalState() const {
|
||||
result << ",\"rx.packetsBad\":" << demodulator.packet_bad_cnt;
|
||||
result << ",\"rx.packetsDummy\":" << demodulator.dummy_cnt;
|
||||
|
||||
#ifdef MODEM_IS_SCPC
|
||||
// формируем структуру для CinC
|
||||
if (isCinC) {
|
||||
if (modulator.is_tx_on) {
|
||||
@ -713,7 +636,6 @@ std::string api_driver::ApiDriver::loadTerminalState() const {
|
||||
} else {
|
||||
result << R"(,"cinc.correlator":null)";
|
||||
}
|
||||
#endif
|
||||
|
||||
// структура температур девайса
|
||||
result << ",\n\"device.adrv\":"; writeDouble(result, device.adrv_temp, 1);
|
||||
@ -737,19 +659,14 @@ std::string api_driver::ApiDriver::loadSettings() const {
|
||||
|
||||
modulator_settings modSettings{};
|
||||
demodulator_settings demodSettings{};
|
||||
buc_lnb_settings bucLnb{};
|
||||
TerminalNetworkSettings network;
|
||||
#ifdef MODEM_IS_SCPC
|
||||
ACM_parameters_serv_ acmSettings{};
|
||||
DPDI_parmeters dpdiSettings{};
|
||||
buc_lnb_settings bucLnb{};
|
||||
TerminalNetworkSettings network;
|
||||
daemon->getSettings(&modSettings, &demodSettings, &acmSettings, &dpdiSettings, &bucLnb);
|
||||
#else
|
||||
daemon->getSettings(&modSettings, &demodSettings, &bucLnb);
|
||||
#endif
|
||||
daemon->getNetworkSettings(network);
|
||||
|
||||
std::stringstream result;
|
||||
#ifdef MODEM_IS_SCPC
|
||||
result << "{\n\"general.isCinC\":" << boolAsStr(modSettings.is_cinc);
|
||||
result << ",\"general.txEn\":" << boolAsStr(modSettings.tx_is_on);
|
||||
result << ",\"general.modulatorMode\":" << (modSettings.is_carrier ? "\"normal\"" : "\"test\"");
|
||||
@ -788,20 +705,6 @@ std::string api_driver::ApiDriver::loadSettings() const {
|
||||
result << ",\"cinc.position.satelliteLongitude\":"; writeDouble(result, translateCoordinates(dpdiSettings.longitude_sattelite_grad, dpdiSettings.longitude_sattelite_minute), 6);
|
||||
result << ",\"cinc.delayMin\":" << dpdiSettings.min_delay;
|
||||
result << ",\"cinc.delayMax\":" << dpdiSettings.max_delay;
|
||||
#else
|
||||
result << "{\n\"tx.txEn\":" << boolAsStr(modSettings.tx_is_on);
|
||||
result << ",\"tx.isTestInputData\":" << boolAsStr(modSettings.is_test_data);
|
||||
result << ",\"tx.cymRate\":" << modSettings.baudrate;
|
||||
result << ",\"tx.centerFreq\":"; writeDouble(result, modSettings.central_freq_in_kGz, 3);
|
||||
result << ",\"tx.attenuation\":"; writeDouble(result, modSettings.attenuation);
|
||||
|
||||
result << ",\n\"rx.gainMode\":" << (demodSettings.is_aru_on ? "\"auto\"" : "\"manual\"");
|
||||
result << ",\"rx.manualGain\":"; writeDouble(result, demodSettings.gain);
|
||||
result << ",\"rx.spectrumInversion\":" << boolAsStr(demodSettings.is_rvt_iq);
|
||||
result << ",\"rx.rolloff\":" << static_cast<int>(demodSettings.rollof * 100);
|
||||
result << ",\"rx.cymRate\":" << demodSettings.baudrate;
|
||||
result << ",\"rx.centerFreq\":"; writeDouble(result, demodSettings.central_freq_in_kGz);
|
||||
#endif
|
||||
|
||||
result << ",\n\"buc.refClk10M\":" << boolAsStr(bucLnb.is_ref_10MHz_buc);
|
||||
switch (bucLnb.buc) {
|
||||
@ -857,12 +760,9 @@ std::string api_driver::ApiDriver::loadFirmwareVersion() const {
|
||||
void api_driver::ApiDriver::setRxTxSettings(boost::property_tree::ptree &pt) {
|
||||
modulator_settings mod{};
|
||||
demodulator_settings demod{};
|
||||
#ifdef MODEM_IS_SCPC
|
||||
ACM_parameters_serv_ acm{};
|
||||
#endif
|
||||
|
||||
// для модулятора
|
||||
#ifdef MODEM_IS_SCPC
|
||||
mod.is_cinc = pt.get<bool>(json_path("general.isCinC", '/'));
|
||||
mod.tx_is_on = pt.get<bool>(json_path("general.txEn", '/'));
|
||||
auto tmp = pt.get<std::string>(json_path("general.modulatorMode", '/'));
|
||||
@ -878,20 +778,9 @@ void api_driver::ApiDriver::setRxTxSettings(boost::property_tree::ptree &pt) {
|
||||
|
||||
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", '/'));
|
||||
#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); }
|
||||
@ -901,7 +790,6 @@ void api_driver::ApiDriver::setRxTxSettings(boost::property_tree::ptree &pt) {
|
||||
demod.rollof = pt.get<double>(json_path("rx.rolloff", '/')) / 100.0;
|
||||
demod.central_freq_in_kGz = pt.get<double>(json_path("rx.centerFreq", '/'));
|
||||
|
||||
#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);
|
||||
@ -914,12 +802,8 @@ void api_driver::ApiDriver::setRxTxSettings(boost::property_tree::ptree &pt) {
|
||||
acm.snr_treashold = pt.get<double>(json_path("acm.requiredSnr", '/')); // требуемый ОСШ
|
||||
|
||||
daemon->setSettingsRxTx(mod, demod, acm);
|
||||
#else
|
||||
daemon->setSettingsRxTx(mod, demod);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MODEM_IS_SCPC
|
||||
void api_driver::ApiDriver::setCincSettings(boost::property_tree::ptree &pt) {
|
||||
DPDI_parmeters s{};
|
||||
|
||||
@ -948,7 +832,6 @@ void api_driver::ApiDriver::setCincSettings(boost::property_tree::ptree &pt) {
|
||||
|
||||
this->daemon->setSettingsCinc(s);
|
||||
}
|
||||
#endif
|
||||
|
||||
void api_driver::ApiDriver::setBucLnbSettings(boost::property_tree::ptree &pt) {
|
||||
buc_lnb_settings s{};
|
||||
@ -967,9 +850,7 @@ void api_driver::ApiDriver::setBucLnbSettings(boost::property_tree::ptree &pt) {
|
||||
tmp = pt.get<int>(json_path("buc.powering", '/'));
|
||||
switch (tmp) {
|
||||
case 24: s.buc = voltage_buc::_24V; break;
|
||||
#ifdef MODEM_IS_SCPC
|
||||
case 48: s.buc = voltage_buc::_48V; break;
|
||||
#endif
|
||||
case 0:
|
||||
default:
|
||||
s.lnb = voltage_lnb::DISABLE;
|
||||
|
@ -46,12 +46,11 @@ namespace api_driver {
|
||||
*/
|
||||
void setRxTxSettings(boost::property_tree::ptree &pt);
|
||||
|
||||
#ifdef MODEM_IS_SCPC
|
||||
/**
|
||||
* Установить настройки CinC, readback можно получить используя loadTerminalState.
|
||||
*/
|
||||
void setCincSettings(boost::property_tree::ptree &pt);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Установить настройки BUC и LNB, readback можно получить используя loadTerminalState.
|
||||
*/
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 72 KiB |
File diff suppressed because it is too large
Load Diff
@ -591,7 +591,7 @@
|
||||
<input v-model="param.debugSend.receiverIp" required type="text" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}">
|
||||
</label>
|
||||
<label>
|
||||
<span>Порт для данных</span>
|
||||
<span>Порт для CinC</span>
|
||||
<input v-model="param.debugSend.portCinC" type="number" min="0" max="65535">
|
||||
</label>
|
||||
<label>
|
Loading…
x
Reference in New Issue
Block a user