From f94d7f63679e4fb1702495eb136b7596b3cbfc36 Mon Sep 17 00:00:00 2001 From: Kuba Kleczkowski Date: Mon, 27 Mar 2023 16:38:58 +0200 Subject: [PATCH] [MOS-636] Added MMI/USSD confirmation USSD/MMI codes are now confirmed after they are sended. --- image/system_a/data/lang/Deutsch.json | 1 + image/system_a/data/lang/English.json | 1 + image/system_a/data/lang/Espanol.json | 1 + image/system_a/data/lang/Francais.json | 1 + image/system_a/data/lang/Polski.json | 1 + image/system_a/data/lang/Svenska.json | 1 + .../ApplicationDesktop.cpp | 10 ++- .../application-desktop/CMakeLists.txt | 1 + .../ApplicationDesktop.hpp | 1 + .../include/application-desktop/Names.hpp | 1 + .../windows/MmiConfirmationWindow.cpp | 72 +++++++++++++++++++ .../windows/MmiConfirmationWindow.hpp | 28 ++++++++ .../windows/MmiPullWindow.cpp | 3 +- .../windows/MmiPushWindow.cpp | 3 +- .../include/service-appmgr/Actions.hpp | 1 + .../service-cellular/ServiceCellular.cpp | 5 ++ .../requests/PinChangeRequest.cpp | 3 +- .../service-cellular/requests/Request.cpp | 10 +++ .../requests/SupplementaryServicesRequest.cpp | 2 +- .../service-cellular/CellularMessage.hpp | 13 ++++ .../requests/PasswordRegistrationRequest.hpp | 4 +- .../requests/PinChangeRequest.hpp | 2 +- .../service-cellular/requests/Request.hpp | 14 +++- .../requests/SupplementaryServicesRequest.hpp | 2 +- .../service-cellular/requests/UssdRequest.hpp | 4 +- .../src/ServiceCellularPriv.cpp | 8 ++- .../services/appmgr/ApplicationManager.cpp | 1 + pure_changelog.md | 1 + 28 files changed, 180 insertions(+), 15 deletions(-) create mode 100644 module-apps/application-desktop/windows/MmiConfirmationWindow.cpp create mode 100644 module-apps/application-desktop/windows/MmiConfirmationWindow.hpp diff --git a/image/system_a/data/lang/Deutsch.json b/image/system_a/data/lang/Deutsch.json index 42da3ceb24d3818c166b97d1c8f335575741ad38..e12ea104366713a79aaeae91d81040e802f907d0 100644 --- a/image/system_a/data/lang/Deutsch.json +++ b/image/system_a/data/lang/Deutsch.json @@ -260,6 +260,7 @@ "app_desktop_info_mmi_imei": "IMEI (MEID)", "app_desktop_info_mmi_result_success": "Erfolgreich", "app_desktop_info_mmi_result_failed": "Fehlgeschlagen", + "app_desktop_info_mmi_confirmation": "Bitte warten...

Der MMI-/USSD- Code wird verarbeitet.
", "sim_header_setup": "$SIM einrichten", "sim_enter_pin_unlock": "PIN-Code eingeben, um

die$PINTYPE Karte einzurichten:
", "sim_enter_enter_current": "Aktuellen PIN-Code eingeben:", diff --git a/image/system_a/data/lang/English.json b/image/system_a/data/lang/English.json index 60632e3074a560a75c335a99b5ace8a668eaed90..bfbb6adf67d69a7581d61705a4cd850b7dc68ec3 100644 --- a/image/system_a/data/lang/English.json +++ b/image/system_a/data/lang/English.json @@ -225,6 +225,7 @@ "app_desktop_info_mmi_imei": "IMEI (MEID)", "app_desktop_info_mmi_result_success": "Success", "app_desktop_info_mmi_result_failed": "Failed", + "app_desktop_info_mmi_confirmation": "Please wait...

Processing USSD code.
", "sim_header_setup": "$SIM setup", "sim_enter_pin_unlock": "Enter the PIN code to set up

the $PINTYPE card:
", "sim_enter_enter_current": "Type current PIN code:", diff --git a/image/system_a/data/lang/Espanol.json b/image/system_a/data/lang/Espanol.json index 1cdf78e7362848e7f29b58aa07671a7a1dc27e1a..e315d4ecf79d0fd5a435a3f80f030f2a72bee647 100644 --- a/image/system_a/data/lang/Espanol.json +++ b/image/system_a/data/lang/Espanol.json @@ -260,6 +260,7 @@ "app_desktop_info_mmi_imei": "IMEI (MEID)", "app_desktop_info_mmi_result_success": "Correcto", "app_desktop_info_mmi_result_failed": "Error", + "app_desktop_info_mmi_confirmation": "Espere, porfavor...

