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 #include "TestInterfaceDBusStubAdapter.h"
5 #include "TestInterface.h"
10 std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestInterfaceDBusStubAdapter(std::string busName,
11 std::string objectPath,
12 std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> dbusProxyConnection,
13 std::shared_ptr<CommonAPI::StubBase> stubBase) {
14 return std::make_shared<TestInterfaceDBusStubAdapter>(busName, objectPath, dbusProxyConnection, stubBase);
17 __attribute__((constructor)) void registerTestInterfaceDBusStubAdapter(void) {
18 CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(TestInterface::getInterfaceName(),
19 &createTestInterfaceDBusStubAdapter);
22 TestInterfaceDBusStubAdapter::TestInterfaceDBusStubAdapter(
23 const std::string& dbusBusName,
24 const std::string& dbusObjectPath,
25 const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
26 const std::shared_ptr<CommonAPI::StubBase>& stub):
27 TestInterfaceDBusStubAdapterHelper(dbusBusName, dbusObjectPath, TestInterface::getInterfaceName(), dbusConnection, std::dynamic_pointer_cast<TestInterfaceStub>(stub)) {
30 const char* TestInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() const {
32 "<method name=\"getTestPredefinedTypeAttributeAttribute\">\n"
33 "<arg name=\"value\" type=\"u\" direction=\"out\" />"
35 "<method name=\"setTestPredefinedTypeAttributeAttribute\">\n"
36 "<arg name=\"requestedValue\" type=\"u\" direction=\"in\" />\n"
37 "<arg name=\"setValue\" type=\"u\" direction=\"out\" />\n"
39 "<signal name=\"onTestPredefinedTypeAttributeAttributeChanged\">\n"
40 "<arg name=\"changedValue\" type=\"u\" />\n"
42 "<method name=\"getTestDerivedStructAttributeAttribute\">\n"
43 "<arg name=\"value\" type=\"(sqi)\" direction=\"out\" />"
45 "<method name=\"setTestDerivedStructAttributeAttribute\">\n"
46 "<arg name=\"requestedValue\" type=\"(sqi)\" direction=\"in\" />\n"
47 "<arg name=\"setValue\" type=\"(sqi)\" direction=\"out\" />\n"
49 "<signal name=\"onTestDerivedStructAttributeAttributeChanged\">\n"
50 "<arg name=\"changedValue\" type=\"(sqi)\" />\n"
52 "<method name=\"getTestDerivedArrayAttributeAttribute\">\n"
53 "<arg name=\"value\" type=\"at\" direction=\"out\" />"
55 "<method name=\"setTestDerivedArrayAttributeAttribute\">\n"
56 "<arg name=\"requestedValue\" type=\"at\" direction=\"in\" />\n"
57 "<arg name=\"setValue\" type=\"at\" direction=\"out\" />\n"
59 "<signal name=\"onTestDerivedArrayAttributeAttributeChanged\">\n"
60 "<arg name=\"changedValue\" type=\"at\" />\n"
62 "<signal name=\"TestPredefinedTypeBroadcast\">\n"
63 "<arg name=\"uint32Value\" type=\"u\" />\n"
64 "<arg name=\"stringValue\" type=\"s\" />\n"
66 "<method name=\"testVoidPredefinedTypeMethod\">\n"
67 "<arg name=\"uint32Value\" type=\"u\" direction=\"in\" />\n"
68 "<arg name=\"stringValue\" type=\"s\" direction=\"in\" />\n"
69 "<arg name=\"uint32Value\" type=\"u\" direction=\"out\" />\n"
70 "<arg name=\"stringValue\" type=\"s\" direction=\"out\" />\n"
72 "<method name=\"testPredefinedTypeMethod\">\n"
73 "<arg name=\"uint32InValue\" type=\"u\" direction=\"in\" />\n"
74 "<arg name=\"stringInValue\" type=\"s\" direction=\"in\" />\n"
75 "<arg name=\"uint32InValue\" type=\"u\" direction=\"out\" />\n"
76 "<arg name=\"stringInValue\" type=\"s\" direction=\"out\" />\n"
78 "<method name=\"testVoidDerivedTypeMethod\">\n"
79 "<arg name=\"testEnumExtended2Value\" type=\"i\" direction=\"in\" />\n"
80 "<arg name=\"testMapValue\" type=\"a{ua(sq)}\" direction=\"in\" />\n"
81 "<arg name=\"testEnumExtended2Value\" type=\"i\" direction=\"out\" />\n"
82 "<arg name=\"testMapValue\" type=\"a{ua(sq)}\" direction=\"out\" />\n"
84 "<method name=\"testDerivedTypeMethod\">\n"
85 "<arg name=\"testEnumExtended2InValue\" type=\"i\" direction=\"in\" />\n"
86 "<arg name=\"testMapInValue\" type=\"a{ua(sq)}\" direction=\"in\" />\n"
87 "<arg name=\"testEnumExtended2InValue\" type=\"i\" direction=\"out\" />\n"
88 "<arg name=\"testMapInValue\" type=\"a{ua(sq)}\" direction=\"out\" />\n"
94 static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
97 > getTestPredefinedTypeAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, "u");
98 static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
101 > setTestPredefinedTypeAttributeAttributeStubDispatcher(
102 &TestInterfaceStub::getTestPredefinedTypeAttributeAttribute,
103 &TestInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute,
104 &TestInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged,
105 &TestInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged,
108 static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
110 DerivedTypeCollection::TestStructExtended
111 > getTestDerivedStructAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedStructAttributeAttribute, "(sqi)");
112 static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
114 DerivedTypeCollection::TestStructExtended
115 > setTestDerivedStructAttributeAttributeStubDispatcher(
116 &TestInterfaceStub::getTestDerivedStructAttributeAttribute,
117 &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute,
118 &TestInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged,
119 &TestInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged,
122 static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
124 DerivedTypeCollection::TestArrayUInt64
125 > getTestDerivedArrayAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedArrayAttributeAttribute, "at");
126 static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
128 DerivedTypeCollection::TestArrayUInt64
129 > setTestDerivedArrayAttributeAttributeStubDispatcher(
130 &TestInterfaceStub::getTestDerivedArrayAttributeAttribute,
131 &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute,
132 &TestInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged,
133 &TestInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged,
137 static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
139 std::tuple<uint32_t, std::string>,
141 > testVoidPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidPredefinedTypeMethod, "");
143 static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
145 std::tuple<uint32_t, std::string>,
146 std::tuple<uint32_t, std::string>
147 > testPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testPredefinedTypeMethod, "us");
149 static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
151 std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>,
153 > testVoidDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidDerivedTypeMethod, "");
155 static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
157 std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>,
158 std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>
159 > testDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testDerivedTypeMethod, "ia{ua(sq)}");
163 const TestInterfaceDBusStubAdapterHelper::StubDispatcherTable TestInterfaceDBusStubAdapterHelper::stubDispatcherTable_ = {
164 { { "getTestPredefinedTypeAttributeAttribute", "" }, &commonapi::tests::getTestPredefinedTypeAttributeAttributeStubDispatcher }
165 , { { "setTestPredefinedTypeAttributeAttribute", "u" }, &commonapi::tests::setTestPredefinedTypeAttributeAttributeStubDispatcher },
166 { { "getTestDerivedStructAttributeAttribute", "" }, &commonapi::tests::getTestDerivedStructAttributeAttributeStubDispatcher }
167 , { { "setTestDerivedStructAttributeAttribute", "(sqi)" }, &commonapi::tests::setTestDerivedStructAttributeAttributeStubDispatcher },
168 { { "getTestDerivedArrayAttributeAttribute", "" }, &commonapi::tests::getTestDerivedArrayAttributeAttributeStubDispatcher }
169 , { { "setTestDerivedArrayAttributeAttribute", "at" }, &commonapi::tests::setTestDerivedArrayAttributeAttributeStubDispatcher }
171 { { "testVoidPredefinedTypeMethod", "us" }, &commonapi::tests::testVoidPredefinedTypeMethodStubDispatcher },
172 { { "testPredefinedTypeMethod", "us" }, &commonapi::tests::testPredefinedTypeMethodStubDispatcher },
173 { { "testVoidDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::testVoidDerivedTypeMethodStubDispatcher },
174 { { "testDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::testDerivedTypeMethodStubDispatcher }
177 void TestInterfaceDBusStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value) {
178 CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>>
181 "onTestPredefinedTypeAttributeAttributeChanged",
186 void TestInterfaceDBusStubAdapter::fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& value) {
187 CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestStructExtended>>
190 "onTestDerivedStructAttributeAttributeChanged",
195 void TestInterfaceDBusStubAdapter::fireTestDerivedArrayAttributeAttributeChanged(const DerivedTypeCollection::TestArrayUInt64& value) {
196 CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestArrayUInt64>>
199 "onTestDerivedArrayAttributeAttributeChanged",
205 void TestInterfaceDBusStubAdapter::fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue) {
206 CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>>
209 "TestPredefinedTypeBroadcast",
211 uint32Value, stringValue
216 } // namespace commonapi