~aleteoryx/muditaos

ref: 49bbaf51a012cce32d173394038eb981d9f0e278 muditaos/module-services/service-eink/messages/ImageMessage.hpp -rw-r--r-- 2.0 KiB
49bbaf51 — Adam Wulkiewicz [MOS-550] Improve refresh of the display 3 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
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include "EinkMessage.hpp"

#include <hal/eink/AbstractEinkDisplay.hpp>
#include <module-gui/gui/core/Context.hpp>
#include <module-gui/gui/Common.hpp>

#include <cstdint>

namespace service::eink
{
    class ImageMessage : public EinkMessage
    {
      public:
        ImageMessage(int contextId, ::gui::Context *context, ::gui::RefreshModes refreshMode);

        [[nodiscard]] auto getContextId() const noexcept -> int;
        [[nodiscard]] auto getContext() noexcept -> ::gui::Context *;
        [[nodiscard]] auto getRefreshMode() const noexcept -> ::gui::RefreshModes;

      private:
        int contextId;
        ::gui::Context *context;
        ::gui::RefreshModes refreshMode;
    };

    class ShutdownImageMessage : public ImageMessage
    {
      public:
        using ImageMessage::ImageMessage;
    };

    class ImageDisplayedNotification : public EinkMessage
    {
      public:
        explicit ImageDisplayedNotification(int contextId);

        [[nodiscard]] auto getContextId() const noexcept -> int;

      private:
        int contextId;
    };

    class RefreshMessage : public EinkMessage
    {
      public:
        RefreshMessage(int contextId,
                       hal::eink::EinkFrame refreshBox,
                       hal::eink::EinkRefreshMode refreshMode,
                       const std::string &originalSender);

        [[nodiscard]] auto getContextId() const noexcept -> int;
        [[nodiscard]] auto getRefreshFrame() noexcept -> hal::eink::EinkFrame;
        [[nodiscard]] auto getRefreshMode() const noexcept -> hal::eink::EinkRefreshMode;
        [[nodiscard]] auto getOriginalSender() const noexcept -> const std::string &;

      private:
        int contextId;
        hal::eink::EinkFrame refreshFrame;
        hal::eink::EinkRefreshMode refreshMode;
        std::string originalSender;
    };

    class CancelRefreshMessage : public EinkMessage
    {};

} // namespace service::eink