Skip to content

Commit

Permalink
capicxx-someip-runtime 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzbichler committed Oct 27, 2020
1 parent 92ece2f commit 0ad2bdc
Show file tree
Hide file tree
Showing 58 changed files with 780 additions and 432 deletions.
29 changes: 29 additions & 0 deletions Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
capi_someip_srcs = [
"src/CommonAPI/SomeIP/**/*.cpp"
]

cc_library_shared {
name: "libCommonAPI-SomeIP",
vendor: true,
srcs: capi_someip_srcs,
defaults: [
"capi_defaults"
],
cppflags: [
"-D_GLIBCXX_USE_NANOSLEEP",
"-DBOOST_LOG_DYN_LINK",
"-pthread",
"-Wno-unused-private-field"
],
local_include_dirs: [
"include"
],
export_include_dirs: [
"include"
],
shared_libs: [
"libCommonAPI",
"libvsomeip"
],
rtti: true
}
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changes
=======

v3.2.0
- Adapt to CommonAPI v3.2.0

v3.1.12.17
- Fix race condition which could occur when doing calls on an
unavailable proxy. The race could lead to waiting the complete
Expand Down
37 changes: 19 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2013-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
# Copyright (C) 2013-2020 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/.
Expand All @@ -10,8 +10,8 @@ project (CommonAPI-SomeIP)
set (CMAKE_VERBOSE_MAKEFILE off)

set (LIBCOMMONAPI_SOMEIP_MAJOR_VERSION 3)
set (LIBCOMMONAPI_SOMEIP_MINOR_VERSION 1)
set (LIBCOMMONAPI_SOMEIP_PATCH_VERSION 12)
set (LIBCOMMONAPI_SOMEIP_MINOR_VERSION 2)
set (LIBCOMMONAPI_SOMEIP_PATCH_VERSION 0)

message(STATUS "Project name: ${PROJECT_NAME}")

Expand Down Expand Up @@ -47,9 +47,9 @@ if(NOT CMAKE_BUILD_TYPE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

if (MSVC)
if (MSVC)
# Boost
find_package( Boost 1.54 COMPONENTS system thread log REQUIRED )
find_package( Boost 1.55 COMPONENTS system thread log REQUIRED )
if(Boost_FOUND)
if(Boost_LIBRARY_DIR)
MESSAGE( STATUS "Boost_LIBRARY_DIR not empty using it: ${Boost_LIBRARY_DIR}" )
Expand All @@ -66,17 +66,22 @@ include_directories( ${Boost_INCLUDE_DIR} )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS /wd4503")
link_directories(${Boost_LIBRARY_DIR})
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wformat -Wformat-security -Wconversion -fexceptions -fstrict-aliasing -fstack-protector -fasynchronous-unwind-tables -fno-omit-frame-pointer -DCOMMONAPI_INTERNAL_COMPILATION -D_GLIBCXX_USE_NANOSLEEP -DBOOST_LOG_DYN_LINK -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wformat -Wformat-security -Wconversion -fexceptions -fstrict-aliasing -fstack-protector -fasynchronous-unwind-tables -fno-omit-frame-pointer -DCOMMONAPI_INTERNAL_COMPILATION -D_GLIBCXX_USE_NANOSLEEP -DBOOST_LOG_DYN_LINK -pthread -fvisibility=hidden")
endif()

SET(MAX_LOG_LEVEL "DEBUG" CACHE STRING "maximum log level")
message(STATUS "MAX_LOG_LEVEL is set to value: ${MAX_LOG_LEVEL}")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_INTERNAL_COMPILATION")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_SOMEIP_VERSION_MAJOR=${LIBCOMMONAPI_SOMEIP_MAJOR_VERSION}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_SOMEIP_VERSION_MINOR=${LIBCOMMONAPI_SOMEIP_MINOR_VERSION}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_SOMEIP_VERSION_MAJOR=${LIBCOMMONAPI_SOMEIP_MAJOR_VERSION}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_SOMEIP_VERSION_MINOR=${LIBCOMMONAPI_SOMEIP_MINOR_VERSION}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_LOGLEVEL=COMMONAPI_LOGLEVEL_${MAX_LOG_LEVEL}")

if (ENABLE_ADDRESS_ALIASES)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_ENABLE_ADDRESS_ALIASES")
message(STATUS "Enabled address aliasing.")
endif ()

