low-can-hat: improve format 23/23223/6
authorRomain Forlot <romain.forlot@iot.bzh>
Thu, 21 Nov 2019 12:44:24 +0000 (13:44 +0100)
committerRomain Forlot <romain.forlot@iot.bzh>
Thu, 9 Jan 2020 14:55:03 +0000 (15:55 +0100)
Weird way test to make test are now fixed to be more readable.

Bug-AGL: SPEC-2988

Change-Id: I81d716ac3799c4217e720a13d8ba78a46996a2c3
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
low-can-binding/binding/low-can-hat.cpp

index 26795f4..5a26874 100644 (file)
@@ -66,12 +66,12 @@ int read_message(sd_event_source *event_source, int fd, uint32_t revents, void *
                if(can_subscription->get_index() != -1)
                {
                        std::shared_ptr<utils::socketcan_t> s = can_subscription->get_socket();
-                       if(s->socket() && s->socket() != -1)
+                       if(s->socket() > 0)
                        {
                                std::shared_ptr<message_t> message = s->read_message();
 
                                // Sure we got a valid CAN message ?
-                               if (! message->get_id() == 0 && ! message->get_length() == 0 && message->get_flags() & INVALID_FLAG)
+                               if (message->get_id() && message->get_length() && !(message->get_flags() & INVALID_FLAG))
                                        push_n_notify(message);
                        }
                }