исправления методов-заглушек, часть 1
This commit is contained in:
@@ -44,7 +44,7 @@ std::tuple<uint8_t, uint8_t> translateCoordinates(double abs) {
|
||||
}
|
||||
|
||||
|
||||
std::string api_driver::ApiDriver::loadTerminalState() const {
|
||||
nlohmann::json api_driver::ApiDriver::loadTerminalState() const {
|
||||
if (daemon == nullptr) {
|
||||
return R"({"error": "api daemon not started!"})";
|
||||
}
|
||||
@@ -56,7 +56,7 @@ std::string api_driver::ApiDriver::loadTerminalState() const {
|
||||
|
||||
auto res = state.asJson();
|
||||
res["device"] = devState.asJson();
|
||||
return res.dump();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,38 +64,57 @@ void api_driver::ApiDriver::resetPacketStatistics() const {
|
||||
this->daemon->resetPacketStatistics();
|
||||
}
|
||||
|
||||
std::string api_driver::ApiDriver::loadSettings() const {
|
||||
nlohmann::json api_driver::ApiDriver::loadSettings() const {
|
||||
if (daemon == nullptr) {
|
||||
return R"({"error": "api daemon not started!"})";
|
||||
}
|
||||
|
||||
// TODO сделать получение настроек
|
||||
return "{}";
|
||||
nlohmann::json res = daemon->getSettingsRxTx().asJson();
|
||||
#ifdef API_OBJECT_QOS_SETTINGS_ENABLE
|
||||
res.update(daemon->getQosSettings().asJson());
|
||||
#endif
|
||||
#ifdef API_OBJECT_NETWORK_SETTINGS_ENABLE
|
||||
res.update(daemon->getNetworkSettings().asJson());
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
std::string api_driver::ApiDriver::loadFirmwareVersion() const {
|
||||
nlohmann::json api_driver::ApiDriver::loadFirmwareVersion() const {
|
||||
if (daemon == nullptr) {
|
||||
return R"({"error": "api daemon not started!"})";
|
||||
}
|
||||
|
||||
std::stringstream result;
|
||||
auto firmware = daemon->getFirmware();
|
||||
result << "{\n\"fw.version\":" << buildEscapedString(firmware.version);
|
||||
result << ",\"fw.modemId\":" << buildEscapedString(firmware.modemId);
|
||||
result << ",\"fw.modemSn\":" << buildEscapedString(firmware.modemSn);
|
||||
result << ",\"fw.macMang\":" << buildEscapedString(firmware.macMang);
|
||||
result << ",\"fw.macData\":" << buildEscapedString(firmware.macData);
|
||||
result << "\n}";
|
||||
return result.str();
|
||||
return daemon->getFirmware().asJson();
|
||||
}
|
||||
|
||||
void api_driver::ApiDriver::setRxTxSettings(const nlohmann::json& data) {
|
||||
// TODO
|
||||
auto rxtx = daemon->getSettingsRxTx();
|
||||
rxtx.updateMainSettings(data);
|
||||
|
||||
std::lock_guard _lapi(this->daemon->cpApiMutex);
|
||||
this->daemon->cp.setDmaDebug("begin_save_config", "");
|
||||
rxtx.storeMainSettings(this->daemon->cp);
|
||||
this->daemon->cp.setDmaDebug("save_config", "");
|
||||
rxtx.updateCallback(this->daemon->cp);
|
||||
{
|
||||
daemon->setSettingsRxTx(rxtx);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef API_OBJECT_DPDI_SETTINGS_ENABLE
|
||||
void api_driver::ApiDriver::setDpdiSettings(const nlohmann::json& data) {
|
||||
// TODO
|
||||
auto rxtx = daemon->getSettingsRxTx();
|
||||
rxtx.updateDpdiSettings(data);
|
||||
|
||||
std::lock_guard _lapi(this->daemon->cpApiMutex);
|
||||
this->daemon->cp.setDmaDebug("begin_save_config", "");
|
||||
rxtx.storeMainSettings(this->daemon->cp);
|
||||
this->daemon->cp.setDmaDebug("save_config", "");
|
||||
rxtx.updateCallback(this->daemon->cp);
|
||||
{
|
||||
daemon->setSettingsRxTx(rxtx);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void api_driver::ApiDriver::setBucLnbSettings(const nlohmann::json& data) {
|
||||
// TODO
|
||||
|
Reference in New Issue
Block a user