Files
MuditaOS/module-apps/application-special-input/AppSpecialInput.cpp
2020-04-08 12:23:53 +02:00

36 lines
1.2 KiB
C++

#include "AppSpecialInput.hpp"
#include "messages/AppMessage.hpp"
#include "windows/InputSelector.hpp"
using namespace app;
AppSpecialInput::AppSpecialInput(std::string name, std::string parent, bool startBackgound)
: Application(name, parent, startBackgound)
{
auto window = new gui::UiCharSelector(this);
windows.insert(std::pair<std::string, gui::AppWindow *>(window->getName(), window));
setActiveWindow(window->getName());
}
sys::Message_t AppSpecialInput::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp)
{
auto retMsg = Application::DataReceivedHandler(msgl);
if (reinterpret_cast<sys::ResponseMessage *>(retMsg.get())->retCode == sys::ReturnCodes::Success) {
return retMsg;
}
return std::make_shared<sys::ResponseMessage>(sys::ReturnCodes::Unresolved);
}
// THIS IS IMPORTANT THIS SETS APPLICATION STATE...
// (not for example Application(...) constructor - this would be too easy)
sys::ReturnCodes AppSpecialInput::InitHandler()
{
auto ret = Application::InitHandler();
if (ret != sys::ReturnCodes::Success) {
LOG_ERROR("!");
}
setActiveWindow(gui::name::window::main_window);
return ret;
}