aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.cpp52
-rwxr-xr-xsrc/openxc/can_message.cpp14
-rwxr-xr-xsrc/openxc/can_message.hpp3
3 files changed, 59 insertions, 10 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 9961105..b35f9e3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -33,6 +33,20 @@
#define EXIT_COMMAND_LINE_ERROR 2
#define EXIT_PROGRAM_ERROR 3
+
+/**
+ * FLAGS
+ */
+
+#define INVALID_FLAG 0x0001
+#define STANDARD_ID 0x0002
+#define EXTENDED_ID 0x0004
+#define BCM_PROTOCOL 0x0008
+#define J1939_PROTOCOL 0x0010
+#define J1939_ADDR_CLAIM_PROTOCOL 0x0020
+#define ISOTP_PROTOCOL 0x0040
+#define FD_FRAME 0x0800
+
template <typename T>
struct generator
{
@@ -185,18 +199,40 @@ std::ostream& operator<<(std::ostream& o, const generator<openxc::can_message>&
<< gen(v.v_.bus()) << ","
<< v.v_.id() << ","
<< "\"" << v.v_.name() << "\","
- << v.v_.length() << ","
- << gen(v.v_.is_fd()) << ",";
- if(v.v_.is_j1939()){
- o << "message_format_t::J1939,";
+ << v.v_.length() << ",";
+ uint32_t flags = 0;
+ if(v.v_.is_fd())
+ {
+ flags = flags|FD_FRAME;
}
- else if(v.v_.is_extended())
+
+ if(v.v_.is_j1939())
{
- o << "message_format_t::EXTENDED,";
+ flags = flags|J1939_PROTOCOL;
}
- else{
- o << "message_format_t::STANDARD,";
+
+ if(v.v_.is_isotp())
+ {
+ flags = flags|ISOTP_PROTOCOL;
}
+
+ if(v.v_.is_extended())
+ {
+ flags = flags|EXTENDED_ID;
+ }
+ else
+ {
+ flags = flags|STANDARD_ID;
+ }
+
+
+ if(v.v_.is_fd())
+ {
+ flags = flags|FD_FRAME;
+ }
+
+ o << gen(flags) << ",";
+
o << "frequency_clock_t(" << gen(v.v_.max_frequency()) << "),"
<< gen(v.v_.force_send_changed()) << ",";
std::uint32_t index = 0;
diff --git a/src/openxc/can_message.cpp b/src/openxc/can_message.cpp
index 70b98a7..700896a 100755
--- a/src/openxc/can_message.cpp
+++ b/src/openxc/can_message.cpp
@@ -46,6 +46,16 @@ namespace openxc
return is_j1939_;
}
+ void can_message::is_isotp(const bool is_isotp)
+ {
+ is_isotp_ = is_isotp;
+ }
+
+ bool can_message::is_isotp() const
+ {
+ return is_isotp_;
+ }
+
bool can_message::bit_numbering_inverted() const
{
return bit_numbering_inverted_;
@@ -102,6 +112,7 @@ namespace openxc
is_fd_ = j.count("is_fd") ? j["is_fd"].get<bool>() : false;
is_extended_ = j.count("is_extended") ? j["is_extended"].get<bool>() : false;
is_j1939_ = j.count("is_j1939") ? j["is_j1939"].get<bool>() : false;
+ is_isotp_ = j.count("is_isotp") ? j["is_isotp"].get<bool>() : false;
bit_numbering_inverted_ = j.count("bit_numbering_inverted") ? j["bit_numbering_inverted"].get<bool>() : false;
name_ = j.count("name") ? j["name"].get<std::string>() : "";
handlers_ = j.count("handlers") ? j["handlers"].get<std::vector<std::string>>() : std::vector<std::string>();
@@ -135,10 +146,9 @@ namespace openxc
nlohmann::json j;
j["bus"] = bus_;
j["is_fd"] = is_fd_;
-
j["is_extended"] = is_extended_;
-
j["is_j1939"] = is_j1939_;
+ j["is_isotp"] = is_isotp_;
j["bit_numbering_inverted"] = bit_numbering_inverted_;
j["signals"] = signals_;
j["name"] = name_;
diff --git a/src/openxc/can_message.hpp b/src/openxc/can_message.hpp
index 98b38a5..555b47d 100755
--- a/src/openxc/can_message.hpp
+++ b/src/openxc/can_message.hpp
@@ -25,6 +25,7 @@ namespace openxc
bool is_fd_;
bool is_extended_;
bool is_j1939_;
+ bool is_isotp_;
uint32_t length_;
float min_value;
float max_value;
@@ -38,6 +39,8 @@ namespace openxc
bool is_extended() const;
void is_j1939(const bool is_j1939);
bool is_j1939() const;
+ void is_isotp(const bool is_isotp);
+ bool is_isotp() const;
std::string bus() const;
bool bit_numbering_inverted() const;
const std::vector<signal>& signals() const;