Skip to content

Commit a448570

Browse files
Merge pull request #154 from SWISensorHub/pr_transport_arb_has_message
transport arbitrator: override Transport::hasMessage
2 parents 0fb650d + a413e21 commit a448570

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

erpc_c/infra/erpc_transport_arbitrator.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ void TransportArbitrator::setCrc16(Crc16 *crcImpl)
4949
m_sharedTransport->setCrc16(crcImpl);
5050
}
5151

52+
bool TransportArbitrator::hasMessage(void)
53+
{
54+
assert(m_sharedTransport && "shared transport is not set");
55+
56+
return m_sharedTransport->hasMessage();
57+
}
58+
5259
erpc_status_t TransportArbitrator::receive(MessageBuffer *message)
5360
{
5461
assert(m_sharedTransport && "shared transport is not set");

erpc_c/infra/erpc_transport_arbitrator.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ class TransportArbitrator : public Transport
121121
*/
122122
virtual void setCrc16(Crc16 *crcImpl) override;
123123

124+
/*!
125+
* @brief Check if the underlying shared transport has a message
126+
*
127+
* @retval The underlying transport is expected to return true when a message is available to
128+
* process and false otherwise.
129+
*/
130+
virtual bool hasMessage(void);
131+
124132
protected:
125133
Transport *m_sharedTransport; //!< Transport being shared through this arbitrator.
126134
Codec *m_codec; //!< Codec used to read incoming message headers.

0 commit comments

Comments
 (0)