# Package config module not found message macro
macro (pkg_config_module_not_found_message PKG_CONFIG_MODULE)
message (FATAL_ERROR "pkg-config could not find the required module ${PKG_CONFIG_MODULE}!"
Expand Down Expand Up @@ -111,27 +116,23 @@ endforeach ()
###################################################################################################

if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
FIND_PACKAGE(CommonAPI 3.1.12 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
FIND_PACKAGE(CommonAPI 3.2.0 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
else()
FIND_PACKAGE(CommonAPI 3.1.12 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
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}")
message(STATUS "CommonAPI Version: ${CommonAPI_VERSION}")

# Boost
find_package( Boost 1.54 COMPONENTS system thread log REQUIRED )
include_directories( ${Boost_INCLUDE_DIR} )

find_package (vsomeip 2.10.0 REQUIRED)
message(STATUS "vsomeip version: ${vsomeip_VERSION}")
find_package (vsomeip3 3.1.0 REQUIRED)
message(STATUS "Using vsomeip3 - v${vsomeip3_VERSION}")

include_directories (
include
${Boost_INCLUDE_DIR}
${COMMONAPI_INCLUDE_DIRS}
${VSOMEIP_INCLUDE_DIRS}
${VSOMEIP3_INCLUDE_DIRS}
)

file (GLOB CommonAPI-SomeIP_SRC "src/CommonAPI/SomeIP/*.cpp")
Expand All @@ -140,7 +141,7 @@ list (SORT CommonAPI-SomeIP_SRC)
# CommonAPI
add_library (CommonAPI-SomeIP SHARED ${CommonAPI-SomeIP_SRC})
set_target_properties (CommonAPI-SomeIP PROPERTIES VERSION ${COMPONENT_VERSION} SOVERSION ${COMPONENT_VERSION})
target_link_libraries (CommonAPI-SomeIP CommonAPI vsomeip)
target_link_libraries (CommonAPI-SomeIP CommonAPI ${VSOMEIP_LIBRARIES})

if (MSVC)
target_link_libraries(CommonAPI-SomeIP ws2_32 Rpcrt4)
Expand Down
2 changes: 1 addition & 1 deletion CommonAPI-SomeIP.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Description: C++ CommonAPI SOME/IP Runtime
Version: @COMPONENT_VERSION@
Libs: -L${libdir} -lCommonAPI-SomeIP
Requires: CommonAPI
Requires.private: vsomeip
Requires.private: vsomeip3
Cflags: -I${includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@

30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### CommonAPI C++ SOME/IP Runtime

##### Copyright
Copyright (C) 2016-2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG).
Copyright (C) 2016-2017, GENIVI Alliance, Inc.
Copyright (C) 2016-2020, Bayerische Motoren Werke Aktiengesellschaft (BMW AG).
Copyright (C) 2016-2020, GENIVI Alliance, Inc.

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.
Expand All @@ -14,13 +14,13 @@ This Source Code Form is subject to the terms of the Mozilla Public License, v.
The user guide can be found in the documentation directory of the CommonAPI-SomeIP-Tools project as AsciiDoc document. A pdf version can be found at https://github.com/GENIVI/capicxx-someip-tools/releases.

##### Further information
https://genivi.github.io/capicxx-someip-tools/
https://genivi.github.io/capicxx-core-tools/

##### Build Instructions for Linux

###### vsomeip
###### CommonAPI Core Runtime and vsomeip

In order to build the CommonAPI SOME/IP Runtime library the vsomeip library must be available on your system. Please consult the vsomeip documentation for informations on building vsomeip.
In order to build the CommonAPI SOME/IP Runtime library the CommonAPI Core Runtime library and the vsomeip library must be available on your system. Please consult the CommonAPI and vsomeip documentation for information on building CommonAPI Core Runtime/vsomeip for Android.

###### Build CommonAPI-SomeIP Runtime

Expand All @@ -37,3 +37,23 @@ $ make install
You can change the installation directory by the CMake variable _CMAKE_INSTALL_PREFIX_ or you can let it uninstalled (skip the _make install_ command). If you want to use the uninstalled version of CommonAPI set the CMake variable _USE_INSTALLED_COMMONAPI_ to _OFF_.

For further build instructions (build for windows, build documentation, tests etc.) please refer to the CommonAPI SOME/IP tutorial.

##### Build Instructions for Android

###### CommonAPI Core Runtime and vsomeip

In order to build the CommonAPI SOME/IP Runtime library the CommonAPI Core Runtime library and the vsomeip library must be included in the Android source tree. Please consult the CommonAPI and vsomeip documentation for information on building CommonAPI Core Runtime/vsomeip for Android.

###### Build CommonAPI-SomeIP Runtime

In general for building the Android source tree the instructions found on the pages from the Android Open Source Project (AOSP) apply (https://source.android.com/setup/build/requirements).

To integrate the CommonAPI SOME/IP Runtime library into the build process, the source code together with the Android.bp file has to be inserted into the Android source tree (by simply copying or by fetching with a custom platform manifest).
When building the Android source tree, the Android.bp file is automatically found and considered by the build system.

In order that the CommonAPI SOME/IP Runtime library is also included in the Android image, the library has to be added to the PRODUCT_PACKAGES variable in one of a device/target specific makefile:

```
PRODUCT_PACKAGES += \
libCommonAPI-SomeIP
```
2 changes: 1 addition & 1 deletion include/CommonAPI/SomeIP/Address.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2014-2020 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/.
Expand Down
6 changes: 4 additions & 2 deletions include/CommonAPI/SomeIP/AddressTranslator.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2014-2020 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/.
Expand Down Expand Up @@ -74,7 +74,9 @@ class AddressTranslator {
typedef std::map<eventgroup_id_t, eventgroup_id_t> EventgroupAlias_t;
typedef std::tuple<Address, MethodAlias_t, EventgroupAlias_t> Alias_t;
std::map<Address, Alias_t > aliases_;

#ifdef COMMONAPI_ENABLE_ADDRESS_ALIASES
std::map<CommonAPI::Address, CommonAPI::Address> others_;
#endif // COMMONAPI_ENABLE_ADDRESS_ALIASES
std::mutex mutex_;
};

Expand Down
7 changes: 4 additions & 3 deletions include/CommonAPI/SomeIP/Attribute.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2014-2020 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/.
Expand Down Expand Up @@ -184,13 +184,15 @@ class ObservableAttribute: public AttributeType_ {
const event_id_t _eventId,
const method_id_t _getMethodId,
const bool _getReliable,
const reliability_type_e _reliabilityType,
const bool _isLittleEndian,
AttributeType_Arguments... _arguments)
: AttributeType_(_proxy, _getMethodId, _getReliable, _isLittleEndian, _arguments...),
changedEvent_(_proxy,
_eventgroupId,
_eventId,
true,
CommonAPI::SomeIP::event_type_e::ET_FIELD,
_reliabilityType,
_isLittleEndian,
std::make_tuple(CommonAPI::Deployable<ValueType, ValueTypeDepl>(this->depl_))) {
}
Expand All @@ -206,5 +208,4 @@ class ObservableAttribute: public AttributeType_ {
} // namespace SomeIP
} // namespace CommonAPI


#endif // COMMONAPI_SOMEIP_ATTRIBUTE_HPP_
8 changes: 6 additions & 2 deletions include/CommonAPI/SomeIP/ClientId.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2014-2020 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/.
Expand Down Expand Up @@ -30,17 +30,21 @@ class COMMONAPI_EXPORT_CLASS_EXPLICIT ClientId : public CommonAPI::ClientId{
friend struct std::hash< ClientId >;

public:
COMMONAPI_EXPORT ClientId(client_id_t client_id);
COMMONAPI_EXPORT ClientId(client_id_t client_id, uid_t _uid, gid_t _gid);
COMMONAPI_EXPORT virtual ~ClientId();

COMMONAPI_EXPORT bool operator==(CommonAPI::ClientId& clientIdToCompare);
COMMONAPI_EXPORT bool operator==(ClientId& clientIdToCompare);
COMMONAPI_EXPORT size_t hashCode();

COMMONAPI_EXPORT client_id_t getClientId();
COMMONAPI_EXPORT uid_t getUid() const;
COMMONAPI_EXPORT gid_t getGid() const;

protected:
client_id_t client_id_;
uid_t uid_;
gid_t gid_;
};

} // namespace SomeIP
Expand Down
6 changes: 5 additions & 1 deletion include/CommonAPI/SomeIP/CommonAPISomeIP.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2015-2020 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/.
Expand All @@ -8,10 +8,14 @@

#ifndef COMMONAPI_INTERNAL_COMPILATION
#define COMMONAPI_INTERNAL_COMPILATION
#define HAS_DEFINED_COMMONAPI_INTERNAL_COMPILATION_HERE
#endif

#include "AddressTranslator.hpp"

#ifdef HAS_DEFINED_COMMONAPI_INTERNAL_COMPILATION_HERE
#undef COMMONAPI_INTERNAL_COMPILATION
#undef HAS_DEFINED_COMMONAPI_INTERNAL_COMPILATION_HERE
#endif

#endif // COMMONAPI_SOMEIP_HPP_
3 changes: 1 addition & 2 deletions include/CommonAPI/SomeIP/Configuration.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// Copyright (C) 2014-2020 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/.
Expand All @@ -21,4 +21,3 @@ struct FactoryConfig {
} // namespace CommonAPI

#endif // COMMONAPI_SOMEIP_CONFIGURATION_HPP_

Loading

0 comments on commit 0ad2bdc

Please sign in to comment.