From 8e056fda939ce0c64826a30275e0b19127a6fb67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ta=C5=84ski?= Date: Wed, 13 Oct 2021 17:23:52 +0200 Subject: [PATCH] [EGD-7205] Tethering can not be enabled in offline mode The tethering should not be enabled in offline mode. --- module-sys/PhoneModes/Subject.cpp | 5 +++++ module-sys/PhoneModes/include/PhoneModes/Subject.hpp | 2 ++ products/PurePhone/sys/SystemManager.cpp | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/module-sys/PhoneModes/Subject.cpp b/module-sys/PhoneModes/Subject.cpp index c2273d0f34456c6029d60ddabfea8efa2eb98681..d647c316a7390e4cbbdc5de824c238a8949a4097 100644 --- a/module-sys/PhoneModes/Subject.cpp +++ b/module-sys/PhoneModes/Subject.cpp @@ -77,4 +77,9 @@ namespace sys::phone_modes { return tetheringMode == Tethering::On; } + + bool Subject::isTetheringPossible() const noexcept + { + return phoneMode != PhoneMode::Offline; + } } // namespace sys::phone_modes diff --git a/module-sys/PhoneModes/include/PhoneModes/Subject.hpp b/module-sys/PhoneModes/include/PhoneModes/Subject.hpp index d7236bc82517cf90604102110af4300be3c500f2..5c326dad84b5a698b098ac5ea0c11fc9cddbd10b 100644 --- a/module-sys/PhoneModes/include/PhoneModes/Subject.hpp +++ b/module-sys/PhoneModes/include/PhoneModes/Subject.hpp @@ -41,6 +41,8 @@ namespace sys::phone_modes bool isTetheringEnabled() const noexcept; + bool isTetheringPossible() const noexcept; + private: bool changePhoneMode(PhoneMode mode) noexcept; void notifyPhoneModeChange(); diff --git a/products/PurePhone/sys/SystemManager.cpp b/products/PurePhone/sys/SystemManager.cpp index 6fe7e9f91b99d3b6261f55cbcd94573a84385818..3f7476a64a5249bd0f62c3fe54e70d47a31df056 100644 --- a/products/PurePhone/sys/SystemManager.cpp +++ b/products/PurePhone/sys/SystemManager.cpp @@ -106,7 +106,9 @@ namespace sys } if (const auto requestedState = request->getTetheringState(); requestedState == phone_modes::Tethering::On) { - bus.sendUnicast(std::make_shared(), service::name::appmgr); + if (phoneModeSubject->isTetheringPossible()) { + bus.sendUnicast(std::make_shared(), service::name::appmgr); + } } else { if (const auto tetheringChanged = phoneModeSubject->setTetheringMode(phone_modes::Tethering::Off);