~aleteoryx/muditaos

ref: 3c2728e5dd474450b564737dfa5d9f7b31af3526 muditaos/module-apps/apps-common/locks/data/PhoneLockMessages.hpp -rw-r--r-- 3.2 KiB
3c2728e5 — Lefucjusz [BH-1695] Fix Harmony crash on startup 2 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// 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 <Service/Message.hpp>

#include <ctime>

namespace locks
{
    class UnlockPhone : public sys::DataMessage
    {};

    class CancelUnlockPhone : public sys::DataMessage
    {};

    class UnlockedPhone : public sys::DataMessage
    {};

    class LockPhone : public sys::DataMessage
    {};

    class LockedPhone : public sys::DataMessage
    {};

    class EnablePhoneLock : public sys::DataMessage
    {};

    class DisablePhoneLock : public sys::DataMessage
    {};

    class ChangePhoneLock : public sys::DataMessage
    {};

    class SetPhoneLock : public sys::DataMessage
    {};

    class SetConfirmedPhoneLock : public sys::DataMessage
    {};

    class SkipSetPhoneLock : public sys::DataMessage
    {};

    class SkippedSetPhoneLock : public sys::DataMessage
    {};

    class UnLockPhoneInput : public sys::DataMessage
    {
      private:
        std::vector<unsigned int> inputData;

      public:
        explicit UnLockPhoneInput(std::vector<unsigned int> inputData) : inputData(std::move(inputData))
        {}

        [[nodiscard]] auto getInputData() const noexcept
        {
            return inputData;
        }
    };

    class PhoneLockTimeUpdate : public sys::DataMessage
    {
      private:
        std::string formattedTime;
        bool isFirstData;

      public:
        explicit PhoneLockTimeUpdate(std::string formattedTime, bool isFirstData = true)
            : formattedTime(std::move(formattedTime)), isFirstData(isFirstData)
        {}

        [[nodiscard]] const auto &getTime() const noexcept
        {
            return formattedTime;
        }

        [[nodiscard]] const auto &getIsFirstData() const noexcept
        {
            return isFirstData;
        }
    };

    class NextPhoneUnlockAttemptLockTime : public sys::DataMessage
    {
      private:
        time_t nextPhoneUnlockAttemptLockTime;

      public:
        explicit NextPhoneUnlockAttemptLockTime(time_t nextPhoneUnlockAttemptLockTime)
            : nextPhoneUnlockAttemptLockTime(nextPhoneUnlockAttemptLockTime)
        {}

        [[nodiscard]] const auto &getTime() const noexcept
        {
            return nextPhoneUnlockAttemptLockTime;
        }
    };

    class ExternalUnLockPhone : public UnLockPhoneInput
    {
      public:
        explicit ExternalUnLockPhone(std::vector<unsigned int> inputData) : UnLockPhoneInput(std::move(inputData))
        {}
    };

    class ExternalPhoneLockAvailabilityChange : public sys::DataMessage
    {
      private:
        bool value = true;

      public:
        explicit ExternalPhoneLockAvailabilityChange(bool value) : value(value)
        {}

        [[nodiscard]] auto getAvailability() const noexcept
        {
            return value;
        }
    };

    class ExternalUnLockPhoneInfo : public sys::DataMessage
    {
      private:
        unsigned int attemptsLeft;

      public:
        explicit ExternalUnLockPhoneInfo(unsigned int attemptsLeft) : attemptsLeft(attemptsLeft)
        {}

        [[nodiscard]] auto getAttemptsLeft() const noexcept
        {
            return attemptsLeft;
        }
    };
} // namespace locks