dbus-cxx logo
connection.h
Go to the documentation of this file.
1 
2 // -*- c++ -*-
3 /* Do not edit! -- generated file */
4 
5 /***************************************************************************
6  * Copyright (C) 2009,2010 by Rick L. Vinyard, Jr. *
7  * rvinyard@cs.nmsu.edu *
8  * *
9  * This file is part of the dbus-cxx library. *
10  * *
11  * The dbus-cxx library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public License *
13  * version 3 as published by the Free Software Foundation. *
14  * *
15  * The dbus-cxx library is distributed in the hope that it will be *
16  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
17  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
18  * General Public License for more details. *
19  * *
20  * You should have received a copy of the GNU General Public License *
21  * along with this software. If not see <http://www.gnu.org/licenses/>. *
22  ***************************************************************************/
23 #include <list>
24 #include <deque>
25 
26 #include <dbus-cxx/pointer.h>
27 #include <dbus-cxx/message.h>
28 #include <dbus-cxx/returnmessage.h>
29 #include <dbus-cxx/pendingcall.h>
30 #include <dbus-cxx/watch.h>
31 #include <dbus-cxx/timeout.h>
32 #include <dbus-cxx/accumulators.h>
33 #include <dbus-cxx/object.h>
34 #include <dbus-cxx/objectproxy.h>
35 #include <dbus-cxx/signal_proxy.h>
36 #include <dbus-cxx/dbus_signal.h>
37 #include <dbus-cxx/messagefilter.h>
38 #include <dbus-cxx/method.h>
39 
40 #include <iostream>
41 
42 #ifndef DBUSCXX_CONNECTION_H
43 #define DBUSCXX_CONNECTION_H
44 
45 namespace DBus
46 {
47 
48  class Object;
49  class signal_base;
50  class PendingCall;
51 
61  class Connection
62  {
63 
64  protected:
65 
66  // TODO dbus_connection_open
67 
68  Connection( DBusConnection* cobj = NULL, bool is_private=false );
69 
75  Connection( BusType type, bool is_private=false );
76 
77  Connection( const Connection& other );
78 
79  public:
80 
81  typedef DBusCxxPointer<Connection> pointer;
82 
83  typedef DBusCxxWeakPointer<Connection> weak_pointer;
84 
85  // TODO dbus_connection_open
86 
87  static pointer create( DBusConnection* cobj = NULL, bool is_private=false );
88 
94  static pointer create( BusType type, bool is_private=false );
95 
96  static pointer create( const Connection& other );
97 
98  virtual ~Connection();
99 
101  operator bool() const;
102 
104  bool is_valid() const;
105 
107  bool is_private() const;
108 
110  bool bus_register();
111 
113  bool is_registered() const;
114 
116  const char* unique_name() const;
117 
118  // TODO set_unique_name()
119 
124  unsigned long unix_user( const std::string& name ) const;
125 
127  const char* bus_id() const;
128 
129  int request_name( const std::string& name, unsigned int flags = 0 );
130 
131  int release_name( const std::string& name );
132 
133  bool name_has_owner( const std::string& name ) const;
134 
135  StartReply start_service( const std::string& name, uint32_t flags ) const;
136 
137  bool add_match( const std::string& rule );
138 
139  void add_match_nonblocking( const std::string& rule );
140 
141  bool remove_match( const std::string& rule );
142 
143  void remove_match_nonblocking( const std::string& rule );
144 
145  // TODO dbus_connection_close
146 
147  bool is_connected() const;
148 
149  bool is_authenticated() const;
150 
151  bool is_anonymous() const;
152 
153  const char* server_id() const;
154 
155  // TODO dbus_connection_preallocate_send
156  // TODO dbus_connection_free_preallocated_send
157  // TODO dbus_connection_send_preallocated
158 
159  uint32_t send( const Message::const_pointer );
160 
165 
166  PendingCall::pointer send_with_reply_async( Message::const_pointer message, int timeout_milliseconds=-1 ) const;
167 
168  ReturnMessage::const_pointer send_with_reply_blocking( Message::const_pointer msg, int timeout_milliseconds=-1 ) const;
169 
170  void flush();
171 
172  bool read_write_dispatch( int timeout_milliseconds=-1 );
173 
174  bool read_write( int timeout_milliseconds=-1 );
175 
177 
178  void return_message( Message::pointer message );
179 
181 
183 
185 
187 
188  int unix_fd() const;
189 
190  int socket() const;
191 
192  unsigned long unix_user() const;
193 
194  unsigned long unix_process_id() const;
195 
196  // TODO dbus_connection_get_adt_audit_session_data
197 
198  // TODO dbus_connection_set_unix_user_function
199 
200  // TODO dbus_connection_get_windows_user
201 
202  // TODO dbus_connection_set_windows_user_function
203 
204  void set_allow_anonymous( bool allow=true );
205 
206  void set_route_peer_messages( bool route=true );
207 
208  // TODO dbus_connection_try_register_object_path
209  // TODO dbus_connection_register_object_path
210  // TODO dbus_connection_try_register_fallback
211  // TODO dbus_connection_register_fallback
212  // TODO dbus_connection_unregister_object_path
213  // TODO dbus_connection_get_object_path_data
214  // TODO dbus_connection_list_registered
215 
216  void set_max_message_size( long size );
217 
218  long max_message_size();
219 
220  void set_max_received_size( long size );
221 
222  long max_received_size();
223 
224  long outgoing_size();
225 
226  bool has_messages_to_send();
227 
228  typedef sigc::signal1<bool,Watch::pointer,InterruptablePredicateAccumulatorDefaultFalse> AddWatchSignal;
229 
231  AddWatchSignal& signal_add_watch();
232 
233  sigc::signal<bool,Watch::pointer>& signal_remove_watch();
234 
235  sigc::signal<void,Watch::pointer>& signal_watch_toggled();
236 
237  typedef sigc::signal1<bool,Timeout::pointer,InterruptablePredicateAccumulatorDefaultFalse> AddTimeoutSignal;
238 
240  AddTimeoutSignal& signal_add_timeout();
241 
242  sigc::signal<bool,Timeout::pointer>& signal_remove_timeout();
243 
244  sigc::signal<bool,Timeout::pointer>& signal_timeout_toggled();
245 
246  sigc::signal<void>& signal_wakeup_main();
247 
249  sigc::signal<void,DispatchStatus>& signal_dispatch_status_changed();
250 
256 
257  typedef std::deque<Watch::pointer> Watches;
258 
259  const Watches& unhandled_watches() const;
260 
262 
263  Object::pointer create_object( const std::string& path, PrimaryFallback pf=PRIMARY );
264 
265  bool register_object( Object::pointer object );
266 
267  ObjectPathHandler::pointer create_object( const std::string& path, sigc::slot<HandlerResult,Connection::pointer,Message::const_pointer>& slot, PrimaryFallback pf=PRIMARY );
268 
269  ObjectPathHandler::pointer create_object( const std::string& path, HandlerResult (*MessageFunction)(Connection::pointer,Message::const_pointer), PrimaryFallback pf=PRIMARY );
270 
271  ObjectProxy::pointer create_object_proxy( const std::string& path );
272 
273  ObjectProxy::pointer create_object_proxy( const std::string& destination, const std::string& path );
274 
275  bool unregister_object( const std::string& path );
276 
282  signal_proxy_simple::pointer create_signal_proxy( const std::string& interface, const std::string& name );
283 
289  signal_proxy_simple::pointer create_signal_proxy( const std::string& path, const std::string& interface, const std::string& name );
290 
291  template <class T_return>
292  DBusCxxPointer<signal_proxy<T_return> > create_signal_proxy( const std::string& interface, const std::string& name )
293  {
294  DBusCxxPointer<signal_proxy<T_return> > sig;
295  sig = signal_proxy<T_return>::create(interface, name);
296  this->add_signal_proxy( sig );
297  return sig;
298  }
299 
300  template <class T_return, class T_arg1>
301  DBusCxxPointer<signal_proxy<T_return, T_arg1> > create_signal_proxy( const std::string& interface, const std::string& name )
302  {
303  DBusCxxPointer<signal_proxy<T_return, T_arg1> > sig;
304  sig = signal_proxy<T_return, T_arg1>::create(interface, name);
305  this->add_signal_proxy( sig );
306  return sig;
307  }
308 
309  template <class T_return, class T_arg1,class T_arg2>
310  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2> > create_signal_proxy( const std::string& interface, const std::string& name )
311  {
312  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2> > sig;
313  sig = signal_proxy<T_return, T_arg1,T_arg2>::create(interface, name);
314  this->add_signal_proxy( sig );
315  return sig;
316  }
317 
318  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
319  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3> > create_signal_proxy( const std::string& interface, const std::string& name )
320  {
321  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3> > sig;
323  this->add_signal_proxy( sig );
324  return sig;
325  }
326 
327  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
328  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > create_signal_proxy( const std::string& interface, const std::string& name )
329  {
330  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > sig;
332  this->add_signal_proxy( sig );
333  return sig;
334  }
335 
336  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
337  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > create_signal_proxy( const std::string& interface, const std::string& name )
338  {
339  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > sig;
341  this->add_signal_proxy( sig );
342  return sig;
343  }
344 
345  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
346  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > create_signal_proxy( const std::string& interface, const std::string& name )
347  {
348  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > sig;
350  this->add_signal_proxy( sig );
351  return sig;
352  }
353 
354  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6,class T_arg7>
355  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > create_signal_proxy( const std::string& interface, const std::string& name )
356  {
357  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > sig;
359  this->add_signal_proxy( sig );
360  return sig;
361  }
362 
363 
364 
365  template <class T_return>
366  DBusCxxPointer<signal_proxy<T_return> > create_signal_proxy( const std::string& path, const std::string& interface, const std::string& name )
367  {
368  DBusCxxPointer<signal_proxy<T_return> > sig;
369  sig = signal_proxy<T_return>::create(path, interface, name);
370  this->add_signal_proxy( sig );
371  return sig;
372  }
373 
374  template <class T_return, class T_arg1>
375  DBusCxxPointer<signal_proxy<T_return, T_arg1> > create_signal_proxy( const std::string& path, const std::string& interface, const std::string& name )
376  {
377  DBusCxxPointer<signal_proxy<T_return, T_arg1> > sig;
378  sig = signal_proxy<T_return, T_arg1>::create(path, interface, name);
379  this->add_signal_proxy( sig );
380  return sig;
381  }
382 
383  template <class T_return, class T_arg1,class T_arg2>
384  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2> > create_signal_proxy( const std::string& path, const std::string& interface, const std::string& name )
385  {
386  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2> > sig;
387  sig = signal_proxy<T_return, T_arg1,T_arg2>::create(path, interface, name);
388  this->add_signal_proxy( sig );
389  return sig;
390  }
391 
392  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
393  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3> > create_signal_proxy( const std::string& path, const std::string& interface, const std::string& name )
394  {
395  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3> > sig;
396  sig = signal_proxy<T_return, T_arg1,T_arg2,T_arg3>::create(path, interface, name);
397  this->add_signal_proxy( sig );
398  return sig;
399  }
400 
401  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
402  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > create_signal_proxy( const std::string& path, const std::string& interface, const std::string& name )
403  {
404  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > sig;
406  this->add_signal_proxy( sig );
407  return sig;
408  }
409 
410  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
411  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > create_signal_proxy( const std::string& path, const std::string& interface, const std::string& name )
412  {
413  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > sig;
415  this->add_signal_proxy( sig );
416  return sig;
417  }
418 
419  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
420  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > create_signal_proxy( const std::string& path, const std::string& interface, const std::string& name )
421  {
422  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > sig;
424  this->add_signal_proxy( sig );
425  return sig;
426  }
427 
428  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6,class T_arg7>
429  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > create_signal_proxy( const std::string& path, const std::string& interface, const std::string& name )
430  {
431  DBusCxxPointer<signal_proxy<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > sig;
433  this->add_signal_proxy( sig );
434  return sig;
435  }
436 
437 
438 
443 
445 
446  typedef std::list<signal_proxy_base::pointer> ProxySignals;
447 
448  typedef std::map<std::string,ProxySignals> NameToProxySignalMap;
449 
450  typedef std::map<std::string,NameToProxySignalMap> InterfaceToNameProxySignalMap;
451 
453  const InterfaceToNameProxySignalMap& get_signal_proxies();
454 
456  NameToProxySignalMap get_signal_proxies( const std::string& interface );
457 
459  ProxySignals get_signal_proxies( const std::string& interface, const std::string& member );
460 
461  template <class T_return>
462  DBusCxxPointer<signal<T_return> > create_signal( const std::string& interface, const std::string& name )
463  {
464  DBusCxxPointer<signal<T_return> > sig;
465  sig = signal<T_return>::create(interface, name);
466  sig->set_connection(this->self());
467  return sig;
468  }
469 
470  template <class T_return, class T_arg1>
471  DBusCxxPointer<signal<T_return, T_arg1> > create_signal( const std::string& interface, const std::string& name )
472  {
473  DBusCxxPointer<signal<T_return, T_arg1> > sig;
474  sig = signal<T_return, T_arg1>::create(interface, name);
475  sig->set_connection(this->self());
476  return sig;
477  }
478 
479  template <class T_return, class T_arg1,class T_arg2>
480  DBusCxxPointer<signal<T_return, T_arg1,T_arg2> > create_signal( const std::string& interface, const std::string& name )
481  {
482  DBusCxxPointer<signal<T_return, T_arg1,T_arg2> > sig;
483  sig = signal<T_return, T_arg1,T_arg2>::create(interface, name);
484  sig->set_connection(this->self());
485  return sig;
486  }
487 
488  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
489  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3> > create_signal( const std::string& interface, const std::string& name )
490  {
491  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3> > sig;
492  sig = signal<T_return, T_arg1,T_arg2,T_arg3>::create(interface, name);
493  sig->set_connection(this->self());
494  return sig;
495  }
496 
497  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
498  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > create_signal( const std::string& interface, const std::string& name )
499  {
500  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > sig;
502  sig->set_connection(this->self());
503  return sig;
504  }
505 
506  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
507  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > create_signal( const std::string& interface, const std::string& name )
508  {
509  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > sig;
511  sig->set_connection(this->self());
512  return sig;
513  }
514 
515  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
516  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > create_signal( const std::string& interface, const std::string& name )
517  {
518  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > sig;
520  sig->set_connection(this->self());
521  return sig;
522  }
523 
524  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6,class T_arg7>
525  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > create_signal( const std::string& interface, const std::string& name )
526  {
527  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > sig;
529  sig->set_connection(this->self());
530  return sig;
531  }
532 
533 
534 
535  template <class T_return>
536  DBusCxxPointer<signal<T_return> > create_signal( const std::string& path, const std::string& interface, const std::string& name )
537  {
538  DBusCxxPointer<signal<T_return> > sig;
539  sig = signal<T_return>::create(path, interface, name);
540  sig->set_connection(this->self());
541  return sig;
542  }
543 
544  template <class T_return, class T_arg1>
545  DBusCxxPointer<signal<T_return, T_arg1> > create_signal( const std::string& path, const std::string& interface, const std::string& name )
546  {
547  DBusCxxPointer<signal<T_return, T_arg1> > sig;
548  sig = signal<T_return, T_arg1>::create(path, interface, name);
549  sig->set_connection(this->self());
550  return sig;
551  }
552 
553  template <class T_return, class T_arg1,class T_arg2>
554  DBusCxxPointer<signal<T_return, T_arg1,T_arg2> > create_signal( const std::string& path, const std::string& interface, const std::string& name )
555  {
556  DBusCxxPointer<signal<T_return, T_arg1,T_arg2> > sig;
557  sig = signal<T_return, T_arg1,T_arg2>::create(path, interface, name);
558  sig->set_connection(this->self());
559  return sig;
560  }
561 
562  template <class T_return, class T_arg1,class T_arg2,class T_arg3>
563  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3> > create_signal( const std::string& path, const std::string& interface, const std::string& name )
564  {
565  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3> > sig;
566  sig = signal<T_return, T_arg1,T_arg2,T_arg3>::create(path, interface, name);
567  sig->set_connection(this->self());
568  return sig;
569  }
570 
571  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4>
572  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > create_signal( const std::string& path, const std::string& interface, const std::string& name )
573  {
574  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4> > sig;
575  sig = signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4>::create(path, interface, name);
576  sig->set_connection(this->self());
577  return sig;
578  }
579 
580  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5>
581  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > create_signal( const std::string& path, const std::string& interface, const std::string& name )
582  {
583  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> > sig;
585  sig->set_connection(this->self());
586  return sig;
587  }
588 
589  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6>
590  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > create_signal( const std::string& path, const std::string& interface, const std::string& name )
591  {
592  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> > sig;
594  sig->set_connection(this->self());
595  return sig;
596  }
597 
598  template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6,class T_arg7>
599  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > create_signal( const std::string& path, const std::string& interface, const std::string& name )
600  {
601  DBusCxxPointer<signal<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> > sig;
603  sig->set_connection(this->self());
604  return sig;
605  }
606 
607 
608 
609  // bool register_object( Object& obj, const std::string & path );
610 //
611 // bool register_signal( signal_base& );
612 
614  pointer self();
615 
630  static pointer self(DBusConnection* c);
631 
632  DBusConnection* cobj();
633 
634  static void set_global_change_sigpipe(bool will_modify_sigpipe=true);
635 
636  std::string introspect( const std::string& destination, const std::string& path );
637 
638  protected:
639  DBusConnection* m_cobj;
640 
642 
643  AddWatchSignal m_add_watch_signal;
644 
645  sigc::signal<bool,Watch::pointer> m_remove_watch_signal;
646 
647  sigc::signal<void,Watch::pointer> m_watch_toggled_signal;
648 
649  AddTimeoutSignal m_add_timeout_signal;
650 
651  sigc::signal<bool,Timeout::pointer> m_remove_timeout_signal;
652 
653  sigc::signal<bool,Timeout::pointer> m_timeout_toggled_signal;
654 
655  sigc::signal<void> m_wakeup_main_signal;
656 
657  sigc::signal<void,DispatchStatus> m_dispatch_status_signal;
658 
660 
662 
663  typedef std::map<DBusTimeout*,Timeout::pointer> Timeouts;
664 
665  Timeouts m_timeouts;
666 
667  friend void init(bool);
668 
669  static dbus_int32_t m_weak_pointer_slot;
670 
671  void initialize( bool is_private );
672 
673  std::map<std::string,ObjectPathHandler::pointer> m_created_objects;
674 
675  InterfaceToNameProxySignalMap m_proxy_signal_interface_map;
676 
677 // std::map<SignalReceiver::pointer, sigc::connection> m_sighandler_iface_conn;
678 
679 // std::map<SignalReceiver::pointer, sigc::connection> m_sighandler_member_conn;
680 
681 // void on_signal_handler_interface_changed(SignalReceiver::pointer handler);
682 
683 // void on_signal_handler_member_changed(SignalReceiver::pointer handler);
684 
685 // typedef std::map<std::string,signal_base> SignalVTable;
686 //
687 // typedef std::map<std::string, SignalVTable> InterfaceVTable;
688 
689  static dbus_bool_t on_add_watch_callback( DBusWatch* cwatch, void* data );
690 
691  static void on_remove_watch_callback( DBusWatch* cwatch, void* data );
692 
693  static void on_watch_toggled_callback( DBusWatch* cwatch, void* data );
694 
695  static dbus_bool_t on_add_timeout_callback( DBusTimeout* ctimeout, void* data );
696 
697  static void on_remove_timeout_callback( DBusTimeout* ctimeout, void* data );
698 
699  static void on_timeout_toggled_callback( DBusTimeout* ctimeout, void* data );
700 
701  static void on_wakeup_main_callback( void* data );
702 
703  static void on_dispatch_status_callback( DBusConnection* connection, DBusDispatchStatus new_status, void* data );
704 
705  static DBusHandlerResult on_filter_callback( DBusConnection* connection, DBusMessage* message, void* data );
706 
707  };
708 
709 }
710 
711 inline
713 {
714  if (not ptr) return ptr;
715  *ptr << msg;
716  return ptr;
717 }
718 
719 inline
721 {
722  if (not ptr) return ptr;
723  *ptr << msg;
724  return ptr;
725 }
726 
727 inline
729 {
730  if (not ptr) return ptr;
731  *ptr << msg;
732  return ptr;
733 }
734 
735 inline
737 {
738  if (not ptr) return ptr;
739  *ptr << msg;
740  return ptr;
741 }
742 
743 inline
745 {
746  if (not ptr) return ptr;
747  *ptr << msg;
748  return ptr;
749 }
750 
751 inline
753 {
754  if (not ptr) return ptr;
755  *ptr << msg;
756  return ptr;
757 }
758 
759 #endif
760 
761 // #include <dbus-cxx/method_impl.h>
const char * unique_name() const
Gets the unique name of the connection as assigned by the message bus.
Definition: connection.cpp:202
static pointer create(const std::string &interface, const std::string &name)
Definition: signal_proxy.h:405
std::string introspect(const std::string &destination, const std::string &path)
Definition: connection.cpp:1000
bool register_object(Object::pointer object)
Definition: connection.cpp:617
Subclass of the numbered sigc::signal templates.
Definition: dbus_signal.h:50
unsigned long unix_process_id() const
Definition: connection.cpp:479
static dbus_bool_t on_add_watch_callback(DBusWatch *cwatch, void *data)
Definition: connection.cpp:850
Object::pointer create_object(const std::string &path, PrimaryFallback pf=PRIMARY)
Definition: connection.cpp:608
long max_received_size()
Definition: connection.cpp:519
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 > > create_signal_proxy(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:411
int release_name(const std::string &name)
Definition: connection.cpp:233
unsigned long unix_user() const
Definition: connection.cpp:469
sigc::signal< void, DispatchStatus > & signal_dispatch_status_changed()
Cannot call dispatch() in a slot connected to this signal.
Definition: connection.cpp:572
int socket() const
Definition: connection.cpp:459
HandlerResult
Definition: enums.h:87
static pointer create(DBusConnection *cobj=NULL, bool is_private=false)
Definition: connection.cpp:77
void set_route_peer_messages(bool route=true)
Definition: connection.cpp:495
std::deque< Watch::pointer > Watches
Definition: connection.h:257
bool is_connected() const
Definition: connection.cpp:310
BusType
Definition: enums.h:26
DBusCxxPointer< const SignalMessage > const_pointer
Definition: signalmessage.h:56
DBusCxxPointer< signal< T_return, T_arg1, T_arg2 > > create_signal(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:554
bool remove_signal_proxy(signal_proxy_base::pointer proxy)
Definition: connection.cpp:695
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3 > > create_signal_proxy(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:393
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > > create_signal(const std::string &interface, const std::string &name)
Definition: connection.h:525
DBusCxxPointer< Message > pointer
Definition: message.h:60
Definition: accumulators.h:24
DBusCxxPointer< signal< T_return, T_arg1 > > create_signal(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:545
StartReply
Definition: enums.h:101
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2 > > create_signal_proxy(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:384
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3 > > create_signal_proxy(const std::string &interface, const std::string &name)
Definition: connection.h:319
sigc::signal< void > & signal_wakeup_main()
Definition: connection.cpp:567
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4 > > create_signal_proxy(const std::string &interface, const std::string &name)
Definition: connection.h:328
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 > > create_signal(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:590
DBusCxxPointer< Connection > pointer
Definition: connection.h:81
Connection point to the DBus.
Definition: connection.h:61
DBusCxxPointer< SignalMessage > pointer
Definition: signalmessage.h:54
bool has_messages_to_send()
Definition: connection.cpp:531
bool bus_register()
Registers this connection with the bus.
Definition: connection.cpp:187
void set_max_message_size(long size)
Definition: connection.cpp:501
DBusConnection * cobj()
Definition: connection.cpp:167
ReturnMessage::const_pointer send_with_reply_blocking(Message::const_pointer msg, int timeout_milliseconds=-1) const
Definition: connection.cpp:359
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4 > > create_signal(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:572
AddWatchSignal & signal_add_watch()
Cannot call watch.handle() in a slot connected to this signal.
Definition: connection.cpp:537
sigc::signal1< bool, Timeout::pointer, InterruptablePredicateAccumulatorDefaultFalse > AddTimeoutSignal
Definition: connection.h:237
std::map< std::string, ObjectPathHandler::pointer > m_created_objects
Definition: connection.h:673
long max_message_size()
Definition: connection.cpp:507
DispatchStatus
Definition: enums.h:80
DBus::Connection::pointer operator<<(DBus::Connection::pointer ptr, DBus::Message::pointer msg)
Definition: connection.h:712
sigc::signal< FilterResult, DBusCxxPointer< Connection >, Message::pointer >::accumulated< FilterAccumulator > FilterSignal
Definition: messagefilter.h:57
void set_max_received_size(long size)
Definition: connection.cpp:513
bool name_has_owner(const std::string &name) const
Definition: connection.cpp:244
sigc::signal< void > m_wakeup_main_signal
Definition: connection.h:655
bool m_private_flag
Definition: connection.h:641
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 > > create_signal_proxy(const std::string &interface, const std::string &name)
Definition: connection.h:337
DBusCxxPointer< signal_proxy< T_return > > create_signal_proxy(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:366
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 > > create_signal(const std::string &interface, const std::string &name)
Definition: connection.h:516
DBusCxxPointer< signal_proxy_base > pointer
Definition: signal_proxy_base.h:78
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4 > > create_signal_proxy(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:402
bool remove_match(const std::string &rule)
Definition: connection.cpp:293
Definition: enums.h:118
static void on_dispatch_status_callback(DBusConnection *connection, DBusDispatchStatus new_status, void *data)
Definition: connection.cpp:943
bool is_anonymous() const
Definition: connection.cpp:322
friend void init(bool)
Initializes the dbus-cxx library.
Definition: utility.cpp:40
Watches m_unhandled_watches
Definition: connection.h:661
void set_allow_anonymous(bool allow=true)
Definition: connection.cpp:489
sigc::signal< bool, Watch::pointer > m_remove_watch_signal
Definition: connection.h:645
PendingCall::pointer send_with_reply_async(Message::const_pointer message, int timeout_milliseconds=-1) const
Definition: connection.cpp:349
bool unregister_object(const std::string &path)
Definition: connection.cpp:657
bool is_registered() const
True if this connection is already registered.
Definition: connection.cpp:197
Timeouts m_timeouts
Definition: connection.h:665
DBusCxxPointer< Watch > pointer
Definition: watch.h:45
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 > > create_signal_proxy(const std::string &interface, const std::string &name)
Definition: connection.h:346
bool is_private() const
True if this is a valid connection and is private; false otherwise.
Definition: connection.cpp:182
static pointer create(const std::string &interface, const std::string &name)
Definition: dbus_signal.h:182
const char * server_id() const
Definition: connection.cpp:328
sigc::signal< bool, Timeout::pointer > m_remove_timeout_signal
Definition: connection.h:651
DBusCxxPointer< PendingCall > pointer
Definition: pendingcall.h:47
long outgoing_size()
Definition: connection.cpp:525
void remove_unhandled_watch(const Watch::pointer w)
Definition: connection.cpp:592
sigc::signal1< bool, Watch::pointer, InterruptablePredicateAccumulatorDefaultFalse > AddWatchSignal
Definition: connection.h:228
AddWatchSignal m_add_watch_signal
Definition: connection.h:643
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3 > > create_signal(const std::string &interface, const std::string &name)
Definition: connection.h:489
AddTimeoutSignal m_add_timeout_signal
Definition: connection.h:649
const InterfaceToNameProxySignalMap & get_signal_proxies()
Gets all the signal handlers.
Definition: connection.cpp:751
DBusCxxPointer< ObjectProxy > pointer
Typedef to smart pointers to ObjectProxy.
Definition: objectproxy.h:194
int request_name(const std::string &name, unsigned int flags=0)
Definition: connection.cpp:222
Message::pointer pop_message()
Definition: connection.cpp:428
void add_match_nonblocking(const std::string &rule)
Definition: connection.cpp:287
sigc::signal< void, Watch::pointer > m_watch_toggled_signal
Definition: connection.h:647
DBusCxxPointer< signal< T_return > > create_signal(const std::string &interface, const std::string &name)
Definition: connection.h:462
int unix_fd() const
Definition: connection.cpp:449
std::list< signal_proxy_base::pointer > ProxySignals
Definition: connection.h:446
void return_message(Message::pointer message)
Definition: connection.cpp:416
bool is_valid() const
True if this is a valid connection; false otherwise.
Definition: connection.cpp:177
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > > create_signal_proxy(const std::string &interface, const std::string &name)
Definition: connection.h:355
sigc::signal< bool, Timeout::pointer > & signal_remove_timeout()
Definition: connection.cpp:557
DBusCxxPointer< signal< T_return, T_arg1, T_arg2 > > create_signal(const std::string &interface, const std::string &name)
Definition: connection.h:480
Connection & operator<<(Message::const_pointer msg)
Sends the message on the connection.
Definition: connection.cpp:343
FilterSignal & signal_filter()
Signal emitted during dispatch.
Definition: connection.cpp:577
static void on_watch_toggled_callback(DBusWatch *cwatch, void *data)
Definition: connection.cpp:866
sigc::signal< bool, Watch::pointer > & signal_remove_watch()
Definition: connection.cpp:542
DBusConnection * m_cobj
Definition: connection.h:639
void initialize(bool is_private)
Definition: connection.cpp:816
ObjectProxy::pointer create_object_proxy(const std::string &path)
Definition: connection.cpp:645
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > > create_signal_proxy(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:429
std::map< DBusTimeout *, Timeout::pointer > Timeouts
Definition: connection.h:663
bool add_match(const std::string &rule)
Definition: connection.cpp:276
FilterSignal m_filter_signal
Definition: connection.h:659
static dbus_bool_t on_add_timeout_callback(DBusTimeout *ctimeout, void *data)
Definition: connection.cpp:872
AddTimeoutSignal & signal_add_timeout()
Cannot call timeout.handle() in a slot connected to this signal.
Definition: connection.cpp:552
const Watches & unhandled_watches() const
Definition: connection.cpp:587
static void set_global_change_sigpipe(bool will_modify_sigpipe=true)
Definition: connection.cpp:582
DBusCxxWeakPointer< Connection > weak_pointer
Definition: connection.h:83
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6 > > create_signal_proxy(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:420
InterfaceToNameProxySignalMap m_proxy_signal_interface_map
Definition: connection.h:675
DBusCxxPointer< ReturnMessage > pointer
Definition: returnmessage.h:52
DBusCxxPointer< signal_proxy_base > pointer
Definition: signal_proxy_base.h:39
std::map< std::string, ProxySignals > NameToProxySignalMap
Definition: connection.h:448
void flush()
Definition: connection.cpp:392
bool read_write_dispatch(int timeout_milliseconds=-1)
Definition: connection.cpp:398
DBusCxxPointer< signal< T_return, T_arg1 > > create_signal(const std::string &interface, const std::string &name)
Definition: connection.h:471
std::map< std::string, NameToProxySignalMap > InterfaceToNameProxySignalMap
Definition: connection.h:450
bool read_write(int timeout_milliseconds=-1)
Definition: connection.cpp:404
DBusCxxPointer< signal_proxy< T_return, T_arg1 > > create_signal_proxy(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:375
Type type(uint8_t)
Definition: types.h:38
static void on_remove_watch_callback(DBusWatch *cwatch, void *data)
Definition: connection.cpp:860
DBusCxxPointer< Object > pointer
Typedef to smart pointers to Object.
Definition: object.h:113
DBusCxxPointer< signal_proxy< T_return > > create_signal_proxy(const std::string &interface, const std::string &name)
Definition: connection.h:292
static void on_remove_timeout_callback(DBusTimeout *ctimeout, void *data)
Definition: connection.cpp:903
DispatchStatus dispatch()
Definition: connection.cpp:442
sigc::signal< void, Watch::pointer > & signal_watch_toggled()
Definition: connection.cpp:547
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 > > create_signal(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:581
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3 > > create_signal(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:563
bool is_authenticated() const
Definition: connection.cpp:316
DBusCxxPointer< const ReturnMessage > const_pointer
Definition: returnmessage.h:54
static void on_wakeup_main_callback(void *data)
Definition: connection.cpp:937
DBusCxxPointer< signal< T_return > > create_signal(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:536
StartReply start_service(const std::string &name, uint32_t flags) const
Definition: connection.cpp:255
void remove_match_nonblocking(const std::string &rule)
Definition: connection.cpp:304
static DBusHandlerResult on_filter_callback(DBusConnection *connection, DBusMessage *message, void *data)
Definition: connection.cpp:949
uint32_t send(const Message::const_pointer)
Definition: connection.cpp:334
static void on_timeout_toggled_callback(DBusTimeout *ctimeout, void *data)
Definition: connection.cpp:916
virtual ~Connection()
Definition: connection.cpp:128
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > > create_signal(const std::string &path, const std::string &interface, const std::string &name)
Definition: connection.h:599
sigc::signal< bool, Timeout::pointer > & signal_timeout_toggled()
Definition: connection.cpp:562
DBusCxxPointer< const Message > const_pointer
Definition: message.h:62
const char * bus_id() const
The bus' globally unique ID, as described in the D-Bus specification.
Definition: connection.cpp:215
signal_proxy_simple::pointer create_signal_proxy(const std::string &interface, const std::string &name)
Adds a signal with the given interface and name.
Definition: connection.cpp:663
DBusCxxPointer< signal_proxy< T_return, T_arg1 > > create_signal_proxy(const std::string &interface, const std::string &name)
Definition: connection.h:301
signal_proxy_base::pointer add_signal_proxy(signal_proxy_base::pointer signal)
Adds the given signal proxy to the connection.
Definition: connection.cpp:673
sigc::signal< void, DispatchStatus > m_dispatch_status_signal
Definition: connection.h:657
DBusCxxPointer< signal_proxy< T_return, T_arg1, T_arg2 > > create_signal_proxy(const std::string &interface, const std::string &name)
Definition: connection.h:310
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4 > > create_signal(const std::string &interface, const std::string &name)
Definition: connection.h:498
PrimaryFallback
Definition: enums.h:116
sigc::signal< bool, Timeout::pointer > m_timeout_toggled_signal
Definition: connection.h:653
static dbus_int32_t m_weak_pointer_slot
Definition: connection.h:669
void steal_borrowed_message(Message::pointer message)
Definition: connection.cpp:422
DispatchStatus dispatch_status() const
Definition: connection.cpp:436
Message::pointer borrow_message()
Definition: connection.cpp:410
Connection(DBusConnection *cobj=NULL, bool is_private=false)
Definition: connection.cpp:35
DBusCxxPointer< signal< T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5 > > create_signal(const std::string &interface, const std::string &name)
Definition: connection.h:507

Generated on Sun Mar 19 2017 14:54:26 for dbus-cxx by doxygen 1.8.8