standalonedispatcher.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-or-later OR BSD-3-Clause
2 /***************************************************************************
3  * Copyright (C) 2020 by Robert Middleton *
4  * robert.middleton@rm5248.com *
5  * *
6  * This file is part of the dbus-cxx library. *
7  ***************************************************************************/
8 #ifndef DBUSCXX_STANDALONE_DISPATCHER
9 #define DBUSCXX_STANDALONE_DISPATCHER
10 
11 #include "dispatcher.h"
12 
13 namespace DBus {
14 
15 class Connection;
16 
24 private:
25 
26  StandaloneDispatcher( bool is_running = true );
27 
28 public:
29 
30  static std::shared_ptr<StandaloneDispatcher> create( bool is_running = true );
31 
33 
36  std::shared_ptr<Connection> create_connection( BusType type );
37 
38  std::shared_ptr<Connection> create_connection( std::string address );
39 
40  bool add_connection( std::shared_ptr<Connection> connection );
41 
43 
44  bool start();
45 
46  bool stop();
47 
48  bool is_running();
49 
50 private:
51 
52  void dispatch_thread_main();
53 
54  void wakeup_thread();
55 
59  void dispatch_connections();
60 
61 private:
62  class priv_data;
63 
64  DBUS_CXX_PROPAGATE_CONST( std::unique_ptr<priv_data> ) m_priv;
65 };
66 
67 } /* namespace DBus */
68 
69 #endif /* DBUSCXX_STANDALONE_DISPATCHER */
A Dispatcher handles all of the reading/writing that a Connection needs in order to work correctly.
Definition: dispatcher.h:24
The StandaloneDispatcher creates a new thread that handles all of the reading and writing to the bus.
Definition: standalonedispatcher.h:23
StandaloneDispatcher(bool is_running=true)
Definition: standalonedispatcher.cpp:55
DBUS_CXX_PROPAGATE_CONST(std::unique_ptr< priv_data >) m_priv
void dispatch_thread_main()
Definition: standalonedispatcher.cpp:131
void dispatch_connections()
Dispatch all of our connections.
Definition: standalonedispatcher.cpp:166
void wakeup_thread()
Definition: standalonedispatcher.cpp:192
bool stop()
Definition: standalonedispatcher.cpp:113
bool start()
Definition: standalonedispatcher.cpp:103
bool is_running()
Definition: standalonedispatcher.cpp:127
std::shared_ptr< Connection > create_connection(BusType type)
Definition: standalonedispatcher.cpp:83
~StandaloneDispatcher()
Definition: standalonedispatcher.cpp:70
bool add_connection(std::shared_ptr< Connection > connection)
Definition: standalonedispatcher.cpp:92
static std::shared_ptr< StandaloneDispatcher > create(bool is_running=true)
Definition: standalonedispatcher.cpp:66
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18
BusType
Definition: enums.h:16
DataType type(const uint8_t &)
Definition: types.h:137