return bit_numbering_inverted_;\r
}\r
\r
- std::uint32_t message_set::max_message_frequency() const\r
+ float message_set::max_message_frequency() const\r
{\r
return max_message_frequency_;\r
}\r
return buses_;\r
}\r
\r
- const std::map<std::string, can_message>& message_set::messages() const\r
+ const std::vector<can_message>& message_set::messages() const\r
{\r
return messages_;\r
}\r
{\r
return commands_;\r
}\r
- \r
- std::string message_set::to_initializer() const\r
- {\r
- std::uint32_t signal_count = 0;\r
- for(const auto& m : messages_)\r
- {\r
- signal_count += m.second.get_signals_count();\r
- }\r
- \r
- std::stringstream ss;\r
- ss << "{0, "\r
- << "\"" << name_ << "\", "\r
- << buses_.size() << ", "\r
- << messages_.size() << ", "\r
- << signal_count << ", "\r
- << commands_.size() << ", "\r
- << diagnostic_messages_.size() << "}";\r
- return ss.str();\r
- }\r
\r
void message_set::from_json(const nlohmann::json& j)\r
{\r
initializers_ = j.count("initializers") ? j["initializers"].get<std::vector<std::string>>() : std::vector<std::string>();\r
loopers_ = j.count("loopers") ? j["loopers"].get<std::vector<std::string>>() : std::vector<std::string>();\r
buses_ = j.count("buses") ? j["buses"].get<std::map<std::string, can_bus>>() : std::map<std::string, can_bus>();\r
- messages_ = j.count("messages") ? j["messages"].get<std::map<std::string, can_message>>() : std::map<std::string, can_message>();\r
+ //messages_ = j.count("messages") ? j["messages"].get<std::map<std::string, can_message>>() : std::map<std::string, can_message>();\r
diagnostic_messages_ = j.count("diagnostic_messages") ? j["diagnostic_messages"].get<std::vector<diagnostic_message>>() : std::vector<diagnostic_message>();\r
mappings_ = j.count("mappings") ? j["mappings"].get<std::vector<mapping>>() : std::vector<mapping>();\r
extra_sources_ = j.count("extra_sources") ? j["extra_sources"].get<std::vector<std::string>>() : std::vector<std::string>();\r
commands_ = j.count("commands") ? j["commands"].get<std::vector<command>>() : std::vector<command>();\r
+ \r
+ \r
+ if (j.count("messages"))\r
+ {\r
+ std::map<std::string, nlohmann::json> messages = j["messages"];\r
+ for(const std::map<std::string, nlohmann::json>::value_type& m : messages)\r
+ {\r
+ can_message cm = m.second.get<can_message>();\r
+ cm.id(m.first);\r
+ messages_.push_back(cm);\r
+ }\r
+ }\r
}\r
\r
-\r
nlohmann::json message_set::to_json() const\r
{\r
nlohmann::json j;\r