浏览代码

pppos-client: Refactor modem component
Merges https://github.com/espressif/esp-idf/pull/6483

Liu Han 5 年之前
父节点
当前提交
b3a35e3d4e

+ 0 - 14
examples/protocols/pppos_client/components/modem/include/esp_modem_dce.h

@@ -13,20 +13,6 @@
 // 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

+ 14 - 0
examples/protocols/pppos_client/components/modem/src/bg96.c

@@ -21,6 +21,20 @@
 
 static const char *DCE_TAG = "bg96";
 
+/**
+ * @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)
+
 /**
  * @brief Handle response from AT+QPOWD=1
  */

+ 14 - 0
examples/protocols/pppos_client/components/modem/src/esp_modem_dce_service.c

@@ -17,6 +17,20 @@
 
 static const char *DCE_TAG = "dce_service";
 
+/**
+ * @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)
+
 esp_err_t esp_modem_dce_handle_response_default(modem_dce_t *dce, const char *line)
 {
     esp_err_t err = ESP_FAIL;

+ 14 - 0
examples/protocols/pppos_client/components/modem/src/sim7600.c

@@ -24,6 +24,20 @@
  */
 static const char *DCE_TAG = "sim7600";
 
+/**
+ * @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)
+
 /**
  * @brief Handle response from AT+CBC
  */

+ 14 - 0
examples/protocols/pppos_client/components/modem/src/sim800.c

@@ -21,6 +21,20 @@
 
 static const char *DCE_TAG = "sim800";
 
+/**
+ * @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)
+
 /**
  * @brief Handle response from AT+CPOWD=1
  */