1 /* Copyright (C) 2013 BMW Group
2 * Author: Manfred Bathelt (manfred.bathelt@bmw.de)
3 * Author: Juergen Gehring (juergen.gehring@bmw.de)
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef COMMONAPI_DBUS_DBUS_STUB_ADAPTER_H_
8 #define COMMONAPI_DBUS_DBUS_STUB_ADAPTER_H_
10 #include "DBusConnection.h"
12 #include <CommonAPI/Stub.h>
13 #include <CommonAPI/DBus/DBusMessage.h>
21 class DBusStubAdapter: virtual public CommonAPI::StubAdapter {
23 DBusStubAdapter(const std::string& commonApiAddress,
24 const std::string& dbusInterfaceName,
25 const std::string& dbusBusName,
26 const std::string& dbusObjectPath,
27 const std::shared_ptr<DBusProxyConnection>& dbusConnection);
29 virtual ~DBusStubAdapter();
32 virtual void deinit();
34 virtual const std::string getAddress() const;
35 virtual const std::string& getDomain() const;
36 virtual const std::string& getServiceId() const;
37 virtual const std::string& getInstanceId() const;
39 inline const std::string& getObjectPath() const;
40 inline const std::string& getInterfaceName() const;
42 inline const std::shared_ptr<DBusProxyConnection>& getDBusConnection() const;
45 virtual const char* getMethodsDBusIntrospectionXmlData() const = 0;
46 virtual bool onInterfaceDBusMessage(const DBusMessage& dbusMessage) = 0;
49 bool onIntrospectionInterfaceDBusMessage(const DBusMessage& dbusMessage);
51 const std::string commonApiDomain_;
52 const std::string commonApiServiceId_;
53 const std::string commonApiParticipantId_;
55 const std::string dbusBusName_;
56 const std::string dbusObjectPath_;
57 const std::string dbusInterfaceName_;
58 const std::shared_ptr<DBusProxyConnection> dbusConnection_;
62 DBusInterfaceHandlerToken dbusIntrospectionInterfaceHandlerToken_;
63 DBusInterfaceHandlerToken dbusInterfaceHandlerToken_;
65 static const std::string domain_;
68 const std::string& DBusStubAdapter::getObjectPath() const {
69 return dbusObjectPath_;
72 const std::string& DBusStubAdapter::getInterfaceName() const {
73 return dbusInterfaceName_;
76 const std::shared_ptr<DBusProxyConnection>& DBusStubAdapter::getDBusConnection() const {
77 return dbusConnection_;
81 } // namespace CommonAPI
83 #endif // COMMONAPI_DBUS_DBUS_STUB_ADAPTER_H_