From e1caf27db81e9897af7512a0b47e0783593833d5 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 4 Dec 2019 17:54:38 +0100 Subject: All: Make format coherent with the whole project Add a space after a comma Change some aligments Bug-AGL: SPEC-2988 Change-Id: I5069120f4bbb33742bb4990e2e1f391ec8d5eeb6 Signed-off-by: Romain Forlot --- low-can-binding/binding/application.cpp | 4 ++-- low-can-binding/binding/application.hpp | 2 +- low-can-binding/binding/low-can-cb.cpp | 30 ++++++++++++------------ low-can-binding/binding/low-can-subscription.cpp | 8 +++---- low-can-binding/binding/low-can-subscription.hpp | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) (limited to 'low-can-binding/binding') diff --git a/low-can-binding/binding/application.cpp b/low-can-binding/binding/application.cpp index bcb8d732..c4da68ae 100644 --- a/low-can-binding/binding/application.cpp +++ b/low-can-binding/binding/application.cpp @@ -145,7 +145,7 @@ void application_t::set_active_message_set(uint8_t 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"); @@ -213,4 +213,4 @@ void application_t::set_subscription_address_claiming(std::shared_ptrget_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); @@ -382,14 +382,14 @@ static int one_subscribe_unsubscribe_events(afb_req_t request, bool subscribe, c 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& id, json_object *args) { int ret = 0; std::shared_ptr 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()) { @@ -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, - 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; @@ -572,7 +572,7 @@ static void write_raw_frame(afb_req_t request, const std::string& bus_name, mess 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()) @@ -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; - int id; - int length; + uint32_t id; + uint32_t length; struct json_object *can_data = nullptr; std::vector 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)) { - 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 !}", @@ -660,8 +660,8 @@ static void write_frame(afb_req_t request, const std::string& bus_name, json_obj "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 @@ -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); - 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"); @@ -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, - j1939_bus, - J1939_ADDR_CLAIM_PROTOCOL); + j1939_bus, + J1939_ADDR_CLAIM_PROTOCOL); if(ret < 0) { diff --git a/low-can-binding/binding/low-can-subscription.cpp b/low-can-binding/binding/low-can-subscription.cpp index 8b5f302e..8c0a07c1 100644 --- a/low-can-binding/binding/low-can-subscription.cpp +++ b/low-can-binding/binding/low-can-subscription.cpp @@ -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(); } - 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()) { - 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(); @@ -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; - 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--; } @@ -704,7 +704,7 @@ int low_can_subscription_t::tx_send(low_can_subscription_t &subscription, messag { can_message_t *cm = static_cast(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 cfd_vect = cm->convert_to_canfd_frame_vector(); diff --git a/low-can-binding/binding/low-can-subscription.hpp b/low-can-binding/binding/low-can-subscription.hpp index ac08d265..fa6b795e 100644 --- a/low-can-binding/binding/low-can-subscription.hpp +++ b/low-can-binding/binding/low-can-subscription.hpp @@ -99,7 +99,7 @@ public: void set_tx_id(canid_t tx_id); void set_signal(std::shared_ptr 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); -- cgit 1.2.3-korg