All: Make format coherent with the whole project 98/23198/6
authorRomain Forlot <romain.forlot@iot.bzh>
Wed, 4 Dec 2019 16:54:38 +0000 (17:54 +0100)
committerRomain Forlot <romain.forlot@iot.bzh>
Thu, 9 Jan 2020 13:38:26 +0000 (14:38 +0100)
Add a space after a comma
Change some aligments

Bug-AGL: SPEC-2988

Change-Id: I5069120f4bbb33742bb4990e2e1f391ec8d5eeb6
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
21 files changed:
low-can-binding/binding/application.cpp
low-can-binding/binding/application.hpp
low-can-binding/binding/low-can-cb.cpp
low-can-binding/binding/low-can-subscription.cpp
low-can-binding/binding/low-can-subscription.hpp
low-can-binding/can/can-decoder.cpp
low-can-binding/can/can-encoder.cpp
low-can-binding/can/message/can-message.cpp
low-can-binding/can/message/can-message.hpp
low-can-binding/can/message/j1939-message.cpp
low-can-binding/can/message/message.cpp
low-can-binding/can/message/message.hpp
low-can-binding/can/signals.cpp [changed mode: 0644->0755]
low-can-binding/can/signals.hpp [changed mode: 0644->0755]
low-can-binding/utils/openxc-utils.cpp
low-can-binding/utils/socketcan-isotp.cpp
low-can-binding/utils/socketcan-j1939/socketcan-j1939-addressclaiming.cpp
low-can-binding/utils/socketcan-j1939/socketcan-j1939-addressclaiming.hpp
low-can-binding/utils/socketcan-j1939/socketcan-j1939-data.cpp
low-can-binding/utils/socketcan-j1939/socketcan-j1939.cpp
low-can-binding/utils/socketcan.cpp

index bcb8d73..c4da68a 100644 (file)
@@ -145,7 +145,7 @@ void application_t::set_active_message_set(uint8_t id)
        active_message_set_ = id;
 }
 
        active_message_set_ = id;
 }
 
