diff --git a/CHANGES b/CHANGES index 198f621..f23400f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,58 @@ Changes ======= +v3.2.14 +- Update README.md with correct github.io link +- Fixed build of the examples with installed DBus + +v3.2.13 +- Enable Modify generation TypeColl without name +- Fix several issues in the CommonAPI-Examples + +v3.2.12 +- Fix compilation error for word "client" +- Revert Modify generation TypeColl without name + +v3.2.11 +- Reduce load models in validation +- Impl changes in generator for Keywords +- Enable Modify generation TypeColl without name + +v3.2.10 +- Fix typedef InterfaceType declaration +- Revert Modify generation TypeColl without name" + +v3.2.9 +- Increase heap memory +- Fix reserved identifier error +- Modify generation TypeColl without name +- Enumeration/Enumerator with same name + +v3.2.8 +- Increase maximum heap memory size +- Accept enumeration/enumerator with same name +- Update dependencies +- Accept duplicate arg names for method in/out +- Create a CommonAPI Example for the E2E functionality + +v3.2.7 +- Update Generator to change the Parameter name "info" + +v3.2.6 +- Modify generation of TypeCollections without name +- Accept Methods with Parameters with the same name +- Accept duplicate argument names for method in and out + +v3.2.5 +- Accept an Interface with a method with the same name + +v3.2.4 +- Fix "com.google.inject" dependencies +- Extend DTCombined with variant test case + +v3.2.2 +- Restore correct include path for AttributeCacheExtension in Example 02 Attributes +- Adapt README to current generator name. +- Check whether an accessor exists before using it. v3.2.0 - Adapted to CommonAPI 3.2.0 diff --git a/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld-SomeIP.fdepl b/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld-SomeIP.fdepl index 58c3b57..ada37e4 100644 --- a/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld-SomeIP.fdepl +++ b/CommonAPI-Examples/E01HelloWorld/fidl/E01HelloWorld-SomeIP.fdepl @@ -25,7 +25,7 @@ define org.genivi.commonapi.someip.deployment for provider as Service { instance commonapi.examples.E01HelloWorld { InstanceId = "commonapi.examples.HelloWorld" - SomeIpInstanceID = 22136 + SomeIpInstanceID = 4660 SomeIpUnicastAddress = "192.168.0.2" SomeIpReliableUnicastPort = 30499 diff --git a/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldClient.cpp b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldClient.cpp index 913e5a6..850d8bb 100644 --- a/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldClient.cpp +++ b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldClient.cpp @@ -5,6 +5,7 @@ #include #include +#include #ifndef _WIN32 #include diff --git a/CommonAPI-Examples/E02Attributes/src/E02AttributesClient.cpp b/CommonAPI-Examples/E02Attributes/src/E02AttributesClient.cpp index e515ac0..703be66 100644 --- a/CommonAPI-Examples/E02Attributes/src/E02AttributesClient.cpp +++ b/CommonAPI-Examples/E02Attributes/src/E02AttributesClient.cpp @@ -4,6 +4,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include +#include #ifndef _WIN32 #include diff --git a/CommonAPI-Examples/E03Methods/src/E03MethodsClient.cpp b/CommonAPI-Examples/E03Methods/src/E03MethodsClient.cpp index 2f21fd1..34410c9 100644 --- a/CommonAPI-Examples/E03Methods/src/E03MethodsClient.cpp +++ b/CommonAPI-Examples/E03Methods/src/E03MethodsClient.cpp @@ -4,6 +4,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include +#include #ifndef _WIN32 #include diff --git a/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp index 0c4a22b..4adfd28 100644 --- a/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp +++ b/CommonAPI-Examples/E04PhoneBook/src/E04PhoneBookClient.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include diff --git a/CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp b/CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp index 86dd7a5..33ede71 100644 --- a/CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp +++ b/CommonAPI-Examples/E05Manager/src/E05ManagerClient.cpp @@ -8,6 +8,7 @@ #endif #include +#include #include #include diff --git a/CommonAPI-Examples/E06Unions/src/E06UnionsClient.cpp b/CommonAPI-Examples/E06Unions/src/E06UnionsClient.cpp index 09c4bb3..89f944b 100644 --- a/CommonAPI-Examples/E06Unions/src/E06UnionsClient.cpp +++ b/CommonAPI-Examples/E06Unions/src/E06UnionsClient.cpp @@ -7,6 +7,7 @@ #include #endif #include +#include #include diff --git a/CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp b/CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp index 9c15fef..06a0641 100644 --- a/CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp +++ b/CommonAPI-Examples/E07Mainloop/src/E07MainloopClient.cpp @@ -10,6 +10,7 @@ #endif #include +#include #include #include diff --git a/CommonAPI-Examples/E08CrcProtection/.gitignore b/CommonAPI-Examples/E08CrcProtection/.gitignore new file mode 100644 index 0000000..5897208 --- /dev/null +++ b/CommonAPI-Examples/E08CrcProtection/.gitignore @@ -0,0 +1,2 @@ +build +src-gen \ No newline at end of file diff --git a/CommonAPI-Examples/E08CrcProtection/CMakeLists.txt b/CommonAPI-Examples/E08CrcProtection/CMakeLists.txt new file mode 100644 index 0000000..cdc8122 --- /dev/null +++ b/CommonAPI-Examples/E08CrcProtection/CMakeLists.txt @@ -0,0 +1,118 @@ +# Copyright (C) 2022 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/. + +cmake_minimum_required(VERSION 2.8) + +set(PRJ_NAME E08CrcProtection) + +set(CMAKE_VERBOSE_MAKEFILE on) + +OPTION(USE_FILE "Set to OFF to disable file logging" OFF ) +message(STATUS "USE_FILE is set to value: ${USE_FILE}") + +OPTION(USE_CONSOLE "Set to OFF to disable console logging" OFF ) +message(STATUS "USE_CONSOLE is set to value: ${USE_CONSOLE}") + +IF(USE_FILE) + add_definitions(-DUSE_FILE) +ENDIF(USE_FILE) +IF(USE_CONSOLE) + add_definitions(-DUSE_CONSOLE) +ENDIF(USE_CONSOLE) + +SET(MAX_LOG_LEVEL "DEBUG" CACHE STRING "maximum log level") +message(STATUS "MAX_LOG_LEVEL is set to value: ${MAX_LOG_LEVEL}") +add_definitions(-DCOMMONAPI_LOGLEVEL=COMMONAPI_LOGLEVEL_${MAX_LOG_LEVEL}) + +if (MSVC) +# Visual C++ is not always sure whether he is really C++ +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS /EHsc /wd\\\"4503\\\"") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS /wd\\\"4503\\\"") +else() +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O0 -std=c++11 -pthread -D_GLIBCXX_USE_NANOSLEEP") +endif() + +message(STATUS "Compiler options: ${CMAKE_CXX_FLAGS}") + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Debug" CACHE STRING + "Choose the type of build, options are: Debug Release." FORCE) +endif(NOT CMAKE_BUILD_TYPE) +message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") + +OPTION(USE_INSTALLED_COMMONAPI "Set to OFF to use the local (build tree) version of CommonAPI" ON) +message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONAPI}") + +if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON") + FIND_PACKAGE(CommonAPI 3.2.0 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY) +else() + FIND_PACKAGE(CommonAPI 3.2.0 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) +endif() + +message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}") +message(STATUS "COMMONAPI_INCLUDE_DIRS: ${COMMONAPI_INCLUDE_DIRS}") + +# CommonAPI +include(FindPkgConfig) +############################################################################### + +# SOME/IP +find_package (CommonAPI-SomeIP 3.2.0 REQUIRED) +find_package (vsomeip3 3.2.0 REQUIRED) + +# Source Files +set(PRJ_SRC_PATH src) +set(PRJ_SRC_GEN_PATH src-gen) +set(PRJ_SRC_GEN_COMMONAPI_PATH ${PRJ_SRC_GEN_PATH}/core/v1/commonapi/examples) +set(PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH ${PRJ_SRC_GEN_PATH}/someip/v1/commonapi/examples) + +set(PRJ_NAME_CLIENT ${PRJ_NAME}Client) +set(PRJ_NAME_SERVICE ${PRJ_NAME}Service) + +# Application +FILE(GLOB PRJ_PROXY_GEN_SRCS ${PRJ_SRC_GEN_COMMONAPI_PATH}/*Proxy.cpp) +FILE(GLOB PRJ_STUB_GEN_SRCS ${PRJ_SRC_GEN_COMMONAPI_PATH}/*Stub*.cpp) +FILE(GLOB PRJ_STUB_IMPL_SRCS ${PRJ_SRC_COMMONAPI_PATH}/*Stub*.cpp) +set(PRJ_CLIENT_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_CLIENT}.cpp ${PRJ_PROXY_GEN_SRCS}) +set(PRJ_SERVICE_SRCS ${PRJ_SRC_PATH}/${PRJ_NAME_SERVICE}.cpp ${PRJ_SRC_PATH}/${PRJ_NAME}StubImpl.cpp ${PRJ_STUB_GEN_SRCS} ${PRJ_STUB_IMPL_SRCS}) + +# Boost +find_package( Boost 1.54 COMPONENTS system thread log REQUIRED ) +include_directories( ${Boost_INCLUDE_DIR} ) + +# SOME/IP library +FILE(GLOB PRJ_SOMEIP_LIB_SRCS ${PRJ_SRC_GEN_COMMONAPI_SOMEIP_PATH}/*cpp) + +include_directories( + src-gen/core + src-gen/someip + ${COMMONAPI_INCLUDE_DIRS} + ${COMMONAPI_SOMEIP_INCLUDE_DIRS} + ${VSOMEIP_INCLUDE_DIRS} +) + +link_directories( + ${COMMONAPI_LIBDIR} + ${COMMONAPI_SOMEIP_CMAKE_DIR}/build + ${Boost_LIBRARY_DIR} +) + +if (MSVC) + set(LINK_LIBRARIES CommonAPI) +else() + set(LINK_LIBRARIES -Wl,--as-needed CommonAPI) +endif() + +# Build Client +add_executable(${PRJ_NAME_CLIENT} ${PRJ_CLIENT_SRCS}) +target_link_libraries(${PRJ_NAME_CLIENT} ${LINK_LIBRARIES} ${VSOMEIP_LIBRARIES}) + +# Build service +add_executable(${PRJ_NAME_SERVICE} ${PRJ_SERVICE_SRCS}) +target_link_libraries(${PRJ_NAME_SERVICE} ${LINK_LIBRARIES} ${VSOMEIP_LIBRARIES}) + +# Build SOME/IP library +add_library (${PRJ_NAME}-someip SHARED ${PRJ_SOMEIP_LIB_SRCS}) +target_link_libraries(${PRJ_NAME}-someip CommonAPI-SomeIP) diff --git a/CommonAPI-Examples/E08CrcProtection/README.md b/CommonAPI-Examples/E08CrcProtection/README.md new file mode 100644 index 0000000..6d91b0d --- /dev/null +++ b/CommonAPI-Examples/E08CrcProtection/README.md @@ -0,0 +1,460 @@ +# Example 8: CRC Protection + +This example was created to demonstrate how the e2e implementation can be used on the CommonAPI layer. Please note that this example can only be correctly used if the Service and the Client are running on distinct machines/ECUs. +First consider the Franca IDL specification of example 8 **E08CrcProtection.fidl**: + +```java +package commonapi.examples + +interface E08CrcProtection { + version { major 1 minor 0 } + + attribute CommonTypes.aStruct aOK + attribute CommonTypes.aStruct aERROR +} + +typeCollection CommonTypes { + version { major 1 minor 0 } + + struct aStruct { + UInt16 CommonCRCLength + UInt16 CommonCRCCounter + UInt32 CommonCRCID + UInt32 CommonCRC + UInt16 value1 + UInt16 value2 + } +} +``` + +The following CRC related fields in the *aStruct* (*CommonCRCLength*, *CommonCRCCounter*, *CommonCRCID*, *CommonCRC*) are automatically computed and setted using the required e2e definitions on the .json file. +In this example we will demonstrate how distinct e2e definitions on the configuration file for the service and the client for the *aERROR* attribute lead to a *CallStatus::INVALID_VALUE* on a changed event notification, after a subscription. + +Let's start by the configuration file used for the service **vsomeip-service.json**: + +```json +{ + "unicast" : "192.168.0.2", + "logging" : + { + "level" : "debug", + "console" : "true", + "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" }, + "dlt" : "false" + }, + "applications" : + [ + { + "name" : "service-sample", + "id" : "0x1277" + } + ], + "services" : + [ + { + "service" : "0x1234", + "instance" : "0x5678", + "reliable" : { "port" : "30499", "enable-magic-cookies" : "false" } + } + ], + "e2e" : + { + "e2e_enabled" : "true", + "protected" : + [ + { + "service_id" : "0x1234", + "event_id" : "0x80e9", + "profile" : "P04", + "variant" : "protector", + "crc_offset" : "64", + "data_id" : "0xFF" + }, + { + "service_id" : "0x1234", + "event_id" : "0x80ea", + "profile" : "P04", + "variant" : "protector", + "crc_offset" : "64", + "data_id" : "0xFF" + } + ] + }, + "routing" : "service-sample", + "service-discovery" : + { + "enable" : "true", + "multicast" : "224.244.224.245", + "port" : "30490", + "protocol" : "udp" + } +} +``` + +And bellow the configuration file used for the client **vsomeip-client.json**: + +```json +{ + "unicast" : "10.0.3.1", + "netmask" : "255.255.255.0", + "logging" : + { + "level" : "debug", + "console" : "true", + "file" : { "enable" : "true", "path" : "/var/log/vsomeip.log" }, + "dlt" : "true" + }, + "applications" : + [ + { + "name" : "client-sample", + "id" : "0x1343" + } + ], + "e2e" : + { + "e2e_enabled" : "true", + "protected" : + [ + { + "service_id" : "0x1234", + "event_id" : "0x80e9", + "profile" : "P04", + "variant" : "checker", + "crc_offset" : "64", + "data_id" : "0xFF" + }, + { + "service_id" : "0x1234", + "event_id" : "0x80ea", + "profile" : "P04", + "variant" : "checker", + "crc_offset" : "64", + "data_id" : "0x00" + } + ] + }, + "routing" : "client-sample", + "service-discovery" : + { + "enable" : "true", + "multicast" : "224.244.224.245", + "port" : "30490", + "protocol" : "udp" + } +} +``` + +Between both it is possible to see, in the e2e definitions, that the *data_id* for the *aERROR* attribute (*event_id 0x80ea*) has distinct values between the service and the client, *0xFF* vs *0x00*, while the definitions for the *aOK* attribute (*event_id 0x80e9*) match. +Please note that the first definition, *unicast* will need to be adapted to your specific setup. + +Now let's have a look to the CommonAPI code on the service side, that is splitted between the following 3 files: + +* **E08CrcProtectionStubImpl.hpp**: +```cpp +#ifndef E08CRCPROTECTIONSTUBIMPL_HPP_ +#define E08CRCPROTECTIONSTUBIMPL_HPP_ + +#include +#include + +class E08CrcProtectionStubImpl: public v1_0::commonapi::examples::E08CrcProtectionStubDefault { + +public: + E08CrcProtectionStubImpl(); + virtual ~E08CrcProtectionStubImpl(); + virtual void incCounter(); + +private: + int cnt; +}; + +#endif // E08CRCPROTECTIONSTUBIMPL_HPP_ +``` + +* **E08CrcProtectionStubImpl.cpp**: +```cpp +#include "E08CrcProtectionStubImpl.hpp" + +using namespace v1::commonapi::examples; + +E08CrcProtectionStubImpl::E08CrcProtectionStubImpl() { + cnt = 0; +} + +E08CrcProtectionStubImpl::~E08CrcProtectionStubImpl() { +} + +void E08CrcProtectionStubImpl::incCounter() { + cnt++; + + CommonTypes::aStruct aOK, aERROR; + aOK.setValue1((uint16_t)cnt); + aOK.setValue2((uint16_t)cnt+1); + setAOKAttribute(aOK); + + aERROR.setValue1((uint16_t)cnt); + aERROR.setValue2((uint16_t)cnt+2); + setAERRORAttribute(aERROR); + std::cout << "New counter value = " << cnt << "!" << std::endl; +} +``` + +* **E08CrcProtectionService.cpp**: +```cpp +#include +#include + +#include +#include "E08CrcProtectionStubImpl.hpp" + +int main() { + CommonAPI::Runtime::setProperty("LogContext", "E08S"); + CommonAPI::Runtime::setProperty("LogApplication", "E08S"); + CommonAPI::Runtime::setProperty("LibraryBase", "E08CrcProtection"); + + std::shared_ptr runtime = CommonAPI::Runtime::get(); + + std::string domain = "local"; + std::string instance = "commonapi.examples.Attributes"; + 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 attributes, see stub implementation + std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl; + std::this_thread::sleep_for(std::chrono::seconds(5)); + } + return 0; +} +``` + +On these implementations we can see that the service side starts by registering a service and if successful, starts incrementing a counter every 5 seconds that is used to set new values into the attributes *aOK* and *aERROR*. Notice that none of the CRC fields are setted explicitly. + +Now, we move into the implementation for the client side in **E08CrcProtectionClient.cpp**: +```cpp +#include +#include + +#ifndef _WIN32 +#include +#endif + +#include +#include +#include + +using namespace v1::commonapi::examples; + +int main() { + CommonAPI::Runtime::setProperty("LogContext", "E08C"); + CommonAPI::Runtime::setProperty("LogApplication", "E08C"); + CommonAPI::Runtime::setProperty("LibraryBase", "E08CrcProtection"); + + std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get(); + + std::string domain = "local"; + std::string instance = "commonapi.examples.Attributes"; + 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)); + } + + CommonTypes::aStruct aOK, aERROR; + CommonAPI::CallInfo info(1000); + info.sender_ = 5678; + + // Subscribe aOK for receiving values + myProxy->getAOKAttribute().getChangedEvent().subscribe( + [&](const CommonTypes::aStruct& val) { + std::cout << "Received change message on aOK:" << std::endl + << "\tCommonCRCLength: " << val.getCommonCRCLength() << std::endl + << "\tCommonCRCCounter: " << val.getCommonCRCCounter() << std::endl + << "\tCommonCRCID: " << val.getCommonCRCID() << std::endl + << "\tCommonCRC: " << val.getCommonCRC() << std::endl + << "\tvalue1: " << val.getValue1() << std::endl + << "\tvalue2: " << val.getValue2() << std::endl; + }, + [&](const CommonAPI::CallStatus &status) { + if (status == CommonAPI::CallStatus::INVALID_VALUE) { + std::cout << "Subscription (Changed Event) of aOK attribute returned CallStatus==INVALID_VALUE" << std::endl; + // do something... (no eventhandler gets called in case of INVALID_VALUE status) + } else if (status == CommonAPI::CallStatus::SUCCESS) { + std::cout << "Got valid response for aOK Async getter" << std::endl; + } + } + ); + + // Subscribe aERROR for receiving values + myProxy->getAERRORAttribute().getChangedEvent().subscribe( + [&](const CommonTypes::aStruct& val) { + std::cout << "Received change message on aERROR:" << std::endl + << "\tCommonCRCLength: " << val.getCommonCRCLength() << std::endl + << "\tCommonCRCCounter: " << val.getCommonCRCCounter() << std::endl + << "\tCommonCRCID: " << val.getCommonCRCID() << std::endl + << "\tCommonCRC: " << val.getCommonCRC() << std::endl + << "\tvalue1: " << val.getValue1() << std::endl + << "\tvalue2: " << val.getValue2() << std::endl; + }, + [&](const CommonAPI::CallStatus &status) { + if (status == CommonAPI::CallStatus::INVALID_VALUE) { + std::cout << "Subscription (Changed Event) of aERROR attribute returned CallStatus==INVALID_VALUE" << std::endl; + // do something... (no eventhandler gets called in case of INVALID_VALUE status) + } else if (status == CommonAPI::CallStatus::SUCCESS) { + std::cout << "Got valid response for aERROR Async getter" << std::endl; + } + } + ); + + while (true) { + std::this_thread::sleep_for(std::chrono::seconds(1)); + } +} +``` + +The client, after a successful build of the proxy, uses the *getAOKAttribute* and *getAERRORAttribute* methods to subscribe to change events on the attributes *aOK* and *aERROR*, respectively. Every notification/access returns a flag named *callStatus* (please see the CommonAPI specification), that has the value *SUCCESS* if everything is working as supposed or a different value if not, in this case, it returns an *INVALID_VALUE* if the CRC values do not match between the computed values for the client and for the service. + +Next we will present some logs of the execution of the service and the client on different machines, respectively: +```bash +bmw:/mnt/E08CrcProtection$ VSOMEIP_CONFIGURATION=vsomeip-service.json COMMONAPI_CONFIG=$PWD/commonapi4someip.ini LD_LIBRARY_PATH=/lib:$PWD/build build/E08CrcProtectionService +[CAPI][INFO] Loading configuration file '/mnt/E08CrcProtection/commonapi4someip.ini' +[CAPI][INFO] Using default binding 'someip' +[CAPI][INFO] Using default shared library folder '/usr/local/lib/commonapi' +[CAPI][DEBUG] Loading library for local:commonapi.examples.E08CrcProtection:v1_0:commonapi.examples.Attributes stub. +[CAPI][INFO] Loading configuration file /etc//commonapi-someip.ini +[CAPI][DEBUG] Added address mapping: local:commonapi.examples.E08CrcProtection:v1_0:commonapi.examples.Attributes <--> [1234.0001(1.0)] +[CAPI][VERBOSE] Registering function for creating "commonapi.examples.E08CrcProtection:v1_0" proxy. +[CAPI][INFO] Registering function for creating "commonapi.examples.E08CrcProtection:v1_0" stub adapter. +[CAPI][DEBUG] Loading interface library "libE08CrcProtection-someip.so" succeeded. +[CAPI][INFO] Registering stub for "local:commonapi.examples.E08CrcProtection:v1_0:commonapi.examples.Attributes" +[326189.926872]~DLT~ 135~INFO ~FIFO /tmp/dlt cannot be opened. Retrying later... +2022-09-12 15:10:32.092482 [info] Parsed vsomeip configuration in 2ms +2022-09-12 15:10:32.093414 [info] Using configuration file: "/mnt/E08CrcProtection/vsomeip-service.json". +2022-09-12 15:10:32.093760 [info] Configuration module loaded. +2022-09-12 15:10:32.093986 [info] Initializing vsomeip application "service-sample". +2022-09-12 15:10:32.094746 [info] Instantiating routing manager [Host]. +2022-09-12 15:10:32.096105 [info] create_routing_root: Local routing @ /tmp/vsomeip-0 +2022-09-12 15:10:32.097361 [info] Service Discovery enabled. Trying to load module. +2022-09-12 15:10:32.104329 [info] Service Discovery module loaded. +2022-09-12 15:10:32.104857 [info] E2E protection enabled. +2022-09-12 15:10:32.110159 [info] E2E module loaded. +2022-09-12 15:10:32.110622 [info] vsomeip tracing not enabled. . vsomeip service discovery tracing not enabled. +2022-09-12 15:10:32.110774 [info] Application(service-sample, 1277) is initialized (11, 100). +2022-09-12 15:10:32.111913 [info] Starting vsomeip application "service-sample" (1277) using 2 threads I/O nice 255 +2022-09-12 15:10:32.113024 [info] main dispatch thread id from application: 1277 (service-sample) is: 7fe1d249a700 TID: 141 +2022-09-12 15:10:32.113515 [info] shutdown thread id from application: 1277 (service-sample) is: 7fe1d1c99700 TID: 142 +2022-09-12 15:10:32.114162 [info] offer_eventEvent [1234.0001.80e9.] cycle time: 0 +2022-09-12 15:10:32.114572 [info] REGISTER EVENT(1277): [1234.0001.80e9:is_provider=true] +2022-09-12 15:10:32.114988 [info] Watchdog is disabled! +2022-09-12 15:10:32.115964 [info] offer_eventEvent [1234.0001.80ea.] cycle time: 0 +2022-09-12 15:10:32.116259 [info] io thread id from application: 1277 (service-sample) is: 7fe1d2c9b700 TID: 140 +2022-09-12 15:10:32.116247 [info] io thread id from application: 1277 (service-sample) is: 7fe1d0c97700 TID: 144 +2022-09-12 15:10:32.116362 [info] REGISTER EVENT(1277): [1234.0001.80ea:is_provider=true] +2022-09-12 15:10:32.117399 [info] vSomeIP 3.2.19 | (default) +2022-09-12 15:10:32.117708 [info] OFFER(1277): [1234.0001:1.0] (true) +2022-09-12 15:10:32.118129 [info] Network interface "eth0" state changed: up +2022-09-12 15:10:32.118839 [info] create_local_server: Listening @ /tmp/vsomeip-1277 +2022-09-12Successfully Registered Service! +15:10:32.119157 [info] Route "default route (0.0.0.0/0) if: eth0 gw: 10.0.3.1" state changed: up +New counter value = 1! +Waiting for calls... (Abort with CTRL+C) +2022-09-12 15:10:32.124982 [debug] Joining to multicast group 224.244.224.245 from 10.0.3.5 +2022-09-12 15:10:32.126384 [info] SOME/IP routing ready. +New counter value = 2! +Waiting for calls... (Abort with CTRL+C) +2022-09-12 15:10:42.122139 [info] vSomeIP 3.2.19 | (default) +New counter value = 3! +Waiting for calls... (Abort with CTRL+C) +2022-09-12 15:10:44.210599 [info] REMOTE SUBSCRIBE(0000): [1234.0001.0001] from 10.0.3.1:45025 reliable was accepted +2022-09-12 15:10:44.215350 [info] REMOTE SUBSCRIBE(0000): [1234.0001.0002] from 10.0.3.1:45025 reliable was accepted +New counter value = 4! +Waiting for calls... (Abort with CTRL+C) +``` + +```bash +bmw:~/Documents/commonapi-core-generator/CommonAPI-Examples/E08CrcProtection$ VSOMEIP_CONFIGURATION=vsomeip-client.json COMMONAPI_CONFIG=$PWD/commonapi4someip.ini LD_LIBRARY_PATH=../../../install_folder/lib:$PWD/build build/E08CrcProtectionClient +[326380.518559]~DLT~2809822~INFO ~FIFO /tmp/dlt cannot be opened. Retrying later... +[CAPI][INFO] Loading configuration file '/home/bmw/Documents/commonapi-core-generator/CommonAPI-Examples/E08CrcProtection/commonapi4someip.ini' +[CAPI][INFO] Using default binding 'someip' +[CAPI][INFO] Using default shared library folder '/usr/local/lib/commonapi' +[CAPI][DEBUG] Loading library for local:commonapi.examples.E08CrcProtection:v1_0:commonapi.examples.Attributes proxy. +[CAPI][INFO] Loading configuration file /etc//commonapi-someip.ini +[CAPI][DEBUG] Added address mapping: local:commonapi.examples.E08CrcProtection:v1_0:commonapi.examples.Attributes <--> [1234.0001(1.0)] +[CAPI][VERBOSE] Registering function for creating "commonapi.examples.E08CrcProtection:v1_0" proxy. +[CAPI][INFO] Registering function for creating "commonapi.examples.E08CrcProtection:v1_0" stub adapter. +[CAPI][DEBUG] Loading interface library "libE08CrcProtection-someip.so" succeeded. +[CAPI][VERBOSE] Creating proxy for "local:commonapi.examples.E08CrcProtection:v1_0:commonapi.examples.Attributes" +2022-09-12 16:13:42.156045 [info] Parsed vsomeip configuration in 1ms +2022-09-12 16:13:42.161035 [info] Using configuration file: "vsomeip-client.json". +2022-09-12 16:13:42.162321 [info] Configuration module loaded. +2022-09-12 16:13:42.163433 [info] Initializing vsomeip application "client-sample". +2022-09-12 16:13:42.168211 [info] Instantiating routing manager [Host]. +2022-09-12 16:13:42.176024 [info] create_routing_root: Local routing @ /tmp/vsomeip-0 +2022-09-12 16:13:42.181899 [info] Service Discovery enabled. Trying to load module. +2022-09-12 16:13:42.200256 [info] Service Discovery module loaded. +2022-09-12 16:13:42.202122 [info] E2E protection enabled. +2022-09-12 16:13:42.209612 [info] E2E module loaded. +2022-09-12 16:13:42.211254 [info] vsomeip tracing not enabled. . vsomeip service discovery tracing not enabled. +2022-09-12 16:13:42.212131 [info] Application(client-sample, 1343) is initialized (11, 100). +2022-09-12 16:13:42.215525 [info] Starting vsomeip application "client-sample" (1343) using 2 threads I/O nice 255 +2022-09-12 16:13:42.217985 [info] REGISTER EVENT(1343): [1234.0001.80e9:is_provider=false] +2022-09-12 16:13:42.218794 [info] main dispatch thread id from application: 1343 (client-sample) is: 7fe949c1c640 TID: 2809828 +2022-09-12 16:13:42.219878 [info] shutdown thread id from application: 1343 (client-sample) is: 7fe94941b640 TID: 2809829 +2022-09-12 16:13:42.219629 [info] REGISTER EVENT(1343): [1234.0001.80ea:is_provider=false] +2022-09-12 16:13:42.222334 [info] Watchdog is disabled! +2022-09-12 16:13:42.223218 [info] REQUEST(1343): [1234.0001:1.4294967295] +2022-09-12 16:13:42.225445 [info] io thread id from application: 1343 (client-sample) is: 7fe94a41d640 TID: 2809827 +2022-09-12 16:13:42.225453 [info] io thread id from application: 1343 (client-sample) is: 7fe93bfff640 TID: 2809831 +2022-09-12 16:13:42.228753 [info] create_local_server: Listening @ /tmp/vsomeip-1343 +2022-09-12 16:13:42.230708 [info] Network interface "lxcbr0" state changed: up +2022-09-12 16:13:42.233703 [info] Route "224.0.0.0/4 if: lxcbr0 gw: n/a" state changed: up +2022-09-12 16:13:42.229153 [info] vSomeIP 3.2.19 | (default) +2022-09-12 16:13:42.234239 [info] SUBSCRIBE(1343): [1234.0001.0001:80e9:1] +2022-09-12 16:13:42.237934 [info] SUBSCRIBE(1343): [1234.0001.0002:80ea:1] +2022-09-12 16:13:42.238613 [info] udp_server_endpoint_impl: SO_RCVBUF is: 212992 +Waiting for service to become available. +2022-09-12 16:13:42.240588 [debug] Joining to multicast group 224.244.224.245 from 10.0.3.1 +2022-09-12 16:13:42.242950 [info] SOME/IP routing ready. +Got valid response for aOK Async getter +Got valid response for aERROR Async getter +2022-09-12 16:13:43.714948 [info] E2E protection: CRC check failed for service: 1234 method: 80ea +Received change message on aOK + CommonCRCLength: 24 + CommonCRCCounter: 41 + CommonCRCID: 16777471 + CommonCRC: 758244104 + value1: 2 + value2: 3 +Subscription (Changed Event) of aOK attribute returned CallStatus==INVALID_VALUE +2022-09-12 16:13:47.341330 [info] E2E protection: CRC check failed for service: 1234 method: 80ea +Received change message on aOK: + CommonCRCLength: 24 + CommonCRCCounter: 42 + CommonCRCID: 16777471 + CommonCRC: 3547810833 + value1: 3 + value2: 4 +Subscription (Changed Event) of aOK attribute returned CallStatus==INVALID_VALUE +2022-09-12 16:13:52.349024 [info] E2E protection: CRC check failed for service: 1234 method: 80ea +Received change message on aOK: + CommonCRCLength: 24 + CommonCRCCounter: 43 + CommonCRCID: 16777471 + CommonCRC: 1160927003 + value1: 4 + value2: 5 +Subscription (Changed Event) of aOK attribute returned CallStatus==INVALID_VALUE +``` + +On the Client side we can see, that even though both subscriptions receive a valid response, on every change event notification, it is possible to obtain the *aOK* attribute values, including the automatically set CRC values, but the notification for the *aERROR* attribute always returns an *INVALID_VALUE*, due to the CRC check failed for this method. \ No newline at end of file diff --git a/CommonAPI-Examples/E08CrcProtection/commonapi4someip.ini b/CommonAPI-Examples/E08CrcProtection/commonapi4someip.ini new file mode 100644 index 0000000..9d2e519 --- /dev/null +++ b/CommonAPI-Examples/E08CrcProtection/commonapi4someip.ini @@ -0,0 +1,8 @@ +[default] +binding=someip + +[logging] +console = true +file = ./mylog.log +dlt = true +level = verbose diff --git a/CommonAPI-Examples/E08CrcProtection/fidl/E08CrcProtection.fdepl b/CommonAPI-Examples/E08CrcProtection/fidl/E08CrcProtection.fdepl new file mode 100644 index 0000000..30800e6 --- /dev/null +++ b/CommonAPI-Examples/E08CrcProtection/fidl/E08CrcProtection.fdepl @@ -0,0 +1,48 @@ +/* Copyright (C) 2022 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-4-SOMEIP_deployment_spec.fdepl" +import "E08CrcProtection.fidl" + +define org.genivi.commonapi.someip.deployment for interface commonapi.examples.E08CrcProtection { + SomeIpServiceID = 4660 + + attribute aOK { + SomeIpGetterID = 3001 + SomeIpSetterID = 3002 + SomeIpNotifierID = 33001 + SomeIpNotifierEventGroups = { 1 } + + SomeIpAttributeReliable = true + } + + attribute aERROR { + SomeIpGetterID = 3003 + SomeIpSetterID = 3004 + SomeIpNotifierID = 33002 + SomeIpNotifierEventGroups = { 2 } + + SomeIpAttributeReliable = true + } +} + +define org.genivi.commonapi.someip.deployment for typeCollection commonapi.examples.CommonTypes { + + struct aStruct { + } + +} + +define org.genivi.commonapi.someip.deployment for provider as Service { + instance commonapi.examples.E08CrcProtection { + InstanceId = "commonapi.examples.Attributes" + + SomeIpInstanceID = 22136 + + SomeIpUnicastAddress = "192.168.0.2" + SomeIpReliableUnicastPort = 30509 + SomeIpUnreliableUnicastPort = 0 + } +} diff --git a/CommonAPI-Examples/E08CrcProtection/fidl/E08CrcProtection.fidl b/CommonAPI-Examples/E08CrcProtection/fidl/E08CrcProtection.fidl new file mode 100644 index 0000000..e8b2772 --- /dev/null +++ b/CommonAPI-Examples/E08CrcProtection/fidl/E08CrcProtection.fidl @@ -0,0 +1,26 @@ +/* Copyright (C) 2022 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 + +interface E08CrcProtection { + version { major 1 minor 0 } + + attribute CommonTypes.aStruct aOK + attribute CommonTypes.aStruct aERROR +} + +typeCollection CommonTypes { + version { major 1 minor 0 } + + struct aStruct { + UInt16 CommonCRCLength + UInt16 CommonCRCCounter + UInt32 CommonCRCID + UInt32 CommonCRC + UInt16 value1 + UInt16 value2 + } +} \ No newline at end of file diff --git a/CommonAPI-Examples/E08CrcProtection/src/E08CrcProtectionClient.cpp b/CommonAPI-Examples/E08CrcProtection/src/E08CrcProtectionClient.cpp new file mode 100644 index 0000000..81f07ea --- /dev/null +++ b/CommonAPI-Examples/E08CrcProtection/src/E08CrcProtectionClient.cpp @@ -0,0 +1,86 @@ +// Copyright (C) 2022 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 + +#ifndef _WIN32 +#include +#endif + +#include +#include +#include + +using namespace v1::commonapi::examples; + +int main() { + CommonAPI::Runtime::setProperty("LogContext", "E08C"); + CommonAPI::Runtime::setProperty("LogApplication", "E08C"); + CommonAPI::Runtime::setProperty("LibraryBase", "E08CrcProtection"); + + std::shared_ptr < CommonAPI::Runtime > runtime = CommonAPI::Runtime::get(); + + std::string domain = "local"; + std::string instance = "commonapi.examples.Attributes"; + 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)); + } + + CommonTypes::aStruct aOK, aERROR; + CommonAPI::CallInfo info(1000); + info.sender_ = 5678; + + // Subscribe aOK for receiving values + myProxy->getAOKAttribute().getChangedEvent().subscribe( + [&](const CommonTypes::aStruct& val) { + std::cout << "Received change message on aOK:" << std::endl + << "\tCommonCRCLength: " << val.getCommonCRCLength() << std::endl + << "\tCommonCRCCounter: " << val.getCommonCRCCounter() << std::endl + << "\tCommonCRCID: " << val.getCommonCRCID() << std::endl + << "\tCommonCRC: " << val.getCommonCRC() << std::endl + << "\tvalue1: " << val.getValue1() << std::endl + << "\tvalue2: " << val.getValue2() << std::endl; + }, + [&](const CommonAPI::CallStatus &status) { + if (status == CommonAPI::CallStatus::INVALID_VALUE) { + std::cout << "Subscription (Changed Event) of aOK attribute returned CallStatus==INVALID_VALUE" << std::endl; + // do something... (no eventhandler gets called in case of INVALID_VALUE status) + } else if (status == CommonAPI::CallStatus::SUCCESS) { + std::cout << "Got valid response for aOK Async getter" << std::endl; + } + } + ); + + // Subscribe aERROR for receiving values + myProxy->getAERRORAttribute().getChangedEvent().subscribe( + [&](const CommonTypes::aStruct& val) { + std::cout << "Received change message on aERROR:" << std::endl + << "\tCommonCRCLength: " << val.getCommonCRCLength() << std::endl + << "\tCommonCRCCounter: " << val.getCommonCRCCounter() << std::endl + << "\tCommonCRCID: " << val.getCommonCRCID() << std::endl + << "\tCommonCRC: " << val.getCommonCRC() << std::endl + << "\tvalue1: " << val.getValue1() << std::endl + << "\tvalue2: " << val.getValue2() << std::endl; + }, + [&](const CommonAPI::CallStatus &status) { + if (status == CommonAPI::CallStatus::INVALID_VALUE) { + std::cout << "Subscription (Changed Event) of aERROR attribute returned CallStatus==INVALID_VALUE" << std::endl; + // do something... (no eventhandler gets called in case of INVALID_VALUE status) + } else if (status == CommonAPI::CallStatus::SUCCESS) { + std::cout << "Got valid response for aERROR Async getter" << std::endl; + } + } + ); + + while (true) { + std::this_thread::sleep_for(std::chrono::seconds(1)); + } +} diff --git a/CommonAPI-Examples/E08CrcProtection/src/E08CrcProtectionService.cpp b/CommonAPI-Examples/E08CrcProtection/src/E08CrcProtectionService.cpp new file mode 100644 index 0000000..87a77b4 --- /dev/null +++ b/CommonAPI-Examples/E08CrcProtection/src/E08CrcProtectionService.cpp @@ -0,0 +1,37 @@ +// Copyright (C) 2022 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 "E08CrcProtectionStubImpl.hpp" + +int main() { + CommonAPI::Runtime::setProperty("LogContext", "E08S"); + CommonAPI::Runtime::setProperty("LogApplication", "E08S"); + CommonAPI::Runtime::setProperty("LibraryBase", "E08CrcProtection"); + + std::shared_ptr runtime = CommonAPI::Runtime::get(); + + std::string domain = "local"; + std::string instance = "commonapi.examples.Attributes"; + 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 attributes, see stub implementation + std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl; + std::this_thread::sleep_for(std::chrono::seconds(5)); + } + return 0; +} diff --git a/CommonAPI-Examples/E08CrcProtection/src/E08CrcProtectionStubImpl.cpp b/CommonAPI-Examples/E08CrcProtection/src/E08CrcProtectionStubImpl.cpp new file mode 100644 index 0000000..4ca91cd --- /dev/null +++ b/CommonAPI-Examples/E08CrcProtection/src/E08CrcProtectionStubImpl.cpp @@ -0,0 +1,29 @@ +// Copyright (C) 2022 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 "E08CrcProtectionStubImpl.hpp" + +using namespace v1::commonapi::examples; + +E08CrcProtectionStubImpl::E08CrcProtectionStubImpl() { + cnt = 0; +} + +E08CrcProtectionStubImpl::~E08CrcProtectionStubImpl() { +} + +void E08CrcProtectionStubImpl::incCounter() { + cnt++; + + CommonTypes::aStruct aOK, aERROR; + aOK.setValue1((uint16_t)cnt); + aOK.setValue2((uint16_t)cnt+1); + setAOKAttribute(aOK); + + aERROR.setValue1((uint16_t)cnt); + aERROR.setValue2((uint16_t)cnt+2); + setAERRORAttribute(aERROR); + std::cout << "New counter value = " << cnt << "!" << std::endl; +} diff --git a/CommonAPI-Examples/E08CrcProtection/src/E08CrcProtectionStubImpl.hpp b/CommonAPI-Examples/E08CrcProtection/src/E08CrcProtectionStubImpl.hpp new file mode 100644 index 0000000..0a2a758 --- /dev/null +++ b/CommonAPI-Examples/E08CrcProtection/src/E08CrcProtectionStubImpl.hpp @@ -0,0 +1,23 @@ +// Copyright (C) 2022 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 E08CRCPROTECTIONSTUBIMPL_HPP_ +#define E08CRCPROTECTIONSTUBIMPL_HPP_ + +#include +#include + +class E08CrcProtectionStubImpl: public v1_0::commonapi::examples::E08CrcProtectionStubDefault { + +public: + E08CrcProtectionStubImpl(); + virtual ~E08CrcProtectionStubImpl(); + virtual void incCounter(); + +private: + int cnt; +}; + +#endif // E08CRCPROTECTIONSTUBIMPL_HPP_ diff --git a/CommonAPI-Examples/E08CrcProtection/vsomeip-client.json b/CommonAPI-Examples/E08CrcProtection/vsomeip-client.json new file mode 100644 index 0000000..d3546b9 --- /dev/null +++ b/CommonAPI-Examples/E08CrcProtection/vsomeip-client.json @@ -0,0 +1,49 @@ +{ + "unicast" : "10.0.3.1", + "netmask" : "255.255.255.0", + "logging" : + { + "level" : "debug", + "console" : "true", + "file" : { "enable" : "true", "path" : "/var/log/vsomeip.log" }, + "dlt" : "true" + }, + "applications" : + [ + { + "name" : "client-sample", + "id" : "0x1343" + } + ], + "e2e" : + { + "e2e_enabled" : "true", + "protected" : + [ + { + "service_id" : "0x1234", + "event_id" : "0x80e9", + "profile" : "P04", + "variant" : "checker", + "crc_offset" : "64", + "data_id" : "0xFF" + }, + { + "service_id" : "0x1234", + "event_id" : "0x80ea", + "profile" : "P04", + "variant" : "checker", + "crc_offset" : "64", + "data_id" : "0x00" + } + ] + }, + "routing" : "client-sample", + "service-discovery" : + { + "enable" : "true", + "multicast" : "224.244.224.245", + "port" : "30490", + "protocol" : "udp" + } +} diff --git a/CommonAPI-Examples/E08CrcProtection/vsomeip-service.json b/CommonAPI-Examples/E08CrcProtection/vsomeip-service.json new file mode 100644 index 0000000..9c42932 --- /dev/null +++ b/CommonAPI-Examples/E08CrcProtection/vsomeip-service.json @@ -0,0 +1,56 @@ +{ + "unicast" : "192.168.0.2", + "logging" : + { + "level" : "debug", + "console" : "true", + "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" }, + "dlt" : "false" + }, + "applications" : + [ + { + "name" : "service-sample", + "id" : "0x1277" + } + ], + "services" : + [ + { + "service" : "0x1234", + "instance" : "0x5678", + "reliable" : { "port" : "30499", "enable-magic-cookies" : "false" } + } + ], + "e2e" : + { + "e2e_enabled" : "true", + "protected" : + [ + { + "service_id" : "0x1234", + "event_id" : "0x80e9", + "profile" : "P04", + "variant" : "protector", + "crc_offset" : "64", + "data_id" : "0xFF" + }, + { + "service_id" : "0x1234", + "event_id" : "0x80ea", + "profile" : "P04", + "variant" : "protector", + "crc_offset" : "64", + "data_id" : "0xFF" + } + ] + }, + "routing" : "service-sample", + "service-discovery" : + { + "enable" : "true", + "multicast" : "224.244.224.245", + "port" : "30490", + "protocol" : "udp" + } +} diff --git a/README.md b/README.md index ef982e2..2839faa 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ ### CommonAPI C++ Core Tools ##### Copyright -Copyright (C) 2015-2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG). -Copyright (C) 2015-202 GENIVI Alliance, Inc. +Copyright (C) 2015-2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG). +Copyright (C) 2015-2023, COVESA -This file is part of GENIVI Project IPC Common API C++. -Contributions are licensed to the GENIVI Alliance under one or more Contribution License Agreements or MPL 2.0. +This file is part of COVESA Project IPC Common API C++. +Contributions are licensed to the COVESA under one or more Contribution License Agreements or MPL 2.0. ##### License 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/. @@ -14,7 +14,7 @@ This Source Code Form is subject to the terms of the Mozilla Public License, v. The specification document and the user guide can be found in the CommonAPI documentation directory of the CommonAPI-Tools project. ##### Further information -https://COVESA.github.io/capicxx-core-tools/ +https://covesa.github.io/capicxx-core-tools/ ##### Build Instructions for Linux diff --git a/org.genivi.commonapi.console.feature/feature.xml b/org.genivi.commonapi.console.feature/feature.xml index b813c00..9044d61 100644 --- a/org.genivi.commonapi.console.feature/feature.xml +++ b/org.genivi.commonapi.console.feature/feature.xml @@ -2,7 +2,7 @@ @@ -18,7 +18,7 @@ - + commonapi org.genivi.commonapi.releng - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT ../org.genivi.commonapi.releng \ No newline at end of file diff --git a/org.genivi.commonapi.console.franca.feature/feature.xml b/org.genivi.commonapi.console.franca.feature/feature.xml index 52f0e55..2d3b536 100644 --- a/org.genivi.commonapi.console.franca.feature/feature.xml +++ b/org.genivi.commonapi.console.franca.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/org.genivi.commonapi.console.franca.feature/pom.xml b/org.genivi.commonapi.console.franca.feature/pom.xml index a5e5bb6..c58a039 100644 --- a/org.genivi.commonapi.console.franca.feature/pom.xml +++ b/org.genivi.commonapi.console.franca.feature/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.releng - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT ../org.genivi.commonapi.releng \ No newline at end of file diff --git a/org.genivi.commonapi.console/META-INF/MANIFEST.MF b/org.genivi.commonapi.console/META-INF/MANIFEST.MF index 7857d83..8264081 100644 --- a/org.genivi.commonapi.console/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.console/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GENIVI CommonAPI Console Bundle-SymbolicName: org.genivi.commonapi.console;singleton:=true -Bundle-Version: 3.2.0.qualifier +Bundle-Version: 3.2.14.qualifier Bundle-Vendor: BMW AG Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.8.0,4.0.0)";visibility:=reexport, org.apache.commons.cli;bundle-version="[1.2.0,2.0.0)";visibility:=reexport, diff --git a/org.genivi.commonapi.console/about.mappings b/org.genivi.commonapi.console/about.mappings index 06a3d8f..ac6eba3 100644 --- a/org.genivi.commonapi.console/about.mappings +++ b/org.genivi.commonapi.console/about.mappings @@ -1,3 +1,3 @@ -0=3.2.0 -1=20200114 +0=3.2.14 +1=20230803 2=$sun.arch.data.model$ diff --git a/org.genivi.commonapi.console/pom.xml b/org.genivi.commonapi.console/pom.xml index 1618af1..ca5552f 100644 --- a/org.genivi.commonapi.console/pom.xml +++ b/org.genivi.commonapi.console/pom.xml @@ -8,7 +8,7 @@ commonapi org.genivi.commonapi.releng - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT ../org.genivi.commonapi.releng diff --git a/org.genivi.commonapi.core.cli.feature/feature.xml b/org.genivi.commonapi.core.cli.feature/feature.xml index ae857c9..a6641be 100644 --- a/org.genivi.commonapi.core.cli.feature/feature.xml +++ b/org.genivi.commonapi.core.cli.feature/feature.xml @@ -2,7 +2,7 @@ commonapi org.genivi.commonapi.core.releng - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT ../org.genivi.commonapi.core.releng diff --git a/org.genivi.commonapi.core.cli.product/category.xml b/org.genivi.commonapi.core.cli.product/category.xml index 19c7606..3e22ed4 100644 --- a/org.genivi.commonapi.core.cli.product/category.xml +++ b/org.genivi.commonapi.core.cli.product/category.xml @@ -1,9 +1,9 @@ - + - + diff --git a/org.genivi.commonapi.core.cli.product/commonapi_console.product b/org.genivi.commonapi.core.cli.product/commonapi_console.product index ef3b726..48eaa4e 100644 --- a/org.genivi.commonapi.core.cli.product/commonapi_console.product +++ b/org.genivi.commonapi.core.cli.product/commonapi_console.product @@ -1,13 +1,13 @@ - + - -Dosgi.requiredJavaVersion=1.8 -Xms512m -Xmx512m + -Dosgi.requiredJavaVersion=1.8 -Xms768m -Xmx1024m -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts diff --git a/org.genivi.commonapi.core.cli.product/pom.xml b/org.genivi.commonapi.core.cli.product/pom.xml index 2ac714c..959de93 100644 --- a/org.genivi.commonapi.core.cli.product/pom.xml +++ b/org.genivi.commonapi.core.cli.product/pom.xml @@ -144,7 +144,7 @@ commonapi org.genivi.commonapi.core.releng - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT ../org.genivi.commonapi.core.releng diff --git a/org.genivi.commonapi.core.cli/META-INF/MANIFEST.MF b/org.genivi.commonapi.core.cli/META-INF/MANIFEST.MF index 8e5dfa7..61d721c 100644 --- a/org.genivi.commonapi.core.cli/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.core.cli/META-INF/MANIFEST.MF @@ -2,14 +2,14 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GENIVI CommonAPI Core Console Interface Bundle-SymbolicName: org.genivi.commonapi.core.cli;singleton:=true -Bundle-Version: 3.2.0.qualifier +Bundle-Version: 3.2.14.qualifier Bundle-Activator: org.genivi.commonapi.core.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.13.1,0.14.0)";visibility:=reexport, org.franca.deploymodel.dsl;bundle-version="[0.13.1,0.14.0)";visibility:=reexport, - org.genivi.commonapi.core;bundle-version="3.2.0";visibility:=reexport, - org.genivi.commonapi.console;bundle-version="3.2.0" + org.genivi.commonapi.core;bundle-version="3.2.14";visibility:=reexport, + org.genivi.commonapi.console;bundle-version="3.2.14" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: BMW AG diff --git a/org.genivi.commonapi.core.cli/pom.xml b/org.genivi.commonapi.core.cli/pom.xml index 477ffbe..1cecb01 100644 --- a/org.genivi.commonapi.core.cli/pom.xml +++ b/org.genivi.commonapi.core.cli/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.core.releng - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT ../org.genivi.commonapi.core.releng diff --git a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandlineToolMain.java b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandlineToolMain.java index 1dd3cc9..5d8cc54 100644 --- a/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandlineToolMain.java +++ b/org.genivi.commonapi.core.cli/src/org/genivi/commonapi/core/cli/CommandlineToolMain.java @@ -27,6 +27,7 @@ import org.genivi.commonapi.core.preferences.FPreferences; import org.genivi.commonapi.core.preferences.PreferenceConstants; import org.genivi.commonapi.core.verification.CommandlineValidator; +import org.genivi.commonapi.core.verification.ValidateElements; import org.genivi.commonapi.core.verification.ValidatorCore; import com.google.inject.Guice; @@ -43,6 +44,7 @@ public class CommandlineToolMain extends CommandlineTool { protected Injector injector; protected IGenerator francaGenerator; protected String scope = "Core validation: "; + private ValidateElements validateElements = new ValidateElements(); private ValidationMessageAcceptor cliMessageAcceptor = new AbstractValidationMessageAcceptor() { @@ -190,6 +192,8 @@ private void validateCore(Resource resource) { if (model != null) { // check existence of imported fidl/fdepl files if (model instanceof FModel) { + validateElements.verifyEqualInOutAndAddSuffix((FModel)model); + cliValidator.validateImports((FModel) model, resource.getURI()); // validate against GENIVI rules diff --git a/org.genivi.commonapi.core.feature/feature.xml b/org.genivi.commonapi.core.feature/feature.xml index fefa2fc..6dbd383 100644 --- a/org.genivi.commonapi.core.feature/feature.xml +++ b/org.genivi.commonapi.core.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/org.genivi.commonapi.core.feature/pom.xml b/org.genivi.commonapi.core.feature/pom.xml index 4d87d4a..560b7d4 100644 --- a/org.genivi.commonapi.core.feature/pom.xml +++ b/org.genivi.commonapi.core.feature/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.core.releng - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT ../org.genivi.commonapi.core.releng diff --git a/org.genivi.commonapi.core.releng/pom.xml b/org.genivi.commonapi.core.releng/pom.xml index 616d5ea..5656f64 100644 --- a/org.genivi.commonapi.core.releng/pom.xml +++ b/org.genivi.commonapi.core.releng/pom.xml @@ -22,7 +22,7 @@ commonapi org.genivi.commonapi.releng - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT ../org.genivi.commonapi.releng diff --git a/org.genivi.commonapi.core.target/org.genivi.commonapi.core.target.target b/org.genivi.commonapi.core.target/org.genivi.commonapi.core.target.target index f4e7180..39852ec 100644 --- a/org.genivi.commonapi.core.target/org.genivi.commonapi.core.target.target +++ b/org.genivi.commonapi.core.target/org.genivi.commonapi.core.target.target @@ -32,6 +32,10 @@ + diff --git a/org.genivi.commonapi.core.target/pom.xml b/org.genivi.commonapi.core.target/pom.xml index fabc640..0ca305e 100644 --- a/org.genivi.commonapi.core.target/pom.xml +++ b/org.genivi.commonapi.core.target/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.core.releng - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT ../org.genivi.commonapi.core.releng \ No newline at end of file diff --git a/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF b/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF index 6ce51c4..b4bb3f7 100644 --- a/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GENIVI CommonAPI Core UI Bundle-SymbolicName: org.genivi.commonapi.core.ui;singleton:=true -Bundle-Version: 3.2.0.qualifier +Bundle-Version: 3.2.14.qualifier Bundle-Activator: org.genivi.commonapi.core.ui.CommonApiUiPlugin Bundle-Vendor: BMW AG Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.10.0,4.0.0)";visibility:=reexport, @@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.10.0,4.0.0)";visibil 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="[5.0.1,6.0.0)";visibility:=reexport, - org.genivi.commonapi.core;bundle-version="3.2.0";visibility:=reexport, + org.genivi.commonapi.core;bundle-version="3.2.14";visibility:=reexport, org.franca.core.dsl.ui;bundle-version="[0.13.1,0.14.0)", org.franca.deploymodel.dsl.ui;bundle-version="[0.13.1,0.14.0)", org.eclipse.ui.console;bundle-version="[3.5.0,4.0.0)" diff --git a/org.genivi.commonapi.core.ui/pom.xml b/org.genivi.commonapi.core.ui/pom.xml index e2f3b3b..a309f32 100644 --- a/org.genivi.commonapi.core.ui/pom.xml +++ b/org.genivi.commonapi.core.ui/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.core.releng - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT ../org.genivi.commonapi.core.releng diff --git a/org.genivi.commonapi.core.updatesite/category.xml b/org.genivi.commonapi.core.updatesite/category.xml index 2489edc..f467a49 100644 --- a/org.genivi.commonapi.core.updatesite/category.xml +++ b/org.genivi.commonapi.core.updatesite/category.xml @@ -1,9 +1,9 @@ - + - + diff --git a/org.genivi.commonapi.core.updatesite/pom.xml b/org.genivi.commonapi.core.updatesite/pom.xml index d9e530c..07bddef 100644 --- a/org.genivi.commonapi.core.updatesite/pom.xml +++ b/org.genivi.commonapi.core.updatesite/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.core.releng - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT ../org.genivi.commonapi.core.releng \ No newline at end of file diff --git a/org.genivi.commonapi.core.validator.feature/feature.xml b/org.genivi.commonapi.core.validator.feature/feature.xml index 3c75d68..3b00355 100644 --- a/org.genivi.commonapi.core.validator.feature/feature.xml +++ b/org.genivi.commonapi.core.validator.feature/feature.xml @@ -2,7 +2,7 @@ @@ -14,7 +14,7 @@ - + commonapi org.genivi.commonapi.core.releng - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT ../org.genivi.commonapi.core.releng diff --git a/org.genivi.commonapi.core.validator/META-INF/MANIFEST.MF b/org.genivi.commonapi.core.validator/META-INF/MANIFEST.MF index 3b5578b..b2e6d33 100644 --- a/org.genivi.commonapi.core.validator/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.core.validator/META-INF/MANIFEST.MF @@ -3,15 +3,15 @@ Bundle-ManifestVersion: 2 Bundle-Name: GENIVI CommonAPI Core Validator Bundle-Vendor: BMW AG Bundle-SymbolicName: org.genivi.commonapi.core.validator;singleton:=true -Bundle-Version: 3.2.0.qualifier +Bundle-Version: 3.2.14.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.eclipse.ui, org.eclipse.core.expressions;bundle-version="3.4.400", org.eclipse.core.resources, org.eclipse.core.runtime, com.google.inject;bundle-version="[5.0.1,6.0.0)";visibility:=reexport, - org.genivi.commonapi.core;bundle-version="3.2.0", - org.genivi.commonapi.core.ui;bundle-version="3.2.0", + org.genivi.commonapi.core;bundle-version="3.2.14", + org.genivi.commonapi.core.ui;bundle-version="3.2.14", org.franca.core.dsl;bundle-version="[0.13.1,0.14.0)";visibility:=reexport, org.eclipse.xtext;bundle-version="[2.7.0,3.0.0)";visibility:=reexport Export-Package: org.genivi.commonapi.core.validator diff --git a/org.genivi.commonapi.core.validator/pom.xml b/org.genivi.commonapi.core.validator/pom.xml index 0c6b576..94f32e9 100644 --- a/org.genivi.commonapi.core.validator/pom.xml +++ b/org.genivi.commonapi.core.validator/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.core.releng - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT ../org.genivi.commonapi.core.releng diff --git a/org.genivi.commonapi.core.validator/src/org/genivi/commonapi/core/validator/ValidatorCoreUi.java b/org.genivi.commonapi.core.validator/src/org/genivi/commonapi/core/validator/ValidatorCoreUi.java index b203b5e..1f9fd87 100644 --- a/org.genivi.commonapi.core.validator/src/org/genivi/commonapi/core/validator/ValidatorCoreUi.java +++ b/org.genivi.commonapi.core.validator/src/org/genivi/commonapi/core/validator/ValidatorCoreUi.java @@ -20,6 +20,7 @@ import org.franca.core.franca.FModel; import org.franca.core.franca.FrancaPackage; import org.franca.core.franca.Import; +import org.genivi.commonapi.core.verification.ValidateElements; import org.genivi.commonapi.core.verification.ValidatorCore; import org.genivi.commonapi.core.preferences.PreferenceConstants; import org.genivi.commonapi.core.ui.CommonApiUiPlugin; @@ -31,7 +32,7 @@ public class ValidatorCoreUi extends ValidatorCore { private HashMap> importList = new HashMap>(); private Boolean hasChanged = false; - + private ValidateElements validateElements = new ValidateElements(); @Override public void validateModel(FModel model, @@ -40,6 +41,9 @@ public void validateModel(FModel model, if (!isValidatorEnabled()) { return; } + + validateElements.verifyEqualInOutAndAddSuffix(model); + // call the super validation method super.validateModel(model, messageAcceptor); @@ -194,12 +198,15 @@ protected void findCyclicImports(String filePath, String prevFilePath, FrancaPackage.Literals.IMPORT__IMPORT_URI, -1, messageAcceptor); return; - } else { + } + //Commented out because the new catalogue allows cyclic imports, error disabled + /* + else { acceptError("Cyclic Imports: " + errorString + filePath, imp, FrancaPackage.Literals.IMPORT__IMPORT_URI, -1, messageAcceptor); return; - } + }*/ } else { cyclicList.add(filePath); if (importList.containsKey(filePath)) { @@ -222,5 +229,4 @@ public boolean isValidatorEnabled() { IPreferenceStore prefs = CommonApiUiPlugin.getValidatorPreferences(); return prefs != null && prefs.getBoolean(PreferenceConstants.P_ENABLE_CORE_VALIDATOR); } - } diff --git a/org.genivi.commonapi.core.verification/README b/org.genivi.commonapi.core.verification/README index 9107965..3705dcb 100644 --- a/org.genivi.commonapi.core.verification/README +++ b/org.genivi.commonapi.core.verification/README @@ -97,7 +97,7 @@ mkdir build cd build cmake \ -DCommonAPI_DIR=$(readlink -f ../../../ascgit017.CommonAPI/build) \ --DCOMMONAPI_TOOL_GENERATOR=$(readlink -f ../../../ascgit017.CommonAPI-Tools/org.genivi.commonapi.core.cli.product/target/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-generator-linux-x86_64) \ +-DCOMMONAPI_TOOL_GENERATOR=$(readlink -f ../../../ascgit017.CommonAPI-Tools/org.genivi.commonapi.core.cli.product/target/products/org.genivi.commonapi.core.cli.product/linux/gtk/x86_64/commonapi-core-generator-linux-x86_64) \ -DCMAKE_GLUECODE_SOMEIP_NAME=SomeIPGlue \ -DSomeIPGlue_DIR=$(readlink -f ../../../ascgit017.CommonAPI-SomeIP-Tools/org.genivi.commonapi.someip.verification/build) \ -DCMAKE_GLUECODE_DBUS_NAME=DBusGlue \ diff --git a/org.genivi.commonapi.core.verification/fidl/ti_datatypes_combined.fidl b/org.genivi.commonapi.core.verification/fidl/ti_datatypes_combined.fidl index ef2420f..1e821e4 100644 --- a/org.genivi.commonapi.core.verification/fidl/ti_datatypes_combined.fidl +++ b/org.genivi.commonapi.core.verification/fidl/ti_datatypes_combined.fidl @@ -42,6 +42,7 @@ interface TestInterface { UInt8 uint8Member String stringMember tEnum enumMember + tArray arrayMember } map tMap { diff --git a/org.genivi.commonapi.core.verification/src/AFExtended.cpp b/org.genivi.commonapi.core.verification/src/AFExtended.cpp index 832881a..f192d01 100644 --- a/org.genivi.commonapi.core.verification/src/AFExtended.cpp +++ b/org.genivi.commonapi.core.verification/src/AFExtended.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include "CommonAPI/CommonAPI.hpp" #include "stub/AFExtendedStub.hpp" #include "v1/commonapi/advanced/extended/AFExtendedBaseProxy.hpp" diff --git a/org.genivi.commonapi.core.verification/src/AFSelective.cpp b/org.genivi.commonapi.core.verification/src/AFSelective.cpp index 246aa1f..ff270cc 100644 --- a/org.genivi.commonapi.core.verification/src/AFSelective.cpp +++ b/org.genivi.commonapi.core.verification/src/AFSelective.cpp @@ -318,7 +318,7 @@ TEST_F(AFSelective, SelectiveMultiBroadcast) { /** * @test Test Destruction of Proxies but service stay online * There were an issue when a proxy which has nevery subscribed gets -* destructed with SomeIP binding (GLIPCI-1081). Therefore i added this +* destructed with SomeIP binding. Therefore i added this * test case. */ TEST_F(AFSelective, ProxyBuildAndDestroy) { diff --git a/org.genivi.commonapi.core.verification/src/CMBlockingCalls.cpp b/org.genivi.commonapi.core.verification/src/CMBlockingCalls.cpp index 764e806..80e4ff9 100644 --- a/org.genivi.commonapi.core.verification/src/CMBlockingCalls.cpp +++ b/org.genivi.commonapi.core.verification/src/CMBlockingCalls.cpp @@ -7,12 +7,13 @@ * @file Communication */ -#include -#include #include +#include +#include +#include #include #include -#include +#include #include "CommonAPI/CommonAPI.hpp" #include "v1/commonapi/communication/TestInterfaceProxy.hpp" #include "stub/CMMethodCallsStub.hpp" diff --git a/org.genivi.commonapi.core.verification/src/CMMethodCalls.cpp b/org.genivi.commonapi.core.verification/src/CMMethodCalls.cpp index bf511b9..3174fec 100644 --- a/org.genivi.commonapi.core.verification/src/CMMethodCalls.cpp +++ b/org.genivi.commonapi.core.verification/src/CMMethodCalls.cpp @@ -7,9 +7,10 @@ * @file Communication */ -#include #include +#include #include +#include #include "CommonAPI/CommonAPI.hpp" #include "v1/commonapi/communication/TestInterfaceProxy.hpp" #include "stub/CMMethodCallsStub.hpp" diff --git a/org.genivi.commonapi.core.verification/src/DTCombined.cpp b/org.genivi.commonapi.core.verification/src/DTCombined.cpp index 0cb9d94..82ae728 100644 --- a/org.genivi.commonapi.core.verification/src/DTCombined.cpp +++ b/org.genivi.commonapi.core.verification/src/DTCombined.cpp @@ -231,9 +231,9 @@ TEST_F(DTCombined, CheckInitialValue) { u2 = false; // check that the union contains a good value // union is initialized with the first kind of value. - // here, that is a boolean, and its value type is '4' - the number + // here, that is a boolean, and its value type is '5' - the number // of types in the union. - EXPECT_EQ(u1.getValueType(), 4); + EXPECT_EQ(u1.getValueType(), 5); EXPECT_EQ(u1, u2); TestInterface::tMap m1; @@ -249,7 +249,7 @@ TEST_F(DTCombined, CheckInitialValue) { EXPECT_EQ(s_l1.getStructMember().getUint8Member(), 0); EXPECT_EQ(s_l1.getStructMember().getStringMember().size(), 0u); EXPECT_EQ(s_l1.getStructMember().getEnumMember(), TestInterface::tEnum::VALUE1); - EXPECT_EQ(s_l1.getUnionMember().getValueType(), 4); + EXPECT_EQ(s_l1.getUnionMember().getValueType(), 5); EXPECT_EQ(s_l1.getUnionMember(), u2); EXPECT_EQ(s_l1.getMapMember().size(), 0u); @@ -267,7 +267,7 @@ TEST_F(DTCombined, CheckInitialValue) { EXPECT_EQ(s_l2.getStructL1Member().getStructMember().getUint8Member(), 0); EXPECT_EQ(s_l2.getStructL1Member().getStructMember().getStringMember().size(), 0u); EXPECT_EQ(s_l2.getStructL1Member().getStructMember().getEnumMember(), TestInterface::tEnum::VALUE1); - EXPECT_EQ(s_l2.getStructL1Member().getUnionMember().getValueType(), 4); + EXPECT_EQ(s_l2.getStructL1Member().getUnionMember().getValueType(), 5); EXPECT_EQ(s_l2.getStructL1Member().getUnionMember(), u2); EXPECT_EQ(s_l2.getStructL1Member().getMapMember().size(), 0u); EXPECT_EQ(s_l2.getUnionL1Member().getValueType(), 5); @@ -302,6 +302,29 @@ TEST_F(DTCombined2, VariantWithLiteralEnum) { EXPECT_EQ(u_l2, u_l3); u_l2 = (uint8_t)5; } + +/** +* @test Test self assignment of CommonAPI::Variant +* - create variant containing an array +* - check validity of Variant after calling assignment operator on itself +*/ +TEST_F(DTCombined2, CheckVariantSelfAssignment) { + TestInterface::tArray myArray({"one", "two", "three"}); + + TestInterface::tUnion myVariant(myArray); + + EXPECT_TRUE(myVariant.isType()); + EXPECT_EQ(myArray, myVariant.get()); + + myVariant.operator=(myVariant); + EXPECT_TRUE(myVariant.isType()); + EXPECT_EQ(myArray, myVariant.get()); + + myVariant.operator=(std::move(myVariant)); + EXPECT_TRUE(myVariant.isType()); + EXPECT_EQ(myArray, myVariant.get()); +} + int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); ::testing::AddGlobalTestEnvironment(new Environment()); diff --git a/org.genivi.commonapi.core.verification/src/PFComplex.cpp b/org.genivi.commonapi.core.verification/src/PFComplex.cpp index 65d4dc0..0e6573c 100644 --- a/org.genivi.commonapi.core.verification/src/PFComplex.cpp +++ b/org.genivi.commonapi.core.verification/src/PFComplex.cpp @@ -8,6 +8,7 @@ */ #include +#include #include "CommonAPI/CommonAPI.hpp" #include "v1/commonapi/performance/complex/TestInterfaceProxy.hpp" @@ -208,20 +209,14 @@ TEST_F(PFComplex, Ping_Pong_Complex_Asynchronous) { watch_.reset(); -#ifdef _WIN32 // DBus under Windows is way to slow at the moment (about 10 times slower than linux), so without an increase in timeout, this test never succeeds. // Only raising for WIN32, since linux should run with the default timeout without problems. CommonAPI::CallInfo callInfo(60000); -#endif watch_.start(); // Call commonAPI method loopCountPerPaylod times to calculate mean time for (uint32_t i = 0; i < loopCountPerPaylod; ++i) { -#ifdef _WIN32 testProxy_->testMethodAsync(in, myCallback_, &callInfo); -#else - testProxy_->testMethodAsync(in, myCallback_); -#endif } { std::unique_lock uniqueLock(synchLock_); diff --git a/org.genivi.commonapi.core.verification/src/PFPrimitive.cpp b/org.genivi.commonapi.core.verification/src/PFPrimitive.cpp index 06e6505..b802a96 100644 --- a/org.genivi.commonapi.core.verification/src/PFPrimitive.cpp +++ b/org.genivi.commonapi.core.verification/src/PFPrimitive.cpp @@ -8,6 +8,7 @@ */ #include +#include #include "CommonAPI/CommonAPI.hpp" #include "v1/commonapi/performance/primitive/TestInterfaceProxy.hpp" @@ -182,19 +183,13 @@ TEST_F(PFPrimitive, Ping_Pong_Primitive_Asynchronous) { // Initialize testData, call count stop watch for next iteration! TestInterface::TestArray in(arraySize_); -#ifdef _WIN32 // DBus under Windows is way to slow at the moment (about 10 times slower than linux), so without an increase in timeout, this test never succeeds. // Only raising for WIN32, since linux should run with the default timeout without problems. CommonAPI::CallInfo callInfo(60000); -#endif watch_.start(); for (uint32_t i = 0; i < loopCountPerPaylod; ++i) { -#ifdef _WIN32 testProxy_->testMethodAsync(in, myCallback_, &callInfo); -#else - testProxy_->testMethodAsync(in, myCallback_); -#endif } { std::unique_lock uniqueLock(synchLock_); @@ -218,4 +213,3 @@ int main(int argc, char** argv) { ::testing::AddGlobalTestEnvironment(new Environment()); return RUN_ALL_TESTS(); } - diff --git a/org.genivi.commonapi.core.verification/src/StabilitySP.cpp b/org.genivi.commonapi.core.verification/src/StabilitySP.cpp index 591e27b..8e0051a 100644 --- a/org.genivi.commonapi.core.verification/src/StabilitySP.cpp +++ b/org.genivi.commonapi.core.verification/src/StabilitySP.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include "CommonAPI/CommonAPI.hpp" #include "v1/commonapi/stability/sp/TestInterfaceProxy.hpp" #include "stub/StabilitySPStub.hpp" @@ -217,7 +218,7 @@ class ProxyThread { return; asyncCounter++; -// std::cout << "asyncCounter<" << this << ">: " << asyncCounter << std::endl; + //std::cout << "asyncCounter<" << this << ">: " << asyncCounter << std::endl; TestInterface::tArray arrayTestValue; @@ -324,7 +325,7 @@ class ProxyThread { if (previousCount != asyncCounter) { break; } - std::this_thread::sleep_for(std::chrono::microseconds(10000)); + std::this_thread::sleep_for(std::chrono::microseconds(20000)); } if (previousCount == asyncCounter) { break; @@ -535,7 +536,7 @@ class ProxyThread { std::function myCallback = std::bind(&ProxyThread::recvValue, this, std::placeholders::_1, std::placeholders::_2); - CommonAPI::CallInfo callInfo(50*1000); + CommonAPI::CallInfo callInfo(100*1000); proxy->getTestAttributeAttribute().getValueAsync(myCallback, &callInfo); return true; diff --git a/org.genivi.commonapi.core.verification/src/THMainLoopIndependence.cpp b/org.genivi.commonapi.core.verification/src/THMainLoopIndependence.cpp index 9d4f66f..c053111 100644 --- a/org.genivi.commonapi.core.verification/src/THMainLoopIndependence.cpp +++ b/org.genivi.commonapi.core.verification/src/THMainLoopIndependence.cpp @@ -8,6 +8,7 @@ */ #include +#include #include "CommonAPI/CommonAPI.hpp" #include "utils/VerificationMainLoop.hpp" #include "v1/commonapi/threading/TestInterfaceProxy.hpp" diff --git a/org.genivi.commonapi.core.verification/src/THMainLoopIntegration.cpp b/org.genivi.commonapi.core.verification/src/THMainLoopIntegration.cpp index 14dc6f6..98ae094 100644 --- a/org.genivi.commonapi.core.verification/src/THMainLoopIntegration.cpp +++ b/org.genivi.commonapi.core.verification/src/THMainLoopIntegration.cpp @@ -8,6 +8,7 @@ */ #include +#include #include "CommonAPI/CommonAPI.hpp" #include "stub/THMainLoopIntegrationStub.hpp" #include "utils/VerificationMainLoop.hpp" diff --git a/org.genivi.commonapi.core.verification/src/THMainLoopTwoThreads.cpp b/org.genivi.commonapi.core.verification/src/THMainLoopTwoThreads.cpp index adfe2d5..65ce1e8 100644 --- a/org.genivi.commonapi.core.verification/src/THMainLoopTwoThreads.cpp +++ b/org.genivi.commonapi.core.verification/src/THMainLoopTwoThreads.cpp @@ -8,6 +8,7 @@ */ #include +#include #include "CommonAPI/CommonAPI.hpp" #include "utils/VerificationMainLoopWithQueue.hpp" #include "v1/commonapi/threading/TestInterfaceProxy.hpp" diff --git a/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoopWithQueue.hpp b/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoopWithQueue.hpp index 8e3deb9..3a96cf5 100644 --- a/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoopWithQueue.hpp +++ b/org.genivi.commonapi.core.verification/src/utils/VerificationMainLoopWithQueue.hpp @@ -8,6 +8,7 @@ #include +#include #include #include #include diff --git a/org.genivi.commonapi.core/.gitignore b/org.genivi.commonapi.core/.gitignore index 5d81d9a..d7a41af 100644 --- a/org.genivi.commonapi.core/.gitignore +++ b/org.genivi.commonapi.core/.gitignore @@ -1,4 +1,5 @@ /bin +/src-gen /target /xtend-gen *~ diff --git a/org.genivi.commonapi.core/META-INF/MANIFEST.MF b/org.genivi.commonapi.core/META-INF/MANIFEST.MF index c7701a2..76c94ed 100644 --- a/org.genivi.commonapi.core/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GENIVI CommonAPI Core C++ Generator Bundle-Vendor: BMW AG -Bundle-Version: 3.2.0.qualifier +Bundle-Version: 3.2.14.qualifier Bundle-SymbolicName: org.genivi.commonapi.core;singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.8.0,4.0.0)";visibility:=reexport, @@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.8.0,4.0.0)";visibili org.eclipse.xtext;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.util;bundle-version="[2.7.0,3.0.0)";visibility:=reexport, - com.google.guava;bundle-version="15.0.0";visibility:=reexport, + com.google.guava;bundle-version="30.1.0";visibility:=reexport, org.franca.core.dsl;bundle-version="[0.13.1,0.14.0)";visibility:=reexport, org.franca.deploymodel.dsl;bundle-version="[0.13.1,0.14.0)";visibility:=reexport, org.franca.deploymodel.ext.providers;bundle-version="[0.13.1,0.14.0)";visibility:=reexport diff --git a/org.genivi.commonapi.core/pom.xml b/org.genivi.commonapi.core/pom.xml index d45cce6..40c1674 100644 --- a/org.genivi.commonapi.core/pom.xml +++ b/org.genivi.commonapi.core/pom.xml @@ -7,7 +7,7 @@ commonapi org.genivi.commonapi.core.releng - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT ../org.genivi.commonapi.core.releng diff --git a/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentInterfacePropertyAccessor.java b/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentInterfacePropertyAccessor.java deleted file mode 100644 index 1ac8693..0000000 --- a/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentInterfacePropertyAccessor.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* -* This file has been generated by Franca's FDeployGenerator. -* Source: deployment specification 'org.genivi.commonapi.core.deployment' -*******************************************************************************/ -package org.genivi.commonapi.core; - -import org.franca.deploymodel.core.FDeployedInterface; - -/** - * Accessor for deployment properties for 'org.genivi.commonapi.core.deployment' specification - * - * @deprecated use class org.genivi.commonapi.core.Deployment.InterfacePropertyAccessor instead - */ -public class DeploymentInterfacePropertyAccessor - extends org.genivi.commonapi.core.Deployment.InterfacePropertyAccessor - implements org.genivi.commonapi.core.Deployment.Enums -{ - public DeploymentInterfacePropertyAccessor(FDeployedInterface target) { - super(target); - } -} - diff --git a/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentTypeCollectionPropertyAccessor.java b/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentTypeCollectionPropertyAccessor.java deleted file mode 100644 index 7e05738..0000000 --- a/org.genivi.commonapi.core/src-gen/org/genivi/commonapi/core/DeploymentTypeCollectionPropertyAccessor.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* -* This file has been generated by Franca's FDeployGenerator. -* Source: deployment specification 'org.genivi.commonapi.core.deployment' -*******************************************************************************/ -package org.genivi.commonapi.core; - -import org.franca.deploymodel.core.FDeployedTypeCollection; - -/** - * Accessor for deployment properties for 'org.genivi.commonapi.core.deployment' specification - * - * @deprecated use class org.genivi.commonapi.core.Deployment.TypeCollectionPropertyAccessor instead - */ -public class DeploymentTypeCollectionPropertyAccessor - extends org.genivi.commonapi.core.Deployment.TypeCollectionPropertyAccessor - implements org.genivi.commonapi.core.Deployment.Enums -{ - public DeploymentTypeCollectionPropertyAccessor(FDeployedTypeCollection target) { - super(target); - } -} - diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FDeployManager.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FDeployManager.java index 0c6f46e..9910c59 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FDeployManager.java +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FDeployManager.java @@ -4,6 +4,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.genivi.commonapi.core.generator; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; @@ -22,6 +23,7 @@ import org.franca.deploymodel.dsl.fDeploy.FDModel; import org.franca.deploymodel.dsl.fDeploy.FDSpecification; import org.franca.deploymodel.dsl.fDeploy.Import; +import org.genivi.commonapi.core.verification.ValidateElements; /** * The FDeployManager loads models from fdepl files and from fidl files that are @@ -45,6 +47,8 @@ public class FDeployManager { private Map deploymentModels = new HashMap(); private Map fidlModels = new HashMap(); private Map specifications = new HashMap(); + private List importsLoadedList = new ArrayList(); + private ValidateElements validateElements = new ValidateElements(); public FDeployManager() { @@ -69,6 +73,10 @@ public FDeployManager() { * @return the root model or null in case of an error. */ public EObject loadModel(URI uri, URI root) { + + // Add the URI to be loaded, to check the cyclic imports + importsLoadedList.add(uri.toString()); + // Check if this file is already loaded if(deploymentModels.keySet().contains(uri.toString()) || fidlModels.keySet().contains(uri.toString())) { @@ -122,9 +130,15 @@ public EObject loadModel(URI uri, URI root) { // resourceSet.getURIConverter().getURIMap() // .put(importURI, resolvedURI); String uriName = resolvedURI.toString(); - EObject importModel = loadModel(resolvedURI, root); + EObject importModel = null; + + if (!importsLoadedList.contains(uriName)) + { + importModel = loadModel(resolvedURI, root); + } + if (importModel != null) { - if(importModel instanceof FDModel) { + if (importModel instanceof FDModel) { // CommonAPI models do _NOT_ contain specifications List itsSpecifications = ((FDModel)importModel).getSpecifications(); if (itsSpecifications.size() == 0) { @@ -143,6 +157,17 @@ else if(importModel instanceof FModel) { } } } + + if (model instanceof FDModel) { + validateElements.validateFDModelElements((FDModel)model); + } + else if(model instanceof FModel) { + String rootUriString = root.toString(); + if (rootUriString.endsWith("fidl")) { + validateElements.validateFModelElements((FModel)model); + } + } + importsLoadedList.clear(); return model; } diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceProxyGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceProxyGenerator.xtend index a6ee448..7f7e97d 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceProxyGenerator.xtend +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceProxyGenerator.xtend @@ -169,7 +169,7 @@ class FInterfaceProxyGenerator { «fInterface.proxyClassName»(std::shared_ptr delegate); ~«fInterface.proxyClassName»(); - typedef «fInterface.getRelativeNameReference(fInterface)» InterfaceType; + typedef «fInterface.versionPrefix»«fInterface.model.generateCppNamespace»«fInterface.getRelativeNameReference(fInterface)» InterfaceType; «IF fInterface.base !== null» inline static const char* getInterface() { diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend index 071d777..77ca5b2 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend @@ -343,7 +343,7 @@ class FInterfaceStubGenerator { typedef «fInterface.stubCommonAPIClassName»::StubAdapterType StubAdapterType; typedef «fInterface.stubCommonAPIClassName»::RemoteEventHandlerType RemoteEventHandlerType; typedef «fInterface.stubRemoteEventClassName» RemoteEventType; - typedef «fInterface.elementName» StubInterface; + typedef «fInterface.versionPrefix»«fInterface.model.generateCppNamespace»«fInterface.elementName» StubInterface; }; «fInterface.model.generateNamespaceEndDeclaration» diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend index 112c97b..38d21ea 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend @@ -309,7 +309,7 @@ class FrancaGeneratorExtensions { def getElementName(FModelElement fModelElement) { if ((fModelElement.name === null || fModelElement.name == "") && fModelElement instanceof FTypeCollection) { - return "__Anonymous__" + return fModelElement.model.directoryPath.replace('/', '_') + "__Types" } else { return fModelElement.name @@ -659,14 +659,20 @@ class FrancaGeneratorExtensions { return signature } - def isErrorType(FBroadcast fBroadcast, PropertyAccessor deploymentAccessor) { - return (deploymentAccessor.getBroadcastType(fBroadcast) == PropertyAccessor.BroadcastType.error) + def isErrorType(FBroadcast fBroadcast, PropertyAccessor _accessor) { + if (_accessor === null) + return false + + return (_accessor.getBroadcastType(fBroadcast) == PropertyAccessor.BroadcastType.error) } - def isErrorType(FBroadcast fBroadcast, FMethod fMethod, PropertyAccessor deploymentAccessor) { - return (fBroadcast.isErrorType(deploymentAccessor) && - deploymentAccessor.getErrors(fMethod) !== null && - deploymentAccessor.getErrors(fMethod).contains(fBroadcast.elementName)) + def isErrorType(FBroadcast fBroadcast, FMethod fMethod, PropertyAccessor _accessor) { + if (_accessor === null) + return false + + return (fBroadcast.isErrorType(_accessor) && + _accessor.getErrors(fMethod) !== null && + _accessor.getErrors(fMethod).contains(fBroadcast.elementName)) } def errorName(FBroadcast fBroadcast, PropertyAccessor deploymentAccessor) { @@ -1999,7 +2005,9 @@ class FrancaGeneratorExtensions { var String name = "" if (_container instanceof FTypeCollection) { name = _container.name - if (name === null) name = "__Anonymous__" + if (name === null) { + name = _container.model.directoryPath.replace('/', '_') + "__Types" + } } else if (_container instanceof FModelElement) { name = _container.name } else if (_container instanceof FModel) { diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/StandaloneModelPersistenceHandler.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/StandaloneModelPersistenceHandler.java index 57111b9..70bca9e 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/StandaloneModelPersistenceHandler.java +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/StandaloneModelPersistenceHandler.java @@ -5,9 +5,11 @@ package org.genivi.commonapi.core.generator; import java.io.IOException; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import org.eclipse.emf.common.util.URI; @@ -46,6 +48,11 @@ public class StandaloneModelPersistenceHandler { */ private ValidationMessageAcceptor messageAcceptor; + /** + * List used to handle cyclic imports + */ + private List importsLoadedList = new ArrayList(); + /** * Special handling for missing deployment specification files. * @@ -86,6 +93,9 @@ public EObject loadModel(URI uri, URI root) { // resolve the input uri, in case it is a relative path URI absURI = uri.resolve(root); + // Add the URI to be loaded, to check the cyclic imports + importsLoadedList.add(absURI.toString()); + // load root model Resource resource = null; try { @@ -119,6 +129,10 @@ public EObject loadModel(URI uri, URI root) { String importURIStr = it.next(); URI importURI = URI.createURI(importURIStr); URI resolvedURI = importURI.resolve(absURI); + + if (importsLoadedList.contains(resolvedURI.toString())) { + continue; + } loadModel(resolvedURI, root); } return model; diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/CommandlineValidator.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/CommandlineValidator.java index e891597..195b981 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/CommandlineValidator.java +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/CommandlineValidator.java @@ -35,6 +35,7 @@ import org.franca.deploymodel.dsl.FDeployImportsProvider; import org.franca.deploymodel.dsl.fDeploy.FDModel; import org.genivi.commonapi.core.generator.StandaloneModelPersistenceHandler; +import org.genivi.commonapi.core.verification.ValidateElements; import com.google.inject.Guice; import com.google.inject.Injector; @@ -44,10 +45,12 @@ public class CommandlineValidator { private ValidationMessageAcceptor cliMessageAcceptor; private List ignoreList; private List ignoreMessageList; + private List importsValidatedList; protected static final String DEPLOYMENT_SPEC = "deployment_spec.fdepl"; protected static final String UNKNOWN_DEPLOYMENT_SPEC = "Couldn't resolve reference to FDSpecification"; private ResourceSet resourceSet; private boolean hasError = false; + private ValidateElements validateElements = new ValidateElements(); public CommandlineValidator(ValidationMessageAcceptor cliMessageAcceptor) { this.cliMessageAcceptor = cliMessageAcceptor; @@ -55,6 +58,7 @@ public CommandlineValidator(ValidationMessageAcceptor cliMessageAcceptor) { ignoreList = new ArrayList(); ignoreMessageList = new ArrayList(); ignoreMessageList.add("Duplicate element type"); + importsValidatedList = new ArrayList(); } private void showError(String message) { @@ -169,11 +173,19 @@ public void validateResourceWithImports(Resource resource) { validateImports(fmodel, resource.getURI()); if (!hasError) { + importsValidatedList.add(resource.getURI().toString()); + for (Import fimport : fmodel.getImports()) { String uriString = fimport.getImportURI(); URI importUri = URI.createURI(uriString); //System.out.println("Validating import " + importUri.lastSegment()); URI resolvedUri = importUri.resolve(resource.getURI()); + + // Check if fimport is already validated + if (importsValidatedList.contains(resolvedUri.toString())) { + continue; + } + Resource importedResource = resourceSet.getResource( resolvedUri, true); validateResourceWithImports(importedResource); @@ -183,7 +195,6 @@ public void validateResourceWithImports(Resource resource) { } } - private boolean isErrorToIgnore(Issue issue) { for(String ignoreMessage : ignoreMessageList) { @@ -217,6 +228,7 @@ public boolean validateDeployment(URI resourcePathUri) Injector injector = Guice.createInjector(new FrancaIDLRuntimeModule()); StandaloneModelPersistenceHandler modelPersistenceHandler = new StandaloneModelPersistenceHandler(injector.getInstance(ResourceSet.class)); modelPersistenceHandler.setIgnoreMissingDeploymentSpecs(true); + ResourceSet resourceSet = modelPersistenceHandler.getResourceSet(); final BasicDiagnostic diagnostics = new BasicDiagnostic(); ValidationMessageAcceptor messageAcceptor = new AbstractValidationMessageAcceptor() { @@ -242,6 +254,14 @@ public void acceptError(String message, EObject object, EStructuralFeature featu if (!outputDiagnostics(diagnostics.getChildren(), false)) return false; + for (Resource resource : resourceSet.getResources()) { + for (EObject eObject : resource.getContents()) { + if (eObject instanceof FDModel) { + validateElements.verifyEqualInOutAndAddSuffix((FDModel)eObject); + } + } + } + // Validate FDEPL/FIDL files with registered XText validators // if (!validate(modelPersistenceHandler.getResourceSet())) @@ -258,6 +278,7 @@ public void acceptError(String message, EObject object, EStructuralFeature featu protected boolean validate(ResourceSet resourceSet) { boolean hasValidationError = false; + for (Resource resource : resourceSet.getResources()) { if (!validate(resource)) diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/CppKeywords.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/CppKeywords.java index 6487da4..d97e3c0 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/CppKeywords.java +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/CppKeywords.java @@ -5,13 +5,14 @@ package org.genivi.commonapi.core.verification; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; public class CppKeywords { public List keyWords = new ArrayList(); - public List reservedWords = new ArrayList(); + public HashMap handleReservedWords = new HashMap(); public CppKeywords() { @@ -100,10 +101,14 @@ public CppKeywords() { keyWords.add("xor"); keyWords.add("xor_eq"); - reservedWords.add("AnonymousTypeCollection"); - reservedWords.add("instance"); - reservedWords.add("attributes"); - reservedWords.add("info"); + handleReservedWords.put("AnonymousTypeCollection", "AnonymousTypeCollection_"); + handleReservedWords.put("instance", "instance_"); + handleReservedWords.put("attributes", "attributes_"); + handleReservedWords.put("info", "info_"); + handleReservedWords.put("callback", "callback_"); + handleReservedWords.put("internalCallStatus", "internalCallStatus_"); + handleReservedWords.put("new", "new_"); + handleReservedWords.put("client", "client_"); + handleReservedWords.put("InterfaceVersion", "ETSInterfaceVersion"); // This attribute's name is already used to access version information of the remote } - } diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/ValidateElements.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/ValidateElements.java new file mode 100644 index 0000000..ce26e88 --- /dev/null +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/ValidateElements.java @@ -0,0 +1,459 @@ +package org.genivi.commonapi.core.verification; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.franca.core.franca.FArgument; +import org.franca.core.franca.FAttribute; +import org.franca.core.franca.FEnumerationType; +import org.franca.core.franca.FEnumerator; +import org.franca.core.franca.FField; +import org.franca.core.franca.FInterface; +import org.franca.core.franca.FMethod; +import org.franca.core.franca.FModel; +import org.franca.core.franca.FStructType; +import org.franca.core.franca.FType; +import org.franca.core.franca.FTypeCollection; +import org.franca.deploymodel.dsl.fDeploy.FDArgument; +import org.franca.deploymodel.dsl.fDeploy.FDAttribute; +import org.franca.deploymodel.dsl.fDeploy.FDEnumeration; +import org.franca.deploymodel.dsl.fDeploy.FDField; +import org.franca.deploymodel.dsl.fDeploy.FDInterface; +import org.franca.deploymodel.dsl.fDeploy.FDMethod; +import org.franca.deploymodel.dsl.fDeploy.FDModel; +import org.franca.deploymodel.dsl.fDeploy.FDRootElement; +import org.franca.deploymodel.dsl.fDeploy.FDStruct; +import org.franca.deploymodel.dsl.fDeploy.FDTypeDefinition; +import org.franca.deploymodel.dsl.fDeploy.FDTypes; +import org.genivi.commonapi.core.verification.CppKeywords; + +public class ValidateElements { + + private CppKeywords cppKeywords = new CppKeywords(); + private List listOfElements = new ArrayList(); + private HashMap inArguments = new HashMap(); + private HashMap inputArguments = new HashMap(); + private List listOfOutArguments = new ArrayList(); + private List listOfEnumerators = new ArrayList(); + + /** + * Final verification of Attributes and In and Out arguments name when the list is completed + * Final verification of Struct Elements and Enumerators name when the list is completed + * Final verification of Output argument and Enumerator name after verify the reserved identifiers + * Input is a FModel + */ + public void validateFModelElements(FModel fModel) { + for (FInterface fInterface : fModel.getInterfaces()) { + validateInterfaceAndElementsName(fInterface); + } + for (FTypeCollection fTypeCollection : fModel.getTypeCollections()) { + validateTypecollectionAndElementsName(fTypeCollection); + } + // Verify if elements name is a reserved identifier. In that case it will be added a suffix + if (!listOfElements.isEmpty()) { + for (Object obj : listOfElements) { + verifyReservedKeyword(obj); + } + } + // Add a suffix to the Out argument since it has the same name of the input parameter + // Out arguments can only be verified after check if their name is a reserved identifier + // In case of In and Out being equal and have as name a reserved identifier the final result will be the name of Out argument with two additional "_" and the In argument with only one additional "_" + if (!listOfOutArguments.isEmpty()) { + addSuffixForEqualInOut(); + } + // To all Enumerators in the list it will be added a suffix + if (!listOfEnumerators.isEmpty()) { + verifyEnumerationAndParameterName(); + } + listOfElements.clear(); + listOfOutArguments.clear(); + listOfEnumerators.clear(); + } + + /** + * Final verification of Attributes and In and Out arguments name when the list is completed + * Final verification of Struct Elements and Enumerators name when the list is completed + * Final verification of Output argument and Enumerator name after verify the reserved identifiers + * Input is a FDModel + */ + public void validateFDModelElements(FDModel fdModel) { + for (FDRootElement depl : fdModel.getDeployments()) { + if (depl instanceof FDInterface) { + validateInterfaceAndElementsName((FDInterface)depl); + } + if (depl instanceof FDTypes) { + validateTypecollectionAndElementsName((FDTypes)depl); + } + } + // Verify if elements name is a reserved identifier. In that case it will be added a suffix + if (!listOfElements.isEmpty()) { + for (Object obj : listOfElements) { + verifyReservedKeyword(obj); + } + } + // Add a suffix to the Out argument since it has the same name of the input parameter + // Out arguments can only be verified after check if their name is a reserved identifier + // In case of In and Out being equal and have as name a reserved identifier the final result will be the name of Out argument with two additional "_" and the In argument with only one additional "_" + if (!listOfOutArguments.isEmpty()) { + // listOfOutArguments analyzed before add the suffix in order to remove the arguments that correspond to the FDArgument.target() + // Otherwise the FArgument would be changed twice - one throught the FDArgument.target() and other throught the FArgument that was previous added to the list + for (Object outArgument : listOfOutArguments) { + if (outArgument instanceof FDArgument) { + FArgument argumentTarget = ((FDArgument)outArgument).getTarget(); + if (listOfOutArguments.contains(argumentTarget)) { + listOfOutArguments.remove(argumentTarget); + } + } + } + addSuffixForEqualInOut(); + } + // To all Enumerators in the list it will be added a suffix + if (!listOfEnumerators.isEmpty()) { + verifyEnumerationAndParameterName(); + } + listOfElements.clear(); + listOfOutArguments.clear(); + listOfEnumerators.clear(); + } + + /** + * Add Attributes and In and Out arguments to a list + * In case In and Out arguments have the same name the out argument is added to a list + * Input: FInterface + */ + private void validateInterfaceAndElementsName(FInterface fInterface) { + for (FMethod fMethod : fInterface.getMethods()) { + for (FArgument in : fMethod.getInArgs()) { + if (!listOfElements.contains(in)) { + listOfElements.add(in); + } + inputArguments.put(in.getName(), in); + } + for (FArgument out : fMethod.getOutArgs()) { + if (!listOfElements.contains(out)) { + listOfElements.add(out); + } + // Verify if In and Out arguments have the same name. In that case add Out argument to the list + String outputKeyName = out.getName(); + if (inputArguments.containsKey(outputKeyName)) { + if (!listOfOutArguments.contains(out)) { + listOfOutArguments.add(out); + } + } + } + inputArguments.clear(); + } + + for (FAttribute fAttribute : fInterface.getAttributes()) { + if (!listOfElements.contains(fAttribute)) { + listOfElements.add(fAttribute); + } + } + } + + /** + * Add Attributes and In and Out arguments to a list + * In case In and Out parameters have the same name the out argument is added to a list + * Input: FDInterface + */ + private void validateInterfaceAndElementsName(FDInterface fdInterface) { + for (FDMethod fdMethod : fdInterface.getMethods()) { + if (fdMethod.getInArguments() != null) { + for (FDArgument in : fdMethod.getInArguments().getArguments()) { + if (!listOfElements.contains(in)) { + listOfElements.add(in); + } + inputArguments.put(in.getTarget().getName(), in.getTarget()); + } + } + if (fdMethod.getOutArguments() != null) { + for (FDArgument out : fdMethod.getOutArguments().getArguments()) { + if (!listOfElements.contains(out)) { + listOfElements.add(out); + } + // Verify if In and Out arguments have the same name. In that case add Out argument to the list + String outputKeyName = out.getTarget().getName(); + if (inputArguments.containsKey(outputKeyName)) { + if (!listOfOutArguments.contains(out)) { + listOfOutArguments.add(out); + } + } + } + } + inputArguments.clear(); + } + + for (FDAttribute fdAttribute : fdInterface.getAttributes()) { + if (!listOfElements.contains(fdAttribute)) { + listOfElements.add(fdAttribute); + } + } + + // Add to the list the elements that are only identified in FModel + for (FMethod fMethod : fdInterface.getTarget().getMethods()) { + for (FArgument in : fMethod.getInArgs()) { + if (!listOfElements.contains(in)) { + listOfElements.add(in); + } + inputArguments.put(in.getName(), in); + } + for (FArgument out : fMethod.getOutArgs()) { + if (!listOfElements.contains(out)) { + listOfElements.add(out); + } + // Verify if In and Out arguments have the same name. In that case add Out argument to the list + String outputKeyName = out.getName(); + if (inputArguments.containsKey(outputKeyName)) { + if (!listOfOutArguments.contains(out)) { + listOfOutArguments.add(out); + } + } + } + inputArguments.clear(); + } + + for (FAttribute fAttribute : fdInterface.getTarget().getAttributes()) { + if (!listOfElements.contains(fAttribute)) { + listOfElements.add(fAttribute); + } + } + } + + /** + * Add Enumerators and Struct members to a list + * Verify if an Enumeration and Enumerator have the same name. In that case the Enumerator is added to a list for it can be updated later + * Input: FTypeCollection + */ + private void validateTypecollectionAndElementsName(FTypeCollection fTypeCollection) { + for (FType fType : fTypeCollection.getTypes()) { + if (fType instanceof FStructType) { + for (FField structElements : ((FStructType)fType).getElements()) { + if (!listOfElements.contains(structElements)) { + listOfElements.add(structElements); + } + } + } + if (fType instanceof FEnumerationType) { + FEnumerationType fEnumerationType = (FEnumerationType)fType; + for (FEnumerator fEnumerator : fEnumerationType.getEnumerators()) { + if (!listOfElements.contains(fEnumerator)) { + listOfElements.add(fEnumerator); + } + // Verify if Enumerator and Enumeration have the same name. In that case add Enumerator to the list + String fEnumeratorName = fEnumerator.getName(); + if (fEnumeratorName.equals(fEnumerationType.getName())) { + if (!listOfEnumerators.contains(fEnumerator)) { + listOfEnumerators.add(fEnumerator); + } + } + } + } + } + } + + /** + * Add Enumerators and Struct members to a list + * Verify if an Enumeration and Enumerator have the same name. In that case the Enumerator is added to a list for it can be updated later + * Input: FDTypes + */ + private void validateTypecollectionAndElementsName(FDTypes fdTypeCollection) { + for (FDTypeDefinition fdType : fdTypeCollection.getTypes()) { + if (fdType instanceof FDStruct) { + for (FDField structElements : ((FDStruct)fdType).getFields()) { + if (!listOfElements.contains(structElements)) { + listOfElements.add(structElements); + } + } + } + if (fdType instanceof FDEnumeration) { + FEnumerationType fEnumerationType = ((FDEnumeration)fdType).getTarget(); + for (FEnumerator fEnumerator : fEnumerationType.getEnumerators()) { + if (!listOfElements.contains(fEnumerator)) { + listOfElements.add(fEnumerator); + } + // Verify if Enumerator and Enumeration have the same name. In that case add Enumerator to the list + String fEnumeratorName = fEnumerator.getName(); + if (fEnumeratorName.equals(fEnumerationType.getName())) { + if (!listOfEnumerators.contains(fEnumerator)) { + listOfEnumerators.add(fEnumerator); + } + } + } + } + } + + // Add to the list the elements that are only identified in FModel + for (FType fType : fdTypeCollection.getTarget().getTypes()) { + if (fType instanceof FStructType) { + for (FField structElements : ((FStructType)fType).getElements()) { + if (!listOfElements.contains(structElements)) { + listOfElements.add(structElements); + } + } + } + if (fType instanceof FEnumerationType) { + FEnumerationType fEnumerationType = (FEnumerationType)fType; + for (FEnumerator fEnumerator : fEnumerationType.getEnumerators()) { + if (!listOfElements.contains(fEnumerator)) { + listOfElements.add(fEnumerator); + } + // Verify if Enumerator and Enumeration have the same name. In that case add Enumerator to the list + String fEnumeratorName = fEnumerator.getName(); + if (fEnumeratorName.equals(fEnumerationType.getName())) { + if (!listOfEnumerators.contains(fEnumerator)) { + listOfEnumerators.add(fEnumerator); + } + } + } + } + } + } + + /** + * Add a suffix "_" to the elements it receives as input + * Method used when its already verified that In and Out arguments have the same name + */ + private void addSuffixForEqualInOut() { + for (Object object : listOfOutArguments) { + if (object instanceof FArgument) { + String outputKeyName = ((FArgument)object).getName(); + String outputKeyWithSuffix = outputKeyName + "_"; + ((FArgument)object).setName(outputKeyWithSuffix); + } + else if (object instanceof FDArgument) { + String outputKeyName = (((FDArgument)object).getTarget()).getName(); + String outputKeyWithSuffix = outputKeyName + "_"; + (((FDArgument)object).getTarget()).setName(outputKeyWithSuffix); + } + } + } + + /** + * Verify if In and Out parameters have the same name + * In that case add a suffix "_" to the Out element + */ + public void verifyEqualInOutAndAddSuffix(Object object) { + if (object instanceof FModel) { + for (FInterface fInterface : ((FModel)object).getInterfaces()) { + for (FMethod fMethod : fInterface.getMethods()) { + for (FArgument in : fMethod.getInArgs()) { + inArguments.put(in.getName(), in); + } + for (FArgument out : fMethod.getOutArgs()) { + String outputKeyName = out.getName(); + if (inArguments.containsKey(outputKeyName)) { + String outputKeyWithSuffix = outputKeyName + "_"; + out.setName(outputKeyWithSuffix); + } + } + inArguments.clear(); + } + } + } + else if (object instanceof FDModel) { + for (FDRootElement depl : ((FDModel)object).getDeployments()) { + if (depl instanceof FDInterface) { + for (FDMethod fdMethod : ((FDInterface)depl).getMethods()) { + if (fdMethod.getInArguments() != null) { + for (FDArgument in : fdMethod.getInArguments().getArguments()) { + inArguments.put(in.getTarget().getName(), in.getTarget()); + } + } + if (fdMethod.getOutArguments() != null) { + for (FDArgument out : fdMethod.getOutArguments().getArguments()) { + String outputKeyName = (out.getTarget()).getName(); + if (inArguments.containsKey(outputKeyName)) { + String outputKeyWithSuffix = outputKeyName + "_"; + (out.getTarget()).setName(outputKeyWithSuffix); + } + } + } + inArguments.clear(); + } + for (FMethod fMethod : ((FDInterface)depl).getTarget().getMethods()) { + for (FArgument in : fMethod.getInArgs()) { + inArguments.put(in.getName(), in); + } + for (FArgument out : fMethod.getOutArgs()) { + String outputKeyName = out.getName(); + if (inArguments.containsKey(outputKeyName)) { + String outputKeyWithSuffix = outputKeyName + "_"; + out.setName(outputKeyWithSuffix); + } + } + inArguments.clear(); + } + } + } + } + } + + /** + * Add a suffix "_" to the elements it receives as input + * Method used when its already verified that Enumerator has the same name of Enumeration + */ + private void verifyEnumerationAndParameterName() { + for (FEnumerator fEnumerator : listOfEnumerators) { + String fEnumeratorName = fEnumerator.getName(); + String fEnumeratorNameWithSuffix = fEnumeratorName + "_"; + fEnumerator.setName(fEnumeratorNameWithSuffix); + } + } + + /** + * Verify if the input name is a reserved identifier. In that case add a suffix "_" + */ + public void verifyReservedKeyword(Object object) { + if (object instanceof FArgument) { + String reservedKeyword = ((FArgument)object).getName(); + if (cppKeywords.handleReservedWords.containsKey(reservedKeyword)) { + String reservedKeywordWithSuffix = cppKeywords.handleReservedWords.get(reservedKeyword); + ((FArgument)object).setName(reservedKeywordWithSuffix); + } + } + else if (object instanceof FDArgument) { + String reservedKeyword = (((FDArgument)object).getTarget()).getName(); + if (cppKeywords.handleReservedWords.containsKey(reservedKeyword)) { + String reservedKeywordWithSuffix = cppKeywords.handleReservedWords.get(reservedKeyword); + (((FDArgument)object).getTarget()).setName(reservedKeywordWithSuffix); + } + } + else if (object instanceof FField) { + String reservedKeyword = ((FField)object).getName(); + if (cppKeywords.handleReservedWords.containsKey(reservedKeyword)) { + String reservedKeywordWithSuffix = cppKeywords.handleReservedWords.get(reservedKeyword); + ((FField)object).setName(reservedKeywordWithSuffix); + } + } + else if (object instanceof FDField) { + String reservedKeyword = (((FDField)object).getTarget()).getName(); + if (cppKeywords.handleReservedWords.containsKey(reservedKeyword)) { + String reservedKeywordWithSuffix = cppKeywords.handleReservedWords.get(reservedKeyword); + (((FDField)object).getTarget()).setName(reservedKeywordWithSuffix); + } + } + else if (object instanceof FAttribute) { + String reservedKeyword = ((FAttribute)object).getName(); + if (cppKeywords.handleReservedWords.containsKey(reservedKeyword)) { + String reservedKeywordWithSuffix = cppKeywords.handleReservedWords.get(reservedKeyword); + ((FAttribute)object).setName(reservedKeywordWithSuffix); + } + } + else if (object instanceof FDAttribute) { + String reservedKeyword = (((FDAttribute)object).getTarget()).getName(); + if (cppKeywords.handleReservedWords.containsKey(reservedKeyword)) { + String reservedKeywordWithSuffix = cppKeywords.handleReservedWords.get(reservedKeyword); + (((FDAttribute)object).getTarget()).setName(reservedKeywordWithSuffix); + } + } + else if (object instanceof FEnumerator) { + String reservedKeyword = ((FEnumerator)object).getName(); + if (cppKeywords.handleReservedWords.containsKey(reservedKeyword)) { + String reservedKeywordWithSuffix = cppKeywords.handleReservedWords.get(reservedKeyword); + ((FEnumerator)object).setName(reservedKeywordWithSuffix); + } + } + } +} \ No newline at end of file diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/ValidatorCore.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/ValidatorCore.java index f84dca6..8e2a147 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/ValidatorCore.java +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/verification/ValidatorCore.java @@ -307,12 +307,13 @@ protected void validateFInterfaceElements( } for (FMethod fMethod : fInterface.getMethods()) { validateName(messageAcceptor, fMethod); - for (FArgument out : fMethod.getOutArgs()) { - validateName(messageAcceptor, out); - } for (FArgument in : fMethod.getInArgs()) { validateName(messageAcceptor, in); } + + for (FArgument out : fMethod.getOutArgs()) { + validateName(messageAcceptor, out); + } } } @@ -326,13 +327,6 @@ private void validateName(ValidationMessageAcceptor messageAcceptor, messageAcceptor); return; } - if (cppKeywords.reservedWords.contains(name)) { - acceptError("Name " + name - + " is a reserved identifier", eObject, - FrancaPackage.Literals.FMODEL_ELEMENT__NAME, -1, - messageAcceptor); - return; - } } private boolean isFrancaVersionGreaterThan(int major, int minor, int micro) { diff --git a/org.genivi.commonapi.releng/pom.xml b/org.genivi.commonapi.releng/pom.xml index ba2b39c..751d120 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.2.0-SNAPSHOT + 3.2.14-SNAPSHOT pom 0.22.0 @@ -46,7 +46,7 @@ commonapi ${target.id} - 3.2.0-SNAPSHOT + 3.2.14-SNAPSHOT