Typo, rename, format
authorRomain Forlot <romain.forlot@iot.bzh>
Wed, 26 Apr 2017 22:53:30 +0000 (00:53 +0200)
committerRomain Forlot <romain.forlot@iot.bzh>
Wed, 26 Apr 2017 23:03:34 +0000 (01:03 +0200)
Change-Id: I8250ef78f0b540617bd249873250f62ad6361fdf
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
CAN-binder/low-can-binding/can/can-bus-dev.cpp
CAN-binder/low-can-binding/can/can-bus.cpp
CAN-binder/low-can-binding/can/can-message.hpp
CAN-binder/low-can-binding/low-can-binding.cpp

index 1aaefc9..df0c0d6 100644 (file)
@@ -28,8 +28,6 @@
 #include "../low-can-binding.hpp"
 #include "canutil/write.h"
 
-#define U64_DATA(p) (*(unsigned long long*)(p)->data)
-
 /// @brief Class constructor
 ///
 /// @param[in] dev_name - String representing the device name into the linux /dev tree
index 6665744..6e74b86 100644 (file)
  * limitations under the License.
  */
 
-#include <map>
-#include <cerrno>
-#include <vector>
-#include <string>
 #include <net/if.h>
 #include <sys/socket.h>
 #include <json-c/json.h>
 #include <linux/can/raw.h>
+#include <map>
+#include <cerrno>
+#include <vector>
+#include <string>
+#include <algorithm>
 
 #include "can-bus.hpp"
 
@@ -337,7 +338,7 @@ void can_bus_t::push_new_vehicle_message(const openxc_VehicleMessage& v_msg)
 
 /// @brief Create a RX_SETUP receive job for the BCM socket of a CAN signal.
 ///
-/// @return 0 if ok.
+/// @return 0 if ok -1 if not.
        int can_bus_t::create_rx_filter(const can_signal_t& s)
        {
                const std::string& bus  = s.get_message().get_bus_name();
index 6fe0317..5a6e6eb 100644 (file)
@@ -70,6 +70,6 @@ public:
 
        bool is_correct_to_send();
 
-static can_message_t convert_from_canfd_frame(const struct canfd_frame& frame, size_t nbytes);
+       static can_message_t convert_from_canfd_frame(const struct canfd_frame& frame, size_t nbytes);
        canfd_frame convert_to_canfd_frame();
 };
index 4420b0d..088b76f 100644 (file)
@@ -142,6 +142,7 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe,
 
        for(const auto& sig : signals.diagnostic_messages)
        {
+               diagnostic_manager_t& diag_m = conf.get_diagnostic_manager();
                DiagnosticRequest* diag_req = conf.get_request_from_diagnostic_message(sig->get_name());
 
                // If the requested diagnostic message isn't supported by the car then unsubcribe it
@@ -150,14 +151,14 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe,
                if(sig->get_supported() && subscribe)
                {
                                float frequency = sig->get_frequency();
-                               subscribe = conf.get_diagnostic_manager().add_recurring_request(
+                               subscribe = diag_m.add_recurring_request(
                                        diag_req, sig->get_name().c_str(), false, sig->get_decoder(), sig->get_callback(), (float)frequency);
                                        //TODO: Adding callback requesting ignition status:     diag_req, sig.c_str(), false, diagnostic_message_t::decode_obd2_response, diagnostic_message_t::check_ignition_status, frequency);
                }
                else
                {
-                       conf.get_diagnostic_manager().cleanup_request(
-                               conf.get_diagnostic_manager().find_recurring_request(diag_req), true);
+                       diag_m.cleanup_request(
+                               diag_m.find_recurring_request(diag_req), true);
                        WARNING(binder_interface, "%s: signal: %s isn't supported. Canceling operation.", __FUNCTION__, sig->get_name().c_str());
                        return -1;
                }
@@ -213,14 +214,14 @@ extern "C"
 {
        static void subscribe(struct afb_req request)
        {
-               std::vector<std::string> signals;
+               std::vector<std::string> args;
                struct utils::signals_found sf;
                int ok = 0, total = 0;
                bool subscribe = true;
 
-               signals = parse_signals_from_request(request, subscribe);
+               args = parse_args_from_request(request, subscribe);
 
-               for(const auto& sig: signals)
+               for(const auto& sig: args)
                {
                        openxc_DynamicField search_key = build_DynamicField(sig);
                        sf = utils::signals_manager_t::instance().find_signals(search_key);
@@ -241,7 +242,7 @@ extern "C"
 
        static void unsubscribe(struct afb_req request)
        {
-               parse_signals_from_request(request, false);
+               parse_args_from_request(request, false);
        }
 
        static const struct afb_verb_desc_v1 verbs[]=