diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-05-23 23:59:27 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-05-23 23:59:27 +0200 |
commit | 7747851ca010a3dfe9ffee808376dd5a7af68b91 (patch) | |
tree | 901e33d39e013c992adab34e7f5af82e5811eade /CAN-binder/low-can-binding/binding | |
parent | f30dc1a18dbb32880bdc0c9021b756c0f846ad53 (diff) |
Static code review fixes.
Several style errors and mistakes mostly on constructor and passing arguments
as ref.
Change-Id: I2ca921d6aa70b9074392bb7779ade35bebf7bd8d
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/binding')
-rw-r--r-- | CAN-binder/low-can-binding/binding/configuration.cpp | 4 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/binding/configuration.hpp | 4 | ||||
-rw-r--r-- | CAN-binder/low-can-binding/binding/low-can-cb.cpp | 7 |
3 files changed, 9 insertions, 6 deletions
diff --git a/CAN-binder/low-can-binding/binding/configuration.cpp b/CAN-binder/low-can-binding/binding/configuration.cpp index 623ba785..8e6dddec 100644 --- a/CAN-binder/low-can-binding/binding/configuration.cpp +++ b/CAN-binder/low-can-binding/binding/configuration.cpp @@ -78,7 +78,7 @@ void configuration_t::set_active_message_set(uint8_t id) } -std::shared_ptr<diagnostic_message_t> configuration_t::get_diagnostic_message(std::string message_name) const +std::shared_ptr<diagnostic_message_t> configuration_t::get_diagnostic_message(const std::string& message_name) const { struct utils::signals_found found; found = utils::signals_manager_t::instance().find_signals(build_DynamicField(message_name)); @@ -87,7 +87,7 @@ std::shared_ptr<diagnostic_message_t> configuration_t::get_diagnostic_message(st return nullptr; } -DiagnosticRequest* configuration_t::get_request_from_diagnostic_message(std::string message_name) const +DiagnosticRequest* configuration_t::get_request_from_diagnostic_message(const std::string& message_name) const { std::shared_ptr<diagnostic_message_t> diag_msg = get_diagnostic_message(message_name); if( diag_msg != nullptr && diag_msg->get_supported()) diff --git a/CAN-binder/low-can-binding/binding/configuration.hpp b/CAN-binder/low-can-binding/binding/configuration.hpp index 3ab88ee5..fc53d386 100644 --- a/CAN-binder/low-can-binding/binding/configuration.hpp +++ b/CAN-binder/low-can-binding/binding/configuration.hpp @@ -81,8 +81,8 @@ class configuration_t void set_active_message_set(uint8_t id); - std::shared_ptr<diagnostic_message_t> get_diagnostic_message(std::string message_name) const; - DiagnosticRequest* get_request_from_diagnostic_message(std::string message_name) const; + std::shared_ptr<diagnostic_message_t> get_diagnostic_message(const std::string& message_name) const; + DiagnosticRequest* get_request_from_diagnostic_message(const std::string& message_name) const; /* /// TODO: implement this function as method into can_bus class /// @brief Pre initialize actions made before CAN bus initialization diff --git a/CAN-binder/low-can-binding/binding/low-can-cb.cpp b/CAN-binder/low-can-binding/binding/low-can-cb.cpp index 9aa23406..9e85f5c7 100644 --- a/CAN-binder/low-can-binding/binding/low-can-cb.cpp +++ b/CAN-binder/low-can-binding/binding/low-can-cb.cpp @@ -52,7 +52,7 @@ void on_no_clients(std::string message) } } -static void push_n_notify(const can_message_t cm) +static void push_n_notify(const can_message_t& cm) { can_bus_t& cbm = configuration_t::instance().get_can_bus_manager(); std::lock_guard<std::mutex> can_message_lock(cbm.get_can_message_mutex()); @@ -181,7 +181,7 @@ static int subscribe_unsubscribe_signal(struct afb_req request, bool subscribe, /// static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe, const struct utils::signals_found& signals) { - int ret, rets = 0; + int rets = 0; //TODO: Implement way to dynamically call the right function no matter // how much signals types we have. @@ -189,6 +189,7 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe, for(const auto& sig : signals.diagnostic_messages) { + int ret = 0; diagnostic_manager_t& diag_m = conf.get_diagnostic_manager(); DiagnosticRequest* diag_req = conf.get_request_from_diagnostic_message(sig->get_name()); @@ -295,6 +296,8 @@ static const std::map<std::string, struct event_filter_t> parse_args_from_reques args = afb_req_json(request); if (args == NULL || !json_object_object_get_ex(args, "event", &event)) { + event = json_object_new_string("*"); + parse_filter(event, &event_filter); ret["*"] = event_filter; } else if (json_object_get_type(event) != json_type_array) |