mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-05-18 21:54:11 -04:00
PhoneModeObserver doesn't work properly in applications. Applications have to handle the phone mode changes via AppMgr. Phone mode and tethering handlers separated.
47 lines
1.7 KiB
C++
47 lines
1.7 KiB
C++
// 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 "Application.hpp"
|
|
#include "SwitchData.hpp"
|
|
#include <AppWindow.hpp>
|
|
|
|
namespace app
|
|
{
|
|
|
|
inline constexpr auto special_input = "ApplicationSpecialInput";
|
|
inline constexpr auto char_select = gui::name::window::main_window;
|
|
|
|
// app just to provide input selection on UI
|
|
class ApplicationSpecialInput : public app::Application
|
|
{
|
|
public:
|
|
std::string requester = "";
|
|
|
|
ApplicationSpecialInput(std::string name = special_input,
|
|
std::string parent = {},
|
|
sys::phone_modes::PhoneMode mode = sys::phone_modes::PhoneMode::Connected,
|
|
StartInBackground startInBackground = {true});
|
|
virtual ~ApplicationSpecialInput() = default;
|
|
|
|
sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override;
|
|
sys::ReturnCodes InitHandler() override;
|
|
sys::ReturnCodes DeinitHandler() override;
|
|
sys::ReturnCodes SwitchPowerModeHandler(const sys::ServicePowerMode mode) override final
|
|
{
|
|
return sys::ReturnCodes::Success;
|
|
}
|
|
void createUserInterface() override;
|
|
void destroyUserInterface() override;
|
|
};
|
|
|
|
template <> struct ManifestTraits<ApplicationSpecialInput>
|
|
{
|
|
static auto GetManifest() -> manager::ApplicationManifest
|
|
{
|
|
return {{manager::actions::ShowSpecialInput, manager::actions::PhoneModeChanged}};
|
|
}
|
|
};
|
|
}; // namespace app
|