MythTV
master
mythplugins
mythzoneminder
mythzoneminder
zmdefines.h
Go to the documentation of this file.
1
/* ============================================================
2
* This program is free software; you can redistribute it
3
* and/or modify it under the terms of the GNU General
4
* Public License as published bythe Free Software Foundation;
5
* either version 2, or (at your option)
6
* any later version.
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* ============================================================ */
14
15
#ifndef ZMDEFINES_H
16
#define ZMDEFINES_H
17
18
#include <utility>
19
#include <vector>
20
21
// qt
22
#include <QString>
23
#include <QDateTime>
24
#include <QTimeZone>
25
27
class
Event
28
{
29
public
:
30
Event
(
int
eventID
,
31
QString
eventName
,
32
int
monitorID
,
33
QString
monitorName
,
34
const
QDateTime &
startTime
,
35
QString
length
) :
36
m_monitorID
(
monitorID
),
37
m_eventID
(
eventID
),
38
m_eventName
(std::move(
eventName
)),
39
m_monitorName
(std::move(
monitorName
)),
40
m_length
(std::move(
length
)),
41
m_startTime
(
startTime
.toLocalTime())
42
{
43
}
44
45
Event
() =
default
;
46
47
int
monitorID
(
void
)
const
{
return
m_monitorID
; }
48
49
int
eventID
(
void
)
const
{
return
m_eventID
; }
50
51
QString
eventName
(
void
)
const
{
return
m_eventName
; }
52
53
QString
monitorName
(
void
)
const
{
return
m_monitorName
; }
54
55
#if QT_VERSION < QT_VERSION_CHECK(6,5,0)
56
QDateTime
startTime
(Qt::TimeSpec spec)
const
58
{
63
return
(Qt::LocalTime == spec) ?
64
m_startTime
:
m_startTime
.toTimeSpec(spec);
65
}
66
#else
67
QDateTime
startTime
(
const
QTimeZone& zone)
const
69
{
70
return
m_startTime
.toTimeZone(zone);
71
}
72
#endif
73
76
QDateTime
startTime
(
void
)
const
{
return
m_startTime
; }
77
78
QString
length
(
void
)
const
{
return
m_length
; }
79
80
private
:
81
int
m_monitorID
{ -1 };
82
int
m_eventID
{ -1 };
83
QString
m_eventName
;
84
QString
m_monitorName
;
85
QString
m_length
;
89
QDateTime
m_startTime
;
90
};
91
92
enum
State
: std::uint8_t
93
{
94
IDLE
,
95
PREALARM
,
96
ALARM
,
97
ALERT
,
98
TAPE
99
};
100
101
// event frame details
102
struct
Frame
103
{
104
QString
type
;
105
double
delta
{0.0};
106
};
107
108
class
Monitor
109
{
110
public
:
111
Monitor
() =
default
;
112
113
public
:
114
// used by console view
115
int
id
{ 0 };
116
QString
name
;
117
QString
type
;
118
QString
function
;
119
bool
enabled
{
false
};
120
QString
device
;
121
QString
zmcStatus
;
122
QString
zmaStatus
;
123
int
events
{ 0 };
124
// used by live view
125
QString
status
;
126
int
width
{ 0 };
127
int
height
{ 0 };
128
int
bytes_per_pixel
{ 0 };
129
// used by the alarm notiftications
130
bool
showNotifications
{
false
};
131
State
state
{
IDLE
};
132
State
previousState
{
IDLE
};
133
};
134
135
Q_DECLARE_METATYPE
(
Monitor
*)
136
137
#endif
Event::monitorName
QString monitorName(void) const
Definition:
zmdefines.h:53
Event::m_eventID
int m_eventID
Definition:
zmdefines.h:82
Event::m_eventName
QString m_eventName
Definition:
zmdefines.h:83
Monitor::width
int width
Definition:
zmdefines.h:126
Monitor::name
QString name
Definition:
zmdefines.h:116
Monitor::status
QString status
Definition:
zmdefines.h:125
Event::startTime
QDateTime startTime(void) const
Returns time with native Qt::TimeSpec (subject to revision).
Definition:
zmdefines.h:76
Monitor::events
int events
Definition:
zmdefines.h:123
Frame
Definition:
zmdefines.h:102
Monitor::previousState
State previousState
Definition:
zmdefines.h:132
IDLE
@ IDLE
Definition:
zmdefines.h:94
Monitor::zmcStatus
QString zmcStatus
Definition:
zmdefines.h:121
State
State
Definition:
zmserver.h:68
Monitor::enabled
bool enabled
Definition:
zmdefines.h:119
Event::m_monitorName
QString m_monitorName
Definition:
zmdefines.h:84
ALARM
@ ALARM
Definition:
zmdefines.h:96
State
State
Definition:
zmdefines.h:92
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(std::chrono::seconds)
Event
Event details.
Definition:
zmdefines.h:27
Monitor::bytes_per_pixel
int bytes_per_pixel
Definition:
zmdefines.h:128
Monitor::device
QString device
Definition:
zmdefines.h:120
ALERT
@ ALERT
Definition:
zmdefines.h:97
Monitor::showNotifications
bool showNotifications
Definition:
zmdefines.h:130
Event::Event
Event()=default
Frame::delta
double delta
Definition:
zmdefines.h:105
Event::Event
Event(int eventID, QString eventName, int monitorID, QString monitorName, const QDateTime &startTime, QString length)
Definition:
zmdefines.h:30
Event::eventName
QString eventName(void) const
Definition:
zmdefines.h:51
Monitor::zmaStatus
QString zmaStatus
Definition:
zmdefines.h:122
Event::m_monitorID
int m_monitorID
Definition:
zmdefines.h:81
Monitor::state
State state
Definition:
zmdefines.h:131
Frame::type
QString type
Definition:
zmdefines.h:104
Monitor::height
int height
Definition:
zmdefines.h:127
TAPE
@ TAPE
Definition:
zmdefines.h:98
Event::eventID
int eventID(void) const
Definition:
zmdefines.h:49
Monitor::type
QString type
Definition:
zmdefines.h:117
Event::monitorID
int monitorID(void) const
Definition:
zmdefines.h:47
Event::m_startTime
QDateTime m_startTime
The start time is stored in local time interally since all uses are currently using local time and co...
Definition:
zmdefines.h:89
Monitor
Definition:
zmdefines.h:108
PREALARM
@ PREALARM
Definition:
zmdefines.h:95
Event::length
QString length(void) const
Definition:
zmdefines.h:78
Monitor::Monitor
Monitor()=default
Event::m_length
QString m_length
Definition:
zmdefines.h:85
Generated on Thu Feb 6 2025 03:17:08 for MythTV by
1.8.17