Procesando el código MMI/USSD.
", "sim_header_setup": "Configuración de $SIM", "sim_enter_pin_unlock": "Introduce el código PIN

para configurar la tarjeta $PINTYPE:
", "sim_enter_enter_current": "Introduce el código PIN actual:", diff --git a/image/system_a/data/lang/Francais.json b/image/system_a/data/lang/Francais.json index 79641358726c5eb9fe775e306d514f04e9eb42dd..370317851677f97bcb4f11bf5c43efb98628f747 100644 --- a/image/system_a/data/lang/Francais.json +++ b/image/system_a/data/lang/Francais.json @@ -229,6 +229,7 @@ "app_desktop_info_mmi_imei": "IMEI (MEID)", "app_desktop_info_mmi_result_success": "Succès", "app_desktop_info_mmi_result_failed": "Échoué", + "app_desktop_info_mmi_confirmation": "Veuillez patienter...

Traitement du code MMI/USSD.
", "sim_header_setup": "Configuration de la $SIM", "sim_enter_pin_unlock": "Entrez votre code pour configurer

la carte $PINTYPE :
", "sim_enter_enter_current": "Taper votre code actuel :", diff --git a/image/system_a/data/lang/Polski.json b/image/system_a/data/lang/Polski.json index aeb0af1b610b8932bc54832d305331dc458209fd..60e71abbf45e465e15bbf34d21084e42122ab633 100644 --- a/image/system_a/data/lang/Polski.json +++ b/image/system_a/data/lang/Polski.json @@ -252,6 +252,7 @@ "app_desktop_info_mmi_imei": "IMEI (MEID)", "app_desktop_info_mmi_result_success": "Udało się", "app_desktop_info_mmi_result_failed": "Nie udało się", + "app_desktop_info_mmi_confirmation": "Proszę czekać...

Przetwarzanie kodu MMI/USSD.
", "sim_header_setup": "Konfiguracja $SIM", "sim_enter_pin_unlock": "Wprowadź kod PIN, by skonfigurować

kartę $PINTYPE:
", "sim_enter_enter_current": "Wprowadź aktualny kod PIN:", diff --git a/image/system_a/data/lang/Svenska.json b/image/system_a/data/lang/Svenska.json index dc946d51e08d7f771ea9d5c383d91423ee2ebc77..80830f246bf2c16d4da540c6c6b5ae13c6c79cfb 100644 --- a/image/system_a/data/lang/Svenska.json +++ b/image/system_a/data/lang/Svenska.json @@ -211,6 +211,7 @@ "app_desktop_info_mmi_imei": "IMEI-nummer (MEID)", "app_desktop_info_mmi_result_success": "Lyckades", "app_desktop_info_mmi_result_failed": "Misslyckades", + "app_desktop_info_mmi_confirmation": "Var god vänta...