-bool application_t::isEngineOn()
+bool application_t::is_engine_on()
 {
        struct utils::signals_found sf;
        openxc_DynamicField search_key = build_DynamicField("engine.speed");
 {
        struct utils::signals_found sf;
        openxc_DynamicField search_key = build_DynamicField("engine.speed");
@@ -213,4 +213,4 @@ void application_t::set_subscription_address_claiming(std::shared_ptr<low_can_su
        subscription_address_claiming_ = new_subscription;
 }
 
        subscription_address_claiming_ = new_subscription;
 }
 
-#endif
\ No newline at end of file
+#endif
index 30e2183..7b4732c 100644 (file)
@@ -89,7 +89,7 @@ class application_t
 
                uint32_t get_signal_id(signal_t& sig) const;
 
 
                uint32_t get_signal_id(signal_t& sig) const;
 
-               bool isEngineOn();
+               bool is_engine_on();
 
                void set_active_message_set(uint8_t id);
 
 
                void set_active_message_set(uint8_t id);
 
index 1c01738..5b351b5 100644 (file)
@@ -221,7 +221,7 @@ static int subscribe_unsubscribe_diagnostic_messages(afb_req_t request,
                // poll a PID for nothing.
                if(sig->get_supported() && subscribe)
                {
                // poll a PID for nothing.
                if(sig->get_supported() && subscribe)
                {
-                       if (!app.isEngineOn())
+                       if (!app.is_engine_on())
                                AFB_WARNING("signal: Engine is off, %s won't received responses until it's on",  sig->get_name().c_str());
 
                        diag_m.add_recurring_request(diag_req, sig->get_name().c_str(), false, sig->get_decoder(), sig->get_callback(), event_filter.frequency, perm_rec_diag_req);
                                AFB_WARNING("signal: Engine is off, %s won't received responses until it's on",  sig->get_name().c_str());
 
                        diag_m.add_recurring_request(diag_req, sig->get_name().c_str(), false, sig->get_decoder(), sig->get_callback(), event_filter.frequency, perm_rec_diag_req);
@@ -382,14 +382,14 @@ static int one_subscribe_unsubscribe_events(afb_req_t request, bool subscribe, c
        return ret;
 }
 
        return ret;
 }
 
-static int one_subscribe_unsubscribe_id(afb_req_t request, bool subscribe, const uint32_t& id ,json_object *args)
+static int one_subscribe_unsubscribe_id(afb_req_t request, bool subscribe, const uint32_t& idjson_object *args)
 {
        int ret = 0;
        std::shared_ptr<message_definition_t> message_definition = application_t::instance().get_message_definition(id);
        struct utils::signals_found sf;
 
        if(message_definition)
 {
        int ret = 0;
        std::shared_ptr<message_definition_t> message_definition = application_t::instance().get_message_definition(id);
        struct utils::signals_found sf;
 
        if(message_definition)
-               sf.signals = list_ptr_signal_t(message_definition->get_signals().begin(),message_definition->get_signals().end());
+               sf.signals = list_ptr_signal_t(message_definition->get_signals().begin(), message_definition->get_signals().end());
 
        if(sf.signals.empty())
        {
 
        if(sf.signals.empty())
        {
@@ -563,7 +563,7 @@ static int send_message(message_t *message, const std::string& bus_name, uint32_
 
 
 static void write_raw_frame(afb_req_t request, const std::string& bus_name, message_t *message,
 
 
 static void write_raw_frame(afb_req_t request, const std::string& bus_name, message_t *message,
-                                                       struct json_object *can_data, uint32_t flags, event_filter_t &event_filter)
+                           struct json_object *can_data, uint32_t flags, event_filter_t &event_filter)
 {
 
        struct utils::signals_found sf;
 {
 
        struct utils::signals_found sf;
@@ -572,7 +572,7 @@ static void write_raw_frame(afb_req_t request, const std::string& bus_name, mess
 
        if( !sf.signals.empty() )
        {
 
        if( !sf.signals.empty() )
        {
-               AFB_DEBUG("ID WRITE RAW : %d",sf.signals.front()->get_message()->get_id());
+               AFB_DEBUG("ID WRITE RAW : %d", sf.signals.front()->get_message()->get_id());
                if(flags & BCM_PROTOCOL)
                {
                        if(sf.signals.front()->get_message()->is_fd())
                if(flags & BCM_PROTOCOL)
                {
                        if(sf.signals.front()->get_message()->is_fd())
@@ -639,20 +639,20 @@ static void write_raw_frame(afb_req_t request, const std::string& bus_name, mess
 static void write_frame(afb_req_t request, const std::string& bus_name, json_object *json_value, event_filter_t &event_filter)
 {
        message_t *message;
 static void write_frame(afb_req_t request, const std::string& bus_name, json_object *json_value, event_filter_t &event_filter)
 {
        message_t *message;
-       int id;
-       int length;
+       uint32_t id;
+       uint32_t length;
        struct json_object *can_data = nullptr;
        std::vector<uint8_t> data;
 
        struct json_object *can_data = nullptr;
        std::vector<uint8_t> data;
 
-       AFB_DEBUG("JSON content %s",json_object_get_string(json_value));
+       AFB_DEBUG("JSON content %s", json_object_get_string(json_value));
 
        if(!wrap_json_unpack(json_value, "{si, si, so !}",
                                  "can_id", &id,
                                  "can_dlc", &length,
                                  "can_data", &can_data))
        {
 
        if(!wrap_json_unpack(json_value, "{si, si, so !}",
                                  "can_id", &id,
                                  "can_dlc", &length,
                                  "can_data", &can_data))
        {
-               message = new can_message_t(0,(uint32_t)id,(uint32_t)length,false,0,data,0);
-               write_raw_frame(request,bus_name,message,can_data,BCM_PROTOCOL,event_filter);
+               message = new can_message_t(0, id, length, false, 0, data, 0);
+               write_raw_frame(request, bus_name, message, can_data, BCM_PROTOCOL, event_filter);
        }
 #ifdef USE_FEATURE_J1939
        else if(!wrap_json_unpack(json_value, "{si, si, so !}",
        }
 #ifdef USE_FEATURE_J1939
        else if(!wrap_json_unpack(json_value, "{si, si, so !}",
@@ -660,8 +660,8 @@ static void write_frame(afb_req_t request, const std::string& bus_name, json_obj
                                  "length", &length,
                                  "data", &can_data))
        {
                                  "length", &length,
                                  "data", &can_data))
        {
-               message = new j1939_message_t((uint32_t)length,data,0,J1939_NO_NAME,(pgn_t)id,J1939_NO_ADDR);
-               write_raw_frame(request,bus_name,message,can_data,J1939_PROTOCOL, event_filter);
+               message = new j1939_message_t(length, data, 0, J1939_NO_NAME, (pgn_t)id, J1939_NO_ADDR);
+               write_raw_frame(request, bus_name, message, can_data, J1939_PROTOCOL, event_filter);
        }
 #endif
        else
        }
 #endif
        else
@@ -712,7 +712,7 @@ static void write_signal(afb_req_t request, const std::string& name, json_object
                flags = BCM_PROTOCOL;
 
 //     cfd = encoder_t::build_frame(sig, value);
                flags = BCM_PROTOCOL;
 
 //     cfd = encoder_t::build_frame(sig, value);
-       message_t *message = encoder_t::build_message(sig,value,false,false);
+       message_t *message = encoder_t::build_message(sig, value, false, false);
 
        if(! send_message(message, sig->get_message()->get_bus_device_name(), flags, event_filter, sig) && send)
                afb_req_success(request, nullptr, "Message correctly sent");
 
        if(! send_message(message, sig->get_message()->get_bus_device_name(), flags, event_filter, sig) && send)
                afb_req_success(request, nullptr, "Message correctly sent");
@@ -923,8 +923,8 @@ int init_binding(afb_api_t api)
                        application.set_subscription_address_claiming(low_can_j1939);
 
                        ret = low_can_subscription_t::open_socket(*low_can_j1939,
                        application.set_subscription_address_claiming(low_can_j1939);
 
                        ret = low_can_subscription_t::open_socket(*low_can_j1939,
-                                                                                               j1939_bus,
-                                                                                               J1939_ADDR_CLAIM_PROTOCOL);
+                                                                 j1939_bus,
+                                                                 J1939_ADDR_CLAIM_PROTOCOL);
 
                        if(ret < 0)
                        {
 
                        if(ret < 0)
                        {
index 8b5f302..8c0a07c 100644 (file)
@@ -394,12 +394,12 @@ int low_can_subscription_t::open_socket(low_can_subscription_t &subscription, co
                                        rx = subscription.signal_->get_message()->get_id();
                                        tx = subscription.get_tx_id();
                                }
                                        rx = subscription.signal_->get_message()->get_id();
                                        tx = subscription.get_tx_id();
                                }
-                               ret = socket->open(subscription.signal_->get_message()->get_bus_device_name(),rx,tx);
+                               ret = socket->open(subscription.signal_->get_message()->get_bus_device_name(), rx, tx);
                                subscription.socket_ = socket;
                        }
                        else if(! bus_name.empty())
                        {
                                subscription.socket_ = socket;
                        }
                        else if(! bus_name.empty())
                        {
-                               ret = socket->open(bus_name, subscription.get_rx_id(),subscription.get_tx_id());
+                               ret = socket->open(bus_name, subscription.get_rx_id(), subscription.get_tx_id());
                                subscription.socket_ = socket;
                        }
                        subscription.index_ = (int)subscription.socket_->socket();
                                subscription.socket_ = socket;
                        }
                        subscription.index_ = (int)subscription.socket_->socket();
@@ -495,7 +495,7 @@ void low_can_subscription_t::add_one_bcm_frame(struct canfd_frame& cfd, struct b
 void low_can_subscription_t::remove_last_bcm_frame(struct bcm_msg& bcm_msg)
 {
        struct canfd_frame cf;
 void low_can_subscription_t::remove_last_bcm_frame(struct bcm_msg& bcm_msg)
 {
        struct canfd_frame cf;
-       memset(&cf,0,sizeof(cf));
+       memset(&cf, 0, sizeof(cf));
        bcm_msg.fd_frames[bcm_msg.msg_head.nframes] = cf;
        bcm_msg.msg_head.nframes--;
 }
        bcm_msg.fd_frames[bcm_msg.msg_head.nframes] = cf;
        bcm_msg.msg_head.nframes--;
 }
@@ -704,7 +704,7 @@ int low_can_subscription_t::tx_send(low_can_subscription_t &subscription, messag
 {
        can_message_t *cm = static_cast<can_message_t*>(message);
 
 {
        can_message_t *cm = static_cast<can_message_t*>(message);
 
-       struct bcm_msg bcm_msg = subscription.make_bcm_head(TX_SEND, cm->get_id(),cm->get_flags()|TX_CP_CAN_ID); // TX_CP_CAN_ID -> copy in cfd the id of bcm
+       struct bcm_msg bcm_msg = subscription.make_bcm_head(TX_SEND, cm->get_id(), cm->get_flags()|TX_CP_CAN_ID); // TX_CP_CAN_ID -> copy in cfd the id of bcm
        cm->set_bcm_msg(bcm_msg);
 
        std::vector<canfd_frame> cfd_vect = cm->convert_to_canfd_frame_vector();
        cm->set_bcm_msg(bcm_msg);
 
        std::vector<canfd_frame> cfd_vect = cm->convert_to_canfd_frame_vector();
index ac08d26..fa6b795 100644 (file)
@@ -99,7 +99,7 @@ public:
        void set_tx_id(canid_t tx_id);
        void set_signal(std::shared_ptr<signal_t> signal);
 
        void set_tx_id(canid_t tx_id);
        void set_signal(std::shared_ptr<signal_t> signal);
 
-       static struct bcm_msg make_bcm_head(uint32_t opcode, uint32_t can_id = 0, uint32_t flags = 0, const struct timeval& timeout = {0,0}, const struct timeval& frequency_thinning = {0,0});
+       static struct bcm_msg make_bcm_head(uint32_t opcode, uint32_t can_id = 0, uint32_t flags = 0, const struct timeval& timeout = {0, 0}, const struct timeval& frequency_thinning = {0, 0});
        static void add_one_bcm_frame(struct canfd_frame& cfd, struct bcm_msg& bcm_msg);
        static void remove_last_bcm_frame(struct bcm_msg& bcm_msg);
 
        static void add_one_bcm_frame(struct canfd_frame& cfd, struct bcm_msg& bcm_msg);
        static void remove_last_bcm_frame(struct bcm_msg& bcm_msg);
 
index 5662669..e901240 100644 (file)
@@ -50,13 +50,13 @@ float decoder_t::parse_signal_bitfield(signal_t& signal, std::shared_ptr<message
                data_signal.push_back(data[i]);
 
 //     if(bit_size > 255)
                data_signal.push_back(data[i]);
 
 //     if(bit_size > 255)
-//             AFB_ERROR("Error signal %s to long bit size",signal.get_name().c_str());
+//             AFB_ERROR("Error signal %s to long bit size", signal.get_name().c_str());
 
 //     if(new_start_bit > 255)
 //             AFB_ERROR("Too long signal offset %d", new_start_bit);
 
        if(data_signal.size() > 65535)
 
 //     if(new_start_bit > 255)
 //             AFB_ERROR("Too long signal offset %d", new_start_bit);
 
        if(data_signal.size() > 65535)
-               AFB_ERROR("Too long data signal %s",signal.get_name().c_str());
+               AFB_ERROR("Too long data signal %s", signal.get_name().c_str());
 
        return bitfield_parse_float(data_signal.data(), (uint16_t) data_signal.size(),
                        new_start_bit, bit_size, signal.get_factor(),
 
        return bitfield_parse_float(data_signal.data(), (uint16_t) data_signal.size(),
                        new_start_bit, bit_size, signal.get_factor(),
index fb68b87..113428b 100644 (file)
@@ -47,7 +47,7 @@ void encoder_t::encode_data(std::shared_ptr<signal_t> sig, std::vector<uint8_t>
        uint8_t len_signal_bytes = 0;
        if(len_signal_bytes_tmp > 255)
        {
        uint8_t len_signal_bytes = 0;
        if(len_signal_bytes_tmp > 255)
        {
-               AFB_ERROR("Error signal %s too long",sig->get_name().c_str());
+               AFB_ERROR("Error signal %s too long", sig->get_name().c_str());
        }
        else
        {
        }
        else
        {
@@ -56,13 +56,13 @@ void encoder_t::encode_data(std::shared_ptr<signal_t> sig, std::vector<uint8_t>
 /*
        if(new_start_bit > 255)
        {
 /*
        if(new_start_bit > 255)
        {
-               AFB_ERROR("Error signal %s too long",sig->get_name().c_str());
+               AFB_ERROR("Error signal %s too long", sig->get_name().c_str());
        }
 */
        uint8_t new_bit_size = 0;
        if(bit_size > 255)
        {
        }
 */
        uint8_t new_bit_size = 0;
        if(bit_size > 255)
        {
-               AFB_ERROR("Error signal %s to long bit size",sig->get_name().c_str());
+               AFB_ERROR("Error signal %s to long bit size", sig->get_name().c_str());
        }
        else
        {
        }
        else
        {
@@ -148,7 +148,7 @@ message_t* encoder_t::build_frame(const std::shared_ptr<signal_t>& signal, uint6
 
        for(const auto& sig: signal->get_message()->get_signals())
        {
 
        for(const auto& sig: signal->get_message()->get_signals())
        {
-               encode_data(sig,data,false,factor,offset);
+               encode_data(sig, data, false, factor, offset);
        }
        message->set_data(data);
        return message;
        }
        message->set_data(data);
        return message;
@@ -177,7 +177,7 @@ message_t* encoder_t::build_message(const std::shared_ptr<signal_t>& signal, uin
                                                                         data,
                                                                         0);
 
                                                                         data,
                                                                         0);
 
-               return build_frame(signal,value,message, factor, offset);
+               return build_frame(signal, value, message, factor, offset);
        }
 #ifdef USE_FEATURE_J1939
        else if(signal->get_message()->is_j1939())
        }
 #ifdef USE_FEATURE_J1939
        else if(signal->get_message()->is_j1939())
@@ -188,7 +188,7 @@ message_t* encoder_t::build_message(const std::shared_ptr<signal_t>& signal, uin
                                                                           J1939_NO_NAME,
                                                                           signal->get_message()->get_id(),
                                                                           J1939_NO_ADDR);
                                                                           J1939_NO_NAME,
                                                                           signal->get_message()->get_id(),
                                                                           J1939_NO_ADDR);
-               return build_frame(signal,value,message, factor, offset);
+               return build_frame(signal, value, message, factor, offset);
        }
 #endif
        else
        }
 #endif
        else
index 1f73c27..5c3e0f0 100644 (file)
@@ -204,12 +204,12 @@ struct std::vector<canfd_frame> can_message_t::convert_to_canfd_frame_vector()
                                std::vector<uint8_t> data = get_data_vector((i*64),(i*64)+63);
                                if(data.size()<64)
                                {
                                std::vector<uint8_t> data = get_data_vector((i*64),(i*64)+63);
                                if(data.size()<64)
                                {
-                                       ::memset(frame.data,0,sizeof(frame.data));
-                                       ::memcpy(frame.data,data.data(),data.size());
+                                       ::memset(frame.data, 0, sizeof(frame.data));
+                                       ::memcpy(frame.data, data.data(), data.size());
                                }
                                else
                                {
                                }
                                else
                                {
-                                       ::memcpy(frame.data,data.data(),64);
+                                       ::memcpy(frame.data, data.data(), 64);
                                }
                                ret.push_back(frame);
                                i++;
                                }
                                ret.push_back(frame);
                                i++;
@@ -226,13 +226,13 @@ struct std::vector<canfd_frame> can_message_t::convert_to_canfd_frame_vector()
                                std::vector<uint8_t> data = get_data_vector(i*8,(i*8)+7);
                                if(data.size()<8)
                                {
                                std::vector<uint8_t> data = get_data_vector(i*8,(i*8)+7);
                                if(data.size()<8)
                                {
-                                       ::memset(frame.data,0,sizeof(frame.data));
-                                       ::memcpy(frame.data,data.data(),data.size());
+                                       ::memset(frame.data, 0, sizeof(frame.data));
+                                       ::memcpy(frame.data, data.data(), data.size());
                                }
                                else
                                {
                                }
                                else
                                {
-                                       ::memset(frame.data,0,sizeof(frame.data));
-                                       ::memcpy(frame.data,data.data(),8);
+                                       ::memset(frame.data, 0, sizeof(frame.data));
+                                       ::memcpy(frame.data, data.data(), 8);
                                }
                                ret.push_back(frame);
                                i++;
                                }
                                ret.push_back(frame);
                                i++;
index acc3bfc..9d501a2 100644 (file)
@@ -40,12 +40,12 @@ class can_message_t : public message_t {
        public:
                can_message_t();
                can_message_t(  uint32_t maxdlen,
        public:
                can_message_t();
                can_message_t(  uint32_t maxdlen,
-                                               uint32_t id,
-                                               uint32_t length,
-                                               bool rtr_flag_,
-                                               uint32_t flags,
-                                               std::vector<uint8_t>& data,
-                                               uint64_t timestamp);
+                               uint32_t id,
+                               uint32_t length,
+                               bool rtr_flag_,
+                               uint32_t flags,
+                               std::vector<uint8_t>& data,
+                               uint64_t timestamp);
 
                uint32_t get_id() const;
                void set_id(const canid_t id);
 
                uint32_t get_id() const;
                void set_id(const canid_t id);
index 432a139..3740ea2 100644 (file)
@@ -94,7 +94,7 @@ uint8_t j1939_message_t::get_addr() const{
 /// @param[in] timestamp - timestamp of the message
 ///
 /// @return A j1939_message_t object fully initialized with sockaddr_can and data values.
 /// @param[in] timestamp - timestamp of the message
 ///
 /// @return A j1939_message_t object fully initialized with sockaddr_can and data values.
-std::shared_ptr<j1939_message_t> j1939_message_t::convert_from_addr(struct sockaddr_can& addr, uint8_t (&data)[128],size_t nbytes, uint64_t timestamp)
+std::shared_ptr<j1939_message_t> j1939_message_t::convert_from_addr(struct sockaddr_can& addr, uint8_t (&data)[128], size_t nbytes, uint64_t timestamp)
 {
        int i;
        uint32_t length = 0;
 {
        int i;
        uint32_t length = 0;
@@ -112,7 +112,7 @@ std::shared_ptr<j1939_message_t> j1939_message_t::convert_from_addr(struct socka
        data_vector.clear();
 
        std::string data_string;
        data_vector.clear();
 
        std::string data_string;
-       data_string = converter_t::to_hex(data,length);
+       data_string = converter_t::to_hex(data, length);
 
        for(i=0;i<length;i++)
        {
 
        for(i=0;i<length;i++)
        {
@@ -122,7 +122,7 @@ std::shared_ptr<j1939_message_t> j1939_message_t::convert_from_addr(struct socka
        AFB_DEBUG("Found pgn: %X, length: %X, data %s",
                                                        addr.can_addr.j1939.pgn, length, data_string.c_str());
 
        AFB_DEBUG("Found pgn: %X, length: %X, data %s",
                                                        addr.can_addr.j1939.pgn, length, data_string.c_str());
 
-       return std::make_shared<j1939_message_t>(j1939_message_t(length, data_vector, timestamp,addr.can_addr.j1939.name,addr.can_addr.j1939.pgn,addr.can_addr.j1939.addr));
+       return std::make_shared<j1939_message_t>(j1939_message_t(length, data_vector, timestamp, addr.can_addr.j1939.name, addr.can_addr.j1939.pgn, addr.can_addr.j1939.addr));
 }
 
 /// @brief Test if members pgn_ and length are set.
 }
 
 /// @brief Test if members pgn_ and length are set.
index 2496b67..2a23ca5 100644 (file)
@@ -83,7 +83,7 @@ const uint8_t* message_t::get_data() const
 /// @return pointer to the first element
 ///  of class member data_
 ///
 /// @return pointer to the first element
 ///  of class member data_
 ///
-const std::vector<uint8_t> message_t::get_data_vector(int start,int end) const
+const std::vector<uint8_t> message_t::get_data_vector(int start, int end) const
 {
        std::vector<uint8_t> ret;
        if(start >= 0)
 {
        std::vector<uint8_t> ret;
        if(start >= 0)
@@ -105,7 +105,7 @@ const std::vector<uint8_t> message_t::get_data_vector(int start,int end) const
        }
        else
        {
        }
        else
        {
-               AFB_ERROR("Error index to get data vector, [%d-%d] - for length %d",start,end,length_);
+               AFB_ERROR("Error index to get data vector, [%d-%d] - for length %d", start, end, length_);
        }
        return ret;
 }
        }
        return ret;
 }
index 1a31a8d..7f13ac4 100644 (file)
@@ -66,7 +66,7 @@ public:
        int get_sub_id() const;
        const uint8_t* get_data() const;
        const std::vector<uint8_t> get_data_vector() const;
        int get_sub_id() const;
        const uint8_t* get_data() const;
        const std::vector<uint8_t> get_data_vector() const;
-       const std::vector<uint8_t> get_data_vector(int start,int end) const;
+       const std::vector<uint8_t> get_data_vector(int start, int end) const;
        uint32_t get_length() const;
        uint64_t get_timestamp() const;
 
        uint32_t get_length() const;
        uint64_t get_timestamp() const;
 
old mode 100644 (file)
new mode 100755 (executable)
index 7d3b733..57aefa5
@@ -44,7 +44,7 @@ signal_t::signal_t(
        signal_decoder decoder,
        signal_encoder encoder,
        bool received,
        signal_decoder decoder,
        signal_encoder encoder,
        bool received,
-       std::pair<bool,int> multiplex,
+       std::pair<bool, int> multiplex,
        bool is_big_endian,
        bool is_signed,
        std::string unit)
        bool is_big_endian,
        bool is_signed,
        std::string unit)
@@ -220,7 +220,7 @@ void signal_t::set_timestamp(uint64_t timestamp)
        frequency_.tick(timestamp);
 }
 
        frequency_.tick(timestamp);
 }
 
-std::pair<bool,int> signal_t::get_multiplex() const
+std::pair<bool, int> signal_t::get_multiplex() const
 {
        return multiplex_;
 }
 {
        return multiplex_;
 }
old mode 100644 (file)
new mode 100755 (executable)
index 2fcc27e..32cd760
@@ -96,7 +96,7 @@ private:
        bool received_; /*!< received_ - True if this signal has ever been received.*/
        float last_value_; /*!< lastValue_ - The last received value of the signal. If 'received' is false,
                                * this value is undefined. */
        bool received_; /*!< received_ - True if this signal has ever been received.*/
        float last_value_; /*!< lastValue_ - The last received value of the signal. If 'received' is false,
                                * this value is undefined. */
-       std::pair<bool,int> multiplex_; /*!< multiplex_ - If bool is false and int is 0 is not a multiplex signal
+       std::pair<bool, int> multiplex_; /*!< multiplex_ - If bool is false and int is 0 is not a multiplex signal
                                                                                If bool is true, that indicate that is a multiplexor
                                                                                If int is different of 0, that indicate the link with a multiplexor */
        bool is_big_endian_; /*!< is_big_endian - True if the signal's data are meant to be read as a big_endian */
                                                                                If bool is true, that indicate that is a multiplexor
                                                                                If int is different of 0, that indicate the link with a multiplexor */
        bool is_big_endian_; /*!< is_big_endian - True if the signal's data are meant to be read as a big_endian */
@@ -121,7 +121,7 @@ public:
                signal_decoder decoder,
                signal_encoder encoder,
                bool received,
                signal_decoder decoder,
                signal_encoder encoder,
                bool received,
-               std::pair<bool,int> multiplex,
+               std::pair<bool, int> multiplex,
                bool is_big_endian,
                bool is_signed,
                std::string unit);
                bool is_big_endian,
                bool is_signed,
                std::string unit);
@@ -162,7 +162,7 @@ public:
        bool get_received() const;
        float get_last_value() const;
        std::pair<float, uint64_t> get_last_value_with_timestamp() const;
        bool get_received() const;
        float get_last_value() const;
        std::pair<float, uint64_t> get_last_value_with_timestamp() const;
-       std::pair<bool,int> get_multiplex() const;
+       std::pair<bool, int> get_multiplex() const;
        bool get_is_big_endian() const;
        bool get_is_signed() const;
        const std::string get_unit() const;
        bool get_is_big_endian() const;
        bool get_is_signed() const;
        const std::string get_unit() const;
index e52676e..b88c45d 100644 (file)
@@ -401,7 +401,7 @@ void jsonify_DynamicField(const openxc_DynamicField& field, json_object* value)
        }
        else if(field.has_bytes_value)
        {
        }
        else if(field.has_bytes_value)
        {
-               std::string s = converter_t::to_hex(field.bytes_value,field.length_array);
+               std::string s = converter_t::to_hex(field.bytes_value, field.length_array);
 
                json_object_object_add(value, "value", json_object_new_string(s.c_str()));
        }
 
                json_object_object_add(value, "value", json_object_new_string(s.c_str()));
        }
index a3792a7..928e8c7 100644 (file)
@@ -36,7 +36,7 @@ namespace utils
        int socketcan_isotp_t::open(std::string device_name)
        {
                AFB_WARNING("NOT USE THIS FUNCTION !");
        int socketcan_isotp_t::open(std::string device_name)
        {
                AFB_WARNING("NOT USE THIS FUNCTION !");
-               return open(device_name,NO_CAN_ID,NO_CAN_ID);
+               return open(device_name, NO_CAN_ID, NO_CAN_ID);
        }
 
        /**
        }
 
        /**
@@ -59,11 +59,11 @@ namespace utils
                        return -1;
                }
 
                        return -1;
                }
 
-               if(define_tx_address(device_name,rx_id,tx_id) < 0)
+               if(define_tx_address(device_name, rx_id, tx_id) < 0)
                        return -1;
 
                struct can_isotp_options opts;
                        return -1;
 
                struct can_isotp_options opts;
-               memset(&opts,0,sizeof(opts));
+               memset(&opts, 0, sizeof(opts));
                setopt(SOL_CAN_ISOTP, CAN_ISOTP_OPTS, &opts, sizeof(opts));
 
                if(bind((struct sockaddr *)&tx_address_, sizeof(tx_address_)) < 0)
                setopt(SOL_CAN_ISOTP, CAN_ISOTP_OPTS, &opts, sizeof(opts));
 
                if(bind((struct sockaddr *)&tx_address_, sizeof(tx_address_)) < 0)
@@ -86,7 +86,7 @@ namespace utils
 
                std::shared_ptr<can_message_t> cm = std::make_shared<can_message_t>();
                uint8_t msg[MAX_ISOTP_FRAMES];
 
                std::shared_ptr<can_message_t> cm = std::make_shared<can_message_t>();
                uint8_t msg[MAX_ISOTP_FRAMES];
-               ssize_t nbytes = read(socket(),msg,MAX_ISOTP_FRAMES);
+               ssize_t nbytes = read(socket(), msg, MAX_ISOTP_FRAMES);
 
                cm->set_id(tx_address_.can_addr.tp.rx_id);
 
 
                cm->set_id(tx_address_.can_addr.tp.rx_id);
 
@@ -101,8 +101,8 @@ namespace utils
                        data.push_back(msg[i]);
 
                std::string data_string;
                        data.push_back(msg[i]);
 
                std::string data_string;
-               data_string = converter_t::to_hex(msg,nbytes);
-               AFB_DEBUG("DATA ISO TP for id : %x = %s",cm->get_id(),data_string.c_str());
+               data_string = converter_t::to_hex(msg, nbytes);
+               AFB_DEBUG("DATA ISO TP for id : %x = %s", cm->get_id(), data_string.c_str());
 
 
                cm->set_data(data);
 
 
                cm->set_data(data);
@@ -126,7 +126,7 @@ namespace utils
                size_t size = m.get_length();
                if(size < MAX_ISOTP_FRAMES)
                {
                size_t size = m.get_length();
                if(size < MAX_ISOTP_FRAMES)
                {
-                       ssize_t ret = write(socket(),m.get_data(),size);
+                       ssize_t ret = write(socket(), m.get_data(), size);
                        if(ret < 0)
                        {
                                AFB_ERROR("Error sending : %i %s", errno, ::strerror(errno));
                        if(ret < 0)
                        {
                                AFB_ERROR("Error sending : %i %s", errno, ::strerror(errno));
@@ -134,7 +134,7 @@ namespace utils
                        }
 
                        if(ret != size)
                        }
 
                        if(ret != size)
-                               AFB_WARNING("ISOTP wrote only %zd byte",ret);
+                               AFB_WARNING("ISOTP wrote only %zd byte", ret);
                }
                else
                {
                }
                else
                {
index 83ba71a..ebb3974 100644 (file)
@@ -26,7 +26,7 @@ namespace utils
         */
        socketcan_j1939_addressclaiming_t::socketcan_j1939_addressclaiming_t():
        socketcan_j1939_t(),
         */
        socketcan_j1939_addressclaiming_t::socketcan_j1939_addressclaiming_t():
        socketcan_j1939_t(),
-       table_j1939_address_{{std::make_pair(0,false)}},
+       table_j1939_address_{{std::make_pair(0, false)}},
        signal_stop_{false},
        claiming_state_{claiming_state::INITIAL}
        {}
        signal_stop_{false},
        claiming_state_{claiming_state::INITIAL}
        {}
@@ -64,7 +64,7 @@ namespace utils
 
                        if(jm->get_addr() != current_address_)
                        {
 
                        if(jm->get_addr() != current_address_)
                        {
-                               save_addr_name(jm->get_addr(),jm->get_name());
+                               save_addr_name(jm->get_addr(), jm->get_name());
                                return invalid_message;
                        }
 
                                return invalid_message;
                        }
 
@@ -76,7 +76,7 @@ namespace utils
                                        return invalid_message;
                                }
 
                                        return invalid_message;
                                }
 
-                               save_addr_name(jm->get_addr(),jm->get_name());
+                               save_addr_name(jm->get_addr(), jm->get_name());
 
 
                                if(timer_handle_->evtSource)
 
 
                                if(timer_handle_->evtSource)
@@ -97,7 +97,7 @@ namespace utils
                                AFB_DEBUG("Address colision");
                                if(jm->get_name() > htole64(J1939_NAME_ECU))
                                {
                                AFB_DEBUG("Address colision");
                                if(jm->get_name() > htole64(J1939_NAME_ECU))
                                {
-                                       if(claim_address(false,false) < 0)
+                                       if(claim_address(false, false) < 0)
                                        {
                                                AFB_ERROR("Claim address failed");
                                                change_state(claiming_state::INVALID);
                                        {
                                                AFB_ERROR("Claim address failed");
                                                change_state(claiming_state::INVALID);
@@ -106,9 +106,9 @@ namespace utils
                                        return invalid_message;
                                }
 
                                        return invalid_message;
                                }
 
-                               save_addr_name(jm->get_addr(),jm->get_name());
+                               save_addr_name(jm->get_addr(), jm->get_name());
 
 
-                               if(claim_address(false,true) < 0)
+                               if(claim_address(false, true) < 0)
                                {
                                                AFB_ERROR("Claim address failed");
                                                change_state(claiming_state::INVALID);
                                {
                                                AFB_ERROR("Claim address failed");
                                                change_state(claiming_state::INVALID);
@@ -140,7 +140,7 @@ namespace utils
                        else
                        {
                                for (int i = start_addr; i <= end_addr; i++)
                        else
                        {
                                for (int i = start_addr; i <= end_addr; i++)
-                                       table_j1939_address_[i] = std::make_pair(0,true);
+                                       table_j1939_address_[i] = std::make_pair(0, true);
                        }
                }
        }
                        }
                }
        }
@@ -152,18 +152,18 @@ namespace utils
         * @param name The name of the ECU that is in the address
         * @return int 0 if save is ok
         */
         * @param name The name of the ECU that is in the address
         * @return int 0 if save is ok
         */
-       int socketcan_j1939_addressclaiming_t::save_addr_name(uint8_t addr,name_t name)
+       int socketcan_j1939_addressclaiming_t::save_addr_name(uint8_t addr, name_t name)
        {
                if(addr < J1939_IDLE_ADDR)
                {
                        if(table_j1939_address_[addr].first < name)
                        {
                                table_j1939_address_[addr].first = name;
        {
                if(addr < J1939_IDLE_ADDR)
                {
                        if(table_j1939_address_[addr].first < name)
                        {
                                table_j1939_address_[addr].first = name;
-                               AFB_DEBUG("[socketcan-j1939-addressclaiming][save_addr_name] NAME : %x <--> ADDR : %d",(unsigned int)name,addr);
+                               AFB_DEBUG("[socketcan-j1939-addressclaiming][save_addr_name] NAME : %x <--> ADDR : %d",(unsigned int)name, addr);
                        }
                        else if(table_j1939_address_[addr].first == name)
                        {
                        }
                        else if(table_j1939_address_[addr].first == name)
                        {
-                               AFB_WARNING("Name %x has already adress %d",(unsigned int)name,addr);
+                               AFB_WARNING("Name %x has already adress %d",(unsigned int)name, addr);
                        }
                }
                else
                        }
                }
                else
@@ -216,20 +216,20 @@ namespace utils
                socketcan_j1939_addressclaiming_t *addressclaiming_socket = (socketcan_j1939_addressclaiming_t*) timerhandle->context;
                // If the cache is cleared :
                addressclaiming_socket->change_state(claiming_state::OPERATIONAL);
                socketcan_j1939_addressclaiming_t *addressclaiming_socket = (socketcan_j1939_addressclaiming_t*) timerhandle->context;
                // If the cache is cleared :
                addressclaiming_socket->change_state(claiming_state::OPERATIONAL);
-               addressclaiming_socket->save_addr_name(addressclaiming_socket->current_address_,htole64(J1939_NAME_ECU));
+               addressclaiming_socket->save_addr_name(addressclaiming_socket->current_address_, htole64(J1939_NAME_ECU));
                AFB_DEBUG("Get address %d for this ecu", addressclaiming_socket->current_address_);
                /*Else :
 
                uint8_t data[3]= { 0, 0, 0, };
                AFB_DEBUG("Get address %d for this ecu", addressclaiming_socket->current_address_);
                /*Else :
 
                uint8_t data[3]= { 0, 0, 0, };
-               std::vector<uint8_t> data_v(data,data+3);
-               int res = addressclaiming_socket->write_j1939_message(J1939_PGN_REQUEST,data_v,3);
+               std::vector<uint8_t> data_v(data, data+3);
+               int res = addressclaiming_socket->write_j1939_message(J1939_PGN_REQUEST, data_v, 3);
                if(res < 0)
                {
                        if(res == -99)
                        {
                if(res < 0)
                {
                        if(res == -99)
                        {
-                               addressclaiming_socket->save_addr_name(addressclaiming_socket->current_address_,htole64(1));
+                               addressclaiming_socket->save_addr_name(addressclaiming_socket->current_address_, htole64(1));
                                AFB_DEBUG("Address busy but no claming request from other ECU");
                                AFB_DEBUG("Address busy but no claming request from other ECU");
-                               addressclaiming_socket->claim_address(false,true);
+                               addressclaiming_socket->claim_address(false, true);
                        }
                        else
                        {
                        }
                        else
                        {
@@ -239,7 +239,7 @@ namespace utils
                else
                {
                        addressclaiming_socket->change_state(claiming_state::OPERATIONAL);
                else
                {
                        addressclaiming_socket->change_state(claiming_state::OPERATIONAL);
-                       addressclaiming_socket->save_addr_name(addressclaiming_socket->current_address_,htole64(J1939_NAME_ECU));
+                       addressclaiming_socket->save_addr_name(addressclaiming_socket->current_address_, htole64(J1939_NAME_ECU));
                        AFB_DEBUG("Get address %d for this ecu", addressclaiming_socket->current_address_);
                }*/
 
                        AFB_DEBUG("Get address %d for this ecu", addressclaiming_socket->current_address_);
                }*/
 
@@ -268,7 +268,7 @@ namespace utils
         * @param new_address If true, claim a new address, else only resend a claim with same address
         * @return int -1 if fail
         */
         * @param new_address If true, claim a new address, else only resend a claim with same address
         * @return int -1 if fail
         */
-       int socketcan_j1939_addressclaiming_t::claim_address(bool first_claim,bool new_address)
+       int socketcan_j1939_addressclaiming_t::claim_address(bool first_claim, bool new_address)
        {
                if(new_address)
                {
        {
                if(new_address)
                {
@@ -286,7 +286,7 @@ namespace utils
 
                if(first_claim)
                {
 
                if(first_claim)
                {
-                       int ret = socketcan_j1939_t::open(device_name_,htole64(J1939_NAME_ECU),J1939_NO_PGN,current_address_);
+                       int ret = socketcan_j1939_t::open(device_name_, htole64(J1939_NAME_ECU), J1939_NO_PGN, current_address_);
 
                        if(ret < 0)
                        {
 
                        if(ret < 0)
                        {
@@ -295,7 +295,7 @@ namespace utils
                        }
 
                        AFB_DEBUG("[socketcan-j1939-addressclaiming][claim_address] Success open socket address claiming");
                        }
 
                        AFB_DEBUG("[socketcan-j1939-addressclaiming][claim_address] Success open socket address claiming");
-                       add_filter(J1939_NO_NAME,J1939_PGN_ADDRESS_CLAIMED,J1939_NO_ADDR,J1939_NO_NAME,J1939_PGN_PDU1_MAX,J1939_NO_ADDR);
+                       add_filter(J1939_NO_NAME, J1939_PGN_ADDRESS_CLAIMED, J1939_NO_ADDR, J1939_NO_NAME, J1939_PGN_PDU1_MAX, J1939_NO_ADDR);
                        define_opt();
                }
                else
                        define_opt();
                }
                else
@@ -374,7 +374,7 @@ namespace utils
        {
                device_name_ = device_name;
                initialize_table_j1939_address();
        {
                device_name_ = device_name;
                initialize_table_j1939_address();
-               if(claim_address(true,true) < 0)
+               if(claim_address(true, true) < 0)
                {
                        AFB_ERROR("Claim address failed");
                        return -1;
                {
                        AFB_ERROR("Claim address failed");
                        return -1;
index 5a95057..e946123 100644 (file)
@@ -33,10 +33,10 @@ namespace utils
                        std::pair<uint64_t, bool> table_j1939_address_[J1939_IDLE_ADDR];
 
                private:
                        std::pair<uint64_t, bool> table_j1939_address_[J1939_IDLE_ADDR];
 
                private:
-                       int claim_address(bool first_claim,bool new_address);
+                       int claim_address(bool first_claim, bool new_address);
                        int pgn_request();
                        void initialize_table_j1939_address();
                        int pgn_request();
                        void initialize_table_j1939_address();
-                       int save_addr_name(uint8_t addr,name_t name);
+                       int save_addr_name(uint8_t addr, name_t name);
                        uint8_t choose_new_address();
                        uint8_t get_addr_table(name_t name);
                        void change_state(claiming_state new_state);
                        uint8_t choose_new_address();
                        uint8_t get_addr_table(name_t name);
                        void change_state(claiming_state new_state);
index 4fd2b26..08c1375 100644 (file)
@@ -31,11 +31,11 @@ namespace utils
         */
        int socketcan_j1939_data_t::open(std::string device_name, pgn_t pgn)
        {
         */
        int socketcan_j1939_data_t::open(std::string device_name, pgn_t pgn)
        {
-               int ret = socketcan_j1939_t::open(device_name,htole64(J1939_NAME_ECU),pgn,J1939_NO_ADDR);
+               int ret = socketcan_j1939_t::open(device_name, htole64(J1939_NAME_ECU), pgn, J1939_NO_ADDR);
                if(ret >= 0)
                {
                        if(tx_address_.can_addr.j1939.pgn != J1939_NO_PGN)
                if(ret >= 0)
                {
                        if(tx_address_.can_addr.j1939.pgn != J1939_NO_PGN)
-                               add_filter(J1939_NO_NAME,tx_address_.can_addr.j1939.pgn,J1939_NO_ADDR,J1939_NO_NAME,J1939_NO_PGN,J1939_NO_ADDR);
+                               add_filter(J1939_NO_NAME, tx_address_.can_addr.j1939.pgn, J1939_NO_ADDR, J1939_NO_NAME, J1939_NO_PGN, J1939_NO_ADDR);
 
                        define_opt();
                }
 
                        define_opt();
                }
index ea68f20..3816325 100644 (file)
@@ -42,8 +42,8 @@ namespace utils
         */
        void socketcan_j1939_t::add_filter(name_t name, pgn_t pgn, uint8_t addr, name_t name_mask, pgn_t pgn_mask, uint8_t addr_mask)
        {
         */
        void socketcan_j1939_t::add_filter(name_t name, pgn_t pgn, uint8_t addr, name_t name_mask, pgn_t pgn_mask, uint8_t addr_mask)
        {
-       //      AFB_DEBUG("[socketcan_j1939_t][add_filter] PGN : %" PRIu32 " ; NAME : %" PRIu64 " ; ADDR : %" PRIu8,pgn,(long unsigned int)name,addr);
-       //      AFB_DEBUG("PGN_MASK : %" PRIu32 " ; NAME_MASK : %" PRIu64 "; ADDR_MASK : %" PRIu8,pgn_mask,(long unsigned int)name_mask,addr_mask);
+       //      AFB_DEBUG("[socketcan_j1939_t][add_filter] PGN : %" PRIu32 " ; NAME : %" PRIu64 " ; ADDR : %" PRIu8, pgn,(long unsigned int)name, addr);
+       //      AFB_DEBUG("PGN_MASK : %" PRIu32 " ; NAME_MASK : %" PRIu64 "; ADDR_MASK : %" PRIu8, pgn_mask,(long unsigned int)name_mask, addr_mask);
                int filter_on = 0;
                struct j1939_filter filter;
                memset(&filter, 0, sizeof(filter));
                int filter_on = 0;
                struct j1939_filter filter;
                memset(&filter, 0, sizeof(filter));
@@ -152,7 +152,7 @@ namespace utils
         */
        int socketcan_j1939_t::open(std::string device_name)
        {
         */
        int socketcan_j1939_t::open(std::string device_name)
        {
-               return open(device_name,0,0,0);
+               return open(device_name, 0, 0, 0);
        }
 
        /**
        }
 
        /**
@@ -169,7 +169,7 @@ namespace utils
 
                socket_ = socketcan_t::open(PF_CAN, SOCK_DGRAM, CAN_J1939);
 
 
                socket_ = socketcan_t::open(PF_CAN, SOCK_DGRAM, CAN_J1939);
 
-               define_tx_address(device_name,name,pgn,addr);
+               define_tx_address(device_name, name, pgn, addr);
 
                if(bind((struct sockaddr *)&tx_address_, sizeof(tx_address_)) < 0)
                {
 
                if(bind((struct sockaddr *)&tx_address_, sizeof(tx_address_)) < 0)
                {
@@ -230,7 +230,7 @@ namespace utils
        int socketcan_j1939_t::write_j1939_message(pgn_t pgn, std::vector<uint8_t> &data, uint32_t len_data)
        {
                j1939_message_t msg = j1939_message_t(len_data, data, 0, 0, pgn, 0);
        int socketcan_j1939_t::write_j1939_message(pgn_t pgn, std::vector<uint8_t> &data, uint32_t len_data)
        {
                j1939_message_t msg = j1939_message_t(len_data, data, 0, 0, pgn, 0);
-               msg.set_sockname(pgn,J1939_NO_NAME,J1939_NO_ADDR);
+               msg.set_sockname(pgn, J1939_NO_NAME, J1939_NO_ADDR);
                return write_message(msg);
        }
 
                return write_message(msg);
        }
 
index d72f108..50dfafb 100644 (file)
@@ -117,7 +117,7 @@ namespace utils
                {
                        if(write_message(vobj[i])<0)
                        {
                {
                        if(write_message(vobj[i])<0)
                        {
-                               AFB_ERROR("Error send message %d",i);
+                               AFB_ERROR("Error send message %d", i);
                                return -1;
                        }
                }
                                return -1;
                        }
                }