From 3968660b2a6d3a9d242a9b9815f8276765cb8636 Mon Sep 17 00:00:00 2001 From: Jonathan Dreyer Date: Sat, 30 Jan 2021 23:31:53 +0100 Subject: [PATCH] Move DCE_CHECK in the esp_modem_dce Signed-off-by: Jonathan Dreyer Signed-off-by: Liu Han --- .../components/modem/CMakeLists.txt | 1 - .../components/modem/component.mk | 1 - .../components/modem/include/esp_modem_dce.h | 14 ++++++++++ .../modem/private_include/bg96_private.h | 28 ------------------- .../pppos_client/components/modem/src/bg96.c | 2 +- .../modem/src/esp_modem_dce_service.c | 13 --------- .../components/modem/src/sim7600.c | 2 +- .../components/modem/src/sim800.c | 13 --------- 8 files changed, 16 insertions(+), 58 deletions(-) delete mode 100644 examples/protocols/pppos_client/components/modem/private_include/bg96_private.h diff --git a/examples/protocols/pppos_client/components/modem/CMakeLists.txt b/examples/protocols/pppos_client/components/modem/CMakeLists.txt index 50fa1a4b7b..bd6af3b747 100644 --- a/examples/protocols/pppos_client/components/modem/CMakeLists.txt +++ b/examples/protocols/pppos_client/components/modem/CMakeLists.txt @@ -8,5 +8,4 @@ set(srcs "src/esp_modem.c" idf_component_register(SRCS "${srcs}" INCLUDE_DIRS include - PRIV_INCLUDE_DIRS private_include REQUIRES driver) diff --git a/examples/protocols/pppos_client/components/modem/component.mk b/examples/protocols/pppos_client/components/modem/component.mk index d3afe77680..33f4c6039d 100644 --- a/examples/protocols/pppos_client/components/modem/component.mk +++ b/examples/protocols/pppos_client/components/modem/component.mk @@ -1,3 +1,2 @@ COMPONENT_ADD_INCLUDEDIRS := include -COMPONENT_PRIV_INCLUDEDIRS := private_include COMPONENT_SRCDIRS := src diff --git a/examples/protocols/pppos_client/components/modem/include/esp_modem_dce.h b/examples/protocols/pppos_client/components/modem/include/esp_modem_dce.h index 3da9d0aea1..7e89d428c0 100644 --- a/examples/protocols/pppos_client/components/modem/include/esp_modem_dce.h +++ b/examples/protocols/pppos_client/components/modem/include/esp_modem_dce.h @@ -13,6 +13,20 @@ // limitations under the License. #pragma once +/** + * @brief Macro defined for error checking + * + */ +#define DCE_CHECK(a, str, goto_tag, ...) \ + do \ + { \ + if (!(a)) \ + { \ + ESP_LOGE(DCE_TAG, "%s(%d): " str, __FUNCTION__, __LINE__, ##__VA_ARGS__); \ + goto goto_tag; \ + } \ + } while (0) + #ifdef __cplusplus extern "C" { #endif diff --git a/examples/protocols/pppos_client/components/modem/private_include/bg96_private.h b/examples/protocols/pppos_client/components/modem/private_include/bg96_private.h deleted file mode 100644 index eef0bd4aad..0000000000 --- a/examples/protocols/pppos_client/components/modem/private_include/bg96_private.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -#pragma once - -/** - * @brief Macro defined for error checking - * - */ -#define DCE_CHECK(a, str, goto_tag, ...) \ - do \ - { \ - if (!(a)) \ - { \ - ESP_LOGE(DCE_TAG, "%s(%d): " str, __FUNCTION__, __LINE__, ##__VA_ARGS__); \ - goto goto_tag; \ - } \ - } while (0) diff --git a/examples/protocols/pppos_client/components/modem/src/bg96.c b/examples/protocols/pppos_client/components/modem/src/bg96.c index a4e96ae17b..e74180d52c 100644 --- a/examples/protocols/pppos_client/components/modem/src/bg96.c +++ b/examples/protocols/pppos_client/components/modem/src/bg96.c @@ -14,8 +14,8 @@ #include #include #include "esp_log.h" +#include "esp_modem_dce_service.h" #include "bg96.h" -#include "bg96_private.h" #define MODEM_RESULT_CODE_POWERDOWN "POWERED DOWN" diff --git a/examples/protocols/pppos_client/components/modem/src/esp_modem_dce_service.c b/examples/protocols/pppos_client/components/modem/src/esp_modem_dce_service.c index ff2527e5f3..f2984c1f90 100644 --- a/examples/protocols/pppos_client/components/modem/src/esp_modem_dce_service.c +++ b/examples/protocols/pppos_client/components/modem/src/esp_modem_dce_service.c @@ -15,20 +15,7 @@ #include "esp_log.h" #include "esp_modem_dce_service.h" -/** - * @brief Macro defined for error checking - * - */ static const char *DCE_TAG = "dce_service"; -#define DCE_CHECK(a, str, goto_tag, ...) \ - do \ - { \ - if (!(a)) \ - { \ - ESP_LOGE(DCE_TAG, "%s(%d): " str, __FUNCTION__, __LINE__, ##__VA_ARGS__); \ - goto goto_tag; \ - } \ - } while (0) esp_err_t esp_modem_dce_handle_response_default(modem_dce_t *dce, const char *line) { diff --git a/examples/protocols/pppos_client/components/modem/src/sim7600.c b/examples/protocols/pppos_client/components/modem/src/sim7600.c index 1739b68ece..3b7aac8b13 100644 --- a/examples/protocols/pppos_client/components/modem/src/sim7600.c +++ b/examples/protocols/pppos_client/components/modem/src/sim7600.c @@ -14,8 +14,8 @@ #include #include #include "esp_log.h" +#include "esp_modem_dce_service.h" #include "bg96.h" -#include "bg96_private.h" /** * @brief This module supports SIM7600 module, which has a very similar interface diff --git a/examples/protocols/pppos_client/components/modem/src/sim800.c b/examples/protocols/pppos_client/components/modem/src/sim800.c index 85123e270d..4dd2a2f176 100644 --- a/examples/protocols/pppos_client/components/modem/src/sim800.c +++ b/examples/protocols/pppos_client/components/modem/src/sim800.c @@ -19,20 +19,7 @@ #define MODEM_RESULT_CODE_POWERDOWN "POWER DOWN" -/** - * @brief Macro defined for error checking - * - */ static const char *DCE_TAG = "sim800"; -#define DCE_CHECK(a, str, goto_tag, ...) \ - do \ - { \ - if (!(a)) \ - { \ - ESP_LOGE(DCE_TAG, "%s(%d): " str, __FUNCTION__, __LINE__, ##__VA_ARGS__); \ - goto goto_tag; \ - } \ - } while (0) /** * @brief Handle response from AT+CPOWD=1