forked from flensrocker/vdr-plugin-dbus2vdr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
recording.c
74 lines (60 loc) · 1.86 KB
/
recording.c
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
#include "recording.h"
#include "common.h"
#include "helper.h"
#include <vdr/recording.h>
cDBusMessageRecording::cDBusMessageRecording(cDBusMessageRecording::eAction action, DBusConnection* conn, DBusMessage* msg)
:cDBusMessage(conn, msg)
,_action(action)
{
}
cDBusMessageRecording::~cDBusMessageRecording(void)
{
}
void cDBusMessageRecording::Process(void)
{
switch (_action) {
case dmrUpdate:
Update();
break;
}
}
void cDBusMessageRecording::Update(void)
{
Recordings.Update(false);
cDBusHelper::SendReply(_conn, _msg, 250, "update of recordings triggered");
}
cDBusDispatcherRecording::cDBusDispatcherRecording(void)
:cDBusMessageDispatcher(DBUS_VDR_RECORDING_INTERFACE)
{
}
cDBusDispatcherRecording::~cDBusDispatcherRecording(void)
{
}
cDBusMessage *cDBusDispatcherRecording::CreateMessage(DBusConnection* conn, DBusMessage* msg)
{
if ((conn == NULL) || (msg == NULL))
return NULL;
const char *object = dbus_message_get_path(msg);
if ((object == NULL) || (strcmp(object, "/Recording") != 0))
return NULL;
if (dbus_message_is_method_call(msg, DBUS_VDR_RECORDING_INTERFACE, "Update"))
return new cDBusMessageRecording(cDBusMessageRecording::dmrUpdate, conn, msg);
return NULL;
}
bool cDBusDispatcherRecording::OnIntrospect(DBusMessage *msg, cString &Data)
{
if (strcmp(dbus_message_get_path(msg), "/Recording") != 0)
return false;
Data =
"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n"
" \"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n"
"<node>\n"
" <interface name=\""DBUS_VDR_RECORDING_INTERFACE"\">\n"
" <method name=\"Update\">\n"
" <arg name=\"replycode\" type=\"i\" direction=\"out\"/>\n"
" <arg name=\"message\" type=\"s\" direction=\"out\"/>\n"
" </method>\n"
" </interface>\n"
"</node>\n";
return true;
}