blob: a9982d1a56cc9c69ca29309c24d00df0a7d6d4a5 [file] [log] [blame]
Jayanth Othayothed7fb7a2022-09-09 00:07:41 -05001/**
2 * Copyright © 2022 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
18#include "extensions/phal/create_pel.hpp"
19
20#include <fmt/format.h>
21
22#include <sdeventplus/utility/timer.hpp>
23
24#include <chrono>
25
26namespace openpower::phal::clock
27{
28
29/* Dbus event timer */
30using Timer = sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>;
31
32/**
33 * @class Manager - Represents the clock daily management functions
34 *
35 */
36class Manager
37{
38 public:
39 Manager() = delete;
40 Manager(const Manager&) = delete;
41 Manager(Manager&&) = delete;
42 Manager& operator=(const Manager&) = delete;
43 Manager& operator=(Manager&&) = delete;
44 ~Manager() = default;
45
46 /**
47 * Constructor
48 * Starts the functions required to capture clock daily logger data.
49 *
50 * @param[in] event - sdeventplus event loop
51 */
52 Manager(const sdeventplus::Event& event);
53
54 /**
55 * @brief Add a dbus timer
56 */
57 void addTimer();
58
59 /**
60 * @brief Callback when a timer expires
61 */
62 void timerExpired();
63
64 /**
65 * @brief utility function to create clock data log
66 */
67 void createClockDataLog();
68
69 private:
70 /* The sdeventplus even loop to use */
71 sdeventplus::Event _event;
72
73 /** @brief Timer used for LEDs lamp test period */
74 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> timer;
75};
76
77} // namespace openpower::phal::clock