Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions libs/bsw/transport/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
add_library(
transport
src/transport/AbstractTransportLayer.cpp
src/transport/DestituteTransportMessageProvider.cpp
src/transport/LogicalAddress.cpp
src/transport/QueuedTransportLayer.cpp
src/transport/SimpleTransportMessageProvider.cpp
src/transport/TransportLogger.cpp
src/transport/TransportMessage.cpp)
add_library(transport src/AbstractTransportLayer.cpp src/LogicalAddress.cpp
src/TransportLogger.cpp src/TransportMessage.cpp)

target_include_directories(transport PUBLIC include)

target_link_libraries(transport PUBLIC common estd util async)

if (BUILD_UNIT_TESTS)
add_library(
transportMock
mock/gmock/src/transport/TransportMessageProvidingListenerMock.cpp)
add_library(transportMock
mock/gmock/src/TransportMessageProvidingListenerMock.cpp)

target_include_directories(transportMock PUBLIC mock/gmock/include)

Expand Down
22 changes: 12 additions & 10 deletions libs/bsw/transport/include/transport/AbstractTransportLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class AbstractTransportLayer : public ::estd::forward_list_node<AbstractTranspor
/** Delegate for asynchronous notification when shutdown is done. */
using ShutdownDelegate = ::estd::function<void(AbstractTransportLayer&)>;

/** Return value of function shutdown in case shutdown was performed synchronously. */
/** Return value of function shutdown in case shutdown was performed
* synchronously. */
static bool const SYNC_SHUTDOWN_COMPLETE = true;

/**
Expand Down Expand Up @@ -59,9 +60,10 @@ class AbstractTransportLayer : public ::estd::forward_list_node<AbstractTranspor
*
* \note
* Receiving messages is only possible if an instance of
* ::transport::ITransportMessageProvider has been set using setTransportMessageProvider().
* To actually get access to the received messages set an
* ITransportMessageListener using setTransportMessageListener().
* ::transport::ITransportMessageProvider has been set using
* setTransportMessageProvider(). To actually get access to the received
* messages set an ITransportMessageListener using
* setTransportMessageListener().
*
* \return result of initialization
* - TP_OK: successfully initialized
Expand All @@ -73,14 +75,13 @@ class AbstractTransportLayer : public ::estd::forward_list_node<AbstractTranspor
/**
* Shuts down a transport layer instance. After completion of shutdown
* no sending and receiving of messages is possible.
* \param ShutdownDelegate Delegate that will be called in case shutdown is completed
* asynchronously.
* \return
* \param ShutdownDelegate Delegate that will be called in case shutdown
* is completed asynchronously. \return
* - true if shutdown is complete
* - false if shutdown will be done asynchronously.
* \note
* In case shutdown is completed immediately, SYNC_SHUTDOWN_COMPLETE will be returned
* an ShutdownDelegate will not be called to avoid recursion.
* In case shutdown is completed immediately, SYNC_SHUTDOWN_COMPLETE will be
* returned an ShutdownDelegate will not be called to avoid recursion.
*/

virtual bool shutdown(ShutdownDelegate);
Expand Down Expand Up @@ -118,7 +119,8 @@ class AbstractTransportLayer : public ::estd::forward_list_node<AbstractTranspor

protected:
/**
* Provides access to ITransportMessageProvidingListener for derived classes.
* Provides access to ITransportMessageProvidingListener for derived
* classes.
*/
ITransportMessageProvidingListener& getProvidingListenerHelper();

Expand Down

This file was deleted.

This file was deleted.

10 changes: 6 additions & 4 deletions libs/bsw/transport/include/transport/IDataProgressListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ namespace transport
class TransportMessage;

