From 74b7d85d4ab9c503b65a4dc59cf45ca171b5f696 Mon Sep 17 00:00:00 2001 From: robbedptechnics Date: Fri, 21 Mar 2025 10:16:14 +0100 Subject: [PATCH] feat(modem): added config_edrx api function --- .pre-commit-config.yaml | 16 ++++++++-------- .../esp_modem_command_library_17.hpp | 2 -- .../esp_modem/include/esp_modem_c_api_types.h | 2 +- components/esp_modem/src/esp_modem_c_api.cpp | 16 +++++++--------- .../esp_modem/src/esp_modem_command_library.cpp | 1 + 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c0137d145..93dde2c6a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v4.3.0 hooks: - id: check-yaml - id: check-added-large-files @@ -13,12 +13,12 @@ repos: - id: mixed-line-ending - id: debug-statements - repo: https://github.com/pycqa/flake8 - rev: 7.1.2 + rev: 5.0.4 hooks: - id: flake8 args: ['--config=.flake8', '--tee', '--benchmark'] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.14.1 + rev: v0.981 hooks: - id: mypy exclude: > @@ -39,25 +39,25 @@ repos: hooks: - id: isort - repo: https://github.com/myint/eradicate/ - rev: 2.3.0 + rev: v2.1.0 hooks: - id: eradicate - repo: https://github.com/espressif/check-copyright/ - rev: v1.1.0 + rev: v1.0.3 hooks: - id: check-copyright args: ['--ignore', 'ci/check_copyright_ignore.txt', '--config', 'ci/check_copyright_config.yaml'] - repo: https://github.com/igrr/astyle_py.git - rev: v1.1.0 + rev: v1.0.5 hooks: - id: astyle_py args: ['--style=otbs', '--attach-namespaces', '--attach-classes', '--indent=spaces=4', '--convert-tabs', '--align-reference=name', '--keep-one-line-statements', '--pad-header', '--pad-oper', '--unpad-paren', '--max-continuation-indent=120', '--exclude-list=ci/ignore_astyle.txt'] - repo: https://github.com/commitizen-tools/commitizen - rev: v4.4.1 + rev: v2.42.1 hooks: - id: commitizen - id: commitizen-branch - stages: [pre-push, manual] + stages: [push, manual] - repo: local hooks: - id: commit message scopes diff --git a/components/esp_modem/include/cxx17_include/esp_modem_command_library_17.hpp b/components/esp_modem/include/cxx17_include/esp_modem_command_library_17.hpp index 6992e1d86..efabb8af0 100644 --- a/components/esp_modem/include/cxx17_include/esp_modem_command_library_17.hpp +++ b/components/esp_modem/include/cxx17_include/esp_modem_command_library_17.hpp @@ -9,8 +9,6 @@ #include "cxx_include/esp_modem_dte.hpp" #include "cxx_include/esp_modem_dce_module.hpp" -static const char *TAG = "command_lib"; - namespace esp_modem::dce_commands { command_result generic_command(CommandableIf *t, const std::string &command, const std::list &pass_phrase, diff --git a/components/esp_modem/include/esp_modem_c_api_types.h b/components/esp_modem/include/esp_modem_c_api_types.h index 17f39444b..c74076418 100644 --- a/components/esp_modem/include/esp_modem_c_api_types.h +++ b/components/esp_modem/include/esp_modem_c_api_types.h @@ -163,7 +163,7 @@ esp_err_t esp_modem_set_apn(esp_modem_dce_t *dce, const char *apn); esp_err_t esp_modem_set_urc(esp_modem_dce_t *dce, esp_err_t(*got_line_cb)(uint8_t *data, size_t len)); #endif -esp_err_t esp_modem_sqns_gm02s_connect(esp_modem_dce_t *dce, const esp_modem_PdpContext_t *pdp_context); +esp_err_t esp_modem_sqn_gm02s_connect(esp_modem_dce_t *dce, const esp_modem_PdpContext_t *pdp_context); /** * @brief This API provides support for temporarily pausing networking in order diff --git a/components/esp_modem/src/esp_modem_c_api.cpp b/components/esp_modem/src/esp_modem_c_api.cpp index 75250a0f6..6c85d9d46 100644 --- a/components/esp_modem/src/esp_modem_c_api.cpp +++ b/components/esp_modem/src/esp_modem_c_api.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -454,8 +454,7 @@ extern "C" esp_err_t esp_modem_config_psm(esp_modem_dce_t *dce_wrap, int mode, c extern "C" esp_err_t esp_modem_config_network_registration_urc(esp_modem_dce_t *dce_wrap, int value) { - if (dce_wrap == nullptr || dce_wrap->dce == nullptr || value > 5) - { + if (dce_wrap == nullptr || dce_wrap->dce == nullptr || value > 5) { return ESP_ERR_INVALID_ARG; } @@ -486,23 +485,22 @@ extern "C" esp_err_t esp_modem_config_mobile_termination_error(esp_modem_dce_t * return command_response_to_esp_err(dce_wrap->dce->config_mobile_termination_error(mode)); } -extern "C" esp_err_t esp_modem_config_edrx(esp_modem_dce_t *dce_wrap, int mode, int access_technology, const char *edrx_value, const char *ptw_value) +extern "C" esp_err_t esp_modem_config_edrx(esp_modem_dce_t *dce_wrap, int mode, int access_technology, const char *edrx_value) { if (dce_wrap == nullptr || dce_wrap->dce == nullptr || mode > 3 || access_technology > 5) { return ESP_ERR_INVALID_ARG; } - if ((mode == 1 || mode == 2 ) && (strlen(edrx_value) != 4 || strlen(ptw_value) != 4)) { + if ((mode == 1 || mode == 2) && strlen(edrx_value) != 4) { return ESP_ERR_INVALID_ARG; } - return command_response_to_esp_err(dce_wrap->dce->config_edrx(mode,access_technology,std::string(edrx_value),std::string(ptw_value))); + return command_response_to_esp_err(dce_wrap->dce->config_edrx(mode, access_technology, std::string(edrx_value))); } -extern "C" esp_err_t esp_modem_sqns_gm02s_connect(esp_modem_dce_t *dce_wrap, const esp_modem_PdpContext_t *pdp_context) +extern "C" esp_err_t esp_modem_sqn_gm02s_connect(esp_modem_dce_t *dce_wrap, const esp_modem_PdpContext_t *pdp_context) { - if (dce_wrap == nullptr || dce_wrap->dce == nullptr) - { + if (dce_wrap == nullptr || dce_wrap->dce == nullptr) { return ESP_ERR_INVALID_ARG; } diff --git a/components/esp_modem/src/esp_modem_command_library.cpp b/components/esp_modem/src/esp_modem_command_library.cpp index a29284a24..024008fcf 100644 --- a/components/esp_modem/src/esp_modem_command_library.cpp +++ b/components/esp_modem/src/esp_modem_command_library.cpp @@ -16,6 +16,7 @@ namespace esp_modem::dce_commands { +static const char *TAG = "command_lib"; command_result generic_command(CommandableIf *t, const std::string &command, const std::list &pass_phrase,