Skip to content

Commit

Permalink
CommonAPI-SomeIP 3.1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
juergengehring committed Jun 19, 2017
1 parent c3acaae commit fcead99
Show file tree
Hide file tree
Showing 29 changed files with 816 additions and 437 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Changes
=======
v3.1.12
- set CommonAPI CallStatus if wrong CRC value was received
- consider version in address translation for SOME/IP
- added backwards compatibility for splitted / merged service inferfaces

v3.1.11.4
- Fixed potential busy loop for mainloop applications

Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set (CMAKE_VERBOSE_MAKEFILE off)

set (LIBCOMMONAPI_SOMEIP_MAJOR_VERSION 3)
set (LIBCOMMONAPI_SOMEIP_MINOR_VERSION 1)
set (LIBCOMMONAPI_SOMEIP_PATCH_VERSION 11)
set (LIBCOMMONAPI_SOMEIP_PATCH_VERSION 12)

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

Expand Down Expand Up @@ -119,9 +119,9 @@ endforeach ()
###################################################################################################

if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
FIND_PACKAGE(CommonAPI 3.1.11 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
FIND_PACKAGE(CommonAPI 3.1.12 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
else()
FIND_PACKAGE(CommonAPI 3.1.11 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
FIND_PACKAGE(CommonAPI 3.1.12 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
endif()

message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
Expand All @@ -132,7 +132,7 @@ message(STATUS "CommonAPI Version: ${CommonAPI_VERSION}")
find_package( Boost 1.54 COMPONENTS system thread log REQUIRED )
include_directories( ${Boost_INCLUDE_DIR} )

find_package (vsomeip 2.6.0 REQUIRED)
find_package (vsomeip 2.7.0 REQUIRED)
message(STATUS "vsomeip version: ${vsomeip_VERSION}")

include_directories (
Expand Down
4 changes: 2 additions & 2 deletions include/CommonAPI/SomeIP/Address.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class COMMONAPI_EXPORT Address {
public:
Address();
Address(const service_id_t _service, const instance_id_t _instance,
major_version_t _major_version = DEFAULT_MAJOR_VERSION,
minor_version_t _minor_version = DEFAULT_MINOR_VERSION);
major_version_t _major_version = ANY_MAJOR_VERSION,
minor_version_t _minor_version = ANY_MINOR_VERSION);
Address(const Address &_source);

Address &operator=(const Address &_source);
Expand Down
21 changes: 21 additions & 0 deletions include/CommonAPI/SomeIP/AddressTranslator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,39 @@ class AddressTranslator {
service_id_t _service, instance_id_t _instance,
major_version_t _major, minor_version_t _minor);

COMMONAPI_EXPORT const Address & getAddressAlias(const Address &_address) const;
COMMONAPI_EXPORT method_id_t getMethodAlias(const Address &_address,
const method_id_t _method) const;
COMMONAPI_EXPORT eventgroup_id_t getEventgroupAlias(const Address &_address,
const eventgroup_id_t _eventgroup) const;

private:
COMMONAPI_EXPORT bool readConfiguration();
COMMONAPI_EXPORT void readServiceAlias(const std::string &_source,
const std::string &_target);
COMMONAPI_EXPORT void readMethodAlias(const std::string &_source,
const std::string &_target);
COMMONAPI_EXPORT void readEventgroupAlias(const std::string &_source,
const std::string &_target);
COMMONAPI_EXPORT bool readValue(const std::string &_data,
Address &_sourceAddress, uint16_t &_id, bool _readId);

COMMONAPI_EXPORT bool isValidService(const service_id_t) const;
COMMONAPI_EXPORT bool isValidInstance(const instance_id_t) const;
COMMONAPI_EXPORT bool isValidMethod(const method_id_t) const;
COMMONAPI_EXPORT bool isValidEventgroup(const eventgroup_id_t) const;

private:
std::string defaultConfig_;

std::map<CommonAPI::Address, Address> forwards_;
std::map<Address, CommonAPI::Address> backwards_;

typedef std::map<method_id_t, method_id_t> MethodAlias_t;
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_;

std::mutex mutex_;
};

Expand Down
2 changes: 0 additions & 2 deletions include/CommonAPI/SomeIP/Attribute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ class ObservableAttribute: public AttributeType_ {
_eventId,
true,
_isLittleEndian,
_getMethodId,
_getReliable,
std::make_tuple(CommonAPI::Deployable<ValueType, ValueTypeDepl>(this->depl_))) {
}

Expand Down
55 changes: 24 additions & 31 deletions include/CommonAPI/SomeIP/Connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <CommonAPI/SomeIP/StubManager.hpp>
#include <CommonAPI/SomeIP/DispatchSource.hpp>
#include <CommonAPI/SomeIP/Watch.hpp>
#include <CommonAPI/SomeIP/SubscriptionStatusWrapper.hpp>

namespace CommonAPI {
namespace SomeIP {
Expand Down Expand Up @@ -76,13 +77,15 @@ struct ErrQueueEntry : QueueEntry {
ErrQueueEntry(std::weak_ptr<ProxyConnection::EventHandler> _eventHandler,
uint16_t _errorCode, uint32_t _tag,
service_id_t _service, instance_id_t _instance,
eventgroup_id_t _eventGroup) :
eventgroup_id_t _eventGroup,
event_id_t _event) :
eventHandler_(_eventHandler),
errorCode_(_errorCode),
tag_(_tag),
service_(_service),
instance_(_instance),
eventGroup_(_eventGroup) {}
eventGroup_(_eventGroup),
event_(_event) {}
virtual ~ErrQueueEntry() {}

std::weak_ptr<ProxyConnection::EventHandler> eventHandler_;
Expand All @@ -91,6 +94,7 @@ struct ErrQueueEntry : QueueEntry {
service_id_t service_;
instance_id_t instance_;
eventgroup_id_t eventGroup_;
event_id_t event_;

void process(std::shared_ptr<Connection> _connection);
};
Expand Down Expand Up @@ -153,10 +157,6 @@ class Connection:
eventgroup_id_t eventGroupId, event_id_t eventId,
ProxyConnection::EventHandler* _eventHandler, major_version_t major, minor_version_t minor);

void subscribeForSelective(service_id_t serviceId, instance_id_t instanceId,
eventgroup_id_t eventGroupId, event_id_t eventId,
std::weak_ptr<ProxyConnection::EventHandler> _eventHandler, uint32_t _tag, major_version_t major);

virtual bool attachMainLoopContext(std::weak_ptr<MainLoopContext>);

virtual bool isAvailable(const Address &_address);
Expand Down Expand Up @@ -206,12 +206,6 @@ class Connection:
virtual void queueSelectiveErrorHandler(service_id_t serviceId,
instance_id_t instanceId);

virtual void subscribeForField(service_id_t serviceId,
instance_id_t instanceId,
eventgroup_id_t eventGroupId,
event_id_t eventId,
major_version_t major);

virtual void incrementConnection();
virtual void decrementConnection();

Expand All @@ -223,6 +217,11 @@ class Connection:

virtual void getAvailableInstances(service_id_t _serviceId, std::vector<std::string> *_instances);

void subscribe(service_id_t serviceId, instance_id_t instanceId,
eventgroup_id_t eventGroupId, event_id_t eventId,
std::weak_ptr<ProxyConnection::EventHandler> _eventHandler,
uint32_t _tag, major_version_t major);

private:
void receive(const std::shared_ptr<vsomeip::message> &_message);
void handleProxyReceive(const std::shared_ptr<vsomeip::message> &_message);
Expand All @@ -235,12 +234,21 @@ class Connection:
void dispatch();
void cleanup();

void addSelectiveErrorListener(service_id_t serviceId,
void addSubscriptionStatusListener(service_id_t serviceId,
instance_id_t instanceId,
eventgroup_id_t eventGroupId);
eventgroup_id_t eventGroupId,
event_id_t _eventId);

void queueSubscriptionStatusHandler(service_id_t serviceId,
instance_id_t instanceId);

void doDisconnect();

void insertSubscriptionStatusListener(service_id_t serviceId, instance_id_t instanceId,
eventgroup_id_t eventGroupId, event_id_t eventId,
std::weak_ptr<ProxyConnection::EventHandler> eventHandler,
uint32_t _tag);

std::shared_ptr<std::thread> dispatchThread_;

std::weak_ptr<MainLoopContext> mainLoopContext_;
Expand Down Expand Up @@ -284,13 +292,6 @@ class Connection:
std::weak_ptr<ProxyConnection::EventHandler>>>>> events_map_t;
mutable events_map_t eventHandlers_;

typedef std::map<service_id_t,
std::map<instance_id_t,
std::map<event_id_t, uint32_t>>> subscription_counter_map_t;

mutable subscription_counter_map_t subscriptionCounters_;


mutable std::mutex availabilityMutex_;
typedef std::map<service_id_t,
std::map<instance_id_t,
Expand All @@ -307,16 +308,8 @@ class Connection:
uint32_t activeConnections_;
std::mutex activeConnectionsMutex_;

std::map<service_id_t,
std::map<instance_id_t,
std::map<eventgroup_id_t,
std::queue<std::pair<std::weak_ptr<ProxyConnection::EventHandler>, std::set<uint32_t>>>>>> selectiveErrorHandlers_;

std::map<service_id_t,
std::map<instance_id_t,
std::map<eventgroup_id_t,
std::map<ProxyConnection::EventHandler* ,
std::pair<std::weak_ptr<ProxyConnection::EventHandler>, std::set<uint32_t>>>>>> pendingSelectiveErrorHandlers_;
std::map<std::tuple<service_id_t, instance_id_t, eventgroup_id_t, event_id_t>,
std::shared_ptr<SubscriptionStatusWrapper>> subscriptionStates_;

std::mutex availabilityCalledMutex_;
std::map<service_id_t, std::map<instance_id_t, bool>> availabilityCalled_;
Expand Down
7 changes: 7 additions & 0 deletions include/CommonAPI/SomeIP/Constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace CommonAPI {
namespace SomeIP {

const method_id_t ANY_METHOD = vsomeip::ANY_METHOD;
const major_version_t ANY_MAJOR_VERSION = vsomeip::ANY_MAJOR;
const minor_version_t ANY_MINOR_VERSION = vsomeip::ANY_MINOR;

const major_version_t DEFAULT_MAJOR_VERSION = vsomeip::DEFAULT_MAJOR;
Expand All @@ -37,6 +38,12 @@ const instance_id_t MAX_INSTANCE_ID = 0xFFFE;
const ms_t ASYNC_MESSAGE_REPLY_TIMEOUT_MS = 5000;
const ms_t ASYNC_MESSAGE_CLEANUP_INTERVAL_MS = 1000;

const method_id_t MIN_METHOD_ID = 0x0001;
const method_id_t MAX_METHOD_ID = 0xFFFE;

const eventgroup_id_t MIN_EVENTGROUP_ID = 0x0001;
const eventgroup_id_t MAX_EVENTGROUP_ID = 0xFFFE;

static const CommonAPI::CallInfo defaultCallInfo(CommonAPI::DEFAULT_SEND_TIMEOUT_MS);

} // namespace SomeIP
Expand Down
Loading

0 comments on commit fcead99

Please sign in to comment.