aboutsummaryrefslogtreecommitdiffstats
path: root/low-can-binding/can/message
diff options
context:
space:
mode:
Diffstat (limited to 'low-can-binding/can/message')
-rw-r--r--low-can-binding/can/message/can-message.cpp5
-rw-r--r--low-can-binding/can/message/can-message.hpp11
-rw-r--r--low-can-binding/can/message/j1939-message.cpp6
-rw-r--r--low-can-binding/can/message/j1939-message.hpp1
-rw-r--r--low-can-binding/can/message/message.cpp13
-rw-r--r--low-can-binding/can/message/message.hpp10
6 files changed, 39 insertions, 7 deletions
diff --git a/low-can-binding/can/message/can-message.cpp b/low-can-binding/can/message/can-message.cpp
index 0ef693c7..b274206b 100644
--- a/low-can-binding/can/message/can-message.cpp
+++ b/low-can-binding/can/message/can-message.cpp
@@ -55,6 +55,11 @@ uint32_t can_message_t::get_id() const
}
+void can_message_t::set_id(const canid_t id)
+{
+ id_ = id;
+}
+
/// @brief Control whether the object is correctly initialized
/// to be sent over the CAN bus
///
diff --git a/low-can-binding/can/message/can-message.hpp b/low-can-binding/can/message/can-message.hpp
index 769899ea..acc3bfc1 100644
--- a/low-can-binding/can/message/can-message.hpp
+++ b/low-can-binding/can/message/can-message.hpp
@@ -39,8 +39,16 @@ class can_message_t : public message_t {
public:
can_message_t();
- can_message_t(uint32_t maxdlen, uint32_t id, uint32_t length, bool rtr_flag_, uint32_t flags, std::vector<uint8_t>& data, uint64_t timestamp);
+ can_message_t( uint32_t maxdlen,
+ uint32_t id,
+ uint32_t length,
+ bool rtr_flag_,
+ uint32_t flags,
+ std::vector<uint8_t>& data,
+ uint64_t timestamp);
+
uint32_t get_id() const;
+ void set_id(const canid_t id);
static std::shared_ptr<can_message_t> convert_from_frame(const canfd_frame& frame, size_t nbytes, uint64_t timestamp);
struct canfd_frame convert_to_canfd_frame();
@@ -53,5 +61,4 @@ class can_message_t : public message_t {
void set_bcm_msg(struct bcm_msg bcm_msg);
std::string get_debug_message();
-
};
diff --git a/low-can-binding/can/message/j1939-message.cpp b/low-can-binding/can/message/j1939-message.cpp
index ec65cba4..8e056c17 100644
--- a/low-can-binding/can/message/j1939-message.cpp
+++ b/low-can-binding/can/message/j1939-message.cpp
@@ -159,6 +159,12 @@ uint32_t j1939_message_t::get_id() const
return get_pgn();
}
+void j1939_message_t::set_id(const canid_t id)
+{
+ pgn_ = id;
+}
+
+
/**
* @brief Return the sockname of the message
*
diff --git a/low-can-binding/can/message/j1939-message.hpp b/low-can-binding/can/message/j1939-message.hpp
index 9e9cea4a..a513e94e 100644
--- a/low-can-binding/can/message/j1939-message.hpp
+++ b/low-can-binding/can/message/j1939-message.hpp
@@ -75,6 +75,7 @@ class j1939_message_t : public message_t
bool is_set();
std::string get_debug_message();
uint32_t get_id() const;
+ void set_id(const canid_t id);
struct sockaddr_can get_sockname();
void set_sockname(struct sockaddr_can sockname);
void set_sockname(pgn_t pgn, name_t name, uint8_t addr);
diff --git a/low-can-binding/can/message/message.cpp b/low-can-binding/can/message/message.cpp
index aaab99f5..2496b672 100644
--- a/low-can-binding/can/message/message.cpp
+++ b/low-can-binding/can/message/message.cpp
@@ -135,7 +135,7 @@ uint32_t message_t::get_length() const
*
* @param data A vector of data
*/
-void message_t::set_data(std::vector<uint8_t> &data)
+void message_t::set_data(std::vector<uint8_t> data)
{
data_ = data;
}
@@ -170,13 +170,22 @@ void message_t::set_flags(uint32_t flags)
flags_ = flags_ | flags;
}
+void message_t::erase_flags()
+{
+ flags_ = 0;
+}
+
uint32_t message_t::get_maxdlen()
{
return maxdlen_;
}
-
void message_t::set_maxdlen(uint32_t maxdlen)
{
maxdlen_ = maxdlen;
+}
+
+void message_t::set_length(uint32_t length)
+{
+ length_ = length;
} \ No newline at end of file
diff --git a/low-can-binding/can/message/message.hpp b/low-can-binding/can/message/message.hpp
index 6cef0185..db06eb38 100644
--- a/low-can-binding/can/message/message.hpp
+++ b/low-can-binding/can/message/message.hpp
@@ -29,6 +29,7 @@
#define CAN_MESSAGE_SIZE 8
#define MAX_BCM_CAN_FRAMES 257
+#define MAX_ISOTP_FRAMES 4096
/**
@@ -42,6 +43,8 @@
#define J1939_PROTOCOL 0x0010
#define J1939_ADDR_CLAIM_PROTOCOL 0x0020
#define ISOTP_PROTOCOL 0x0040
+#define ISOTP_SEND 0x0080
+#define ISOTP_RECEIVE 0x0100
#define FD_FRAME 0x0800
/// @class message_t
@@ -69,16 +72,17 @@ public:
uint32_t get_length() const;
uint64_t get_timestamp() const;
- void set_data(std::vector<uint8_t> &data);
+ void set_data(std::vector<uint8_t> data);
void set_sub_id(int sub_id);
void set_timestamp(uint64_t timestamp);
virtual bool is_set() = 0;
virtual std::string get_debug_message() = 0;
virtual uint32_t get_id() const = 0;
+ virtual void set_id(canid_t id) = 0;
uint32_t get_flags();
void set_flags(uint32_t flags);
+ void erase_flags();
uint32_t get_maxdlen();
void set_maxdlen(uint32_t maxdlen);
-
-
+ void set_length(uint32_t length);
};