add nmea2000 dependency. Fix CSV parsing

This commit is contained in:
oleg 2026-04-13 10:39:48 +03:00
parent 16466ed754
commit 0d2668bac5
4 changed files with 29 additions and 0 deletions

View File

@ -45,5 +45,9 @@ target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
${clipp_SOURCE_DIR}/include ${clipp_SOURCE_DIR}/include
) )
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE
CANBOAT_JSON_PATH="${canboat_SOURCE_DIR}/docs/canboat.json"
)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ftxui::component ftxui::screen ftxui::dom tiny-process-library xlnt sqlite3_lib z Boost::regex ${Boost_LIBRARIES} lely::coapp lely::co lely::can lely::io2 lely::ev lely::util) target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ftxui::component ftxui::screen ftxui::dom tiny-process-library xlnt sqlite3_lib z Boost::regex ${Boost_LIBRARIES} lely::coapp lely::co lely::can lely::io2 lely::ev lely::util)

View File

@ -121,6 +121,19 @@ FetchContent_Declare(
GIT_PROGRESS TRUE GIT_PROGRESS TRUE
) )
FetchContent_Declare(
canboat
GIT_REPOSITORY https://github.com/canboat/canboat.git
GIT_TAG v6.1.6
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
FetchContent_GetProperties(canboat)
if(NOT canboat_POPULATED)
FetchContent_Populate(canboat)
endif()
FetchContent_GetProperties(lely_core) FetchContent_GetProperties(lely_core)
if(NOT lely_core_POPULATED) if(NOT lely_core_POPULATED)
FetchContent_Populate(lely_core) FetchContent_Populate(lely_core)

View File

@ -92,6 +92,14 @@ std::unique_ptr<sqlite::database> parseCsv(const std::string &file) {
if (line.empty()) if (line.empty())
continue; continue;
while (std::count(line.begin(), line.end(), '"') % 2 != 0) {
std::string next;
if (!std::getline(ifs, next))
break;
line += '\n';
line += next;
}
auto fields = parseCsvLine(line); auto fields = parseCsvLine(line);
std::map<std::string, std::string> pgn_row_map, spn_row_map; std::map<std::string, std::string> pgn_row_map, spn_row_map;

View File

@ -57,6 +57,10 @@ void initJ1939Database(sqlite::database &db) {
db << "PRAGMA journal_mode = OFF"; db << "PRAGMA journal_mode = OFF";
db << "PRAGMA synchronous = OFF"; db << "PRAGMA synchronous = OFF";
db << "PRAGMA foreign_keys = ON;"; db << "PRAGMA foreign_keys = ON;";
db << "CREATE INDEX IF NOT EXISTS idx_spns_pgn ON spns(pgn);";
db << "CREATE INDEX IF NOT EXISTS idx_spn_fragments_spn ON spn_fragments(spn);";
db << "CREATE INDEX IF NOT EXISTS idx_spn_fragments_spn_pgn ON spn_fragments(spn, pgn);";
} }
std::string buildPgnInsertSql() { std::string buildPgnInsertSql() {