@@ -40,6 +40,7 @@ class cPluginDbus2vdr : public cPlugin {
40
40
// Add any member variables or functions you may need here.
41
41
bool enable_osd ;
42
42
int send_upstart_signals ;
43
+ bool enable_system ;
43
44
bool enable_session ;
44
45
bool enable_network ;
45
46
bool first_main_thread ;
@@ -78,6 +79,7 @@ cPluginDbus2vdr::cPluginDbus2vdr(void)
78
79
// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
79
80
enable_osd = false;
80
81
send_upstart_signals = -1 ;
82
+ enable_system = true;
81
83
enable_session = false;
82
84
enable_network = false;
83
85
first_main_thread = true;
@@ -103,10 +105,10 @@ const char *cPluginDbus2vdr::CommandLineHelp(void)
103
105
" creates an OSD provider which will save the OSD as PNG files\n"
104
106
" --upstart\n"
105
107
" enable Upstart started/stopped events\n"
106
- " --poll-timeout\n"
107
- " timeout in milliseconds for dbus_connection_read_write_dispatch\n"
108
108
" --session\n"
109
109
" connect to session D-Bus daemon\n"
110
+ " --no-system\n"
111
+ " don't connect to system D-Bus daemon\n"
110
112
" --network\n"
111
113
" enable network support for peer2peer communication\n"
112
114
" a local dbus-daemon has to be started manually\n"
@@ -121,8 +123,8 @@ bool cPluginDbus2vdr::ProcessArgs(int argc, char *argv[])
121
123
{"shutdown-hooks-wrapper" , required_argument , 0 , 'w' },
122
124
{"osd" , no_argument , 0 , 'o' },
123
125
{"upstart" , no_argument , 0 , 'u' },
124
- {"poll-timeout" , required_argument , 0 , 'p' },
125
126
{"session" , no_argument , 0 , 's' | 0x100 },
127
+ {"no-system" , no_argument , 0 , 's' | 0x200 },
126
128
{"network" , no_argument , 0 , 'n' },
127
129
{0 , 0 , 0 , 0 }
128
130
};
@@ -143,14 +145,20 @@ bool cPluginDbus2vdr::ProcessArgs(int argc, char *argv[])
143
145
{
144
146
if (optarg != NULL ) {
145
147
isyslog ("dbus2vdr: use shutdown-hooks in %s" , optarg );
146
- cDBusShutdownActions ::SetShutdownHooksDir (optarg );
148
+ cDBusShutdown ::SetShutdownHooksDir (optarg );
147
149
}
148
150
break ;
149
151
}
150
152
case 's' | 0x100 :
151
153
{
152
154
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" );
154
162
break ;
155
163
}
156
164
case 'u' :
@@ -163,15 +171,7 @@ bool cPluginDbus2vdr::ProcessArgs(int argc, char *argv[])
163
171
{
164
172
if (optarg != NULL ) {
165
173
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 );
175
175
}
176
176
break ;
177
177
}
@@ -191,7 +191,7 @@ bool cPluginDbus2vdr::Initialize(void)
191
191
// Initialize any background activities the plugin shall perform.
192
192
if (!dbus_threads_init_default ())
193
193
esyslog ("dbus2vdr: dbus_threads_init_default returns an error - not good!" );
194
- cDBusDispatcherShutdown ::StartupTime = time (NULL );
194
+ cDBusShutdown ::StartupTime = time (NULL );
195
195
return true;
196
196
}
197
197
@@ -209,6 +209,23 @@ bool cPluginDbus2vdr::Start(void)
209
209
else
210
210
busname = cString ::sprintf ("%s" , DBUS_VDR_BUSNAME );
211
211
#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
+
212
229
if (enable_session ) {
213
230
session_bus = new cDBusConnection (* busname , G_BUS_TYPE_SESSION );
214
231
session_bus -> AddObject (new cDBusChannels );
@@ -226,27 +243,17 @@ bool cPluginDbus2vdr::Start(void)
226
243
session_bus -> Start ();
227
244
}
228
245
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 ;
239
246
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();
242
251
}
243
- cDBusMonitor ::StartMonitor (enable_network );
244
252
245
253
if (enable_osd )
246
254
new cDBusOsdProvider ();
247
255
248
- if (cDBusVdr ::SetStatus (cDBusVdr ::statusStart ))
249
- cDBusDispatcherVdr ::SendStatus (cDBusVdr ::statusStart );
256
+ cDBusVdr ::SetStatus (cDBusVdr ::statusStart );
250
257
251
258
return true;
252
259
}
@@ -261,12 +268,9 @@ void cPluginDbus2vdr::Stop(void)
261
268
cDBusMonitor ::SendUpstartSignal ("stopped" );
262
269
}
263
270
264
- if (cDBusVdr ::SetStatus (cDBusVdr ::statusStop ))
265
- cDBusDispatcherVdr ::SendStatus (cDBusVdr ::statusStop );
271
+ cDBusVdr ::SetStatus (cDBusVdr ::statusStop );
266
272
267
273
cDBusMonitor ::StopUpstartSender ();
268
- cDBusMonitor ::StopMonitor ();
269
- cDBusMessageDispatcher ::Shutdown ();
270
274
271
275
if (network_bus != NULL ) {
272
276
delete network_bus ;
@@ -294,8 +298,7 @@ void cPluginDbus2vdr::MainThreadHook(void)
294
298
if (first_main_thread ) {
295
299
first_main_thread = false;
296
300
297
- if (cDBusVdr ::SetStatus (cDBusVdr ::statusReady ))
298
- cDBusDispatcherVdr ::SendStatus (cDBusVdr ::statusReady );
301
+ cDBusVdr ::SetStatus (cDBusVdr ::statusReady );
299
302
300
303
if (send_upstart_signals == 0 ) {
301
304
send_upstart_signals ++ ;
0 commit comments