From 6bf9f1f82b21b23c3c7cfc9b5637c9baed5c1ea5 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 27 Jun 2024 14:22:41 +0300 Subject: [PATCH 01/15] Drop all 'dynamic_*' libraries --- .github/workflows/build.yml | 4 +- examples/CMakeLists.txt | 3 - .../novatel/dynamic_components/CMakeLists.txt | 4 - .../dynamic_components/dynamic_components.cpp | 222 ------------------ .../dynamic_file_parser/CMakeLists.txt | 4 - .../dynamic_file_parser.cpp | 168 ------------- .../novatel/dynamic_parser/CMakeLists.txt | 4 - .../novatel/dynamic_parser/dynamic_parser.cpp | 164 ------------- src/decoders/CMakeLists.txt | 1 - src/decoders/dynamic_library/CMakeLists.txt | 14 -- .../api/common_json_reader.hpp | 41 ---- .../dynamic_library/api/common_logger.hpp | 44 ---- .../dynamic_library/api/decoders_export.h | 85 ------- .../dynamic_library/api/novatel_commander.hpp | 53 ----- .../dynamic_library/api/novatel_encoder.hpp | 56 ----- .../api/novatel_file_parser.hpp | 75 ------ .../dynamic_library/api/novatel_filter.hpp | 70 ------ .../dynamic_library/api/novatel_framer.hpp | 57 ----- .../api/novatel_header_decoder.hpp | 52 ---- .../api/novatel_message_decoder.hpp | 59 ----- .../dynamic_library/api/novatel_parser.hpp | 65 ----- src/decoders/dynamic_library/api/version.hpp | 38 --- .../src/common_json_reader.cpp | 84 ------- .../dynamic_library/src/common_logger.cpp | 68 ------ .../dynamic_library/src/novatel_commander.cpp | 61 ----- .../dynamic_library/src/novatel_encoder.cpp | 64 ----- .../src/novatel_file_parser.cpp | 125 ---------- .../dynamic_library/src/novatel_filter.cpp | 121 ---------- .../dynamic_library/src/novatel_framer.cpp | 86 ------- .../src/novatel_header_decoder.cpp | 61 ----- .../src/novatel_message_decoder.cpp | 71 ------ .../dynamic_library/src/novatel_parser.cpp | 107 --------- src/decoders/dynamic_library/src/version.cpp | 33 --- src/hw_interface/CMakeLists.txt | 1 - .../dynamic_library/CMakeLists.txt | 13 - .../dynamic_library/api/hwinterface_export.h | 67 ------ .../dynamic_library/api/stream_interface.hpp | 40 ---- .../dynamic_library/api/version.hpp | 32 --- .../dynamic_library/src/stream_interface.cpp | 55 ----- .../dynamic_library/src/version.cpp | 31 --- 40 files changed, 2 insertions(+), 2401 deletions(-) delete mode 100644 examples/novatel/dynamic_components/CMakeLists.txt delete mode 100644 examples/novatel/dynamic_components/dynamic_components.cpp delete mode 100644 examples/novatel/dynamic_file_parser/CMakeLists.txt delete mode 100644 examples/novatel/dynamic_file_parser/dynamic_file_parser.cpp delete mode 100644 examples/novatel/dynamic_parser/CMakeLists.txt delete mode 100644 examples/novatel/dynamic_parser/dynamic_parser.cpp delete mode 100644 src/decoders/dynamic_library/CMakeLists.txt delete mode 100644 src/decoders/dynamic_library/api/common_json_reader.hpp delete mode 100644 src/decoders/dynamic_library/api/common_logger.hpp delete mode 100644 src/decoders/dynamic_library/api/decoders_export.h delete mode 100644 src/decoders/dynamic_library/api/novatel_commander.hpp delete mode 100644 src/decoders/dynamic_library/api/novatel_encoder.hpp delete mode 100644 src/decoders/dynamic_library/api/novatel_file_parser.hpp delete mode 100644 src/decoders/dynamic_library/api/novatel_filter.hpp delete mode 100644 src/decoders/dynamic_library/api/novatel_framer.hpp delete mode 100644 src/decoders/dynamic_library/api/novatel_header_decoder.hpp delete mode 100644 src/decoders/dynamic_library/api/novatel_message_decoder.hpp delete mode 100644 src/decoders/dynamic_library/api/novatel_parser.hpp delete mode 100644 src/decoders/dynamic_library/api/version.hpp delete mode 100644 src/decoders/dynamic_library/src/common_json_reader.cpp delete mode 100644 src/decoders/dynamic_library/src/common_logger.cpp delete mode 100644 src/decoders/dynamic_library/src/novatel_commander.cpp delete mode 100644 src/decoders/dynamic_library/src/novatel_encoder.cpp delete mode 100644 src/decoders/dynamic_library/src/novatel_file_parser.cpp delete mode 100644 src/decoders/dynamic_library/src/novatel_filter.cpp delete mode 100644 src/decoders/dynamic_library/src/novatel_framer.cpp delete mode 100644 src/decoders/dynamic_library/src/novatel_header_decoder.cpp delete mode 100644 src/decoders/dynamic_library/src/novatel_message_decoder.cpp delete mode 100644 src/decoders/dynamic_library/src/novatel_parser.cpp delete mode 100644 src/decoders/dynamic_library/src/version.cpp delete mode 100644 src/hw_interface/dynamic_library/CMakeLists.txt delete mode 100644 src/hw_interface/dynamic_library/api/hwinterface_export.h delete mode 100644 src/hw_interface/dynamic_library/api/stream_interface.hpp delete mode 100644 src/hw_interface/dynamic_library/api/version.hpp delete mode 100644 src/hw_interface/dynamic_library/src/stream_interface.cpp delete mode 100644 src/hw_interface/dynamic_library/src/version.cpp diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1f52e2888..9612c36f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -185,10 +185,10 @@ jobs: - name: Generate HTML code coverage reports run: | mkdir out/build/code-coverage - gcovr -r ./src/ ./out/build/ --exclude='.*/test/.*' --exclude='.*/dynamic_library/.*' --exclude='.*/version.h' --html --html-details -o ./out/build/code-coverage/index.html + gcovr -r ./src/ ./out/build/ --exclude='.*/test/.*' --exclude='.*/version.h' --html --html-details -o ./out/build/code-coverage/index.html - name: Coverage visualization in pipeline summary - run: gcovr -r ./src/ ./out/build/ --exclude='.*/test/.*' --exclude='.*/dynamic_library/.*' --exclude='.*/version.h' --exclude-unreachable-branches --print-summary -o ./out/build/coverage.xml + run: gcovr -r ./src/ ./out/build/ --exclude='.*/test/.*' --exclude='.*/version.h' --exclude-unreachable-branches --print-summary -o ./out/build/coverage.xml - name: Upload Artifacts uses: actions/upload-artifact@v4.3.0 diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index e771d539e..207129dea 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -5,6 +5,3 @@ add_subdirectory(novatel/converter_parser) add_subdirectory(novatel/json_parser) add_subdirectory(novatel/range_decompressor) add_subdirectory(novatel/rxconfig_handler) -add_subdirectory(novatel/dynamic_file_parser) -add_subdirectory(novatel/dynamic_components) -add_subdirectory(novatel/dynamic_parser) diff --git a/examples/novatel/dynamic_components/CMakeLists.txt b/examples/novatel/dynamic_components/CMakeLists.txt deleted file mode 100644 index 4d11417a4..000000000 --- a/examples/novatel/dynamic_components/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(TARGET_NAME "dynamic_components") -add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} common decoders_dynamic_library novatel stream_interface) -set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/dynamic_components/dynamic_components.cpp b/examples/novatel/dynamic_components/dynamic_components.cpp deleted file mode 100644 index a3567db4a..000000000 --- a/examples/novatel/dynamic_components/dynamic_components.cpp +++ /dev/null @@ -1,222 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file dynamic_components.cpp -// =============================================================================== - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace fs = std::filesystem; - -using namespace novatel::edie; -using namespace novatel::edie::oem; - -int main(int argc, char* argv[]) -{ - // This example uses the default logger config, but you can also pass a config file to InitLogger() - // Example config file: logger\example_logger_config.toml - Logger::InitLogger(); - std::shared_ptr pclLogger = Logger::RegisterLogger("dynamic_components"); - pclLogger->set_level(spdlog::level::debug); - Logger::AddConsoleLogging(pclLogger); - Logger::AddRotatingFileLogger(pclLogger); - - // Get command line arguments - pclLogger->info("Decoder library information:\n{}", caPrettyPrint); - - std::string sEncodeFormat = "ASCII"; - if (argc == 2 && strcmp(argv[1], "-V") == 0) { return 0; } - if (argc < 3) - { - pclLogger->error("ERROR: Need to specify a JSON message definitions DB, an input file and an output format."); - pclLogger->error("Example: converter "); - return 1; - } - if (argc == 4) { sEncodeFormat = argv[3]; } - - // Check command line arguments - const fs::path pathJsonDb = argv[1]; - if (!fs::exists(pathJsonDb)) - { - pclLogger->error("File \"{}\" does not exist", pathJsonDb.string()); - return 1; - } - const fs::path pathInFilename = argv[2]; - if (!fs::exists(pathInFilename)) - { - pclLogger->error("File \"{}\" does not exist", pathInFilename.string()); - return 1; - } - - ENCODE_FORMAT eEncodeFormat = StringToEncodeFormat(sEncodeFormat); - if (eEncodeFormat == ENCODE_FORMAT::UNSPECIFIED) - { - pclLogger->error("Unspecified output format.\n\tASCII\n\tBINARY\n\tFLATTENED_BINARY"); - return 1; - } - - pclLogger->info("Loading Database..."); - auto tStart = std::chrono::high_resolution_clock::now(); - JsonReader* pclJsonDb = CommonJsonReaderInit(); - CommonJsonReaderLoadFile(pclJsonDb, pathJsonDb.string().c_str()); - pclLogger->info("Done in {}ms", - std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - tStart).count()); - - // Set up the EDIE components - Framer* pclFramer = NovatelFramerInit(); - NovatelFramerSetLoggerLevel(pclFramer, spdlog::level::debug); - NovatelFramerFrameJson(pclFramer, false); - NovatelFramerPayloadOnly(pclFramer, false); - NovatelFramerReportUnknownBytes(pclFramer, true); - - HeaderDecoder* pclHeaderDecoder = NovatelHeaderDecoderInit(pclJsonDb); - NovatelHeaderDecoderSetLoggerLevel(pclHeaderDecoder, spdlog::level::debug); - - MessageDecoder* pclMessageDecoder = NovatelMessageDecoderInit(pclJsonDb); - NovatelMessageDecoderSetLoggerLevel(pclMessageDecoder, spdlog::level::debug); - - Encoder* pclEncoder = NovatelEncoderInit(pclJsonDb); - NovatelEncoderSetLoggerLevel(pclEncoder, spdlog::level::debug); - - Filter* pclFilter = NovatelFilterInit(); - NovatelFilterSetLoggerLevel(pclFilter, spdlog::level::debug); - - // Set up buffers - unsigned char acFrameBuffer[MAX_ASCII_MESSAGE_LENGTH]; - unsigned char acEncodeBuffer[MAX_ASCII_MESSAGE_LENGTH]; - unsigned char* pucEncodedMessageBuffer = acEncodeBuffer; - - // Initialize structures and error codes - auto eFramerStatus = STATUS::UNKNOWN; - auto eDecoderStatus = STATUS::UNKNOWN; - auto eEncoderStatus = STATUS::UNKNOWN; - - IntermediateHeader stHeader; - std::vector stMessage; - - MetaDataStruct stMetaData; - MessageDataStruct stMessageData; - - // Initialize FS structures and buffers - StreamReadStatus stReadStatus; - ReadDataStructure stReadData; - unsigned char* acIfsReadBuffer[MAX_ASCII_MESSAGE_LENGTH]; - stReadData.cData = reinterpret_cast(acIfsReadBuffer); - stReadData.uiDataSize = sizeof(acIfsReadBuffer); - - // Set up file streams - InputFileStream clIfs(pathInFilename.string().c_str()); - OutputFileStream clConvertedLogsOfs(pathInFilename.string().append(".").append(sEncodeFormat).c_str()); - OutputFileStream clUnknownBytesOfs(pathInFilename.string().append(".").append(sEncodeFormat).append(".UNKNOWN").c_str()); - - tStart = std::chrono::high_resolution_clock::now(); - - while (!stReadStatus.bEOS) - { - stReadStatus = clIfs.ReadData(stReadData); - NovatelFramerWrite(pclFramer, reinterpret_cast(stReadData.cData), stReadStatus.uiCurrentStreamRead); - // Clearing INCOMPLETE status when internal buffer needs more bytes. - eFramerStatus = STATUS::INCOMPLETE_MORE_DATA; - - while (eFramerStatus != STATUS::BUFFER_EMPTY && eFramerStatus != STATUS::INCOMPLETE) - { - unsigned char* pucFrameBuffer = acFrameBuffer; - eFramerStatus = NovatelFramerRead(pclFramer, pucFrameBuffer, MAX_ASCII_MESSAGE_LENGTH, &stMetaData); - - if (eFramerStatus == STATUS::SUCCESS) - { - if (stMetaData.bResponse) - { - clUnknownBytesOfs.WriteData(reinterpret_cast(pucFrameBuffer), stMetaData.uiLength); - continue; - } - - pucFrameBuffer[stMetaData.uiLength] = '\0'; - pclLogger->info("Framed: {}", reinterpret_cast(pucFrameBuffer)); - - // Decode the header. Get metadata here and populate the Intermediate header. - eDecoderStatus = NovatelHeaderDecoderDecode(pclHeaderDecoder, pucFrameBuffer, &stHeader, &stMetaData); - - if (eDecoderStatus == STATUS::SUCCESS) - { - // Filter the log, pass over this log if we don't want it. - if (!NovatelFilterDoFiltering(pclFilter, &stMetaData)) { continue; } - - pucFrameBuffer += stMetaData.uiHeaderLength; - uint32_t uiBodyLength = stMetaData.uiLength - stMetaData.uiHeaderLength; - // Decode the Log, pass the metadata and populate the intermediate log. - eDecoderStatus = NovatelMessageDecoderDecode(pclMessageDecoder, pucFrameBuffer, &stMessage, &stMetaData); - - if (eDecoderStatus == STATUS::SUCCESS) - { - eEncoderStatus = NovatelEncoderEncode(pclEncoder, pucEncodedMessageBuffer, MAX_ASCII_MESSAGE_LENGTH, &stHeader, &stMessage, - &stMessageData, &stMetaData, eEncodeFormat); - - if (eEncoderStatus == STATUS::SUCCESS) - { - clConvertedLogsOfs.WriteData(reinterpret_cast(stMessageData.pucMessage), stMessageData.uiMessageLength); - stMessageData.pucMessage[stMessageData.uiMessageLength] = '\0'; - pclLogger->info("Encoded: ({}) {}\n", stMessageData.uiMessageLength, reinterpret_cast(stMessageData.pucMessage)); - } - else - { - clUnknownBytesOfs.WriteData(reinterpret_cast(pucFrameBuffer), uiBodyLength); - pclLogger->warn("Encoder returned with status code {}", static_cast(eEncoderStatus)); - } - } - else - { - clUnknownBytesOfs.WriteData(reinterpret_cast(pucFrameBuffer), uiBodyLength); - pclLogger->warn("MessageDecoder returned with status code {}", static_cast(eDecoderStatus)); - } - } - else - { - clUnknownBytesOfs.WriteData(reinterpret_cast(pucFrameBuffer), stMetaData.uiLength); - pclLogger->warn("HeaderDecoder returned with status code {}", static_cast(eDecoderStatus)); - } - } - else if (eFramerStatus == STATUS::UNKNOWN) { clUnknownBytesOfs.WriteData(reinterpret_cast(pucFrameBuffer), stMetaData.uiLength); } - else { pclLogger->warn("Framer returned with status code {}", static_cast(eFramerStatus)); } - } - } - - // Clean up - Logger::Shutdown(); - NovatelFramerDelete(pclFramer); - NovatelHeaderDecoderDelete(pclHeaderDecoder); - NovatelMessageDecoderDelete(pclMessageDecoder); - NovatelEncoderDelete(pclEncoder); - NovatelFilterDelete(pclFilter); - return 0; -} diff --git a/examples/novatel/dynamic_file_parser/CMakeLists.txt b/examples/novatel/dynamic_file_parser/CMakeLists.txt deleted file mode 100644 index f834e1ecf..000000000 --- a/examples/novatel/dynamic_file_parser/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(TARGET_NAME "dynamic_file_parser") -add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} common decoders_dynamic_library novatel stream_interface) -set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/dynamic_file_parser/dynamic_file_parser.cpp b/examples/novatel/dynamic_file_parser/dynamic_file_parser.cpp deleted file mode 100644 index f8966c307..000000000 --- a/examples/novatel/dynamic_file_parser/dynamic_file_parser.cpp +++ /dev/null @@ -1,168 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file dynamic_file_parser.cpp -// =============================================================================== - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace fs = std::filesystem; - -using namespace novatel::edie; -using namespace novatel::edie::oem; - -int main(int argc, char* argv[]) -{ - // This example uses the default logger config, but you can also pass a config file to InitLogger() - // Example config file: logger\example_logger_config.toml - Logger::InitLogger(); - std::shared_ptr pclLogger = Logger::RegisterLogger("dynamic_file_parser"); - pclLogger->set_level(spdlog::level::debug); - Logger::AddConsoleLogging(pclLogger); - Logger::AddRotatingFileLogger(pclLogger); - - // Get command line arguments - pclLogger->info("Decoder library information:\n{}", caPrettyPrint); - - std::string sEncodeFormat = "ASCII"; - if (argc == 2 && strcmp(argv[1], "-V") == 0) { return 0; } - if (argc < 3) - { - pclLogger->error("ERROR: Need to specify a JSON message definitions DB, an input file and an output format."); - pclLogger->error("Example: converter "); - return 1; - } - if (argc == 4) { sEncodeFormat = argv[3]; } - - // Check command line arguments - const fs::path pathJsonDb = argv[1]; - if (!fs::exists(pathJsonDb)) - { - pclLogger->error("File \"{}\" does not exist", pathJsonDb.string()); - return 1; - } - const fs::path pathInFilename = argv[2]; - if (!fs::exists(pathInFilename)) - { - pclLogger->error("File \"{}\" does not exist", pathInFilename.string()); - return 1; - } - - ENCODE_FORMAT eEncodeFormat = StringToEncodeFormat(sEncodeFormat); - if (eEncodeFormat == ENCODE_FORMAT::UNSPECIFIED) - { - pclLogger->error("Unspecified output format.\n\tASCII\n\tBINARY\n\tFLATTENED_BINARY"); - return 1; - } - - pclLogger->info("Loading Database..."); - auto tStart = std::chrono::high_resolution_clock::now(); - JsonReader* pclJsonDb = CommonJsonReaderInit(); - CommonJsonReaderLoadFile(pclJsonDb, pathJsonDb.string().c_str()); - pclLogger->info("Done in {}ms", - std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - tStart).count()); - - // Setup timers - auto tLoop = std::chrono::high_resolution_clock::now(); - uint32_t uiCounter = 0; - - // Set up the EDIE components - FileParser* pclFileParser = NovatelFileParserInit(pclJsonDb); - pclFileParser->SetEncodeFormat(eEncodeFormat); - - Filter* pclFilter = NovatelFilterInit(); - NovatelFilterSetLoggerLevel(pclFilter, spdlog::level::debug); - - // Initialize structures and error codes - auto eStatus = STATUS::UNKNOWN; - - MetaDataStruct stMetaData; - MessageDataStruct stMessageData; - - NovatelFileParserSetFilter(pclFileParser, pclFilter); - - // Initialize FS structures and buffers - ReadDataStructure stReadData; - unsigned char acIfsReadBuffer[MAX_ASCII_MESSAGE_LENGTH]; - stReadData.cData = reinterpret_cast(acIfsReadBuffer); - stReadData.uiDataSize = sizeof(acIfsReadBuffer); - - // Set up file streams - InputFileStream clIfs(pathInFilename.string().c_str()); - OutputFileStream clConvertedLogsOfs(pathInFilename.string().append(".").append(sEncodeFormat).c_str()); - OutputFileStream clUnknownBytesOfs(pathInFilename.string().append(".").append(sEncodeFormat).append(".UNKNOWN").c_str()); - - if (!NovatelFileParserSetStream(pclFileParser, &clIfs)) - { - pclLogger->error("Failed to set stream!"); - exit(1); - } - - uint32_t uiCompleteMessages = 0; - tStart = std::chrono::high_resolution_clock::now(); - tLoop = std::chrono::high_resolution_clock::now(); - - while (eStatus != STATUS::STREAM_EMPTY) - { - try - { - eStatus = NovatelFileParserRead(pclFileParser, &stMessageData, &stMetaData); - if (eStatus == STATUS::SUCCESS) - { - clConvertedLogsOfs.WriteData(reinterpret_cast(stMessageData.pucMessage), stMessageData.uiMessageLength); - stMessageData.pucMessage[stMessageData.uiMessageLength] = '\0'; - pclLogger->info("Encoded: ({}) {}", stMessageData.uiMessageLength, reinterpret_cast(stMessageData.pucMessage)); - uiCompleteMessages++; - } - } - catch (std::exception& e) - { - pclLogger->error("Exception thrown: {}, {} \n{}\n", __DATE__, __TIME__, e.what()); - exit(-1); - } - - if (std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - tLoop).count() > 1000) - { - uiCounter++; - pclLogger->info("{}% {} logs/s", NovatelFileParserGetPercentRead(pclFileParser), uiCompleteMessages / uiCounter); - tLoop = std::chrono::high_resolution_clock::now(); - } - } - - pclLogger->info("Converted {} logs in {}ms from {}", uiCompleteMessages, - std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - tStart).count(), - pathInFilename.string().c_str()); - Logger::Shutdown(); - NovatelFileParserDelete(pclFileParser); - return 0; -} diff --git a/examples/novatel/dynamic_parser/CMakeLists.txt b/examples/novatel/dynamic_parser/CMakeLists.txt deleted file mode 100644 index d97d100c3..000000000 --- a/examples/novatel/dynamic_parser/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(TARGET_NAME "dynamic_parser") -add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} common decoders_dynamic_library novatel stream_interface) -set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/dynamic_parser/dynamic_parser.cpp b/examples/novatel/dynamic_parser/dynamic_parser.cpp deleted file mode 100644 index f31a3c6b5..000000000 --- a/examples/novatel/dynamic_parser/dynamic_parser.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file dynamic_parser.cpp -// =============================================================================== - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace fs = std::filesystem; - -using namespace novatel::edie; -using namespace novatel::edie::oem; - -int main(int argc, char* argv[]) -{ - // This example uses the default logger config, but you can also pass a config file to InitLogger() - // Example config file: logger\example_logger_config.toml - Logger::InitLogger(); - std::shared_ptr pclLogger = Logger::RegisterLogger("dynamic_parser"); - pclLogger->set_level(spdlog::level::debug); - Logger::AddConsoleLogging(pclLogger); - Logger::AddRotatingFileLogger(pclLogger); - - // Get command line arguments - pclLogger->info("Decoder library information:\n{}", caPrettyPrint); - - std::string sEncodeFormat = "ASCII"; - if (argc == 2 && strcmp(argv[1], "-V") == 0) { return 0; } - if (argc < 3) - { - pclLogger->error("ERROR: Need to specify a JSON message definitions DB, an input file and an output format."); - pclLogger->error("Example: converter "); - return 1; - } - if (argc == 4) { sEncodeFormat = argv[3]; } - - // Check command line arguments - const fs::path pathJsonDb = argv[1]; - if (!fs::exists(pathJsonDb)) - { - pclLogger->error("File \"{}\" does not exist", pathJsonDb.string()); - return 1; - } - const fs::path pathInFilename = argv[2]; - if (!fs::exists(pathInFilename)) - { - pclLogger->error("File \"{}\" does not exist", pathInFilename.string()); - return 1; - } - - ENCODE_FORMAT eEncodeFormat = StringToEncodeFormat(sEncodeFormat); - if (eEncodeFormat == ENCODE_FORMAT::UNSPECIFIED) - { - pclLogger->error("Unspecified output format.\n\tASCII\n\tBINARY\n\tFLATTENED_BINARY"); - return 1; - } - - pclLogger->info("Loading Database..."); - auto tStart = std::chrono::high_resolution_clock::now(); - JsonReader* pclJsonDb = CommonJsonReaderInit(); - CommonJsonReaderLoadFile(pclJsonDb, pathJsonDb.string().c_str()); - pclLogger->info("Done in {}ms", - std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - tStart).count()); - - // Set up timers - auto tLoop = std::chrono::high_resolution_clock::now(); - uint32_t uiCounter = 0; - - // Set up the EDIE components - Parser* pclParser = NovatelParserInit(pclJsonDb); - pclParser->SetEncodeFormat(eEncodeFormat); - - Filter* pclFilter = NovatelFilterInit(); - NovatelFilterSetLoggerLevel(pclFilter, spdlog::level::debug); - - // Initialize structures - MetaDataStruct stMetaData; - MessageDataStruct stMessageData; - - NovatelParserSetFilter(pclParser, pclFilter); - - // Initialize FS structures and buffers - StreamReadStatus stReadStatus; - ReadDataStructure stReadData; - unsigned char acIfsReadBuffer[MAX_ASCII_MESSAGE_LENGTH]; - stReadData.cData = reinterpret_cast(acIfsReadBuffer); - stReadData.uiDataSize = sizeof(acIfsReadBuffer); - - // Set up file streams - InputFileStream clIfs(pathInFilename.string().c_str()); - OutputFileStream clConvertedLogsOfs(pathInFilename.string().append(".").append(sEncodeFormat).c_str()); - OutputFileStream clUnknownBytesOfs(pathInFilename.string().append(".").append(sEncodeFormat).append(".UNKNOWN").c_str()); - - uint32_t uiCompleteMessages = 0; - - tStart = std::chrono::high_resolution_clock::now(); - tLoop = std::chrono::high_resolution_clock::now(); - - while (!stReadStatus.bEOS) - { - stReadData.cData = reinterpret_cast(acIfsReadBuffer); - stReadStatus = clIfs.ReadData(stReadData); - NovatelParserWrite(pclParser, reinterpret_cast(stReadData.cData), stReadStatus.uiCurrentStreamRead); - - STATUS eStatus = NovatelParserRead(pclParser, &stMessageData, &stMetaData); - - while (eStatus != STATUS::BUFFER_EMPTY) - { - if (eStatus == STATUS::SUCCESS) - { - clConvertedLogsOfs.WriteData(reinterpret_cast(stMessageData.pucMessage), stMessageData.uiMessageLength); - stMessageData.pucMessage[stMessageData.uiMessageLength] = '\0'; - pclLogger->info("Encoded: ({}) {}", stMessageData.uiMessageLength, reinterpret_cast(stMessageData.pucMessage)); - uiCompleteMessages++; - } - - if (std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - tLoop).count() > 1000) - { - uiCounter++; - pclLogger->info("{} logs/s", uiCompleteMessages / uiCounter); - tLoop = std::chrono::high_resolution_clock::now(); - } - - eStatus = NovatelParserRead(pclParser, &stMessageData, &stMetaData); - } - } - - pclLogger->info("Converted {} logs in {}ms from {}", uiCompleteMessages, - std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - tStart).count(), - pathInFilename.string().c_str()); - Logger::Shutdown(); - NovatelParserDelete(pclParser); - return 0; -} diff --git a/src/decoders/CMakeLists.txt b/src/decoders/CMakeLists.txt index 482c66d1b..cedd748b0 100644 --- a/src/decoders/CMakeLists.txt +++ b/src/decoders/CMakeLists.txt @@ -1,3 +1,2 @@ add_subdirectory(common) -add_subdirectory(dynamic_library) add_subdirectory(novatel) diff --git a/src/decoders/dynamic_library/CMakeLists.txt b/src/decoders/dynamic_library/CMakeLists.txt deleted file mode 100644 index b7a28551c..000000000 --- a/src/decoders/dynamic_library/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(TARGET_NAME "decoders_dynamic_library") -file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -add_library(${TARGET_NAME} SHARED ${SOURCES}) -find_package(Threads REQUIRED) -target_link_libraries(${TARGET_NAME} PRIVATE Threads::Threads common novatel stream_interface) -add_custom_command(TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/api/ ${CMAKE_SOURCE_DIR}/bin/api/decoders/${TARGET_NAME}/api/) -set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "decoders") -target_include_directories(${TARGET_NAME} PUBLIC api) - -if(WIN32) - add_compile_definitions(DECODERS_EXPORTS) -else() - add_compile_definitions(DECODERS_STATIC_DEFINE) -endif() diff --git a/src/decoders/dynamic_library/api/common_json_reader.hpp b/src/decoders/dynamic_library/api/common_json_reader.hpp deleted file mode 100644 index 1716330af..000000000 --- a/src/decoders/dynamic_library/api/common_json_reader.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file common_json_reader.hpp -// =============================================================================== - -#ifndef DYNAMIC_LIBRARY_COMMON_JSON_READER_HPP -#define DYNAMIC_LIBRARY_COMMON_JSON_READER_HPP - -#include "decoders/common/api/json_reader.hpp" -#include "decoders_export.h" - -extern "C" -{ - DECODERS_EXPORT novatel::edie::JsonReader* CommonJsonReaderInit(); - DECODERS_EXPORT bool CommonJsonReaderLoadFile(novatel::edie::JsonReader* pclJsonDb_, const char* pcJsonDbFilepath_); - DECODERS_EXPORT bool CommonJsonReaderParseJson(novatel::edie::JsonReader* pclJsonDb_, const char* pcJsonData_); - DECODERS_EXPORT bool CommonJsonReaderDelete(novatel::edie::JsonReader* pclJsonDb_); -} - -#endif // DYNAMIC_LIBRARY_COMMON_JSON_READER_HPP diff --git a/src/decoders/dynamic_library/api/common_logger.hpp b/src/decoders/dynamic_library/api/common_logger.hpp deleted file mode 100644 index de73c10a5..000000000 --- a/src/decoders/dynamic_library/api/common_logger.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file common_logger.hpp -// =============================================================================== - -#ifndef DYNAMIC_LIBRARY_LOGGER_HPP -#define DYNAMIC_LIBRARY_LOGGER_HPP - -#include - -#include "decoders/common/api/logger.hpp" -#include "decoders_export.h" - -extern "C" -{ - DECODERS_EXPORT void CommonLoggerSetup(); - DECODERS_EXPORT void CommonLoggerSetupFromFile(char* pcLoggerConfigPath_); - DECODERS_EXPORT bool CommonLoggerSetLoggerLevel(int32_t iLogLevel_); - DECODERS_EXPORT void CommonLoggerShutdownLogger(); - DECODERS_EXPORT bool CommonLoggerLog(int32_t iLogLevel_, char* pucMessage_); -} - -#endif // DYNAMIC_LIBRARY_LOGGER_HPP diff --git a/src/decoders/dynamic_library/api/decoders_export.h b/src/decoders/dynamic_library/api/decoders_export.h deleted file mode 100644 index b5996da78..000000000 --- a/src/decoders/dynamic_library/api/decoders_export.h +++ /dev/null @@ -1,85 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file decoders_export.h -// =============================================================================== - -#ifndef DECODERS_EXPORT_H -#define DECODERS_EXPORT_H - -#if defined(_WIN32) || defined(_WIN64) -// For Windows platforms -#ifdef DECODERS_STATIC_DEFINE -#define DECODERS_EXPORT -#define DECODERS_NO_EXPORT -#else -#ifndef DECODERS_EXPORT -#ifdef DECODERS_EXPORTS -// We are building this library. -#define DECODERS_EXPORT __declspec(dllexport) -#else -// We are using this library. -#define DECODERS_EXPORT __declspec(dllimport) -#endif -#endif - -#ifndef DECODERS_NO_EXPORT -#define DECODERS_NO_EXPORT -#endif -#endif - -#ifndef DECODERS_DEPRECATED -#define DECODERS_DEPRECATED __declspec(deprecated) -#endif - -#ifndef DECODERS_DEPRECATED_EXPORT -#define DECODERS_DEPRECATED_EXPORT DECODERS_EXPORT DECODERS_DEPRECATED -#endif - -#ifndef DECODERS_DEPRECATED_NO_EXPORT -#define DECODERS_DEPRECATED_NO_EXPORT DECODERS_NO_EXPORT DECODERS_DEPRECATED -#endif -#else -// For Linux platforms -#define DECODERS_EXPORT -#define DECODERS_NO_EXPORT -#ifndef DECODERS_DEPRECATED -#define DECODERS_DEPRECATED __attribute__((deprecated)) -#endif - -#ifndef DECODERS_DEPRECATED_EXPORT -#define DECODERS_DEPRECATED_EXPORT DECODERS_EXPORT DECODERS_DEPRECATED -#endif - -#ifndef DECODERS_DEPRECATED_NO_EXPORT -#define DECODERS_DEPRECATED_NO_EXPORT DECODERS_NO_EXPORT DECODERS_DEPRECATED -#endif -#endif - -#if 0 // DEFINE_NO_DEPRECATED -#ifndef DECODERS_NO_DEPRECATED -#define DECODERS_NO_DEPRECATED -#endif -#endif - -#endif // DECODERS_EXPORT_H diff --git a/src/decoders/dynamic_library/api/novatel_commander.hpp b/src/decoders/dynamic_library/api/novatel_commander.hpp deleted file mode 100644 index b8629b8eb..000000000 --- a/src/decoders/dynamic_library/api/novatel_commander.hpp +++ /dev/null @@ -1,53 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_commander.hpp -// =============================================================================== - -#ifndef DYNAMIC_LIBRARY_NOVATEL_COMMANDER_HPP -#define DYNAMIC_LIBRARY_NOVATEL_COMMANDER_HPP - -#include "decoders/common/api/json_reader.hpp" -#include "decoders/novatel/api/commander.hpp" -#include "decoders/novatel/api/common.hpp" -#include "decoders_export.h" - -extern "C" -{ - // Logger - DECODERS_EXPORT bool NovatelCommanderSetLoggerLevel(novatel::edie::oem::Commander* pclCommander_, uint32_t iLogLevel_); - - // Construct/Destruct - DECODERS_EXPORT novatel::edie::oem::Commander* NovatelCommanderInit(novatel::edie::JsonReader* pclJsonDb_); - DECODERS_EXPORT void NovatelCommanderDelete(novatel::edie::oem::Commander* pclCommander_); - - // Config - DECODERS_EXPORT void NovatelCommanderLoadJson(novatel::edie::oem::Commander* pclCommander_, novatel::edie::JsonReader* pclJsonDb_); - - // R/W - DECODERS_EXPORT novatel::edie::STATUS NovatelCommanderEncode(novatel::edie::oem::Commander* pclCommander_, char* pcAbbrevAsciiCommand_, - uint32_t uicAbbrevAsciiCommandLength_, char* pcEncodeBuffer_, - uint32_t* puiEncodeBufferSize_, novatel::edie::ENCODE_FORMAT eEncodeFormat_); -} - -#endif // DYNAMIC_LIBRARY_NOVATEL_COMMANDER_HPP diff --git a/src/decoders/dynamic_library/api/novatel_encoder.hpp b/src/decoders/dynamic_library/api/novatel_encoder.hpp deleted file mode 100644 index 06de0fc32..000000000 --- a/src/decoders/dynamic_library/api/novatel_encoder.hpp +++ /dev/null @@ -1,56 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_encoder.hpp -// =============================================================================== - -#ifndef DYNAMIC_LIBRARY_NOVATEL_ENCODER_HPP -#define DYNAMIC_LIBRARY_NOVATEL_ENCODER_HPP - -#include "decoders/common/api/json_reader.hpp" -#include "decoders/novatel/api/common.hpp" -#include "decoders/novatel/api/encoder.hpp" -#include "decoders_export.h" - -extern "C" -{ - // Logger - DECODERS_EXPORT bool NovatelEncoderSetLoggerLevel(novatel::edie::oem::Encoder* pclEncoder_, uint32_t iLogLevel_); - - // Construct/Destruct - DECODERS_EXPORT novatel::edie::oem::Encoder* NovatelEncoderInit(novatel::edie::JsonReader* pclJsonDb_); - DECODERS_EXPORT void NovatelEncoderDelete(novatel::edie::oem::Encoder* pclEncoder_); - - // Config - DECODERS_EXPORT void NovatelEncoderLoadJson(novatel::edie::oem::Encoder* pclEncoder_, novatel::edie::JsonReader* pclJsonDb_); - - // R/W - DECODERS_EXPORT novatel::edie::STATUS NovatelEncoderEncode(novatel::edie::oem::Encoder* pclEncoder_, unsigned char* pucEncodeBuffer_, - uint32_t uiEncodeBufferSize_, novatel::edie::oem::IntermediateHeader* pstInterHeader_, - std::vector* pstInterMessage_, - novatel::edie::MessageDataStruct* pstMessageData_, - novatel::edie::oem::MetaDataStruct* pstMetaData_, - novatel::edie::ENCODE_FORMAT eEncodeFormat_); -} - -#endif // DYNAMIC_LIBRARY_NOVATEL_ENCODER_HPP diff --git a/src/decoders/dynamic_library/api/novatel_file_parser.hpp b/src/decoders/dynamic_library/api/novatel_file_parser.hpp deleted file mode 100644 index 09f101862..000000000 --- a/src/decoders/dynamic_library/api/novatel_file_parser.hpp +++ /dev/null @@ -1,75 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_file_parser.hpp -// =============================================================================== - -#ifndef DYNAMIC_LIBRARY_NOVATEL_FILE_PARSER_HPP -#define DYNAMIC_LIBRARY_NOVATEL_FILE_PARSER_HPP - -#include "decoders/novatel/api/common.hpp" -#include "decoders/novatel/api/file_parser.hpp" -#include "decoders/novatel/api/filter.hpp" -#include "decoders_export.h" -#include "hw_interface/stream_interface/api/inputfilestream.hpp" - -extern "C" -{ - // Construct/Destruct - DECODERS_EXPORT novatel::edie::oem::FileParser* NovatelFileParserInit(novatel::edie::JsonReader* pclJsonDb_); - DECODERS_EXPORT void NovatelFileParserDelete(novatel::edie::oem::FileParser* pclFileParser_); - - // Config - DECODERS_EXPORT void NovatelFileParserLoadJsonDb(novatel::edie::oem::FileParser* pclFileParser_, novatel::edie::JsonReader* pclJsonDb_); - - DECODERS_EXPORT void NovatelFileParserSetIgnoreAbbrevAsciiResponses(novatel::edie::oem::FileParser* pclFileParser_, - bool bIgnoreAbbrevAsciiResponsesCmp_); - DECODERS_EXPORT bool NovatelFileParserGetIgnoreAbbrevAsciiResponses(novatel::edie::oem::FileParser* pclFileParser_); - DECODERS_EXPORT void NovatelFileParserSetDecompressRangeCmp(novatel::edie::oem::FileParser* pclFileParser_, bool bDecompressRangeCmp_); - DECODERS_EXPORT bool NovatelFileParserGetDecompressRangeCmp(novatel::edie::oem::FileParser* pclFileParser_); - DECODERS_EXPORT void NovatelFileParserSetReturnUnknownBytes(novatel::edie::oem::FileParser* pclFileParser_, bool bReturnUnknownBytes_); - DECODERS_EXPORT bool NovatelFileParserGetReturnUnknownBytes(novatel::edie::oem::FileParser* pclFileParser_); - DECODERS_EXPORT void NovatelFileParserSetEncodeFormat(novatel::edie::oem::FileParser* pclFileParser_, - novatel::edie::ENCODE_FORMAT eEncodeFormat_); - DECODERS_EXPORT novatel::edie::ENCODE_FORMAT NovatelFileParserGetEncodeFormat(novatel::edie::oem::FileParser* pclFileParser_); - - DECODERS_EXPORT novatel::edie::oem::Filter* NovatelFileParserGetFilter(novatel::edie::oem::FileParser* pclFileParser_); - DECODERS_EXPORT void NovatelFileParserSetFilter(novatel::edie::oem::FileParser* pclFileParser_, novatel::edie::oem::Filter* pclFilter_); - - DECODERS_EXPORT unsigned char* NovatelFileParserGetBuffer(novatel::edie::oem::FileParser* pclFileParser_); - - // Stream, R/W - DECODERS_EXPORT bool NovatelFileParserSetStream(novatel::edie::oem::FileParser* pclFileParser_, InputFileStream* pclIfs_); - DECODERS_EXPORT uint32_t NovatelFileParserGetPercentRead(novatel::edie::oem::FileParser* pclFileParser_); - - // R/W - DECODERS_EXPORT novatel::edie::STATUS NovatelFileParserRead(novatel::edie::oem::FileParser* pclFileParser_, - novatel::edie::MessageDataStruct* pstMessageData_, - novatel::edie::oem::MetaDataStruct* pstMetaData_); - DECODERS_EXPORT bool NovatelFileParserReset(novatel::edie::oem::FileParser* pclFileParser_); - - DECODERS_EXPORT uint32_t NovatelFileParserFlush(novatel::edie::oem::FileParser* pclFileParser_, unsigned char* pucBuffer_, - uint32_t uiBufferSize_); -} - -#endif // DYNAMIC_LIBRARY_NOVATEL_FILE_PARSER_HPP diff --git a/src/decoders/dynamic_library/api/novatel_filter.hpp b/src/decoders/dynamic_library/api/novatel_filter.hpp deleted file mode 100644 index ed4280087..000000000 --- a/src/decoders/dynamic_library/api/novatel_filter.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_filter.hpp -// =============================================================================== - -#ifndef DYNAMIC_LIBRARY_NOVATEL_FILTER_HPP -#define DYNAMIC_LIBRARY_NOVATEL_FILTER_HPP - -#include "decoders/novatel/api/filter.hpp" -#include "decoders_export.h" - -extern "C" -{ - // Logger - DECODERS_EXPORT bool NovatelFilterSetLoggerLevel(novatel::edie::oem::Filter* pclFilter_, uint32_t uiLogLevel_); - - // Construct/Destruct - DECODERS_EXPORT novatel::edie::oem::Filter* NovatelFilterInit(); - DECODERS_EXPORT void NovatelFilterDelete(novatel::edie::oem::Filter* pclFilter_); - - // Config - DECODERS_EXPORT void NovatelFilterSetIncludeLowerTime(novatel::edie::oem::Filter* pclFilter_, uint32_t uiLowerTimeWeek_, double dLowerTimeSec_); - DECODERS_EXPORT void NovatelFilterSetIncludeUpperTime(novatel::edie::oem::Filter* pclFilter_, uint32_t uiUpperTime_, double dUpperTimeSec_); - DECODERS_EXPORT void NovatelFilterInvertTimeFilter(novatel::edie::oem::Filter* pclFilter_, bool bInvert_); - - DECODERS_EXPORT void NovatelFilterSetIncludeDecimation(novatel::edie::oem::Filter* pclFilter_, double dPeriodSec_); - DECODERS_EXPORT void NovatelFilterInvertDecimationFilter(novatel::edie::oem::Filter* pclFilter_, bool bInvert_); - - DECODERS_EXPORT void NovatelFilterIncludeTimeStatus(novatel::edie::oem::Filter* pclFilter_, novatel::edie::TIME_STATUS eTimeStatus_); - DECODERS_EXPORT void NovatelFilterInvertTimeStatusFilter(novatel::edie::oem::Filter* pclFilter_, bool bInvert_); - - DECODERS_EXPORT void NovatelFilterIncludeMessageId(novatel::edie::oem::Filter* pclFilter_, uint32_t uiId_, - novatel::edie::HEADER_FORMAT eFormat_ = novatel::edie::HEADER_FORMAT::ALL, - novatel::edie::MEASUREMENT_SOURCE eSource_ = novatel::edie::MEASUREMENT_SOURCE::PRIMARY); - DECODERS_EXPORT void NovatelFilterInvertMessageIdFilter(novatel::edie::oem::Filter* pclFilter_, bool bInvert_); - - DECODERS_EXPORT void NovatelFilterIncludeMessageName(novatel::edie::oem::Filter* pclFilter_, uint8_t* pucMessageName_, - novatel::edie::HEADER_FORMAT eFormat_ = novatel::edie::HEADER_FORMAT::ALL, - novatel::edie::MEASUREMENT_SOURCE eSource_ = novatel::edie::MEASUREMENT_SOURCE::PRIMARY); - DECODERS_EXPORT void NovatelFilterInvertMessageNameFilter(novatel::edie::oem::Filter* pclFilter_, bool bInvert_); - - DECODERS_EXPORT void NovatelFilterIncludeNmeaMessages(novatel::edie::oem::Filter* pclFilter_, bool bInvert_); - - // novatel::edie::oem::Filter - DECODERS_EXPORT bool NovatelFilterDoFiltering(novatel::edie::oem::Filter* pclFilter_, novatel::edie::oem::MetaDataStruct* pstMetaData_); - DECODERS_EXPORT void NovatelFilterClearFilters(novatel::edie::oem::Filter* pclFilter_); -} - -#endif // DYNAMIC_LIBRARY_NOVATEL_FILTER_HPP diff --git a/src/decoders/dynamic_library/api/novatel_framer.hpp b/src/decoders/dynamic_library/api/novatel_framer.hpp deleted file mode 100644 index 171eb03d8..000000000 --- a/src/decoders/dynamic_library/api/novatel_framer.hpp +++ /dev/null @@ -1,57 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_framer.hpp -// =============================================================================== - -#ifndef DYNAMIC_LIBRARY_NOVATEL_FRAMER_HPP -#define DYNAMIC_LIBRARY_NOVATEL_FRAMER_HPP - -#include "decoders/novatel/api/common.hpp" -#include "decoders/novatel/api/filter.hpp" -#include "decoders/novatel/api/framer.hpp" -#include "decoders_export.h" - -extern "C" -{ - // Logger - DECODERS_EXPORT bool NovatelFramerSetLoggerLevel(novatel::edie::oem::Framer* pclFramer_, uint32_t uiLogLevel_); - - // Construct/Destruct - DECODERS_EXPORT novatel::edie::oem::Framer* NovatelFramerInit(); - DECODERS_EXPORT void NovatelFramerDelete(novatel::edie::oem::Framer* pclFramer_); - - // Config - DECODERS_EXPORT void NovatelFramerFrameJson(novatel::edie::oem::Framer* pclFramer_, bool bFrameJson_); - DECODERS_EXPORT void NovatelFramerPayloadOnly(novatel::edie::oem::Framer* pclFramer_, bool bPayloadOnly_); - DECODERS_EXPORT void NovatelFramerReportUnknownBytes(novatel::edie::oem::Framer* pclFramer_, bool bReportUnknownBytes_); - - // R/W - DECODERS_EXPORT uint32_t NovatelFramerGetAvailableBytes(novatel::edie::oem::Framer* pclFramer_); - DECODERS_EXPORT uint32_t NovatelFramerWrite(novatel::edie::oem::Framer* pclFramer_, unsigned char* pucBytes_, uint32_t uiByteCount_); - DECODERS_EXPORT novatel::edie::STATUS NovatelFramerRead(novatel::edie::oem::Framer* pclFramer_, unsigned char* pucBuffer_, uint32_t uiBufferSize_, - novatel::edie::oem::MetaDataStruct* pstMetaData_); - DECODERS_EXPORT uint32_t NovatelFramerFlush(novatel::edie::oem::Framer* pclFramer_, unsigned char* pucBuffer_, uint32_t uiBufferSize_); -} - -#endif // DYNAMIC_LIBRARY_NOVATEL_FRAMER_HPP diff --git a/src/decoders/dynamic_library/api/novatel_header_decoder.hpp b/src/decoders/dynamic_library/api/novatel_header_decoder.hpp deleted file mode 100644 index d7677e027..000000000 --- a/src/decoders/dynamic_library/api/novatel_header_decoder.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_header_decoder.hpp -// =============================================================================== - -#ifndef DYNAMIC_LIBRARY_NOVATEL_HEADER_DECODER_HPP -#define DYNAMIC_LIBRARY_NOVATEL_HEADER_DECODER_HPP - -#include "decoders/novatel/api/common.hpp" -#include "decoders/novatel/api/header_decoder.hpp" -#include "decoders_export.h" - -extern "C" -{ - // Logger - DECODERS_EXPORT bool NovatelHeaderDecoderSetLoggerLevel(novatel::edie::oem::HeaderDecoder* pclHeaderDecoder_, uint32_t iLogLevel_); - - // Construct/Destruct - DECODERS_EXPORT novatel::edie::oem::HeaderDecoder* NovatelHeaderDecoderInit(novatel::edie::JsonReader* pclJsonDb_); - DECODERS_EXPORT void NovatelHeaderDecoderDelete(novatel::edie::oem::HeaderDecoder* pclHeaderDecoder_); - - // Config - DECODERS_EXPORT void NovatelHeaderDecoderLoadJson(novatel::edie::oem::HeaderDecoder* pclHeaderDecoder_, novatel::edie::JsonReader* pclJsonDb_); - - // R/W - DECODERS_EXPORT novatel::edie::STATUS NovatelHeaderDecoderDecode(novatel::edie::oem::HeaderDecoder* pclHeaderDecoder_, unsigned char* pucLogBuf_, - novatel::edie::oem::IntermediateHeader* pstInterHeader_, - novatel::edie::oem::MetaDataStruct* pstMetaData_); -} - -#endif // DYNAMIC_LIBRARY_NOVATEL_HEADER_DECODER_HPP diff --git a/src/decoders/dynamic_library/api/novatel_message_decoder.hpp b/src/decoders/dynamic_library/api/novatel_message_decoder.hpp deleted file mode 100644 index cb39ae5cf..000000000 --- a/src/decoders/dynamic_library/api/novatel_message_decoder.hpp +++ /dev/null @@ -1,59 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_message_decoder.hpp -// =============================================================================== - -#ifndef DYNAMIC_LIBRARY_NOVATEL_MESSAGE_DECODER_HPP -#define DYNAMIC_LIBRARY_NOVATEL_MESSAGE_DECODER_HPP - -#include - -#include "decoders/novatel/api/common.hpp" -#include "decoders/novatel/api/message_decoder.hpp" -#include "decoders_export.h" - -extern "C" -{ - // Logger - DECODERS_EXPORT bool NovatelMessageDecoderSetLoggerLevel(novatel::edie::oem::MessageDecoder* pclMessageDecoder_, uint32_t iLogLevel_); - - // Construct/Destruct - DECODERS_EXPORT novatel::edie::oem::MessageDecoder* NovatelMessageDecoderInit(novatel::edie::JsonReader* pclJsonDb_); - DECODERS_EXPORT void NovatelMessageDecoderDelete(novatel::edie::oem::MessageDecoder* pclMessageDecoder_); - - // Config - DECODERS_EXPORT void NovatelMessageDecoderLoadJson(novatel::edie::oem::MessageDecoder* pclMessageDecoder_, novatel::edie::JsonReader* pclJsonDb_); - - // R/W - DECODERS_EXPORT novatel::edie::STATUS NovatelMessageDecoderDecode(novatel::edie::oem::MessageDecoder* pclMessageDecoder_, - unsigned char* pucLogBuf_, - std::vector* pstInterMessage_, - novatel::edie::oem::MetaDataStruct* pstMetaData_); - - // Intermediate Log handling. - DECODERS_EXPORT std::vector* NovatelIntermediateMessageInit(); - DECODERS_EXPORT void NovatelIntermediateMessageDelete(std::vector* pstInterMessage_); -} - -#endif // DYNAMIC_LIBRARY_NOVATEL_MESSAGE_DECODER_HPP diff --git a/src/decoders/dynamic_library/api/novatel_parser.hpp b/src/decoders/dynamic_library/api/novatel_parser.hpp deleted file mode 100644 index 1c933f0fc..000000000 --- a/src/decoders/dynamic_library/api/novatel_parser.hpp +++ /dev/null @@ -1,65 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_parser.hpp -// =============================================================================== - -#ifndef DYNAMIC_LIBRARY_NOVATEL_PARSER_HPP -#define DYNAMIC_LIBRARY_NOVATEL_PARSER_HPP - -#include "decoders/novatel/api/common.hpp" -#include "decoders/novatel/api/parser.hpp" -#include "decoders_export.h" - -extern "C" -{ - // Construct/Destruct - DECODERS_EXPORT novatel::edie::oem::Parser* NovatelParserInit(novatel::edie::JsonReader* pclJsonDb_); - DECODERS_EXPORT void NovatelParserDelete(novatel::edie::oem::Parser* pclParser_); - - // Config - DECODERS_EXPORT void NovatelParserLoadJsonDb(novatel::edie::oem::Parser* pclParser_, novatel::edie::JsonReader* pclJsonDb_); - - DECODERS_EXPORT void NovatelParserSetIgnoreAbbrevAsciiResponses(novatel::edie::oem::Parser* pclParser_, bool bIgnoreAbbrevAsciiResponsesCmp_); - DECODERS_EXPORT bool NovatelParserGetIgnoreAbbrevAsciiResponses(novatel::edie::oem::Parser* pclParser_); - DECODERS_EXPORT void NovatelParserSetDecompressRangeCmp(novatel::edie::oem::Parser* pclParser_, bool bDecompressRangeCmp_); - DECODERS_EXPORT bool NovatelParserGetDecompressRangeCmp(novatel::edie::oem::Parser* pclParser_); - DECODERS_EXPORT void NovatelParserSetReturnUnknownBytes(novatel::edie::oem::Parser* pclParser_, bool bReturnUnknownBytes_); - DECODERS_EXPORT bool NovatelParserGetReturnUnknownBytes(novatel::edie::oem::Parser* pclParser_); - DECODERS_EXPORT void NovatelParserSetEncodeFormat(novatel::edie::oem::Parser* pclParser_, novatel::edie::ENCODE_FORMAT eEncodeFormat_); - DECODERS_EXPORT novatel::edie::ENCODE_FORMAT NovatelParserGetEncodeFormat(novatel::edie::oem::Parser* pclParser_); - - DECODERS_EXPORT novatel::edie::oem::Filter* NovatelParserGetFilter(novatel::edie::oem::Parser* pclParser_); - DECODERS_EXPORT void NovatelParserSetFilter(novatel::edie::oem::Parser* pclParser_, novatel::edie::oem::Filter* pclFilter_); - - DECODERS_EXPORT unsigned char* NovatelParserGetBuffer(novatel::edie::oem::Parser* pclParser_); - - // R/W - DECODERS_EXPORT uint32_t NovatelParserWrite(novatel::edie::oem::Parser* pclParser_, unsigned char* pucBytes_, uint32_t uiByteCount_); - DECODERS_EXPORT novatel::edie::STATUS NovatelParserRead(novatel::edie::oem::Parser* pclParser_, novatel::edie::MessageDataStruct* pstMessageData_, - novatel::edie::oem::MetaDataStruct* pstMetaData_); - - DECODERS_EXPORT uint32_t NovatelParserFlush(novatel::edie::oem::Parser* pclParser_, unsigned char* pucBuffer_, uint32_t uiBufferSize_); -} - -#endif // DYNAMIC_LIBRARY_NOVATEL_PARSER_HPP diff --git a/src/decoders/dynamic_library/api/version.hpp b/src/decoders/dynamic_library/api/version.hpp deleted file mode 100644 index c270007ee..000000000 --- a/src/decoders/dynamic_library/api/version.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file version.hpp -// =============================================================================== - -#ifndef DYNAMIC_LIBRARY_VERSION_HPP -#define DYNAMIC_LIBRARY_VERSION_HPP - -#include "decoders_export.h" - -extern "C" -{ - DECODERS_EXPORT const char* Version(); - DECODERS_EXPORT const char* PrettyVersion(); -} - -#endif diff --git a/src/decoders/dynamic_library/src/common_json_reader.cpp b/src/decoders/dynamic_library/src/common_json_reader.cpp deleted file mode 100644 index 9a22cf551..000000000 --- a/src/decoders/dynamic_library/src/common_json_reader.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file common_json_reader.cpp -// =============================================================================== - -#include "common_json_reader.hpp" - -using namespace novatel::edie; - -JsonReader* CommonJsonReaderInit() -{ - auto* pclJsonDb = new JsonReader(); - return pclJsonDb; -} - -bool CommonJsonReaderLoadFile(JsonReader* pclJsonDb_, const char* pcJsonDbFilepath_) -{ - if (pclJsonDb_ == nullptr) { return false; } - - try - { - pclJsonDb_->LoadFile(pcJsonDbFilepath_); - } - catch (...) - { - return false; - } - - return true; -} - -bool CommonJsonReaderParseJson(JsonReader* pclJsonDb_, const char* pcJsonData_) -{ - if (pclJsonDb_ == nullptr) { return false; } - - try - { - pclJsonDb_->ParseJson(pcJsonData_); - } - catch (...) - { - return false; - } - - return true; -} - -bool CommonJsonReaderDelete(JsonReader* pclJsonDb_) -{ - if (pclJsonDb_ == nullptr) { return false; } - - try - { - delete pclJsonDb_; - pclJsonDb_ = nullptr; - } - catch (...) - { - return false; - } - - return true; -} diff --git a/src/decoders/dynamic_library/src/common_logger.cpp b/src/decoders/dynamic_library/src/common_logger.cpp deleted file mode 100644 index 27139ec6e..000000000 --- a/src/decoders/dynamic_library/src/common_logger.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file common_logger.cpp -// =============================================================================== - -#include "common_logger.hpp" - -#include - -#include "decoders/common/api/logger.hpp" - -void CommonLoggerSetup() { Logger::InitLogger(); } - -void CommonLoggerSetupFromFile(char* pcLoggerConfigPath_) { Logger::InitLogger(std::string(pcLoggerConfigPath_)); } - -bool CommonLoggerSetLoggerLevel(int32_t iLogLevel_) -{ - return iLogLevel_ >= spdlog::level::level_enum::trace && iLogLevel_ < spdlog::level::level_enum::n_levels - ? spdlog::set_level(static_cast(iLogLevel_)), - true : false; -} - -void CommonLoggerShutdownLogger() { Logger::Shutdown(); } - -bool CommonLoggerLog(int32_t iLogLevel_, char* pucMessage_) -{ - std::shared_ptr pclLogger = spdlog::get("logger_"); - - if (!pclLogger) { pclLogger = Logger::RegisterLogger("decoder_dll"); } - - if (iLogLevel_ >= spdlog::level::level_enum::trace && iLogLevel_ < spdlog::level::level_enum::n_levels) - { - switch (static_cast(iLogLevel_)) - { - case SPDLOG_LEVEL_TRACE: pclLogger->trace(pucMessage_); break; - case SPDLOG_LEVEL_DEBUG: pclLogger->debug(pucMessage_); break; - case SPDLOG_LEVEL_INFO: pclLogger->info(pucMessage_); break; - case SPDLOG_LEVEL_WARN: pclLogger->warn(pucMessage_); break; - case SPDLOG_LEVEL_ERROR: pclLogger->error(pucMessage_); break; - case SPDLOG_LEVEL_CRITICAL: pclLogger->critical(pucMessage_); break; - case SPDLOG_LEVEL_OFF: break; // Do no logging - default: SPDLOG_LOGGER_ERROR(pclLogger, "Unknown log level {}", iLogLevel_); break; - } - return true; - } - return false; -} diff --git a/src/decoders/dynamic_library/src/novatel_commander.cpp b/src/decoders/dynamic_library/src/novatel_commander.cpp deleted file mode 100644 index 7c79e5293..000000000 --- a/src/decoders/dynamic_library/src/novatel_commander.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_commander.cpp -// =============================================================================== - -#include "novatel_commander.hpp" - -using namespace novatel::edie; -using namespace novatel::edie::oem; - -bool NovatelCommanderSetLoggerLevel(Commander* pclCommander_, uint32_t uiLogLevel_) -{ - return (pclCommander_ != nullptr) && uiLogLevel_ >= spdlog::level::level_enum::trace && uiLogLevel_ < spdlog::level::level_enum::n_levels - ? pclCommander_->SetLoggerLevel(static_cast(uiLogLevel_)), - true : false; -} - -Commander* NovatelCommanderInit(JsonReader* pclJsonDb_) { return new Commander(pclJsonDb_); } - -void NovatelCommanderDelete(Commander* pclCommander_) -{ - if (pclCommander_ != nullptr) - { - delete pclCommander_; - pclCommander_ = nullptr; - } -} - -void NovatelCommanderLoadJson(Commander* pclCommander_, JsonReader* pclJsonDb_) -{ - if ((pclCommander_ != nullptr) && (pclJsonDb_ != nullptr)) { pclCommander_->LoadJsonDb(pclJsonDb_); } -} - -STATUS NovatelCommanderEncode(Commander* pclCommander_, char* pcAbbrevAsciiCommand_, uint32_t uicAbbrevAsciiCommandLength_, char* pcEncodeBuffer_, - uint32_t* puiEncodeBufferSize_, ENCODE_FORMAT eEncodeFormat_) -{ - return (pclCommander_ != nullptr) && (pcAbbrevAsciiCommand_ != nullptr) && (pcEncodeBuffer_ != nullptr) && (puiEncodeBufferSize_ != nullptr) - ? pclCommander_->Encode(pcAbbrevAsciiCommand_, uicAbbrevAsciiCommandLength_, pcEncodeBuffer_, *puiEncodeBufferSize_, eEncodeFormat_) - : STATUS::NULL_PROVIDED; -} diff --git a/src/decoders/dynamic_library/src/novatel_encoder.cpp b/src/decoders/dynamic_library/src/novatel_encoder.cpp deleted file mode 100644 index 1dce9059f..000000000 --- a/src/decoders/dynamic_library/src/novatel_encoder.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_encoder.cpp -// =============================================================================== - -#include "novatel_encoder.hpp" - -using namespace novatel::edie; -using namespace novatel::edie::oem; - -bool NovatelEncoderSetLoggerLevel(Encoder* pclEncoder_, uint32_t uiLogLevel_) -{ - return (pclEncoder_ != nullptr) && uiLogLevel_ >= spdlog::level::level_enum::trace && uiLogLevel_ < spdlog::level::level_enum::n_levels - ? pclEncoder_->SetLoggerLevel(static_cast(uiLogLevel_)), - true : false; -} - -Encoder* NovatelEncoderInit(JsonReader* pclJsonDb_) { return new Encoder(pclJsonDb_); } - -void NovatelEncoderDelete(Encoder* pclEncoder_) -{ - if (pclEncoder_ != nullptr) - { - delete pclEncoder_; - pclEncoder_ = nullptr; - } -} - -void NovatelEncoderLoadJson(Encoder* pclEncoder_, JsonReader* pclJsonDb_) -{ - if ((pclEncoder_ != nullptr) && (pclJsonDb_ != nullptr)) { pclEncoder_->LoadJsonDb(pclJsonDb_); } -} - -STATUS NovatelEncoderEncode(Encoder* pclEncoder_, unsigned char* pucEncodeBuffer_, uint32_t uiEncodeBufferSize_, IntermediateHeader* pstInterHeader_, - std::vector* pstInterMessage_, MessageDataStruct* pstMessageData_, MetaDataStruct* pstMetaData_, - ENCODE_FORMAT eEncodeFormat_) -{ - return (pclEncoder_ != nullptr) && (pucEncodeBuffer_ != nullptr) && (pstInterHeader_ != nullptr) && (pstInterMessage_ != nullptr) && - (pstMessageData_ != nullptr) && (pstMetaData_ != nullptr) - ? pclEncoder_->Encode(&pucEncodeBuffer_, uiEncodeBufferSize_, *pstInterHeader_, *pstInterMessage_, *pstMessageData_, *pstMetaData_, - eEncodeFormat_) - : STATUS::NULL_PROVIDED; -} diff --git a/src/decoders/dynamic_library/src/novatel_file_parser.cpp b/src/decoders/dynamic_library/src/novatel_file_parser.cpp deleted file mode 100644 index 24b53684c..000000000 --- a/src/decoders/dynamic_library/src/novatel_file_parser.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_file_parser.cpp -// =============================================================================== - -#include "novatel_file_parser.hpp" - -#include - -using namespace novatel::edie; -using namespace novatel::edie::oem; - -FileParser* NovatelFileParserInit(JsonReader* pclJsonDb_) { return new FileParser(pclJsonDb_); } - -void NovatelFileParserDelete(FileParser* pclFileParser_) -{ - if (pclFileParser_ != nullptr) - { - delete pclFileParser_; - pclFileParser_ = nullptr; - } -} - -void NovatelFileParserLoadJsonDb(FileParser* pclFileParser_, JsonReader* pclJsonDb_) -{ - if ((pclFileParser_ != nullptr) && (pclJsonDb_ != nullptr)) { pclFileParser_->LoadJsonDb(pclJsonDb_); } -} - -void NovatelFileParserSetIgnoreAbbrevAsciiResponses(FileParser* pclFileParser_, bool bIgnoreAbbrevAsciiResponsesCmp_) -{ - if (pclFileParser_ != nullptr) { pclFileParser_->SetIgnoreAbbreviatedAsciiResponses(bIgnoreAbbrevAsciiResponsesCmp_); } -} - -bool NovatelFileParserGetIgnoreAbbrevAsciiResponses(FileParser* pclFileParser_) -{ - return pclFileParser_ != nullptr ? pclFileParser_->GetIgnoreAbbreviatedAsciiResponses() : false; -} - -void NovatelFileParserSetDecompressRangeCmp(FileParser* pclFileParser_, bool bDecompressRangeCmp_) -{ - if (pclFileParser_ != nullptr) { pclFileParser_->SetDecompressRangeCmp(bDecompressRangeCmp_); } -} - -bool NovatelFileParserGetDecompressRangeCmp(FileParser* pclFileParser_) -{ - return pclFileParser_ != nullptr ? pclFileParser_->GetDecompressRangeCmp() : false; -} - -void NovatelFileParserSetReturnUnknownBytes(FileParser* pclFileParser_, bool bReturnUnknownBytes_) -{ - if (pclFileParser_ != nullptr) { pclFileParser_->SetReturnUnknownBytes(bReturnUnknownBytes_); } -} - -bool NovatelFileParserGetReturnUnknownBytes(FileParser* pclFileParser_) -{ - return pclFileParser_ != nullptr ? pclFileParser_->GetReturnUnknownBytes() : false; -} - -void NovatelFileParserSetEncodeFormat(FileParser* pclFileParser_, ENCODE_FORMAT eEncodeFormat_) -{ - if (pclFileParser_ != nullptr) { return pclFileParser_->SetEncodeFormat(eEncodeFormat_); } -} - -ENCODE_FORMAT NovatelFileParserGetEncodeFormat(FileParser* pclFileParser_) -{ - return pclFileParser_ != nullptr ? pclFileParser_->GetEncodeFormat() : ENCODE_FORMAT::UNSPECIFIED; -} - -unsigned char* NovatelFileParserGetBuffer(FileParser* pclFileParser_) -{ - return pclFileParser_ != nullptr ? pclFileParser_->GetInternalBuffer() : nullptr; -} - -Filter* NovatelFileParserGetFilter(FileParser* pclFileParser_) { return pclFileParser_ != nullptr ? pclFileParser_->GetFilter() : nullptr; } - -void NovatelFileParserSetFilter(FileParser* pclFileParser_, Filter* pclFilter_) -{ - if ((pclFileParser_ != nullptr) && (pclFilter_ != nullptr)) { pclFileParser_->SetFilter(pclFilter_); } -} - -bool NovatelFileParserSetStream(FileParser* pclFileParser_, InputFileStream* pclIfs_) -{ - return (pclFileParser_ != nullptr) && (pclIfs_ != nullptr) ? pclFileParser_->SetStream(pclIfs_) : false; -} - -uint32_t NovatelFileParserGetPercentRead(FileParser* pclFileParser_) -{ - return pclFileParser_ != nullptr ? pclFileParser_->GetPercentRead() : std::numeric_limits::max(); -} - -STATUS NovatelFileParserRead(FileParser* pclFileParser_, MessageDataStruct* pstMessageData_, MetaDataStruct* pstMetaData_) -{ - return (pclFileParser_ != nullptr) && (pstMessageData_ != nullptr) && (pstMetaData_ != nullptr) - ? pclFileParser_->Read(*pstMessageData_, *pstMetaData_) - : STATUS::NULL_PROVIDED; -} - -bool NovatelFileParserReset(FileParser* pclFileParser_) { return pclFileParser_ != nullptr ? pclFileParser_->Reset() : false; } - -uint32_t NovatelFileParserFlush(FileParser* pclFileParser_, unsigned char* pucBuffer_, uint32_t uiBufferSize_) -{ - return (pclFileParser_ != nullptr) && (pucBuffer_ != nullptr) ? pclFileParser_->Flush(pucBuffer_, uiBufferSize_) - : std::numeric_limits::max(); -} diff --git a/src/decoders/dynamic_library/src/novatel_filter.cpp b/src/decoders/dynamic_library/src/novatel_filter.cpp deleted file mode 100644 index 1d5c4a412..000000000 --- a/src/decoders/dynamic_library/src/novatel_filter.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_filter.cpp -// =============================================================================== - -#include "novatel_filter.hpp" - -using namespace novatel::edie; -using namespace novatel::edie::oem; - -bool NovatelFilterSetLoggerLevel(Filter* pclFilter_, uint32_t uiLogLevel_) -{ - return (pclFilter_ != nullptr) && uiLogLevel_ >= spdlog::level::level_enum::trace && uiLogLevel_ < spdlog::level::level_enum::n_levels - ? pclFilter_->SetLoggerLevel(static_cast(uiLogLevel_)), - true : false; -} - -Filter* NovatelFilterInit() { return new Filter(); } - -void NovatelFilterDelete(Filter* pclFilter_) -{ - if (pclFilter_ != nullptr) - { - delete pclFilter_; - pclFilter_ = nullptr; - } -} - -void NovatelFilterSetIncludeLowerTime(Filter* pclFilter_, uint32_t uiLowerTimeWeek_, double dLowerTimeSec_) -{ - if (pclFilter_ != nullptr) { pclFilter_->SetIncludeLowerTimeBound(uiLowerTimeWeek_, dLowerTimeSec_); } -} - -void NovatelFilterSetIncludeUpperTime(Filter* pclFilter_, uint32_t uiUpperTime_, double dUpperTimeSec_) -{ - if (pclFilter_ != nullptr) { pclFilter_->SetIncludeUpperTimeBound(uiUpperTime_, dUpperTimeSec_); } -} - -void NovatelFilterInvertTimeFilter(Filter* pclFilter_, bool bInvert_) -{ - if (pclFilter_ != nullptr) { pclFilter_->InvertTimeFilter(bInvert_); } -} - -void NovatelFilterSetIncludeDecimation(Filter* pclFilter_, double dPeriodSec_) -{ - if (pclFilter_ != nullptr) { pclFilter_->SetIncludeDecimation(dPeriodSec_); } -} - -void NovatelFilterInvertDecimationFilter(Filter* pclFilter_, bool bInvert_) -{ - if (pclFilter_ != nullptr) { pclFilter_->InvertDecimationFilter(bInvert_); } -} - -void NovatelFilterIncludeTimeStatus(Filter* pclFilter_, TIME_STATUS eTimeStatus_) -{ - if (pclFilter_ != nullptr) { pclFilter_->IncludeTimeStatus(eTimeStatus_); } -} - -void NovatelFilterInvertTimeStatusFilter(Filter* pclFilter_, bool bInvert_) -{ - if (pclFilter_ != nullptr) { pclFilter_->InvertTimeStatusFilter(bInvert_); } -} - -void NovatelFilterIncludeMessageId(Filter* pclFilter_, uint32_t uiId_, HEADER_FORMAT eFormat_, MEASUREMENT_SOURCE eSource_) -{ - if (pclFilter_ != nullptr) { pclFilter_->IncludeMessageId(uiId_, eFormat_, eSource_); } -} - -void NovatelFilterInvertMessageIdFilter(Filter* pclFilter_, bool bInvert_) -{ - if (pclFilter_ != nullptr) { pclFilter_->InvertMessageIdFilter(bInvert_); } -} - -void NovatelFilterIncludeMessageName(Filter* pclFilter_, uint8_t* pucMessageName_, HEADER_FORMAT eFormat_, MEASUREMENT_SOURCE eSource_) -{ - if ((pclFilter_ != nullptr) && (pucMessageName_ != nullptr)) - { - pclFilter_->IncludeMessageName(std::string(reinterpret_cast(pucMessageName_)), eFormat_, eSource_); - } -} - -void NovatelFilterInvertMessageNameFilter(Filter* pclFilter_, bool bInvert_) -{ - if (pclFilter_ != nullptr) { pclFilter_->InvertMessageNameFilter(bInvert_); } -} - -void NovatelFilterIncludeNmeaMessages(Filter* pclFilter_, bool bInvert_) -{ - if (pclFilter_ != nullptr) { pclFilter_->IncludeNmeaMessages(bInvert_); } -} - -bool NovatelFilterDoFiltering(Filter* pclFilter_, MetaDataStruct* pstMetaData_) -{ - return (pclFilter_ != nullptr) && (pstMetaData_ != nullptr) ? pclFilter_->DoFiltering(*pstMetaData_) : false; -} - -void NovatelFilterClearFilters(Filter* pclFilter_) -{ - if (pclFilter_ != nullptr) { pclFilter_->ClearFilters(); } -} diff --git a/src/decoders/dynamic_library/src/novatel_framer.cpp b/src/decoders/dynamic_library/src/novatel_framer.cpp deleted file mode 100644 index a4ad86c77..000000000 --- a/src/decoders/dynamic_library/src/novatel_framer.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_framer.cpp -// =============================================================================== - -#include "novatel_framer.hpp" - -#include - -using namespace novatel::edie; -using namespace novatel::edie::oem; - -bool NovatelFramerSetLoggerLevel(Framer* pclFramer_, uint32_t uiLogLevel_) -{ - return (pclFramer_ != nullptr) && uiLogLevel_ >= spdlog::level::level_enum::trace && uiLogLevel_ < spdlog::level::level_enum::n_levels - ? pclFramer_->SetLoggerLevel(static_cast(uiLogLevel_)), - true : false; -} - -Framer* NovatelFramerInit() { return new Framer(); } - -void NovatelFramerDelete(Framer* pclFramer_) -{ - if (pclFramer_ != nullptr) - { - delete pclFramer_; - pclFramer_ = nullptr; - } -} - -void NovatelFramerFrameJson(Framer* pclFramer_, bool bFrameJson_) -{ - if (pclFramer_ != nullptr) { pclFramer_->SetFrameJson(bFrameJson_); } -} - -void NovatelFramerPayloadOnly(Framer* pclFramer_, bool bPayloadOnly_) -{ - if (pclFramer_ != nullptr) { pclFramer_->SetPayloadOnly(bPayloadOnly_); } -} - -void NovatelFramerReportUnknownBytes(Framer* pclFramer_, bool bReportUnknownBytes_) -{ - if (pclFramer_ != nullptr) { pclFramer_->SetReportUnknownBytes(bReportUnknownBytes_); } -} - -uint32_t NovatelFramerGetAvailableBytes(Framer* pclFramer_) -{ - return pclFramer_ != nullptr ? pclFramer_->GetBytesAvailableInBuffer() : std::numeric_limits::max(); -} - -uint32_t NovatelFramerWrite(Framer* pclFramer_, unsigned char* pucBytes_, uint32_t uiByteCount_) -{ - return pclFramer_ != nullptr ? pclFramer_->Write(pucBytes_, uiByteCount_) : std::numeric_limits::max(); -} - -STATUS NovatelFramerRead(Framer* pclFramer_, unsigned char* pucBuffer_, uint32_t uiBufferSize_, MetaDataStruct* pstMetaData_) -{ - return (pclFramer_ != nullptr) && (pstMetaData_ != nullptr) ? pclFramer_->GetFrame(pucBuffer_, uiBufferSize_, *pstMetaData_) - : STATUS::NULL_PROVIDED; -} - -uint32_t NovatelFramerFlush(Framer* pclFramer_, unsigned char* pucBuffer_, uint32_t uiBufferSize_) -{ - return (pclFramer_ != nullptr) && (pucBuffer_ != nullptr) ? pclFramer_->Flush(pucBuffer_, uiBufferSize_) : std::numeric_limits::max(); -} diff --git a/src/decoders/dynamic_library/src/novatel_header_decoder.cpp b/src/decoders/dynamic_library/src/novatel_header_decoder.cpp deleted file mode 100644 index 38bb40c84..000000000 --- a/src/decoders/dynamic_library/src/novatel_header_decoder.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_header_decoder.cpp -// =============================================================================== - -#include "novatel_header_decoder.hpp" - -using namespace novatel::edie; -using namespace novatel::edie::oem; - -bool NovatelHeaderDecoderSetLoggerLevel(HeaderDecoder* pclHeaderDecoder_, uint32_t uiLogLevel_) -{ - return (pclHeaderDecoder_ != nullptr) && uiLogLevel_ >= spdlog::level::level_enum::trace && uiLogLevel_ < spdlog::level::level_enum::n_levels - ? pclHeaderDecoder_->SetLoggerLevel(static_cast(uiLogLevel_)), - true : false; -} - -HeaderDecoder* NovatelHeaderDecoderInit(JsonReader* pclJsonDb_) { return new HeaderDecoder(pclJsonDb_); } - -void NovatelHeaderDecoderDelete(HeaderDecoder* pclHeaderDecoder_) -{ - if (pclHeaderDecoder_ != nullptr) - { - delete pclHeaderDecoder_; - pclHeaderDecoder_ = nullptr; - } -} - -void NovatelHeaderDecoderLoadJson(HeaderDecoder* pclHeaderDecoder_, JsonReader* pclJsonDb_) -{ - if ((pclHeaderDecoder_ != nullptr) && (pclJsonDb_ != nullptr)) { pclHeaderDecoder_->LoadJsonDb(pclJsonDb_); } -} - -STATUS NovatelHeaderDecoderDecode(HeaderDecoder* pclHeaderDecoder_, unsigned char* pucLogBuf_, IntermediateHeader* pstInterHeader_, - MetaDataStruct* pstMetaData_) -{ - return (pclHeaderDecoder_ != nullptr) && (pucLogBuf_ != nullptr) && (pstInterHeader_ != nullptr) && (pstMetaData_ != nullptr) - ? pclHeaderDecoder_->Decode(pucLogBuf_, *pstInterHeader_, *pstMetaData_) - : STATUS::NULL_PROVIDED; -} diff --git a/src/decoders/dynamic_library/src/novatel_message_decoder.cpp b/src/decoders/dynamic_library/src/novatel_message_decoder.cpp deleted file mode 100644 index cc20291ca..000000000 --- a/src/decoders/dynamic_library/src/novatel_message_decoder.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_message_decoder.cpp -// =============================================================================== - -#include "novatel_message_decoder.hpp" - -using namespace novatel::edie; - -bool NovatelMessageDecoderSetLoggerLevel(oem::MessageDecoder* pclMessageDecoder_, uint32_t uiLogLevel_) -{ - return (pclMessageDecoder_ != nullptr) && uiLogLevel_ >= spdlog::level::level_enum::trace && uiLogLevel_ < spdlog::level::level_enum::n_levels - ? pclMessageDecoder_->SetLoggerLevel(static_cast(uiLogLevel_)), - true : false; -} - -oem::MessageDecoder* NovatelMessageDecoderInit(JsonReader* pclJsonDb_) { return new oem::MessageDecoder(pclJsonDb_); } - -void NovatelMessageDecoderDelete(oem::MessageDecoder* pclMessageDecoder_) -{ - if (pclMessageDecoder_ != nullptr) - { - delete pclMessageDecoder_; - pclMessageDecoder_ = nullptr; - } -} - -void NovatelMessageDecoderLoadJson(oem::MessageDecoder* pclMessageDecoder_, JsonReader* pclJsonDb_) -{ - if ((pclMessageDecoder_ != nullptr) && (pclJsonDb_ != nullptr)) { pclMessageDecoder_->LoadJsonDb(pclJsonDb_); } -} - -STATUS NovatelMessageDecoderDecode(oem::MessageDecoder* pclMessageDecoder_, unsigned char* pucLogBuf_, std::vector* pstInterMessage_, - oem::MetaDataStruct* pstMetaData_) -{ - return (pclMessageDecoder_ != nullptr) && (pstInterMessage_ != nullptr) && (pstMetaData_ != nullptr) - ? pclMessageDecoder_->Decode(pucLogBuf_, *pstInterMessage_, *pstMetaData_) - : STATUS::NULL_PROVIDED; -} - -std::vector* NovatelIntermediateMessageInit() { return new std::vector(); } - -void NovatelIntermediateMessageDelete(std::vector* pstInterMessage_) -{ - if (pstInterMessage_ != nullptr) - { - delete pstInterMessage_; - pstInterMessage_ = nullptr; - } -} diff --git a/src/decoders/dynamic_library/src/novatel_parser.cpp b/src/decoders/dynamic_library/src/novatel_parser.cpp deleted file mode 100644 index 299a78292..000000000 --- a/src/decoders/dynamic_library/src/novatel_parser.cpp +++ /dev/null @@ -1,107 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file novatel_parser.cpp -// =============================================================================== - -#include "novatel_parser.hpp" - -#include - -using namespace novatel::edie; -using namespace novatel::edie::oem; - -Parser* NovatelParserInit(JsonReader* pclJsonDb_) { return new Parser(pclJsonDb_); } - -void NovatelParserDelete(Parser* pclParser_) -{ - if (pclParser_ != nullptr) - { - delete pclParser_; - pclParser_ = nullptr; - } -} - -void NovatelParserLoadJsonDb(Parser* pclParser_, JsonReader* pclJsonDb_) -{ - if ((pclParser_ != nullptr) && (pclJsonDb_ != nullptr)) { pclParser_->LoadJsonDb(pclJsonDb_); } -} - -void NovatelParserSetIgnoreAbbrevAsciiResponses(Parser* pclParser_, bool bIgnoreAbbrevAsciiResponsesCmp_) -{ - if (pclParser_ != nullptr) { pclParser_->SetIgnoreAbbreviatedAsciiResponses(bIgnoreAbbrevAsciiResponsesCmp_); } -} - -bool NovatelParserGetIgnoreAbbrevAsciiResponses(Parser* pclParser_) -{ - return pclParser_ != nullptr ? pclParser_->GetIgnoreAbbreviatedAsciiResponses() : false; -} - -void NovatelParserSetDecompressRangeCmp(Parser* pclParser_, bool bDecompressRangeCmp_) -{ - if (pclParser_ != nullptr) { pclParser_->SetDecompressRangeCmp(bDecompressRangeCmp_); } -} - -bool NovatelParserGetDecompressRangeCmp(Parser* pclParser_) { return pclParser_ != nullptr ? pclParser_->GetDecompressRangeCmp() : false; } - -void NovatelParserSetReturnUnknownBytes(Parser* pclParser_, bool bReturnUnknownBytes_) -{ - if (pclParser_ != nullptr) { pclParser_->SetReturnUnknownBytes(bReturnUnknownBytes_); } -} - -bool NovatelParserGetReturnUnknownBytes(Parser* pclParser_) { return pclParser_ != nullptr ? pclParser_->GetReturnUnknownBytes() : false; } - -void NovatelParserSetEncodeFormat(Parser* pclParser_, ENCODE_FORMAT eEncodeFormat_) -{ - if (pclParser_ != nullptr) { pclParser_->SetEncodeFormat(eEncodeFormat_); } -} - -ENCODE_FORMAT NovatelParserGetEncodeFormat(Parser* pclParser_) -{ - return pclParser_ != nullptr ? pclParser_->GetEncodeFormat() : ENCODE_FORMAT::UNSPECIFIED; -} - -Filter* NovatelParserGetFilter(Parser* pclParser_) { return pclParser_ != nullptr ? pclParser_->GetFilter() : nullptr; } - -void NovatelParserSetFilter(Parser* pclParser_, Filter* pclFilter_) -{ - if ((pclParser_ != nullptr) && (pclFilter_ != nullptr)) { pclParser_->SetFilter(pclFilter_); } -} - -unsigned char* NovatelParserGetBuffer(Parser* pclParser_) { return pclParser_ != nullptr ? pclParser_->GetInternalBuffer() : nullptr; } - -uint32_t NovatelParserWrite(Parser* pclParser_, unsigned char* pucBytes_, uint32_t uiByteCount_) -{ - return (pclParser_ != nullptr) && (pucBytes_ != nullptr) ? pclParser_->Write(pucBytes_, uiByteCount_) : std::numeric_limits::max(); -} - -STATUS NovatelParserRead(Parser* pclParser_, MessageDataStruct* pstMessageData_, MetaDataStruct* pstMetaData_) -{ - return (pclParser_ != nullptr) && (pstMessageData_ != nullptr) && (pstMetaData_ != nullptr) ? pclParser_->Read(*pstMessageData_, *pstMetaData_) - : STATUS::NULL_PROVIDED; -} - -uint32_t NovatelParserFlush(Parser* pclParser_, unsigned char* pucBuffer_, uint32_t uiBufferSize_) -{ - return (pclParser_ != nullptr) && (pucBuffer_ != nullptr) ? pclParser_->Flush(pucBuffer_, uiBufferSize_) : std::numeric_limits::max(); -} diff --git a/src/decoders/dynamic_library/src/version.cpp b/src/decoders/dynamic_library/src/version.cpp deleted file mode 100644 index 7fa8db807..000000000 --- a/src/decoders/dynamic_library/src/version.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file version.cpp -// =============================================================================== - -#include "decoders/dynamic_library/api/version.hpp" - -#include "version.h" // this refers to the EDIE version.h - -const char* Version() { return get_version(); } - -const char* PrettyVersion() { return caPrettyPrint; } diff --git a/src/hw_interface/CMakeLists.txt b/src/hw_interface/CMakeLists.txt index 9ba92351e..1fff52379 100644 --- a/src/hw_interface/CMakeLists.txt +++ b/src/hw_interface/CMakeLists.txt @@ -1,2 +1 @@ -add_subdirectory(dynamic_library) add_subdirectory(stream_interface) diff --git a/src/hw_interface/dynamic_library/CMakeLists.txt b/src/hw_interface/dynamic_library/CMakeLists.txt deleted file mode 100644 index 4ee5b5cd4..000000000 --- a/src/hw_interface/dynamic_library/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -set(TARGET_NAME "hw_interface_dynamic_library") -file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -add_library(${TARGET_NAME} SHARED ${SOURCES}) -target_link_libraries(${TARGET_NAME} PRIVATE common stream_interface) -add_custom_command(TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/api/ ${CMAKE_SOURCE_DIR}/bin/api/hw_interface/${TARGET_NAME}/api/) -set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "hw_interface") -target_include_directories(${TARGET_NAME} PUBLIC api) - -if(WIN32) - add_compile_definitions(HWINTERFACE_EXPORTS) -else() - add_compile_definitions(HWINTERFACE_STATIC_DEFINE) -endif() diff --git a/src/hw_interface/dynamic_library/api/hwinterface_export.h b/src/hw_interface/dynamic_library/api/hwinterface_export.h deleted file mode 100644 index bcd15b897..000000000 --- a/src/hw_interface/dynamic_library/api/hwinterface_export.h +++ /dev/null @@ -1,67 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file hwinterface_export.h -// =============================================================================== - -#ifndef HWINTERFACE_EXPORT_H -#define HWINTERFACE_EXPORT_H - -#ifdef HWINTERFACE_STATIC_DEFINE -#define HWINTERFACE_EXPORT -#define HWINTERFACE_NO_EXPORT -#else -#ifndef HWINTERFACE_EXPORT -#ifdef HWINTERFACE_EXPORTS -/* We are building this library */ -#define HWINTERFACE_EXPORT __declspec(dllexport) -#else -/* We are using this library */ -#define HWINTERFACE_EXPORT __declspec(dllimport) -#endif -#endif - -#ifndef HWINTERFACE_NO_EXPORT -#define HWINTERFACE_NO_EXPORT -#endif -#endif - -#ifndef HWINTERFACE_DEPRECATED -#define HWINTERFACE_DEPRECATED __declspec(deprecated) -#endif - -#ifndef HWINTERFACE_DEPRECATED_EXPORT -#define HWINTERFACE_DEPRECATED_EXPORT HWINTERFACE_EXPORT HWINTERFACE_DEPRECATED -#endif - -#ifndef HWINTERFACE_DEPRECATED_NO_EXPORT -#define HWINTERFACE_DEPRECATED_NO_EXPORT HWINTERFACE_NO_EXPORT HWINTERFACE_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -#ifndef HWINTERFACE_NO_DEPRECATED -#define HWINTERFACE_NO_DEPRECATED -#endif -#endif - -#endif /* HWINTERFACE_EXPORT_H */ diff --git a/src/hw_interface/dynamic_library/api/stream_interface.hpp b/src/hw_interface/dynamic_library/api/stream_interface.hpp deleted file mode 100644 index 75c8321df..000000000 --- a/src/hw_interface/dynamic_library/api/stream_interface.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file stream_interface.hpp -// =============================================================================== - -#ifndef DYNAMIC_LIBRARY_STREAM_INTERFACE_HPP -#define DYNAMIC_LIBRARY_STREAM_INTERFACE_HPP - -#include "hw_interface/stream_interface/api/inputfilestream.hpp" -#include "hwinterface_export.h" - -extern "C" -{ - HWINTERFACE_EXPORT InputFileStream* ifs_init(char* pcInputFilePath_); - HWINTERFACE_EXPORT void ifs_del(InputStreamInterface* pclIFS_); - HWINTERFACE_EXPORT void ifs_read(InputFileStream* pclIFS_, StreamReadStatus* pstReadStatus_, char* pcReadBuf_, int iBufSize_); -} - -#endif // DYNAMIC_LIBRARY_STREAM_INTERFACE_HPP diff --git a/src/hw_interface/dynamic_library/api/version.hpp b/src/hw_interface/dynamic_library/api/version.hpp deleted file mode 100644 index 1ecbd0601..000000000 --- a/src/hw_interface/dynamic_library/api/version.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file version.hpp -// =============================================================================== - -#include "hwinterface_export.h" - -extern "C" -{ - HWINTERFACE_EXPORT const char* get_version(); -} diff --git a/src/hw_interface/dynamic_library/src/stream_interface.cpp b/src/hw_interface/dynamic_library/src/stream_interface.cpp deleted file mode 100644 index b6349aaec..000000000 --- a/src/hw_interface/dynamic_library/src/stream_interface.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file stream_interface.cpp -// =============================================================================== - -#include "stream_interface.hpp" - -InputFileStream* ifs_init(char* pcInputFilePath_) -{ - auto* pclIFS = new InputFileStream(pcInputFilePath_); - return pclIFS; -} - -void ifs_del(InputStreamInterface* pclIFS_) -{ - if (pclIFS_ != nullptr) - { - delete pclIFS_; - pclIFS_ = nullptr; - } -} - -void ifs_read(InputFileStream* pclIFS_, StreamReadStatus* pstReadStatus_, char* pcReadBuf_, int iBufSize_) -{ - ReadDataStructure stReadData; - stReadData.cData = pcReadBuf_; - stReadData.uiDataSize = iBufSize_; - StreamReadStatus stReadStatus = pclIFS_->ReadData(stReadData); - // TODO: why make the temporary object if we're just going to copy over all the members? - pstReadStatus_->bEOS = stReadStatus.bEOS; - pstReadStatus_->uiCurrentStreamRead = stReadStatus.uiCurrentStreamRead; - pstReadStatus_->uiPercentStreamRead = stReadStatus.uiPercentStreamRead; - pstReadStatus_->ullStreamLength = stReadStatus.ullStreamLength; -} diff --git a/src/hw_interface/dynamic_library/src/version.cpp b/src/hw_interface/dynamic_library/src/version.cpp deleted file mode 100644 index f177fc659..000000000 --- a/src/hw_interface/dynamic_library/src/version.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// =============================================================================== -// | | -// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | -// | | -// | Permission is hereby granted, free of charge, to any person obtaining a | -// | copy of this software and associated documentation files (the "Software"), | -// | to deal in the Software without restriction, including without limitation | -// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | -// | and/or sell copies of the Software, and to permit persons to whom the | -// | Software is furnished to do so, subject to the following conditions: | -// | | -// | The above copyright notice and this permission notice shall be included | -// | in all copies or substantial portions of the Software. | -// | | -// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | -// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | -// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | -// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | -// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | -// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | -// | DEALINGS IN THE SOFTWARE. | -// | | -// =============================================================================== -// ! \file version.cpp -// =============================================================================== - -#include "version.hpp" - -#ifdef HWINTERFACE_EXPORTS -const char* get_version() { return "0.1.0"; } -#endif From 983cc0f785779b08304a3e2301a5af71b8914819 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 21 Sep 2024 09:54:46 +0300 Subject: [PATCH 02/15] Reorganize headers and subdirs, add namespaced CMake targets Moved all headers under a single include/novatel_edie directory at the repo root. Split decoders/common into common/ and decoders/common to avoid a circular dependency between stream_interface and decoders/common. Renamed: - hw_interface/stream_interface -> stream_interface - decoders/novatel -> decoders/oem Added an edie_ prefix to all output names of libraries to avoid potential conflicts with other projects. --- .gitignore | 2 +- CMakeLists.txt | 25 +++--- README.md | 4 +- docs/conf.py | 9 +- .../novatel/command_encoding/CMakeLists.txt | 2 +- .../command_encoding/command_encoding.cpp | 5 +- .../converter_components/CMakeLists.txt | 2 +- .../converter_components.cpp | 20 ++--- .../converter_file_parser/CMakeLists.txt | 2 +- .../converter_file_parser.cpp | 9 +- .../novatel/converter_parser/CMakeLists.txt | 2 +- .../converter_parser/converter_parser.cpp | 9 +- examples/novatel/json_parser/CMakeLists.txt | 2 +- examples/novatel/json_parser/json_parser.cpp | 9 +- .../novatel/range_decompressor/CMakeLists.txt | 2 +- .../range_decompressor/range_decompressor.cpp | 20 ++--- examples/novatel/rangecmp/CMakeLists.txt | 2 +- .../novatel/rxconfig_handler/CMakeLists.txt | 2 +- .../rxconfig_handler/rxconfig_handler.cpp | 12 +-- .../novatel_edie/common}/circular_buffer.hpp | 0 include/novatel_edie/common/common.hpp | 84 ++++++++++++++++++ .../novatel_edie/common}/crc32.hpp | 0 .../novatel_edie/common}/logger.hpp | 0 .../novatel_edie/common}/nexcept.hpp | 0 .../novatel_edie/decoders/common}/common.hpp | 54 +---------- .../novatel_edie/decoders/common}/encoder.hpp | 5 +- .../novatel_edie/decoders/common}/framer.hpp | 4 +- .../decoders/common}/json_reader.hpp | 9 +- .../decoders/common}/message_decoder.hpp | 12 +-- .../novatel_edie/decoders/oem}/commander.hpp | 10 +-- .../novatel_edie/decoders/oem}/common.hpp | 2 +- .../novatel_edie/decoders/oem}/encoder.hpp | 15 ++-- .../decoders/oem}/file_parser.hpp | 6 +- .../novatel_edie/decoders/oem}/filter.hpp | 8 +- .../novatel_edie/decoders/oem}/framer.hpp | 4 +- .../decoders/oem}/header_decoder.hpp | 10 +-- .../decoders/oem}/message_decoder.hpp | 2 +- .../novatel_edie/decoders/oem}/parser.hpp | 18 ++-- .../decoders/oem}/rangecmp/common.hpp | 0 .../oem}/rangecmp/range_decompressor.hpp | 10 +-- .../oem}/rxconfig/rxconfig_handler.hpp | 14 +-- .../novatel_edie/stream_interface}/common.hpp | 2 - .../stream_interface}/filestream.hpp | 2 +- .../stream_interface}/inputfilestream.hpp | 4 +- .../stream_interface}/inputmemorystream.hpp | 4 +- .../inputstreaminterface.hpp | 2 +- .../stream_interface}/memorystream.hpp | 3 +- .../multioutputfilestream.hpp | 7 +- .../stream_interface}/outputfilestream.hpp | 4 +- .../outputstreaminterface.hpp | 0 src/CMakeLists.txt | 2 - src/common/CMakeLists.txt | 22 +++++ .../common/src/circular_buffer.cpp | 4 +- src/common/src/common.cpp | 44 +++++++++ src/common/test/CMakeLists.txt | 7 ++ .../common/test/circular_buffer_unit_test.cpp | 21 ++--- .../common/test/crc32_unit_test.cpp | 17 ++-- src/common/test/main.cpp | 46 ++++++++++ src/decoders/CMakeLists.txt | 2 - src/decoders/common/CMakeLists.txt | 22 ++--- src/decoders/common/src/common.cpp | 4 +- src/decoders/common/src/encoder.cpp | 2 +- src/decoders/common/src/json_reader.cpp | 4 +- src/decoders/common/src/message_decoder.cpp | 2 +- src/decoders/common/test/CMakeLists.txt | 5 +- .../common/test/json_reader_unit_test.cpp | 4 +- src/decoders/common/test/main.cpp | 2 +- .../common/test/message_decoder_unit_test.cpp | 2 +- src/decoders/novatel/CMakeLists.txt | 7 -- src/decoders/oem/CMakeLists.txt | 13 +++ .../{novatel => oem}/src/commander.cpp | 2 +- src/decoders/{novatel => oem}/src/encoder.cpp | 2 +- .../{novatel => oem}/src/file_parser.cpp | 2 +- src/decoders/{novatel => oem}/src/filter.cpp | 2 +- src/decoders/{novatel => oem}/src/framer.cpp | 4 +- .../{novatel => oem}/src/header_decoder.cpp | 2 +- .../{novatel => oem}/src/message_decoder.cpp | 2 +- src/decoders/{novatel => oem}/src/parser.cpp | 2 +- .../src/rangecmp/range_decompressor.cpp | 2 +- .../src/rxconfig/rxconfig_handler.cpp | 2 +- .../{novatel => oem}/test/CMakeLists.txt | 3 +- src/decoders/{novatel => oem}/test/main.cpp | 4 +- .../{novatel => oem}/test/novatel_test.cpp | 25 +++--- .../test/proprietary_test.cpp | 4 +- .../{novatel => oem}/test/range_cmp_test.cpp | 2 +- .../test/resources/BESTUTMBIN.GPS | Bin .../abbreviated_ascii_sync_error.ASC | 0 .../test/resources/ascii_sync_error.ASC | 0 .../test/resources/binary_sync_error.BIN | Bin .../test/resources/nmea_sync_error.txt | 0 .../resources/novatel_message_definitions.hpp | 0 .../proprietary_binary_sync_error.BIN | Bin .../test/resources/short_ascii_sync_error.ASC | 0 .../resources/short_binary_sync_error.BIN | Bin .../{novatel => oem}/test/rx_config_test.cpp | 8 +- src/hw_interface/CMakeLists.txt | 1 - .../stream_interface/CMakeLists.txt | 7 -- src/stream_interface/CMakeLists.txt | 13 +++ .../stream_interface/src/filestream.cpp | 4 +- .../stream_interface/src/inputfilestream.cpp | 2 +- .../src/multioutputfilestream.cpp | 8 +- .../stream_interface/src/outputfilestream.cpp | 2 +- .../stream_interface/test/CMakeLists.txt | 3 +- .../test/filestreamunittest.cpp | 4 +- .../test/inputfilestreamunittest.cpp | 2 +- .../stream_interface/test/main.cpp | 2 +- .../test/multioutputfilestreamunittest.cpp | 4 +- .../test/outputfilestreamunittest.cpp | 2 +- .../test/resources/decoder_bestpos.asc | 0 .../test/resources/filestream_file2.asc | 0 ...0\347\232\204\346\226\207\344\273\266.gps" | 0 ...0\347\232\204\346\226\207\344\273\266.gps" | 0 .../test/resources/outputfilestream_file1.asc | 0 .../test/resources/outputfilestream_file2.asc | 0 .../test/resources/outputfilestream_file3.asc | 0 .../test/resources/outputfilestream_file4.asc | 0 .../resources/streaminterface_testread.asc | 0 ...0\347\232\204\346\226\207\344\273\266.gps" | 0 118 files changed, 460 insertions(+), 329 deletions(-) rename {src/decoders/common/api => include/novatel_edie/common}/circular_buffer.hpp (100%) create mode 100644 include/novatel_edie/common/common.hpp rename {src/decoders/common/api => include/novatel_edie/common}/crc32.hpp (100%) rename {src/decoders/common/api => include/novatel_edie/common}/logger.hpp (100%) rename {src/decoders/common/api => include/novatel_edie/common}/nexcept.hpp (100%) rename {src/decoders/common/api => include/novatel_edie/decoders/common}/common.hpp (87%) rename {src/decoders/common/api => include/novatel_edie/decoders/common}/encoder.hpp (98%) rename {src/decoders/common/api => include/novatel_edie/decoders/common}/framer.hpp (98%) rename {src/decoders/common/api => include/novatel_edie/decoders/common}/json_reader.hpp (99%) rename {src/decoders/common/api => include/novatel_edie/decoders/common}/message_decoder.hpp (97%) rename {src/decoders/novatel/api => include/novatel_edie/decoders/oem}/commander.hpp (96%) rename {src/decoders/novatel/api => include/novatel_edie/decoders/oem}/common.hpp (99%) rename {src/decoders/novatel/api => include/novatel_edie/decoders/oem}/encoder.hpp (97%) rename {src/decoders/novatel/api => include/novatel_edie/decoders/oem}/file_parser.hpp (98%) rename {src/decoders/novatel/api => include/novatel_edie/decoders/oem}/filter.hpp (98%) rename {src/decoders/novatel/api => include/novatel_edie/decoders/oem}/framer.hpp (97%) rename {src/decoders/novatel/api => include/novatel_edie/decoders/oem}/header_decoder.hpp (96%) rename {src/decoders/novatel/api => include/novatel_edie/decoders/oem}/message_decoder.hpp (97%) rename {src/decoders/novatel/api => include/novatel_edie/decoders/oem}/parser.hpp (96%) rename {src/decoders/novatel/api => include/novatel_edie/decoders/oem}/rangecmp/common.hpp (100%) rename {src/decoders/novatel/api => include/novatel_edie/decoders/oem}/rangecmp/range_decompressor.hpp (96%) rename {src/decoders/novatel/api => include/novatel_edie/decoders/oem}/rxconfig/rxconfig_handler.hpp (95%) rename {src/hw_interface/stream_interface/api => include/novatel_edie/stream_interface}/common.hpp (98%) rename {src/hw_interface/stream_interface/api => include/novatel_edie/stream_interface}/filestream.hpp (99%) rename {src/hw_interface/stream_interface/api => include/novatel_edie/stream_interface}/inputfilestream.hpp (98%) rename {src/hw_interface/stream_interface/api => include/novatel_edie/stream_interface}/inputmemorystream.hpp (97%) rename {src/hw_interface/stream_interface/api => include/novatel_edie/stream_interface}/inputstreaminterface.hpp (99%) rename {src/hw_interface/stream_interface/api => include/novatel_edie/stream_interface}/memorystream.hpp (98%) rename {src/hw_interface/stream_interface/api => include/novatel_edie/stream_interface}/multioutputfilestream.hpp (98%) rename {src/hw_interface/stream_interface/api => include/novatel_edie/stream_interface}/outputfilestream.hpp (97%) rename {src/hw_interface/stream_interface/api => include/novatel_edie/stream_interface}/outputstreaminterface.hpp (100%) delete mode 100644 src/CMakeLists.txt create mode 100644 src/common/CMakeLists.txt rename src/{decoders => }/common/src/circular_buffer.cpp (98%) create mode 100644 src/common/src/common.cpp create mode 100644 src/common/test/CMakeLists.txt rename src/{decoders => }/common/test/circular_buffer_unit_test.cpp (92%) rename src/{decoders => }/common/test/crc32_unit_test.cpp (88%) create mode 100644 src/common/test/main.cpp delete mode 100644 src/decoders/CMakeLists.txt delete mode 100644 src/decoders/novatel/CMakeLists.txt create mode 100644 src/decoders/oem/CMakeLists.txt rename src/decoders/{novatel => oem}/src/commander.cpp (99%) rename src/decoders/{novatel => oem}/src/encoder.cpp (99%) rename src/decoders/{novatel => oem}/src/file_parser.cpp (99%) rename src/decoders/{novatel => oem}/src/filter.cpp (99%) rename src/decoders/{novatel => oem}/src/framer.cpp (99%) rename src/decoders/{novatel => oem}/src/header_decoder.cpp (99%) rename src/decoders/{novatel => oem}/src/message_decoder.cpp (99%) rename src/decoders/{novatel => oem}/src/parser.cpp (99%) rename src/decoders/{novatel => oem}/src/rangecmp/range_decompressor.cpp (99%) rename src/decoders/{novatel => oem}/src/rxconfig/rxconfig_handler.cpp (99%) rename src/decoders/{novatel => oem}/test/CMakeLists.txt (75%) rename src/decoders/{novatel => oem}/test/main.cpp (96%) rename src/decoders/{novatel => oem}/test/novatel_test.cpp (99%) rename src/decoders/{novatel => oem}/test/proprietary_test.cpp (99%) rename src/decoders/{novatel => oem}/test/range_cmp_test.cpp (99%) rename src/decoders/{novatel => oem}/test/resources/BESTUTMBIN.GPS (100%) rename src/decoders/{novatel => oem}/test/resources/abbreviated_ascii_sync_error.ASC (100%) rename src/decoders/{novatel => oem}/test/resources/ascii_sync_error.ASC (100%) rename src/decoders/{novatel => oem}/test/resources/binary_sync_error.BIN (100%) rename src/decoders/{novatel => oem}/test/resources/nmea_sync_error.txt (100%) rename src/decoders/{novatel => oem}/test/resources/novatel_message_definitions.hpp (100%) rename src/decoders/{novatel => oem}/test/resources/proprietary_binary_sync_error.BIN (100%) rename src/decoders/{novatel => oem}/test/resources/short_ascii_sync_error.ASC (100%) rename src/decoders/{novatel => oem}/test/resources/short_binary_sync_error.BIN (100%) rename src/decoders/{novatel => oem}/test/rx_config_test.cpp (98%) delete mode 100644 src/hw_interface/CMakeLists.txt delete mode 100644 src/hw_interface/stream_interface/CMakeLists.txt create mode 100644 src/stream_interface/CMakeLists.txt rename src/{hw_interface => }/stream_interface/src/filestream.cpp (98%) rename src/{hw_interface => }/stream_interface/src/inputfilestream.cpp (98%) rename src/{hw_interface => }/stream_interface/src/multioutputfilestream.cpp (98%) rename src/{hw_interface => }/stream_interface/src/outputfilestream.cpp (97%) rename src/{hw_interface => }/stream_interface/test/CMakeLists.txt (77%) rename src/{hw_interface => }/stream_interface/test/filestreamunittest.cpp (98%) rename src/{hw_interface => }/stream_interface/test/inputfilestreamunittest.cpp (99%) rename src/{hw_interface => }/stream_interface/test/main.cpp (97%) rename src/{hw_interface => }/stream_interface/test/multioutputfilestreamunittest.cpp (99%) rename src/{hw_interface => }/stream_interface/test/outputfilestreamunittest.cpp (97%) rename src/{hw_interface => }/stream_interface/test/resources/decoder_bestpos.asc (100%) rename src/{hw_interface => }/stream_interface/test/resources/filestream_file2.asc (100%) rename "src/hw_interface/stream_interface/test/resources/filestream\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" => "src/stream_interface/test/resources/filestream\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" (100%) rename "src/hw_interface/stream_interface/test/resources/inputfilestream\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" => "src/stream_interface/test/resources/inputfilestream\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" (100%) rename src/{hw_interface => }/stream_interface/test/resources/outputfilestream_file1.asc (100%) rename src/{hw_interface => }/stream_interface/test/resources/outputfilestream_file2.asc (100%) rename src/{hw_interface => }/stream_interface/test/resources/outputfilestream_file3.asc (100%) rename src/{hw_interface => }/stream_interface/test/resources/outputfilestream_file4.asc (100%) rename src/{hw_interface => }/stream_interface/test/resources/streaminterface_testread.asc (100%) rename "src/hw_interface/stream_interface/test/resources/\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" => "src/stream_interface/test/resources/\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" (100%) diff --git a/.gitignore b/.gitignore index b6006c953..dab760d37 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,6 @@ bin/ venv/ CMakeSettings.json CMakeUserPresets.json -/src/version.h +/include/novatel_edie/version.h edie.*.log edie.log diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b0cc9a46..23198f078 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,9 +80,10 @@ endif() string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE) string(TOLOWER ${CMAKE_SYSTEM_NAME} OPERATING_SYSTEM) string(TOLOWER ${CMAKE_CXX_COMPILER_ID} COMPILER) -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${BUILD_TYPE} "${CMAKE_BINARY_DIR}/bin/${OPERATING_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR}-${COMPILER}-${CMAKE_BUILD_TYPE}") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${BUILD_TYPE} "${CMAKE_BINARY_DIR}/bin/${OPERATING_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR}-${COMPILER}-${CMAKE_BUILD_TYPE}") -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${BUILD_TYPE} "${CMAKE_BINARY_DIR}/bin/${OPERATING_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR}-${COMPILER}-${CMAKE_BUILD_TYPE}") +set(OUTPUT_DIR "${CMAKE_BINARY_DIR}/bin/${OPERATING_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR}-${COMPILER}-${CMAKE_BUILD_TYPE}") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${BUILD_TYPE} "${OUTPUT_DIR}") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${BUILD_TYPE} "${OUTPUT_DIR}") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${BUILD_TYPE} "${OUTPUT_DIR}") # Find Git package, if not need to install manually or through .yml file find_package(Git) @@ -98,26 +99,24 @@ endif() if(GIT_EXECUTABLE) execute_process(COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in - -D DST=${CMAKE_CURRENT_SOURCE_DIR}/src/version.h + -D DST=${CMAKE_CURRENT_SOURCE_DIR}/include/novatel_edie/version.h -D GIT_EXECUTABLE=${GIT_EXECUTABLE} -D GIT_BRANCH=${GIT_BRANCH} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/GenerateVersionHeader.cmake) endif() -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/src -) - # Build EDIE components -add_subdirectory(src/hw_interface) -add_subdirectory(src/decoders) +add_subdirectory(src/common) +add_subdirectory(src/stream_interface) +add_subdirectory(src/decoders/common) +add_subdirectory(src/decoders/oem) if(BUILD_TESTS) enable_testing() + add_subdirectory(src/common/test) + add_subdirectory(src/stream_interface/test) add_subdirectory(src/decoders/common/test) - add_subdirectory(src/decoders/novatel/test) - add_subdirectory(src/hw_interface/stream_interface/test) + add_subdirectory(src/decoders/oem/test) endif() if(BUILD_EXAMPLES) diff --git a/README.md b/README.md index aabebaa84..d36b23b97 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ The FileParser class provides an interface for parsing GPS files. ```cpp #include -#include "decoders/novatel/api/fileparser.hpp" +#include using namespace novatel::edie; using namespace novatel::edie::oem; @@ -209,7 +209,7 @@ Note that all fields must be provided in the abbreviated ASCII string command in ```cpp #include -#include "decoders/novatel/api/commander.hpp" +#include using namespace novatel::edie; using namespace novatel::edie::oem; diff --git a/docs/conf.py b/docs/conf.py index 53ef6fcfe..b26344c37 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,7 +15,6 @@ # import os # import sys # sys.path.insert(0, os.path.abspath('.')) -import textwrap # -- Project information ----------------------------------------------------- @@ -81,11 +80,5 @@ # TIP: if using the sphinx-bootstrap-theme, you need # "treeViewIsBootstrap": True, "exhaleExecutesDoxygen": True, - "exhaleDoxygenStdin": textwrap.dedent(''' - INPUT = ../src/decoders/common/api - INPUT += ../src/decoders/dynamic_library/api - INPUT += ../src/decoders/novatel/api - INPUT += ../src/hw_interface/dynamic_library/api - INPUT += ../src/hw_interface/stream_interface/api - ''') + "exhaleDoxygenStdin": "INPUT = ../include", } diff --git a/examples/novatel/command_encoding/CMakeLists.txt b/examples/novatel/command_encoding/CMakeLists.txt index 4362a7802..280b431e7 100644 --- a/examples/novatel/command_encoding/CMakeLists.txt +++ b/examples/novatel/command_encoding/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "command_encoding") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} common novatel stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/command_encoding/command_encoding.cpp b/examples/novatel/command_encoding/command_encoding.cpp index ee15651e3..16797fe18 100644 --- a/examples/novatel/command_encoding/command_encoding.cpp +++ b/examples/novatel/command_encoding/command_encoding.cpp @@ -29,8 +29,9 @@ #include #include -#include -#include +#include +#include +#include namespace fs = std::filesystem; diff --git a/examples/novatel/converter_components/CMakeLists.txt b/examples/novatel/converter_components/CMakeLists.txt index 80a45ef2b..31afda08b 100644 --- a/examples/novatel/converter_components/CMakeLists.txt +++ b/examples/novatel/converter_components/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "converter_components") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} common novatel stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/converter_components/converter_components.cpp b/examples/novatel/converter_components/converter_components.cpp index d40e94bcc..7d09944e6 100644 --- a/examples/novatel/converter_components/converter_components.cpp +++ b/examples/novatel/converter_components/converter_components.cpp @@ -29,16 +29,16 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace fs = std::filesystem; diff --git a/examples/novatel/converter_file_parser/CMakeLists.txt b/examples/novatel/converter_file_parser/CMakeLists.txt index 7d29d2797..9827f7960 100644 --- a/examples/novatel/converter_file_parser/CMakeLists.txt +++ b/examples/novatel/converter_file_parser/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "converter_file_parser") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} common novatel stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/converter_file_parser/converter_file_parser.cpp b/examples/novatel/converter_file_parser/converter_file_parser.cpp index 4be657672..98a34cf8c 100644 --- a/examples/novatel/converter_file_parser/converter_file_parser.cpp +++ b/examples/novatel/converter_file_parser/converter_file_parser.cpp @@ -29,10 +29,11 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace fs = std::filesystem; diff --git a/examples/novatel/converter_parser/CMakeLists.txt b/examples/novatel/converter_parser/CMakeLists.txt index 04b158d04..34e777128 100644 --- a/examples/novatel/converter_parser/CMakeLists.txt +++ b/examples/novatel/converter_parser/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "converter_parser") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} common novatel stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/converter_parser/converter_parser.cpp b/examples/novatel/converter_parser/converter_parser.cpp index c8e1b202b..ca407f48c 100644 --- a/examples/novatel/converter_parser/converter_parser.cpp +++ b/examples/novatel/converter_parser/converter_parser.cpp @@ -27,10 +27,11 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace fs = std::filesystem; diff --git a/examples/novatel/json_parser/CMakeLists.txt b/examples/novatel/json_parser/CMakeLists.txt index 2caba5319..268e6456f 100644 --- a/examples/novatel/json_parser/CMakeLists.txt +++ b/examples/novatel/json_parser/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "json_parser") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} common novatel stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/json_parser/json_parser.cpp b/examples/novatel/json_parser/json_parser.cpp index fec56f40b..85cc67e36 100644 --- a/examples/novatel/json_parser/json_parser.cpp +++ b/examples/novatel/json_parser/json_parser.cpp @@ -27,10 +27,11 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace fs = std::filesystem; diff --git a/examples/novatel/range_decompressor/CMakeLists.txt b/examples/novatel/range_decompressor/CMakeLists.txt index cf9504f94..88c1a6e5b 100644 --- a/examples/novatel/range_decompressor/CMakeLists.txt +++ b/examples/novatel/range_decompressor/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "range_decompressor") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} common novatel stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/range_decompressor/range_decompressor.cpp b/examples/novatel/range_decompressor/range_decompressor.cpp index 31237d10c..9b24ca4c5 100644 --- a/examples/novatel/range_decompressor/range_decompressor.cpp +++ b/examples/novatel/range_decompressor/range_decompressor.cpp @@ -24,19 +24,19 @@ // ! \file range_decompressor_example.cpp // =============================================================================== -#include "src/decoders/novatel/api/rangecmp/range_decompressor.hpp" - #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace fs = std::filesystem; diff --git a/examples/novatel/rangecmp/CMakeLists.txt b/examples/novatel/rangecmp/CMakeLists.txt index cf9504f94..88c1a6e5b 100644 --- a/examples/novatel/rangecmp/CMakeLists.txt +++ b/examples/novatel/rangecmp/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "range_decompressor") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} common novatel stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/rxconfig_handler/CMakeLists.txt b/examples/novatel/rxconfig_handler/CMakeLists.txt index 1634204e2..6ce805b63 100644 --- a/examples/novatel/rxconfig_handler/CMakeLists.txt +++ b/examples/novatel/rxconfig_handler/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "rxconfig_handler") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} common novatel stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/rxconfig_handler/rxconfig_handler.cpp b/examples/novatel/rxconfig_handler/rxconfig_handler.cpp index 3415e6952..31edf032a 100644 --- a/examples/novatel/rxconfig_handler/rxconfig_handler.cpp +++ b/examples/novatel/rxconfig_handler/rxconfig_handler.cpp @@ -24,15 +24,15 @@ // ! \file rxconfig_example.cpp // =============================================================================== -#include "src/decoders/novatel/api/rxconfig/rxconfig_handler.hpp" - #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace fs = std::filesystem; diff --git a/src/decoders/common/api/circular_buffer.hpp b/include/novatel_edie/common/circular_buffer.hpp similarity index 100% rename from src/decoders/common/api/circular_buffer.hpp rename to include/novatel_edie/common/circular_buffer.hpp diff --git a/include/novatel_edie/common/common.hpp b/include/novatel_edie/common/common.hpp new file mode 100644 index 000000000..63c167d59 --- /dev/null +++ b/include/novatel_edie/common/common.hpp @@ -0,0 +1,84 @@ +// =============================================================================== +// | | +// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | +// | | +// | Permission is hereby granted, free of charge, to any person obtaining a | +// | copy of this software and associated documentation files (the "Software"), | +// | to deal in the Software without restriction, including without limitation | +// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | +// | and/or sell copies of the Software, and to permit persons to whom the | +// | Software is furnished to do so, subject to the following conditions: | +// | | +// | The above copyright notice and this permission notice shall be included | +// | in all copies or substantial portions of the Software. | +// | | +// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | +// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | +// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | +// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | +// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | +// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | +// | DEALINGS IN THE SOFTWARE. | +// | | +// =============================================================================== +// ! \file common.hpp +// =============================================================================== + +#ifndef COMMON_COMMON_HPP +#define COMMON_COMMON_HPP + +#include + +namespace novatel::edie { + +//----------------------------------------------------------------------- +//! \enum TIME_STATUS +//! \brief Enumeration describing the time status on a NovAtel receiver +//! when a log is produced. See GPS Reference Time Status. +//----------------------------------------------------------------------- +enum class TIME_STATUS +{ + UNKNOWN = 20, //!< Time validity is unknown. + APPROXIMATE = 60, //!< Time is set approximately. + COARSEADJUSTING = 80, //!< Time is approaching coarse precision. + COARSE = 100, //!< This time is valid to coarse precision. + COARSESTEERING = 120, //!< Time is coarse set and is being steered. + FREEWHEELING = 130, //!< Position is lost and the range bias cannot be calculated. + FINEADJUSTING = 140, //!< Time is adjusting to fine precision. + FINE = 160, //!< Time has fine precision. + FINEBACKUPSTEERING = 170, //!< Time is fine set and is being steered by the backup system. + FINESTEERING = 180, //!< Time is fine set and is being steered. + SATTIME = 200, //!< Time from satellite. Only used in logs containing satellite data such as ephemeris and almanac. + EXTERN = 220, //!< Time source is external to the Receiver. + EXACT = 240 //!< Time is exact. +}; + +//----------------------------------------------------------------------- +//! \brief Compare two double values. +// +//! \param[in] dVal1_ First double type Value. +//! \param[in] dVal2_ Second double type value. +//! \param[in] dEpsilon_ The tolerance with which to justify "equal". +// +//! \return Boolean Value - Returns both values are equal or not? +//----------------------------------------------------------------------- +bool IsEqual(double dVal1_, double dVal2_, double dEpsilon_ = 0.001); + +//----------------------------------------------------------------------- +//! \brief Get the char as an integer. +// +//! \param[in] c_ The char to get as an integer. +// +//! \return The char as an integer. +//----------------------------------------------------------------------- +int32_t ToDigit(char c_); + +//----------------------------------------------------------------------- +// Common miscellaneous defines +//----------------------------------------------------------------------- +constexpr uint32_t SEC_TO_MILLI_SEC = 1000; //!< A Macro definition for number of milliseconds in a second. +constexpr uint32_t SECS_IN_WEEK = 604800; //!< A Macro definition for number of milliseconds in a week. + +} // namespace novatel::edie + +#endif diff --git a/src/decoders/common/api/crc32.hpp b/include/novatel_edie/common/crc32.hpp similarity index 100% rename from src/decoders/common/api/crc32.hpp rename to include/novatel_edie/common/crc32.hpp diff --git a/src/decoders/common/api/logger.hpp b/include/novatel_edie/common/logger.hpp similarity index 100% rename from src/decoders/common/api/logger.hpp rename to include/novatel_edie/common/logger.hpp diff --git a/src/decoders/common/api/nexcept.hpp b/include/novatel_edie/common/nexcept.hpp similarity index 100% rename from src/decoders/common/api/nexcept.hpp rename to include/novatel_edie/common/nexcept.hpp diff --git a/src/decoders/common/api/common.hpp b/include/novatel_edie/decoders/common/common.hpp similarity index 87% rename from src/decoders/common/api/common.hpp rename to include/novatel_edie/decoders/common/common.hpp index b8f832de5..b745cb485 100644 --- a/src/decoders/common/api/common.hpp +++ b/include/novatel_edie/decoders/common/common.hpp @@ -24,13 +24,15 @@ // ! \file common.hpp // =============================================================================== -#ifndef COMMON_HPP -#define COMMON_HPP +#ifndef DECODERS_COMMON_HPP +#define DECODERS_COMMON_HPP #include #include #include +#include "novatel_edie/common/common.hpp" + namespace novatel::edie { //----------------------------------------------------------------------- @@ -127,28 +129,6 @@ inline std::ostream& operator<<(std::ostream& os_, const ENCODE_FORMAT eFormat_) return os_; } -//----------------------------------------------------------------------- -//! \enum TIME_STATUS -//! \brief Enumeration describing the time status on a NovAtel receiver -//! when a log is produced. See GPS Reference Time Status. -//----------------------------------------------------------------------- -enum class TIME_STATUS -{ - UNKNOWN = 20, //!< Time validity is unknown. - APPROXIMATE = 60, //!< Time is set approximately. - COARSEADJUSTING = 80, //!< Time is approaching coarse precision. - COARSE = 100, //!< This time is valid to coarse precision. - COARSESTEERING = 120, //!< Time is coarse set and is being steered. - FREEWHEELING = 130, //!< Position is lost and the range bias cannot be calculated. - FINEADJUSTING = 140, //!< Time is adjusting to fine precision. - FINE = 160, //!< Time has fine precision. - FINEBACKUPSTEERING = 170, //!< Time is fine set and is being steered by the backup system. - FINESTEERING = 180, //!< Time is fine set and is being steered. - SATTIME = 200, //!< Time from satellite. Only used in logs containing satellite data such as ephemeris and almanac. - EXTERN = 220, //!< Time source is external to the Receiver. - EXACT = 240 //!< Time is exact. -}; - //----------------------------------------------------------------------- //! \enum HEADER_FORMAT //! \brief Header formats of messages. @@ -295,17 +275,6 @@ inline MetaDataBase::~MetaDataBase() = default; } // namespace novatel::edie -//----------------------------------------------------------------------- -//! \brief Compare two double values. -// -//! \param[in] dVal1_ First double type Value. -//! \param[in] dVal2_ Second double type value. -//! \param[in] dEpsilon_ The tolerance with which to justify "equal". -// -//! \return Boolean Value - Returns both values are equal or not? -//----------------------------------------------------------------------- -bool IsEqual(double dVal1_, double dVal2_, double dEpsilon_ = 0.001); - //----------------------------------------------------------------------- //! \brief Construct a full message ID from its parts. // @@ -373,15 +342,6 @@ int32_t GetEnumValue(const novatel::edie::EnumDefinition* stEnumDef_, const std: //----------------------------------------------------------------------- int32_t GetResponseId(const novatel::edie::EnumDefinition* stRespDef_, const std::string& strResp_); -//----------------------------------------------------------------------- -//! \brief Get the char as an integer. -// -//! \param[in] c_ The char to get as an integer. -// -//! \return The char as an integer. -//----------------------------------------------------------------------- -int32_t ToDigit(char c_); - //----------------------------------------------------------------------- //! \brief Strip abbreviated ASCII formatting from the front of the //! log buffer. @@ -414,12 +374,6 @@ struct SatelliteId } }; -//----------------------------------------------------------------------- -// Common miscellaneous defines -//----------------------------------------------------------------------- -constexpr uint32_t SEC_TO_MILLI_SEC = 1000; //!< A Macro definition for number of milliseconds in a second. -constexpr uint32_t SECS_IN_WEEK = 604800; //!< A Macro definition for number of milliseconds in a week. - //----------------------------------------------------------------------- // NovAtel message length defines //----------------------------------------------------------------------- diff --git a/src/decoders/common/api/encoder.hpp b/include/novatel_edie/decoders/common/encoder.hpp similarity index 98% rename from src/decoders/common/api/encoder.hpp rename to include/novatel_edie/decoders/common/encoder.hpp index 79cbab8f2..aca37c1af 100644 --- a/src/decoders/common/api/encoder.hpp +++ b/include/novatel_edie/decoders/common/encoder.hpp @@ -29,8 +29,9 @@ #include -#include "decoders/common/api/json_reader.hpp" -#include "decoders/common/api/message_decoder.hpp" +#include "novatel_edie/common/logger.hpp" +#include "novatel_edie/decoders/common/json_reader.hpp" +#include "novatel_edie/decoders/common/message_decoder.hpp" namespace novatel::edie { diff --git a/src/decoders/common/api/framer.hpp b/include/novatel_edie/decoders/common/framer.hpp similarity index 98% rename from src/decoders/common/api/framer.hpp rename to include/novatel_edie/decoders/common/framer.hpp index 72c7f4c8c..ba642a727 100644 --- a/src/decoders/common/api/framer.hpp +++ b/include/novatel_edie/decoders/common/framer.hpp @@ -29,8 +29,8 @@ #include -#include "circular_buffer.hpp" -#include "logger.hpp" +#include "novatel_edie/common/circular_buffer.hpp" +#include "novatel_edie/common/logger.hpp" //============================================================================ //! \class FramerBase diff --git a/src/decoders/common/api/json_reader.hpp b/include/novatel_edie/decoders/common/json_reader.hpp similarity index 99% rename from src/decoders/common/api/json_reader.hpp rename to include/novatel_edie/decoders/common/json_reader.hpp index db0099c7e..5b2070178 100644 --- a/src/decoders/common/api/json_reader.hpp +++ b/include/novatel_edie/decoders/common/json_reader.hpp @@ -29,19 +29,18 @@ #include #include -#include #include #include #include -#include "crc32.hpp" -#include "logger.hpp" - -using nlohmann::json; +#include "novatel_edie/common/crc32.hpp" +#include "novatel_edie/common/logger.hpp" namespace novatel::edie { +using nlohmann::json; + //============================================================================ //! \class JsonReaderFailure //! \brief Exception to be thrown when JsonReader fails to parse a JSON. diff --git a/src/decoders/common/api/message_decoder.hpp b/include/novatel_edie/decoders/common/message_decoder.hpp similarity index 97% rename from src/decoders/common/api/message_decoder.hpp rename to include/novatel_edie/decoders/common/message_decoder.hpp index 7018153b0..47372f819 100644 --- a/src/decoders/common/api/message_decoder.hpp +++ b/include/novatel_edie/decoders/common/message_decoder.hpp @@ -30,17 +30,13 @@ #include #include -#include - -#include "decoders/common/api/common.hpp" -#include "decoders/common/api/json_reader.hpp" -#include "decoders/common/api/logger.hpp" -#include "decoders/common/api/message_decoder.hpp" +#include "novatel_edie/common/logger.hpp" +#include "novatel_edie/decoders/common/common.hpp" +#include "novatel_edie/decoders/common/json_reader.hpp" +#include "novatel_edie/decoders/common/message_decoder.hpp" namespace novatel::edie { -using nlohmann::json; - struct FieldContainer; #define NOVATEL_TYPES bool, int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, float, double, std::string diff --git a/src/decoders/novatel/api/commander.hpp b/include/novatel_edie/decoders/oem/commander.hpp similarity index 96% rename from src/decoders/novatel/api/commander.hpp rename to include/novatel_edie/decoders/oem/commander.hpp index a9e5730a8..01242a024 100644 --- a/src/decoders/novatel/api/commander.hpp +++ b/include/novatel_edie/decoders/oem/commander.hpp @@ -27,11 +27,11 @@ #ifndef NOVATEL_COMMANDER_HPP #define NOVATEL_COMMANDER_HPP -#include "decoders/common/api/common.hpp" -#include "decoders/common/api/json_reader.hpp" -#include "decoders/novatel/api/common.hpp" -#include "decoders/novatel/api/encoder.hpp" -#include "decoders/novatel/api/message_decoder.hpp" +#include "novatel_edie/decoders/common/common.hpp" +#include "novatel_edie/decoders/common/json_reader.hpp" +#include "novatel_edie/decoders/oem/common.hpp" +#include "novatel_edie/decoders/oem/encoder.hpp" +#include "novatel_edie/decoders/oem/message_decoder.hpp" namespace novatel::edie::oem { diff --git a/src/decoders/novatel/api/common.hpp b/include/novatel_edie/decoders/oem/common.hpp similarity index 99% rename from src/decoders/novatel/api/common.hpp rename to include/novatel_edie/decoders/oem/common.hpp index 5e7def9a4..dd18c98a8 100644 --- a/src/decoders/novatel/api/common.hpp +++ b/include/novatel_edie/decoders/oem/common.hpp @@ -29,7 +29,7 @@ #include -#include "decoders/common/api/common.hpp" +#include "novatel_edie/decoders/common/common.hpp" namespace novatel::edie::oem { diff --git a/src/decoders/novatel/api/encoder.hpp b/include/novatel_edie/decoders/oem/encoder.hpp similarity index 97% rename from src/decoders/novatel/api/encoder.hpp rename to include/novatel_edie/decoders/oem/encoder.hpp index 048ff4a00..99c611529 100644 --- a/src/decoders/novatel/api/encoder.hpp +++ b/include/novatel_edie/decoders/oem/encoder.hpp @@ -27,15 +27,12 @@ #ifndef NOVATEL_ENCODER_HPP #define NOVATEL_ENCODER_HPP -#include - -#include "decoders/common/api/common.hpp" -#include "decoders/common/api/encoder.hpp" -#include "decoders/common/api/json_reader.hpp" -#include "decoders/common/api/message_decoder.hpp" -#include "decoders/novatel/api/common.hpp" - -using nlohmann::json; +#include "novatel_edie/common/logger.hpp" +#include "novatel_edie/decoders/common/common.hpp" +#include "novatel_edie/decoders/common/encoder.hpp" +#include "novatel_edie/decoders/common/json_reader.hpp" +#include "novatel_edie/decoders/common/message_decoder.hpp" +#include "novatel_edie/decoders/oem/common.hpp" namespace novatel::edie::oem { diff --git a/src/decoders/novatel/api/file_parser.hpp b/include/novatel_edie/decoders/oem/file_parser.hpp similarity index 98% rename from src/decoders/novatel/api/file_parser.hpp rename to include/novatel_edie/decoders/oem/file_parser.hpp index 43c501aa6..7506e732a 100644 --- a/src/decoders/novatel/api/file_parser.hpp +++ b/include/novatel_edie/decoders/oem/file_parser.hpp @@ -27,9 +27,9 @@ #ifndef NOVATEL_FILE_PARSER_HPP #define NOVATEL_FILE_PARSER_HPP -#include "decoders/common/api/common.hpp" -#include "decoders/novatel/api/parser.hpp" -#include "hw_interface/stream_interface/api/inputfilestream.hpp" +#include "novatel_edie/decoders/common/common.hpp" +#include "novatel_edie/decoders/oem/parser.hpp" +#include "novatel_edie/stream_interface/inputfilestream.hpp" namespace novatel::edie::oem { diff --git a/src/decoders/novatel/api/filter.hpp b/include/novatel_edie/decoders/oem/filter.hpp similarity index 98% rename from src/decoders/novatel/api/filter.hpp rename to include/novatel_edie/decoders/oem/filter.hpp index e63a7ed3c..12e8c0f36 100644 --- a/src/decoders/novatel/api/filter.hpp +++ b/include/novatel_edie/decoders/oem/filter.hpp @@ -30,10 +30,10 @@ #include #include -#include "decoders/common/api/common.hpp" -#include "decoders/common/api/logger.hpp" -#include "decoders/novatel/api/common.hpp" -#include "decoders/novatel/api/header_decoder.hpp" +#include "novatel_edie/common/logger.hpp" +#include "novatel_edie/decoders/common/common.hpp" +#include "novatel_edie/decoders/oem/common.hpp" +#include "novatel_edie/decoders/oem/header_decoder.hpp" namespace novatel::edie::oem { diff --git a/src/decoders/novatel/api/framer.hpp b/include/novatel_edie/decoders/oem/framer.hpp similarity index 97% rename from src/decoders/novatel/api/framer.hpp rename to include/novatel_edie/decoders/oem/framer.hpp index 4354c45ac..ffbf5ce5a 100644 --- a/src/decoders/novatel/api/framer.hpp +++ b/include/novatel_edie/decoders/oem/framer.hpp @@ -27,8 +27,8 @@ #ifndef NOVATEL_FRAMER_HPP #define NOVATEL_FRAMER_HPP -#include "decoders/common/api/framer.hpp" -#include "decoders/novatel/api/common.hpp" +#include "novatel_edie/decoders/common/framer.hpp" +#include "novatel_edie/decoders/oem/common.hpp" namespace novatel::edie::oem { diff --git a/src/decoders/novatel/api/header_decoder.hpp b/include/novatel_edie/decoders/oem/header_decoder.hpp similarity index 96% rename from src/decoders/novatel/api/header_decoder.hpp rename to include/novatel_edie/decoders/oem/header_decoder.hpp index 49ff1f830..d12d3ead4 100644 --- a/src/decoders/novatel/api/header_decoder.hpp +++ b/include/novatel_edie/decoders/oem/header_decoder.hpp @@ -27,12 +27,10 @@ #ifndef NOVATEL_HEADER_DECODER_HPP #define NOVATEL_HEADER_DECODER_HPP -#include - -#include "decoders/common/api/common.hpp" -#include "decoders/common/api/json_reader.hpp" -#include "decoders/common/api/logger.hpp" -#include "decoders/novatel/api/common.hpp" +#include "novatel_edie/common/logger.hpp" +#include "novatel_edie/decoders/common/common.hpp" +#include "novatel_edie/decoders/common/json_reader.hpp" +#include "novatel_edie/decoders/oem/common.hpp" namespace novatel::edie::oem { diff --git a/src/decoders/novatel/api/message_decoder.hpp b/include/novatel_edie/decoders/oem/message_decoder.hpp similarity index 97% rename from src/decoders/novatel/api/message_decoder.hpp rename to include/novatel_edie/decoders/oem/message_decoder.hpp index 85a3a9250..95cb8a4ee 100644 --- a/src/decoders/novatel/api/message_decoder.hpp +++ b/include/novatel_edie/decoders/oem/message_decoder.hpp @@ -27,7 +27,7 @@ #ifndef OEM_MESSAGE_DECODER_HPP #define OEM_MESSAGE_DECODER_HPP -#include "decoders/common/api/message_decoder.hpp" +#include "novatel_edie/decoders/common/message_decoder.hpp" namespace novatel::edie::oem { diff --git a/src/decoders/novatel/api/parser.hpp b/include/novatel_edie/decoders/oem/parser.hpp similarity index 96% rename from src/decoders/novatel/api/parser.hpp rename to include/novatel_edie/decoders/oem/parser.hpp index ca16867ae..d42f485ff 100644 --- a/src/decoders/novatel/api/parser.hpp +++ b/include/novatel_edie/decoders/oem/parser.hpp @@ -27,15 +27,15 @@ #ifndef NOVATEL_PARSER_HPP #define NOVATEL_PARSER_HPP -#include "decoders/common/api/common.hpp" -#include "decoders/common/api/logger.hpp" -#include "decoders/novatel/api/common.hpp" -#include "decoders/novatel/api/encoder.hpp" -#include "decoders/novatel/api/filter.hpp" -#include "decoders/novatel/api/framer.hpp" -#include "decoders/novatel/api/header_decoder.hpp" -#include "decoders/novatel/api/rangecmp/range_decompressor.hpp" -#include "decoders/novatel/api/rxconfig/rxconfig_handler.hpp" +#include "novatel_edie/common/logger.hpp" +#include "novatel_edie/decoders/common/common.hpp" +#include "novatel_edie/decoders/oem/common.hpp" +#include "novatel_edie/decoders/oem/encoder.hpp" +#include "novatel_edie/decoders/oem/filter.hpp" +#include "novatel_edie/decoders/oem/framer.hpp" +#include "novatel_edie/decoders/oem/header_decoder.hpp" +#include "novatel_edie/decoders/oem/rangecmp/range_decompressor.hpp" +#include "novatel_edie/decoders/oem/rxconfig/rxconfig_handler.hpp" namespace novatel::edie::oem { diff --git a/src/decoders/novatel/api/rangecmp/common.hpp b/include/novatel_edie/decoders/oem/rangecmp/common.hpp similarity index 100% rename from src/decoders/novatel/api/rangecmp/common.hpp rename to include/novatel_edie/decoders/oem/rangecmp/common.hpp diff --git a/src/decoders/novatel/api/rangecmp/range_decompressor.hpp b/include/novatel_edie/decoders/oem/rangecmp/range_decompressor.hpp similarity index 96% rename from src/decoders/novatel/api/rangecmp/range_decompressor.hpp rename to include/novatel_edie/decoders/oem/rangecmp/range_decompressor.hpp index ffa568e4f..7ba4a88db 100644 --- a/src/decoders/novatel/api/rangecmp/range_decompressor.hpp +++ b/include/novatel_edie/decoders/oem/rangecmp/range_decompressor.hpp @@ -27,11 +27,11 @@ #ifndef RANGE_DECOMPRESSOR_HPP #define RANGE_DECOMPRESSOR_HPP -#include "decoders/novatel/api/encoder.hpp" -#include "decoders/novatel/api/filter.hpp" -#include "decoders/novatel/api/header_decoder.hpp" -#include "decoders/novatel/api/message_decoder.hpp" -#include "decoders/novatel/api/rangecmp/common.hpp" +#include "novatel_edie/decoders/oem/encoder.hpp" +#include "novatel_edie/decoders/oem/filter.hpp" +#include "novatel_edie/decoders/oem/header_decoder.hpp" +#include "novatel_edie/decoders/oem/message_decoder.hpp" +#include "novatel_edie/decoders/oem/rangecmp/common.hpp" namespace novatel::edie::oem { diff --git a/src/decoders/novatel/api/rxconfig/rxconfig_handler.hpp b/include/novatel_edie/decoders/oem/rxconfig/rxconfig_handler.hpp similarity index 95% rename from src/decoders/novatel/api/rxconfig/rxconfig_handler.hpp rename to include/novatel_edie/decoders/oem/rxconfig/rxconfig_handler.hpp index 4e5f25d92..8a8500e41 100644 --- a/src/decoders/novatel/api/rxconfig/rxconfig_handler.hpp +++ b/include/novatel_edie/decoders/oem/rxconfig/rxconfig_handler.hpp @@ -27,13 +27,13 @@ #ifndef RXCONFIG_HANDLER_HPP #define RXCONFIG_HANDLER_HPP -#include "decoders/common/api/common.hpp" -#include "decoders/common/api/json_reader.hpp" -#include "decoders/novatel/api/common.hpp" -#include "decoders/novatel/api/encoder.hpp" -#include "decoders/novatel/api/framer.hpp" -#include "decoders/novatel/api/header_decoder.hpp" -#include "decoders/novatel/api/message_decoder.hpp" +#include "novatel_edie/decoders/common/common.hpp" +#include "novatel_edie/decoders/common/json_reader.hpp" +#include "novatel_edie/decoders/oem/common.hpp" +#include "novatel_edie/decoders/oem/encoder.hpp" +#include "novatel_edie/decoders/oem/framer.hpp" +#include "novatel_edie/decoders/oem/header_decoder.hpp" +#include "novatel_edie/decoders/oem/message_decoder.hpp" namespace novatel::edie::oem { diff --git a/src/hw_interface/stream_interface/api/common.hpp b/include/novatel_edie/stream_interface/common.hpp similarity index 98% rename from src/hw_interface/stream_interface/api/common.hpp rename to include/novatel_edie/stream_interface/common.hpp index 2d97931f5..6aa867708 100644 --- a/src/hw_interface/stream_interface/api/common.hpp +++ b/include/novatel_edie/stream_interface/common.hpp @@ -27,8 +27,6 @@ #ifndef STREAM_INTERFACE_COMMON_HPP #define STREAM_INTERFACE_COMMON_HPP -#include "decoders/common/api/common.hpp" - /*! An Enum. * * Splitting type of log enumeration while writing to different output files. diff --git a/src/hw_interface/stream_interface/api/filestream.hpp b/include/novatel_edie/stream_interface/filestream.hpp similarity index 99% rename from src/hw_interface/stream_interface/api/filestream.hpp rename to include/novatel_edie/stream_interface/filestream.hpp index 82ec30ac7..d5017fc74 100644 --- a/src/hw_interface/stream_interface/api/filestream.hpp +++ b/include/novatel_edie/stream_interface/filestream.hpp @@ -30,7 +30,7 @@ #include #include -#include "common.hpp" +#include "novatel_edie/stream_interface/common.hpp" /*! \class FileStream * \brief A class will provide file operation handlers. diff --git a/src/hw_interface/stream_interface/api/inputfilestream.hpp b/include/novatel_edie/stream_interface/inputfilestream.hpp similarity index 98% rename from src/hw_interface/stream_interface/api/inputfilestream.hpp rename to include/novatel_edie/stream_interface/inputfilestream.hpp index f4ca75a7b..873666c96 100644 --- a/src/hw_interface/stream_interface/api/inputfilestream.hpp +++ b/include/novatel_edie/stream_interface/inputfilestream.hpp @@ -27,8 +27,8 @@ #ifndef INPUT_FILE_STREAM_HPP #define INPUT_FILE_STREAM_HPP -#include "filestream.hpp" -#include "inputstreaminterface.hpp" +#include "novatel_edie/stream_interface/filestream.hpp" +#include "novatel_edie/stream_interface/inputstreaminterface.hpp" /*! \class InputFileStream * \brief A Derived class will be used by decoder, if the decoded input is file. diff --git a/src/hw_interface/stream_interface/api/inputmemorystream.hpp b/include/novatel_edie/stream_interface/inputmemorystream.hpp similarity index 97% rename from src/hw_interface/stream_interface/api/inputmemorystream.hpp rename to include/novatel_edie/stream_interface/inputmemorystream.hpp index b26703de9..9d30ea460 100644 --- a/src/hw_interface/stream_interface/api/inputmemorystream.hpp +++ b/include/novatel_edie/stream_interface/inputmemorystream.hpp @@ -36,8 +36,8 @@ #ifndef INPUTMEMORYSTREAM_HPP #define INPUTMEMORYSTREAM_HPP -#include "inputstreaminterface.hpp" -#include "memorystream.hpp" +#include "novatel_edie/stream_interface/inputstreaminterface.hpp" +#include "novatel_edie/stream_interface/memorystream.hpp" /*! \class InputMemoryStream * \brief A Derived Class for writing buffer data to circullar buffer which will be used for diff --git a/src/hw_interface/stream_interface/api/inputstreaminterface.hpp b/include/novatel_edie/stream_interface/inputstreaminterface.hpp similarity index 99% rename from src/hw_interface/stream_interface/api/inputstreaminterface.hpp rename to include/novatel_edie/stream_interface/inputstreaminterface.hpp index 02c39ab78..00c22e5ad 100644 --- a/src/hw_interface/stream_interface/api/inputstreaminterface.hpp +++ b/include/novatel_edie/stream_interface/inputstreaminterface.hpp @@ -29,7 +29,7 @@ #include -#include "common.hpp" +#include "novatel_edie/stream_interface/common.hpp" //----------------------------------------------------------------------- // Globals diff --git a/src/hw_interface/stream_interface/api/memorystream.hpp b/include/novatel_edie/stream_interface/memorystream.hpp similarity index 98% rename from src/hw_interface/stream_interface/api/memorystream.hpp rename to include/novatel_edie/stream_interface/memorystream.hpp index ead8ef87d..29a54da3e 100644 --- a/src/hw_interface/stream_interface/api/memorystream.hpp +++ b/include/novatel_edie/stream_interface/memorystream.hpp @@ -28,8 +28,7 @@ #define MEMORYSTREAM_HPP #include "common.hpp" -#include "decoders/common/api/circular_buffer.hpp" -#include "decoders/common/api/common.hpp" +#include "novatel_edie/common/circular_buffer.hpp" /*! \class MemoryStream * \brief Derived class from parent CircularBuffer. diff --git a/src/hw_interface/stream_interface/api/multioutputfilestream.hpp b/include/novatel_edie/stream_interface/multioutputfilestream.hpp similarity index 98% rename from src/hw_interface/stream_interface/api/multioutputfilestream.hpp rename to include/novatel_edie/stream_interface/multioutputfilestream.hpp index 8387778d4..3906ccde2 100644 --- a/src/hw_interface/stream_interface/api/multioutputfilestream.hpp +++ b/include/novatel_edie/stream_interface/multioutputfilestream.hpp @@ -30,10 +30,9 @@ #include #include -#include "decoders/common/api/common.hpp" -#include "decoders/novatel/api/common.hpp" -#include "filestream.hpp" -#include "outputstreaminterface.hpp" +#include "novatel_edie/common/common.hpp" +#include "novatel_edie/stream_interface/filestream.hpp" +#include "novatel_edie/stream_interface/outputstreaminterface.hpp" /*! \def MIN_TIME_SPLIT_SEC * \brief Minimum split time in seconds. diff --git a/src/hw_interface/stream_interface/api/outputfilestream.hpp b/include/novatel_edie/stream_interface/outputfilestream.hpp similarity index 97% rename from src/hw_interface/stream_interface/api/outputfilestream.hpp rename to include/novatel_edie/stream_interface/outputfilestream.hpp index bac754360..1b739262f 100644 --- a/src/hw_interface/stream_interface/api/outputfilestream.hpp +++ b/include/novatel_edie/stream_interface/outputfilestream.hpp @@ -27,8 +27,8 @@ #ifndef OUTPUT_FILE_STREAM_HPP #define OUTPUT_FILE_STREAM_HPP -#include "filestream.hpp" -#include "outputstreaminterface.hpp" +#include "novatel_edie/stream_interface/filestream.hpp" +#include "novatel_edie/stream_interface/outputstreaminterface.hpp" /*! \class OutputFileStream * \brief A Derived class from parent interface class OutputStreamInterface. diff --git a/src/hw_interface/stream_interface/api/outputstreaminterface.hpp b/include/novatel_edie/stream_interface/outputstreaminterface.hpp similarity index 100% rename from src/hw_interface/stream_interface/api/outputstreaminterface.hpp rename to include/novatel_edie/stream_interface/outputstreaminterface.hpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 0851c518f..000000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_subdirectory(decoders) -add_subdirectory(hw_interface) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt new file mode 100644 index 000000000..7b129bf62 --- /dev/null +++ b/src/common/CMakeLists.txt @@ -0,0 +1,22 @@ +set(TARGET_NAME "common") +file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +add_library(${TARGET_NAME} STATIC ${SOURCES}) +add_library(novatel_edie::${TARGET_NAME} ALIAS ${TARGET_NAME}) +set_target_properties(${TARGET_NAME} PROPERTIES + OUTPUT_NAME "edie_${TARGET_NAME}" + FOLDER "common" +) +target_include_directories(${TARGET_NAME} PUBLIC + $ + $ +) +target_compile_features(${TARGET_NAME} PUBLIC cxx_std_17) + +find_package(spdlog REQUIRED CONFIG) +find_package(spdlog_setup REQUIRED CONFIG) + +target_link_libraries(${TARGET_NAME} PUBLIC + spdlog_setup::spdlog_setup + $ + $ +) diff --git a/src/decoders/common/src/circular_buffer.cpp b/src/common/src/circular_buffer.cpp similarity index 98% rename from src/decoders/common/src/circular_buffer.cpp rename to src/common/src/circular_buffer.cpp index e40ce5d47..1576a6f57 100644 --- a/src/decoders/common/src/circular_buffer.cpp +++ b/src/common/src/circular_buffer.cpp @@ -24,14 +24,14 @@ // ! \file circular_buffer.cpp // =============================================================================== -#include "decoders/common/api/circular_buffer.hpp" +#include "novatel_edie/common/circular_buffer.hpp" #include #include #include #include -#include "decoders/common/api/nexcept.hpp" +#include "novatel_edie/common/nexcept.hpp" //--------------------------------------------------------------------------- void CircularBuffer::SetCapacity(const uint32_t uiCapacity_) diff --git a/src/common/src/common.cpp b/src/common/src/common.cpp new file mode 100644 index 000000000..31a16206f --- /dev/null +++ b/src/common/src/common.cpp @@ -0,0 +1,44 @@ +// =============================================================================== +// | | +// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | +// | | +// | Permission is hereby granted, free of charge, to any person obtaining a | +// | copy of this software and associated documentation files (the "Software"), | +// | to deal in the Software without restriction, including without limitation | +// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | +// | and/or sell copies of the Software, and to permit persons to whom the | +// | Software is furnished to do so, subject to the following conditions: | +// | | +// | The above copyright notice and this permission notice shall be included | +// | in all copies or substantial portions of the Software. | +// | | +// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | +// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | +// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | +// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | +// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | +// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | +// | DEALINGS IN THE SOFTWARE. | +// | | +// =============================================================================== +// ! \file common.cpp +// =============================================================================== + +#include "novatel_edie/common/common.hpp" + +namespace novatel::edie { + +//----------------------------------------------------------------------- +bool IsEqual(const double dVal1_, const double dVal2_, const double dEpsilon_) +{ + double dDiff = dVal1_ - dVal2_; + + if (dDiff < 0) { dDiff *= -1.0; } + + return dDiff < dEpsilon_; +} + +//----------------------------------------------------------------------- +int32_t ToDigit(const char c_) { return c_ - '0'; } + +} // namespace novatel::edie diff --git a/src/common/test/CMakeLists.txt b/src/common/test/CMakeLists.txt new file mode 100644 index 000000000..0642a9dd9 --- /dev/null +++ b/src/common/test/CMakeLists.txt @@ -0,0 +1,7 @@ +set(TARGET_NAME "common_test") +file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +add_executable(${TARGET_NAME} ${SOURCES}) +set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "common/tests") +find_package(GTest REQUIRED CONFIG) +target_link_libraries(${TARGET_NAME} PUBLIC novatel_edie::common GTest::gtest GTest::gtest_main) +add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} ${CMAKE_SOURCE_DIR}) diff --git a/src/decoders/common/test/circular_buffer_unit_test.cpp b/src/common/test/circular_buffer_unit_test.cpp similarity index 92% rename from src/decoders/common/test/circular_buffer_unit_test.cpp rename to src/common/test/circular_buffer_unit_test.cpp index af94bc63e..8fabef642 100644 --- a/src/decoders/common/test/circular_buffer_unit_test.cpp +++ b/src/common/test/circular_buffer_unit_test.cpp @@ -26,19 +26,12 @@ #include -#include "decoders/common/api/circular_buffer.hpp" - -class CircularBufferTest : public ::testing::Test -{ - public: - void SetUp() override {} - void TearDown() override {} -}; +#include "novatel_edie/common/circular_buffer.hpp" // ------------------------------------------------------------------------------------------------------- // CircularBuffer Unit Tests // ------------------------------------------------------------------------------------------------------- -TEST_F(CircularBufferTest, SET_CAPACITY) +TEST(CircularBufferTest, SET_CAPACITY) { uint32_t uiCapacity = 100; CircularBuffer cCircularBuffer; @@ -60,7 +53,7 @@ TEST_F(CircularBufferTest, SET_CAPACITY) } } -TEST_F(CircularBufferTest, APPEND) +TEST(CircularBufferTest, APPEND) { const auto* pcData = "test data"; auto uiBytes = static_cast(strlen(pcData)); @@ -68,7 +61,7 @@ TEST_F(CircularBufferTest, APPEND) ASSERT_DOUBLE_EQ(cCircularBuffer.Append(reinterpret_cast(pcData), uiBytes), uiBytes); } -TEST_F(CircularBufferTest, GET_BYTE) +TEST(CircularBufferTest, GET_BYTE) { const auto* pcData = "test data"; auto uiBytes = static_cast(strlen(pcData)); @@ -86,7 +79,7 @@ TEST_F(CircularBufferTest, GET_BYTE) ASSERT_EQ(cCircularBuffer.GetByte(uiBytes), '\0'); } -TEST_F(CircularBufferTest, DISCARD) +TEST(CircularBufferTest, DISCARD) { const auto* pcData = "test data"; auto uiBytes = static_cast(strlen(pcData)); @@ -105,7 +98,7 @@ TEST_F(CircularBufferTest, DISCARD) cCircularBuffer.Discard(uiBytes + 1); } -TEST_F(CircularBufferTest, CLEAR) +TEST(CircularBufferTest, CLEAR) { std::string pcData("test data"); CircularBuffer cCircularBuffer; @@ -114,7 +107,7 @@ TEST_F(CircularBufferTest, CLEAR) ASSERT_TRUE(cCircularBuffer.GetLength() == 0); } -TEST_F(CircularBufferTest, COPY) +TEST(CircularBufferTest, COPY) { CircularBuffer cCircularBuffer; diff --git a/src/decoders/common/test/crc32_unit_test.cpp b/src/common/test/crc32_unit_test.cpp similarity index 88% rename from src/decoders/common/test/crc32_unit_test.cpp rename to src/common/test/crc32_unit_test.cpp index b30b48cf7..1b780608b 100644 --- a/src/decoders/common/test/crc32_unit_test.cpp +++ b/src/common/test/crc32_unit_test.cpp @@ -26,28 +26,21 @@ #include -#include "decoders/common/api/common.hpp" -#include "decoders/common/api/crc32.hpp" -#include "decoders/novatel/api/common.hpp" - -class CRC32Test : public testing::Test -{ - public: - void SetUp() override {} - void TearDown() override {} -}; +#include "novatel_edie/common/crc32.hpp" // ------------------------------------------------------------------------------------------------------- // CRC32 Unit Tests // ------------------------------------------------------------------------------------------------------- -TEST_F(CRC32Test, CalculateBlockCRC32) +TEST(CRC32Test, CalculateBlockCRC32) { std::string sMessage("#BESTPOSA,SPECIAL,0,72.5,FINESTEERING,2000,202512.000,02000020,b1f6,32768;SOL_COMPUTED," "SINGLE,17.44306884140,78.37411522222,649.8119,-76.8000,WGS84,0.9206,1.0236,1.9887,\"\",0." "000,0.000,34,34,34,34,00,06,39,33*42d4f5cc\r\n"); + const uint16_t OEM4_ASCII_CRC_LENGTH = 8; + uint32_t uiCalculatedCRC = 0; - uint64_t uiTerminatorIndex = sMessage.length() - (novatel::edie::oem::OEM4_ASCII_CRC_LENGTH + 3); + uint64_t uiTerminatorIndex = sMessage.length() - (OEM4_ASCII_CRC_LENGTH + 3); if (uiTerminatorIndex == 0) { return; } diff --git a/src/common/test/main.cpp b/src/common/test/main.cpp new file mode 100644 index 000000000..655b3da1e --- /dev/null +++ b/src/common/test/main.cpp @@ -0,0 +1,46 @@ +// =============================================================================== +// | | +// | COPYRIGHT NovAtel Inc, 2022. All rights reserved. | +// | | +// | Permission is hereby granted, free of charge, to any person obtaining a | +// | copy of this software and associated documentation files (the "Software"), | +// | to deal in the Software without restriction, including without limitation | +// | the rights to use, copy, modify, merge, publish, distribute, sublicense, | +// | and/or sell copies of the Software, and to permit persons to whom the | +// | Software is furnished to do so, subject to the following conditions: | +// | | +// | The above copyright notice and this permission notice shall be included | +// | in all copies or substantial portions of the Software. | +// | | +// | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | +// | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | +// | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | +// | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | +// | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | +// | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | +// | DEALINGS IN THE SOFTWARE. | +// | | +// =============================================================================== +// ! \file main.cpp +// =============================================================================== + +#include +#include + +#include + +#include "novatel_edie/common/logger.hpp" + +int main(int argc, char** argv) +{ + testing::InitGoogleTest(&argc, argv); + Logger::InitLogger(); + + if (argc != 2) { throw std::invalid_argument("1 argument required.\nUsage: "); } + + std::string strDatabaseVar = "TEST_DATABASE_PATH=" + std::string(argv[1]) + "/database/messages_public.json"; + + if (putenv(const_cast(strDatabaseVar.c_str())) != 0) { throw std::runtime_error("Failed to set db path."); } + + return RUN_ALL_TESTS(); +} diff --git a/src/decoders/CMakeLists.txt b/src/decoders/CMakeLists.txt deleted file mode 100644 index cedd748b0..000000000 --- a/src/decoders/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_subdirectory(common) -add_subdirectory(novatel) diff --git a/src/decoders/common/CMakeLists.txt b/src/decoders/common/CMakeLists.txt index 359fac069..9e9ce330c 100644 --- a/src/decoders/common/CMakeLists.txt +++ b/src/decoders/common/CMakeLists.txt @@ -1,19 +1,19 @@ -set(TARGET_NAME "common") +set(TARGET_NAME "decoders_common") file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) add_library(${TARGET_NAME} STATIC ${SOURCES}) -add_custom_command(TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/api/ ${CMAKE_SOURCE_DIR}/bin/api/decoders/${TARGET_NAME}/api/) -set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "decoders") -target_include_directories(${TARGET_NAME} PUBLIC api) - +add_library(novatel_edie::${TARGET_NAME} ALIAS ${TARGET_NAME}) +set_target_properties(${TARGET_NAME} PROPERTIES + OUTPUT_NAME "edie_${TARGET_NAME}" + FOLDER "decoders" +) +target_include_directories(${TARGET_NAME} PUBLIC + $ + $ +) target_compile_features(${TARGET_NAME} PUBLIC cxx_std_17) find_package(nlohmann_json REQUIRED CONFIG) -find_package(spdlog REQUIRED CONFIG) -find_package(spdlog_setup REQUIRED CONFIG) - target_link_libraries(${TARGET_NAME} PUBLIC + novatel_edie::common nlohmann_json::nlohmann_json - spdlog_setup::spdlog_setup - $ - $ ) diff --git a/src/decoders/common/src/common.cpp b/src/decoders/common/src/common.cpp index 1f9276b5c..ac2cac91b 100644 --- a/src/decoders/common/src/common.cpp +++ b/src/decoders/common/src/common.cpp @@ -24,9 +24,9 @@ // ! \file common.cpp // =============================================================================== -#include "common.hpp" +#include "novatel_edie/decoders/common/common.hpp" -#include "json_reader.hpp" +#include "novatel_edie/decoders/common/json_reader.hpp" using namespace novatel::edie; diff --git a/src/decoders/common/src/encoder.cpp b/src/decoders/common/src/encoder.cpp index 2cb9e12c7..08ba780ab 100644 --- a/src/decoders/common/src/encoder.cpp +++ b/src/decoders/common/src/encoder.cpp @@ -24,7 +24,7 @@ // ! \file encoder.cpp // =============================================================================== -#include "decoders/common/api/encoder.hpp" +#include "novatel_edie/decoders/common/encoder.hpp" #include diff --git a/src/decoders/common/src/json_reader.cpp b/src/decoders/common/src/json_reader.cpp index 2cc92f4f3..56da8bfb2 100644 --- a/src/decoders/common/src/json_reader.cpp +++ b/src/decoders/common/src/json_reader.cpp @@ -24,9 +24,9 @@ // ! \file json_reader.cpp // =============================================================================== -#include "json_reader.hpp" +#include "novatel_edie/decoders/common/json_reader.hpp" -#include "common.hpp" +#include "novatel_edie/decoders/common/common.hpp" namespace novatel::edie { diff --git a/src/decoders/common/src/message_decoder.cpp b/src/decoders/common/src/message_decoder.cpp index 378c3a385..3c1447940 100644 --- a/src/decoders/common/src/message_decoder.cpp +++ b/src/decoders/common/src/message_decoder.cpp @@ -24,7 +24,7 @@ // ! \file message_decoder.cpp // =============================================================================== -#include "decoders/common/api/message_decoder.hpp" +#include "novatel_edie/decoders/common/message_decoder.hpp" #include diff --git a/src/decoders/common/test/CMakeLists.txt b/src/decoders/common/test/CMakeLists.txt index fd901fdf7..12f8ee26a 100644 --- a/src/decoders/common/test/CMakeLists.txt +++ b/src/decoders/common/test/CMakeLists.txt @@ -1,8 +1,7 @@ -set(TARGET_NAME "common_test") +set(TARGET_NAME "decoders_common_test") file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) add_executable(${TARGET_NAME} ${SOURCES}) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "decoders/tests") -target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../../) find_package(GTest REQUIRED CONFIG) -target_link_libraries(${TARGET_NAME} PUBLIC common GTest::gtest GTest::gtest_main) +target_link_libraries(${TARGET_NAME} PUBLIC novatel_edie::decoders_common GTest::gtest GTest::gtest_main) add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} ${CMAKE_SOURCE_DIR}) diff --git a/src/decoders/common/test/json_reader_unit_test.cpp b/src/decoders/common/test/json_reader_unit_test.cpp index 802dc0548..5f73de838 100644 --- a/src/decoders/common/test/json_reader_unit_test.cpp +++ b/src/decoders/common/test/json_reader_unit_test.cpp @@ -28,8 +28,8 @@ #include -#include "decoders/common/api/common.hpp" -#include "decoders/common/api/json_reader.hpp" +#include "novatel_edie/decoders/common/common.hpp" +#include "novatel_edie/decoders/common/json_reader.hpp" using namespace novatel::edie; diff --git a/src/decoders/common/test/main.cpp b/src/decoders/common/test/main.cpp index 334b7a7e3..655b3da1e 100644 --- a/src/decoders/common/test/main.cpp +++ b/src/decoders/common/test/main.cpp @@ -29,7 +29,7 @@ #include -#include "src/decoders/common/api/logger.hpp" +#include "novatel_edie/common/logger.hpp" int main(int argc, char** argv) { diff --git a/src/decoders/common/test/message_decoder_unit_test.cpp b/src/decoders/common/test/message_decoder_unit_test.cpp index d84fa28d0..ea1cf112c 100644 --- a/src/decoders/common/test/message_decoder_unit_test.cpp +++ b/src/decoders/common/test/message_decoder_unit_test.cpp @@ -26,7 +26,7 @@ #include -#include "decoders/common/api/message_decoder.hpp" +#include "novatel_edie/decoders/common/message_decoder.hpp" using namespace novatel::edie; diff --git a/src/decoders/novatel/CMakeLists.txt b/src/decoders/novatel/CMakeLists.txt deleted file mode 100644 index c65e9d513..000000000 --- a/src/decoders/novatel/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -set(TARGET_NAME "novatel") -file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -add_library(${TARGET_NAME} STATIC ${SOURCES}) -add_custom_command(TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/api/ ${CMAKE_SOURCE_DIR}/bin/api/decoders/${TARGET_NAME}/api/) -set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "decoders") -target_link_libraries(${TARGET_NAME} PUBLIC stream_interface common) -target_include_directories(${TARGET_NAME} PUBLIC api) diff --git a/src/decoders/oem/CMakeLists.txt b/src/decoders/oem/CMakeLists.txt new file mode 100644 index 000000000..2a02e6ede --- /dev/null +++ b/src/decoders/oem/CMakeLists.txt @@ -0,0 +1,13 @@ +set(TARGET_NAME "oem_decoder") +file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +add_library(${TARGET_NAME} STATIC ${SOURCES}) +add_library(novatel_edie::${TARGET_NAME} ALIAS ${TARGET_NAME}) +set_target_properties(${TARGET_NAME} PROPERTIES + OUTPUT_NAME "edie_${TARGET_NAME}" + FOLDER "decoders" +) +target_link_libraries(${TARGET_NAME} PUBLIC novatel_edie::common decoders_common stream_interface) +target_include_directories(${TARGET_NAME} PUBLIC + $ + $ +) diff --git a/src/decoders/novatel/src/commander.cpp b/src/decoders/oem/src/commander.cpp similarity index 99% rename from src/decoders/novatel/src/commander.cpp rename to src/decoders/oem/src/commander.cpp index e3533fc44..2e892cebe 100644 --- a/src/decoders/novatel/src/commander.cpp +++ b/src/decoders/oem/src/commander.cpp @@ -24,7 +24,7 @@ // ! \file commander.cpp // =============================================================================== -#include "decoders/novatel/api/commander.hpp" +#include "novatel_edie/decoders/oem/commander.hpp" using namespace novatel::edie; using namespace novatel::edie::oem; diff --git a/src/decoders/novatel/src/encoder.cpp b/src/decoders/oem/src/encoder.cpp similarity index 99% rename from src/decoders/novatel/src/encoder.cpp rename to src/decoders/oem/src/encoder.cpp index 5599d07f3..0af9bb8a7 100644 --- a/src/decoders/novatel/src/encoder.cpp +++ b/src/decoders/oem/src/encoder.cpp @@ -24,7 +24,7 @@ // ! \file encoder.cpp // =============================================================================== -#include "decoders/novatel/api/encoder.hpp" +#include "novatel_edie/decoders/oem/encoder.hpp" #include diff --git a/src/decoders/novatel/src/file_parser.cpp b/src/decoders/oem/src/file_parser.cpp similarity index 99% rename from src/decoders/novatel/src/file_parser.cpp rename to src/decoders/oem/src/file_parser.cpp index 739a61d22..1d487939f 100644 --- a/src/decoders/novatel/src/file_parser.cpp +++ b/src/decoders/oem/src/file_parser.cpp @@ -24,7 +24,7 @@ // ! \file file_parser.cpp // =============================================================================== -#include "decoders/novatel/api/file_parser.hpp" +#include "novatel_edie/decoders/oem/file_parser.hpp" using namespace novatel::edie; using namespace novatel::edie::oem; diff --git a/src/decoders/novatel/src/filter.cpp b/src/decoders/oem/src/filter.cpp similarity index 99% rename from src/decoders/novatel/src/filter.cpp rename to src/decoders/oem/src/filter.cpp index 7fd95a64b..8263c16a8 100644 --- a/src/decoders/novatel/src/filter.cpp +++ b/src/decoders/oem/src/filter.cpp @@ -24,7 +24,7 @@ // ! \file filter.cpp // =============================================================================== -#include "decoders/novatel/api/filter.hpp" +#include "novatel_edie/decoders/oem/filter.hpp" #include diff --git a/src/decoders/novatel/src/framer.cpp b/src/decoders/oem/src/framer.cpp similarity index 99% rename from src/decoders/novatel/src/framer.cpp rename to src/decoders/oem/src/framer.cpp index 5fb10d351..5bd9ae0a1 100644 --- a/src/decoders/novatel/src/framer.cpp +++ b/src/decoders/oem/src/framer.cpp @@ -24,9 +24,9 @@ // ! \file framer.cpp // =============================================================================== -#include "framer.hpp" +#include "novatel_edie/decoders/oem/framer.hpp" -#include "src/decoders/common/api/crc32.hpp" +#include "novatel_edie/common/crc32.hpp" using namespace novatel::edie; using namespace novatel::edie::oem; diff --git a/src/decoders/novatel/src/header_decoder.cpp b/src/decoders/oem/src/header_decoder.cpp similarity index 99% rename from src/decoders/novatel/src/header_decoder.cpp rename to src/decoders/oem/src/header_decoder.cpp index 398f87fbb..16b4cf250 100644 --- a/src/decoders/novatel/src/header_decoder.cpp +++ b/src/decoders/oem/src/header_decoder.cpp @@ -24,7 +24,7 @@ // ! \file header_decoder.cpp // =============================================================================== -#include "decoders/novatel/api/header_decoder.hpp" +#include "novatel_edie/decoders/oem/header_decoder.hpp" #include diff --git a/src/decoders/novatel/src/message_decoder.cpp b/src/decoders/oem/src/message_decoder.cpp similarity index 99% rename from src/decoders/novatel/src/message_decoder.cpp rename to src/decoders/oem/src/message_decoder.cpp index 82568707d..33933dfe1 100644 --- a/src/decoders/novatel/src/message_decoder.cpp +++ b/src/decoders/oem/src/message_decoder.cpp @@ -24,7 +24,7 @@ // ! \file message_decoder.cpp // =============================================================================== -#include "decoders/novatel/api/message_decoder.hpp" +#include "novatel_edie/decoders/oem/message_decoder.hpp" #include #include diff --git a/src/decoders/novatel/src/parser.cpp b/src/decoders/oem/src/parser.cpp similarity index 99% rename from src/decoders/novatel/src/parser.cpp rename to src/decoders/oem/src/parser.cpp index fa04f67d4..3bb377645 100644 --- a/src/decoders/novatel/src/parser.cpp +++ b/src/decoders/oem/src/parser.cpp @@ -24,7 +24,7 @@ // ! \file parser.cpp // =============================================================================== -#include "parser.hpp" +#include "novatel_edie/decoders/oem/parser.hpp" using namespace novatel::edie; using namespace novatel::edie::oem; diff --git a/src/decoders/novatel/src/rangecmp/range_decompressor.cpp b/src/decoders/oem/src/rangecmp/range_decompressor.cpp similarity index 99% rename from src/decoders/novatel/src/rangecmp/range_decompressor.cpp rename to src/decoders/oem/src/rangecmp/range_decompressor.cpp index 6e6fc76a2..80852aba8 100644 --- a/src/decoders/novatel/src/rangecmp/range_decompressor.cpp +++ b/src/decoders/oem/src/rangecmp/range_decompressor.cpp @@ -24,7 +24,7 @@ // ! \file range_decompressor.cpp // =============================================================================== -#include "decoders/novatel/api/rangecmp/range_decompressor.hpp" +#include "novatel_edie/decoders/oem/rangecmp/range_decompressor.hpp" #include diff --git a/src/decoders/novatel/src/rxconfig/rxconfig_handler.cpp b/src/decoders/oem/src/rxconfig/rxconfig_handler.cpp similarity index 99% rename from src/decoders/novatel/src/rxconfig/rxconfig_handler.cpp rename to src/decoders/oem/src/rxconfig/rxconfig_handler.cpp index b23808e5c..4d767edf1 100644 --- a/src/decoders/novatel/src/rxconfig/rxconfig_handler.cpp +++ b/src/decoders/oem/src/rxconfig/rxconfig_handler.cpp @@ -24,7 +24,7 @@ // ! \file rxconfig_handler.cpp // =============================================================================== -#include "decoders/novatel/api/rxconfig/rxconfig_handler.hpp" +#include "novatel_edie/decoders/oem/rxconfig/rxconfig_handler.hpp" using namespace novatel::edie; using namespace novatel::edie::oem; diff --git a/src/decoders/novatel/test/CMakeLists.txt b/src/decoders/oem/test/CMakeLists.txt similarity index 75% rename from src/decoders/novatel/test/CMakeLists.txt rename to src/decoders/oem/test/CMakeLists.txt index 29bd8cb4a..9214d9963 100644 --- a/src/decoders/novatel/test/CMakeLists.txt +++ b/src/decoders/oem/test/CMakeLists.txt @@ -2,10 +2,9 @@ set(TARGET_NAME "novatel_test") file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) add_executable(${TARGET_NAME} ${SOURCES}) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "decoders/tests") -target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../../) find_package(GTest REQUIRED CONFIG) target_link_libraries(${TARGET_NAME} PUBLIC - novatel common stream_interface + novatel_edie::oem_decoder novatel_edie::stream_interface GTest::gtest GTest::gtest_main ) add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} ${CMAKE_SOURCE_DIR}) diff --git a/src/decoders/novatel/test/main.cpp b/src/decoders/oem/test/main.cpp similarity index 96% rename from src/decoders/novatel/test/main.cpp rename to src/decoders/oem/test/main.cpp index 0da9949a1..33ef7728c 100644 --- a/src/decoders/novatel/test/main.cpp +++ b/src/decoders/oem/test/main.cpp @@ -29,7 +29,7 @@ #include -#include "src/decoders/common/api/logger.hpp" +#include "novatel_edie/common/logger.hpp" int main(int argc, char** argv) { @@ -39,7 +39,7 @@ int main(int argc, char** argv) if (argc != 2) { throw std::invalid_argument("1 argument required.\nUsage: "); } std::string strDatabaseVar = "TEST_DATABASE_PATH=" + std::string(argv[1]) + "/database/messages_public.json"; - std::string strResourceVar = "TEST_RESOURCE_PATH=" + std::string(argv[1]) + "/src/decoders/novatel/test/resources/"; + std::string strResourceVar = "TEST_RESOURCE_PATH=" + std::string(argv[1]) + "/src/decoders/oem/test/resources/"; if (putenv(const_cast(strDatabaseVar.c_str())) != 0) { throw std::runtime_error("Failed to set db path."); } if (putenv(const_cast(strResourceVar.c_str())) != 0) { throw std::runtime_error("Failed to set resource path."); } diff --git a/src/decoders/novatel/test/novatel_test.cpp b/src/decoders/oem/test/novatel_test.cpp similarity index 99% rename from src/decoders/novatel/test/novatel_test.cpp rename to src/decoders/oem/test/novatel_test.cpp index ae38bd0cf..9fae3610d 100644 --- a/src/decoders/novatel/test/novatel_test.cpp +++ b/src/decoders/oem/test/novatel_test.cpp @@ -31,21 +31,18 @@ #include #include -#include - -#include "decoders/common/api/json_reader.hpp" -#include "decoders/common/api/message_decoder.hpp" -#include "decoders/novatel/api/commander.hpp" -#include "decoders/novatel/api/encoder.hpp" -#include "decoders/novatel/api/file_parser.hpp" -#include "decoders/novatel/api/filter.hpp" -#include "decoders/novatel/api/framer.hpp" -#include "decoders/novatel/api/header_decoder.hpp" -#include "hw_interface/stream_interface/api/inputfilestream.hpp" -#include "hw_interface/stream_interface/api/inputstreaminterface.hpp" -#include "resources/novatel_message_definitions.hpp" -using json = nlohmann::json; +#include "novatel_edie/decoders/common/json_reader.hpp" +#include "novatel_edie/decoders/common/message_decoder.hpp" +#include "novatel_edie/decoders/oem/commander.hpp" +#include "novatel_edie/decoders/oem/encoder.hpp" +#include "novatel_edie/decoders/oem/file_parser.hpp" +#include "novatel_edie/decoders/oem/filter.hpp" +#include "novatel_edie/decoders/oem/framer.hpp" +#include "novatel_edie/decoders/oem/header_decoder.hpp" +#include "novatel_edie/stream_interface/inputfilestream.hpp" +#include "novatel_edie/stream_interface/inputstreaminterface.hpp" +#include "resources/novatel_message_definitions.hpp" using namespace novatel::edie; using namespace novatel::edie::oem; diff --git a/src/decoders/novatel/test/proprietary_test.cpp b/src/decoders/oem/test/proprietary_test.cpp similarity index 99% rename from src/decoders/novatel/test/proprietary_test.cpp rename to src/decoders/oem/test/proprietary_test.cpp index a1b8dbbe2..bc3c449d9 100644 --- a/src/decoders/novatel/test/proprietary_test.cpp +++ b/src/decoders/oem/test/proprietary_test.cpp @@ -26,8 +26,8 @@ #include -#include "decoders/novatel/api/framer.hpp" -#include "hw_interface/stream_interface/api/inputfilestream.hpp" +#include "novatel_edie/decoders/oem/framer.hpp" +#include "novatel_edie/stream_interface/inputfilestream.hpp" using namespace novatel::edie; using namespace novatel::edie::oem; diff --git a/src/decoders/novatel/test/range_cmp_test.cpp b/src/decoders/oem/test/range_cmp_test.cpp similarity index 99% rename from src/decoders/novatel/test/range_cmp_test.cpp rename to src/decoders/oem/test/range_cmp_test.cpp index c0ec6d130..20a3c7c7e 100644 --- a/src/decoders/novatel/test/range_cmp_test.cpp +++ b/src/decoders/oem/test/range_cmp_test.cpp @@ -26,7 +26,7 @@ #include -#include "decoders/novatel/api/rangecmp/range_decompressor.hpp" +#include "novatel_edie/decoders/oem/rangecmp/range_decompressor.hpp" using namespace novatel::edie; using namespace novatel::edie::oem; diff --git a/src/decoders/novatel/test/resources/BESTUTMBIN.GPS b/src/decoders/oem/test/resources/BESTUTMBIN.GPS similarity index 100% rename from src/decoders/novatel/test/resources/BESTUTMBIN.GPS rename to src/decoders/oem/test/resources/BESTUTMBIN.GPS diff --git a/src/decoders/novatel/test/resources/abbreviated_ascii_sync_error.ASC b/src/decoders/oem/test/resources/abbreviated_ascii_sync_error.ASC similarity index 100% rename from src/decoders/novatel/test/resources/abbreviated_ascii_sync_error.ASC rename to src/decoders/oem/test/resources/abbreviated_ascii_sync_error.ASC diff --git a/src/decoders/novatel/test/resources/ascii_sync_error.ASC b/src/decoders/oem/test/resources/ascii_sync_error.ASC similarity index 100% rename from src/decoders/novatel/test/resources/ascii_sync_error.ASC rename to src/decoders/oem/test/resources/ascii_sync_error.ASC diff --git a/src/decoders/novatel/test/resources/binary_sync_error.BIN b/src/decoders/oem/test/resources/binary_sync_error.BIN similarity index 100% rename from src/decoders/novatel/test/resources/binary_sync_error.BIN rename to src/decoders/oem/test/resources/binary_sync_error.BIN diff --git a/src/decoders/novatel/test/resources/nmea_sync_error.txt b/src/decoders/oem/test/resources/nmea_sync_error.txt similarity index 100% rename from src/decoders/novatel/test/resources/nmea_sync_error.txt rename to src/decoders/oem/test/resources/nmea_sync_error.txt diff --git a/src/decoders/novatel/test/resources/novatel_message_definitions.hpp b/src/decoders/oem/test/resources/novatel_message_definitions.hpp similarity index 100% rename from src/decoders/novatel/test/resources/novatel_message_definitions.hpp rename to src/decoders/oem/test/resources/novatel_message_definitions.hpp diff --git a/src/decoders/novatel/test/resources/proprietary_binary_sync_error.BIN b/src/decoders/oem/test/resources/proprietary_binary_sync_error.BIN similarity index 100% rename from src/decoders/novatel/test/resources/proprietary_binary_sync_error.BIN rename to src/decoders/oem/test/resources/proprietary_binary_sync_error.BIN diff --git a/src/decoders/novatel/test/resources/short_ascii_sync_error.ASC b/src/decoders/oem/test/resources/short_ascii_sync_error.ASC similarity index 100% rename from src/decoders/novatel/test/resources/short_ascii_sync_error.ASC rename to src/decoders/oem/test/resources/short_ascii_sync_error.ASC diff --git a/src/decoders/novatel/test/resources/short_binary_sync_error.BIN b/src/decoders/oem/test/resources/short_binary_sync_error.BIN similarity index 100% rename from src/decoders/novatel/test/resources/short_binary_sync_error.BIN rename to src/decoders/oem/test/resources/short_binary_sync_error.BIN diff --git a/src/decoders/novatel/test/rx_config_test.cpp b/src/decoders/oem/test/rx_config_test.cpp similarity index 98% rename from src/decoders/novatel/test/rx_config_test.cpp rename to src/decoders/oem/test/rx_config_test.cpp index ad349952a..c30f4aa58 100644 --- a/src/decoders/novatel/test/rx_config_test.cpp +++ b/src/decoders/oem/test/rx_config_test.cpp @@ -29,10 +29,10 @@ #include -#include "decoders/common/api/common.hpp" -#include "decoders/common/api/json_reader.hpp" -#include "decoders/common/api/message_decoder.hpp" -#include "decoders/novatel/api/rxconfig/rxconfig_handler.hpp" +#include "novatel_edie/decoders/common/common.hpp" +#include "novatel_edie/decoders/common/json_reader.hpp" +#include "novatel_edie/decoders/common/message_decoder.hpp" +#include "novatel_edie/decoders/oem/rxconfig/rxconfig_handler.hpp" using namespace novatel::edie; using namespace novatel::edie::oem; diff --git a/src/hw_interface/CMakeLists.txt b/src/hw_interface/CMakeLists.txt deleted file mode 100644 index 1fff52379..000000000 --- a/src/hw_interface/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(stream_interface) diff --git a/src/hw_interface/stream_interface/CMakeLists.txt b/src/hw_interface/stream_interface/CMakeLists.txt deleted file mode 100644 index 3edd12b68..000000000 --- a/src/hw_interface/stream_interface/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -set(TARGET_NAME "stream_interface") -file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -add_library(${TARGET_NAME} STATIC ${SOURCES}) -target_link_libraries(${TARGET_NAME} PRIVATE common) -add_custom_command(TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/api/ ${CMAKE_SOURCE_DIR}/bin/api/hw_interface/${TARGET_NAME}/api/) -set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "hw_interface") -target_include_directories(${TARGET_NAME} PUBLIC api) diff --git a/src/stream_interface/CMakeLists.txt b/src/stream_interface/CMakeLists.txt new file mode 100644 index 000000000..59be3594f --- /dev/null +++ b/src/stream_interface/CMakeLists.txt @@ -0,0 +1,13 @@ +set(TARGET_NAME "stream_interface") +file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) +add_library(${TARGET_NAME} STATIC ${SOURCES}) +add_library(novatel_edie::${TARGET_NAME} ALIAS ${TARGET_NAME}) +set_target_properties(${TARGET_NAME} PROPERTIES + OUTPUT_NAME "edie_${TARGET_NAME}" + FOLDER "hw_interface" +) +target_link_libraries(${TARGET_NAME} PRIVATE novatel_edie::common) +target_include_directories(${TARGET_NAME} PUBLIC + $ + $ +) diff --git a/src/hw_interface/stream_interface/src/filestream.cpp b/src/stream_interface/src/filestream.cpp similarity index 98% rename from src/hw_interface/stream_interface/src/filestream.cpp rename to src/stream_interface/src/filestream.cpp index 1e3c410e5..2aa8a0bdc 100644 --- a/src/hw_interface/stream_interface/src/filestream.cpp +++ b/src/stream_interface/src/filestream.cpp @@ -24,11 +24,11 @@ // ! \file filestream.cpp // =============================================================================== -#include "filestream.hpp" +#include "novatel_edie/stream_interface/filestream.hpp" #include -#include "decoders/common/api/nexcept.hpp" +#include "novatel_edie/common/nexcept.hpp" // --------------------------------------------------------- FileStream::FileStream(const std::u32string& s32FileName_) diff --git a/src/hw_interface/stream_interface/src/inputfilestream.cpp b/src/stream_interface/src/inputfilestream.cpp similarity index 98% rename from src/hw_interface/stream_interface/src/inputfilestream.cpp rename to src/stream_interface/src/inputfilestream.cpp index 5e57e5acc..95e4c0861 100644 --- a/src/hw_interface/stream_interface/src/inputfilestream.cpp +++ b/src/stream_interface/src/inputfilestream.cpp @@ -24,7 +24,7 @@ // ! \file inputfilestream.cpp // =============================================================================== -#include "inputfilestream.hpp" +#include "novatel_edie/stream_interface/inputfilestream.hpp" #include diff --git a/src/hw_interface/stream_interface/src/multioutputfilestream.cpp b/src/stream_interface/src/multioutputfilestream.cpp similarity index 98% rename from src/hw_interface/stream_interface/src/multioutputfilestream.cpp rename to src/stream_interface/src/multioutputfilestream.cpp index 8fa86427d..78d7f7bed 100644 --- a/src/hw_interface/stream_interface/src/multioutputfilestream.cpp +++ b/src/stream_interface/src/multioutputfilestream.cpp @@ -24,12 +24,16 @@ // ! \file multioutputfilestream.cpp // =============================================================================== -#include "multioutputfilestream.hpp" +#include "novatel_edie/stream_interface/multioutputfilestream.hpp" #include #include -#include "decoders/common/api/nexcept.hpp" +#include "novatel_edie/common/common.hpp" +#include "novatel_edie/common/nexcept.hpp" + +using novatel::edie::IsEqual; +using novatel::edie::SECS_IN_WEEK; // --------------------------------------------------------- MultiOutputFileStream::~MultiOutputFileStream() diff --git a/src/hw_interface/stream_interface/src/outputfilestream.cpp b/src/stream_interface/src/outputfilestream.cpp similarity index 97% rename from src/hw_interface/stream_interface/src/outputfilestream.cpp rename to src/stream_interface/src/outputfilestream.cpp index 7077e9ba3..b29772a34 100644 --- a/src/hw_interface/stream_interface/src/outputfilestream.cpp +++ b/src/stream_interface/src/outputfilestream.cpp @@ -24,7 +24,7 @@ // ! \file outputfilestream.cpp // =============================================================================== -#include "outputfilestream.hpp" +#include "novatel_edie/stream_interface/outputfilestream.hpp" // --------------------------------------------------------- OutputFileStream::OutputFileStream(const std::u32string& s32FileName) diff --git a/src/hw_interface/stream_interface/test/CMakeLists.txt b/src/stream_interface/test/CMakeLists.txt similarity index 77% rename from src/hw_interface/stream_interface/test/CMakeLists.txt rename to src/stream_interface/test/CMakeLists.txt index 241b02b1f..350358e89 100644 --- a/src/hw_interface/stream_interface/test/CMakeLists.txt +++ b/src/stream_interface/test/CMakeLists.txt @@ -2,10 +2,9 @@ set(TARGET_NAME "stream_interface_test") file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) add_executable(${TARGET_NAME} ${SOURCES}) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "hw_interface/tests") -target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../../) find_package(GTest REQUIRED CONFIG) target_link_libraries(${TARGET_NAME} PUBLIC - stream_interface common + novatel_edie::stream_interface GTest::gtest GTest::gtest_main ) add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} ${CMAKE_SOURCE_DIR}) diff --git a/src/hw_interface/stream_interface/test/filestreamunittest.cpp b/src/stream_interface/test/filestreamunittest.cpp similarity index 98% rename from src/hw_interface/stream_interface/test/filestreamunittest.cpp rename to src/stream_interface/test/filestreamunittest.cpp index a22ef7984..a586fbb66 100644 --- a/src/hw_interface/stream_interface/test/filestreamunittest.cpp +++ b/src/stream_interface/test/filestreamunittest.cpp @@ -29,8 +29,8 @@ #include -#include "decoders/common/api/nexcept.hpp" -#include "hw_interface/stream_interface/api/filestream.hpp" +#include "novatel_edie/common/nexcept.hpp" +#include "novatel_edie/stream_interface/filestream.hpp" #ifndef RESOURCE_DIR #define RESOURCE_DIR diff --git a/src/hw_interface/stream_interface/test/inputfilestreamunittest.cpp b/src/stream_interface/test/inputfilestreamunittest.cpp similarity index 99% rename from src/hw_interface/stream_interface/test/inputfilestreamunittest.cpp rename to src/stream_interface/test/inputfilestreamunittest.cpp index d91a18150..31245337f 100644 --- a/src/hw_interface/stream_interface/test/inputfilestreamunittest.cpp +++ b/src/stream_interface/test/inputfilestreamunittest.cpp @@ -29,7 +29,7 @@ #include -#include "hw_interface/stream_interface/api/inputfilestream.hpp" +#include "novatel_edie/stream_interface/inputfilestream.hpp" #ifndef RESOURCE_DIR #define RESOURCE_DIR diff --git a/src/hw_interface/stream_interface/test/main.cpp b/src/stream_interface/test/main.cpp similarity index 97% rename from src/hw_interface/stream_interface/test/main.cpp rename to src/stream_interface/test/main.cpp index a9222f2ba..9ee7c55a5 100644 --- a/src/hw_interface/stream_interface/test/main.cpp +++ b/src/stream_interface/test/main.cpp @@ -34,7 +34,7 @@ int main(int argc, char** argv) if (argc != 2) { throw std::invalid_argument("1 argument required.\nUsage: "); } - std::string strResourceVar = "TEST_RESOURCE_PATH=" + std::string(argv[1]) + "/src/hw_interface/stream_interface/test/resources/"; + std::string strResourceVar = "TEST_RESOURCE_PATH=" + std::string(argv[1]) + "/src/stream_interface/test/resources/"; if (putenv(const_cast(strResourceVar.c_str())) != 0) { throw std::runtime_error("Failed to set resource path."); } diff --git a/src/hw_interface/stream_interface/test/multioutputfilestreamunittest.cpp b/src/stream_interface/test/multioutputfilestreamunittest.cpp similarity index 99% rename from src/hw_interface/stream_interface/test/multioutputfilestreamunittest.cpp rename to src/stream_interface/test/multioutputfilestreamunittest.cpp index dc503eb8a..6e35c2cbf 100644 --- a/src/hw_interface/stream_interface/test/multioutputfilestreamunittest.cpp +++ b/src/stream_interface/test/multioutputfilestreamunittest.cpp @@ -29,8 +29,8 @@ #include -#include "decoders/common/api/nexcept.hpp" -#include "hw_interface/stream_interface/api/multioutputfilestream.hpp" +#include "novatel_edie/common/nexcept.hpp" +#include "novatel_edie/stream_interface/multioutputfilestream.hpp" class MultiOutputFileStreamTest : public ::testing::Test { diff --git a/src/hw_interface/stream_interface/test/outputfilestreamunittest.cpp b/src/stream_interface/test/outputfilestreamunittest.cpp similarity index 97% rename from src/hw_interface/stream_interface/test/outputfilestreamunittest.cpp rename to src/stream_interface/test/outputfilestreamunittest.cpp index 28b162d18..c91abc377 100644 --- a/src/hw_interface/stream_interface/test/outputfilestreamunittest.cpp +++ b/src/stream_interface/test/outputfilestreamunittest.cpp @@ -29,7 +29,7 @@ #include -#include "hw_interface/stream_interface/api/outputfilestream.hpp" +#include "novatel_edie/stream_interface/outputfilestream.hpp" class OutputFileStreamTest : public ::testing::Test { diff --git a/src/hw_interface/stream_interface/test/resources/decoder_bestpos.asc b/src/stream_interface/test/resources/decoder_bestpos.asc similarity index 100% rename from src/hw_interface/stream_interface/test/resources/decoder_bestpos.asc rename to src/stream_interface/test/resources/decoder_bestpos.asc diff --git a/src/hw_interface/stream_interface/test/resources/filestream_file2.asc b/src/stream_interface/test/resources/filestream_file2.asc similarity index 100% rename from src/hw_interface/stream_interface/test/resources/filestream_file2.asc rename to src/stream_interface/test/resources/filestream_file2.asc diff --git "a/src/hw_interface/stream_interface/test/resources/filestream\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" "b/src/stream_interface/test/resources/filestream\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" similarity index 100% rename from "src/hw_interface/stream_interface/test/resources/filestream\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" rename to "src/stream_interface/test/resources/filestream\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" diff --git "a/src/hw_interface/stream_interface/test/resources/inputfilestream\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" "b/src/stream_interface/test/resources/inputfilestream\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" similarity index 100% rename from "src/hw_interface/stream_interface/test/resources/inputfilestream\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" rename to "src/stream_interface/test/resources/inputfilestream\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" diff --git a/src/hw_interface/stream_interface/test/resources/outputfilestream_file1.asc b/src/stream_interface/test/resources/outputfilestream_file1.asc similarity index 100% rename from src/hw_interface/stream_interface/test/resources/outputfilestream_file1.asc rename to src/stream_interface/test/resources/outputfilestream_file1.asc diff --git a/src/hw_interface/stream_interface/test/resources/outputfilestream_file2.asc b/src/stream_interface/test/resources/outputfilestream_file2.asc similarity index 100% rename from src/hw_interface/stream_interface/test/resources/outputfilestream_file2.asc rename to src/stream_interface/test/resources/outputfilestream_file2.asc diff --git a/src/hw_interface/stream_interface/test/resources/outputfilestream_file3.asc b/src/stream_interface/test/resources/outputfilestream_file3.asc similarity index 100% rename from src/hw_interface/stream_interface/test/resources/outputfilestream_file3.asc rename to src/stream_interface/test/resources/outputfilestream_file3.asc diff --git a/src/hw_interface/stream_interface/test/resources/outputfilestream_file4.asc b/src/stream_interface/test/resources/outputfilestream_file4.asc similarity index 100% rename from src/hw_interface/stream_interface/test/resources/outputfilestream_file4.asc rename to src/stream_interface/test/resources/outputfilestream_file4.asc diff --git a/src/hw_interface/stream_interface/test/resources/streaminterface_testread.asc b/src/stream_interface/test/resources/streaminterface_testread.asc similarity index 100% rename from src/hw_interface/stream_interface/test/resources/streaminterface_testread.asc rename to src/stream_interface/test/resources/streaminterface_testread.asc diff --git "a/src/hw_interface/stream_interface/test/resources/\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" "b/src/stream_interface/test/resources/\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" similarity index 100% rename from "src/hw_interface/stream_interface/test/resources/\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" rename to "src/stream_interface/test/resources/\344\270\215\345\220\214\350\257\255\350\250\200\347\232\204\346\226\207\344\273\266.gps" From 7ef5c1b2e2c152a27ebe212c9e3723ad344b71cf Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 28 Sep 2024 22:03:08 +0300 Subject: [PATCH 03/15] Copy dependency shared libs to ${OUTPUT_DIR} on all platforms --- CMakeLists.txt | 34 ++++++++++++++++++---------------- cmake/third_party.cmake | 19 ++++++++++--------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23198f078..bd4e5973b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,9 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${BUILD_TYPE} "${OUTPUT_DIR}") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${BUILD_TYPE} "${OUTPUT_DIR}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${BUILD_TYPE} "${OUTPUT_DIR}") +# Look for shared libs in the same directory as the executable when running tests +set(CMAKE_BUILD_RPATH "\$ORIGIN") + # Find Git package, if not need to install manually or through .yml file find_package(Git) if(NOT Git_FOUND) @@ -123,21 +126,20 @@ if(BUILD_EXAMPLES) add_subdirectory(examples) endif() -if(WIN32) - # Copy third-party DLLs to the build directory for tests - copy_third_party_dlls() - # Copy C++ runtime DLL for non-MSVC compilers - if(NOT MSVC) - if(NOT EXISTS CMAKE_CXX_COMPILER) - find_program(CXX_COMPILER_PATH NAMES "${CMAKE_CXX_COMPILER}") - else() - set(CXX_COMPILER_PATH "${CMAKE_CXX_COMPILER}") - endif() - get_filename_component(COMPILER_BIN_DIR "${CXX_COMPILER_PATH}" DIRECTORY) - foreach(stdcpp_library libstdc++-6.dll libc++.dll) - if(EXISTS "${COMPILER_BIN_DIR}/${stdcpp_library}") - file(COPY "${COMPILER_BIN_DIR}/${stdcpp_library}" DESTINATION "${CMAKE_BINARY_DIR}/bin/${OPERATING_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR}-${COMPILER}-${CMAKE_BUILD_TYPE}") - endif() - endforeach() +# Copy third-party shared libs to the build directory for tests +copy_third_shared_libraries("${OUTPUT_DIR}") + +# Copy the C++ runtime DLL for non-MSVC compilers on Windows +if(WIN32 AND NOT MSVC) + if(NOT EXISTS CMAKE_CXX_COMPILER) + find_program(CXX_COMPILER_PATH NAMES "${CMAKE_CXX_COMPILER}") + else() + set(CXX_COMPILER_PATH "${CMAKE_CXX_COMPILER}") endif() + get_filename_component(COMPILER_BIN_DIR "${CXX_COMPILER_PATH}" DIRECTORY) + foreach(stdcpp_library libstdc++-6.dll libc++.dll) + if(EXISTS "${COMPILER_BIN_DIR}/${stdcpp_library}") + file(COPY "${COMPILER_BIN_DIR}/${stdcpp_library}" DESTINATION "${OUTPUT_DIR}") + endif() + endforeach() endif() diff --git a/cmake/third_party.cmake b/cmake/third_party.cmake index 555d85bc1..6136a4b5c 100644 --- a/cmake/third_party.cmake +++ b/cmake/third_party.cmake @@ -38,13 +38,14 @@ endif() set(CONAN_DEPLOYER_DIR "${CMAKE_BINARY_DIR}/full_deploy/host") -function(copy_third_party_dlls) - # Convert build type, operating system, and compiler to lowercase/uppercase as needed - string(TOLOWER ${CMAKE_SYSTEM_NAME} OPERATING_SYSTEM) - string(TOLOWER ${CMAKE_CXX_COMPILER_ID} COMPILER) - - # Copy all third-party DLLs to the target directory - file(GLOB_RECURSE dll_files "${CONAN_DEPLOYER_DIR}/*/*.dll") - set(TARGET_DIR "${CMAKE_BINARY_DIR}/bin/${OPERATING_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR}-${COMPILER}-${CMAKE_BUILD_TYPE}") - file(COPY ${dll_files} DESTINATION "${TARGET_DIR}") +function(copy_third_shared_libraries target_dir) + if(WIN32) + set(pattern "*.dll") + elseif(APPLE) + set(pattern "*.dylib") + else() + set(pattern "*.so*") + endif() + file(GLOB_RECURSE libs "${CONAN_DEPLOYER_DIR}/*/${pattern}") + file(COPY ${libs} DESTINATION "${target_dir}") endfunction() From b870a2edc5b9766718298b2e50d58ee6097d6642 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 28 Sep 2024 22:15:53 +0300 Subject: [PATCH 04/15] common_test does not require TEST_DATABASE_PATH --- src/common/test/main.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/common/test/main.cpp b/src/common/test/main.cpp index 655b3da1e..fdff2734b 100644 --- a/src/common/test/main.cpp +++ b/src/common/test/main.cpp @@ -24,9 +24,6 @@ // ! \file main.cpp // =============================================================================== -#include -#include - #include #include "novatel_edie/common/logger.hpp" @@ -35,12 +32,5 @@ int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); Logger::InitLogger(); - - if (argc != 2) { throw std::invalid_argument("1 argument required.\nUsage: "); } - - std::string strDatabaseVar = "TEST_DATABASE_PATH=" + std::string(argv[1]) + "/database/messages_public.json"; - - if (putenv(const_cast(strDatabaseVar.c_str())) != 0) { throw std::runtime_error("Failed to set db path."); } - return RUN_ALL_TESTS(); } From 28766d2cb7b10fc0f2333906ee090e41f96bbf50 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 28 Sep 2024 22:54:07 +0300 Subject: [PATCH 05/15] Fix a typo --- CMakeLists.txt | 2 +- cmake/third_party.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bd4e5973b..fa77a0d97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,7 +127,7 @@ if(BUILD_EXAMPLES) endif() # Copy third-party shared libs to the build directory for tests -copy_third_shared_libraries("${OUTPUT_DIR}") +copy_third_party_shared_libs("${OUTPUT_DIR}") # Copy the C++ runtime DLL for non-MSVC compilers on Windows if(WIN32 AND NOT MSVC) diff --git a/cmake/third_party.cmake b/cmake/third_party.cmake index 6136a4b5c..8c7e21de4 100644 --- a/cmake/third_party.cmake +++ b/cmake/third_party.cmake @@ -38,7 +38,7 @@ endif() set(CONAN_DEPLOYER_DIR "${CMAKE_BINARY_DIR}/full_deploy/host") -function(copy_third_shared_libraries target_dir) +function(copy_third_party_shared_libs target_dir) if(WIN32) set(pattern "*.dll") elseif(APPLE) From 53b091dd43ddbce6b3751b9574674d8d1f354ca3 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 28 Sep 2024 23:00:40 +0300 Subject: [PATCH 06/15] CI: inspect build/out/bin dir --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9612c36f4..8d429ce2a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,6 +64,9 @@ jobs: - name: Build run: cmake --build out/build --parallel --config ${{ env.BUILD_TYPE }} + - name: Inspect build outputs + run: ls -lh out/build/bin/* + - name: Unit Tests run: ctest --test-dir out/build --build-config ${{ env.BUILD_TYPE }} --output-on-failure From 1d153e89424bf0a6d3a2b349f80e01c2fb939815 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 28 Sep 2024 23:13:20 +0300 Subject: [PATCH 07/15] Set RPATH to $ORIGIN for the copied third-party libs --- .github/workflows/build.yml | 5 ++++- cmake/third_party.cmake | 16 ++++++++++++++++ conanfile.py | 22 ++++++++++++++++++++++ conanfile.txt | 20 -------------------- 4 files changed, 42 insertions(+), 21 deletions(-) create mode 100644 conanfile.py delete mode 100644 conanfile.txt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d429ce2a..e4f42910d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,7 +65,10 @@ jobs: run: cmake --build out/build --parallel --config ${{ env.BUILD_TYPE }} - name: Inspect build outputs - run: ls -lh out/build/bin/* + if: env.OPERATING_SYSTEM == 'linux' + run: | + ls -lh out/build/bin/* + (cd out/build/bin/* && for f in *; do echo $f; objdump -p $f | grep -P 'RUNPATH|RPATH' || true; done) - name: Unit Tests run: ctest --test-dir out/build --build-config ${{ env.BUILD_TYPE }} --output-on-failure diff --git a/cmake/third_party.cmake b/cmake/third_party.cmake index 8c7e21de4..dba38b5e2 100644 --- a/cmake/third_party.cmake +++ b/cmake/third_party.cmake @@ -46,6 +46,22 @@ function(copy_third_party_shared_libs target_dir) else() set(pattern "*.so*") endif() + file(GLOB_RECURSE libs "${CONAN_DEPLOYER_DIR}/*/${pattern}") file(COPY ${libs} DESTINATION "${target_dir}") + + # Set RPATH to $ORIGIN for the copied libraries + if(NOT WIN32) + file(GLOB_RECURSE PATCHELF_EXECUTABLE "${CMAKE_BINARY_DIR}/full_deploy/build/*/patchelf") + foreach(lib ${libs}) + get_filename_component(lib_name ${lib} NAME) + if(APPLE) + execute_process(COMMAND install_name_tool -add_rpath @loader_path "${target_dir}/${lib_name}" + COMMAND_ERROR_IS_FATAL ANY) + else() + execute_process(COMMAND "${PATCHELF_EXECUTABLE}" --set-rpath \$ORIGIN "${target_dir}/${lib_name}" + COMMAND_ERROR_IS_FATAL ANY) + endif() + endforeach() + endif() endfunction() diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 000000000..71407aab3 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,22 @@ +from conan import ConanFile + +class NovatelEdiePackage(ConanFile): + settings = "os", "compiler", "build_type", "arch" + requires = [ + "nlohmann_json/[>=3.11 <3.12]", + "gegles-spdlog_setup/[>=1.1 <2]", + "spdlog/[>=1.13 <2]" + ] + default_options = { + # Statically linking against spdlog causes its singleton registry to be + # re-instantiated in each shared library or executable that links against it. + "spdlog/*:shared": True, + "fmt/*:shared": True + } + generators = "CMakeDeps", "CMakeToolchain" + cmake_layout = "cmake_layout" + + def build_requirements(self): + self.test_requires("gtest/[>=1.14 <1.15]") + if self.settings.os in ["Linux", "FreeBSD"]: + self.tool_requires("patchelf/0.18") diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index 7badad415..000000000 --- a/conanfile.txt +++ /dev/null @@ -1,20 +0,0 @@ -[requires] -nlohmann_json/[>=3.11 <3.12] -gegles-spdlog_setup/[>=1.1 <2] -spdlog/[>=1.13 <2] - -[test_requires] -gtest/[>=1.14 <1.15] - -[options] -# Statically linking against spdlog causes its singleton registry to be -# re-instantiated in each shared library or executable that links against it. -spdlog/*:shared=True -fmt/*:shared=True - -[layout] -cmake_layout - -[generators] -CMakeDeps -CMakeToolchain From 3a782b5cc28fa305834402906c7b81703d1b2f67 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sun, 29 Sep 2024 01:02:09 +0300 Subject: [PATCH 08/15] set CMAKE_CXX_STANDARD --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa77a0d97..b7b2c3d94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,10 @@ else() message(WARNING "Unable to identify OS. Update script to support distribution or OS") endif() +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + if(MSVC) set_property(GLOBAL PROPERTY USE_FOLDERS ON) if(NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) From 16459a53977770d93ce476ff7fcdd889fa589161 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 30 Sep 2024 14:22:34 +0300 Subject: [PATCH 09/15] Add an aggregate novatel_edie::novatel_edie target --- CMakeLists.txt | 10 ++++++++++ examples/novatel/command_encoding/CMakeLists.txt | 2 +- examples/novatel/converter_components/CMakeLists.txt | 2 +- examples/novatel/converter_file_parser/CMakeLists.txt | 2 +- examples/novatel/converter_parser/CMakeLists.txt | 2 +- examples/novatel/json_parser/CMakeLists.txt | 2 +- examples/novatel/range_decompressor/CMakeLists.txt | 2 +- examples/novatel/rangecmp/CMakeLists.txt | 2 +- examples/novatel/rxconfig_handler/CMakeLists.txt | 2 +- src/common/CMakeLists.txt | 1 - src/common/test/CMakeLists.txt | 2 +- src/decoders/common/CMakeLists.txt | 3 +-- src/decoders/common/test/CMakeLists.txt | 2 +- src/decoders/oem/CMakeLists.txt | 3 +-- src/decoders/oem/test/CMakeLists.txt | 2 +- src/stream_interface/CMakeLists.txt | 3 +-- src/stream_interface/test/CMakeLists.txt | 2 +- 17 files changed, 25 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7b2c3d94..da6df7b79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,6 +118,16 @@ add_subdirectory(src/stream_interface) add_subdirectory(src/decoders/common) add_subdirectory(src/decoders/oem) +# Add an aggregate target for all components +add_library(novatel_edie INTERFACE) +add_library(novatel_edie::novatel_edie ALIAS novatel_edie) +target_link_libraries(novatel_edie INTERFACE + common + stream_interface + decoders_common + oem_decoder +) + if(BUILD_TESTS) enable_testing() add_subdirectory(src/common/test) diff --git a/examples/novatel/command_encoding/CMakeLists.txt b/examples/novatel/command_encoding/CMakeLists.txt index 280b431e7..353ddac20 100644 --- a/examples/novatel/command_encoding/CMakeLists.txt +++ b/examples/novatel/command_encoding/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "command_encoding") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::novatel_edie) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/converter_components/CMakeLists.txt b/examples/novatel/converter_components/CMakeLists.txt index 31afda08b..cc8c8ec14 100644 --- a/examples/novatel/converter_components/CMakeLists.txt +++ b/examples/novatel/converter_components/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "converter_components") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::novatel_edie) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/converter_file_parser/CMakeLists.txt b/examples/novatel/converter_file_parser/CMakeLists.txt index 9827f7960..8e78e24f4 100644 --- a/examples/novatel/converter_file_parser/CMakeLists.txt +++ b/examples/novatel/converter_file_parser/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "converter_file_parser") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::novatel_edie) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/converter_parser/CMakeLists.txt b/examples/novatel/converter_parser/CMakeLists.txt index 34e777128..1febcedaa 100644 --- a/examples/novatel/converter_parser/CMakeLists.txt +++ b/examples/novatel/converter_parser/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "converter_parser") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::novatel_edie) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/json_parser/CMakeLists.txt b/examples/novatel/json_parser/CMakeLists.txt index 268e6456f..4806407e4 100644 --- a/examples/novatel/json_parser/CMakeLists.txt +++ b/examples/novatel/json_parser/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "json_parser") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::novatel_edie) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/range_decompressor/CMakeLists.txt b/examples/novatel/range_decompressor/CMakeLists.txt index 88c1a6e5b..394acde5d 100644 --- a/examples/novatel/range_decompressor/CMakeLists.txt +++ b/examples/novatel/range_decompressor/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "range_decompressor") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::novatel_edie) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/rangecmp/CMakeLists.txt b/examples/novatel/rangecmp/CMakeLists.txt index 88c1a6e5b..394acde5d 100644 --- a/examples/novatel/rangecmp/CMakeLists.txt +++ b/examples/novatel/rangecmp/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "range_decompressor") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::novatel_edie) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/examples/novatel/rxconfig_handler/CMakeLists.txt b/examples/novatel/rxconfig_handler/CMakeLists.txt index 6ce805b63..776d6e05c 100644 --- a/examples/novatel/rxconfig_handler/CMakeLists.txt +++ b/examples/novatel/rxconfig_handler/CMakeLists.txt @@ -1,4 +1,4 @@ set(TARGET_NAME "rxconfig_handler") add_executable(${TARGET_NAME} ${TARGET_NAME}.cpp) -target_link_libraries(${TARGET_NAME} novatel_edie::oem_decoder novatel_edie::stream_interface) +target_link_libraries(${TARGET_NAME} novatel_edie::novatel_edie) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "examples") diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 7b129bf62..9f504ac90 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -1,7 +1,6 @@ set(TARGET_NAME "common") file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) add_library(${TARGET_NAME} STATIC ${SOURCES}) -add_library(novatel_edie::${TARGET_NAME} ALIAS ${TARGET_NAME}) set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "edie_${TARGET_NAME}" FOLDER "common" diff --git a/src/common/test/CMakeLists.txt b/src/common/test/CMakeLists.txt index 0642a9dd9..b01ae319d 100644 --- a/src/common/test/CMakeLists.txt +++ b/src/common/test/CMakeLists.txt @@ -3,5 +3,5 @@ file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) add_executable(${TARGET_NAME} ${SOURCES}) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "common/tests") find_package(GTest REQUIRED CONFIG) -target_link_libraries(${TARGET_NAME} PUBLIC novatel_edie::common GTest::gtest GTest::gtest_main) +target_link_libraries(${TARGET_NAME} PUBLIC common GTest::gtest GTest::gtest_main) add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} ${CMAKE_SOURCE_DIR}) diff --git a/src/decoders/common/CMakeLists.txt b/src/decoders/common/CMakeLists.txt index 9e9ce330c..b606719c6 100644 --- a/src/decoders/common/CMakeLists.txt +++ b/src/decoders/common/CMakeLists.txt @@ -1,7 +1,6 @@ set(TARGET_NAME "decoders_common") file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) add_library(${TARGET_NAME} STATIC ${SOURCES}) -add_library(novatel_edie::${TARGET_NAME} ALIAS ${TARGET_NAME}) set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "edie_${TARGET_NAME}" FOLDER "decoders" @@ -14,6 +13,6 @@ target_compile_features(${TARGET_NAME} PUBLIC cxx_std_17) find_package(nlohmann_json REQUIRED CONFIG) target_link_libraries(${TARGET_NAME} PUBLIC - novatel_edie::common + common nlohmann_json::nlohmann_json ) diff --git a/src/decoders/common/test/CMakeLists.txt b/src/decoders/common/test/CMakeLists.txt index 12f8ee26a..4cb1b09de 100644 --- a/src/decoders/common/test/CMakeLists.txt +++ b/src/decoders/common/test/CMakeLists.txt @@ -3,5 +3,5 @@ file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) add_executable(${TARGET_NAME} ${SOURCES}) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "decoders/tests") find_package(GTest REQUIRED CONFIG) -target_link_libraries(${TARGET_NAME} PUBLIC novatel_edie::decoders_common GTest::gtest GTest::gtest_main) +target_link_libraries(${TARGET_NAME} PUBLIC decoders_common GTest::gtest GTest::gtest_main) add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} ${CMAKE_SOURCE_DIR}) diff --git a/src/decoders/oem/CMakeLists.txt b/src/decoders/oem/CMakeLists.txt index 2a02e6ede..1d3863ff3 100644 --- a/src/decoders/oem/CMakeLists.txt +++ b/src/decoders/oem/CMakeLists.txt @@ -1,12 +1,11 @@ set(TARGET_NAME "oem_decoder") file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) add_library(${TARGET_NAME} STATIC ${SOURCES}) -add_library(novatel_edie::${TARGET_NAME} ALIAS ${TARGET_NAME}) set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "edie_${TARGET_NAME}" FOLDER "decoders" ) -target_link_libraries(${TARGET_NAME} PUBLIC novatel_edie::common decoders_common stream_interface) +target_link_libraries(${TARGET_NAME} PUBLIC common decoders_common stream_interface) target_include_directories(${TARGET_NAME} PUBLIC $ $ diff --git a/src/decoders/oem/test/CMakeLists.txt b/src/decoders/oem/test/CMakeLists.txt index 9214d9963..5a8107b5e 100644 --- a/src/decoders/oem/test/CMakeLists.txt +++ b/src/decoders/oem/test/CMakeLists.txt @@ -4,7 +4,7 @@ add_executable(${TARGET_NAME} ${SOURCES}) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "decoders/tests") find_package(GTest REQUIRED CONFIG) target_link_libraries(${TARGET_NAME} PUBLIC - novatel_edie::oem_decoder novatel_edie::stream_interface + oem_decoder stream_interface GTest::gtest GTest::gtest_main ) add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} ${CMAKE_SOURCE_DIR}) diff --git a/src/stream_interface/CMakeLists.txt b/src/stream_interface/CMakeLists.txt index 59be3594f..1e9806401 100644 --- a/src/stream_interface/CMakeLists.txt +++ b/src/stream_interface/CMakeLists.txt @@ -1,12 +1,11 @@ set(TARGET_NAME "stream_interface") file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) add_library(${TARGET_NAME} STATIC ${SOURCES}) -add_library(novatel_edie::${TARGET_NAME} ALIAS ${TARGET_NAME}) set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "edie_${TARGET_NAME}" FOLDER "hw_interface" ) -target_link_libraries(${TARGET_NAME} PRIVATE novatel_edie::common) +target_link_libraries(${TARGET_NAME} PRIVATE common) target_include_directories(${TARGET_NAME} PUBLIC $ $ diff --git a/src/stream_interface/test/CMakeLists.txt b/src/stream_interface/test/CMakeLists.txt index 350358e89..c3ab2871d 100644 --- a/src/stream_interface/test/CMakeLists.txt +++ b/src/stream_interface/test/CMakeLists.txt @@ -4,7 +4,7 @@ add_executable(${TARGET_NAME} ${SOURCES}) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "hw_interface/tests") find_package(GTest REQUIRED CONFIG) target_link_libraries(${TARGET_NAME} PUBLIC - novatel_edie::stream_interface + stream_interface GTest::gtest GTest::gtest_main ) add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} ${CMAKE_SOURCE_DIR}) From 297684f0f9210ff20fc0a37210e5c7af3f113427 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 30 Sep 2024 18:24:29 +0300 Subject: [PATCH 10/15] Add Conan packaging support, support system deps, refactor CMake --- CMakeLists.txt | 118 ++++++--------------------- cmake/CompilerOptions.cmake | 40 +++++++++ cmake/ThirdParty.cmake | 70 ++++++++++++++++ cmake/Utils.cmake | 44 ++++++++++ cmake/modules/Findspdlog_setup.cmake | 49 +++++++++++ cmake/novatel_edie-config.cmake.in | 21 +++++ cmake/third_party.cmake | 67 --------------- conanfile.py | 109 ++++++++++++++++++++++--- src/common/CMakeLists.txt | 11 ++- src/decoders/common/CMakeLists.txt | 9 +- src/decoders/oem/CMakeLists.txt | 9 +- src/stream_interface/CMakeLists.txt | 9 +- test_package/conanfile.py | 3 +- 13 files changed, 377 insertions(+), 182 deletions(-) create mode 100644 cmake/CompilerOptions.cmake create mode 100644 cmake/ThirdParty.cmake create mode 100644 cmake/Utils.cmake create mode 100644 cmake/modules/Findspdlog_setup.cmake create mode 100644 cmake/novatel_edie-config.cmake.in delete mode 100644 cmake/third_party.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index da6df7b79..03b9bf5a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,84 +1,30 @@ cmake_minimum_required(VERSION 3.15) +include(cmake/ThirdParty.cmake) +project(novatel_edie VERSION 3.3.7 LANGUAGES CXX) option(BUILD_TESTS "Build tests" ON) option(BUILD_EXAMPLES "Build examples" ON) option(CMAKE_POSITION_INDEPENDENT_CODE "Set -fPIC" ON) option(WARNINGS_AS_ERRORS "Treat warnings as errors" OFF) option(COVERAGE "Coverage" OFF) -option(USE_STATIC_LIBS "Statically link dependencies" OFF) - -if(USE_STATIC_LIBS) - # Set Conan statically link dependencies - unset(CONAN_INSTALL_ARGS CACHE) - set(CONAN_OPTIONS -o spdlog/*:shared=False -o fmt/*:shared=False) -else() - # Set Conan dynamically link dependencies - unset(CONAN_INSTALL_ARGS CACHE) - set(CONAN_OPTIONS -o spdlog/*:shared=True -o fmt/*:shared=True) -endif() - -include(cmake/third_party.cmake) -project(novatel-edie VERSION 3.3.7 LANGUAGES CXX) if(NOT DEFINED CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() -# Check platforms -if(CMAKE_HOST_WIN32) - set(WINDOWS 1) - cmake_host_system_information(RESULT OS_NAME QUERY OS_NAME) - set(DISTRIB_NAME ${OS_NAME}) -elseif(CMAKE_HOST_UNIX) - set(LINUX 1) - cmake_host_system_information(RESULT DISTRIB_NAME QUERY DISTRIB_NAME) - cmake_host_system_information(RESULT DISTRIB_VERSION_ID QUERY DISTRIB_VERSION_ID) - set(DISTRIB_NAME "${DISTRIB_NAME}-${DISTRIB_VERSION_ID}") -else() - message(WARNING "Unable to identify OS. Update script to support distribution or OS") +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 17) endif() - -set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -if(MSVC) - set_property(GLOBAL PROPERTY USE_FOLDERS ON) - if(NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) - # shared spdlog requires MultiThreadedDLL - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") - endif() - add_definitions(-DWIN32 -D_WINDOWS) - add_compile_options(/W4 /GR /EHsc /utf-8 /wd4244 /wd4996) - add_compile_options("$<$:/Ox;/Ob2>") - if(WARNINGS_AS_ERRORS) - add_compile_options(/WX) - endif() -elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") - add_compile_options(-Wall -Wextra -pedantic) - add_compile_options("$<$:-O3>") +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - if(WINDOWS) - # TODO: we shouldn't have to do this, something is bloating an object file - add_compile_options($<$:-O1>) - endif() - - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - add_compile_options(-Wno-format-truncation) - endif() - - if(WARNINGS_AS_ERRORS) - add_compile_options(-Werror) - endif() - - if(COVERAGE) - message("Coverage is On") - add_compile_options(--coverage) - add_link_options(--coverage) - endif() -else() - message(WARNING "Unable to identify compiler.") -endif() +include(GNUInstallDirs) +include(cmake/CompilerOptions.cmake) +include(cmake/Utils.cmake) +# For custom Find*.cmake modules +list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules") # Output all binaries in the same directory for easier testing string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE) @@ -92,25 +38,16 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${BUILD_TYPE} "${OUTPUT_DIR}") # Look for shared libs in the same directory as the executable when running tests set(CMAKE_BUILD_RPATH "\$ORIGIN") -# Find Git package, if not need to install manually or through .yml file -find_package(Git) -if(NOT Git_FOUND) - message(FATAL_ERROR "Git was not found. Install Git and make sure it is in your PATH.") -endif() - +find_package(Git REQUIRED) if(NOT DEFINED GIT_BRANCH) set(GIT_BRANCH "main") endif() - -# Build version of EDIE through cmake -if(GIT_EXECUTABLE) - execute_process(COMMAND ${CMAKE_COMMAND} - -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in - -D DST=${CMAKE_CURRENT_SOURCE_DIR}/include/novatel_edie/version.h - -D GIT_EXECUTABLE=${GIT_EXECUTABLE} - -D GIT_BRANCH=${GIT_BRANCH} - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/GenerateVersionHeader.cmake) -endif() +execute_process(COMMAND ${CMAKE_COMMAND} + -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in + -D DST=${CMAKE_CURRENT_SOURCE_DIR}/include/novatel_edie/version.h + -D GIT_EXECUTABLE=${GIT_EXECUTABLE} + -D GIT_BRANCH=${GIT_BRANCH} + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/GenerateVersionHeader.cmake) # Build EDIE components add_subdirectory(src/common) @@ -140,20 +77,11 @@ if(BUILD_EXAMPLES) add_subdirectory(examples) endif() -# Copy third-party shared libs to the build directory for tests +# Copy shared libs to the build output directory for tests +copy_cpp_runtime_dlls("${OUTPUT_DIR}") copy_third_party_shared_libs("${OUTPUT_DIR}") -# Copy the C++ runtime DLL for non-MSVC compilers on Windows -if(WIN32 AND NOT MSVC) - if(NOT EXISTS CMAKE_CXX_COMPILER) - find_program(CXX_COMPILER_PATH NAMES "${CMAKE_CXX_COMPILER}") - else() - set(CXX_COMPILER_PATH "${CMAKE_CXX_COMPILER}") - endif() - get_filename_component(COMPILER_BIN_DIR "${CXX_COMPILER_PATH}" DIRECTORY) - foreach(stdcpp_library libstdc++-6.dll libc++.dll) - if(EXISTS "${COMPILER_BIN_DIR}/${stdcpp_library}") - file(COPY "${COMPILER_BIN_DIR}/${stdcpp_library}" DESTINATION "${OUTPUT_DIR}") - endif() - endforeach() -endif() +# Install +install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(FILES database/messages_public.json DESTINATION ${CMAKE_INSTALL_DATADIR}/novatel_edie) +install_novatel_edie_cmake_config() diff --git a/cmake/CompilerOptions.cmake b/cmake/CompilerOptions.cmake new file mode 100644 index 000000000..144b3e01d --- /dev/null +++ b/cmake/CompilerOptions.cmake @@ -0,0 +1,40 @@ +if(MSVC) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) + if(NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) + if(BUILD_SHARED_LIBS) + # shared spdlog requires MultiThreadedDLL + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + else() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + endif() + endif() + add_definitions(-DWIN32 -D_WINDOWS) + add_compile_options(/W4 /GR /EHsc /utf-8 /wd4244 /wd4996) + add_compile_options("$<$:/Ox;/Ob2>") + if(WARNINGS_AS_ERRORS) + add_compile_options(/WX) + endif() +elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + add_compile_options(-Wall -Wextra -pedantic) + add_compile_options("$<$:-O3>") + + if(CMAKE_HOST_WIN32) + add_compile_options($<$:-Wa,-mbig-obj>) + endif() + + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + add_compile_options(-Wno-format-truncation) + endif() + + if(WARNINGS_AS_ERRORS) + add_compile_options(-Werror) + endif() + + if(COVERAGE) + message("Coverage is On") + add_compile_options(--coverage) + add_link_options(--coverage) + endif() +else() + message(WARNING "Unable to identify compiler.") +endif() diff --git a/cmake/ThirdParty.cmake b/cmake/ThirdParty.cmake new file mode 100644 index 000000000..abbccc5e6 --- /dev/null +++ b/cmake/ThirdParty.cmake @@ -0,0 +1,70 @@ +include(CMakeDependentOption) + +if(CMAKE_TOOLCHAIN_FILE MATCHES "conan_toolchain.cmake") + set(CONAN_ALREADY_ACTIVE 1) +endif() + +cmake_dependent_option(USE_CONAN "Use Conan to automatically manage dependencies" ON + "NOT DEFINED VCPKG_TOOLCHAIN AND NOT CONAN_ALREADY_ACTIVE" OFF) + +if(USE_CONAN) + if(CMAKE_VERSION VERSION_LESS 3.24) + message(FATAL_ERROR "Automatic Conan integration requires CMake 3.24 or later.") + endif() + if(NOT DEFINED CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) + endif() + if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 17) + endif() + list(APPEND CMAKE_PROJECT_TOP_LEVEL_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/conan_provider.cmake) +endif() + +# Copy third-party shared libs to the build directory for tests +function(copy_third_party_shared_libs target_dir) + if(USE_CONAN) + get_property(conan_generators_folder GLOBAL PROPERTY CONAN_GENERATORS_FOLDER) + include("${conan_generators_folder}/conan_runtime_paths.cmake") + endif() + if(NOT DEFINED CONAN_RUNTIME_LIB_DIRS) + if(USE_CONAN) + message(FATAL_ERROR "Failed to load CONAN_RUNTIME_LIB_DIRS") + endif() + # TODO: Add support for vcpkg + message(STATUS "Not using Conan, skipping copying third-party shared libraries.") + return() + endif() + + message(STATUS "Copying third-party shared libraries to ${target_dir}...") + + if(WIN32) + set(pattern "*.dll") + elseif(APPLE) + set(pattern "*.dylib") + else() + set(pattern "*.so*") + endif() + + set(copied_files) + foreach(path ${CONAN_RUNTIME_LIB_DIRS}) + message(STATUS "Copying shared libraries from ${path}") + file(GLOB libs "${path}/${pattern}") + file(COPY ${libs} DESTINATION "${target_dir}") + list(APPEND copied_files ${libs}) + endforeach() + + # Set RPATH to $ORIGIN for the copied libraries + if(NOT WIN32) + find_program(PATCHELF_EXECUTABLE patchelf REQUIRED) + foreach(lib ${copied_files}) + get_filename_component(lib_name ${lib} NAME) + if(APPLE) + execute_process(COMMAND install_name_tool -add_rpath @loader_path "${target_dir}/${lib_name}" + COMMAND_ERROR_IS_FATAL ANY) + else() + execute_process(COMMAND "${PATCHELF_EXECUTABLE}" --set-rpath \$ORIGIN "${target_dir}/${lib_name}" + COMMAND_ERROR_IS_FATAL ANY) + endif() + endforeach() + endif() +endfunction() diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake new file mode 100644 index 000000000..3fcccf932 --- /dev/null +++ b/cmake/Utils.cmake @@ -0,0 +1,44 @@ +# Copy the C++ runtime DLL for non-MSVC compilers on Windows +function(copy_cpp_runtime_dlls target_dir) + if(WIN32 AND NOT MSVC) + if(NOT EXISTS CMAKE_CXX_COMPILER) + find_program(CXX_COMPILER_PATH NAMES "${CMAKE_CXX_COMPILER}") + else() + set(CXX_COMPILER_PATH "${CMAKE_CXX_COMPILER}") + endif() + get_filename_component(COMPILER_BIN_DIR "${CXX_COMPILER_PATH}" DIRECTORY) + foreach(stdcpp_library libstdc++-6.dll libc++.dll) + if(EXISTS "${COMPILER_BIN_DIR}/${stdcpp_library}") + file(COPY "${COMPILER_BIN_DIR}/${stdcpp_library}" DESTINATION "${target_dir}") + endif() + endforeach() + endif() +endfunction() + +# Generate and install nova_edie-config.cmake +function(install_novatel_edie_cmake_config) + include(GNUInstallDirs) + set(CMAKE_CONFIG_INSTALL_DIR lib/cmake/novatel_edie) + + install(TARGETS novatel_edie EXPORT novatel_edie-targets) + install(EXPORT novatel_edie-targets + NAMESPACE novatel_edie:: + FILE novatel_edie-targets.cmake + DESTINATION ${CMAKE_CONFIG_INSTALL_DIR} + COMPONENT novatel_edie) + + include(CMakePackageConfigHelpers) + configure_package_config_file(cmake/novatel_edie-config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/novatel_edie-config.cmake" + INSTALL_DESTINATION ${CMAKE_CONFIG_INSTALL_DIR} + PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_DATADIR) + + write_basic_package_version_file(novatel_edie-config-version.cmake + VERSION ${novatel_edie_VERSION} + COMPATIBILITY SameMajorVersion) + + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/novatel_edie-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/novatel_edie-config-version.cmake" + DESTINATION ${CMAKE_CONFIG_INSTALL_DIR} + COMPONENT novatel_edie) +endfunction() diff --git a/cmake/modules/Findspdlog_setup.cmake b/cmake/modules/Findspdlog_setup.cmake new file mode 100644 index 000000000..8c5b93a96 --- /dev/null +++ b/cmake/modules/Findspdlog_setup.cmake @@ -0,0 +1,49 @@ +# Findspdlog_setup.cmake +# +# This module tries to locate the spdlog_setup library using find_package(spdlog_setup CONFIG). +# If not found, it falls back to downloading and configuring it from an official release. + +find_package(spdlog_setup CONFIG QUIET) + +if(NOT spdlog_setup_FOUND) + set(spdlog_setup_VERSION "1.1.0") + set(spdlog_setup_URL "https://github.com/gegles/spdlog_setup/archive/refs/tags/v${spdlog_setup_VERSION}.tar.gz") + set(spdlog_setup_SHA256 "80a37463a1cd2735f6f7af0b0dfb01a1ecc0a271b33fb29966564b9758f7c309") + set(spdlog_setup_SOURCE_DIR "${CMAKE_BINARY_DIR}/third_party/spdlog_setup") + set(spdlog_setup_INCLUDE_DIR "${spdlog_setup_SOURCE_DIR}/include") + + find_package(cpptoml REQUIRED CONFIG) + + if(POLICY CMP0135) + cmake_policy(SET CMP0135 NEW) + endif() + include(FetchContent) + FetchContent_Declare( + spdlog_setup + URL "${spdlog_setup_URL}" + URL_HASH SHA256=${spdlog_setup_SHA256} + SOURCE_DIR "${spdlog_setup_SOURCE_DIR}" + EXCLUDE_FROM_ALL + ) + FetchContent_GetProperties(spdlog_setup) + if(NOT EXISTS "${spdlog_setup_INCLUDE_DIR}") + message(STATUS "spdlog_setup not found. Fetching it from ${spdlog_setup_URL} instead...") + FetchContent_MakeAvailable(spdlog_setup) + endif() + + add_library(spdlog_setup::spdlog_setup INTERFACE IMPORTED) + target_include_directories(spdlog_setup::spdlog_setup INTERFACE + "$" + "$" + ) + target_link_libraries(spdlog_setup::spdlog_setup INTERFACE cpptoml) + + install(DIRECTORY "${spdlog_setup_SOURCE_DIR}/include/" + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/novatel_edie/third_party + ) + + set(spdlog_setup_FOUND TRUE CACHE INTERNAL "") + set(spdlog_setup_VENDORED TRUE CACHE INTERNAL "") +else() + set(spdlog_setup_VENDORED FALSE CACHE INTERNAL "") +endif() diff --git a/cmake/novatel_edie-config.cmake.in b/cmake/novatel_edie-config.cmake.in new file mode 100644 index 000000000..198a83ec5 --- /dev/null +++ b/cmake/novatel_edie-config.cmake.in @@ -0,0 +1,21 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) + +include("${CMAKE_CURRENT_LIST_DIR}/novatel_edie-targets.cmake") + +set_and_check(novatel_edie_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@") +set_and_check(novatel_edie_DATA_DIR "@PACKAGE_CMAKE_INSTALL_DATADIR@") +set(novatel_edie_LIBRARIES novatel_edie::novatel_edie) +check_required_components(novatel_edie) + +find_dependency(nlohmann_json) +find_dependency(spdlog) + +if(@spdlog_setup_VENDORED@) + # spdlog_setup has been vendored, find its dependencies + find_dependency(cpptoml) +else() + # use external spdlog_setup + find_dependency(spdlog_setup) +endif() diff --git a/cmake/third_party.cmake b/cmake/third_party.cmake deleted file mode 100644 index dba38b5e2..000000000 --- a/cmake/third_party.cmake +++ /dev/null @@ -1,67 +0,0 @@ -if(NOT DEFINED CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - -option(USE_CONAN "Use Conan to automatically manage dependencies" TRUE) - -if(NOT DEFINED CONAN_INSTALL_ARGS) - set(CONAN_INSTALL_ARGS - --build=missing - # Deploy the installed dependencies in the build dir for easier installation - --deployer=full_deploy "--deployer-folder=${CMAKE_BINARY_DIR}" - # Set cppstd without relying on CMAKE_CXX_STANDARD - --settings compiler.cppstd=17 - # Use options set by the project - ${CONAN_OPTIONS} - ) - if(WIN32) - list(APPEND CONAN_INSTALL_ARGS -c tools.deployer:symlinks=False) - endif() - set(CONAN_INSTALL_ARGS "${CONAN_INSTALL_ARGS}" CACHE INTERNAL "" FORCE) -endif() - -if(USE_CONAN AND NOT DEFINED VCPKG_TOOLCHAIN AND NOT CMAKE_TOOLCHAIN_FILE MATCHES "conan_toolchain.cmake") - if(CMAKE_VERSION GREATER_EQUAL 3.24) - list(APPEND CMAKE_PROJECT_TOP_LEVEL_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/conan_provider.cmake) - else() - message(WARNING - "CMake 3.24 or greater is required to install Conan dependencies automatically. " - "You will have to run 'conan install . ${CONAN_INSTALL_ARGS}' manually in the source directory instead." - ) - # To use the output from the Conan CMakeDeps generator - list(PREPEND CMAKE_PREFIX_PATH - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/generators - ${CMAKE_CURRENT_BINARY_DIR}/build/${CMAKE_BUILD_TYPE}/generators - ) - endif() -endif() - -set(CONAN_DEPLOYER_DIR "${CMAKE_BINARY_DIR}/full_deploy/host") - -function(copy_third_party_shared_libs target_dir) - if(WIN32) - set(pattern "*.dll") - elseif(APPLE) - set(pattern "*.dylib") - else() - set(pattern "*.so*") - endif() - - file(GLOB_RECURSE libs "${CONAN_DEPLOYER_DIR}/*/${pattern}") - file(COPY ${libs} DESTINATION "${target_dir}") - - # Set RPATH to $ORIGIN for the copied libraries - if(NOT WIN32) - file(GLOB_RECURSE PATCHELF_EXECUTABLE "${CMAKE_BINARY_DIR}/full_deploy/build/*/patchelf") - foreach(lib ${libs}) - get_filename_component(lib_name ${lib} NAME) - if(APPLE) - execute_process(COMMAND install_name_tool -add_rpath @loader_path "${target_dir}/${lib_name}" - COMMAND_ERROR_IS_FATAL ANY) - else() - execute_process(COMMAND "${PATCHELF_EXECUTABLE}" --set-rpath \$ORIGIN "${target_dir}/${lib_name}" - COMMAND_ERROR_IS_FATAL ANY) - endif() - endforeach() - endif() -endfunction() diff --git a/conanfile.py b/conanfile.py index 71407aab3..803ea8c4c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,22 +1,105 @@ +import os +import re +from pathlib import Path + from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain, CMakeDeps +from conan.tools.files import copy, rmdir + +required_conan_version = ">=2.0" -class NovatelEdiePackage(ConanFile): +class NovatelEdieConan(ConanFile): + name = "novatel_edie" + description = ("EDIE (Encode Decode Interface Engine) is a C++ SDK that can encode and decode messages " + "from NovAtel's OEM7 receivers from one format into another.") + url = "https://github.com/novatel/novatel_edie" + license = "MIT" + package_type = "library" settings = "os", "compiler", "build_type", "arch" - requires = [ - "nlohmann_json/[>=3.11 <3.12]", - "gegles-spdlog_setup/[>=1.1 <2]", - "spdlog/[>=1.13 <2]" - ] + options = { + "shared": [True, False], + "fPIC": [True, False], + } default_options = { - # Statically linking against spdlog causes its singleton registry to be - # re-instantiated in each shared library or executable that links against it. - "spdlog/*:shared": True, - "fmt/*:shared": True + "shared": False, + "fPIC": True, } - generators = "CMakeDeps", "CMakeToolchain" - cmake_layout = "cmake_layout" + + exports_sources = ["cmake/*", "database/*", "include/*", "src/*", "LICENSE", "!doc", "!test", "CMakelists.txt"] + + def set_version(self): + cmakelists_content = Path(self.recipe_folder, "CMakeLists.txt").read_text() + self.version = re.search(r"novatel_edie VERSION ([\d.]+)", cmakelists_content).group(1) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.options["spdlog"].shared = True + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires("nlohmann_json/[>=3.11 <3.12]", transitive_headers=True) + self.requires("spdlog/[>=1.13 <2]", transitive_headers=True, transitive_libs=True) + self.requires("gegles-spdlog_setup/[>=1.1 <2]", transitive_headers=True) + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 17) + + if self.options.shared and not self.dependencies["spdlog"].options.shared: + # Statically linking against spdlog causes its singleton registry to be + # re-instantiated in each shared library and executable that links against it. + raise ConanInvalidConfiguration("spdlog must be dynamically linked when building novatel_edie as a shared library") def build_requirements(self): self.test_requires("gtest/[>=1.14 <1.15]") if self.settings.os in ["Linux", "FreeBSD"]: - self.tool_requires("patchelf/0.18") + self.tool_requires("patchelf/[*]") + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_TESTS"] = False + tc.cache_variables["BUILD_EXAMPLES"] = False + tc.cache_variables["CMAKE_INSTALL_DATADIR"] = "res" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + # A workaround for conan_provider.cmake not loading conan_toolchain.cmake + toolchain_lines = Path(self.generators_folder, "conan_toolchain.cmake").read_text().splitlines() + runtime_paths = "\n".join(l for l in toolchain_lines if ("CONAN_RUNTIME_LIB_DIRS" in l or "CMAKE_PROGRAM_PATH" in l)) + Path(self.generators_folder, "conan_runtime_paths.cmake").write_text(runtime_paths) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.source_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "novatel_edie") + self.cpp_info.set_property("cmake_target_name", "novatel_edie::novatel_edie") + self.cpp_info.resdirs = ["res"] + self.cpp_info.libs = [ + # Note: the order of the listed libs matters when linking statically. + "edie_oem_decoder", + "edie_stream_interface", + "edie_decoders_common", + "edie_common", + ] + db_path = os.path.join(self.package_folder, "res", "novatel_edie", "messages_public.json") + self.runenv_info.define_path("EDIE_DATABASE_FILE", db_path) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 9f504ac90..8618e8c88 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -1,6 +1,6 @@ set(TARGET_NAME "common") file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -add_library(${TARGET_NAME} STATIC ${SOURCES}) +add_library(${TARGET_NAME} ${SOURCES}) set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "edie_${TARGET_NAME}" FOLDER "common" @@ -12,10 +12,17 @@ target_include_directories(${TARGET_NAME} PUBLIC target_compile_features(${TARGET_NAME} PUBLIC cxx_std_17) find_package(spdlog REQUIRED CONFIG) -find_package(spdlog_setup REQUIRED CONFIG) +find_package(spdlog_setup REQUIRED MODULE) target_link_libraries(${TARGET_NAME} PUBLIC spdlog_setup::spdlog_setup $ $ ) + +install(TARGETS ${TARGET_NAME} + EXPORT novatel_edie-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/src/decoders/common/CMakeLists.txt b/src/decoders/common/CMakeLists.txt index b606719c6..1c482a1a7 100644 --- a/src/decoders/common/CMakeLists.txt +++ b/src/decoders/common/CMakeLists.txt @@ -1,6 +1,6 @@ set(TARGET_NAME "decoders_common") file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -add_library(${TARGET_NAME} STATIC ${SOURCES}) +add_library(${TARGET_NAME} ${SOURCES}) set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "edie_${TARGET_NAME}" FOLDER "decoders" @@ -16,3 +16,10 @@ target_link_libraries(${TARGET_NAME} PUBLIC common nlohmann_json::nlohmann_json ) + +install(TARGETS ${TARGET_NAME} + EXPORT novatel_edie-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/src/decoders/oem/CMakeLists.txt b/src/decoders/oem/CMakeLists.txt index 1d3863ff3..d6e1a4906 100644 --- a/src/decoders/oem/CMakeLists.txt +++ b/src/decoders/oem/CMakeLists.txt @@ -1,6 +1,6 @@ set(TARGET_NAME "oem_decoder") file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -add_library(${TARGET_NAME} STATIC ${SOURCES}) +add_library(${TARGET_NAME} ${SOURCES}) set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "edie_${TARGET_NAME}" FOLDER "decoders" @@ -10,3 +10,10 @@ target_include_directories(${TARGET_NAME} PUBLIC $ $ ) + +install(TARGETS ${TARGET_NAME} + EXPORT novatel_edie-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/src/stream_interface/CMakeLists.txt b/src/stream_interface/CMakeLists.txt index 1e9806401..fcb0422e0 100644 --- a/src/stream_interface/CMakeLists.txt +++ b/src/stream_interface/CMakeLists.txt @@ -1,6 +1,6 @@ set(TARGET_NAME "stream_interface") file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) -add_library(${TARGET_NAME} STATIC ${SOURCES}) +add_library(${TARGET_NAME} ${SOURCES}) set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "edie_${TARGET_NAME}" FOLDER "hw_interface" @@ -10,3 +10,10 @@ target_include_directories(${TARGET_NAME} PUBLIC $ $ ) + +install(TARGETS ${TARGET_NAME} + EXPORT novatel_edie-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 6e4eaee6c..228c22cd0 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -25,8 +25,7 @@ def build(self): def test(self): if can_run(self): bin_path = os.path.join(self.cpp.build.bindir, "CommandEncoding") - datadir = self.dependencies["novatel_edie"].cpp_info.resdirs[0] - database_json = os.path.join(datadir, "messages_public.json") + database_json = self.dependencies["novatel_edie"].runenv_info.vars(self).get("EDIE_DATABASE_FILE") format = "ASCII" command = "RTKTIMEOUT 30" self.run(f"{bin_path} {database_json} {format} {command}", env="conanrun") From 035940c6613ac3c3e79d040da280968f0e9e2c8a Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 30 Sep 2024 18:41:07 +0300 Subject: [PATCH 11/15] Add SetDefaultProfile.cmake --- CMakeLists.txt | 11 +---------- cmake/CompilerOptions.cmake | 8 -------- cmake/SetDefaultProfile.cmake | 19 +++++++++++++++++++ cmake/ThirdParty.cmake | 7 +------ 4 files changed, 21 insertions(+), 24 deletions(-) create mode 100644 cmake/SetDefaultProfile.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 03b9bf5a0..540595edb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,19 +8,10 @@ option(CMAKE_POSITION_INDEPENDENT_CODE "Set -fPIC" ON) option(WARNINGS_AS_ERRORS "Treat warnings as errors" OFF) option(COVERAGE "Coverage" OFF) -if(NOT DEFINED CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - -if(NOT DEFINED CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 17) -endif() -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) include(GNUInstallDirs) +include(cmake/SetDefaultProfile.cmake) include(cmake/CompilerOptions.cmake) include(cmake/Utils.cmake) # For custom Find*.cmake modules diff --git a/cmake/CompilerOptions.cmake b/cmake/CompilerOptions.cmake index 144b3e01d..9c4275cf4 100644 --- a/cmake/CompilerOptions.cmake +++ b/cmake/CompilerOptions.cmake @@ -1,13 +1,5 @@ if(MSVC) set_property(GLOBAL PROPERTY USE_FOLDERS ON) - if(NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) - if(BUILD_SHARED_LIBS) - # shared spdlog requires MultiThreadedDLL - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") - else() - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - endif() - endif() add_definitions(-DWIN32 -D_WINDOWS) add_compile_options(/W4 /GR /EHsc /utf-8 /wd4244 /wd4996) add_compile_options("$<$:/Ox;/Ob2>") diff --git a/cmake/SetDefaultProfile.cmake b/cmake/SetDefaultProfile.cmake new file mode 100644 index 000000000..397c869b3 --- /dev/null +++ b/cmake/SetDefaultProfile.cmake @@ -0,0 +1,19 @@ +if(NOT DEFINED CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 17) +endif() +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +if(MSVC AND NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) + if(BUILD_SHARED_LIBS) + # shared spdlog requires MultiThreadedDLL + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") + else() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + endif() + message(STATUS "CMAKE_MSVC_RUNTIME_LIBRARY not set, using ${CMAKE_MSVC_RUNTIME_LIBRARY}") +endif() diff --git a/cmake/ThirdParty.cmake b/cmake/ThirdParty.cmake index abbccc5e6..2c6441589 100644 --- a/cmake/ThirdParty.cmake +++ b/cmake/ThirdParty.cmake @@ -11,12 +11,7 @@ if(USE_CONAN) if(CMAKE_VERSION VERSION_LESS 3.24) message(FATAL_ERROR "Automatic Conan integration requires CMake 3.24 or later.") endif() - if(NOT DEFINED CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) - endif() - if(NOT DEFINED CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 17) - endif() + include("${CMAKE_CURRENT_LIST_DIR}/SetDefaultProfile.cmake") list(APPEND CMAKE_PROJECT_TOP_LEVEL_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/conan_provider.cmake) endif() From b19fa02d9a1f38aec1911220c9fd2d1cec3f28a5 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 30 Sep 2024 19:06:10 +0300 Subject: [PATCH 12/15] conan_provider.cmake: fix missing runtime type detection for ClangCL --- cmake/SetDefaultProfile.cmake | 8 +------- cmake/conan_provider.cmake | 10 +++++----- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/cmake/SetDefaultProfile.cmake b/cmake/SetDefaultProfile.cmake index 397c869b3..e11f92c75 100644 --- a/cmake/SetDefaultProfile.cmake +++ b/cmake/SetDefaultProfile.cmake @@ -9,11 +9,5 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) if(MSVC AND NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) - if(BUILD_SHARED_LIBS) - # shared spdlog requires MultiThreadedDLL - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") - else() - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - endif() - message(STATUS "CMAKE_MSVC_RUNTIME_LIBRARY not set, using ${CMAKE_MSVC_RUNTIME_LIBRARY}") + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") endif() diff --git a/cmake/conan_provider.cmake b/cmake/conan_provider.cmake index 6163b6371..7149bd59f 100644 --- a/cmake/conan_provider.cmake +++ b/cmake/conan_provider.cmake @@ -214,9 +214,7 @@ function(detect_compiler COMPILER COMPILER_VERSION COMPILER_RUNTIME COMPILER_RUN message(STATUS "CMake-Conan: CMake compiler=${_COMPILER}") message(STATUS "CMake-Conan: CMake compiler version=${_COMPILER_VERSION}") - if(_COMPILER MATCHES MSVC) - set(_COMPILER "msvc") - string(SUBSTRING ${MSVC_VERSION} 0 3 _COMPILER_VERSION) + if(MSVC) # Configure compiler.runtime and compiler.runtime_type settings for MSVC if(CMAKE_MSVC_RUNTIME_LIBRARY) set(_msvc_runtime_library ${CMAKE_MSVC_RUNTIME_LIBRARY}) @@ -252,9 +250,11 @@ function(detect_compiler COMPILER COMPILER_VERSION COMPILER_RUNTIME COMPILER_RUN endif() message(STATUS "CMake-Conan: CMake compiler.runtime_type=${_COMPILER_RUNTIME_TYPE}") endif() + endif() - unset(_KNOWN_MSVC_RUNTIME_VALUES) - + if(_COMPILER MATCHES MSVC) + set(_COMPILER "msvc") + string(SUBSTRING ${MSVC_VERSION} 0 3 _COMPILER_VERSION) elseif(_COMPILER MATCHES AppleClang) set(_COMPILER "apple-clang") string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION}) From 05e650413690aac531080953e8cafad99902a78f Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Tue, 1 Oct 2024 12:41:56 +0300 Subject: [PATCH 13/15] Fix stream_interface folder name --- src/stream_interface/CMakeLists.txt | 2 +- src/stream_interface/test/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stream_interface/CMakeLists.txt b/src/stream_interface/CMakeLists.txt index fcb0422e0..77c7cf2a4 100644 --- a/src/stream_interface/CMakeLists.txt +++ b/src/stream_interface/CMakeLists.txt @@ -3,7 +3,7 @@ file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) add_library(${TARGET_NAME} ${SOURCES}) set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "edie_${TARGET_NAME}" - FOLDER "hw_interface" + FOLDER "stream_interface" ) target_link_libraries(${TARGET_NAME} PRIVATE common) target_include_directories(${TARGET_NAME} PUBLIC diff --git a/src/stream_interface/test/CMakeLists.txt b/src/stream_interface/test/CMakeLists.txt index c3ab2871d..2c1905bc9 100644 --- a/src/stream_interface/test/CMakeLists.txt +++ b/src/stream_interface/test/CMakeLists.txt @@ -1,7 +1,7 @@ set(TARGET_NAME "stream_interface_test") file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) add_executable(${TARGET_NAME} ${SOURCES}) -set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "hw_interface/tests") +set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "stream_interface/tests") find_package(GTest REQUIRED CONFIG) target_link_libraries(${TARGET_NAME} PUBLIC stream_interface From dda5d4a59703953915fdf46b04d0d5229b009830 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Tue, 1 Oct 2024 12:46:48 +0300 Subject: [PATCH 14/15] novatel_test -> oem_test --- src/decoders/oem/test/CMakeLists.txt | 2 +- src/decoders/oem/test/{novatel_test.cpp => oem_test.cpp} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/decoders/oem/test/{novatel_test.cpp => oem_test.cpp} (100%) diff --git a/src/decoders/oem/test/CMakeLists.txt b/src/decoders/oem/test/CMakeLists.txt index 5a8107b5e..f8dc21e64 100644 --- a/src/decoders/oem/test/CMakeLists.txt +++ b/src/decoders/oem/test/CMakeLists.txt @@ -1,4 +1,4 @@ -set(TARGET_NAME "novatel_test") +set(TARGET_NAME "oem_test") file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) add_executable(${TARGET_NAME} ${SOURCES}) set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER "decoders/tests") diff --git a/src/decoders/oem/test/novatel_test.cpp b/src/decoders/oem/test/oem_test.cpp similarity index 100% rename from src/decoders/oem/test/novatel_test.cpp rename to src/decoders/oem/test/oem_test.cpp From e9de8e2827f8c2aeada640c55d267dda668def72 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Tue, 1 Oct 2024 12:48:42 +0300 Subject: [PATCH 15/15] CI: Add include/ to clang-format and editorconfig steps --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4f42910d..57558d49c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -109,7 +109,7 @@ jobs: sudo apt-get install -y clang-format - name: Check code formatting - run: find src examples \( -name '*.cpp' -o -name '*.hpp' \) -exec clang-format -Werror --style=file -n {} + || (echo "Clang-format failed! See the README if you don't know how to fix this." && exit 1) + run: find include src examples \( -name '*.cpp' -o -name '*.hpp' \) -exec clang-format -Werror --style=file -n {} + || (echo "Clang-format failed! See the README if you don't know how to fix this." && exit 1) # ========================================================= # Editor Config Job @@ -128,7 +128,7 @@ jobs: run: find . \( -name 'CMakeLists.txt' \) -exec editorconfig-checker {} \+ || { echo "EditorConfig check failed! See the README if you don't know how to fix this."; exit 1; } - name: Check C++ formatting - run: find src examples \( -name '*.cpp' -o -name '*.hpp' \) -exec editorconfig-checker {} \+ || { echo "EditorConfig check failed! See the README if you don't know how to fix this."; exit 1; } + run: find include src examples \( -name '*.cpp' -o -name '*.hpp' \) -exec editorconfig-checker {} \+ || { echo "EditorConfig check failed! See the README if you don't know how to fix this."; exit 1; } # ========================================================= # Clang Tidy Job