aboutsummaryrefslogtreecommitdiffstats
path: root/low-can-binding/binding/low-can-hat.hpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-07-01 18:55:23 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2019-07-03 09:37:05 +0200
commit3977705505069b4210b29e8188cdd35813c65886 (patch)
tree91664b21e4cb83e91b2288ff7e2e720171a80362 /low-can-binding/binding/low-can-hat.hpp
parent105d083165b263851edfcd3ffb7f64acb888d14b (diff)
When sending a CAN signal make an case-insensitive comparison as it isn't necessary to be strict on that, so case insensitive if fine. Update the documentation accordingly. Bug-AGL: SPEC-2582 Change-Id: I998b64cdd9a381da3da582aeba42ab726fff1259 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/binding/low-can-hat.hpp')
-rw-r--r--low-can-binding/binding/low-can-hat.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/low-can-binding/binding/low-can-hat.hpp b/low-can-binding/binding/low-can-hat.hpp
index e21b9cd0..1662ce04 100644
--- a/low-can-binding/binding/low-can-hat.hpp
+++ b/low-can-binding/binding/low-can-hat.hpp
@@ -23,6 +23,7 @@
#include <string>
#include <memory>
#include <systemd/sd-event.h>
+#include <cctype>
#include <afb/afb-binding>
@@ -31,3 +32,12 @@ class low_can_subscription_t;
void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, std::map<int, std::shared_ptr<low_can_subscription_t> >& s);
void on_no_clients(std::shared_ptr<low_can_subscription_t> can_subscription, uint32_t pid, std::map<int, std::shared_ptr<low_can_subscription_t> >& s);
int read_message(sd_event_source *s, int fd, uint32_t revents, void *userdata);
+
+inline bool caseInsCharCompareN(char a, char b) {
+ return(toupper(a) == toupper(b));
+}
+
+inline bool caseInsCompare(const std::string& s1, const std::string& s2) {
+ return((s1.size() == s2.size()) &&
+ equal(s1.begin(), s1.end(), s2.begin(), caseInsCharCompareN));
+}