From bfb8465657c4fa919f15d059070680bcea521c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D0=BB=D0=B0=20=D0=93=D0=BE=D1=80?= =?UTF-8?q?=D0=BD=D1=83=D1=88=D0=BA=D0=BE?= Date: Wed, 29 Nov 2023 14:27:22 +0300 Subject: [PATCH] finished matches_filters logic --- main/can.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main/can.c b/main/can.c index e005b00..67ba8a5 100644 --- a/main/can.c +++ b/main/can.c @@ -73,7 +73,16 @@ void can_msg_to_str(twai_message_t *can_msg, char *start_str, char *out_str) { } bool matches_filters(twai_message_t *msg) { - return true; + List *tmp_cursor = adv_filters.filters; + while (tmp_cursor != NULL) { + smart_filt_element_t *curr_filter; + curr_filter = (smart_filt_element_t *) tmp_cursor->data; + if ((msg->identifier & curr_filter->mask) == curr_filter->filt) { + return true; + } + tmp_cursor = tmp_cursor->next; + } + return false; } // TODO: add software filtering