GENIVI / CANdb

Library for parsing CAN bus database description formats
Mozilla Public License 2.0
145 stars 46 forks source link

"VAL_TABLE_" and "VAL_" DBC Signal parsing #32

Closed enricop closed 3 years ago

enricop commented 3 years ago

Hello,

in this file CANdb/src/dbcparser.cpp at line192:

    pegParser["val_entry"] = [&can_db, &phrasesPairs](const peg::SemanticValues&) {
        std::vector<CANdb_t::ValTable::ValTableEntry> tab;
        std::transform(phrasesPairs.begin(), phrasesPairs.end(), std::back_inserter(tab), [](const auto& p) {
            return CANdb_t::ValTable::ValTableEntry{ p.first, p.second };
        });
        can_db.val_tables.push_back(CANdb_t::ValTable{ "", tab });
        phrasesPairs.clear();
    };

the signal id/name is not parsed from the DBC file "VALTABLE" and "VAL_" section, but just an empty string ("") is used.

It should be placed in the "identifier" member of "ValTable" struct.

Would it be possible to fix this upstream or provide us just a suggestion on how to do it? Thanks for your support, enrico

enricop commented 3 years ago

any suggestion for implementing a perParser lamda for "VAL_" entries like the ones here? @btaczala @rkollataj @mguentner

btaczala commented 3 years ago

@enricop can you provide an example dbc file for this?

enricop commented 3 years ago

hello, I've sent you a mail with the dbc.

You can find also a "dbcparser.cpp" patch we are using to workaround this issue, but we are not expert on the parsing library/logic. candb.txt

Thank you very much for your support on this and your effort in removing boost as a dependency of CANdb.

enricop commented 3 years ago

this is the actual diff with the current upstream master branch code: upstream_patch.txt

enricop commented 3 years ago

hello, we tested the "val_table" branch and it's ok

btaczala commented 3 years ago

@enricop Yeah I'll merge the valtable branch; the thing that's still missing is `VAL` entries - I'm planning to add support for them

enricop commented 3 years ago

ok thank you. Linking the entries in the new VAL_ data structure with the VAL_TABLE_ data structure would be usefull too.