From cab5e7eeed15f54717ab6af37c5a63fe53bfa047 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 05:17:39 +0000 Subject: [PATCH 1/6] Bump codecov/codecov-action from 3 to 5 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index e69308f..3587d65 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -49,7 +49,7 @@ jobs: echo "CODECOV_TOKEN=$CODECOV_TOKEN" >> "$GITHUB_ENV" - name: Upload coverage report to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: file: "${{ env.COVERAGE_DATA_PATH }}" fail_ci_if_error: true From 7f5410d63ae3c2cf3dd5e4074b05d66f28bd9257 Mon Sep 17 00:00:00 2001 From: fabik111 Date: Tue, 13 May 2025 11:08:12 +0200 Subject: [PATCH 2/6] fix the first frame of snake animation --- src/utility/LEDFeedback.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utility/LEDFeedback.cpp b/src/utility/LEDFeedback.cpp index ca670b5..0264dbd 100644 --- a/src/utility/LEDFeedback.cpp +++ b/src/utility/LEDFeedback.cpp @@ -194,6 +194,9 @@ void LEDFeedbackClass::setMode(LEDFeedbackMode mode) { _framePtr = nullptr; matrix.loadSequence(snake); matrix.play(true); + /* For fixing the issue that the first + * frame of the first run is not shown */ + matrix.loadSequence(snake); #endif _ledChangeInterval = HEARTBEAT_INTERVAL; _count = 0; From c7c6f9d4973222c1126ac3e73959e20870102c1f Mon Sep 17 00:00:00 2001 From: fabik111 Date: Tue, 13 May 2025 11:09:38 +0200 Subject: [PATCH 3/6] set the duration of first frame of snake animation at 2000 ms --- src/utility/LEDFeedback.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utility/LEDFeedback.cpp b/src/utility/LEDFeedback.cpp index 0264dbd..bcbf864 100644 --- a/src/utility/LEDFeedback.cpp +++ b/src/utility/LEDFeedback.cpp @@ -48,7 +48,7 @@ const uint32_t cloud[][4] = { }; const uint32_t snake[][4] = { - { 0xffffffff, 0xffffffff, 0xffffffff, 1300 }, + { 0xffffffff, 0xffffffff, 0xffffffff, 2000 }, { 0x7fffffff, 0xffffffff, 0xfffff7ff, 66 }, { 0x3fe7ffff, 0xffffffff, 0xff7ff3fe, 66 }, { 0x1fc3fe7f, 0xfffffff7, 0xff3fe1fc, 66 }, From 5e3933d47a19dbf2807aafd09ef01f90c8dc46bf Mon Sep 17 00:00:00 2001 From: Fabio C Date: Tue, 20 May 2025 11:02:29 +0200 Subject: [PATCH 4/6] bump cloud-utils to 1.1.0: use copyCBORStringToArray from cloud-utils (#11) --- .../cbor/Decoder.cpp | 69 ++++++++----------- 1 file changed, 30 insertions(+), 39 deletions(-) diff --git a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Decoder.cpp b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Decoder.cpp index bac0846..9bc5c40 100644 --- a/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Decoder.cpp +++ b/src/configuratorAgents/agents/boardConfigurationProtocol/cbor/Decoder.cpp @@ -10,35 +10,11 @@ #include "Decoder.h" #include +#include #if defined(BOARD_HAS_ETHERNET) #include #endif -// FIXME move this utility functions -static bool copyCBORStringToArray(CborValue * param, char * dest, size_t dest_size) { - if (cbor_value_is_text_string(param)) { - // NOTE: keep in mind that _cbor_value_copy_string tries to put a \0 at the end of the string - if(_cbor_value_copy_string(param, dest, &dest_size, NULL) == CborNoError) { - return true; - } - } - - return false; -} - -// FIXME dest_size should be also returned, the copied byte array can have a different size from the starting one -// for the time being we need this on SHA256 only -static bool copyCBORByteToArray(CborValue * param, uint8_t * dest, size_t dest_size) { - if (cbor_value_is_byte_string(param)) { - // NOTE: keep in mind that _cbor_value_copy_string tries to put a \0 at the end of the string - if(_cbor_value_copy_string(param, dest, &dest_size, NULL) == CborNoError) { - return true; - } - } - - return false; -} - MessageDecoder::Status TimestampProvisioningMessageDecoder::decode(CborValue* param, Message* message) { TimestampProvisioningMessage* ts = (TimestampProvisioningMessage*) message; @@ -56,8 +32,9 @@ MessageDecoder::Status TimestampProvisioningMessageDecoder::decode(CborValue* pa MessageDecoder::Status WifiConfigProvisioningMessageDecoder::decode(CborValue* param, Message* message) { NetworkConfigProvisioningMessage* provisioningNetworkConfig = (NetworkConfigProvisioningMessage*) message; memset(&provisioningNetworkConfig->networkSetting, 0x00, sizeof(models::NetworkSetting)); + size_t ssidSize = sizeof(provisioningNetworkConfig->networkSetting.wifi.ssid); // Message is composed of 2 parameters: ssid and password - if (!copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.wifi.ssid, sizeof(provisioningNetworkConfig->networkSetting.wifi.ssid))) { + if (cbor::utils::copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.wifi.ssid, ssidSize) == MessageDecoder::Status::Error) { return MessageDecoder::Status::Error; } @@ -66,7 +43,8 @@ MessageDecoder::Status WifiConfigProvisioningMessageDecoder::decode(CborValue* p return MessageDecoder::Status::Error; } - if (!copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.wifi.pwd, sizeof(provisioningNetworkConfig->networkSetting.wifi.pwd))) { + size_t pwdSize = sizeof(provisioningNetworkConfig->networkSetting.wifi.pwd); + if (cbor::utils::copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.wifi.pwd, pwdSize) == MessageDecoder::Status::Error) { return MessageDecoder::Status::Error; } provisioningNetworkConfig->networkSetting.type = NetworkAdapter::WIFI; @@ -92,8 +70,9 @@ MessageDecoder::Status CommandsProvisioningMessageDecoder::decode(CborValue* par MessageDecoder::Status LoRaConfigProvisioningMessageDecoder::decode(CborValue* param, Message* message) { NetworkConfigProvisioningMessage* provisioningNetworkConfig = (NetworkConfigProvisioningMessage*) message; memset(&provisioningNetworkConfig->networkSetting, 0x00, sizeof(models::NetworkSetting)); + size_t appeuiSize = sizeof(provisioningNetworkConfig->networkSetting.lora.appeui); // Message is composed of 5 parameters: app_eui, app_key, band, channel_mask, device_class - if (!copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.lora.appeui, sizeof(provisioningNetworkConfig->networkSetting.lora.appeui))) { + if (cbor::utils::copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.lora.appeui, appeuiSize) == MessageDecoder::Status::Error) { return MessageDecoder::Status::Error; } @@ -102,7 +81,8 @@ MessageDecoder::Status LoRaConfigProvisioningMessageDecoder::decode(CborValue* p return MessageDecoder::Status::Error; } - if (!copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.lora.appkey, sizeof(provisioningNetworkConfig->networkSetting.lora.appkey))) { + size_t appkeySize = sizeof(provisioningNetworkConfig->networkSetting.lora.appkey); + if (cbor::utils::copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.lora.appkey, appkeySize) == MessageDecoder::Status::Error) { return MessageDecoder::Status::Error; } @@ -127,7 +107,8 @@ MessageDecoder::Status LoRaConfigProvisioningMessageDecoder::decode(CborValue* p return MessageDecoder::Status::Error; } - if(!copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.lora.channelMask, sizeof(provisioningNetworkConfig->networkSetting.lora.channelMask))) { + size_t channelMaskSize = sizeof(provisioningNetworkConfig->networkSetting.lora.channelMask); + if(cbor::utils::copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.lora.channelMask, channelMaskSize) == MessageDecoder::Status::Error) { return MessageDecoder::Status::Error; } @@ -138,7 +119,9 @@ MessageDecoder::Status LoRaConfigProvisioningMessageDecoder::decode(CborValue* p char deviceClass[LORA_DEVICE_CLASS_SIZE]; memset(deviceClass, 0x00, sizeof(deviceClass)); - if (!copyCBORStringToArray(param, deviceClass, sizeof(deviceClass))) { + + size_t deviceClassSize = sizeof(deviceClass); + if (cbor::utils::copyCBORStringToArray(param, deviceClass, deviceClassSize) == MessageDecoder::Status::Error) { return MessageDecoder::Status::Error; } @@ -159,8 +142,9 @@ MessageDecoder::Status CATM1ConfigProvisioningMessageDecoder::decode(CborValue* CborValue array_iter; size_t arrayLength = 0; + size_t pinSize = sizeof(provisioningNetworkConfig->networkSetting.catm1.pin); // Message is composed of 5 parameters: pin, band, apn, login and password - if (!copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.catm1.pin, sizeof(provisioningNetworkConfig->networkSetting.catm1.pin))) { + if (cbor::utils::copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.catm1.pin, pinSize) == MessageDecoder::Status::Error) { return MessageDecoder::Status::Error; } @@ -208,7 +192,8 @@ MessageDecoder::Status CATM1ConfigProvisioningMessageDecoder::decode(CborValue* return MessageDecoder::Status::Error; } - if (!copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.catm1.apn, sizeof(provisioningNetworkConfig->networkSetting.catm1.apn))) { + size_t apnSize = sizeof(provisioningNetworkConfig->networkSetting.catm1.apn); + if (cbor::utils::copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.catm1.apn, apnSize) == MessageDecoder::Status::Error) { return MessageDecoder::Status::Error; } @@ -217,7 +202,8 @@ MessageDecoder::Status CATM1ConfigProvisioningMessageDecoder::decode(CborValue* return MessageDecoder::Status::Error; } - if (!copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.catm1.login, sizeof(provisioningNetworkConfig->networkSetting.catm1.login))) { + size_t loginSize = sizeof(provisioningNetworkConfig->networkSetting.catm1.login); + if (cbor::utils::copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.catm1.login, loginSize) == MessageDecoder::Status::Error) { return MessageDecoder::Status::Error; } @@ -226,7 +212,8 @@ MessageDecoder::Status CATM1ConfigProvisioningMessageDecoder::decode(CborValue* return MessageDecoder::Status::Error; } - if (!copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.catm1.pass, sizeof(provisioningNetworkConfig->networkSetting.catm1.pass))) { + size_t passSize = sizeof(provisioningNetworkConfig->networkSetting.catm1.pass); + if (cbor::utils::copyCBORStringToArray(param, provisioningNetworkConfig->networkSetting.catm1.pass, passSize) == MessageDecoder::Status::Error) { return MessageDecoder::Status::Error; } @@ -343,8 +330,9 @@ MessageDecoder::Status EthernetConfigProvisioningMessageDecoder::decode(CborValu #if defined(BOARD_HAS_NB) || defined(BOARD_HAS_GSM) ||defined(BOARD_HAS_CELLULAR) static inline MessageDecoder::Status extractCellularFields(CborValue* param, models::CellularSetting* cellSetting) { + size_t pinSize = sizeof(cellSetting->pin); // Message is composed of 4 parameters: pin, apn, login and password - if (!copyCBORStringToArray(param, cellSetting->pin, sizeof(cellSetting->pin))) { + if (cbor::utils::copyCBORStringToArray(param, cellSetting->pin, pinSize) == MessageDecoder::Status::Error) { return MessageDecoder::Status::Error; } @@ -353,7 +341,8 @@ static inline MessageDecoder::Status extractCellularFields(CborValue* param, mod return MessageDecoder::Status::Error; } - if (!copyCBORStringToArray(param, cellSetting->apn, sizeof(cellSetting->apn))) { + size_t apnSize = sizeof(cellSetting->apn); + if (cbor::utils::copyCBORStringToArray(param, cellSetting->apn, apnSize) == MessageDecoder::Status::Error) { return MessageDecoder::Status::Error; } @@ -362,7 +351,8 @@ static inline MessageDecoder::Status extractCellularFields(CborValue* param, mod return MessageDecoder::Status::Error; } - if (!copyCBORStringToArray(param, cellSetting->login, sizeof(cellSetting->login))) { + size_t loginSize = sizeof(cellSetting->login); + if (cbor::utils::copyCBORStringToArray(param, cellSetting->login, loginSize) == MessageDecoder::Status::Error) { return MessageDecoder::Status::Error; } @@ -371,7 +361,8 @@ static inline MessageDecoder::Status extractCellularFields(CborValue* param, mod return MessageDecoder::Status::Error; } - if (!copyCBORStringToArray(param, cellSetting->pass, sizeof(cellSetting->pass))) { + size_t passSize = sizeof(cellSetting->pass); + if (cbor::utils::copyCBORStringToArray(param, cellSetting->pass, passSize) == MessageDecoder::Status::Error) { return MessageDecoder::Status::Error; } From f5184f79cfc5a2ff39162ce2612a3f16c1c45ea7 Mon Sep 17 00:00:00 2001 From: Fabio C Date: Tue, 20 May 2025 11:11:14 +0200 Subject: [PATCH 5/6] Fix for updating credential when AgentsManagerClass is not polled only by NetworkConfigurator(#10) --- src/Arduino_NetworkConfigurator.cpp | 23 +++++++++++++---------- src/Arduino_NetworkConfigurator.h | 1 + 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Arduino_NetworkConfigurator.cpp b/src/Arduino_NetworkConfigurator.cpp index 85bf4a0..f448b1f 100644 --- a/src/Arduino_NetworkConfigurator.cpp +++ b/src/Arduino_NetworkConfigurator.cpp @@ -33,6 +33,7 @@ NetworkConfiguratorClass::NetworkConfiguratorClass(ConnectionHandler &connection _state{ NetworkConfiguratorStates::END }, _connectionHandler{ &connectionHandler }, _connectionHandlerIstantiated{ false }, + _configInProgress{ false }, _kvstore{ nullptr }, _connectionTimeout{ NC_CONNECTION_TIMEOUT_ms, NC_CONNECTION_TIMEOUT_ms }, _connectionRetryTimer{ NC_CONNECTION_RETRY_TIMER_ms, NC_CONNECTION_RETRY_TIMER_ms }, @@ -547,8 +548,11 @@ NetworkConfiguratorStates NetworkConfiguratorClass::handleConnecting() { _agentsManager->update(); //To keep alive the connection with the configurator StatusMessage err; ConnectionResult res = connectToNetwork(&err); - + _configInProgress = _agentsManager->isConfigInProgress(); if (res == ConnectionResult::SUCCESS) { + if (_configInProgress) { + _ledFeedback->setMode(LEDFeedbackClass::LEDFeedbackMode::PEER_CONNECTED); + } return NetworkConfiguratorStates::CONFIGURED; } else if (res == ConnectionResult::FAILED) { sendStatus(err); @@ -560,17 +564,16 @@ NetworkConfiguratorStates NetworkConfiguratorClass::handleConnecting() { } NetworkConfiguratorStates NetworkConfiguratorClass::handleConfigured() { - bool configInprogress = _agentsManager->isConfigInProgress(); - - if (configInprogress) { - _ledFeedback->setMode(LEDFeedbackClass::LEDFeedbackMode::PEER_CONNECTED); - } - _agentsManager->update(); + const bool updatedConfigInprogress = _agentsManager->isConfigInProgress(); + // If the agent manager changes state, it means that user is trying to configure the network, so the network configurator should change state - if (_agentsManager->isConfigInProgress() && !configInprogress) { - scanNetworkOptions(); - return NetworkConfiguratorStates::UPDATING_CONFIG; + if (_configInProgress != updatedConfigInprogress) { + _configInProgress = updatedConfigInprogress; + if (_configInProgress) { + scanNetworkOptions(); + return NetworkConfiguratorStates::UPDATING_CONFIG; + } } return NetworkConfiguratorStates::CONFIGURED; diff --git a/src/Arduino_NetworkConfigurator.h b/src/Arduino_NetworkConfigurator.h index e22bf1c..d68bbdb 100644 --- a/src/Arduino_NetworkConfigurator.h +++ b/src/Arduino_NetworkConfigurator.h @@ -162,6 +162,7 @@ class NetworkConfiguratorClass { ConnectionHandler *_connectionHandler; static inline models::NetworkSetting _networkSetting; bool _connectionHandlerIstantiated; + bool _configInProgress; ResetInput *_resetInput; LEDFeedbackClass *_ledFeedback; /* Timeout instances */ From b349c5d162884a53c96ca6a1324d70c1f2b9b51d Mon Sep 17 00:00:00 2001 From: fabik111 Date: Tue, 20 May 2025 12:07:21 +0200 Subject: [PATCH 6/6] Release version 0.1.3 --- library.properties | 2 +- src/ANetworkConfigurator_Config.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library.properties b/library.properties index a90f9ad..7792473 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Arduino_NetworkConfigurator -version=0.1.2 +version=0.1.3 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 9b474ba..315ce41 100644 --- a/src/ANetworkConfigurator_Config.h +++ b/src/ANetworkConfigurator_Config.h @@ -7,7 +7,7 @@ */ #pragma once -#define ANetworkConfigurator_LIB_VERSION "0.1.2" +#define ANetworkConfigurator_LIB_VERSION "0.1.3" #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