~aleteoryx/muditaos

ref: 3c69244f4db9f310c328687052326659aad29146 muditaos/module-apps/application-phonebook/ApplicationPhonebook.hpp -rw-r--r-- 2.6 KiB
3c69244f — Przemyslaw Brudny [EGD-6773] Added light BarGraph type and updated UpdateProgress 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// 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 <string>

namespace gui::window::name
{
    inline constexpr auto contact                = "Contact";
    inline constexpr auto contact_options        = "Options";
    inline constexpr auto namecard_options       = "Namecard Options";
    inline constexpr auto new_contact            = "New";
    inline constexpr auto search                 = "Search";
    inline constexpr auto search_results         = "SearchResults";
    inline constexpr auto dialog_yes_no          = "DialogYesNo";
    inline constexpr auto dialog                 = "Dialog";
    inline constexpr auto dialog_yes_no_icon_txt = "DialogYesNoIconTxt";
    inline constexpr auto ice_contacts           = "IceContacts";

} // namespace gui::window::name

namespace app
{
    inline constexpr auto name_phonebook         = "ApplicationPhonebook";
    constexpr std::uint16_t phonebook_stack_size = 4096;

    class ApplicationPhonebook : public app::Application
    {
      public:
        explicit ApplicationPhonebook(std::string name                    = name_phonebook,
                                      std::string parent                  = {},
                                      sys::phone_modes::PhoneMode mode    = sys::phone_modes::PhoneMode::Connected,
                                      StartInBackground startInBackground = {false});
        ~ApplicationPhonebook() override = default;

        auto DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) -> sys::MessagePointer override;
        auto InitHandler() -> sys::ReturnCodes override;

        auto SwitchPowerModeHandler(const sys::ServicePowerMode mode) -> sys::ReturnCodes final
        {
            return sys::ReturnCodes::Success;
        }

        void createUserInterface() override;
        void destroyUserInterface() override;

        void onSearchRequest(const std::string &searchFilter);
        bool searchEmpty(const std::string &query);
    };

    template <> struct ManifestTraits<ApplicationPhonebook>
    {
        static auto GetManifest() -> manager::ApplicationManifest
        {
            return {{manager::actions::Launch,
                     manager::actions::ShowContacts,
                     manager::actions::AddContact,
                     manager::actions::EditContact,
                     manager::actions::ShowContactDetails,
                     manager::actions::ShowEmergencyContacts,
                     manager::actions::PhoneModeChanged}};
        }
    };
} // namespace app