Skip to content

Commit 90ac8ff

Browse files
committed
removed a lot of old code, port to GDBus is nearly done
1 parent d2690e5 commit 90ac8ff

21 files changed

+94
-3134
lines changed

README

+24-4
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ Commandline Arguments
6565
(see comments below at section "OSD")
6666
-u, --upstart
6767
enable Upstart started/stopped events
68-
-p, --poll-timeout
69-
timeout in milliseconds for dbus_connection_read_write_dispatch
70-
default: 10ms
71-
lower values may cause higher cpu load but will increase speed of reaction
7268
-n, --network
7369
enable network support (see comments below at section "Network")
70+
--session
71+
connect to the session D-Bus daemon
72+
--no-system
73+
don't connect to the system D-Bus daemon
7474

7575
Interface "channel"
7676
-------------------
@@ -326,6 +326,26 @@ Interface "skin"
326326
- set the current skin
327327
vdr-dbus-send.sh /Skin skin.SetSkin string:'name'
328328

329+
Interface "status"
330+
------------------
331+
Via the status interface the signals from vdr's cStatus class will be emitted
332+
333+
- "ChannelSwitch"
334+
int32 DeviceNumber
335+
int32 ChannelNumber
336+
bool LiveView
337+
338+
- "Recording"
339+
int32 DeviceNumber
340+
string Name
341+
string FileName
342+
bool On
343+
344+
- "Replaying"
345+
string Name
346+
string FileName
347+
bool On
348+
329349
Interface "timer"
330350
-----------------
331351
- list all timers

dbus2vdr.c

+39-36
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class cPluginDbus2vdr : public cPlugin {
4040
// Add any member variables or functions you may need here.
4141
bool enable_osd;
4242
int send_upstart_signals;
43+
bool enable_system;
4344
bool enable_session;
4445
bool enable_network;
4546
bool first_main_thread;
@@ -78,6 +79,7 @@ cPluginDbus2vdr::cPluginDbus2vdr(void)
7879
// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
7980
enable_osd = false;
8081
send_upstart_signals = -1;
82+
enable_system = true;
8183
enable_session = false;
8284
enable_network = false;
8385
first_main_thread = true;
@@ -103,10 +105,10 @@ const char *cPluginDbus2vdr::CommandLineHelp(void)
103105
" creates an OSD provider which will save the OSD as PNG files\n"
104106
" --upstart\n"
105107
" enable Upstart started/stopped events\n"
106-
" --poll-timeout\n"
107-
" timeout in milliseconds for dbus_connection_read_write_dispatch\n"
108108
" --session\n"
109109
" connect to session D-Bus daemon\n"
110+
" --no-system\n"
111+
" don't connect to system D-Bus daemon\n"
110112
" --network\n"
111113
" enable network support for peer2peer communication\n"
112114
" a local dbus-daemon has to be started manually\n"
@@ -121,8 +123,8 @@ bool cPluginDbus2vdr::ProcessArgs(int argc, char *argv[])
121123
{"shutdown-hooks-wrapper", required_argument, 0, 'w'},
122124
{"osd", no_argument, 0, 'o'},
123125
{"upstart", no_argument, 0, 'u'},
124-
{"poll-timeout", required_argument, 0, 'p'},
125126
{"session", no_argument, 0, 's' | 0x100},
127+
{"no-system", no_argument, 0, 's' | 0x200},
126128
{"network", no_argument, 0, 'n'},
127129
{0, 0, 0, 0}
128130
};
@@ -143,14 +145,20 @@ bool cPluginDbus2vdr::ProcessArgs(int argc, char *argv[])
143145
{
144146
if (optarg != NULL) {
145147
isyslog("dbus2vdr: use shutdown-hooks in %s", optarg);
146-
cDBusShutdownActions::SetShutdownHooksDir(optarg);
148+
cDBusShutdown::SetShutdownHooksDir(optarg);
147149
}
148150
break;
149151
}
150152
case 's' | 0x100:
151153
{
152154
enable_session = true;
153-
isyslog("dbus2vdr: enable session support");
155+
isyslog("dbus2vdr: enable session-bus");
156+
break;
157+
}
158+
case 's' | 0x200:
159+
{
160+
enable_system = false;
161+
isyslog("dbus2vdr: disable system-bus support");
154162
break;
155163
}
156164
case 'u':
@@ -163,15 +171,7 @@ bool cPluginDbus2vdr::ProcessArgs(int argc, char *argv[])
163171
{
164172
if (optarg != NULL) {
165173
isyslog("dbus2vdr: use shutdown-hooks-wrapper %s", optarg);
166-
cDBusShutdownActions::SetShutdownHooksWrapper(optarg);
167-
}
168-
break;
169-
}
170-
case 'p':
171-
{
172-
if ((optarg != NULL) && isnumber(optarg)) {
173-
isyslog("dbus2vdr: use poll-timeout %s", optarg);
174-
cDBusMonitor::PollTimeoutMs = strtol(optarg, NULL, 10);
174+
cDBusShutdown::SetShutdownHooksWrapper(optarg);
175175
}
176176
break;
177177
}
@@ -191,7 +191,7 @@ bool cPluginDbus2vdr::Initialize(void)
191191
// Initialize any background activities the plugin shall perform.
192192
if (!dbus_threads_init_default())
193193
esyslog("dbus2vdr: dbus_threads_init_default returns an error - not good!");
194-
cDBusDispatcherShutdown::StartupTime = time(NULL);
194+
cDBusShutdown::StartupTime = time(NULL);
195195
return true;
196196
}
197197