Bearbetar MMI/USSD-kod.
", "sim_header_setup": "$SIM-inställningar", "sim_enter_pin_unlock": "Den förra PIN-koden:", "sim_change_pin": "Ändra PIN-koden", diff --git a/module-apps/application-desktop/ApplicationDesktop.cpp b/module-apps/application-desktop/ApplicationDesktop.cpp index 4ca40a947c3e17ff8db6f89c548f4088d8b1c8ca..90d73dc61b94ef71a41aa0ddef7de01c36057324 100644 --- a/module-apps/application-desktop/ApplicationDesktop.cpp +++ b/module-apps/application-desktop/ApplicationDesktop.cpp @@ -10,6 +10,7 @@ #include "MmiInternalMsgWindow.hpp" #include "MmiPullWindow.hpp" #include "WindowsPopupFilter.hpp" +#include "MmiConfirmationWindow.hpp" #include #include @@ -50,6 +51,11 @@ namespace app return actionHandled(); }); + addActionReceiver(app::manager::actions::ShowMMIConfirmation, [this](auto &&data) { + switchWindow(app::window::name::desktop_mmi_confirmation, std::move(data)); + return actionHandled(); + }); + addActionReceiver(app::manager::actions::DisplayLowBatteryScreen, [this](auto &&data) { handleLowBatteryNotification(std::move(data)); return actionHandled(); @@ -166,7 +172,9 @@ namespace app gui::popup::window::tethering_off_window, [](ApplicationCommon *app, const std::string &name) { return std::make_unique(app, gui::popup::window::tethering_off_window); }); - + windowsFactory.attach(desktop_mmi_confirmation, [](ApplicationCommon *app, const std::string &name) { + return std::make_unique(app, name); + }); attachPopups({gui::popup::ID::Volume, gui::popup::ID::Tethering, gui::popup::ID::BluetoothAuthenticate, diff --git a/module-apps/application-desktop/CMakeLists.txt b/module-apps/application-desktop/CMakeLists.txt index 78a45a6658394d2cc63921ec4b165bf1f6b33a15..f676699174103aa5e7f402370c381aa2dacc8038 100644 --- a/module-apps/application-desktop/CMakeLists.txt +++ b/module-apps/application-desktop/CMakeLists.txt @@ -42,6 +42,7 @@ target_sources(application-desktop windows/MmiPullWindow.hpp windows/MmiPushWindow.cpp windows/MmiPushWindow.hpp + windows/MmiConfirmationWindow.cpp PUBLIC include/application-desktop/ApplicationDesktop.hpp include/application-desktop/Constants.hpp diff --git a/module-apps/application-desktop/include/application-desktop/ApplicationDesktop.hpp b/module-apps/application-desktop/include/application-desktop/ApplicationDesktop.hpp index 3b6aef2bfaeeb2b95490656f57eb9484cf3ebf41..6d7eb6b36f4c4546acfc4381acdd87e563fb1de3 100644 --- a/module-apps/application-desktop/include/application-desktop/ApplicationDesktop.hpp +++ b/module-apps/application-desktop/include/application-desktop/ApplicationDesktop.hpp @@ -59,6 +59,7 @@ namespace app manager::actions::ShowMMIResponse, manager::actions::ShowMMIPush, manager::actions::ShowMMIResult, + manager::actions::ShowMMIConfirmation, manager::actions::DisplayLowBatteryScreen, manager::actions::SystemBrownout, manager::actions::DisplayLogoAtExit, diff --git a/module-apps/application-desktop/include/application-desktop/Names.hpp b/module-apps/application-desktop/include/application-desktop/Names.hpp index b177cb78b3a36a480de1bc4163879a527e3cccbb..3928a7d35ef14dfffbc6b5e5c735a4bd394d49c3 100644 --- a/module-apps/application-desktop/include/application-desktop/Names.hpp +++ b/module-apps/application-desktop/include/application-desktop/Names.hpp @@ -20,4 +20,5 @@ namespace app::window::name inline constexpr auto desktop_mmi_pull = "MmiPullWindow"; inline constexpr auto desktop_mmi_push = "MmiPushWindow"; inline constexpr auto desktop_mmi_internal = "MmiInternalMsgWindow"; + inline constexpr auto desktop_mmi_confirmation = "MmiConfirmationWindow"; }; // namespace app::window::name diff --git a/module-apps/application-desktop/windows/MmiConfirmationWindow.cpp b/module-apps/application-desktop/windows/MmiConfirmationWindow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f600f51df183219d693e7de9b14eecde0abb778f --- /dev/null +++ b/module-apps/application-desktop/windows/MmiConfirmationWindow.cpp @@ -0,0 +1,72 @@ +// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#include "MmiConfirmationWindow.hpp" + +#include +#include +#include +#include + +using namespace gui; + +namespace style::desktop +{ + namespace image + { + constexpr uint32_t x = 176; + constexpr uint32_t y = 135; + } // namespace image + namespace text + { + constexpr uint32_t x = 40; + constexpr uint32_t y = 300; + constexpr uint32_t w = 400; + constexpr uint32_t h = 300; + } // namespace text + +} // namespace style::desktop + +MmiConfirmationWindow::MmiConfirmationWindow(app::ApplicationCommon *app, const std::string &name) + : gui::WindowWithTimer(app, name) +{ + AppWindow::buildInterface(); + navBar->setText(nav_bar::Side::Center, utils::translate(style::strings::common::ok)); + icon = new Icon(this, + style::window::default_left_margin, + style::window::default_vertical_pos, + style::window::default_body_width, + style::window::default_body_height, + "progress_128px_W_G", + utils::translate("app_desktop_info_mmi_confirmation")); + icon->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top)); + icon->image->setMargins(Margins(0, icon::image_top_margin, 0, icon::image_bottom_margin)); +} + +bool MmiConfirmationWindow::onInput(const InputEvent &inputEvent) +{ + if (inputEvent.isShortRelease()) { + switch (inputEvent.getKeyCode()) { + case KeyCode::KEY_ENTER: { + application->returnToPreviousWindow(); + return true; + } + case KeyCode::KEY_RF: { + return true; + } + default: + break; + } + } + return AppWindow::onInput(inputEvent); +} + +void MmiConfirmationWindow::destroyInterface() +{ + erase(); +} + +MmiConfirmationWindow::~MmiConfirmationWindow() +{ + destroyInterface(); +} diff --git a/module-apps/application-desktop/windows/MmiConfirmationWindow.hpp b/module-apps/application-desktop/windows/MmiConfirmationWindow.hpp new file mode 100644 index 0000000000000000000000000000000000000000..02498ff29719f7c056e343615873cf6530e0821b --- /dev/null +++ b/module-apps/application-desktop/windows/MmiConfirmationWindow.hpp @@ -0,0 +1,28 @@ +// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#pragma once + +#include +#include +#include +#include +#include + +#include + +namespace gui +{ + class MmiConfirmationWindow : public WindowWithTimer + { + protected: + Icon *icon = nullptr; + + public: + MmiConfirmationWindow(app::ApplicationCommon *app, const std::string &name); + ~MmiConfirmationWindow() override; + bool onInput(const InputEvent &inputEvent) override; + void destroyInterface() override; + }; + +}; // namespace gui diff --git a/module-apps/application-desktop/windows/MmiPullWindow.cpp b/module-apps/application-desktop/windows/MmiPullWindow.cpp index 58e5d0f16a4f5acc393319095c0c48d52a45048a..9fac47b6ccc8a2d21638d1eb7234df2fc228b3e8 100644 --- a/module-apps/application-desktop/windows/MmiPullWindow.cpp +++ b/module-apps/application-desktop/windows/MmiPullWindow.cpp @@ -4,6 +4,7 @@ #include "DesktopInputWidget.hpp" #include "Mmi.hpp" #include "MmiPullWindow.hpp" +#include "Names.hpp" #include #include @@ -84,7 +85,7 @@ bool MmiPullWindow::onInput(const InputEvent &inputEvent) switch (inputEvent.getKeyCode()) { case KeyCode::KEY_RF: { CellularServiceAPI::USSDRequest(this->application, cellular::USSDMessage::RequestType::abortSession, ""); - application->returnToPreviousWindow(); + application->switchWindow(app::window::name::desktop_main_window); return true; } default: diff --git a/module-apps/application-desktop/windows/MmiPushWindow.cpp b/module-apps/application-desktop/windows/MmiPushWindow.cpp index ac3b5f70360564cccbdc34f9dca2399070854bc9..74184015b67b52cabe26c7f280373006f7fd3183 100644 --- a/module-apps/application-desktop/windows/MmiPushWindow.cpp +++ b/module-apps/application-desktop/windows/MmiPushWindow.cpp @@ -3,6 +3,7 @@ #include "Mmi.hpp" #include "MmiPushWindow.hpp" +#include "Names.hpp" #include #include @@ -57,7 +58,7 @@ bool MmiPushWindow::onInput(const InputEvent &inputEvent) if (inputEvent.isShortRelease()) { switch (inputEvent.getKeyCode()) { case KeyCode::KEY_ENTER: { - application->returnToPreviousWindow(); + application->switchWindow(app::window::name::desktop_main_window); return true; } case KeyCode::KEY_RF: { diff --git a/module-services/service-appmgr/include/service-appmgr/Actions.hpp b/module-services/service-appmgr/include/service-appmgr/Actions.hpp index f9d40b14050b74070a3604a4edb76300051d4a8e..d5340828429bdf3d50de95a84ba68c8a96c8ade4 100644 --- a/module-services/service-appmgr/include/service-appmgr/Actions.hpp +++ b/module-services/service-appmgr/include/service-appmgr/Actions.hpp @@ -48,6 +48,7 @@ namespace app::manager ShowMMIResult, ShowMMIResponse, ShowMMIPush, + ShowMMIConfirmation, SmsRejectNoSim, DisplayLowBatteryScreen, SystemBrownout, diff --git a/module-services/service-cellular/ServiceCellular.cpp b/module-services/service-cellular/ServiceCellular.cpp index 5fa8d7afbc43ea274be374af3b3cbc87d9964ab2..4839b94d257eaa3406edef009ed6e2445da5c480 100644 --- a/module-services/service-cellular/ServiceCellular.cpp +++ b/module-services/service-cellular/ServiceCellular.cpp @@ -1793,12 +1793,17 @@ auto ServiceCellular::handleCellularCallRequestMessage(cellular::CallRequestMess auto request = factory.create(); CellularRequestHandler handler(*this); + const auto confirmation = request->confirmRequest(); + if (confirmation) { + bus.sendUnicast(confirmation, ::service::name::appmgr); + } auto result = channel->cmd(request->command()); request->handle(handler, result); if (!result) { log_last_AT_error(channel); } LOG_INFO("isHandled %d, %s", static_cast(request->isHandled()), utils::enumToString(result.code).c_str()); + if (!request->isHandled()) { cellular::CallRequestGeneralError::ErrorType errorType = translate(result.code); auto message = std::make_shared(errorType); diff --git a/module-services/service-cellular/requests/PinChangeRequest.cpp b/module-services/service-cellular/requests/PinChangeRequest.cpp index 4f19be6e9c554099d96bc16f2eae633c7f2bcdf9..deb1392617a114a9a60705ecae7c5ae44712d731 100644 --- a/module-services/service-cellular/requests/PinChangeRequest.cpp +++ b/module-services/service-cellular/requests/PinChangeRequest.cpp @@ -27,7 +27,8 @@ namespace cellular { PinChangeRequest::PinChangeRequest(const std::string &data, GroupMatch matchGroups) - : Request(data), requestOldPinOrPuk(matchGroups[magic_enum::enum_integer(PinChangeRegexGroups::OldPassword)]), + : ConfirmingRequest(data), + requestOldPinOrPuk(matchGroups[magic_enum::enum_integer(PinChangeRegexGroups::OldPassword)]), requestNewPin(matchGroups[magic_enum::enum_integer(PinChangeRegexGroups::NewPassword)]), requestNewPinRepeat(matchGroups[magic_enum::enum_integer(PinChangeRegexGroups::NewPasswordRepeat)]) { diff --git a/module-services/service-cellular/requests/Request.cpp b/module-services/service-cellular/requests/Request.cpp index 75d7e6520eaf1f353fa14fcd362a385fbf89bac0..05dc6ae5871f79c6cb6b59ada1e4050b4cd007ed 100644 --- a/module-services/service-cellular/requests/Request.cpp +++ b/module-services/service-cellular/requests/Request.cpp @@ -32,6 +32,11 @@ namespace cellular return true; } + std::shared_ptr Request::confirmRequest() const noexcept + { + return sys::MessageNone{}; + } + at::Cmd Request::buildCommand(at::AT atCommand, const std::vector &builderFunctions, bool trim) const @@ -54,4 +59,9 @@ namespace cellular return cmd; } + + std::shared_ptr ConfirmingRequest::confirmRequest() const noexcept + { + return std::make_shared(); + } }; // namespace cellular diff --git a/module-services/service-cellular/requests/SupplementaryServicesRequest.cpp b/module-services/service-cellular/requests/SupplementaryServicesRequest.cpp index 055e91364e7cf101c6c36368d0bdc8d9e8164adf..460aa2b93e6156ea3d2c2a4787cc6b8ce4001379 100644 --- a/module-services/service-cellular/requests/SupplementaryServicesRequest.cpp +++ b/module-services/service-cellular/requests/SupplementaryServicesRequest.cpp @@ -31,7 +31,7 @@ namespace namespace cellular { SupplementaryServicesRequest::SupplementaryServicesRequest(const std::string &data, GroupMatch matchGroups) - : Request(data), + : ConfirmingRequest(data), serviceCode(matchGroups[magic_enum::enum_integer(SupplementaryServicesRegexGroups::ServiceCode)]), supplementaryInfoA(matchGroups[magic_enum::enum_integer(SupplementaryServicesRegexGroups::SupInfoA)]), supplementaryInfoB(matchGroups[magic_enum::enum_integer(SupplementaryServicesRegexGroups::SupInfoB)]), diff --git a/module-services/service-cellular/service-cellular/CellularMessage.hpp b/module-services/service-cellular/service-cellular/CellularMessage.hpp index 57c465914f7d8029203e53c73258759d978ccb92..de019d64e13049da56c585d7b6450aab40a43332 100644 --- a/module-services/service-cellular/service-cellular/CellularMessage.hpp +++ b/module-services/service-cellular/service-cellular/CellularMessage.hpp @@ -433,6 +433,19 @@ namespace cellular } }; + class MMIConfirmationMessage : public sys::DataMessage, public app::manager::actions::ConvertibleToAction + { + public: + MMIConfirmationMessage() + {} + + [[nodiscard]] auto toAction() const -> std::unique_ptr + { + return std::make_unique( + sender, app::manager::actions::ShowMMIConfirmation, nullptr); + } + }; + class SetOperatorAutoSelectResponse : public ResponseMessage { public: diff --git a/module-services/service-cellular/service-cellular/requests/PasswordRegistrationRequest.hpp b/module-services/service-cellular/service-cellular/requests/PasswordRegistrationRequest.hpp index 8e2d4231c13a9177627735a29c8fc50d24f85e53..734b9c2c7991a31710078a62f05011760fededa4 100644 --- a/module-services/service-cellular/service-cellular/requests/PasswordRegistrationRequest.hpp +++ b/module-services/service-cellular/service-cellular/requests/PasswordRegistrationRequest.hpp @@ -25,11 +25,11 @@ namespace cellular NewPasswordRepeat //! (?:\*([0-9]*) }; - class PasswordRegistrationRequest : public Request + class PasswordRegistrationRequest : public ConfirmingRequest { public: PasswordRegistrationRequest(const std::string &data, GroupMatch matchGroups) - : Request(data), + : ConfirmingRequest(data), requestBarringService( matchGroups[magic_enum::enum_integer(PasswordRegistrationRegexGroups::BarringServiceCode)]), requestOldPassword(matchGroups[magic_enum::enum_integer(PasswordRegistrationRegexGroups::OldPassword)]), diff --git a/module-services/service-cellular/service-cellular/requests/PinChangeRequest.hpp b/module-services/service-cellular/service-cellular/requests/PinChangeRequest.hpp index 95e9ed78bc1435096d9200a8480b03ad17ad69ec..785a7e82c8a90ad4e5e185b2d302e0f263f4a283 100644 --- a/module-services/service-cellular/service-cellular/requests/PinChangeRequest.hpp +++ b/module-services/service-cellular/service-cellular/requests/PinChangeRequest.hpp @@ -20,7 +20,7 @@ namespace cellular NewPasswordRepeat //! (?:\*([0-9]*)) }; - class PinChangeRequest : public Request + class PinChangeRequest : public ConfirmingRequest { public: enum class PassChangeType diff --git a/module-services/service-cellular/service-cellular/requests/Request.hpp b/module-services/service-cellular/service-cellular/requests/Request.hpp index 3024565f3807448264858e49daa05b9b08f4850f..b5bb75110cf88d682814134a43cd8062d1157d32 100644 --- a/module-services/service-cellular/service-cellular/requests/Request.hpp +++ b/module-services/service-cellular/service-cellular/requests/Request.hpp @@ -3,6 +3,7 @@ #pragma once +#include #include #include #include "service-cellular/RequestHandler.hpp" @@ -21,19 +22,21 @@ namespace cellular virtual void setHandled(bool handled) = 0; virtual bool checkModemResponse(const at::Result &result) = 0; [[nodiscard]] virtual bool isHandled() const noexcept = 0; - [[nodiscard]] virtual bool isValid() const noexcept = 0; + [[nodiscard]] virtual bool isValid() const noexcept = 0; + virtual std::shared_ptr confirmRequest() const noexcept = 0; virtual ~IRequest(){}; }; class Request : public IRequest { public: - Request(const std::string &data) : request(data){}; + explicit Request(const std::string &data) : request(data){}; void setHandled(bool handled) final; bool isHandled() const noexcept final; bool checkModemResponse(const at::Result &result) final; bool isValid() const noexcept override; + std::shared_ptr confirmRequest() const noexcept override; protected: using commandBuilderFunc = std::function; @@ -50,4 +53,11 @@ namespace cellular bool isRequestHandled = false; std::string request; }; + + class ConfirmingRequest : public Request + { + public: + explicit ConfirmingRequest(const std::string &data) : Request(data){}; + std::shared_ptr confirmRequest() const noexcept final; + }; }; // namespace cellular diff --git a/module-services/service-cellular/service-cellular/requests/SupplementaryServicesRequest.hpp b/module-services/service-cellular/service-cellular/requests/SupplementaryServicesRequest.hpp index cc6591ace45b3e7b84c37b92c6b8cf0a24a2eb48..b7f24d1f3a025ea3a4481a159f2c5069f32c81fd 100644 --- a/module-services/service-cellular/service-cellular/requests/SupplementaryServicesRequest.hpp +++ b/module-services/service-cellular/service-cellular/requests/SupplementaryServicesRequest.hpp @@ -28,7 +28,7 @@ namespace cellular SupInfoC //! (?:\*([^\*\#]+)) - Supplementary Information C (optional) }; - class SupplementaryServicesRequest : public Request + class SupplementaryServicesRequest : public ConfirmingRequest { public: static std::unique_ptr create(const std::string &data, GroupMatch matchGroups); diff --git a/module-services/service-cellular/service-cellular/requests/UssdRequest.hpp b/module-services/service-cellular/service-cellular/requests/UssdRequest.hpp index 62692e9974fbef75f4dabb2a5e739db9dd11d47d..1806500aaa785c81361f5437745b1f97b57208ea 100644 --- a/module-services/service-cellular/service-cellular/requests/UssdRequest.hpp +++ b/module-services/service-cellular/service-cellular/requests/UssdRequest.hpp @@ -12,10 +12,10 @@ namespace cellular { constexpr inline auto UssdRegex = "^[\\*\\#].*[\\#]$"; - class UssdRequest : public Request + class UssdRequest : public ConfirmingRequest { public: - UssdRequest(const std::string &data) : Request(data){}; + explicit UssdRequest(const std::string &data) : ConfirmingRequest(data){}; auto command() -> at::Cmd final; static auto create(const std::string &data, GroupMatch) -> std::unique_ptr; diff --git a/module-services/service-cellular/src/ServiceCellularPriv.cpp b/module-services/service-cellular/src/ServiceCellularPriv.cpp index 389373150bd2aaed05c5b1a2ae3d94102b89be8d..7325375c517117d20e63c515031b75e75007c4c8 100644 --- a/module-services/service-cellular/src/ServiceCellularPriv.cpp +++ b/module-services/service-cellular/src/ServiceCellularPriv.cpp @@ -587,8 +587,12 @@ namespace cellular::internal channel->cmd(at::AT::SMS_GSM); std::string command = at::factory(at::AT::CUSD_SEND) + request + commandDcs; - auto result = channel->cmd(command, std::chrono::seconds(120)); - return result.code == at::Result::Code::OK; + const auto result = channel->cmd(command, std::chrono::seconds(120)); + if (result.code == at::Result::Code::OK) { + owner->bus.sendUnicast(std::make_shared(), ::service::name::appmgr); + return true; + } + return false; }; ussdHandler->onRequestAbortSession = [this]() { diff --git a/products/PurePhone/services/appmgr/ApplicationManager.cpp b/products/PurePhone/services/appmgr/ApplicationManager.cpp index 2faa0e442987768fa3a1b392a9922b1e773d3e78..49f52588acaee474d5c7d54d9ad3a042d6e684ce 100644 --- a/products/PurePhone/services/appmgr/ApplicationManager.cpp +++ b/products/PurePhone/services/appmgr/ApplicationManager.cpp @@ -399,6 +399,7 @@ namespace app::manager connect(typeid(cellular::MMIResultMessage), convertibleToActionHandler); connect(typeid(cellular::MMIResponseMessage), convertibleToActionHandler); connect(typeid(cellular::MMIPushMessage), convertibleToActionHandler); + connect(typeid(cellular::MMIConfirmationMessage), convertibleToActionHandler); connect(typeid(cellular::NoSimNotification), convertibleToActionHandler); connect(typeid(cellular::NotAnEmergencyNotification), convertibleToActionHandler); connect(typeid(cellular::NoNetworkConenctionNotification), convertibleToActionHandler); diff --git a/pure_changelog.md b/pure_changelog.md index 9a8822e35dd468f98583df3ec430fd2af62b45a1..7f773a56bb0c7a8681f60b1e94338c58d73d7477 100644 --- a/pure_changelog.md +++ b/pure_changelog.md @@ -4,6 +4,7 @@ ### Added * Added input mode selection display timeout +* Added MMI/USSD code confirmation ### Changed / Improved