/**
* This interface is for classes that need to implement a function like routing on the fly.
* This interface is for classes that need to implement a function like routing
* on the fly.
*
* Routing on the fly does not require to wait until a complete
* TransportMessage has been received but routing commences when the first
Expand All @@ -32,9 +33,10 @@ class IDataProgressListener

public:
/**
* This function notifies an IDataProgressListener when new data has been added to a given
* TransportMessage. \param transportMessage TransportMessage that has had progress \param n
* Number of bytes that have been added
* This function notifies an IDataProgressListener when new data has been
* added to a given TransportMessage. \param transportMessage
* TransportMessage that has had progress \param n Number of bytes that have
* been added
*/
virtual void dataProgressed(TransportMessage& transportMessage, uint32_t n) = 0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class ITransportMessageProcessedListener
/**
* Callback being called when a TransportMessage has been processed.
* \param transportMessage the TransportMessage that has been processed
* \param result ProcessingResult indicating if the TransportMessage has
* been processed without errors
* \param result ProcessingResult indicating if the
* TransportMessage has been processed without errors
*/
virtual void
transportMessageProcessed(TransportMessage& transportMessage, ProcessingResult result)
Expand Down
15 changes: 8 additions & 7 deletions libs/bsw/transport/include/transport/ITransportMessageProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,21 @@ class ITransportMessageProvider
* \param sourceId id of TransportMessage's source
* \param targetId id of TransportMessage's target
* \param size size of the requested TransportMessage
* \param peek slice to the payload of the underlying data buffer
* \param pTransportMessage a pointer to TransportMessage (0L if no
* \param peek slice to the payload of the underlying data
* buffer \param pTransportMessage a pointer to TransportMessage (0L if no
* message was available) is written to this pointer.
* \return
* - TPMSG_OK: pTransportMessage has been set
* - TPMSG_INVALID_SRC_ID: sourceId is not allowed from srcBusId
* - TPMSG_INVALID_TGT_ID: requested targetId is invalid
* - TPMSG_NO_MSG_AVAILABLE: all params are valid but all
* TransportMessages are currently locked
* - TPMSG_NOT_RESPONSIBLE: not the correct provider for this request
* - TPMSG_NOT_RESPONSIBLE: not the correct provider for this
* request
*
* \note
* The TransportMessage must be released by a call to releaseTransportMessage
* before it can be returned again by this method.
* The TransportMessage must be released by a call to
* releaseTransportMessage before it can be returned again by this method.
*/
virtual ErrorCode getTransportMessage(
uint8_t srcBusId,
Expand All @@ -74,8 +75,8 @@ class ITransportMessageProvider
* Function to return a \p transportMessage to this provider.
*
* \note
* The provider must be also able to accept a \p transportMessage, which doesn't
* belong to it and e.g. ignore it. This is not an error case.
* The provider must be also able to accept a \p transportMessage, which
* doesn't belong to it and e.g. ignore it. This is not an error case.
*/
virtual void releaseTransportMessage(TransportMessage& transportMessage) = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ class TransportMessage;
* A typical TransportMessage listening transaction has the following steps:
* - a transport layer call getTransportMessage to get a buffer to receive to
* - once the message is completely received messageReceived gets called
* - when the transport layer is done with the message it calls releaseTransportMessage and the
* message may be used again
* - when the transport layer is done with the message it calls
* releaseTransportMessage and the message may be used again
*/
class ITransportMessageProvidingListener
: public ITransportMessageListener
, public ITransportMessageProvider
{
ITransportMessageProvidingListener& operator=(ITransportMessageProvidingListener const&);
public:
ITransportMessageProvidingListener& operator=(ITransportMessageProvidingListener const&)
= delete;
};

} // namespace transport
Expand Down
5 changes: 2 additions & 3 deletions libs/bsw/transport/include/transport/LogicalAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <estd/optional.h>
#include <estd/slice.h>

#include <algorithm>
#include <array>

namespace transport
Expand All @@ -21,10 +20,10 @@ struct LogicalAddress
namespace addressfinder
{
::estd::optional<LogicalAddress>
findDoipAddressInSlice(uint16_t const address, ::estd::slice<LogicalAddress const> const& list);
findDoipAddressInSlice(uint16_t address, ::estd::slice<LogicalAddress const> const& list);

::estd::optional<LogicalAddress>
find8BitAddressInSlice(uint16_t const address, ::estd::slice<LogicalAddress const> const& list);
find8BitAddressInSlice(uint16_t address, ::estd::slice<LogicalAddress const> const& list);

inline bool isDoipAddressIn(uint16_t const address, ::estd::slice<LogicalAddress const> const& list)
{
Expand Down
Loading