Giter Site home page Giter Site logo

dbc_parser_cpp's People

Contributors

linuxdevon avatar murmele avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dbc_parser_cpp's Issues

Feature: Implement empty BU_

BU_ field is available, but is empty. According to the documentation there is nothing against an empty BU_ field
http://mcu.so/Microcontroller/Automotive/dbc-file-format-documentation_compress.pdf

VERSION ""


NS_ : 

BS_:

BU_:


BO_ 293 Msg1: 2 Vector__XXX
 SG_ Wert7 : 0|16@1- (1,0) [0|0] "" Vector__XXX

BO_ 292 Msg2: 8 Vector__XXX
 SG_ Wert8 : 56|8@1- (1,0) [0|0] "" Vector__XXX
 SG_ Wert6 : 32|24@1- (1,0) [0|0] "km/h" Vector__XXX
 SG_ Wert5 : 24|8@1- (1,0) [0|0] "" Vector__XXX
 SG_ Wert4 : 0|24@1- (1,0) [0|0] "km/h" Vector__XXX

BO_ 291 Msg3: 8 Vector__XXX
 SG_ Wert3 : 48|16@1- (1,0) [0|0] "" Vector__XXX
 SG_ Wert2 : 24|8@1- (1,0) [0|0] "" Vector__XXX
 SG_ Wert1 : 32|16@1- (1,0) [0|0] "" Vector__XXX
 SG_ Speed : 0|24@1- (1,0) [0|0] "km/h" Vector__XXX

Feature: Better error messages

Currently only a validity_error() is thrown if the dbc file is not correct. Maybe introducing an enum which will be returned with the error to indicate where the error is located and a function to convert the enum to a string error message.

dbc_parser_cpp/src/dbc.cpp

Lines 204 to 250 in 753119d

Message::ParseSignalsStatus DbcParser::parseMessage(const uint32_t id, const std::vector<uint8_t>& data, std::vector<double>& out_values) {
for (const auto& message : messages) {
if (message.id() == id) {
return message.parseSignals(data, out_values);
}
}
return Message::ParseSignalsStatus::ErrorUnknownID;
}
void DbcParser::parse_dbc_header(std::istream& file_stream) {
std::string line;
std::smatch match;
utils::StreamHandler::get_line(file_stream, line);
if (!std::regex_search(line, match, version_re)) {
throw validity_error();
}
version = match.str(2);
utils::StreamHandler::get_next_non_blank_line(file_stream, line);
utils::StreamHandler::skip_to_next_blank_line(file_stream, line);
utils::StreamHandler::get_next_non_blank_line(file_stream, line);
if (!std::regex_search(line, match, bit_timing_re)) {
throw validity_error();
}
}
void DbcParser::parse_dbc_nodes(std::istream& file_stream) {
std::string line;
std::smatch match;
utils::StreamHandler::get_next_non_blank_line(file_stream, line);
if (!std::regex_search(line, match, node_re)) {
throw validity_error();
}
if (match.length() > 2) {
std::string n = match.str(2);
utils::String::split(n, nodes);
}
}
void DbcParser::parse_dbc_messages(const std::vector<std::string>& lines) {

what() methods are private

Why the what methods are private?

	class exception : public std::exception {
		const char * what() const throw() {
			return "libdbc exception occurred";
		}
	};

	class validity_error : public exception {
		const char * what() const throw() {
			return "Invalid DBC file...";
		}
	};

CMake minimum required version issue

Building with CMake version 3.16 up to 3.22 fails. CMakeLists.txt uses FILE_SET which requires CMake 3.23 but minimum required CMake version is set to 3.16.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.