@@ -209,6 +209,23 @@ bool cPluginDbus2vdr::Start(void)
209209
else
210210
busname = cString::sprintf("%s", DBUS_VDR_BUSNAME);
211211
#endif
212+
if (enable_system) {
213+
system_bus = new cDBusConnection(*busname, G_BUS_TYPE_SYSTEM);
214+
system_bus->AddObject(new cDBusChannels);
215+
system_bus->AddObject(new cDBusEpg);
216+
cDBusPlugin::AddAllPlugins(system_bus);
217+
system_bus->AddObject(new cDBusPluginManager);
218+
system_bus->AddObject(new cDBusRecordings);
219+
system_bus->AddObject(new cDBusRemote);
220+
system_bus->AddObject(new cDBusSetup);
221+
system_bus->AddObject(new cDBusShutdown);
222+
system_bus->AddObject(new cDBusSkin);
223+
system_bus->AddObject(new cDBusStatus);
224+
system_bus->AddObject(new cDBusTimers);
225+
system_bus->AddObject(new cDBusVdr);
226+
system_bus->Start();
227+
}
228+
212229
if (enable_session) {
213230
session_bus = new cDBusConnection(*busname, G_BUS_TYPE_SESSION);
214231
session_bus->AddObject(new cDBusChannels);
@@ -226,27 +243,17 @@ bool cPluginDbus2vdr::Start(void)
226243
session_bus->Start();
227244
}
228245

229-
new cDBusDispatcherEpg;
230-
new cDBusDispatcherOsd;
231-
new cDBusDispatcherPlugin;
232-
new cDBusDispatcherRecording;
233-
new cDBusDispatcherRemote;
234-
new cDBusDispatcherSetup;
235-
new cDBusDispatcherShutdown;
236-
new cDBusDispatcherSkin;
237-
new cDBusDispatcherTimer;
238-
new cDBusDispatcherVdr;
239246
if (enable_network) {
240-
new cDBusDispatcherRecordingConst(busNetwork);
241-
new cDBusDispatcherTimerConst(busNetwork);
247+
//network_bus = new cDBusConnection(*busname, address);
248+
//network_bus->AddObject(new cDBusRecordingsConst);
249+
//network_bus->AddObject(new cDBusTimersConst);
250+
//network_bus->Start();
242251
}
243-
cDBusMonitor::StartMonitor(enable_network);
244252

245253
if (enable_osd)
246254
new cDBusOsdProvider();
247255

248-
if (cDBusVdr::SetStatus(cDBusVdr::statusStart))
249-
cDBusDispatcherVdr::SendStatus(cDBusVdr::statusStart);
256+
cDBusVdr::SetStatus(cDBusVdr::statusStart);
250257

251258
return true;
252259
}
@@ -261,12 +268,9 @@ void cPluginDbus2vdr::Stop(void)
261268
cDBusMonitor::SendUpstartSignal("stopped");
262269
}
263270

264-
if (cDBusVdr::SetStatus(cDBusVdr::statusStop))
265-
cDBusDispatcherVdr::SendStatus(cDBusVdr::statusStop);
271+
cDBusVdr::SetStatus(cDBusVdr::statusStop);
266272

267273
cDBusMonitor::StopUpstartSender();
268-
cDBusMonitor::StopMonitor();
269-
cDBusMessageDispatcher::Shutdown();
270274

271275
if (network_bus != NULL) {
272276
delete network_bus;
@@ -294,8 +298,7 @@ void cPluginDbus2vdr::MainThreadHook(void)
294298
if (first_main_thread) {
295299
first_main_thread = false;
296300

297-
if (cDBusVdr::SetStatus(cDBusVdr::statusReady))
298-
cDBusDispatcherVdr::SendStatus(cDBusVdr::statusReady);
301+
cDBusVdr::SetStatus(cDBusVdr::statusReady);
299302

300303
if (send_upstart_signals == 0) {
301304
send_upstart_signals++;

0 commit comments

Comments
 (0)