DBusBase.h
Go to the documentation of this file.00001 #ifndef CASA_DBUS_BASE_H__
00002 #define CASA_DBUS_BASE_H__
00003
00004 #include <thread>
00005 #if defined(DBUS_CPP)
00006 #include <dbus-cpp/dbus.h>
00007 #else
00008 #include <dbus-c++/dbus.h>
00009 #endif
00010
00011 namespace casa {
00012
00013 class Record;
00014
00015 class DBusThreadedBase
00016 {
00017 public:
00018 DBusThreadedBase();
00019 ~DBusThreadedBase();
00020
00021 void stopService();
00022
00023
00024 static std::map<std::string,DBus::Variant> fromRecord(Record);
00025 static Record toRecord(std::map<std::string,DBus::Variant>);
00026
00027 private:
00028
00029 void serviceLoop();
00030 std::thread *itsThread;
00031 };
00032
00033 class DBusService : public DBus::IntrospectableAdaptor,
00034 public DBus::ObjectAdaptor,
00035 public DBusThreadedBase
00036 {
00037 public:
00038 DBusService(const std::string &bus_name, const std::string &object_path);
00039 ~DBusService();
00040 };
00041
00042 class ServiceProxy : public DBus::IntrospectableProxy,
00043 public DBus::ObjectProxy,
00044 public DBusThreadedBase
00045 {
00046 public:
00047 ServiceProxy(const std::string& serviceName);
00048 ~ServiceProxy();
00049 };
00050
00051 }
00052
00053 #endif