increased version number to 2.1.5 and regenerated code for test fidl
[profile/ivi/common-api-dbus-runtime.git] / src / test / fake / legacy / service / LegacyInterfaceDBusStubAdapter.cpp
1 /*
2 * This file was generated by the CommonAPI Generators.
3 * Used org.genivi.commonapi.core 2.1.5.qualifier.
4 * Used org.franca.core 0.8.10.201309262002.
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
7 * If a copy of the MPL was not distributed with this file, You can obtain one at
8 * http://mozilla.org/MPL/2.0/.
9 */
10 #include "LegacyInterfaceDBusStubAdapter.h"
11 #include <fake/legacy/service/LegacyInterface.h>
12
13 namespace fake {
14 namespace legacy {
15 namespace service {
16
17 std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createLegacyInterfaceDBusStubAdapter(
18                    const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
19                    const std::string& commonApiAddress,
20                    const std::string& interfaceName,
21                    const std::string& busName,
22                    const std::string& objectPath,
23                    const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection,
24                    const std::shared_ptr<CommonAPI::StubBase>& stubBase) {
25     return std::make_shared<LegacyInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase);
26 }
27
28 __attribute__((constructor)) void registerLegacyInterfaceDBusStubAdapter(void) {
29     CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(LegacyInterface::getInterfaceId(),
30                                                                &createLegacyInterfaceDBusStubAdapter);
31 }
32
33
34
35 LegacyInterfaceDBusStubAdapterInternal::~LegacyInterfaceDBusStubAdapterInternal() {
36     deactivateManagedInstances();
37     LegacyInterfaceDBusStubAdapterHelper::deinit();
38 }
39
40 void LegacyInterfaceDBusStubAdapterInternal::deactivateManagedInstances() {
41 }
42
43 const char* LegacyInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const {
44     static const std::string introspectionData =
45         "<method name=\"getInterfaceVersion\">\n"
46             "<arg name=\"value\" type=\"uu\" direction=\"out\" />"
47         "</method>\n"
48         "<method name=\"TestMethod\">\n"
49             "<arg name=\"input\" type=\"i\" direction=\"in\" />\n"
50             "<arg name=\"val1\" type=\"i\" direction=\"out\" />\n"
51             "<arg name=\"val2\" type=\"i\" direction=\"out\" />\n"
52         "</method>\n"
53         "<method name=\"OtherTestMethod\">\n"
54             "<arg name=\"greeting\" type=\"s\" direction=\"out\" />\n"
55             "<arg name=\"identifier\" type=\"i\" direction=\"out\" />\n"
56         "</method>\n"
57         "<method name=\"finish\">\n"
58         "</method>\n"
59
60     ;
61     return introspectionData.c_str();
62 }
63
64 static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
65         LegacyInterfaceStub,
66         CommonAPI::Version
67         > getLegacyInterfaceInterfaceVersionStubDispatcher(&LegacyInterfaceStub::getInterfaceVersion, "uu");
68
69
70 static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
71     LegacyInterfaceStub,
72     std::tuple<int32_t>,
73     std::tuple<int32_t, int32_t>
74     > testMethodStubDispatcher(&LegacyInterfaceStub::TestMethod, "ii");
75 static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
76     LegacyInterfaceStub,
77     std::tuple<>,
78     std::tuple<std::string, int32_t>
79     > otherTestMethodStubDispatcher(&LegacyInterfaceStub::OtherTestMethod, "si");
80 static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
81     LegacyInterfaceStub,
82     std::tuple<>,
83     std::tuple<>
84     > finishStubDispatcher(&LegacyInterfaceStub::finish, "");
85
86
87
88 const LegacyInterfaceDBusStubAdapterHelper::StubDispatcherTable& LegacyInterfaceDBusStubAdapterInternal::getStubDispatcherTable() {
89     return stubDispatcherTable_;
90 }
91
92
93 LegacyInterfaceDBusStubAdapterInternal::LegacyInterfaceDBusStubAdapterInternal(
94         const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory,
95         const std::string& commonApiAddress,
96         const std::string& dbusInterfaceName,
97         const std::string& dbusBusName,
98         const std::string& dbusObjectPath,
99         const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
100         const std::shared_ptr<CommonAPI::StubBase>& stub):
101         CommonAPI::DBus::DBusStubAdapter(
102                 factory,
103                 commonApiAddress,
104                 dbusInterfaceName,
105                 dbusBusName,
106                 dbusObjectPath,
107                 dbusConnection,
108                 false),
109         LegacyInterfaceDBusStubAdapterHelper(
110             factory,
111             commonApiAddress,
112             dbusInterfaceName,
113             dbusBusName,
114             dbusObjectPath,
115             dbusConnection,
116             std::dynamic_pointer_cast<LegacyInterfaceStub>(stub),
117             false),
118         stubDispatcherTable_({
119             { { "TestMethod", "i" }, &fake::legacy::service::testMethodStubDispatcher },
120             { { "OtherTestMethod", "" }, &fake::legacy::service::otherTestMethodStubDispatcher },
121             { { "finish", "" }, &fake::legacy::service::finishStubDispatcher }
122             }) {
123
124     stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &fake::legacy::service::getLegacyInterfaceInterfaceVersionStubDispatcher });
125 }
126
127 } // namespace service
128 } // namespace legacy
129 } // namespace fake