компилируемая версия для всех версий модемов, пока без CP Proxy

This commit is contained in:
2025-06-03 16:16:41 +03:00
parent 50f82483fd
commit f30e1adb49
8 changed files with 661 additions and 263 deletions

View File

@@ -64,59 +64,6 @@ void api_driver::ApiDriver::resetPacketStatistics() const {
this->daemon->resetPacketStatistics();
}
#ifdef MODEM_IS_SCPC
struct ModcodDef_t {const char* modulation; const char* speed;};
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 ? ModcodDefs : ModcodDefs + 1;
if (modcod < (sizeof(ModcodDefs) / sizeof(ModcodDef_t))) {
d = ModcodDefs + modcod;
}
return d->modulation;
}
static const char* extractModcodSpeed(uint32_t modcod, bool defaultQpsk1_4 = true) {
modcod >>= 2;
const auto* d = defaultQpsk1_4 ? ModcodDefs : ModcodDefs + 1;
if (modcod < (sizeof(ModcodDefs) / sizeof(ModcodDef_t))) {
d = ModcodDefs + modcod;
}
return d->speed;
}
#endif
std::string api_driver::ApiDriver::loadSettings() const {
if (daemon == nullptr) {
return R"({"error": "api daemon not started!"})";
@@ -142,43 +89,23 @@ 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, bool isPilots = false) {
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) | (isPilots ? 1 : 0);
}
#endif
void api_driver::ApiDriver::setRxTxSettings(boost::property_tree::ptree &pt) {
void api_driver::ApiDriver::setRxTxSettings(const nlohmann::json& data) {
// TODO
}
void api_driver::ApiDriver::setDpdiSettings(boost::property_tree::ptree &pt) {
void api_driver::ApiDriver::setDpdiSettings(const nlohmann::json& data) {
// TODO
}
void api_driver::ApiDriver::setBucLnbSettings(boost::property_tree::ptree &pt) {
void api_driver::ApiDriver::setBucLnbSettings(const nlohmann::json& data) {
// TODO
}
void api_driver::ApiDriver::setQosSettings(boost::property_tree::ptree &pt) {
void api_driver::ApiDriver::setQosSettings(const nlohmann::json& data) {
// TODO
}
void api_driver::ApiDriver::setNetworkSettings(boost::property_tree::ptree &pt) {
void api_driver::ApiDriver::setNetworkSettings(const nlohmann::json& data) {
// TODO
}
@@ -208,8 +135,8 @@ std::string api_driver::ApiDriver::getLoggingStatisticsSettings() {
return this->daemon->statsLogs.getSettings();
}
void api_driver::ApiDriver::setLoggingStatisticsSettings(boost::property_tree::ptree &pt) {
this->daemon->statsLogs.setSettings(pt);
void api_driver::ApiDriver::setLoggingStatisticsSettings(const nlohmann::json& data) {
this->daemon->statsLogs.setSettings(data);
}
#endif