X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fopenxc%2Fsignal.cpp;fp=src%2Fopenxc%2Fsignal.cpp;h=e60c3ee7c42c8d6281115ec3aab36fc93959d70f;hb=f61a6cb23ab86da2b3d477276886f1e73ec5c88c;hp=e9c1088b43bab9c0e62008ae3554e45d82c9c1a8;hpb=0bb5744297d7d25577b5ed48899c021e23e9a8ec;p=src%2Flow-level-can-generator.git diff --git a/src/openxc/signal.cpp b/src/openxc/signal.cpp index e9c1088..e60c3ee 100755 --- a/src/openxc/signal.cpp +++ b/src/openxc/signal.cpp @@ -83,6 +83,23 @@ namespace openxc { return encoder_; } + + std::pair signal::multiplex() const{ + return multiplex_; + } + + bool signal::is_big_endian() const{ + return is_big_endian_; + } + + bool signal::is_signed() const{ + return is_signed_; + } + + std::string signal::unit() const{ + return unit_; + } + void signal::from_json(const nlohmann::json& j) { @@ -99,6 +116,29 @@ namespace openxc force_send_changed_ = j.count("force_send_changed") ? j["force_send_changed"].get() : false; writable_ = j.count("writable") ? j["writable"].get() : false; encoder_ = j.count("encoder") ? j["encoder"].get() : ""; + if(j.count("multiplex")) + { + std::string mult = j["multiplex"].get(); + bool first = false; + int second = 0 ; + if(mult.compare("Multiplexor") == 0){ + first = true; + } + else if (mult.compare("") != 0) + { + second = std::stoi(mult); + } + multiplex_ = std::make_pair(first,second); + } + else + { + multiplex_ = std::make_pair(false,0); + } + is_big_endian_ = j.count("is_big_endian") ? j["is_big_endian"].get() : false; + is_signed_ = j.count("is_signed") ? j["is_signed"].get() : false; + unit_ = j.count("unit") ? j["unit"].get() : ""; + + if (j.count("states")) { @@ -127,6 +167,29 @@ namespace openxc j["force_send_changed"] = force_send_changed_; j["writable"] = writable_; j["encoder"] = encoder_; + + std::string multi = ""; + + if(multiplex_.first) + { + multi = "Multiplexor"; + } + else if(multiplex_.second != 0) + { + multi = std::to_string(multiplex_.second); + } + else + { + multi = ""; + } + + j["multiplex"] = multi; + + + + j["is_big_endian"] = is_big_endian_; + j["is_signed"] = is_signed_; + j["unit"] = unit_; return j; }