~aleteoryx/muditaos

ref: 20e0437d15787fc7b635490d2c73bf3082feea38 muditaos/module-services/service-cellular/src/NetworkTime.hpp -rw-r--r-- 1.4 KiB
20e0437d — Lefucjusz [MOS-000] Update Pure 1.8.0 changelog 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
// 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 <memory>

namespace at
{
    class Cmd;
    class BaseChannel;
} // namespace at

namespace sys
{
    class Message;
}
namespace cellular::service
{
    class NetworkTime
    {
      public:
        /** Set cmd channel
         * \param channel channel (or nullptr to block communication)
         */
        void setChannel(at::BaseChannel *channel);
        /**
         * Requests settings related to Network Time synchronisation
         */
        std::shared_ptr<sys::Message> createSettingsRequest();
        /**
         * Handles settings related to Network Time synchronisation change
         * @param newValue Automatic Date and Time setting value
         * @param isOfflineModeOn is Offline mode currently enabled
         */
        void processSettings(bool newValue, bool isOfflineModeOn);

      private:
        at::BaseChannel *channel    = nullptr;
        bool isAutomaticDateAndTime = false;
        /**
         * It enables Network Time reporting
         * @param isOfflineModeOn is Offline mode currently enabled
         */
        void enableTimeReporting(bool isOfflineModeOn);
        /**
         * It disables Network Time reporting
         */
        void disableTimeReporting();
    };
} // namespace cellular::service