diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6792c739..16f2c6aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,13 +19,13 @@ jobs: shell: bash steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Build run: | git config --global --add safe.directory ${GITHUB_WORKSPACE} ./docker/ci.sh - name: Artefacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: fpsdk_common_versions_trixie path: build/trixie-ci_build_toplevel_release_noros/*/*_versions.txt @@ -39,13 +39,13 @@ jobs: shell: bash steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Build run: | git config --global --add safe.directory ${GITHUB_WORKSPACE} ./docker/ci.sh - name: Artefacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: fpsdk_common_versions_noetic path: build/noetic-ci_build_toplevel_release_ros1/*/*_versions.txt @@ -59,13 +59,13 @@ jobs: shell: bash steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: CI run: | git config --global --add safe.directory ${GITHUB_WORKSPACE} ./docker/ci.sh - name: Artefacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: fpsdk_common_versions_humble path: build/humble-ci_build_toplevel_release_ros2/*/*_versions.txt @@ -79,13 +79,13 @@ jobs: shell: bash steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: CI run: | git config --global --add safe.directory ${GITHUB_WORKSPACE} ./docker/ci.sh - name: Artefacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: fpsdk_common_versions_jazzy path: build/jazzy-ci_build_toplevel_release_ros2/*/*_versions.txt @@ -99,7 +99,7 @@ jobs: - ci-fpsdk-jazzy steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Login uses: docker/login-action@v3 with: @@ -142,12 +142,12 @@ jobs: id-token: write steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 ##### Get artefacts from build jobs - name: Get build artefacts - uses: actions/download-artifact@v5 + uses: actions/download-artifact@v8 with: path: build-artefacts # See Doxyfile and Makefile # We'll get: @@ -176,7 +176,7 @@ jobs: # https://github.com/actions/upload-pages-artifact (This, not actions/upload-artifact, which doesn't work # for pages deployment. Both actions make the artefact show up as a job artefact. - name: Upload pages artefact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v4 with: path: github-pages diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 31f1718b..e62d292b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,9 +12,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Login - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.actor }} @@ -45,9 +45,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Login - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.actor }} @@ -79,9 +79,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Login - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.actor }} @@ -113,9 +113,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Login - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.actor }} diff --git a/fpsdk_common/src/parser.cpp b/fpsdk_common/src/parser.cpp index 9f997363..99c397a8 100644 --- a/fpsdk_common/src/parser.cpp +++ b/fpsdk_common/src/parser.cpp @@ -767,9 +767,9 @@ static int IsSbfMessage(const uint8_t* buf, const std::size_t size) return WAIT; } - // // Limit message size + // Limit message size, check constraints const std::size_t message_size = ((uint16_t)buf[6] | ((uint16_t)buf[7] << 8)); - if (message_size > MAX_SBF_SIZE) { + if ((message_size > MAX_SBF_SIZE) || (message_size < SBF_HEAD_SIZE) || ((message_size % 4) != 0)) { return NADA; } diff --git a/fpsdk_common/test/data/test_data_sbf.bin b/fpsdk_common/test/data/test_data_sbf.bin new file mode 100644 index 00000000..8857fc37 Binary files /dev/null and b/fpsdk_common/test/data/test_data_sbf.bin differ diff --git a/fpsdk_common/test/data/test_data_sbf.cpp b/fpsdk_common/test/data/test_data_sbf.cpp new file mode 100644 index 00000000..7b35f60a --- /dev/null +++ b/fpsdk_common/test/data/test_data_sbf.cpp @@ -0,0 +1,10 @@ +// clang-format off +static const std::vector TEST_DATA_SBF_BIN = { + 0x24, 0x40, 0x89, 0x0a, 0xa7, 0x4f, 0x60, 0x00, 0x08, 0xce, 0xa8, 0x0d, 0x58, 0x09, 0x01, 0x00, 0xfa, 0x95, 0x70, 0xa4, 0x2b, 0x79, 0xea, 0x3f, 0xdd, 0x71, 0x61, 0x0d, 0xd9, 0xe0, 0xc2, 0x3f, + 0xce, 0x8c, 0xd1, 0x80, 0x61, 0xb5, 0x7c, 0x40, 0x4a, 0xf5, 0x3f, 0x42, 0x58, 0x73, 0xa2, 0x39, 0xfb, 0xd2, 0xe1, 0x39, 0xb8, 0x9f, 0x85, 0x39, 0xf9, 0x02, 0x95, 0xd0, 0xbe, 0xe3, 0x61, 0xe6, + 0xf8, 0x8f, 0xc4, 0xbf, 0x40, 0xd7, 0x25, 0x3e, 0x00, 0x00, 0x29, 0x00, 0xff, 0xff, 0xff, 0xff, 0x05, 0x49, 0x22, 0x50, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0xc5, 0x00, 0x2e, 0x01, 0x50, 0x00, + 0x24, 0x40, 0x06, 0x37, 0x12, 0x17, 0x38, 0x00, 0x08, 0xce, 0xa8, 0x0d, 0x58, 0x09, 0x01, 0x00, 0x46, 0xce, 0x12, 0x3f, 0x20, 0x8a, 0xcc, 0x3e, 0xbd, 0x2a, 0x12, 0x40, 0xfe, 0x75, 0x73, 0x3f, + 0x5c, 0x76, 0x8c, 0xbb, 0xca, 0x48, 0xc6, 0x3d, 0x5f, 0x98, 0x87, 0x3d, 0x06, 0x8a, 0x89, 0x3e, 0xbc, 0x12, 0x35, 0x3e, 0x7c, 0x84, 0xa8, 0x3f, 0x24, 0x40, 0x44, 0x85, 0x14, 0x17, 0x38, 0x00, + 0x08, 0xce, 0xa8, 0x0d, 0x58, 0x09, 0x01, 0x00, 0x77, 0x08, 0xdd, 0x37, 0x85, 0xd7, 0x98, 0x37, 0xac, 0xbb, 0x49, 0x38, 0xcf, 0x28, 0x1c, 0x38, 0xd2, 0x00, 0x39, 0xb5, 0x5e, 0x0e, 0x04, 0xb5, + 0xce, 0xd5, 0x7e, 0x35, 0xcd, 0x1d, 0xc6, 0x35, 0xe0, 0x2f, 0xcd, 0x35, 0xd3, 0x46, 0x01, 0x38 +}; diff --git a/fpsdk_common/test/parser_test.cpp b/fpsdk_common/test/parser_test.cpp index 463bb4a3..9bbffa4f 100644 --- a/fpsdk_common/test/parser_test.cpp +++ b/fpsdk_common/test/parser_test.cpp @@ -35,6 +35,7 @@ using namespace fpsdk::common::parser; #include "data/test_data_nmea.cpp" #include "data/test_data_novb.cpp" #include "data/test_data_rtcm3.cpp" +#include "data/test_data_sbf.cpp" #include "data/test_data_spartn.cpp" #include "data/test_data_ubx.cpp" @@ -368,6 +369,46 @@ TEST_F(ParserTest, SPARTN) // --------------------------------------------------------------------------------------------------------------------- +TEST_F(ParserTest, SBF) +{ + Parser parser; + EXPECT_TRUE( // clang-format off + TestLog(parser, TEST_DATA_SBF_BIN, { + { "SBF-PVTGEODETIC", { + 0x24, 0x40, 0x89, 0x0a, 0xa7, 0x4f, 0x60, 0x00, 0x08, 0xce, 0xa8, 0x0d, 0x58, 0x09, 0x01, 0x00, + 0xfa, 0x95, 0x70, 0xa4, 0x2b, 0x79, 0xea, 0x3f, 0xdd, 0x71, 0x61, 0x0d, 0xd9, 0xe0, 0xc2, 0x3f, + 0xce, 0x8c, 0xd1, 0x80, 0x61, 0xb5, 0x7c, 0x40, 0x4a, 0xf5, 0x3f, 0x42, 0x58, 0x73, 0xa2, 0x39, + 0xfb, 0xd2, 0xe1, 0x39, 0xb8, 0x9f, 0x85, 0x39, 0xf9, 0x02, 0x95, 0xd0, 0xbe, 0xe3, 0x61, 0xe6, + 0xf8, 0x8f, 0xc4, 0xbf, 0x40, 0xd7, 0x25, 0x3e, 0x00, 0x00, 0x29, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x05, 0x49, 0x22, 0x50, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0xc5, 0x00, 0x2e, 0x01, 0x50, 0x00 } }, + { "SBF-POSCOVGEODETIC", { + 0x24, 0x40, 0x06, 0x37, 0x12, 0x17, 0x38, 0x00, 0x08, 0xce, 0xa8, 0x0d, 0x58, 0x09, 0x01, 0x00, + 0x46, 0xce, 0x12, 0x3f, 0x20, 0x8a, 0xcc, 0x3e, 0xbd, 0x2a, 0x12, 0x40, 0xfe, 0x75, 0x73, 0x3f, + 0x5c, 0x76, 0x8c, 0xbb, 0xca, 0x48, 0xc6, 0x3d, 0x5f, 0x98, 0x87, 0x3d, 0x06, 0x8a, 0x89, 0x3e, + 0xbc, 0x12, 0x35, 0x3e, 0x7c, 0x84, 0xa8, 0x3f } }, + { "SBF-VELCOVGEODETIC", { + 0x24, 0x40, 0x44, 0x85, 0x14, 0x17, 0x38, 0x00, 0x08, 0xce, 0xa8, 0x0d, 0x58, 0x09, 0x01, 0x00, + 0x77, 0x08, 0xdd, 0x37, 0x85, 0xd7, 0x98, 0x37, 0xac, 0xbb, 0x49, 0x38, 0xcf, 0x28, 0x1c, 0x38, + 0xd2, 0x00, 0x39, 0xb5, 0x5e, 0x0e, 0x04, 0xb5, 0xce, 0xd5, 0x7e, 0x35, 0xcd, 0x1d, 0xc6, 0x35, + 0xe0, 0x2f, 0xcd, 0x35, 0xd3, 0x46, 0x01, 0x38 } } + }, { + })); // clang-format on + + TestDetector({ 0x24, 0x40, 0xff, 0xd1, 0xa1, 0x0f, 0x20, 0x00, 0xc0, 0xf8, 0xa7, 0x0d, 0x58, 0x09, 0x29, 0x00, 0x49, + 0x00, 0x22, 0x00, 0x26, 0x00, 0x3e, 0x00, 0xbf, 0xfa, 0xbc, 0x40, 0x1b, 0x6d, 0x22, 0x41 }); + + TestBadMessage({ 0x24, 0x40, 0xfe, 0xd1, 0xa1, 0x0f, 0x20, 0x00, 0xc0, 0xf8, 0xa7, 0x0d, 0x58, 0x09, 0x29, 0x00, + 0x49, 0x00, 0x22, 0x00, 0x26, 0x00, 0x3e, 0x00, 0xbf, 0xfa, 0xbc, 0x40, 0x1b, 0x6d, 0x22, 0x41 }); // bad crc + TestBadMessage({ 0x24, 0x40, 0xff, 0xd1, 0xa1, 0x0f, 0x00, 0x00, 0xc0, 0xf8, 0xa7, 0x0d, 0x58, 0x09, 0x29, 0x00, + 0x49, 0x00, 0x22, 0x00, 0x26, 0x00, 0x3e, 0x00, 0xbf, 0xfa, 0xbc, 0x40, 0x1b, 0x6d, 0x22, + 0x41 }); // length < head size + TestBadMessage( + { 0x24, 0x40, 0xff, 0xd1, 0xa1, 0x0f, 0x1f, 0x00, 0xc0, 0xf8, 0xa7, 0x0d, 0x58, 0x09, 0x29, 0x00, 0x49, 0x00, + 0x22, 0x00, 0x26, 0x00, 0x3e, 0x00, 0xbf, 0xfa, 0xbc, 0x40, 0x1b, 0x6d, 0x22, 0x41 }); // length % 4 != 0 +} + +// --------------------------------------------------------------------------------------------------------------------- + TEST_F(ParserTest, FP_A) { Parser parser;