Use initialisation list with CanBus_c constructor
[apps/low-level-can-service.git] / src / can-utils.h
index a760af1..04303e3 100644 (file)
@@ -87,21 +87,21 @@ typedef uint64_t (*SignalEncoder)(struct CanSignal* signal,
  */
 class CanBus_c {
        private:
-               afb_binding_interface *interface;
+               afb_binding_interface *interface_;
 
                /* Got from conf file */
-               std::string deviceName;
+               std::string device_name;
 
-               int socket;
-               bool is_fdmode_on;
+               int can_socket_;
+               bool is_fdmode_on_;
                struct sockaddr_can txAddress;
 
-               std::thread th_reading;
-               std::thread th_decoding;
-               std::thread th_pushing;
+               std::thread th_reading_;
+               std::thread th_decoding_;
+               std::thread th_pushing_;
 
-               std::queue <CanMessage_c> can_message_q;
-               std::queue <openxc_VehicleMessage> vehicle_message_q;
+               std::queue <CanMessage_c> can_message_q_;
+               std::queue <openxc_VehicleMessage> vehicle_message_q_;
 
        public:
                int open();
@@ -112,6 +112,9 @@ class CanBus_c {
 
                CanMessage_c* next_can_message();
                void insert_new_can_message(CanMessage_c *can_msg);
+
+               openxc_VehicleMessage* next_vehicle_message();
+               void insert_new_vehicle_message(openxc_VehicleMessage *v_msg);
 };
 
 /* A compact representation of a single CAN message, meant to be used in in/out
@@ -137,10 +140,10 @@ class CanMessage_c {
                uint8_t length;
 
        public:
-               uint32_t get_id();
-               int get_format();
-               uint8_t get_data();
-               uint8_t get_lenght();
+               uint32_t get_id() const;
+               int get_format() const;
+               uint8_t get_data() const;
+               uint8_t get_lenght() const;
 
                void set_id(uint32_t id);
                void set_format(CanMessageFormat format);
@@ -229,8 +232,6 @@ struct CanSignal {
        SignalEncoder encoder;
        bool received;
        float lastValue;
-
-       struct afb_event event;
 };
 typedef struct CanSignal CanSignal;