aboutsummaryrefslogtreecommitdiffstats
path: root/src/openxc/can_message.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openxc/can_message.cpp')
-rwxr-xr-xsrc/openxc/can_message.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/openxc/can_message.cpp b/src/openxc/can_message.cpp
index 77418d8..858540c 100755
--- a/src/openxc/can_message.cpp
+++ b/src/openxc/can_message.cpp
@@ -27,6 +27,16 @@ namespace openxc
return is_fd_;
}
+ void can_message::is_j1939(const bool is_j1939)
+ {
+ is_j1939_ = is_j1939;
+ }
+
+ bool can_message::is_j1939() const
+ {
+ return is_j1939_;
+ }
+
bool can_message::bit_numbering_inverted() const
{
return bit_numbering_inverted_;
@@ -72,10 +82,16 @@ namespace openxc
return force_send_changed_;
}
+ uint32_t can_message::length() const
+ {
+ return length_;
+ }
+
void can_message::from_json(const nlohmann::json& j)
{
bus_ = j.count("bus") ? j["bus"].get<std::string>() : "";
is_fd_ = j.count("is_fd") ? j["is_fd"].get<bool>() : false;
+ is_j1939_ = j.count("is_j1939") ? j["is_j1939"].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>();
@@ -84,7 +100,8 @@ namespace openxc
max_signal_frequency_ = j.count("max_signal_frequency") ? j["max_signal_frequency"].get<float>() : 5;
force_send_changed_ = j.count("force_send_changed") ? j["force_send_changed"].get<bool>() : true;
force_send_changed_signals_ = j.count("force_send_changed_signals") ? j["force_send_changed_signals"].get<bool>() : false;
-
+ length_ = j.count("length") ? j["length"].get<uint32_t>() : 0;
+
if(j.count("signals"))
{
std::map<std::string, nlohmann::json> signals = j["signals"];
@@ -108,6 +125,7 @@ namespace openxc
nlohmann::json j;
j["bus"] = bus_;
j["is_fd"] = is_fd_;
+ j["is_j1939"] = is_j1939_;
j["bit_numbering_inverted"] = bit_numbering_inverted_;
j["signals"] = signals_;
j["name"] = name_;
@@ -117,6 +135,7 @@ namespace openxc
j["max_signal_frequency"] = max_signal_frequency_;
j["force_send_changed"] = force_send_changed_;
j["force_send_changed_signals"] = force_send_changed_signals_;
+ j["length"] = length_;
return j;
}