M .gitmodules => .gitmodules +2 -2
@@ 35,10 35,10 @@
url = https://github.com/catchorg/Catch2
[submodule "module-utils/date"]
path = module-utils/date
- url = ../date.git
+ url = git@github.com:mudita/date.git
[submodule "module-audio/Audio/decoder/minimp3"]
path = module-audio/Audio/decoder/minimp3
- url = ../minimp3.git
+ url = git@github.com:mudita/minimp3.git
branch = RT1051
[submodule "module-audio/Audio/decoder/taglib"]
path = module-audio/Audio/decoder/taglib
M changelog.md => changelog.md +2 -1
@@ 4,11 4,12 @@
### Added
+### Other
### Changed
-
+* `[antenna-app]` Added parameter history window.
### Fixed
M module-apps/application-antenna/AntennaAppStyle.hpp => module-apps/application-antenna/AntennaAppStyle.hpp +25 -0
@@ 24,11 24,15 @@ namespace antenna
constexpr uint32_t buttonH = 33;
constexpr uint32_t buttonSmallW = 130;
constexpr uint32_t buttonBigW = 400;
+ constexpr uint32_t buttonMidW = 195;
constexpr uint32_t buttonPosXLeft = 35;
constexpr uint32_t buttonPosXCenter = 175;
constexpr uint32_t buttonPostXRight = 315;
+ constexpr uint32_t buttonPosXColumnLeft = 40;
+ constexpr uint32_t buttonPosXColumnRight = 240;
+
constexpr uint32_t buttonPosYRow1 = 441;
constexpr uint32_t buttonPosYRow2 = 479;
constexpr uint32_t buttonPosYRow3 = 517;
@@ 53,6 57,27 @@ namespace antenna
constexpr uint32_t commonFocusPen = 3;
constexpr uint32_t commonNoFocusPen = 1;
} // namespace scan_mode_window
+
+ namespace algo_window
+ {
+
+ constexpr uint32_t selectedAntennaYPos = 110;
+ constexpr uint32_t selectedAntennaH = 50;
+ constexpr uint32_t infoYPos = 160;
+ constexpr uint32_t culumnLabelYPos = 199;
+ constexpr uint32_t commonH = 33;
+
+ constexpr uint32_t leftColumnXPos = 20;
+ constexpr uint32_t rightColumnXPos = 250;
+ constexpr uint32_t boxW = 210;
+ constexpr uint32_t boxH = 300;
+ constexpr uint32_t boxYPos = 232;
+
+ constexpr uint32_t commonW = 440;
+
+ constexpr uint32_t commonNoFocusPen = 0;
+
+ } // namespace algo_window
} // namespace antenna
#endif /* MODULE_APPS_APPLICATION_ANTENNA_ANTENNAAPPSTYLE_HPP_ */
M module-apps/application-antenna/ApplicationAntenna.cpp => module-apps/application-antenna/ApplicationAntenna.cpp +60 -11
@@ 11,6 11,7 @@
#include "windows/AntennaMainWindow.hpp"
#include "windows/ScanModesWindow.hpp"
+#include "windows/AlgoParamsWindow.hpp"
#include <ticks.hpp>
namespace app
@@ 19,15 20,12 @@ namespace app
void ApplicationAntenna::timerHandler(void)
{
auto win = getCurrentWindow();
-
- if (win->getName() == gui::name::window::main_window) {
- auto window = dynamic_cast<gui::AntennaMainWindow *>(win);
- if (window != nullptr) {
- if (!cellularRequestInProgress) {
- LOG_INFO("Get Network info");
- cellularRequestInProgress = true;
- CellularServiceAPI::GetNetworkInfo(this);
- }
+ auto windowName = win->getName();
+ if ((windowName == gui::name::window::main_window) || (windowName == gui::name::window::algo_window)) {
+ if (!cellularRequestInProgress) {
+ LOG_INFO("Get Network info");
+ cellularRequestInProgress = true;
+ CellularServiceAPI::GetNetworkInfo(this);
}
}
}
@@ 38,7 36,7 @@ namespace app
{
busChannels.push_back(sys::BusChannels::AntennaNotifications);
-
+ busChannels.push_back(sys::BusChannels::AntennaNotifications);
appTimer.restart();
}
@@ 75,6 73,7 @@ namespace app
if (msgl->messageType == MessageType::CellularNetworkInfoResult) {
auto msg = dynamic_cast<cellular::RawCommandRespAsync *>(msgl);
if (msg != nullptr) {
+ handleNetworkParams(msg->data);
auto win = getCurrentWindow();
if (win->getName() == gui::name::window::main_window) {
@@ 84,6 83,7 @@ namespace app
window->updateDebugInfo(msg->data);
}
}
+
cellularRequestInProgress = false;
}
handled = true;
@@ 105,7 105,7 @@ namespace app
handled = true;
}
if (msgl->messageType == MessageType::AntennaChanged) {
- bsp::cellular::antenna antenna;
+
CellularServiceAPI::GetAntenna(this, antenna);
auto win = getCurrentWindow();
@@ 116,8 116,22 @@ namespace app
window->updateAntennaButtons(antenna);
}
}
+
+ bool refresh = false;
+ if (win->getName() == gui::name::window::algo_window) {
+ refresh = true;
+ }
+ auto window = getWindow(gui::name::window::algo_window);
+ auto algoWindow = dynamic_cast<gui::AlgoParamsWindow *>(window);
+ if (algoWindow != nullptr) {
+ algoWindow->handleAntennaChanged(antenna, refresh);
+ }
handled = true;
}
+ if (msgl->messageType == MessageType::AntennaCSQChange) {
+ csqUpdated = true;
+ handled = true;
+ }
if (handled)
return std::make_shared<sys::ResponseMessage>();
else
@@ 136,6 150,8 @@ namespace app
setActiveWindow(gui::name::window::main_window);
+ CellularServiceAPI::GetAntenna(this, antenna);
+
return ret;
}
@@ 152,9 168,42 @@ namespace app
win = new gui::ScanModesWindow(this);
windows.insert(std::pair<std::string, gui::AppWindow *>(gui::name::window::scan_window, win));
+
+ win = new gui::AlgoParamsWindow(this);
+ windows.insert(std::pair<std::string, gui::AppWindow *>(gui::name::window::algo_window, win));
}
void ApplicationAntenna::destroyUserInterface()
{}
+ void ApplicationAntenna::handleNetworkParams(std::vector<std::string> &data)
+ {
+
+ uint32_t creg;
+ at::response::parseCREG(data[1], creg);
+
+ uint32_t bandFreq = at::response::qnwinfo::parseNetworkFrequency(data[2]);
+
+ if ((csqUpdated) || lastCreg != creg || lastFreq != bandFreq) {
+ std::string param;
+ at::response::parseCSQ(data[0], param);
+ param += " | " + std::to_string(creg);
+ param += " | " + std::to_string(bandFreq);
+
+ csqUpdated = false;
+ lastCreg = creg;
+ lastFreq = bandFreq;
+
+ bool refresh = false;
+ auto win = getWindow(gui::name::window::algo_window);
+ if (win == getCurrentWindow()) {
+ refresh = true;
+ }
+ auto window = dynamic_cast<gui::AlgoParamsWindow *>(win);
+ if (window != nullptr) {
+
+ window->handleNewParams(param, refresh);
+ }
+ }
+ }
} /* namespace app */
M module-apps/application-antenna/ApplicationAntenna.hpp => module-apps/application-antenna/ApplicationAntenna.hpp +26 -1
@@ 15,13 15,29 @@ namespace app
{
inline const std::string name_antenna = "ApplicationAntenna";
-
+ namespace antenna
+ {
+ class StoreParams
+ {
+ public:
+ std::string csq;
+ std::string creg;
+ std::string bandFreq;
+ };
+ constexpr uint32_t paramsMaxSize = 9;
+ } // namespace antenna
class ApplicationAntenna : public app::Application
{
protected:
AppTimer appTimer;
void timerHandler(void);
bool cellularRequestInProgress = false;
+ bsp::cellular::antenna antenna;
+
+ bool csqUpdated = false;
+ uint32_t lastCsq = 0;
+ uint32_t lastCreg = 0;
+ uint32_t lastFreq = 0;
public:
ApplicationAntenna(std::string name = name_antenna, std::string parent = "", bool startBackgound = false);
@@ 42,6 58,15 @@ namespace app
{
cellularRequestInProgress = value;
};
+ void handleNetworkParams(std::vector<std::string> &data);
+ bsp::cellular::antenna getAntenna(void)
+ {
+ CellularServiceAPI::GetAntenna(this, antenna);
+ return antenna;
+ }
+
+ std::vector<app::antenna::StoreParams> lowBandParams;
+ std::vector<app::antenna::StoreParams> highBandParams;
};
} /* namespace app */
M module-apps/application-antenna/CMakeLists.txt => module-apps/application-antenna/CMakeLists.txt +1 -0
@@ 17,6 17,7 @@ target_sources( ${PROJECT_NAME}
"${CMAKE_CURRENT_LIST_DIR}/ApplicationAntenna.cpp"
"${CMAKE_CURRENT_LIST_DIR}/windows/AntennaMainWindow.cpp"
"${CMAKE_CURRENT_LIST_DIR}/windows/ScanModesWindow.cpp"
+ "${CMAKE_CURRENT_LIST_DIR}/windows/AlgoParamsWindow.cpp"
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/ApplicationAntenna.hpp"
)
A module-apps/application-antenna/windows/AlgoParamsWindow.cpp => module-apps/application-antenna/windows/AlgoParamsWindow.cpp +196 -0
@@ 0,0 1,196 @@
+#include "AlgoParamsWindow.hpp"
+#include "gui/widgets/BoxLayout.hpp"
+#include "gui/widgets/Item.hpp"
+#include "gui/widgets/Label.hpp"
+#include "gui/widgets/Window.hpp"
+
+#include "i18/i18.hpp"
+#include <Style.hpp>
+#include "gui/widgets/BoxLayout.hpp"
+#include "../AntennaAppStyle.hpp"
+#include "../ApplicationAntenna.hpp"
+#include "service-cellular/api/CellularServiceAPI.hpp"
+
+using StringList = std::list<std::string>;
+
+namespace gui
+{
+
+ AlgoParamsWindow::AlgoParamsWindow(app::Application *app) : AppWindow(app, gui::name::window::algo_window)
+ {
+ buildInterface();
+ }
+
+ void AlgoParamsWindow::rebuild()
+ {
+ destroyInterface();
+ buildInterface();
+ }
+ void AlgoParamsWindow::buildInterface()
+ {
+ AppWindow::buildInterface();
+
+ bottomBar->setActive(BottomBar::Side::LEFT, true);
+ bottomBar->setActive(BottomBar::Side::CENTER, true);
+ bottomBar->setActive(BottomBar::Side::RIGHT, true);
+ bottomBar->setText(BottomBar::Side::CENTER, utils::localize.get(style::strings::common::open));
+ bottomBar->setText(BottomBar::Side::RIGHT, utils::localize.get(style::strings::common::back));
+
+ topBar->setActive(TopBar::Elements::SIGNAL, true);
+ topBar->setActive(TopBar::Elements::TIME, true);
+ topBar->setActive(TopBar::Elements::BATTERY, true);
+
+ setTitle(utils::localize.get("app_desktop_tools_antenna"));
+
+ lowBandBox = new gui::VBox(this,
+ antenna::algo_window::leftColumnXPos,
+ antenna::algo_window::boxYPos,
+ antenna::algo_window::boxW,
+ antenna::algo_window::boxH);
+ highBandBox = new gui::VBox(this,
+ antenna::algo_window::rightColumnXPos,
+ antenna::algo_window::boxYPos,
+ antenna::algo_window::boxW,
+ antenna::algo_window::boxH);
+
+ selectedAntenna = new gui::Label(this,
+ style::window::default_left_margin,
+ antenna::algo_window::selectedAntennaYPos,
+ antenna::algo_window::commonW,
+ style::window::label::default_h);
+ selectedAntenna->setFont(style::window::font::medium);
+ selectedAntenna->setPenWidth(antenna::algo_window::commonNoFocusPen);
+
+ info = new gui::Label(this,
+ style::window::default_left_margin,
+ antenna::algo_window::infoYPos,
+ antenna::algo_window::commonW,
+ style::window::label::small_h);
+ info->setText("Params format: CSQ | CREG | Band frequency");
+ info->setFont(style::window::font::verysmall);
+ info->setPenWidth(antenna::algo_window::commonNoFocusPen);
+
+ lowBandLabel = new gui::Label(this,
+ antenna::algo_window::leftColumnXPos,
+ antenna::algo_window::culumnLabelYPos,
+ antenna::algo_window::boxW,
+ style::window::label::small_h);
+ lowBandLabel->setText(lowBandString);
+ lowBandLabel->setFont(style::window::font::verysmall);
+ lowBandLabel->setPenWidth(antenna::algo_window::commonNoFocusPen);
+
+ highBandLabel = new gui::Label(this,
+ antenna::algo_window::rightColumnXPos,
+ antenna::algo_window::culumnLabelYPos,
+ antenna::algo_window::boxW,
+ style::window::label::small_h);
+ highBandLabel->setText(highBandString);
+ highBandLabel->setFont(style::window::font::verysmall);
+ highBandLabel->setPenWidth(antenna::algo_window::commonNoFocusPen);
+
+ app = dynamic_cast<app::ApplicationAntenna *>(this->application);
+ if (app != nullptr) {
+ auto currentAntenna = app->getAntenna();
+ updateAntennaLabel(currentAntenna);
+ }
+ }
+
+ void AlgoParamsWindow::destroyInterface()
+ {
+ erase();
+ }
+
+ void AlgoParamsWindow::onBeforeShow(ShowMode mode, SwitchData *data)
+ {}
+
+ bool AlgoParamsWindow::onInput(const InputEvent &inputEvent)
+ {
+ bool ret = AppWindow::onInput(inputEvent);
+ if (ret) {
+ application->render(RefreshModes::GUI_REFRESH_FAST);
+ return true;
+ }
+ return false;
+ }
+
+ void AlgoParamsWindow::handleNewParams(std::string data, bool refresh)
+ {
+
+ app = dynamic_cast<app::ApplicationAntenna *>(this->application);
+ if (app == nullptr) {
+ return;
+ }
+
+ StringList *list = nullptr;
+ gui::VBox *box = nullptr;
+ if (app->getAntenna() == bsp::cellular::antenna::lowBand) {
+ list = &lowBandParams;
+ box = lowBandBox;
+ }
+ else {
+ list = &highBandParams;
+ box = highBandBox;
+ }
+ list->push_front(data);
+ if (list->size() > app::antenna::paramsMaxSize) {
+ list->pop_back();
+ }
+ box->erase();
+ for (auto item : *list) {
+ box->addWidget(addLabel(box, item));
+ }
+
+ if (refresh) {
+ application->refreshWindow(RefreshModes::GUI_REFRESH_FAST);
+ }
+ }
+
+ void AlgoParamsWindow::handleAntennaChanged(bsp::cellular::antenna antenna, bool refresh)
+ {
+ StringList *list = nullptr;
+ gui::VBox *box = nullptr;
+ auto currentAntenna = app->getAntenna();
+ if (currentAntenna == bsp::cellular::antenna::lowBand) {
+ list = &lowBandParams;
+ box = lowBandBox;
+ }
+ else {
+ list = &highBandParams;
+ box = highBandBox;
+ }
+ updateAntennaLabel(currentAntenna);
+ list->clear();
+ box->erase();
+
+ if (refresh) {
+ application->refreshWindow(RefreshModes::GUI_REFRESH_FAST);
+ }
+ }
+ gui::Label *AlgoParamsWindow::addLabel(gui::Item *parent, const UTF8 &text)
+ {
+ gui::Label *label = new gui::Label(parent,
+ antenna::scan_mode_window::commonDefaultPos,
+ antenna::scan_mode_window::commonDefaultPos,
+ antenna::scan_mode_window::buttonW,
+ antenna::scan_mode_window::buttonH,
+ text);
+ label->setFilled(false);
+ label->setPenFocusWidth(antenna::scan_mode_window::commonFocusPen);
+ label->setPenWidth(antenna::scan_mode_window::commonNoFocusPen);
+
+ label->setFont(style::window::font::verysmall);
+ label->setAlignment(gui::Alignment(gui::Alignment::Horizontal::Center, gui::Alignment::Vertical::Center));
+
+ return label;
+ }
+ void AlgoParamsWindow::updateAntennaLabel(bsp::cellular::antenna antenna)
+ {
+ if (antenna == bsp::cellular::antenna::lowBand) {
+ selectedAntenna->setText(selectedAntennaPrefix + lowBandString);
+ }
+ else {
+
+ selectedAntenna->setText(selectedAntennaPrefix + highBandString);
+ }
+ }
+} // namespace gui
A module-apps/application-antenna/windows/AlgoParamsWindow.hpp => module-apps/application-antenna/windows/AlgoParamsWindow.hpp +52 -0
@@ 0,0 1,52 @@
+
+#pragma once
+
+#include "Application.hpp"
+#include "gui/widgets/Text.hpp"
+#include "windows/AppWindow.hpp"
+#include "../ApplicationAntenna.hpp"
+
+namespace gui
+{
+ namespace name
+ {
+ namespace window
+ {
+ const std::string algo_window("AlgoParamsWindow");
+ }
+ } // namespace name
+ class AlgoParamsWindow : public AppWindow
+ {
+ protected:
+ std::list<std::string> lowBandParams;
+ std::list<std::string> highBandParams;
+
+ gui::VBox *lowBandBox = nullptr;
+ gui::VBox *highBandBox = nullptr;
+ app::ApplicationAntenna *app = nullptr;
+ gui::Label *selectedAntenna = nullptr;
+ gui::Label *info = nullptr;
+ gui::Label *lowBandLabel = nullptr;
+ gui::Label *highBandLabel = nullptr;
+
+ std::string selectedAntennaPrefix = "Currently selected antenna: ";
+ std::string lowBandString = "Low Band";
+ std::string highBandString = "High Band";
+
+ gui::Label *addLabel(gui::Item *parent, const UTF8 &text);
+ void updateAntennaLabel(bsp::cellular::antenna antenna);
+
+ public:
+ AlgoParamsWindow(app::Application *app);
+
+ // virtual methods
+ bool onInput(const InputEvent &inputEvent) override;
+ void onBeforeShow(ShowMode mode, SwitchData *data) override;
+ void rebuild() override;
+ void buildInterface() override;
+ void destroyInterface() override;
+ void handleNewParams(std::string data, bool refresh);
+ void handleAntennaChanged(bsp::cellular::antenna antenna, bool refresh);
+ };
+
+} /* namespace gui */
M module-apps/application-antenna/windows/AntennaMainWindow.cpp => module-apps/application-antenna/windows/AntennaMainWindow.cpp +25 -8
@@ 15,6 15,7 @@
#include "../AntennaAppStyle.hpp"
#include "ScanModesWindow.hpp"
+#include "AlgoParamsWindow.hpp"
#include "../ApplicationAntenna.hpp"
#include "service-cellular/api/CellularServiceAPI.hpp"
#include "service-antenna/api/AntennaServiceAPI.hpp"
@@ 102,6 103,11 @@ namespace gui
return true;
}));
+ buttons.push_back(addLabel("Algo Parms", [=](gui::Item &) {
+ this->application->switchWindow(gui::name::window::algo_window, nullptr);
+ return true;
+ }));
+
uint32_t posX = antenna::main_window::commonXPos;
for (uint32_t i = 0; i < buttons.size(); i++) {
buttons[i]->setFont(style::window::font::medium);
@@ 130,11 136,14 @@ namespace gui
buttons[buttonDescriotion::ScanMode]->setSize(antenna::main_window::buttonSmallW,
antenna::main_window::buttonH);
- buttons[buttonDescriotion::LockAntennaManager]->setPosition(antenna::main_window::buttonPosXLeft,
+ buttons[buttonDescriotion::LockAntennaManager]->setPosition(antenna::main_window::buttonPosXColumnLeft,
antenna::main_window::buttonPosYRow3);
- buttons[buttonDescriotion::LockAntennaManager]->setSize(antenna::main_window::buttonBigW,
+ buttons[buttonDescriotion::LockAntennaManager]->setSize(antenna::main_window::buttonMidW,
antenna::main_window::buttonH);
-
+ buttons[buttonDescriotion::AlgoParams]->setPosition(antenna::main_window::buttonPosXColumnRight,
+ antenna::main_window::buttonPosYRow3);
+ buttons[buttonDescriotion::AlgoParams]->setSize(antenna::main_window::buttonMidW,
+ antenna::main_window::buttonH);
operators = new gui::Text(this,
antenna::main_window::commonXPos,
antenna::main_window::scanListPosY,
@@ 178,6 187,13 @@ namespace gui
buttons[buttonDescriotion::LockAntennaManager]->setNavigationItem(NavigationDirection::UP,
buttons[buttonDescriotion::AntennaA]);
+ buttons[buttonDescriotion::LockAntennaManager]->setNavigationItem(NavigationDirection::RIGHT,
+ buttons[buttonDescriotion::AlgoParams]);
+
+ buttons[buttonDescriotion::AlgoParams]->setNavigationItem(NavigationDirection::UP,
+ buttons[buttonDescriotion::AntennaA]);
+ buttons[buttonDescriotion::AlgoParams]->setNavigationItem(NavigationDirection::LEFT,
+ buttons[buttonDescriotion::LockAntennaManager]);
setFocusItem(buttons[buttonDescriotion::AntennaA]);
antenna::lockState antennaServiceState;
@@ 185,9 201,9 @@ namespace gui
updateLockedButton(antennaServiceState);
}
- bsp::cellular::antenna antenna;
- if (CellularServiceAPI::GetAntenna(this->application, antenna)) {
- updateAntennaButtons(antenna);
+ auto app = dynamic_cast<app::ApplicationAntenna *>(this->application);
+ if (app != nullptr) {
+ updateAntennaButtons(app->getAntenna());
}
}
void AntennaMainWindow::destroyInterface()
@@ 237,12 253,13 @@ namespace gui
void AntennaMainWindow::updateDebugInfo(std::vector<std::string> &data)
{
- LOG_INFO("AntennaMainWindow::updateDebugInfo vector size %u", static_cast<unsigned int>(data.size()));
if (data.size() == 3) {
titles[static_cast<uint32_t>(labelDescripion::csq)]->setText(
titlesText[static_cast<uint32_t>(labelDescripion::csq)] + data[0]);
+ std::string creg;
+ at::response::parseCREG(data[1], creg);
titles[static_cast<uint32_t>(labelDescripion::status)]->setText(
- titlesText[static_cast<uint32_t>(labelDescripion::status)] + data[1]);
+ titlesText[static_cast<uint32_t>(labelDescripion::status)] + creg);
auto bandFrequency = at::response::qnwinfo::parseNetworkFrequency(data[2]);
titles[static_cast<uint32_t>(labelDescripion::band)]->setText(
M module-apps/application-antenna/windows/AntennaMainWindow.hpp => module-apps/application-antenna/windows/AntennaMainWindow.hpp +2 -1
@@ 35,7 35,8 @@ namespace gui
AntennaB,
StartScan,
ScanMode,
- LockAntennaManager
+ LockAntennaManager,
+ AlgoParams
};
public:
M module-apps/application-antenna/windows/ScanModesWindow.cpp => module-apps/application-antenna/windows/ScanModesWindow.cpp +0 -6
@@ 1,9 1,3 @@
-/*
- * ScanModeWindow.cpp
- *
- * Created on: 31 mar 2020
- * Author: kuba
- */
#include "ScanModesWindow.hpp"
#include "gui/widgets/BoxLayout.hpp"
M module-audio/Audio/decoder/taglib => module-audio/Audio/decoder/taglib +1 -1
@@ 1,1 1,1 @@
-Subproject commit b2a6e50aedf0cfe1f808eb23dc9f572a848ddffe
+Subproject commit 355ea4337cadf7b9c92e940febaef8288b6f5902
M module-cellular/at/response.cpp => module-cellular/at/response.cpp +9 -7
@@ 8,25 8,26 @@ namespace at
namespace response
{
- bool parseCSQ(std::string &response, std::string &result)
+ bool parseCSQ(std::string response, std::string &result)
{
std::string toErase = "+CSQ: ";
-
auto pos = response.find(toErase);
if (pos != std::string::npos) {
response.erase(pos, toErase.length());
+
result = response;
return true;
}
return false;
}
- bool parseCSQ(std::string &cellularResponse, uint32_t &result)
+ bool parseCSQ(std::string cellularResponse, uint32_t &result)
{
-
+ LOG_INFO("%s", cellularResponse.c_str());
std::string CSQstring;
if (parseCSQ(cellularResponse, CSQstring)) {
auto pos = CSQstring.find(',');
if (pos != std::string::npos) {
+ LOG_INFO("%s", CSQstring.c_str());
CSQstring = CSQstring.substr(0, pos);
return utils::toNumeric(CSQstring, result);
}
@@ 50,11 51,12 @@ namespace at
} // namespace creg
bool parseCREG(std::string &response, uint32_t &result)
{
- auto pos = response.find(',');
+ auto resp = response;
+ auto pos = resp.find(',');
if (pos != std::string::npos) {
auto constexpr digitLength = 1;
- response = response.substr(pos + digitLength, digitLength);
- return utils::toNumeric(response, result);
+ resp = resp.substr(pos + digitLength, digitLength);
+ return utils::toNumeric(resp, result);
}
return false;
}
M module-cellular/at/response.hpp => module-cellular/at/response.hpp +2 -2
@@ 12,8 12,8 @@ namespace at
namespace response
{
std::vector<std::string> tokenize(std::string &response, std::string separator = ",");
- bool parseCSQ(std::string &response, std::string &result);
- bool parseCSQ(std::string &cellularResponse, uint32_t &result);
+ bool parseCSQ(std::string response, std::string &result);
+ bool parseCSQ(std::string cellularResponse, uint32_t &result);
bool parseCREG(std::string &response, uint32_t &result);
bool parseCREG(std::string &response, std::string &result);
bool parseQNWINFO(std::string &response, std::string &result);
M module-services/service-antenna/api/AntennaServiceAPI.cpp => module-services/service-antenna/api/AntennaServiceAPI.cpp +1 -1
@@ 6,7 6,7 @@ namespace AntennaServiceAPI
void CSQChange(sys::Service *serv)
{
auto msg = std::make_shared<sys::DataMessage>(MessageType::AntennaCSQChange);
- sys::Bus::SendUnicast(msg, ServiceAntenna::serviceName, serv);
+ sys::Bus::SendMulticast(msg, sys::BusChannels::AntennaNotifications, serv);
}
bool LockRequest(sys::Service *serv, antenna::lockState request)
{
M module-services/service-cellular/ServiceCellular.cpp => module-services/service-cellular/ServiceCellular.cpp +4 -14
@@ 1272,13 1272,8 @@ std::vector<std::string> ServiceCellular::getNetworkInfo(void)
if (channel) {
auto resp = channel->cmd(at::AT::CSQ);
if (resp.code == at::Result::Code::OK) {
- std::string ret;
- if (at::response::parseCSQ(resp.response[0], ret)) {
- data.push_back(ret);
- }
- else {
- data.push_back("");
- }
+
+ data.push_back(resp.response[0]);
}
else {
data.push_back("");
@@ 1286,13 1281,8 @@ std::vector<std::string> ServiceCellular::getNetworkInfo(void)
resp = channel->cmd(at::AT::CREG);
if (resp.code == at::Result::Code::OK) {
- std::string ret;
- if (at::response::parseCREG(resp.response[0], ret)) {
- data.push_back(ret);
- }
- else {
- data.push_back("");
- }
+
+ data.push_back(resp.response[0]);
}
else {
data.push_back("");