/
Monitor.h
169 lines (150 loc) · 6.52 KB
/
Monitor.h
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "AddonCallback.h"
#include "AddonString.h"
namespace XBMCAddon
{
namespace xbmc
{
/**
* Monitor class.
*
* Monitor() -- Creates a new Monitor to notify addon about changes.
*/
class Monitor : public AddonCallback
{
String Id;
public:
Monitor();
#ifndef SWIG
inline void OnSettingsChanged() { XBMC_TRACE; invokeCallback(new CallbackFunction<Monitor>(this,&Monitor::onSettingsChanged)); }
inline void OnScreensaverActivated() { XBMC_TRACE; invokeCallback(new CallbackFunction<Monitor>(this,&Monitor::onScreensaverActivated)); }
inline void OnScreensaverDeactivated() { XBMC_TRACE; invokeCallback(new CallbackFunction<Monitor>(this,&Monitor::onScreensaverDeactivated)); }
inline void OnDPMSActivated() { XBMC_TRACE; invokeCallback(new CallbackFunction<Monitor>(this,&Monitor::onDPMSActivated)); }
inline void OnDPMSDeactivated() { XBMC_TRACE; invokeCallback(new CallbackFunction<Monitor>(this,&Monitor::onDPMSDeactivated)); }
inline void OnScanStarted(const String &library)
{
XBMC_TRACE;
invokeCallback(new CallbackFunction<Monitor,const String>(this,&Monitor::onScanStarted,library));
invokeCallback(new CallbackFunction<Monitor,const String>(this,&Monitor::onDatabaseScanStarted,library));
}
inline void OnScanFinished(const String &library)
{
XBMC_TRACE;
invokeCallback(new CallbackFunction<Monitor,const String>(this,&Monitor::onScanFinished,library));
invokeCallback(new CallbackFunction<Monitor,const String>(this,&Monitor::onDatabaseUpdated,library));
}
inline void OnCleanStarted(const String &library) { XBMC_TRACE; invokeCallback(new CallbackFunction<Monitor,const String>(this,&Monitor::onCleanStarted,library)); }
inline void OnCleanFinished(const String &library) { XBMC_TRACE; invokeCallback(new CallbackFunction<Monitor,const String>(this,&Monitor::onCleanFinished,library)); }
inline void OnAbortRequested() { XBMC_TRACE; invokeCallback(new CallbackFunction<Monitor>(this,&Monitor::onAbortRequested)); }
inline void OnNotification(const String &sender, const String &method, const String &data) { XBMC_TRACE; invokeCallback(new CallbackFunction<Monitor,const String,const String,const String>(this,&Monitor::onNotification,sender,method,data)); }
inline const String& GetId() { return Id; }
#endif
/**
* onSettingsChanged() -- onSettingsChanged method.\n
* \n
* Will be called when addon settings are changed\n
*/
virtual void onSettingsChanged() { XBMC_TRACE; }
/**
* onScreensaverActivated() -- onScreensaverActivated method.\n
* \n
* Will be called when screensaver kicks in\n
*/
virtual void onScreensaverActivated() { XBMC_TRACE; }
/**
* onScreensaverDeactivated() -- onScreensaverDeactivated method.\n
* \n
* Will be called when screensaver goes off\n
*/
virtual void onScreensaverDeactivated() { XBMC_TRACE; }
/**
* onDPMSActivated() -- onDPMSActivated method.\n
* \n
* Will be called when energysaving/DPMS gets active\n
*/
virtual void onDPMSActivated() { XBMC_TRACE; }
/**
* onDPMSDeactivated() -- onDPMSDeactivated method.\n
* \n
* Will be called when energysaving/DPMS is turned off\n
*/
virtual void onDPMSDeactivated() { XBMC_TRACE; }
/**
* onScanStarted(library) -- onScanStarted method.\n
*\n
* library : video/music as string\n
*\n
* Will be called when library scan has started and return video or music to indicate which library is being scanned\n
*/
virtual void onScanStarted(const String library) { XBMC_TRACE; }
/**
* onScanFinished(library) -- onScanFinished method.\n
* \n
* library : video/music as string\n
* \n
* Will be called when library scan has ended and return video or music to indicate which library has been scanned\n
*/
virtual void onScanFinished(const String library) { XBMC_TRACE; }
/**
* onDatabaseScanStarted(database) -- Deprecated, use onScanStarted().
*/
virtual void onDatabaseScanStarted(const String database) { XBMC_TRACE; }
/**
* onDatabaseUpdated(database) -- Deprecated, use onScanFinished().
*/
virtual void onDatabaseUpdated(const String database) { XBMC_TRACE; }
/**
* onCleanStarted(library) -- onCleanStarted method.\n
* \n
* library : video/music as string\n
* \n
* Will be called when library clean has started and return video or music to indicate which library is being cleaned\n
*/
virtual void onCleanStarted(const String library) { XBMC_TRACE; }
/**
* onCleanFinished(library) -- onCleanFinished method.\n
* \n
* library : video/music as string\n
* \n
* Will be called when library clean has ended and return video or music to indicate which library has been cleaned\n
*/
virtual void onCleanFinished(const String library) { XBMC_TRACE; }
/**
* onAbortRequested() -- onAbortRequested method.\n
* \n
* Will be called when XBMC requests Abort\n
*/
virtual void onAbortRequested() { XBMC_TRACE; }
/**
* onNotification(sender, method, data) -- onNotification method.\n
*\n
* sender : sender of the notification\n
* method : name of the notification\n
* data : JSON-encoded data of the notification\n
*\n
* Will be called when XBMC receives or sends a notification\n
*/
virtual void onNotification(const String sender, const String method, const String data) { XBMC_TRACE; }
virtual ~Monitor();
};
}
};