-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathirtc.hpp
More file actions
40 lines (31 loc) · 1.08 KB
/
irtc.hpp
File metadata and controls
40 lines (31 loc) · 1.08 KB
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
#pragma once
#include <linux/rtc.h>
#include <memory>
#include <string_view>
struct IRTC {
enum class Clock { LOCAL, UTC, INVALID };
struct IntegrationInfo {
int port = 0;
int reg = 0;
int bit = 0;
};
virtual rtc_time get_time() const = 0;
virtual void set_wakeup(rtc_time const &time) = 0;
virtual rtc_wkalrm get_wakeup() const = 0;
virtual void clear_wakeup() = 0;
virtual Clock type() const noexcept = 0;
virtual std::string_view name() const noexcept = 0;
virtual bool notify_listener(IntegrationInfo const &info) const noexcept = 0;
virtual bool
unnotify_listener(IntegrationInfo const &info) const noexcept = 0;
static std::unique_ptr<IRTC> get(std::string_view name,
std::string_view adj = {});
static Clock parse_adjfile(std::string_view adj);
virtual ~IRTC() = default;
};
struct MockRTC : IRTC {
virtual void set_time(rtc_time const &time) = 0;
virtual void wakeup_occured() = 0;
static std::unique_ptr<MockRTC> get(std::string_view name,
std::string_view adj = {});
};