Implement check of supported diagnostic PID.
[apps/agl-service-can-low-level.git] / src / can / can-bus-dev.hpp
index d7c3458..63e6163 100644 (file)
 
 #pragma once
 
+#include <stdint.h>
+#include <linux/can.h>
 #include <string>
 #include <thread>
-#include <linux/can.h>
 
 #include "../utils/socket.hpp"
 
@@ -35,17 +36,20 @@ private:
        std::string device_name_;
        utils::socket_t can_socket_;
 
-       int32_t id_; /// < an identifier used through binding that refer to that device
+       int32_t address_; /// < an identifier used through binding that refer to that device
 
        bool is_fdmode_on_; /// < boolean telling if whether or not the can socket use fdmode.
        struct sockaddr_can txAddress_; /// < internal member using to bind to the socket
 
        std::thread th_reading_; /// < Thread handling read the socket can device filling can_message_q_ queue of can_bus_t
-       bool is_running_; /// < boolean telling whether or not reading is running or not
+       bool is_running_ = false; /// < boolean telling whether or not reading is running or not
        void can_reader(can_bus_t& can_bus);
 
 public:
-       can_bus_dev_t(const std::string& dev_name);
+       can_bus_dev_t(const std::string& dev_name, int32_t address);
+
+       std::string get_device_name() const;
+       uint32_t get_address() const;
 
        int open();
        int close();
@@ -54,7 +58,8 @@ public:
 
        void stop_reading();
 
-       std::pair<struct canfd_frame&, size_t> read();
+       can_message_t read();
 
-       int send_can_message(can_message_t& can_msg);
+       int send(can_message_t& can_msg);
+       bool shims_send(const uint32_t arbitration_id, const uint8_t* data, const uint8_t size);
 };