From 8b8b111eff72ae738f1c5923a7c6688fc0f552d3 Mon Sep 17 00:00:00 2001 From: Fabio C Date: Tue, 29 Apr 2025 14:37:50 +0200 Subject: [PATCH 1/7] Reorganize folder structure (#5) * move utilities classes to parent folder * rename Utility->utility * reorganize configuratorAgents folder * rename BoardConfigurationProtocol->boardConfigurationProtocol --- .github/workflows/compile-examples.yml | 2 +- .../NetworkConfiguratorDemo/NetworkConfiguratorDemo.ino | 4 ++-- extras/test/CMakeLists.txt | 8 ++++---- extras/test/src/test_provisioning_command_decode.cpp | 4 ++-- extras/test/src/test_provisioning_command_encode.cpp | 4 ++-- src/Arduino_NetworkConfigurator.cpp | 4 ++-- src/Arduino_NetworkConfigurator.h | 6 +++--- .../AgentsManager.cpp | 2 +- .../AgentsManager.h | 0 .../MessagesDefinitions.h | 0 .../NetworkOptionsDefinitions.h | 0 .../agents/BLE => configuratorAgents/agents}/BLEAgent.h | 8 ++++---- .../agents/ConfiguratorAgent.h | 4 ++-- .../Serial => configuratorAgents/agents}/SerialAgent.h | 8 ++++---- .../BoardConfigurationProtocol.cpp | 0 .../BoardConfigurationProtocol.h | 2 +- .../agents/boardConfigurationProtocol}/CBORAdapter.cpp | 0 .../agents/boardConfigurationProtocol}/CBORAdapter.h | 2 +- .../agents/boardConfigurationProtocol}/PacketBuffer.h | 0 .../agents/boardConfigurationProtocol}/PacketManager.cpp | 0 .../agents/boardConfigurationProtocol}/PacketManager.h | 0 .../agents/boardConfigurationProtocol}/cbor/CBOR.h | 0 .../boardConfigurationProtocol}/cbor/CBORInstances.h | 0 .../agents/boardConfigurationProtocol}/cbor/Decoder.cpp | 0 .../agents/boardConfigurationProtocol}/cbor/Decoder.h | 0 .../agents/boardConfigurationProtocol}/cbor/Encoder.cpp | 0 .../agents/boardConfigurationProtocol}/cbor/Encoder.h | 0 .../cbor/ProvisioningMessage.h | 2 +- src/{Utility/LEDFeedback => utility}/LEDFeedback.cpp | 0 src/{Utility/LEDFeedback => utility}/LEDFeedback.h | 0 src/{Utility/ResetInput => utility}/ResetInput.cpp | 2 +- src/{Utility/ResetInput => utility}/ResetInput.h | 0 32 files changed, 31 insertions(+), 31 deletions(-) rename src/{ConfiguratorAgents => configuratorAgents}/AgentsManager.cpp (99%) rename src/{ConfiguratorAgents => configuratorAgents}/AgentsManager.h (100%) rename src/{ConfiguratorAgents => configuratorAgents}/MessagesDefinitions.h (100%) rename src/{ConfiguratorAgents => configuratorAgents}/NetworkOptionsDefinitions.h (100%) rename src/{ConfiguratorAgents/agents/BLE => configuratorAgents/agents}/BLEAgent.h (97%) rename src/{ConfiguratorAgents => configuratorAgents}/agents/ConfiguratorAgent.h (96%) rename src/{ConfiguratorAgents/agents/Serial => configuratorAgents/agents}/SerialAgent.h (96%) rename src/{ConfiguratorAgents/agents/BoardConfigurationProtocol => configuratorAgents/agents/boardConfigurationProtocol}/BoardConfigurationProtocol.cpp (100%) rename src/{ConfiguratorAgents/agents/BoardConfigurationProtocol => configuratorAgents/agents/boardConfigurationProtocol}/BoardConfigurationProtocol.h (98%) rename src/{ConfiguratorAgents/agents/BoardConfigurationProtocol => configuratorAgents/agents/boardConfigurationProtocol}/CBORAdapter.cpp (100%) rename src/{ConfiguratorAgents/agents/BoardConfigurationProtocol => configuratorAgents/agents/boardConfigurationProtocol}/CBORAdapter.h (97%) rename src/{ConfiguratorAgents/agents/BoardConfigurationProtocol => configuratorAgents/agents/boardConfigurationProtocol}/PacketBuffer.h (100%) rename src/{ConfiguratorAgents/agents/BoardConfigurationProtocol => configuratorAgents/agents/boardConfigurationProtocol}/PacketManager.cpp (100%) rename src/{ConfiguratorAgents/agents/BoardConfigurationProtocol => configuratorAgents/agents/boardConfigurationProtocol}/PacketManager.h (100%) rename src/{ConfiguratorAgents/agents/BoardConfigurationProtocol => configuratorAgents/agents/boardConfigurationProtocol}/cbor/CBOR.h (100%) rename src/{ConfiguratorAgents/agents/BoardConfigurationProtocol => configuratorAgents/agents/boardConfigurationProtocol}/cbor/CBORInstances.h (100%) rename src/{ConfiguratorAgents/agents/BoardConfigurationProtocol => configuratorAgents/agents/boardConfigurationProtocol}/cbor/Decoder.cpp (100%) rename src/{ConfiguratorAgents/agents/BoardConfigurationProtocol => configuratorAgents/agents/boardConfigurationProtocol}/cbor/Decoder.h (100%) rename src/{ConfiguratorAgents/agents/BoardConfigurationProtocol => configuratorAgents/agents/boardConfigurationProtocol}/cbor/Encoder.cpp (100%) rename src/{ConfiguratorAgents/agents/BoardConfigurationProtocol => configuratorAgents/agents/boardConfigurationProtocol}/cbor/Encoder.h (100%) rename src/{ConfiguratorAgents/agents/BoardConfigurationProtocol => configuratorAgents/agents/boardConfigurationProtocol}/cbor/ProvisioningMessage.h (98%) rename src/{Utility/LEDFeedback => utility}/LEDFeedback.cpp (100%) rename src/{Utility/LEDFeedback => utility}/LEDFeedback.h (100%) rename src/{Utility/ResetInput => utility}/ResetInput.cpp (97%) rename src/{Utility/ResetInput => utility}/ResetInput.h (100%) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 1644caf..8e3d1e0 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -30,7 +30,7 @@ jobs: - source-path: ./ - name: Arduino_DebugUtils - source-url: https://github.com/fabik111/Arduino_ConnectionHandler.git - version: 0314cf54593029aea05bb8c179e40a26128f7d67 + version: 54b93d64da130f653fb437819c22fb89b78732d0 - source-url: https://github.com/arduino-libraries/ArduinoBLE.git - source-url: https://github.com/arduino-libraries/Arduino_CloudUtils.git - source-url: https://github.com/arduino-libraries/Arduino_KVStore.git diff --git a/examples/NetworkConfiguratorDemo/NetworkConfiguratorDemo.ino b/examples/NetworkConfiguratorDemo/NetworkConfiguratorDemo.ino index d832a2a..1bb8e6c 100644 --- a/examples/NetworkConfiguratorDemo/NetworkConfiguratorDemo.ino +++ b/examples/NetworkConfiguratorDemo/NetworkConfiguratorDemo.ino @@ -34,8 +34,8 @@ #include #include #include -#include -#include +#include +#include KVStore kvstore; BLEAgentClass BLEAgent; diff --git a/extras/test/CMakeLists.txt b/extras/test/CMakeLists.txt index 1393140..b4c0898 100644 --- a/extras/test/CMakeLists.txt +++ b/extras/test/CMakeLists.txt @@ -46,8 +46,8 @@ endif() include_directories(include) include_directories(../../src) -include_directories(../../src/ConfiguratorAgents) -include_directories(../../src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor) +include_directories(../../src/configuratorAgents) +include_directories(../../src/configuratorAgents/agents/boardConfigurationProtocol/cbor) # add_library(cloudutils STATIC IMPORTED GLOBAL) add_library(cloudutils INTERFACE) @@ -98,8 +98,8 @@ set(TEST_SRCS ) set(TEST_DUT_SRCS - ../../src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/Decoder.cpp - ../../src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/Encoder.cpp + ../../src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Decoder.cpp + ../../src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Encoder.cpp ${cloudutils_SOURCE_DIR}/src/cbor/tinycbor/src/cborencoder.c ${cloudutils_SOURCE_DIR}/src/cbor/tinycbor/src/cborencoder_close_container_checked.c diff --git a/extras/test/src/test_provisioning_command_decode.cpp b/extras/test/src/test_provisioning_command_decode.cpp index 8571697..d2c32be 100644 --- a/extras/test/src/test_provisioning_command_decode.cpp +++ b/extras/test/src/test_provisioning_command_decode.cpp @@ -13,8 +13,8 @@ #include #include - #include "../../src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/CBOR.h" - #include "../../src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/CBORInstances.h" + #include "../../src/configuratorAgents/agents/boardConfigurationProtocol/cbor/CBOR.h" + #include "../../src/configuratorAgents/agents/boardConfigurationProtocol/cbor/CBORInstances.h" #include /****************************************************************************** diff --git a/extras/test/src/test_provisioning_command_encode.cpp b/extras/test/src/test_provisioning_command_encode.cpp index 28ef8f5..b0f7198 100644 --- a/extras/test/src/test_provisioning_command_encode.cpp +++ b/extras/test/src/test_provisioning_command_encode.cpp @@ -11,8 +11,8 @@ #include #include #include - #include "../../src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/CBOR.h" - #include "../../src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/CBORInstances.h" + #include "../../src/configuratorAgents/agents/boardConfigurationProtocol/cbor/CBOR.h" + #include "../../src/configuratorAgents/agents/boardConfigurationProtocol/cbor/CBORInstances.h" /****************************************************************************** TEST CODE diff --git a/src/Arduino_NetworkConfigurator.cpp b/src/Arduino_NetworkConfigurator.cpp index 5e0b0f4..85bf4a0 100644 --- a/src/Arduino_NetworkConfigurator.cpp +++ b/src/Arduino_NetworkConfigurator.cpp @@ -11,8 +11,8 @@ #include #include "ConnectionHandlerDefinitions.h" -#include "ConfiguratorAgents/MessagesDefinitions.h" -#include "Utility/LEDFeedback/LEDFeedback.h" +#include "configuratorAgents/MessagesDefinitions.h" + #ifdef BOARD_HAS_WIFI #include "WiFiConnectionHandler.h" #endif diff --git a/src/Arduino_NetworkConfigurator.h b/src/Arduino_NetworkConfigurator.h index fe6c7bc..ff1d1db 100644 --- a/src/Arduino_NetworkConfigurator.h +++ b/src/Arduino_NetworkConfigurator.h @@ -12,12 +12,12 @@ #include "Arduino.h" #include "Arduino_ConnectionHandler.h" -#include "ConfiguratorAgents/AgentsManager.h" +#include "configuratorAgents/AgentsManager.h" #include #include #include -#include "Utility/ResetInput/ResetInput.h" -#include "Utility/LEDFeedback/LEDFeedback.h" +#include "utility/ResetInput.h" +#include "utility/LEDFeedback.h" /** * @enum NetworkConfiguratorStates diff --git a/src/ConfiguratorAgents/AgentsManager.cpp b/src/configuratorAgents/AgentsManager.cpp similarity index 99% rename from src/ConfiguratorAgents/AgentsManager.cpp rename to src/configuratorAgents/AgentsManager.cpp index b9ce385..5d29311 100644 --- a/src/ConfiguratorAgents/AgentsManager.cpp +++ b/src/configuratorAgents/AgentsManager.cpp @@ -13,7 +13,7 @@ #include #include "AgentsManager.h" #include "NetworkOptionsDefinitions.h" -#include "Utility/LEDFeedback/LEDFeedback.h" +#include "utility/LEDFeedback.h" /****************************************************************************** * PUBLIC MEMBER FUNCTIONS diff --git a/src/ConfiguratorAgents/AgentsManager.h b/src/configuratorAgents/AgentsManager.h similarity index 100% rename from src/ConfiguratorAgents/AgentsManager.h rename to src/configuratorAgents/AgentsManager.h diff --git a/src/ConfiguratorAgents/MessagesDefinitions.h b/src/configuratorAgents/MessagesDefinitions.h similarity index 100% rename from src/ConfiguratorAgents/MessagesDefinitions.h rename to src/configuratorAgents/MessagesDefinitions.h diff --git a/src/ConfiguratorAgents/NetworkOptionsDefinitions.h b/src/configuratorAgents/NetworkOptionsDefinitions.h similarity index 100% rename from src/ConfiguratorAgents/NetworkOptionsDefinitions.h rename to src/configuratorAgents/NetworkOptionsDefinitions.h diff --git a/src/ConfiguratorAgents/agents/BLE/BLEAgent.h b/src/configuratorAgents/agents/BLEAgent.h similarity index 97% rename from src/ConfiguratorAgents/agents/BLE/BLEAgent.h rename to src/configuratorAgents/agents/BLEAgent.h index d9b45d0..6283cb8 100644 --- a/src/ConfiguratorAgents/agents/BLE/BLEAgent.h +++ b/src/configuratorAgents/agents/BLEAgent.h @@ -15,10 +15,10 @@ #include "utility/HCI.h" #include "BLEStringCharacteristic.h" #include "BLECharacteristic.h" -#include "ConfiguratorAgents/agents/ConfiguratorAgent.h" -#include "ConfiguratorAgents/agents/BoardConfigurationProtocol/BoardConfigurationProtocol.h" -#include "Utility/LEDFeedback/LEDFeedback.h" -#include "ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/CBORInstances.h" +#include "configuratorAgents/agents/ConfiguratorAgent.h" +#include "configuratorAgents/agents/boardConfigurationProtocol/BoardConfigurationProtocol.h" +#include "utility/LEDFeedback.h" +#include "configuratorAgents/agents/boardConfigurationProtocol/cbor/CBORInstances.h" #define BASE_LOCAL_NAME "Arduino" #define ARDUINO_COMPANY_ID 0x09A3 diff --git a/src/ConfiguratorAgents/agents/ConfiguratorAgent.h b/src/configuratorAgents/agents/ConfiguratorAgent.h similarity index 96% rename from src/ConfiguratorAgents/agents/ConfiguratorAgent.h rename to src/configuratorAgents/agents/ConfiguratorAgent.h index 4022e11..32cd731 100644 --- a/src/ConfiguratorAgents/agents/ConfiguratorAgent.h +++ b/src/configuratorAgents/agents/ConfiguratorAgent.h @@ -8,8 +8,8 @@ #pragma once #include "settings/settings.h" -#include "ConfiguratorAgents/NetworkOptionsDefinitions.h" -#include "ConfiguratorAgents/MessagesDefinitions.h" +#include "configuratorAgents/NetworkOptionsDefinitions.h" +#include "configuratorAgents/MessagesDefinitions.h" #include "Arduino.h" /** diff --git a/src/ConfiguratorAgents/agents/Serial/SerialAgent.h b/src/configuratorAgents/agents/SerialAgent.h similarity index 96% rename from src/ConfiguratorAgents/agents/Serial/SerialAgent.h rename to src/configuratorAgents/agents/SerialAgent.h index abcdb85..95c1248 100644 --- a/src/ConfiguratorAgents/agents/Serial/SerialAgent.h +++ b/src/configuratorAgents/agents/SerialAgent.h @@ -9,10 +9,10 @@ #pragma once #include #include "Arduino.h" -#include "ConfiguratorAgents/agents/ConfiguratorAgent.h" -#include "ConfiguratorAgents/agents/BoardConfigurationProtocol/BoardConfigurationProtocol.h" -#include "ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/CBORInstances.h" -#include "Utility/LEDFeedback/LEDFeedback.h" +#include "configuratorAgents/agents/ConfiguratorAgent.h" +#include "configuratorAgents/agents/boardConfigurationProtocol/BoardConfigurationProtocol.h" +#include "configuratorAgents/agents/boardConfigurationProtocol/cbor/CBORInstances.h" +#include "utility/LEDFeedback.h" /** * @class SerialAgentClass diff --git a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/BoardConfigurationProtocol.cpp b/src/configuratorAgents/agents/boardConfigurationProtocol/BoardConfigurationProtocol.cpp similarity index 100% rename from src/ConfiguratorAgents/agents/BoardConfigurationProtocol/BoardConfigurationProtocol.cpp rename to src/configuratorAgents/agents/boardConfigurationProtocol/BoardConfigurationProtocol.cpp diff --git a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/BoardConfigurationProtocol.h b/src/configuratorAgents/agents/boardConfigurationProtocol/BoardConfigurationProtocol.h similarity index 98% rename from src/ConfiguratorAgents/agents/BoardConfigurationProtocol/BoardConfigurationProtocol.h rename to src/configuratorAgents/agents/boardConfigurationProtocol/BoardConfigurationProtocol.h index 4db3bba..3a82291 100644 --- a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/BoardConfigurationProtocol.h +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/BoardConfigurationProtocol.h @@ -9,7 +9,7 @@ #pragma once #include #include "PacketManager.h" -#include "ConfiguratorAgents/MessagesDefinitions.h" +#include "configuratorAgents/MessagesDefinitions.h" /** * @class BoardConfigurationProtocol diff --git a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/CBORAdapter.cpp b/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.cpp similarity index 100% rename from src/ConfiguratorAgents/agents/BoardConfigurationProtocol/CBORAdapter.cpp rename to src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.cpp diff --git a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/CBORAdapter.h b/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.h similarity index 97% rename from src/ConfiguratorAgents/agents/BoardConfigurationProtocol/CBORAdapter.h rename to src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.h index 40917df..88fc856 100644 --- a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/CBORAdapter.h +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.h @@ -8,7 +8,7 @@ #pragma once #include "Arduino.h" -#include "ConfiguratorAgents/MessagesDefinitions.h" +#include "configuratorAgents/MessagesDefinitions.h" #include "settings/settings.h" #include "cbor/CBOR.h" #include "./cbor/CBOR.h" diff --git a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/PacketBuffer.h b/src/configuratorAgents/agents/boardConfigurationProtocol/PacketBuffer.h similarity index 100% rename from src/ConfiguratorAgents/agents/BoardConfigurationProtocol/PacketBuffer.h rename to src/configuratorAgents/agents/boardConfigurationProtocol/PacketBuffer.h diff --git a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/PacketManager.cpp b/src/configuratorAgents/agents/boardConfigurationProtocol/PacketManager.cpp similarity index 100% rename from src/ConfiguratorAgents/agents/BoardConfigurationProtocol/PacketManager.cpp rename to src/configuratorAgents/agents/boardConfigurationProtocol/PacketManager.cpp diff --git a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/PacketManager.h b/src/configuratorAgents/agents/boardConfigurationProtocol/PacketManager.h similarity index 100% rename from src/ConfiguratorAgents/agents/BoardConfigurationProtocol/PacketManager.h rename to src/configuratorAgents/agents/boardConfigurationProtocol/PacketManager.h diff --git a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/CBOR.h b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/CBOR.h similarity index 100% rename from src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/CBOR.h rename to src/configuratorAgents/agents/boardConfigurationProtocol/cbor/CBOR.h diff --git a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/CBORInstances.h b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/CBORInstances.h similarity index 100% rename from src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/CBORInstances.h rename to src/configuratorAgents/agents/boardConfigurationProtocol/cbor/CBORInstances.h diff --git a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/Decoder.cpp b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Decoder.cpp similarity index 100% rename from src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/Decoder.cpp rename to src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Decoder.cpp diff --git a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/Decoder.h b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Decoder.h similarity index 100% rename from src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/Decoder.h rename to src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Decoder.h diff --git a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/Encoder.cpp b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Encoder.cpp similarity index 100% rename from src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/Encoder.cpp rename to src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Encoder.cpp diff --git a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/Encoder.h b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Encoder.h similarity index 100% rename from src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/Encoder.h rename to src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Encoder.h diff --git a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/ProvisioningMessage.h b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h similarity index 98% rename from src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/ProvisioningMessage.h rename to src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h index 383c9ef..ac9d467 100644 --- a/src/ConfiguratorAgents/agents/BoardConfigurationProtocol/cbor/ProvisioningMessage.h +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include #define UHWID_SIZE 32 #define PROVISIONING_JWT_SIZE 269 // Max length of jwt is 268 + \0 diff --git a/src/Utility/LEDFeedback/LEDFeedback.cpp b/src/utility/LEDFeedback.cpp similarity index 100% rename from src/Utility/LEDFeedback/LEDFeedback.cpp rename to src/utility/LEDFeedback.cpp diff --git a/src/Utility/LEDFeedback/LEDFeedback.h b/src/utility/LEDFeedback.h similarity index 100% rename from src/Utility/LEDFeedback/LEDFeedback.h rename to src/utility/LEDFeedback.h diff --git a/src/Utility/ResetInput/ResetInput.cpp b/src/utility/ResetInput.cpp similarity index 97% rename from src/Utility/ResetInput/ResetInput.cpp rename to src/utility/ResetInput.cpp index ddfc1f2..0df5fc0 100644 --- a/src/Utility/ResetInput/ResetInput.cpp +++ b/src/utility/ResetInput.cpp @@ -9,7 +9,7 @@ #if NETWORK_CONFIGURATOR_COMPATIBLE #include "ResetInput.h" -#include "Utility/LEDFeedback/LEDFeedback.h" +#include "utility/LEDFeedback.h" ResetInput &ResetInput::getInstance() { static ResetInput instance; diff --git a/src/Utility/ResetInput/ResetInput.h b/src/utility/ResetInput.h similarity index 100% rename from src/Utility/ResetInput/ResetInput.h rename to src/utility/ResetInput.h From f6f40bc7121ddf84027f4267fff5e314753f90bf Mon Sep 17 00:00:00 2001 From: Fabio C Date: Mon, 5 May 2025 15:30:37 +0200 Subject: [PATCH 2/7] Add unit test workflow (#7) * add unit test workflow * CBORDefinitions: fix comment --- .github/workflows/unit-tests.yml | 56 +++++++++++++++++++ .../src/test_provisioning_command_encode.cpp | 1 + .../cbor/ProvisioningMessage.h | 2 +- 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/unit-tests.yml diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 0000000..e69308f --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,56 @@ +name: Unit Tests + +on: + pull_request: + paths: + - ".github/workflows/unit-tests.yml" + - 'extras/test/**' + - 'src/**' + + push: + paths: + - ".github/workflows/unit-tests.yml" + - 'extras/test/**' + - 'src/**' + +jobs: + test: + name: Run unit tests + runs-on: ubuntu-latest + + env: + COVERAGE_DATA_PATH: extras/coverage-data/coverage.info + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: arduino/cpp-test-action@main + with: + runtime-paths: | + - extras/test/build/bin/testNetworkConfigurator + coverage-exclude-paths: | + - '*/extras/test/*' + - '/usr/*' + coverage-data-path: ${{ env.COVERAGE_DATA_PATH }} + + # A token is used to avoid intermittent spurious job failures caused by rate limiting. + - name: Set up Codecov upload token + run: | + if [[ "${{ github.repository }}" == "arduino-libraries/Arduino_NetworkConfigurator" ]]; then + # In order to avoid uploads of data from forks, only use the token for runs in the parent repo. + # Token is intentionally exposed. + # See: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954 + CODECOV_TOKEN="49f6e3b9-4c5b-40a0-ba75-0f5ce723a2ad" + else + # codecov/codecov-action does unauthenticated upload if empty string is passed via the `token` input. + CODECOV_TOKEN="" + fi + echo "CODECOV_TOKEN=$CODECOV_TOKEN" >> "$GITHUB_ENV" + + - name: Upload coverage report to Codecov + uses: codecov/codecov-action@v3 + with: + file: "${{ env.COVERAGE_DATA_PATH }}" + fail_ci_if_error: true + token: ${{ env.CODECOV_TOKEN }} diff --git a/extras/test/src/test_provisioning_command_encode.cpp b/extras/test/src/test_provisioning_command_encode.cpp index b0f7198..64872fc 100644 --- a/extras/test/src/test_provisioning_command_encode.cpp +++ b/extras/test/src/test_provisioning_command_encode.cpp @@ -123,6 +123,7 @@ { JWTProvisioningMessage command; command.c.id = ProvisioningMessageId::JWTProvisioningMessageId; + memset(command.jwt, 0x00, 269); memset(command.jwt, 0xCA, 268); uint8_t buffer[512]; size_t bytes_encoded = sizeof(buffer); diff --git a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h index ac9d467..97387d5 100644 --- a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h @@ -105,7 +105,7 @@ struct UniqueHardwareIdProvisioningMessage { struct JWTProvisioningMessage { ProvisioningMessage c; struct { - char jwt[PROVISIONING_JWT_SIZE]; //The payload is an array of char with a maximum length of 268, not null terminated. It's not a string. + char jwt[PROVISIONING_JWT_SIZE]; //The payload is a string with maximum dimension of 268 characters + '\0'. }; }; From 138c15817592906f93fffbc360ccdc8f38808567 Mon Sep 17 00:00:00 2001 From: fabik111 Date: Mon, 12 May 2025 15:30:47 +0200 Subject: [PATCH 3/7] Release version 0.1.1 --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 335e97c..8628408 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Arduino_NetworkConfigurator -version=0.0.1 +version=0.1.1 author=Arduino maintainer=Arduino sentence=This library allows to configure and update the network settings of a ConnectionHandler instance. From 2490c71372f0e4ef41e9e11f3150365196cd781e Mon Sep 17 00:00:00 2001 From: fabik111 Date: Tue, 6 May 2025 17:58:57 +0200 Subject: [PATCH 4/7] update test ci dep --- .github/workflows/compile-examples.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 8e3d1e0..4342ccc 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -31,9 +31,9 @@ jobs: - name: Arduino_DebugUtils - source-url: https://github.com/fabik111/Arduino_ConnectionHandler.git version: 54b93d64da130f653fb437819c22fb89b78732d0 - - source-url: https://github.com/arduino-libraries/ArduinoBLE.git - - source-url: https://github.com/arduino-libraries/Arduino_CloudUtils.git - - source-url: https://github.com/arduino-libraries/Arduino_KVStore.git + - name: ArduinoBLE + - name: Arduino_CloudUtils + - name: Arduino_KVStore SKETCH_PATHS: | - examples/NetworkConfiguratorDemo SKETCHES_REPORTS_PATH: sketches-reports From 541573882dda5b416d282edd52f4a066cef330fb Mon Sep 17 00:00:00 2001 From: fabik111 Date: Tue, 6 May 2025 17:59:25 +0200 Subject: [PATCH 5/7] add README.md --- README.md | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 149 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 99f1827..0546307 100644 --- a/README.md +++ b/README.md @@ -1 +1,149 @@ -# Network Configurator \ No newline at end of file +# Network Configurator + +[![Check Arduino status](https://github.com/arduino-libraries/Arduino_NetworkConfigurator/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_NetworkConfigurator/actions/workflows/check-arduino.yml) +[![Compile Examples](https://github.com/arduino-libraries/Arduino_NetworkConfigurator/workflows/Compile%20Examples/badge.svg)](https://github.com/arduino-libraries/Arduino_NetworkConfigurator/actions?workflow=Compile+Examples) +[![Spell Check](https://github.com/arduino-libraries/Arduino_NetworkConfigurator/workflows/Spell%20Check/badge.svg)](https://github.com/arduino-libraries/Arduino_NetworkConfigurator/actions?workflow=Spell+Check) +[![Unit Tests](https://github.com/arduino-libraries/Arduino_NetworkConfigurator/workflows/Unit%20Tests/badge.svg)](https://github.com/arduino-libraries/Arduino_NetworkConfigurator/actions?workflow=Unit+Tests) + +This library enables the *remote* configuration of an [`Arduino_ConnectionHandler`](https://github.com/arduino-libraries/Arduino_ConnectionHandler) instance through the board's physical interfaces like "Bluetooth Low Energy (BLE)", Serial, etc.. +The provided network configuration is stored on persistent storage and loaded at the start up. + +The library offers mechanisms for wiping out the saved network configuration on the persistent storage. + +## Supported boards and configurable connectivity types matrix +|Boards | WiFi | Ethernet | GSM | NB-IoT | CAT-M1 | Cellular | LoRa | +|-------|:----:|:--------:|:---:|:------:|:------:|:--------:|:----:| +|[`UNO R4 WiFi`](https://store.arduino.cc/products/uno-r4-wifi) | X | | | | | | | +|[`OPTA WiFi`](https://store.arduino.cc/products/opta-wifi) | X | X | | | | | | +|[`Portenta H7`](https://store.arduino.cc/portenta-h7) | X | X | | | X | X | | +|[`GIGA R1 WiFi`](https://store.arduino.cc/products/giga-r1-wifi)| X | | | | | | | +|[`Nicla Vision`](https://store.arduino.cc/products/nicla-vision)| X | | | | | | | +|[`Portenta C33`](https://store.arduino.cc/products/portenta-c33)| X | X | | | | | | +|[`Nano RP2040 Connect`](https://store.arduino.cc/products/arduino-nano-rp2040-connect)| X | | | | | | | +|[`Nano 33 IoT`](https://store.arduino.cc/arduino-nano-33-iot) | X | | | | | | | +|[`MKR WiFi 1010`](https://store.arduino.cc/arduino-mkr-wifi-1010)| X | | | | | | | + +## How to clean up the stored configuration + +The `NetworkConfigurator` library provides a way for wiping out the stored network settings and forcing +the restart of the BLE interface if turned off. + +The procedure: + +* `Arduino Opta`: press and hold the user button (`BTN_USER`) until the led (`LED_USER`) turns off +* `Arduino MKR WiFi 1010`: short the pin 7 to GND until the led turns off +* `Arduino GIGA R1 WiFi`: short the pin 7 to GND until the led turns off +* `Arduino Nano RP2040 Connect`: short the pin 2 to 3.3V until the led turns off +* Other boards: short the pin 2 to GND until the led turns off + +## Configurator Agents +The library provides a set of *Configurator Agents* that added as plug-in to the sketch handle the communication between the Arduino Network Configurator and an external client ([*Arduino IoT App*](https://cloud.arduino.cc/iot-remote-app/) and Arduino IoT Cloud) for configuring the board. + +Out-of-the box there are 2 Configurator Agents +* `BLEAgent`: manage the BLE interface +* `SerialAgent`: manage the Serial interface + +### Configurator Agents and supported board matrix +|Boards | BLEAgent | SerialAgent | +|-------|:----:|:--------:| +|[`UNO R4 WiFi`](https://store.arduino.cc/products/uno-r4-wifi) | X | X | +|[`OPTA WiFi`](https://store.arduino.cc/products/opta-wifi) | X | X | +|[`Portenta H7`](https://store.arduino.cc/portenta-h7) | X | X | +|[`GIGA R1 WiFi`](https://store.arduino.cc/products/giga-r1-wifi)| X | X | +|[`Nicla Vision`](https://store.arduino.cc/products/nicla-vision)| X | X | +|[`Portenta C33`](https://store.arduino.cc/products/portenta-c33)| X | X | +|[`Nano RP2040 Connect`](https://store.arduino.cc/products/arduino-nano-rp2040-connect)| X | X | +|[`Nano 33 IoT`](https://store.arduino.cc/arduino-nano-33-iot) | X | X | +|[`MKR WiFi 1010`](https://store.arduino.cc/arduino-mkr-wifi-1010)| X | X | + +### How to enable a Configurator Agent +1. Include the *Configurator Agent* header file in the sketch ex.: `#include ` +2. Declare a global variable of the *agent* in the sketch ex.: `BLEAgentClass BLEAgent;` +3. Register the *agent* to the `NetworkConfigurator` ex.:`NetworkConfigurator.addAgent(BLEAgent);` + +## Storage + +The `NetworkConfigurator` needs a *persistent storage* for saving the provided network configuration. + +The user must specify a *storage library* in the sketch and pass it to the `NetworkConfigurator` as parameter. + +The user can use the [`Arduino_KVStore`](https://github.com/arduino-libraries/Arduino_KVStore) library as storage, otherwise he can implement his own custom storage library. + +The custom storage library must be based on a Key-Value storage system and must implement the interface `KVStoreInterface` of the [`Arduino_KVStore`](https://github.com/arduino-libraries/Arduino_KVStore) library + +### How to set the storage library +1. Include the header file of the *storage library* ex.: `#include ` +2. Declare the instance of the *storage manager* ex.: `KVStore kvstore;` +3. Register the storage manager instance to the `NetworkConfigurator` ex.: `NetworkConfigurator.setStorage(kvstore);` + +## How-to-use +1. Choose and include a *storage library* like [`Arduino_KVStore`](https://github.com/arduino-libraries/Arduino_KVStore) +2. Choose and include the *Configurator Agents* +3. Register the *storage library* and the *Configurator Agents* to the `NetworkConfigurator` + +``` +#include +#include +#include +#include +#include + +KVStore kvstore; +BLEAgentClass BLEAgent; +SerialAgentClass SerialAgent; +GenericConnectionHandler conMan; +NetworkConfiguratorClass NetworkConfigurator(conMan); + +void setup() { + /* Initialize serial debug port and wait up to 5 seconds for port to open */ + Serial.begin(9600); + for(unsigned long const serialBeginTime = millis(); !Serial && (millis() - serialBeginTime <= 5000); ) { } + + /* Add callbacks to the ConnectionHandler object to get notified of network + * connection events. */ + conMan.addCallback(NetworkConnectionEvent::CONNECTED, onNetworkConnect); + conMan.addCallback(NetworkConnectionEvent::DISCONNECTED, onNetworkDisconnect); + conMan.addCallback(NetworkConnectionEvent::ERROR, onNetworkError); + + /* Set the KVStore */ + NetworkConfigurator.setStorage(kvstore); + /* Add the interfaces that are enabled for configuring the network*/ + NetworkConfigurator.addAgent(BLEAgent); + NetworkConfigurator.addAgent(SerialAgent); + + /* Start the network configurator */ + NetworkConfigurator.begin(); + +} + +void loop() { + /* + * Poll the networkConfigurator and check if connectionHandler is configured. + * If the ConnectionHandler has been configured, the following code keeps on + * running connection workflows on our allowing reconnection in case of failure + * and notification of connect/disconnect event if enabled. + * + * NOTE: any use of delay() within the loop or methods called from it will delay + * the execution of .update() and .check() methods of the NetworkConfigurator and + * ConnectionHandler objects which might not guarantee the correct functioning + * of the code. + */ + if(NetworkConfigurator.update() == NetworkConfiguratorStates::CONFIGURED) { + conMan.check(); + } +} + +void onNetworkConnect() { + Serial.println(">>>> CONNECTED to network"); +} + +void onNetworkDisconnect() { + Serial.println(">>>> DISCONNECTED from network"); +} + +void onNetworkError() { + Serial.println(">>>> ERROR"); +} +``` + +View the full example in the `example` folder. From 06485ddba65993d4f0680d3e2c557f693dd9f818 Mon Sep 17 00:00:00 2001 From: fabik111 Date: Thu, 8 May 2025 12:28:01 +0200 Subject: [PATCH 6/7] update connectionHandler dep --- .github/workflows/compile-examples.yml | 3 +-- src/Arduino_NetworkConfigurator.h | 2 +- src/configuratorAgents/AgentsManager.cpp | 1 - src/configuratorAgents/MessagesDefinitions.h | 2 +- src/configuratorAgents/agents/ConfiguratorAgent.h | 1 - .../agents/boardConfigurationProtocol/CBORAdapter.cpp | 1 - .../agents/boardConfigurationProtocol/CBORAdapter.h | 2 +- .../agents/boardConfigurationProtocol/cbor/Decoder.cpp | 2 +- .../boardConfigurationProtocol/cbor/ProvisioningMessage.h | 2 +- 9 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 4342ccc..e467e73 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -29,8 +29,7 @@ jobs: # Install the NetworkConfigurator library from the repository - source-path: ./ - name: Arduino_DebugUtils - - source-url: https://github.com/fabik111/Arduino_ConnectionHandler.git - version: 54b93d64da130f653fb437819c22fb89b78732d0 + - name: Arduino_ConnectionHandler - name: ArduinoBLE - name: Arduino_CloudUtils - name: Arduino_KVStore diff --git a/src/Arduino_NetworkConfigurator.h b/src/Arduino_NetworkConfigurator.h index ff1d1db..e22bf1c 100644 --- a/src/Arduino_NetworkConfigurator.h +++ b/src/Arduino_NetworkConfigurator.h @@ -13,7 +13,7 @@ #include "Arduino.h" #include "Arduino_ConnectionHandler.h" #include "configuratorAgents/AgentsManager.h" -#include +#include #include #include #include "utility/ResetInput.h" diff --git a/src/configuratorAgents/AgentsManager.cpp b/src/configuratorAgents/AgentsManager.cpp index 5d29311..71f8f34 100644 --- a/src/configuratorAgents/AgentsManager.cpp +++ b/src/configuratorAgents/AgentsManager.cpp @@ -10,7 +10,6 @@ #include #include -#include #include "AgentsManager.h" #include "NetworkOptionsDefinitions.h" #include "utility/LEDFeedback.h" diff --git a/src/configuratorAgents/MessagesDefinitions.h b/src/configuratorAgents/MessagesDefinitions.h index f79e888..2f2d460 100644 --- a/src/configuratorAgents/MessagesDefinitions.h +++ b/src/configuratorAgents/MessagesDefinitions.h @@ -9,7 +9,7 @@ #pragma once #include "Arduino.h" #include "NetworkOptionsDefinitions.h" -#include +#include #define MAX_UHWID_SIZE 32 #define MAX_JWT_SIZE 269 diff --git a/src/configuratorAgents/agents/ConfiguratorAgent.h b/src/configuratorAgents/agents/ConfiguratorAgent.h index 32cd731..0b44863 100644 --- a/src/configuratorAgents/agents/ConfiguratorAgent.h +++ b/src/configuratorAgents/agents/ConfiguratorAgent.h @@ -7,7 +7,6 @@ */ #pragma once -#include "settings/settings.h" #include "configuratorAgents/NetworkOptionsDefinitions.h" #include "configuratorAgents/MessagesDefinitions.h" #include "Arduino.h" diff --git a/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.cpp b/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.cpp index 456a163..96fcbf5 100644 --- a/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.cpp +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.cpp @@ -11,7 +11,6 @@ #include "CBORAdapter.h" #include "cbor/MessageEncoder.h" #include "cbor/MessageDecoder.h" -#include bool CBORAdapter::uhwidToCBOR(const byte *uhwid, uint8_t *data, size_t *len) { CBORMessageEncoder encoder; diff --git a/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.h b/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.h index 88fc856..09aeef8 100644 --- a/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.h +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/CBORAdapter.h @@ -9,7 +9,7 @@ #pragma once #include "Arduino.h" #include "configuratorAgents/MessagesDefinitions.h" -#include "settings/settings.h" +#include #include "cbor/CBOR.h" #include "./cbor/CBOR.h" diff --git a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Decoder.cpp b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Decoder.cpp index df6e657..bac0846 100644 --- a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Decoder.cpp +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Decoder.cpp @@ -9,7 +9,7 @@ #if NETWORK_CONFIGURATOR_COMPATIBLE #include "Decoder.h" -#include +#include #if defined(BOARD_HAS_ETHERNET) #include #endif diff --git a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h index 97387d5..240a7b5 100644 --- a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/ProvisioningMessage.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #define UHWID_SIZE 32 From 4c06ac357d2a7d2a3c6a05225e8fd24da0956427 Mon Sep 17 00:00:00 2001 From: fabik111 Date: Mon, 12 May 2025 15:48:08 +0200 Subject: [PATCH 7/7] Release version 0.1.2 --- library.properties | 2 +- src/ANetworkConfigurator_Config.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library.properties b/library.properties index 8628408..a90f9ad 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Arduino_NetworkConfigurator -version=0.1.1 +version=0.1.2 author=Arduino maintainer=Arduino sentence=This library allows to configure and update the network settings of a ConnectionHandler instance. diff --git a/src/ANetworkConfigurator_Config.h b/src/ANetworkConfigurator_Config.h index 8eb06f4..9b474ba 100644 --- a/src/ANetworkConfigurator_Config.h +++ b/src/ANetworkConfigurator_Config.h @@ -7,7 +7,7 @@ */ #pragma once -#define ANetworkConfigurator_LIB_VERSION "0.1.1" +#define ANetworkConfigurator_LIB_VERSION "0.1.2" #if defined(ARDUINO_SAMD_MKRWIFI1010) #define NETWORK_CONFIGURATOR_COMPATIBLE 1 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy