Adds CAN FD flag on message object.
[src/low-level-can-generator.git] / src / main.cpp
index d30428e..0608f16 100644 (file)
@@ -173,6 +173,7 @@ std::ostream& operator<<(std::ostream& o, const generator<openxc::can_message>&
                << "{std::make_shared<can_message_definition_t>(can_message_definition_t{"\r
                << gen(v.v_.bus()) << ","\r
                << v.v_.id() << ","\r
+               << v.v_.is_fd() << ","\r
                << "can_message_format_t::STANDARD,"\r
                << "frequency_clock_t(" << gen(v.v_.max_frequency()) << "),"\r
                << gen(v.v_.force_send_changed()) << ",\n";\r
@@ -203,7 +204,8 @@ std::ostream& operator<<(std::ostream& o, const generator<openxc::diagnostic_mes
                << v.line_prefix_ << "\t" << gen(v.v_.frequency()) << ",\n"\r
                << v.line_prefix_ << "\t" << (v.v_.decoder().size() ? v.v_.decoder() : "nullptr") << ",\n"\r
                << v.line_prefix_ << "\t" << (v.v_.callback().size() ? v.v_.callback() : "nullptr") << ",\n"\r
-               << v.line_prefix_ << "\t" << "true" << "\n"\r
+               << v.line_prefix_ << "\t" << "true" << ",\n"\r
+               << v.line_prefix_ << "\t" << "false" << "\n"\r
                << v.line_prefix_ << "})}\n";\r
        return o;\r
 }\r
@@ -216,7 +218,8 @@ std::ostream& operator<<(std::ostream& o, const generator<openxc::diagnostic_mes
 void generate(const std::string& header, const std::string& footer, const openxc::message_set& message_set, std::ostream& out)\r
 {\r
        out << "#include \"application.hpp\"\n"\r
-               << "#include \"../can/can-decoder.hpp\"\n\n";\r
+               << "#include \"../can/can-decoder.hpp\"\n"\r
+               << "#include \"../can/can-encoder.hpp\"\n\n";\r
 \r
        if (header.size()) out << header << "\n";\r
 \r
@@ -268,7 +271,7 @@ void generate(const std::string& header, const std::string& footer, const openxc
 std::string read_file(const std::string& file)\r
 {\r
        if(file.size() == 0) return std::string();\r
-       \r
+\r
        std::string content;\r
        std::ifstream stream(file);\r
        if (stream)\r
@@ -333,7 +336,7 @@ int main(int argc, char *argv[])
                        showhelpinfo(argv[0]);\r
                        exit(1);\r
                }\r
-               /*use function getopt to get the arguments with option."hu:p:s:v" indicate \r
+               /*use function getopt to get the arguments with option."hu:p:s:v" indicate\r
                that option h,v are the options without arguments while u,p,s are the\r
                options with arguments*/\r
                while((tmp=(char)getopt(argc,argv,"m:h:f:o:"))!=-1)\r
@@ -384,7 +387,7 @@ int main(int argc, char *argv[])
                                throw std::runtime_error(ss.str());\r
                        }\r
                }\r
-               generate(header.str(), footer, message_set, output_file.size() ? out : std::cout); \r
+               generate(header.str(), footer, message_set, output_file.size() ? out : std::cout);\r
        }\r
        catch (std::exception& e)\r
        {\r