1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 #ifndef COMMONAPI_DBUS_DBUS_STUB_ADAPTER_H_
5 #define COMMONAPI_DBUS_DBUS_STUB_ADAPTER_H_
7 #include "DBusConnection.h"
9 #include <CommonAPI/Stub.h>
10 #include <CommonAPI/DBus/DBusMessage.h>
18 class DBusStubAdapter: virtual public CommonAPI::StubAdapter {
20 DBusStubAdapter(const std::string& dbusBusName,
21 const std::string& dbusObjectPath,
22 const std::string& interfaceName,
23 const std::shared_ptr<DBusProxyConnection>& dbusConnection);
25 virtual ~DBusStubAdapter();
29 virtual const std::string getAddress() const;
30 virtual const std::string& getDomain() const;
31 virtual const std::string& getServiceId() const;
32 virtual const std::string& getInstanceId() const;
34 inline const std::string& getObjectPath() const;
36 inline const std::shared_ptr<DBusProxyConnection>& getDBusConnection() const;
39 virtual const char* getMethodsDBusIntrospectionXmlData() const = 0;
40 virtual bool onInterfaceDBusMessage(const DBusMessage& dbusMessage) = 0;
43 bool onIntrospectionInterfaceDBusMessage(const DBusMessage& dbusMessage);
45 const std::string dbusBusName_;
46 const std::string dbusObjectPath_;
47 const std::string interfaceName_;
48 const std::shared_ptr<DBusProxyConnection> dbusConnection_;
52 DBusInterfaceHandlerToken dbusIntrospectionInterfaceHandlerToken_;
53 DBusInterfaceHandlerToken dbusInterfaceHandlerToken_;
55 static const std::string domain_;
58 const std::string& DBusStubAdapter::getObjectPath() const {
59 return dbusObjectPath_;
62 const std::shared_ptr<DBusProxyConnection>& DBusStubAdapter::getDBusConnection() const {
63 return dbusConnection_;
67 } // namespace CommonAPI
69 #endif // COMMONAPI_DBUS_DBUS_STUB_ADAPTER_H_