Skip to content

Commit d77db3f

Browse files
tridgebugobliterator
authored andcommitted
Transfer type is not checked in c++ wrappers
fixes #79 thanks to Mykhaylo Shcherbak
1 parent 9b05a4d commit d77db3f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

canard/handler_list.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,17 @@ class HandlerList {
5454
/// @brief accept a message if it is handled by this handler list
5555
/// @param index Index of the handler list
5656
/// @param msgid ID of the message/service
57+
/// @param transfer_type canard tranfer type (Broadcast, request or reply)
5758
/// @param[out] signature Signature of the message/service
5859
/// @return true if the message is handled by this handler list
59-
static bool accept_message(uint8_t index, uint16_t msgid, uint64_t &signature) NOINLINE_FUNC
60+
static bool accept_message(uint8_t index, uint16_t msgid, CanardTransferType transfer_type, uint64_t &signature) NOINLINE_FUNC
6061
{
6162
#ifdef WITH_SEMAPHORE
6263
WITH_SEMAPHORE(sem[index]);
6364
#endif
6465
HandlerList* entry = head[index];
6566
while (entry != nullptr) {
66-
if (entry->msgid == msgid) {
67+
if (entry->msgid == msgid && entry->transfer_type == transfer_type) {
6768
signature = entry->signature;
6869
return true;
6970
}

canard/interface.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,11 @@ class Interface {
9595
protected:
9696
/// @brief forward accept_message call to indexed HandlerList
9797
/// @param msgid ID of the message/service
98+
/// @param transfer_type - transfer type
9899
/// @param[out] signature signature of message/service
99100
/// @return true if the message/service is accepted
100-
inline bool accept_message(uint16_t msgid, uint64_t &signature) {
101-
return HandlerList::accept_message(index, msgid, signature);
101+
inline bool accept_message(uint16_t msgid, CanardTransferType transfer_type, uint64_t &signature) {
102+
return HandlerList::accept_message(index, msgid, transfer_type, signature);
102103
}
103104

104105
/// @brief forward handle_message call to indexed HandlerList
@@ -111,4 +112,4 @@ class Interface {
111112
bool canfd; ///< true if the interface is CAN FD
112113
};
113114

114-
} // namespace Canard
115+
} // namespace Canard

0 commit comments

Comments
 (0)