diff --git a/CommonAPI-Examples/CMakeLists.txt b/CommonAPI-Examples/CMakeLists.txt index 76031e2..6fe3493 100644 --- a/CommonAPI-Examples/CMakeLists.txt +++ b/CommonAPI-Examples/CMakeLists.txt @@ -55,8 +55,8 @@ endif() message("CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}") message("COMMONAPI_INCLUDE_DIRS: ${COMMONAPI_INCLUDE_DIRS}") -find_package (CommonAPI-SomeIP 3.1.10 REQUIRED) -find_package (vsomeip 2.5.0 REQUIRED) +find_package (CommonAPI-SomeIP 3.1.11 REQUIRED) +find_package (vsomeip 2.5.3 REQUIRED) include_directories ( ${COMMONAPI_INCLUDE_DIRS} @@ -316,3 +316,86 @@ target_link_libraries ( CommonAPI ${DL_LIBRARY} ) + +# path A +set(PRJ_SRC_GEN_COMMONAPI_PATH_A src-gen/v1/commonapi/examples/A) +set(PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH_A src-gen/v1/commonapi/examples/A) +# path B +set(PRJ_SRC_GEN_COMMONAPI_PATH_B src-gen/v1/commonapi/examples/B) +set(PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH_B src-gen/v1/commonapi/examples/B) +# path C +set(PRJ_SRC_GEN_COMMONAPI_PATH_C src-gen/v2/commonapi/examples/C) +set(PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH_C src-gen/v2/commonapi/examples/C) + +# name A +set(PRJ_NAME_CLIENT_A MergedInterfaceClientA) +set(PRJ_NAME_SERVICE_A MergedInterfaceServiceA) +# name B +set(PRJ_NAME_CLIENT_B MergedInterfaceClientB) +set(PRJ_NAME_SERVICE_B MergedInterfaceServiceB) +# name C +set(PRJ_NAME_CLIENT_C MergedInterfaceClientC) +set(PRJ_NAME_SERVICE_C MergedInterfaceServiceC) + +# Application A +FILE(GLOB PRJ_PROXY_GEN_SRCS_A ${PRJ_SRC_GEN_COMMONAPI_PATH_A}/*Proxy.cpp) +FILE(GLOB PRJ_STUB_GEN_SRCS_A ${PRJ_SRC_GEN_COMMONAPI_PATH_A}/*Stub*.cpp) +FILE(GLOB PRJ_STUB_IMPL_SRCS_A ${PRJ_SRC_COMMONAPI_PATH_A}/*Stub*.cpp) +# Application B +FILE(GLOB PRJ_PROXY_GEN_SRCS_B ${PRJ_SRC_GEN_COMMONAPI_PATH_B}/*Proxy.cpp) +FILE(GLOB PRJ_STUB_GEN_SRCS_B ${PRJ_SRC_GEN_COMMONAPI_PATH_B}/*Stub*.cpp) +FILE(GLOB PRJ_STUB_IMPL_SRCS_B ${PRJ_SRC_COMMONAPI_PATH_B}/*Stub*.cpp) +# Application C +FILE(GLOB PRJ_PROXY_GEN_SRCS_C ${PRJ_SRC_GEN_COMMONAPI_PATH_C}/*Proxy.cpp) +FILE(GLOB PRJ_STUB_GEN_SRCS_C ${PRJ_SRC_GEN_COMMONAPI_PATH_C}/*Stub*.cpp) +FILE(GLOB PRJ_STUB_IMPL_SRCS_C ${PRJ_SRC_COMMONAPI_PATH_C}/*Stub*.cpp) + +# sources A +set(PRJ_CLIENT_SRCS_A src/A/${PRJ_NAME_CLIENT_A}.cpp ${PRJ_PROXY_GEN_SRCS_A}) +set(PRJ_SERVICE_SRCS_A src/A/${PRJ_NAME_SERVICE_A}.cpp src/A/MergedInterfaceStubImplA.cpp ${PRJ_STUB_GEN_SRCS_A} ${PRJ_STUB_IMPL_SRCS_A}) +#sources B +set(PRJ_CLIENT_SRCS_B src/B/${PRJ_NAME_CLIENT_B}.cpp ${PRJ_PROXY_GEN_SRCS_B}) +set(PRJ_SERVICE_SRCS_B src/B/${PRJ_NAME_SERVICE_B}.cpp src/B/MergedInterfaceStubImplB.cpp ${PRJ_STUB_GEN_SRCS_B} ${PRJ_STUB_IMPL_SRCS_B}) +# sources C +set(PRJ_CLIENT_SRCS_C src/C/${PRJ_NAME_CLIENT_C}.cpp ${PRJ_PROXY_GEN_SRCS_C}) +set(PRJ_SERVICE_SRCS_C src/C/${PRJ_NAME_SERVICE_C}.cpp src/C/MergedInterfaceStubImplC.cpp ${PRJ_STUB_GEN_SRCS_C} ${PRJ_STUB_IMPL_SRCS_C}) + +# SOME/IP library A +FILE(GLOB PRJ_SOMEIP_LIB_SRCS_A ${PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH_A}/*cpp) +# SOME/IP library B +FILE(GLOB PRJ_SOMEIP_LIB_SRCS_B ${PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH_B}/*cpp) +# SOME/IP library C +FILE(GLOB PRJ_SOMEIP_LIB_SRCS_C ${PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH_C}/*cpp) + +set(LINK_LIBRARIES -Wl,--as-needed CommonAPI CommonAPI-SomeIP) + +# Build Client A +add_executable(${PRJ_NAME_CLIENT_A} ${PRJ_CLIENT_SRCS_A}) +target_link_libraries(${PRJ_NAME_CLIENT_A} ${LINK_LIBRARIES}) +# Build Client B +add_executable(${PRJ_NAME_CLIENT_B} ${PRJ_CLIENT_SRCS_B}) +target_link_libraries(${PRJ_NAME_CLIENT_B} ${LINK_LIBRARIES}) +# Build Client C +add_executable(${PRJ_NAME_CLIENT_C} ${PRJ_CLIENT_SRCS_C}) +target_link_libraries(${PRJ_NAME_CLIENT_C} ${LINK_LIBRARIES}) + +# Build service A +add_executable(${PRJ_NAME_SERVICE_A} ${PRJ_SERVICE_SRCS_A}) +target_link_libraries(${PRJ_NAME_SERVICE_A} ${LINK_LIBRARIES}) +# Build service B +add_executable(${PRJ_NAME_SERVICE_B} ${PRJ_SERVICE_SRCS_B}) +target_link_libraries(${PRJ_NAME_SERVICE_B} ${LINK_LIBRARIES}) +# Build service C +add_executable(${PRJ_NAME_SERVICE_C} ${PRJ_SERVICE_SRCS_C}) +target_link_libraries(${PRJ_NAME_SERVICE_C} ${LINK_LIBRARIES}) + +# Build SOME/IP library A +add_library (MergedInterface-A-someip SHARED ${PRJ_SOMEIP_LIB_SRCS_A}) +target_link_libraries(MergedInterface-A-someip CommonAPI-SomeIP) +# Build SOME/IP library B +add_library (MergedInterface-B-someip SHARED ${PRJ_SOMEIP_LIB_SRCS_B}) +target_link_libraries(MergedInterface-B-someip CommonAPI-SomeIP) +# Build SOME/IP library C +add_library (MergedInterface-C-someip SHARED ${PRJ_SOMEIP_LIB_SRCS_C}) +target_link_libraries(MergedInterface-C-someip CommonAPI-SomeIP) + diff --git a/CommonAPI-Examples/commonapi-someip-aliases.ini b/CommonAPI-Examples/commonapi-someip-aliases.ini new file mode 100644 index 0000000..1ae7a67 --- /dev/null +++ b/CommonAPI-Examples/commonapi-someip-aliases.ini @@ -0,0 +1,13 @@ +[aliases] +service:0x1234:0x5678:0x01:0x00=0x1236:0x5678:0x02:0x01 +service:0x1235:0x5678:0x01:0x00=0x1236:0x5678:0x02:0x01 +method:0x1234:0x5678:0x01:0x00:0x3E8=0x1236:0x5678:0x02:0x01:0x1388 +method:0x1234:0x5678:0x01:0x00:0x3E9=0x1236:0x5678:0x02:0x01:0x1389 +event:0x1234:0x5678:0x01:0x00:0x2B02=0x1236:0x5678:0x02:0x01:0xD6E2 +eventgroup:0x1234:0x5678:0x01:0x00:0x2B02=0x1236:0x5678:0x02:0x01:0xD6E2 +method:0x1235:0x5678:0x01:0x00:0xBB8=0x1236:0x5678:0x02:0x01:0x2BC +method:0x1235:0x5678:0x01:0x00:0xBB9=0x1236:0x5678:0x02:0x01:0x2BD +event:0x1235:0x5678:0x01:0x00:0x80F2=0x1236:0x5678:0x02:0x01:0x1E1E +eventgroup:0x1235:0x5678:0x01:0x00:0x80F2=0x1236:0x5678:0x02:0x01:0x1E1E + + diff --git a/CommonAPI-Examples/fidl/MergedInterfaceA.fdepl b/CommonAPI-Examples/fidl/MergedInterfaceA.fdepl new file mode 100644 index 0000000..73f29e3 --- /dev/null +++ b/CommonAPI-Examples/fidl/MergedInterfaceA.fdepl @@ -0,0 +1,44 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl" +import "MergedInterfaceA.fidl" + +define org.genivi.commonapi.someip.deployment for interface commonapi.examples.A.MergedInterfaceA { + SomeIpServiceID = 4660 + + attribute x1 { + SomeIpGetterID = 1000 + SomeIpSetterID = 1001 + SomeIpNotifierID = 11010 + SomeIpEventGroups = { 11010 } + + SomeIpGetterReliable = true + SomeIpSetterReliable = true + SomeIpNotifierReliable = true + } + + attribute x2 { + SomeIpGetterID = 2000 + SomeIpSetterID = 2001 + SomeIpNotifierID = 22010 + SomeIpEventGroups = { 22010 } + + SomeIpGetterReliable = true + SomeIpSetterReliable = true + SomeIpNotifierReliable = true + } +} + + +define org.genivi.commonapi.someip.deployment for provider Service { + instance commonapi.examples.A.MergedInterfaceA { + InstanceId = "commonapi.examples.A.MergedInterfaceA" + SomeIpInstanceID = 22136 + SomeIpUnicastAddress = "192.168.0.2" + SomeIpReliableUnicastPort = 30499 + SomeIpUnreliableUnicastPort = 30500 + } +} diff --git a/CommonAPI-Examples/fidl/MergedInterfaceA.fidl b/CommonAPI-Examples/fidl/MergedInterfaceA.fidl new file mode 100644 index 0000000..aaa1a43 --- /dev/null +++ b/CommonAPI-Examples/fidl/MergedInterfaceA.fidl @@ -0,0 +1,14 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package commonapi.examples.A + +interface MergedInterfaceA { + version { major 1 minor 0 } + + attribute Int32 x1 + attribute Int32 x2 +} + diff --git a/CommonAPI-Examples/fidl/MergedInterfaceB.fdepl b/CommonAPI-Examples/fidl/MergedInterfaceB.fdepl new file mode 100644 index 0000000..315cb21 --- /dev/null +++ b/CommonAPI-Examples/fidl/MergedInterfaceB.fdepl @@ -0,0 +1,44 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl" +import "MergedInterfaceB.fidl" + +define org.genivi.commonapi.someip.deployment for interface commonapi.examples.B.MergedInterfaceB { + SomeIpServiceID = 4661 + + attribute x3 { + SomeIpGetterID = 3000 + SomeIpSetterID = 3001 + SomeIpNotifierID = 33010 + SomeIpEventGroups = { 33010 } + + SomeIpGetterReliable = true + SomeIpSetterReliable = true + SomeIpNotifierReliable = true + } + + attribute x4 { + SomeIpGetterID = 4000 + SomeIpSetterID = 4001 + SomeIpNotifierID = 44010 + SomeIpEventGroups = { 44010 } + + SomeIpGetterReliable = true + SomeIpSetterReliable = true + SomeIpNotifierReliable = true + } +} + + +define org.genivi.commonapi.someip.deployment for provider Service { + instance commonapi.examples.B.MergedInterfaceB { + InstanceId = "commonapi.examples.B.MergedInterfaceB" + SomeIpInstanceID = 22136 + SomeIpUnicastAddress = "192.168.0.2" + SomeIpReliableUnicastPort = 30499 + SomeIpUnreliableUnicastPort = 30500 + } +} diff --git a/CommonAPI-Examples/fidl/MergedInterfaceB.fidl b/CommonAPI-Examples/fidl/MergedInterfaceB.fidl new file mode 100644 index 0000000..e042886 --- /dev/null +++ b/CommonAPI-Examples/fidl/MergedInterfaceB.fidl @@ -0,0 +1,14 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package commonapi.examples.B + +interface MergedInterfaceB { + version { major 1 minor 0 } + + attribute Int32 x3 + attribute Int32 x4 +} + diff --git a/CommonAPI-Examples/fidl/MergedInterfaceC.fdepl b/CommonAPI-Examples/fidl/MergedInterfaceC.fdepl new file mode 100644 index 0000000..55dee4f --- /dev/null +++ b/CommonAPI-Examples/fidl/MergedInterfaceC.fdepl @@ -0,0 +1,66 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-SOMEIP_deployment_spec.fdepl" +import "MergedInterfaceC.fidl" + +define org.genivi.commonapi.someip.deployment for interface commonapi.examples.C.MergedInterfaceC { + SomeIpServiceID = 4662 + + attribute x1 { + SomeIpGetterID = 5000 + SomeIpSetterID = 5001 + SomeIpNotifierID = 55010 + SomeIpEventGroups = { 55010 } + + SomeIpGetterReliable = true + SomeIpSetterReliable = true + SomeIpNotifierReliable = true + } + + attribute x2 { + SomeIpGetterID = 600 + SomeIpSetterID = 601 + SomeIpNotifierID = 6610 + SomeIpEventGroups = { 6610 } + + SomeIpGetterReliable = true + SomeIpSetterReliable = true + SomeIpNotifierReliable = true + } + + attribute x3 { + SomeIpGetterID = 700 + SomeIpSetterID = 701 + SomeIpNotifierID = 7710 + SomeIpEventGroups = { 7710 } + + SomeIpGetterReliable = true + SomeIpSetterReliable = true + SomeIpNotifierReliable = true + } + + attribute x4 { + SomeIpGetterID = 800 + SomeIpSetterID = 801 + SomeIpNotifierID = 8810 + SomeIpEventGroups = { 8810 } + + SomeIpGetterReliable = true + SomeIpSetterReliable = true + SomeIpNotifierReliable = true + } +} + + +define org.genivi.commonapi.someip.deployment for provider Service { + instance commonapi.examples.C.MergedInterfaceC { + InstanceId = "commonapi.examples.C.MergedInterfaceC" + SomeIpInstanceID = 22136 + SomeIpUnicastAddress = "192.168.0.2" + SomeIpReliableUnicastPort = 30499 + SomeIpUnreliableUnicastPort = 30500 + } +} diff --git a/CommonAPI-Examples/fidl/MergedInterfaceC.fidl b/CommonAPI-Examples/fidl/MergedInterfaceC.fidl new file mode 100644 index 0000000..ffe3a47 --- /dev/null +++ b/CommonAPI-Examples/fidl/MergedInterfaceC.fidl @@ -0,0 +1,16 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package commonapi.examples.C + +interface MergedInterfaceC { + version { major 2 minor 1 } + + attribute Int32 x1 + attribute Int32 x2 + attribute Int32 x3 + attribute Int32 x4 +} + diff --git a/CommonAPI-Examples/src/A/MergedInterfaceClientA.cpp b/CommonAPI-Examples/src/A/MergedInterfaceClientA.cpp new file mode 100644 index 0000000..eddbf88 --- /dev/null +++ b/CommonAPI-Examples/src/A/MergedInterfaceClientA.cpp @@ -0,0 +1,78 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include + +#ifndef _WIN32 +#include +#endif + +#include +#include +#include + +using namespace v1::commonapi::examples::A; + +void recv_cb(const CommonAPI::CallStatus& callStatus, const int32_t& val) { + std::cout << "Receive callback: " << val << std::endl; +} + +int main() { + CommonAPI::Runtime::setProperty("LogContext", "E02CA"); + CommonAPI::Runtime::setProperty("LogApplication", "E02CA"); + CommonAPI::Runtime::setProperty("LibraryBase", "MergedInterface-A"); + + std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get(); + + std::string domain = "local"; + std::string instance = "commonapi.examples.A.MergedInterfaceA"; + std::string connection = "client-sample"; + + auto myProxy = runtime->buildProxyWithDefaultAttributeExtension(domain, instance, connection); + + std::cout << "Waiting for service to become available." << std::endl; + while (!myProxy->isAvailable()) { + std::this_thread::sleep_for(std::chrono::microseconds(10)); + } + + CommonAPI::CallStatus callStatus; + + int32_t value = 0; + + CommonAPI::CallInfo info(1000); + info.sender_ = 5678; + + // Get actual attribute value from service + std::cout << "Proxy A getting attribute X1 value: " << value << std::endl; + myProxy->getX1Attribute().getValue(callStatus, value, &info); + if (callStatus != CommonAPI::CallStatus::SUCCESS) { + std::cerr << "Remote call A failed!\n"; + return -1; + } + std::cout << "Proxy A got attribute X1 value: " << value << std::endl; + + // Subscribe for receiving values + myProxy->getX1Attribute().getChangedEvent().subscribe([&](const int32_t& val) { + std::cout << "Proxy A received attribute X1 change message: " << val << std::endl; + }); + + value = 100; + + // Asynchronous call to set attribute of service + std::function fcb = recv_cb; + myProxy->getX1Attribute().setValueAsync(value, fcb, &info); + + + while (true) { + int32_t errorValue = -1; + int32_t valueCached = *myProxy->getX1AttributeExtension().getCachedValue(errorValue); + if (valueCached != errorValue) { + std::cout << "Proxy A ot cached attribute X1 value[" << (int)valueCached << "]: " << valueCached << std::endl; + } else { + std::cout << "Proxy A got cached attribute X1 error value[" << (int)valueCached << "]: " << valueCached << std::endl; + } + std::this_thread::sleep_for(std::chrono::microseconds(1000000)); + } +} diff --git a/CommonAPI-Examples/src/A/MergedInterfaceServiceA.cpp b/CommonAPI-Examples/src/A/MergedInterfaceServiceA.cpp new file mode 100644 index 0000000..2da7750 --- /dev/null +++ b/CommonAPI-Examples/src/A/MergedInterfaceServiceA.cpp @@ -0,0 +1,37 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include +#include + +#include +#include "MergedInterfaceStubImplA.hpp" + +int main() { + CommonAPI::Runtime::setProperty("LogContext", "E02SA"); + CommonAPI::Runtime::setProperty("LogApplication", "E02SA"); + CommonAPI::Runtime::setProperty("LibraryBase", "MergedInterface-A"); + + std::shared_ptr runtime = CommonAPI::Runtime::get(); + + std::string domain = "local"; + std::string instance = "commonapi.examples.A.MergedInterfaceA"; + std::string connection = "service-sample"; + + std::shared_ptr myService = std::make_shared(); + while (!runtime->registerService(domain, instance, myService, connection)) { + std::cout << "Register Service failed, trying again in 100 milliseconds..." << std::endl; + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + + std::cout << "Successfully Registered Service!" << std::endl; + + while (true) { + myService->incCounter(); // Change value of attribute, see stub implementation + std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl; + std::this_thread::sleep_for(std::chrono::seconds(2)); + } + return 0; +} diff --git a/CommonAPI-Examples/src/A/MergedInterfaceStubImplA.cpp b/CommonAPI-Examples/src/A/MergedInterfaceStubImplA.cpp new file mode 100644 index 0000000..ea83da0 --- /dev/null +++ b/CommonAPI-Examples/src/A/MergedInterfaceStubImplA.cpp @@ -0,0 +1,19 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "MergedInterfaceStubImplA.hpp" + +MergedInterfaceStubImplA::MergedInterfaceStubImplA() { + cnt = 0; +} + +MergedInterfaceStubImplA::~MergedInterfaceStubImplA() { +} + +void MergedInterfaceStubImplA::incCounter() { + cnt++; + setX1Attribute((int32_t)cnt); + std::cout << "New counter value = " << cnt << "!" << std::endl; +} diff --git a/CommonAPI-Examples/src/A/MergedInterfaceStubImplA.hpp b/CommonAPI-Examples/src/A/MergedInterfaceStubImplA.hpp new file mode 100644 index 0000000..8814096 --- /dev/null +++ b/CommonAPI-Examples/src/A/MergedInterfaceStubImplA.hpp @@ -0,0 +1,23 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef MERGEDINTERFACESTUBIMPLA_H_ +#define MERGEDINTERFACESTUBIMPLA_H_ + +#include +#include + +class MergedInterfaceStubImplA: public v1_0::commonapi::examples::A::MergedInterfaceAStubDefault{ + +public: + MergedInterfaceStubImplA(); + virtual ~MergedInterfaceStubImplA(); + virtual void incCounter(); + +private: + int cnt; +}; + +#endif /* MERGEDINTERFACESTUBIMPLA_H_ */ diff --git a/CommonAPI-Examples/src/B/MergedInterfaceClientB.cpp b/CommonAPI-Examples/src/B/MergedInterfaceClientB.cpp new file mode 100644 index 0000000..f65f750 --- /dev/null +++ b/CommonAPI-Examples/src/B/MergedInterfaceClientB.cpp @@ -0,0 +1,77 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include + +#ifndef _WIN32 +#include +#endif + +#include +#include +#include + +using namespace v1::commonapi::examples::B; + +void recv_cb(const CommonAPI::CallStatus& callStatus, const int32_t& val) { + std::cout << "Receive callback: " << val << std::endl; +} + +int main() { + CommonAPI::Runtime::setProperty("LogContext", "E02CB"); + CommonAPI::Runtime::setProperty("LogApplication", "E02CB"); + CommonAPI::Runtime::setProperty("LibraryBase", "MergedInterface-B"); + + std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get(); + + std::string domain = "local"; + std::string instance = "commonapi.examples.B.MergedInterfaceB"; + std::string connection = "client-sample"; + + auto myProxy = runtime->buildProxyWithDefaultAttributeExtension(domain, instance, connection); + + std::cout << "Waiting for service to become available." << std::endl; + while (!myProxy->isAvailable()) { + std::this_thread::sleep_for(std::chrono::microseconds(10)); + } + + CommonAPI::CallStatus callStatus; + + int32_t value = 0; + + CommonAPI::CallInfo info(1000); + info.sender_ = 5678; + + // Get actual attribute value from service + std::cout << "Proxy B getting attribute X3 value: " << value << std::endl; + myProxy->getX3Attribute().getValue(callStatus, value, &info); + if (callStatus != CommonAPI::CallStatus::SUCCESS) { + std::cerr << "Remote call A failed!\n"; + return -1; + } + std::cout << "Proxy B got attribute X3 value: " << value << std::endl; + + // Subscribe for receiving values + myProxy->getX3Attribute().getChangedEvent().subscribe([&](const int32_t& val) { + std::cout << "Proxy B received attrbiute X3 change message: " << val << std::endl; + }); + + value = 100; + + // Asynchronous call to set attribute of service + std::function fcb = recv_cb; + myProxy->getX3Attribute().setValueAsync(value, fcb, &info); + + while (true) { + int32_t errorValue = -1; + int32_t valueCached = *myProxy->getX3AttributeExtension().getCachedValue(errorValue); + if (valueCached != errorValue) { + std::cout << "Proxy B got cached attribute X3 value[" << (int)valueCached << "]: " << valueCached << std::endl; + } else { + std::cout << "Proxy B got cached attribute X3 error value[" << (int)valueCached << "]: " << valueCached << std::endl; + } + std::this_thread::sleep_for(std::chrono::microseconds(1000000)); + } +} diff --git a/CommonAPI-Examples/src/B/MergedInterfaceServiceB.cpp b/CommonAPI-Examples/src/B/MergedInterfaceServiceB.cpp new file mode 100644 index 0000000..85a7aaf --- /dev/null +++ b/CommonAPI-Examples/src/B/MergedInterfaceServiceB.cpp @@ -0,0 +1,37 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include +#include + +#include +#include "MergedInterfaceStubImplB.hpp" + +int main() { + CommonAPI::Runtime::setProperty("LogContext", "E02SB"); + CommonAPI::Runtime::setProperty("LogApplication", "E02SB"); + CommonAPI::Runtime::setProperty("LibraryBase", "MergedInterface-B"); + + std::shared_ptr runtime = CommonAPI::Runtime::get(); + + std::string domain = "local"; + std::string instance = "commonapi.examples.B.MergedInterfaceB"; + std::string connection = "service-sample"; + + std::shared_ptr myService = std::make_shared(); + while (!runtime->registerService(domain, instance, myService, connection)) { + std::cout << "Register Service B failed, trying again in 100 milliseconds..." << std::endl; + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + + std::cout << "Successfully Registered Service!" << std::endl; + + while (true) { + myService->incCounter(); // Change value of attribute, see stub implementation + std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl; + std::this_thread::sleep_for(std::chrono::seconds(2)); + } + return 0; +} diff --git a/CommonAPI-Examples/src/B/MergedInterfaceStubImplB.cpp b/CommonAPI-Examples/src/B/MergedInterfaceStubImplB.cpp new file mode 100644 index 0000000..f385753 --- /dev/null +++ b/CommonAPI-Examples/src/B/MergedInterfaceStubImplB.cpp @@ -0,0 +1,19 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "MergedInterfaceStubImplB.hpp" + +MergedInterfaceStubImplB::MergedInterfaceStubImplB() { + cnt = 0; +} + +MergedInterfaceStubImplB::~MergedInterfaceStubImplB() { +} + +void MergedInterfaceStubImplB::incCounter() { + cnt++; + setX3Attribute((int32_t)cnt); + std::cout << "New counter value = " << cnt << "!" << std::endl; +} diff --git a/CommonAPI-Examples/src/B/MergedInterfaceStubImplB.hpp b/CommonAPI-Examples/src/B/MergedInterfaceStubImplB.hpp new file mode 100644 index 0000000..4bf5261 --- /dev/null +++ b/CommonAPI-Examples/src/B/MergedInterfaceStubImplB.hpp @@ -0,0 +1,23 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef MERGEDINTERFACESTUBIMPLB_H_ +#define MERGEDINTERFACESTUBIMPLB_H_ + +#include +#include + +class MergedInterfaceStubImplB: public v1_0::commonapi::examples::B::MergedInterfaceBStubDefault{ + +public: + MergedInterfaceStubImplB(); + virtual ~MergedInterfaceStubImplB(); + virtual void incCounter(); + +private: + int cnt; +}; + +#endif /* MERGEDINTERFACESTUBIMPLB_H_ */ diff --git a/CommonAPI-Examples/src/C/MergedInterfaceClientC.cpp b/CommonAPI-Examples/src/C/MergedInterfaceClientC.cpp new file mode 100644 index 0000000..dbf339e --- /dev/null +++ b/CommonAPI-Examples/src/C/MergedInterfaceClientC.cpp @@ -0,0 +1,77 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include + +#ifndef _WIN32 +#include +#endif + +#include +#include +#include + +using namespace v2::commonapi::examples::C; + +void recv_cb(const CommonAPI::CallStatus& callStatus, const int32_t& val) { + std::cout << "Receive callback: " << val << std::endl; +} + +int main() { + CommonAPI::Runtime::setProperty("LogContext", "E02CC"); + CommonAPI::Runtime::setProperty("LogApplication", "E02CC"); + CommonAPI::Runtime::setProperty("LibraryBase", "MergedInterface-C"); + + std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get(); + + std::string domain = "local"; + std::string instance = "commonapi.examples.C.AttributesC"; + std::string connection = "client-sample"; + + auto myProxy = runtime->buildProxyWithDefaultAttributeExtension(domain, instance, connection); + + std::cout << "Waiting for service to become available." << std::endl; + while (!myProxy->isAvailable()) { + std::this_thread::sleep_for(std::chrono::microseconds(10)); + } + + CommonAPI::CallStatus callStatus; + + int32_t value = 0; + + CommonAPI::CallInfo info(1000); + info.sender_ = 5678; + + // Get actual attribute value from service + std::cout << "Proxy C getting attribute X3 value: " << value << std::endl; + myProxy->getX3Attribute().getValue(callStatus, value, &info); + if (callStatus != CommonAPI::CallStatus::SUCCESS) { + std::cerr << "Remote call A failed!\n"; + return -1; + } + std::cout << "Proxy C got attribute X3 value: " << value << std::endl; + + // Subscribe for receiving values + myProxy->getX3Attribute().getChangedEvent().subscribe([&](const int32_t& val) { + std::cout << "Received attribute X3 change message: " << val << std::endl; + }); + + value = 100; + + // Asynchronous call to set attribute of service + std::function fcb = recv_cb; + myProxy->getX3Attribute().setValueAsync(value, fcb, &info); + + while (true) { + int32_t errorValue = -1; + int32_t valueCached = *myProxy->getX3AttributeExtension().getCachedValue(errorValue); + if (valueCached != errorValue) { + std::cout << " +#include + +#include +#include "MergedInterfaceStubImplC.hpp" + +int main() { + CommonAPI::Runtime::setProperty("LogContext", "E02SC"); + CommonAPI::Runtime::setProperty("LogApplication", "E02SC"); + CommonAPI::Runtime::setProperty("LibraryBase", "MergedInterface-C"); + + std::shared_ptr runtime = CommonAPI::Runtime::get(); + + std::string domain = "local"; + std::string instance = "commonapi.examples.C.MergedInterfaceC"; + std::string connection = "service-sample"; + + std::shared_ptr myService = std::make_shared(); + while (!runtime->registerService(domain, instance, myService, connection)) { + std::cout << "Register Service C failed, trying again in 100 milliseconds..." << std::endl; + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + + std::cout << "Successfully Registered Service C!" << std::endl; + + while (true) { + myService->incCounter(); // Change value of attribute, see stub implementation + std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl; + std::this_thread::sleep_for(std::chrono::seconds(2)); + } + return 0; +} diff --git a/CommonAPI-Examples/src/C/MergedInterfaceStubImplC.cpp b/CommonAPI-Examples/src/C/MergedInterfaceStubImplC.cpp new file mode 100644 index 0000000..d678281 --- /dev/null +++ b/CommonAPI-Examples/src/C/MergedInterfaceStubImplC.cpp @@ -0,0 +1,20 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "MergedInterfaceStubImplC.hpp" + +MergedInterfaceStubImplC::MergedInterfaceStubImplC() { + cnt = 0; +} + +MergedInterfaceStubImplC::~MergedInterfaceStubImplC() { +} + +void MergedInterfaceStubImplC::incCounter() { + cnt++; + setX1Attribute((int32_t)cnt); + setX3Attribute((int32_t)cnt); + std::cout << "New counter value " << cnt << "!" << std::endl; +} diff --git a/CommonAPI-Examples/src/C/MergedInterfaceStubImplC.hpp b/CommonAPI-Examples/src/C/MergedInterfaceStubImplC.hpp new file mode 100644 index 0000000..698beda --- /dev/null +++ b/CommonAPI-Examples/src/C/MergedInterfaceStubImplC.hpp @@ -0,0 +1,23 @@ +/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef MERGEDINTERFACESTUBIMPLC_H_ +#define MERGEDINTERFACESTUBIMPLC_H_ + +#include +#include + +class MergedInterfaceStubImplC: public v2_1::commonapi::examples::C::MergedInterfaceCStubDefault{ + +public: + MergedInterfaceStubImplC(); + virtual ~MergedInterfaceStubImplC(); + virtual void incCounter(); + +private: + int cnt; +}; + +#endif /* MERGEDINTERFACESTUBIMPLC_H_ */ diff --git a/CommonAPI-Examples/vsomeip-local.json b/CommonAPI-Examples/vsomeip-local.json index 9f0358a..dc62d2b 100644 --- a/CommonAPI-Examples/vsomeip-local.json +++ b/CommonAPI-Examples/vsomeip-local.json @@ -64,6 +64,18 @@ "events" : [ "0x777", "0x779" ] } ] + }, + { + "service" : "0x1235", + "instance" : "0x5678", + "reliable" : { "port" : "30509", "enable-magic-cookies" : "false" }, + "unreliable" : "31001" + }, + { + "service" : "0x1236", + "instance" : "0x5678", + "reliable" : { "port" : "30509", "enable-magic-cookies" : "false" }, + "unreliable" : "31002" } ], "routing" : "service-sample", diff --git a/org.genivi.commonapi.releng/pom.xml b/org.genivi.commonapi.releng/pom.xml index ff92c88..c76423d 100644 --- a/org.genivi.commonapi.releng/pom.xml +++ b/org.genivi.commonapi.releng/pom.xml @@ -3,7 +3,7 @@ 4.0.0 commonapi org.genivi.commonapi.releng - 3.1.10-SNAPSHOT + 3.1.11-SNAPSHOT pom 0.22.0 @@ -46,7 +46,7 @@ commonapi ${target.id} - 3.1.10-SNAPSHOT + 3.1.11-SNAPSHOT diff --git a/org.genivi.commonapi.someip.cli.feature/feature.xml b/org.genivi.commonapi.someip.cli.feature/feature.xml index 594360c..3977a28 100644 --- a/org.genivi.commonapi.someip.cli.feature/feature.xml +++ b/org.genivi.commonapi.someip.cli.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/org.genivi.commonapi.someip.cli.feature/pom.xml b/org.genivi.commonapi.someip.cli.feature/pom.xml index 45299e3..ce2566f 100644 --- a/org.genivi.commonapi.someip.cli.feature/pom.xml +++ b/org.genivi.commonapi.someip.cli.feature/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.someip.releng - 3.1.10-SNAPSHOT + 3.1.11-SNAPSHOT ../org.genivi.commonapi.someip.releng \ No newline at end of file diff --git a/org.genivi.commonapi.someip.cli.product/commonapi_someip_cli.product b/org.genivi.commonapi.someip.cli.product/commonapi_someip_cli.product index 23da8d3..8797e88 100644 --- a/org.genivi.commonapi.someip.cli.product/commonapi_someip_cli.product +++ b/org.genivi.commonapi.someip.cli.product/commonapi_someip_cli.product @@ -1,13 +1,13 @@ - + - -Dosgi.requiredJavaVersion=1.8 -Xms512m -Xmx512m -XX:PermSize=128m + -Dosgi.requiredJavaVersion=1.8 -Xms512m -Xmx512m -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts diff --git a/org.genivi.commonapi.someip.cli.product/pom.xml b/org.genivi.commonapi.someip.cli.product/pom.xml index a481232..59e7122 100644 --- a/org.genivi.commonapi.someip.cli.product/pom.xml +++ b/org.genivi.commonapi.someip.cli.product/pom.xml @@ -131,7 +131,7 @@ commonapi org.genivi.commonapi.someip.releng - 3.1.10-SNAPSHOT + 3.1.11-SNAPSHOT ../org.genivi.commonapi.someip.releng diff --git a/org.genivi.commonapi.someip.cli/META-INF/MANIFEST.MF b/org.genivi.commonapi.someip.cli/META-INF/MANIFEST.MF index 5fcf886..3b38252 100644 --- a/org.genivi.commonapi.someip.cli/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.someip.cli/META-INF/MANIFEST.MF @@ -2,15 +2,15 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: commonapi Some/IP generator Console Interface Bundle-SymbolicName: org.genivi.commonapi.someip.cli;singleton:=true -Bundle-Version: 3.1.10.qualifier +Bundle-Version: 3.1.11.qualifier Bundle-Activator: org.genivi.commonapi.someip.cli.Activator Require-Bundle: org.eclipse.core.runtime, org.eclipse.xtext;bundle-version="[2.7.0,3.0.0)";visibility:=reexport, org.franca.core.dsl;bundle-version="[0.9.0,0.10.0)";visibility:=reexport, org.franca.deploymodel.dsl;bundle-version="[0.9.0,0.10.0)";visibility:=reexport, org.genivi.commonapi.console, - org.genivi.commonapi.someip;bundle-version="3.1.10", - org.genivi.commonapi.someip.deployment.validator;bundle-version="3.1.10" + org.genivi.commonapi.someip;bundle-version="3.1.11", + org.genivi.commonapi.someip.deployment.validator;bundle-version="3.1.11" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: BMW AG diff --git a/org.genivi.commonapi.someip.cli/pom.xml b/org.genivi.commonapi.someip.cli/pom.xml index e5893e6..0508330 100644 --- a/org.genivi.commonapi.someip.cli/pom.xml +++ b/org.genivi.commonapi.someip.cli/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.someip.releng - 3.1.10-SNAPSHOT + 3.1.11-SNAPSHOT ../org.genivi.commonapi.someip.releng \ No newline at end of file diff --git a/org.genivi.commonapi.someip.deployment.validator/META-INF/MANIFEST.MF b/org.genivi.commonapi.someip.deployment.validator/META-INF/MANIFEST.MF index 5038ddd..f3a64fe 100644 --- a/org.genivi.commonapi.someip.deployment.validator/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.someip.deployment.validator/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GENIVI Common API Some/IP Deployment Validator Bundle-SymbolicName: org.genivi.commonapi.someip.deployment.validator;singleton:=true -Bundle-Version: 3.1.10.qualifier +Bundle-Version: 3.1.11.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: BMW AG Export-Package: org.genivi.commonapi.someip.deployment.validator diff --git a/org.genivi.commonapi.someip.deployment.validator/pom.xml b/org.genivi.commonapi.someip.deployment.validator/pom.xml index e793746..b5dd7bc 100644 --- a/org.genivi.commonapi.someip.deployment.validator/pom.xml +++ b/org.genivi.commonapi.someip.deployment.validator/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.someip.releng - 3.1.10-SNAPSHOT + 3.1.11-SNAPSHOT ../org.genivi.commonapi.someip.releng \ No newline at end of file diff --git a/org.genivi.commonapi.someip.deployment.validator/src/org/genivi/commonapi/someip/deployment/validator/SomeIPDeploymentValidator.xtend b/org.genivi.commonapi.someip.deployment.validator/src/org/genivi/commonapi/someip/deployment/validator/SomeIPDeploymentValidator.xtend index 5bd4081..90515d9 100644 --- a/org.genivi.commonapi.someip.deployment.validator/src/org/genivi/commonapi/someip/deployment/validator/SomeIPDeploymentValidator.xtend +++ b/org.genivi.commonapi.someip.deployment.validator/src/org/genivi/commonapi/someip/deployment/validator/SomeIPDeploymentValidator.xtend @@ -9,6 +9,7 @@ import org.eclipse.emf.common.util.DiagnosticChain import org.eclipse.xtext.validation.FeatureBasedDiagnostic import org.franca.core.franca.FInterface import org.franca.core.franca.FModel +import org.franca.deploymodel.dsl.fDeploy.FDArray import org.franca.deploymodel.dsl.fDeploy.FDAttribute import org.franca.deploymodel.dsl.fDeploy.FDBroadcast import org.franca.deploymodel.dsl.fDeploy.FDInteger @@ -18,9 +19,11 @@ import org.franca.deploymodel.dsl.fDeploy.FDMethod import org.franca.deploymodel.dsl.fDeploy.FDModel import org.franca.deploymodel.dsl.fDeploy.FDProperty import org.franca.deploymodel.dsl.fDeploy.FDProvider +import org.franca.deploymodel.dsl.fDeploy.FDTypes import org.franca.deploymodel.dsl.fDeploy.FDValue import static org.franca.deploymodel.dsl.fDeploy.FDeployPackage.Literals.* +import org.franca.deploymodel.dsl.fDeploy.FDElement class SomeIPDeploymentValidator { @@ -37,6 +40,7 @@ class SomeIPDeploymentValidator var missingInterfaceDeployment = new HashSet var fdInterfaces = new ArrayList var fdInterfaceInstances = new ArrayList + var fdTypeCollections = new ArrayList def validate(Collection fdepls, DiagnosticChain diagnostics) { @@ -47,14 +51,21 @@ class SomeIPDeploymentValidator var deplFileName = fdepl.eResource.URI.lastSegment if (!deplFileName.endsWith(DEPLOYMENT_SPECIFICATION_FILENAME_SUFFIX)) { - for ( fdInterface : fdepl.deployments.filter(typeof(FDInterface))) { - if(fdInterface.spec.name != null && fdInterface.spec.name.contains(SOMEIP_SPECIFICATION_TYPE)) + for (fdInterface : fdepl.deployments.filter(typeof(FDInterface))) + { + if (fdInterface.spec.name != null && fdInterface.spec.name.contains(SOMEIP_SPECIFICATION_TYPE)) fdInterfaces.add(fdInterface) } - for ( fdProvider : fdepl.deployments.filter(typeof(FDProvider))) { - if(fdProvider.spec.name != null && fdProvider.spec.name.contains(SOMEIP_SPECIFICATION_TYPE)) + for (fdProvider : fdepl.deployments.filter(typeof(FDProvider))) + { + if (fdProvider.spec.name != null && fdProvider.spec.name.contains(SOMEIP_SPECIFICATION_TYPE)) fdInterfaceInstances.addAll(fdProvider.instances) } + for (fdTypes : fdepl.deployments.filter(typeof(FDTypes))) + { + if (fdTypes.spec.name != null && fdTypes.spec.name.contains(SOMEIP_SPECIFICATION_TYPE)) + fdTypeCollections.addAll(fdTypes) + } } } @@ -67,10 +78,124 @@ class SomeIPDeploymentValidator for (fdInterface : fdInterfaces) validateCompleteInterfaceDeployments(fdInterface) - validateProviderInstanceDeployments(fdepls) + validateProviderInstanceDeployments() + + validateArrayDeployments() + } + + private def validateArrayDeployments() + { + val fdArrayDeployments = new ArrayList + + // Type collections + for (typeCollection : fdTypeCollections) + fdArrayDeployments.addAll(typeCollection.types.filter(typeof(FDArray))) + + for (fdInterface : fdInterfaces) + { + // Interface local types + fdArrayDeployments.addAll(fdInterface.types.filter(typeof(FDArray))) + + // Interface attributes + fdArrayDeployments.addAll(fdInterface.attributes.filter[it.target != null && it.target.array]) + + // Interface method's input and output arguments + fdInterface.methods.forEach[m| + if (m.inArguments != null) + fdArrayDeployments.addAll(m.inArguments.arguments.filter[it.target != null && it.target.array]) + if (m.outArguments != null) + fdArrayDeployments.addAll(m.outArguments.arguments.filter[it.target != null && it.target.array]) + ] + + // Interface broadcast's output arguments + fdInterface.broadcasts.forEach[bc| + if (bc.outArguments != null) + fdArrayDeployments.addAll(bc.outArguments.arguments.filter[it.target != null && it.target.array]) + ] + } + + for (fdArrayDeployment : fdArrayDeployments) + { + validateArrayDeployment(fdArrayDeployment, + "SomeIpArrayMinLength", + "SomeIpArrayMaxLength", + "SomeIpArrayLengthWidth") + + validateArrayDeployment(fdArrayDeployment, + "SomeIpAttrArrayMinLength", + "SomeIpAttrArrayMaxLength", + "SomeIpAttrArrayLengthWidth") + + validateArrayDeployment(fdArrayDeployment, + "SomeIpArgArrayMinLength", + "SomeIpArgArrayMaxLength", + "SomeIpArgArrayLengthWidth") + + validateArrayDeployment(fdArrayDeployment, + "SomeIpStructArrayMinLength", + "SomeIpStructArrayMaxLength", + "SomeIpStructArrayLengthWidth") + + validateArrayDeployment(fdArrayDeployment, + "SomeIpUnionArrayMinLength", + "SomeIpUnionArrayMaxLength", + "SomeIpUnionArrayLengthWidth") + } } - private def validateProviderInstanceDeployments(Collection fdepls) + private def validateArrayDeployment(FDElement fdArray, String minLengthName, String maxLengthName, String lengthWidthName) + { + var propSomeIpArrayMinLength = fdArray.properties.findFirst[it.decl.name == minLengthName] + var propSomeIpArrayMaxLength = fdArray.properties.findFirst[it.decl.name == maxLengthName] + var propSomeIpArrayLengthWidth = fdArray.properties.findFirst[it.decl.name == lengthWidthName] + + var someIpArrayMinLength = getInteger(propSomeIpArrayMinLength) + var someIpArrayMaxLength = getInteger(propSomeIpArrayMaxLength) + var someIpArrayLengthWidth = getInteger(propSomeIpArrayLengthWidth) + + if (someIpArrayMinLength != null && someIpArrayMaxLength != null && someIpArrayMinLength == someIpArrayMaxLength && someIpArrayMinLength != 0) + { + // * If SomeIpArrayLengthWidth == 1, 2 or 4 bytes, SomeIpArrayMinLength and SomeIpArrayMaxLength are ignored. + // + if (someIpArrayLengthWidth == null) + { + var diag = new FeatureBasedDiagnostic(Diagnostic.WARNING, + "Array deployment with '" + minLengthName + "' = '" + maxLengthName + "' is missing a '" + lengthWidthName + " = 0' property.", + propSomeIpArrayMinLength, null, -1, null, null) + diagnostics.add(diag) + } + else if (someIpArrayLengthWidth != 0) + { + var diag = new FeatureBasedDiagnostic(Diagnostic.WARNING, + "Array deployment with '" + minLengthName + "' = '" + maxLengthName + "' does not specify '" + lengthWidthName + " = 0'.", + propSomeIpArrayLengthWidth, null, -1, null, null) + diagnostics.add(diag) + } + } + else if (someIpArrayLengthWidth != null && someIpArrayLengthWidth == 0) + { + // * If SomeIpArrayLengthWidth == 0, the array has SomeIpArrayMaxLength elements. + // + if (someIpArrayMaxLength == null || someIpArrayMaxLength == 0) + { + var diag = new FeatureBasedDiagnostic(Diagnostic.WARNING, + "Array deployment specifies a fixed length array type, but is missing a nonzero array length specification '" + maxLengthName + "'.", + propSomeIpArrayLengthWidth, null, -1, null, null) + diagnostics.add(diag) + } + else if (someIpArrayMinLength != null && someIpArrayMaxLength != null && someIpArrayMinLength > someIpArrayMaxLength) + { + var diag = new FeatureBasedDiagnostic(Diagnostic.WARNING, + "Array deployment contains a minimum array length '" + minLengthName + "' that exceeds the maximum array length '" + maxLengthName + ".", + propSomeIpArrayMinLength, null, -1, null, null) + diagnostics.add(diag) + } + } + + + } + + private def validateProviderInstanceDeployments() { fdInterfaceInstances.forEach[interfaceInstance| if (fdInterfaces.findFirst[target != null && interfaceInstance.target != null && target.equals(interfaceInstance.target)] == null) @@ -718,6 +843,11 @@ class SomeIPDeploymentValidator } private def getId(FDProperty prop) + { + return getInteger(prop) + } + + private def getInteger(FDProperty prop) { if (prop == null || prop.value == null) return null diff --git a/org.genivi.commonapi.someip.feature/feature.xml b/org.genivi.commonapi.someip.feature/feature.xml index 1bbe244..1cc250f 100644 --- a/org.genivi.commonapi.someip.feature/feature.xml +++ b/org.genivi.commonapi.someip.feature/feature.xml @@ -2,7 +2,7 @@ @@ -17,21 +17,21 @@ id="org.genivi.commonapi.someip" download-size="0" install-size="0" - version="3.1.10.qualifier" + version="3.1.11.qualifier" unpack="false"/> diff --git a/org.genivi.commonapi.someip.feature/pom.xml b/org.genivi.commonapi.someip.feature/pom.xml index 044ce22..9855316 100644 --- a/org.genivi.commonapi.someip.feature/pom.xml +++ b/org.genivi.commonapi.someip.feature/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.someip.releng - 3.1.10-SNAPSHOT + 3.1.11-SNAPSHOT ../org.genivi.commonapi.someip.releng \ No newline at end of file diff --git a/org.genivi.commonapi.someip.releng/pom.xml b/org.genivi.commonapi.someip.releng/pom.xml index b6e6bb9..4399845 100644 --- a/org.genivi.commonapi.someip.releng/pom.xml +++ b/org.genivi.commonapi.someip.releng/pom.xml @@ -24,7 +24,7 @@ commonapi org.genivi.commonapi.releng - 3.1.10-SNAPSHOT + 3.1.11-SNAPSHOT ../org.genivi.commonapi.releng @@ -39,4 +39,10 @@ file:${COREPATH}/org.genivi.commonapi.core.updatesite/target/repository/ + + target + + + ${buildDir} + diff --git a/org.genivi.commonapi.someip.target/pom.xml b/org.genivi.commonapi.someip.target/pom.xml index 20ea331..151efd5 100644 --- a/org.genivi.commonapi.someip.target/pom.xml +++ b/org.genivi.commonapi.someip.target/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.someip.releng - 3.1.10-SNAPSHOT + 3.1.11-SNAPSHOT ../org.genivi.commonapi.someip.releng \ No newline at end of file diff --git a/org.genivi.commonapi.someip.ui/META-INF/MANIFEST.MF b/org.genivi.commonapi.someip.ui/META-INF/MANIFEST.MF index 2bb3ae3..61b16e8 100644 --- a/org.genivi.commonapi.someip.ui/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.someip.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GENIVI Common API Some/IP UI Bundle-SymbolicName: org.genivi.commonapi.someip.ui;singleton:=true -Bundle-Version: 3.1.10.qualifier +Bundle-Version: 3.1.11.qualifier Bundle-Activator: org.genivi.commonapi.someip.ui.CommonApiSomeIPUiPlugin Bundle-Vendor: BMW AG Require-Bundle: org.eclipse.ui, @@ -14,11 +14,11 @@ Require-Bundle: org.eclipse.ui, org.eclipse.xtext.builder;bundle-version="[2.7.0,3.0.0)";visibility:=reexport, org.eclipse.xtext.generator;bundle-version="[2.7.0,3.0.0)";visibility:=reexport, com.google.inject;bundle-version="3.0.0", - org.genivi.commonapi.core.ui;bundle-version="3.1.10", - org.genivi.commonapi.someip;bundle-version="3.1.10", + org.genivi.commonapi.core.ui;bundle-version="3.1.11", + org.genivi.commonapi.someip;bundle-version="3.1.11", org.franca.core.dsl.ui;bundle-version="0.9.1", org.franca.deploymodel.dsl.ui;bundle-version="0.9.1", - org.genivi.commonapi.someip.deployment.validator;bundle-version="3.1.10" + org.genivi.commonapi.someip.deployment.validator;bundle-version="3.1.11" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Import-Package: javax.inject diff --git a/org.genivi.commonapi.someip.ui/pom.xml b/org.genivi.commonapi.someip.ui/pom.xml index 290945c..83e3c4a 100644 --- a/org.genivi.commonapi.someip.ui/pom.xml +++ b/org.genivi.commonapi.someip.ui/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.someip.releng - 3.1.10-SNAPSHOT + 3.1.11-SNAPSHOT ../org.genivi.commonapi.someip.releng \ No newline at end of file diff --git a/org.genivi.commonapi.someip.updatesite/category.xml b/org.genivi.commonapi.someip.updatesite/category.xml index 0f65375..5b31d4e 100644 --- a/org.genivi.commonapi.someip.updatesite/category.xml +++ b/org.genivi.commonapi.someip.updatesite/category.xml @@ -1,9 +1,9 @@ - + - + diff --git a/org.genivi.commonapi.someip.updatesite/pom.xml b/org.genivi.commonapi.someip.updatesite/pom.xml index 8f3b120..7e961e5 100644 --- a/org.genivi.commonapi.someip.updatesite/pom.xml +++ b/org.genivi.commonapi.someip.updatesite/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.someip.releng - 3.1.10-SNAPSHOT + 3.1.11-SNAPSHOT ../org.genivi.commonapi.someip.releng \ No newline at end of file diff --git a/org.genivi.commonapi.someip.validator.feature/feature.xml b/org.genivi.commonapi.someip.validator.feature/feature.xml index ce9f8a7..338685c 100644 --- a/org.genivi.commonapi.someip.validator.feature/feature.xml +++ b/org.genivi.commonapi.someip.validator.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/org.genivi.commonapi.someip.validator.feature/pom.xml b/org.genivi.commonapi.someip.validator.feature/pom.xml index 8d27f40..89caad8 100644 --- a/org.genivi.commonapi.someip.validator.feature/pom.xml +++ b/org.genivi.commonapi.someip.validator.feature/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.someip.releng - 3.1.10-SNAPSHOT + 3.1.11-SNAPSHOT ../org.genivi.commonapi.someip.releng \ No newline at end of file diff --git a/org.genivi.commonapi.someip.validator/META-INF/MANIFEST.MF b/org.genivi.commonapi.someip.validator/META-INF/MANIFEST.MF index 42b458b..f70c739 100644 --- a/org.genivi.commonapi.someip.validator/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.someip.validator/META-INF/MANIFEST.MF @@ -2,15 +2,15 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GENIVI Common API Some/IP Validator Bundle-SymbolicName: org.genivi.commonapi.someip.validator;singleton:=true -Bundle-Version: 3.1.10.qualifier +Bundle-Version: 3.1.11.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: BMW AG Require-Bundle: org.eclipse.xtext.builder;bundle-version="[2.7.0,3.0.0)";visibility:=reexport, org.eclipse.xtext.generator;bundle-version="[2.7.0,3.0.0)";visibility:=reexport, org.eclipse.xtext.ui;bundle-version="[2.7.0,3.0.0)";visibility:=reexport, - org.genivi.commonapi.core;bundle-version="3.1.10";visibility:=reexport, + org.genivi.commonapi.core;bundle-version="3.1.11";visibility:=reexport, org.genivi.commonapi.core.ui, - org.genivi.commonapi.someip;bundle-version="3.1.10";visibility:=reexport, - org.genivi.commonapi.someip.ui;bundle-version="3.1.10";visibility:=reexport + org.genivi.commonapi.someip;bundle-version="3.1.11";visibility:=reexport, + org.genivi.commonapi.someip.ui;bundle-version="3.1.11";visibility:=reexport Export-Package: org.genivi.commonapi.someip.validator diff --git a/org.genivi.commonapi.someip.validator/pom.xml b/org.genivi.commonapi.someip.validator/pom.xml index 0580811..9431d12 100644 --- a/org.genivi.commonapi.someip.validator/pom.xml +++ b/org.genivi.commonapi.someip.validator/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.someip.releng - 3.1.10-SNAPSHOT + 3.1.11-SNAPSHOT ../org.genivi.commonapi.someip.releng \ No newline at end of file diff --git a/org.genivi.commonapi.someip.verification/CMakeLists.txt b/org.genivi.commonapi.someip.verification/CMakeLists.txt index 2a0051b..280e103 100644 --- a/org.genivi.commonapi.someip.verification/CMakeLists.txt +++ b/org.genivi.commonapi.someip.verification/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT(libsomeipglue) SET( ${PROJECT_NAME}_MAJOR_VERSION 3 ) SET( ${PROJECT_NAME}_MINOR_VERSION 1 ) -SET( ${PROJECT_NAME}_PATCH_LEVEL 10 ) +SET( ${PROJECT_NAME}_PATCH_LEVEL 11 ) message("Project name: ${PROJECT_NAME}") diff --git a/org.genivi.commonapi.someip.verification/fidl/conf/ti_advanced_polymorph.fdepl.in b/org.genivi.commonapi.someip.verification/fidl/conf/ti_advanced_polymorph.fdepl.in index e6dc686..d305fee 100644 --- a/org.genivi.commonapi.someip.verification/fidl/conf/ti_advanced_polymorph.fdepl.in +++ b/org.genivi.commonapi.someip.verification/fidl/conf/ti_advanced_polymorph.fdepl.in @@ -11,6 +11,14 @@ define org.genivi.commonapi.someip.deployment for interface commonapi.advanced.p SomeIpEventGroups = { 33007 } } + attribute a_dub { + SomeIpGetterID = 3002 + SomeIpSetterID = 3003 + SomeIpNotifierID = 33009 + SomeIpEventGroups = { 33008 } + } + + method testMethod { SomeIpMethodID = 515 diff --git a/org.genivi.commonapi.someip.verification/fidl/conf/ti_communication.fdepl.in b/org.genivi.commonapi.someip.verification/fidl/conf/ti_communication.fdepl.in index edc58b9..81b550d 100644 --- a/org.genivi.commonapi.someip.verification/fidl/conf/ti_communication.fdepl.in +++ b/org.genivi.commonapi.someip.verification/fidl/conf/ti_communication.fdepl.in @@ -28,6 +28,13 @@ define org.genivi.commonapi.someip.deployment for interface commonapi.communicat SomeIpGetterID = 3006 } + attribute testD { + SomeIpGetterID = 3007 + SomeIpSetterID = 3008 + SomeIpNotifierID = 33002 + SomeIpEventGroups = { 33000 } + } + method testMethod { SomeIpMethodID = 515 SomeIpReliable = true diff --git a/org.genivi.commonapi.someip/META-INF/MANIFEST.MF b/org.genivi.commonapi.someip/META-INF/MANIFEST.MF index fd4e61d..de2b6c7 100644 --- a/org.genivi.commonapi.someip/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.someip/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GENIVI Common API Some/IP C++ Generator Bundle-Vendor: BMW AG -Bundle-Version: 3.1.10.qualifier +Bundle-Version: 3.1.11.qualifier Bundle-SymbolicName: org.genivi.commonapi.someip;singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0", @@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0", org.eclipse.xtext.util;bundle-version="[2.7.0,3.0.0)";visibility:=reexport, org.franca.core.dsl;bundle-version="[0.9.0,0.10.0)";visibility:=reexport, org.franca.deploymodel.dsl;bundle-version="[0.9.0,0.10.0)";visibility:=reexport, - org.genivi.commonapi.core;bundle-version="3.1.10";visibility:=reexport, + org.genivi.commonapi.core;bundle-version="3.1.11";visibility:=reexport, org.eclipse.core.resources;bundle-version="[3.9.0,4.0.0)" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: org.genivi.commonapi.someip.generator, diff --git a/org.genivi.commonapi.someip/pom.xml b/org.genivi.commonapi.someip/pom.xml index c504b9c..bb6d3bc 100644 --- a/org.genivi.commonapi.someip/pom.xml +++ b/org.genivi.commonapi.someip/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.someip.releng - 3.1.10-SNAPSHOT + 3.1.11-SNAPSHOT ../org.genivi.commonapi.someip.releng \ No newline at end of file diff --git a/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FInterfaceSomeIPStubAdapterGenerator.xtend b/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FInterfaceSomeIPStubAdapterGenerator.xtend index 484b87f..d76b4c3 100644 --- a/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FInterfaceSomeIPStubAdapterGenerator.xtend +++ b/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FInterfaceSomeIPStubAdapterGenerator.xtend @@ -67,7 +67,7 @@ class FInterfaceSomeIPStubAdapterGenerator { #include #include #include - #include + #include #undef COMMONAPI_INTERNAL_COMPILATION @@ -295,9 +295,13 @@ class FInterfaceSomeIPStubAdapterGenerator { if(_receivers == NULL) { std::lock_guard < std::mutex > itsLock(«broadcast.className»Mutex_); - actualReceiverList = «broadcast.stubAdapterClassSubscriberListPropertyName»; + if («broadcast.stubAdapterClassSubscriberListPropertyName» != NULL) + actualReceiverList = std::make_shared(*«broadcast.stubAdapterClassSubscriberListPropertyName»); } + if(actualReceiverList == NULL) + return; + for (auto clientIdIterator = actualReceiverList->cbegin(); clientIdIterator != actualReceiverList->cend(); clientIdIterator++) { diff --git a/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FrancaSomeIPDeploymentAccessorHelper.xtend b/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FrancaSomeIPDeploymentAccessorHelper.xtend index 0604b4a..03bcd8c 100644 --- a/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FrancaSomeIPDeploymentAccessorHelper.xtend +++ b/org.genivi.commonapi.someip/src/org/genivi/commonapi/someip/generator/FrancaSomeIPDeploymentAccessorHelper.xtend @@ -1128,6 +1128,10 @@ class FrancaSomeIPDeploymentAccessorHelper { } } + if (_struct.base != null) { + return hasDeployment(_accessor, _struct.base); + } + return false }