M harmony_changelog.md => harmony_changelog.md +1 -3
@@ 5,14 5,12 @@
### Fixed
* Fixed frequency lock during user activity
-
### Added
-
+* Added notification when charger is connected
### Changed / Improved
* Disabled USB MTP protocol
-
## [2.2.1 2023-10-30]
### Fixed
M image/system_a/data/lang/Deutsch.json => image/system_a/data/lang/Deutsch.json +2 -0
@@ 117,6 117,8 @@
"app_bellmain_relaxation": "Entspannung",
"app_bellmain_settings": "Einstellungen",
"app_bellmain_usb_status_connected": "Verbunden",
+ "app_bell_charging_notification": "Wird aufgeladen",
+ "app_bell_charging_done_notification": "Vollst\u00e4ndig aufgeladen",
"app_calculator_decimal_separator": ".",
"app_calculator_equals": "GLEICH",
"app_calculator_error": "Fehler",
M image/system_a/data/lang/English.json => image/system_a/data/lang/English.json +2 -0
@@ 152,6 152,8 @@
"app_bellmain_relaxation": "Relaxation",
"app_bellmain_settings": "Settings",
"app_bellmain_usb_status_connected": "Connected",
+ "app_bell_charging_notification": "Charging",
+ "app_bell_charging_done_notification": "Fully charged",
"app_calculator_decimal_separator": ".",
"app_calculator_equals": "EQUALS",
"app_calculator_error": "Error",
M image/system_a/data/lang/Espanol.json => image/system_a/data/lang/Espanol.json +2 -0
@@ 116,6 116,8 @@
"app_bellmain_relaxation": "Relajaci\u00f3n",
"app_bellmain_settings": "Ajustes",
"app_bellmain_usb_status_connected": "Conectado",
+ "app_bell_charging_notification": "Cargando",
+ "app_bell_charging_done_notification": "Completamente cargado",
"app_calculator_decimal_separator": ",",
"app_calculator_equals": "IGUAL A",
"app_calculator_error": "Error",
M image/system_a/data/lang/Francais.json => image/system_a/data/lang/Francais.json +2 -0
@@ 120,6 120,8 @@
"app_bellmain_relaxation": "Bruits de fond",
"app_bellmain_settings": "Param\u00e8tres",
"app_bellmain_usb_status_connected": "Connect\u00e9",
+ "app_bell_charging_notification": "En charge",
+ "app_bell_charging_done_notification": "Compl\u00e8tement charg\u00e9",
"app_calculator_decimal_separator": ",",
"app_calculator_equals": "\u00c9QUIVAUT \u00c0",
"app_calculator_error": "Erreur",
M image/system_a/data/lang/Polski.json => image/system_a/data/lang/Polski.json +2 -0
@@ 118,6 118,8 @@
"app_bellmain_relaxation": "Relaks",
"app_bellmain_settings": "Ustawienia",
"app_bellmain_usb_status_connected": "Po\u0142\u0105czony",
+ "app_bell_charging_notification": "\u0141adowanie",
+ "app_bell_charging_done_notification": "W pe\u0142ni na\u0142adowany",
"app_calculator_decimal_separator": ",",
"app_calculator_equals": "WYNIK",
"app_calculator_error": "B\u0142\u0105d",
M => +5 -1
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "Popups.hpp"
@@ 52,6 52,10 @@ namespace gui::popup
return gui::popup::window::reboot_window;
case ID::BedtimeNotification:
return gui::popup::window::bedtime_notification_window;
case ID::ChargingNotification:
return gui::popup::window::charging_notification_window;
case ID::ChargingDoneNotification:
return gui::popup::window::charging_done_notification_window;
case ID::AppTestPopup:
return gui::popup::window::test_popup;
case ID::Invalid:
M => +4 -0
@@ 32,6 32,8 @@ namespace gui
PowerOff,
Reboot,
BedtimeNotification,
ChargingNotification,
ChargingDoneNotification,
AppTestPopup,
Invalid,
};
@@ 61,6 63,8 @@ namespace gui
inline constexpr auto alarm_window = "AlarmPopup";
inline constexpr auto reboot_window = "RebootPopup";
inline constexpr auto bedtime_notification_window = "BedtimeNotificationPopup";
inline constexpr auto charging_notification_window = "ChargingNotificationPopup";
inline constexpr auto charging_done_notification_window = "ChargingDoneNotificationPopup";
inline constexpr auto test_popup = "test_popup";
} // namespace window
M module-services/service-evtmgr/battery/BatteryController.cpp => module-services/service-evtmgr/battery/BatteryController.cpp +32 -2
@@ 10,6 10,7 @@
#include <service-evtmgr/BatteryMessages.hpp>
#include <service-evtmgr/ServiceEventManagerName.hpp>
+#include <service-appmgr/ServiceApplicationManagerName.hpp>
#include <service-desktop/ServiceDesktopName.hpp>
#include <module-utils/EventStore/EventStore.hpp>
#include <log/log.hpp>
@@ 89,6 90,16 @@ namespace
return NewState::Unknown;
}
}
+
+ bool isProperLastState(Store::Battery::State state)
+ {
+ return (state == Store::Battery::State::Discharging) || (state == Store::Battery::State::PluggedNotCharging);
+ }
+
+ bool isProperCurrentState(Store::Battery::State state)
+ {
+ return (state == Store::Battery::State::Charging) || (state == Store::Battery::State::ChargingDone);
+ }
} // namespace
BatteryController::BatteryController(sys::Service *service, xQueueHandle notificationChannel, EventManagerParams params)
@@ 176,8 187,8 @@ void sevm::battery::BatteryController::update()
Store::Battery::modify().state = transformChargingState(charger->getChargingStatus());
Store::Battery::modify().temperature = transformTemperatureState(charger->getTemperatureState());
- const auto currentSoc = Store::Battery::get().level;
- const auto currentState = Store::Battery::get().state;
+ const auto currentSoc = Store::Battery::get().level;
+ const auto currentState = Store::Battery::get().state;
const auto currentTemperature = Store::Battery::get().temperature;
/// Send BatteryStatusChangeMessage only when battery SOC, charger state or temperature has changed
@@ 186,6 197,16 @@ void sevm::battery::BatteryController::update()
service->bus.sendUnicast(std::move(message), service::name::evt_manager);
}
+ if (isFirstUpdateDone) {
+ sendChargingNotification(lastState, currentState);
+ }
+ else {
+ if (lastState == Store::Battery::State::Discharging) {
+ sendChargingNotification(lastState, currentState);
+ }
+ isFirstUpdateDone = true;
+ }
+
batteryState.check(transformChargingState(Store::Battery::get().state),
static_cast<float>(Store::Battery::get().level));
@@ 224,3 245,12 @@ void sevm::battery::BatteryController::checkChargerPresence()
service->bus.sendUnicast(std::make_shared<sevm::USBPlugEvent>(plugEvent), service::name::service_desktop);
chargerPresence = newChargerPresence;
}
+
+void sevm::battery::BatteryController::sendChargingNotification(const Store::Battery::State &lastState,
+ const Store::Battery::State ¤tState)
+{
+ if (isProperLastState(lastState) && isProperCurrentState(currentState)) {
+ service->bus.sendUnicast(std::make_shared<sevm::BatteryChargingMessage>(transformChargingState(currentState)),
+ service::name::appmgr);
+ }
+}
M module-services/service-evtmgr/battery/BatteryController.hpp => module-services/service-evtmgr/battery/BatteryController.hpp +4 -0
@@ 7,6 7,7 @@
#include "EventManagerParams.hpp"
#include "BatteryBrownoutDetector.hpp"
#include "BatteryState.hpp"
+#include "EventStore.hpp"
#include <queue.hpp>
#include <memory>
@@ 32,6 33,8 @@ namespace sevm::battery
void updateSoc();
void printCurrentState();
void checkChargerPresence();
+ void sendChargingNotification(const Store::Battery::State &lastState,
+ const Store::Battery::State ¤tState);
units::Voltage getVoltage();
sys::Service *service{nullptr};
@@ 39,5 42,6 @@ namespace sevm::battery
BatteryBrownoutDetector brownoutDetector;
BatteryState batteryState;
ChargerPresence chargerPresence{ChargerPresence::Undefined};
+ bool isFirstUpdateDone{false};
};
}; // namespace sevm::battery
M module-services/service-evtmgr/service-evtmgr/BatteryMessages.hpp => module-services/service-evtmgr/service-evtmgr/BatteryMessages.hpp +14 -0
@@ 42,4 42,18 @@ namespace sevm
Event event = Event::CableUnplugged;
};
+
+ class BatteryChargingMessage : public sys::DataMessage
+ {
+ public:
+ explicit BatteryChargingMessage(BatteryState::ChargingState chargingState) : chargingState{chargingState} {};
+
+ [[nodiscard]] BatteryState::ChargingState getChargingState() const
+ {
+ return chargingState;
+ }
+
+ private:
+ BatteryState::ChargingState chargingState{BatteryState::ChargingState::Discharging};
+ };
} // namespace sevm
M products/BellHybrid/CMakeLists.txt => products/BellHybrid/CMakeLists.txt +2 -2
@@ 143,14 143,14 @@ download_asset_release_json(json-common-target
${CMAKE_CURRENT_SOURCE_DIR}/assets/assets_common.json
${SYSROOT_PATH}/system_a/
MuditaOSPublicAssets
- 0.0.17
+ 0.0.18
${MUDITA_CACHE_DIR}
)
download_asset_release_json(json-community-target
${CMAKE_CURRENT_SOURCE_DIR}/assets/assets_community.json
${SYSROOT_PATH}/system_a/
MuditaOSPublicAssets
- 0.0.17
+ 0.0.18
${MUDITA_CACHE_DIR}
)
download_asset_json(json-rt1051-target
M products/BellHybrid/alarms/CMakeLists.txt => products/BellHybrid/alarms/CMakeLists.txt +2 -0
@@ 19,6 19,8 @@ target_sources(alarms
include/popups/AlarmActivatedPopupRequestParams.hpp
include/popups/AlarmDeactivatedPopupRequestParams.hpp
include/popups/BedtimeReminderPopupRequestParams.hpp
+ include/popups/ChargingNotificationPopupRequestParams.hpp
+ include/popups/ChargingDoneNotificationPopupRequestParams.hpp
)
target_include_directories(alarms
A => +16 -0
@@ 0,0 1,16 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <apps-common/popups/data/PopupRequestParams.hpp>
namespace gui
{
class ChargingDoneNotificationPopupRequestParams : public PopupRequestParams
{
public:
ChargingDoneNotificationPopupRequestParams() : PopupRequestParams{gui::popup::ID::ChargingDoneNotification}
{}
};
} // namespace gui
A => +16 -0
@@ 0,0 1,16 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <apps-common/popups/data/PopupRequestParams.hpp>
namespace gui
{
class ChargingNotificationPopupRequestParams : public PopupRequestParams
{
public:
ChargingNotificationPopupRequestParams() : PopupRequestParams{gui::popup::ID::ChargingNotification}
{}
};
} // namespace gui
M products/BellHybrid/apps/Application.cpp => products/BellHybrid/apps/Application.cpp +13 -0
@@ 15,6 15,7 @@
#include <common/windows/BellWelcomeWindow.hpp>
#include <service-appmgr/ServiceApplicationManagerName.hpp>
#include <common/popups/BedtimeNotificationWindow.hpp>
+#include <common/popups/ChargingNotificationWindow.hpp>
#include <apps-common/WindowsPopupFilter.hpp>
namespace app
@@ 101,6 102,18 @@ namespace app
return std::make_unique<gui::BedtimeNotificationWindow>(app);
});
break;
+ case ID::ChargingNotification:
+ windowsFactory.attach(window::charging_notification_window,
+ [](app::ApplicationCommon *app, const std::string &name) {
+ return std::make_unique<gui::ChargingNotificationWindow>(app);
+ });
+ break;
+ case ID::ChargingDoneNotification:
+ windowsFactory.attach(window::charging_done_notification_window,
+ [](app::ApplicationCommon *app, const std::string &name) {
+ return std::make_unique<gui::ChargingDoneNotificationWindow>(app);
+ });
+ break;
default:
break;
}
M products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp => products/BellHybrid/apps/application-bell-alarm/ApplicationBellAlarm.cpp +3 -1
@@ 61,7 61,9 @@ namespace app
gui::popup::ID::AlarmDeactivated,
gui::popup::ID::PowerOff,
gui::popup::ID::Reboot,
- gui::popup::ID::BedtimeNotification});
+ gui::popup::ID::BedtimeNotification,
+ gui::popup::ID::ChargingNotification,
+ gui::popup::ID::ChargingDoneNotification});
}
sys::MessagePointer ApplicationBellAlarm::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp)
M products/BellHybrid/apps/application-bell-bedtime/ApplicationBellBedtime.cpp => products/BellHybrid/apps/application-bell-bedtime/ApplicationBellBedtime.cpp +4 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "ApplicationBellBedtime.hpp"
@@ 48,7 48,9 @@ namespace app
attachPopups({gui::popup::ID::AlarmActivated,
gui::popup::ID::AlarmDeactivated,
gui::popup::ID::PowerOff,
- gui::popup::ID::Reboot});
+ gui::popup::ID::Reboot,
+ gui::popup::ID::ChargingNotification,
+ gui::popup::ID::ChargingDoneNotification});
}
sys::MessagePointer ApplicationBellBedtime::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp)
M products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp => products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp +3 -1
@@ 159,7 159,9 @@ namespace app
gui::popup::ID::AlarmDeactivated,
gui::popup::ID::PowerOff,
gui::popup::ID::Reboot,
- gui::popup::ID::BedtimeNotification});
+ gui::popup::ID::BedtimeNotification,
+ gui::popup::ID::ChargingNotification,
+ gui::popup::ID::ChargingDoneNotification});
}
sys::MessagePointer ApplicationBellMain::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp)
M products/BellHybrid/apps/application-bell-meditation-timer/MeditationTimer.cpp => products/BellHybrid/apps/application-bell-meditation-timer/MeditationTimer.cpp +16 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "MeditationTimer.hpp"
@@ 17,6 17,7 @@
#include "presenter/SettingsPresenter.hpp"
#include "presenter/StatisticsPresenter.hpp"
+#include "apps-common/WindowsPopupFilter.hpp"
#include <common/models/TimeModel.hpp>
#include <common/models/AudioModel.hpp>
@@ 32,6 33,17 @@ namespace app
uint32_t stackDepth)
: Application(std::move(name), std::move(parent), statusIndicators, startInBackground, stackDepth)
{
+ getPopupFilter().addAppDependentFilter([&](const gui::PopupRequestParams ¶ms) {
+ const auto popupId = params.getPopupId();
+ if (popupId == gui::popup::ID::ChargingNotification ||
+ popupId == gui::popup::ID::ChargingDoneNotification) {
+ return gui::window::bell_finished::defaultName != getCurrentWindow()->getName()
+ ? gui::popup::FilterType::Show
+ : gui::popup::FilterType::Remove;
+ }
+ return gui::popup::FilterType::Show;
+ });
+
bus.channels.push_back(sys::BusChannel::ServiceAudioNotifications);
}
@@ 105,7 117,9 @@ namespace app
gui::popup::ID::AlarmDeactivated,
gui::popup::ID::PowerOff,
gui::popup::ID::Reboot,
- gui::popup::ID::BedtimeNotification});
+ gui::popup::ID::BedtimeNotification,
+ gui::popup::ID::ChargingNotification,
+ gui::popup::ID::ChargingDoneNotification});
}
sys::MessagePointer MeditationTimer::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp)
M products/BellHybrid/apps/application-bell-onboarding/ApplicationBellOnBoarding.cpp => products/BellHybrid/apps/application-bell-onboarding/ApplicationBellOnBoarding.cpp +2 -0
@@ 139,6 139,8 @@ namespace app
[](ApplicationCommon *app, const std::string &name) {
return std::make_unique<gui::OnBoardingInstructionPromptWindow>(app, name);
});
+
+ attachPopups({gui::popup::ID::ChargingNotification, gui::popup::ID::ChargingDoneNotification});
}
void ApplicationBellOnBoarding::destroyUserInterface()
M products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp => products/BellHybrid/apps/application-bell-powernap/ApplicationBellPowerNap.cpp +4 -2
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "ApplicationBellPowerNap.hpp"
@@ 73,7 73,9 @@ namespace app
gui::popup::ID::AlarmDeactivated,
gui::popup::ID::PowerOff,
gui::popup::ID::Reboot,
- gui::popup::ID::BedtimeNotification});
+ gui::popup::ID::BedtimeNotification,
+ gui::popup::ID::ChargingNotification,
+ gui::popup::ID::ChargingDoneNotification});
}
sys::MessagePointer ApplicationBellPowerNap::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp)
M products/BellHybrid/apps/application-bell-relaxation/ApplicationBellRelaxation.cpp => products/BellHybrid/apps/application-bell-relaxation/ApplicationBellRelaxation.cpp +3 -1
@@ 125,7 125,9 @@ namespace app
gui::popup::ID::AlarmDeactivated,
gui::popup::ID::PowerOff,
gui::popup::ID::Reboot,
- gui::popup::ID::BedtimeNotification});
+ gui::popup::ID::BedtimeNotification,
+ gui::popup::ID::ChargingNotification,
+ gui::popup::ID::ChargingDoneNotification});
}
sys::MessagePointer ApplicationBellRelaxation::DataReceivedHandler(sys::DataMessage *msgl,
M products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp => products/BellHybrid/apps/application-bell-settings/ApplicationBellSettings.cpp +3 -1
@@ 244,7 244,9 @@ namespace app
gui::popup::ID::AlarmDeactivated,
gui::popup::ID::PowerOff,
gui::popup::ID::Reboot,
- gui::popup::ID::BedtimeNotification});
+ gui::popup::ID::BedtimeNotification,
+ gui::popup::ID::ChargingNotification,
+ gui::popup::ID::ChargingDoneNotification});
}
sys::MessagePointer ApplicationBellSettings::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp)
M products/BellHybrid/apps/common/CMakeLists.txt => products/BellHybrid/apps/common/CMakeLists.txt +2 -0
@@ 37,6 37,7 @@ target_sources(application-bell-common
src/popups/AlarmDeactivatedWindow.cpp
src/popups/BellTurnOffOptionWindow.cpp
src/popups/BellRebootWindow.cpp
+ src/popups/ChargingNotificationWindow.cpp
src/popups/presenter/AlarmActivatedPresenter.cpp
src/widgets/AlarmIcon.cpp
src/widgets/ListItems.cpp
@@ 98,6 99,7 @@ target_sources(application-bell-common
include/common/popups/BedtimeNotificationWindow.hpp
include/common/popups/BellTurnOffOptionWindow.hpp
include/common/popups/BellRebootWindow.hpp
+ include/common/popups/ChargingNotificationWindow.hpp
include/common/widgets/AlarmIcon.hpp
include/common/widgets/BellBattery.hpp
include/common/widgets/BellConnectionStatus.hpp
M => +3 -3
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 18,8 18,8 @@ namespace gui
{
private:
static constexpr auto bedtimeNotificationIcon = "big_bedtime_W_G";
static constexpr auto bedtimeNotificationText = "app_bell_bedtime_notification";
static constexpr auto bedtimeNotificationTimout = std::chrono::seconds{6};
static constexpr auto bedtimeNotificationText = "app_bell_bedtime_notification";
static constexpr auto bedtimeNotificationTimeout = std::chrono::seconds{6};
app::ApplicationCommon *app;
Icon *icon = nullptr;
A => +41 -0
@@ 0,0 1,41 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <apps-common/popups/WindowWithTimer.hpp>
#include <AsyncTask.hpp>
namespace app
{
class ApplicationCommon;
}
namespace gui
{
namespace charging_notification
{} // namespace charging_notification
class Icon;
class ChargingNotificationWindow : public WindowWithTimer, public app::AsyncCallbackReceiver
{
protected:
app::ApplicationCommon *app;
Icon *icon = nullptr;
bool onInput(const InputEvent &inputEvent) override;
void returnToPreviousWindow();
void buildInterface() override;
public:
explicit ChargingNotificationWindow(app::ApplicationCommon *app);
void onBeforeShow(ShowMode mode, SwitchData *data) override;
};
class ChargingDoneNotificationWindow : public ChargingNotificationWindow
{
public:
explicit ChargingDoneNotificationWindow(app::ApplicationCommon *app);
void onBeforeShow(ShowMode mode, SwitchData *data) override;
};
} /* namespace gui */
M => +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include <audio/AudioMessage.hpp>
@@ 14,7 14,7 @@
namespace gui
{
BedtimeNotificationWindow::BedtimeNotificationWindow(app::ApplicationCommon *app)
: WindowWithTimer(app, popup::window::bedtime_notification_window, bedtimeNotificationTimout),
: WindowWithTimer(app, popup::window::bedtime_notification_window, bedtimeNotificationTimeout),
app::AsyncCallbackReceiver{app}, app{app}
{
buildInterface();
A => +98 -0
@@ 0,0 1,98 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include <apps-common/popups/Popups.hpp>
#include <apps-common/popups/data/PopupRequestParams.hpp>
#include <common/popups/ChargingNotificationWindow.hpp>
#include <gui/input/InputEvent.hpp>
#include <gui/widgets/Icon.hpp>
#include <i18n/i18n.hpp>
#include <purefs/filesystem_paths.hpp>
#include <service-appmgr/Controller.hpp>
#include "EventStore.hpp"
namespace
{
constexpr auto chargingIcon = "big_bell_battery_charging_W_G";
constexpr auto chargingText = "app_bell_charging_notification";
constexpr auto chargingDoneText = "app_bell_charging_done_notification";
constexpr auto chargingNotificationTimeout = std::chrono::seconds{5};
} // namespace
namespace gui
{
ChargingNotificationWindow::ChargingNotificationWindow(app::ApplicationCommon *app)
: WindowWithTimer(app, popup::window::charging_notification_window, chargingNotificationTimeout),
app::AsyncCallbackReceiver{app}, app{app}
{
buildInterface();
timerCallback = [this](Item &, sys::Timer &) {
returnToPreviousWindow();
return true;
};
}
void ChargingNotificationWindow::buildInterface()
{
AppWindow::buildInterface();
navBar->setText(nav_bar::Side::Right, utils::translate(style::strings::common::back));
setTitle("");
icon = new Icon(this,
style::window::default_left_margin,
style::window::default_vertical_pos,
style::window::default_body_width,
style::window::default_body_height,
"",
"");
icon->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Top));
icon->image->setMargins(Margins(0, icon::image_top_margin, 0, icon::image_bottom_margin));
icon->text->setFont(style::window::font::verybiglight);
}
void ChargingNotificationWindow::onBeforeShow(ShowMode mode, [[maybe_unused]] SwitchData *data)
{
WindowWithTimer::onBeforeShow(mode, data);
icon->text->setRichText(std::to_string(Store::Battery::get().level) + "% " + utils::translate(chargingText));
icon->image->set(chargingIcon);
icon->resizeItems();
statusBar->setVisible(false);
header->setTitleVisibility(false);
navBar->setActive(nav_bar::Side::Right, false);
}
void ChargingNotificationWindow::returnToPreviousWindow()
{
detachTimerIfExists();
app::manager::Controller::sendAction(
application,
app::manager::actions::AbortPopup,
std::make_unique<gui::PopupRequestParams>(gui::popup::ID::ChargingNotification));
application->returnToPreviousWindow();
}
bool ChargingNotificationWindow::onInput(const InputEvent &inputEvent)
{
if (inputEvent.isShortRelease(KeyCode::KEY_ENTER) || inputEvent.isShortRelease(KeyCode::KEY_RF)) {
returnToPreviousWindow();
return true;
}
return false;
}
ChargingDoneNotificationWindow::ChargingDoneNotificationWindow(app::ApplicationCommon *app)
: ChargingNotificationWindow(app)
{}
void ChargingDoneNotificationWindow::onBeforeShow(ShowMode mode, [[maybe_unused]] SwitchData *data)
{
WindowWithTimer::onBeforeShow(mode, data);
icon->text->setRichText(utils::translate(chargingDoneText));
icon->image->set(chargingIcon);
icon->resizeItems();
statusBar->setVisible(false);
header->setTitleVisibility(false);
navBar->setActive(nav_bar::Side::Right, false);
}
} /* namespace gui */
M products/BellHybrid/assets/assets_common.json => products/BellHybrid/assets/assets_common.json +1 -1
@@ 62,7 62,7 @@
{"name": "release.tgz", "tarfile" :"image/assets/images/bell/shortcuts_step_restart_W_G.vpi", "output": "assets/images/shortcuts_step_restart_W_G.vpi"},
{"name": "release.tgz", "tarfile" :"image/assets/images/bell/shortcuts_step_bedside_lamp_W_G.vpi", "output": "assets/images/shortcuts_step_bedside_lamp_W_G.vpi"},
{"name": "release.tgz", "tarfile" :"image/assets/images/bell/big_information_W_G.vpi", "output": "assets/images/big_information_W_G.vpi"},
-
+ {"name": "release.tgz", "tarfile" :"image/assets/images/bell/big_bell_battery_charging_W_G.vpi", "output": "assets/images/big_bell_battery_charging_W_G.vpi"},
{"name": "release_audio.tgz", "tarfile" :"./image/assets/audio/bell/chimes/Blissful_Dream.mp3", "output": "assets/audio/chimes/Blissful_Dream.mp3"},
{"name": "release_audio.tgz", "tarfile" :"./image/assets/audio/bell/chimes/Gentle_Chime.mp3", "output": "assets/audio/chimes/Gentle_Chime.mp3"},
M products/BellHybrid/services/appmgr/ApplicationManager.cpp => products/BellHybrid/services/appmgr/ApplicationManager.cpp +29 -0
@@ 9,6 9,10 @@
#include <application-bell-onboarding/BellOnBoardingNames.hpp>
#include <service-appmgr/ServiceApplicationManagerName.hpp>
#include <common/windows/BellWelcomeWindow.hpp>
+#include <service-evtmgr/BatteryMessages.hpp>
+#include "service-appmgr/Controller.hpp"
+#include <popups/ChargingNotificationPopupRequestParams.hpp>
+#include <popups/ChargingDoneNotificationPopupRequestParams.hpp>
namespace app::manager
{
@@ 84,6 88,31 @@ namespace app::manager
handleStopIdleTimer(request);
return sys::msgHandled();
});
+
+ connect(typeid(sevm::BatteryChargingMessage), [&](sys::Message *request) -> sys::MessagePointer {
+ auto *msg = dynamic_cast<sevm::BatteryChargingMessage *>(request);
+ if (msg == nullptr) {
+ return sys::msgNotHandled();
+ }
+ switch (msg->getChargingState()) {
+ case BatteryState::ChargingState::Charging:
+ app::manager::Controller::sendAction(this,
+ app::manager::actions::ShowPopup,
+ std::make_unique<gui::ChargingNotificationPopupRequestParams>());
+ break;
+ case BatteryState::ChargingState::ChargingDone:
+ app::manager::Controller::sendAction(
+ this,
+ app::manager::actions::ShowPopup,
+ std::make_unique<gui::ChargingDoneNotificationPopupRequestParams>());
+ break;
+ default:
+ break;
+ }
+
+ return sys::msgHandled();
+ });
+
connect(typeid(AlarmActivated), convertibleToActionHandler);
connect(typeid(AlarmDeactivated), convertibleToActionHandler);
connect(typeid(BedtimeNotification), convertibleToActionHandler);