From ab7afae2a81c35d61d7c9cb6c6cc216180bb4524 Mon Sep 17 00:00:00 2001
From: helge <helgewurst@web.de>
Date: 摹曛, 04 11月 2021 21:37:49 +0800
Subject: [PATCH] move port number definitions to header

---
 examples/test-LwIP-netconn/scpi_server.c |   10 +++-------
 examples/test-LwIP-netconn/scpi_server.h |    3 +++
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/examples/test-LwIP-netconn/scpi_server.c b/examples/test-LwIP-netconn/scpi_server.c
index 309dd38..df1ebbf 100644
--- a/examples/test-LwIP-netconn/scpi_server.c
+++ b/examples/test-LwIP-netconn/scpi_server.c
@@ -49,10 +49,6 @@
 #include "lwip/tcp.h"
 #include "lwip/inet.h"
 
-
-#define DEVICE_PORT 5025
-#define CONTROL_PORT 5026
-
 #define SCPI_THREAD_PRIO (tskIDLE_PRIORITY + 2)
 
 #define SCPI_MSG_TIMEOUT                0
@@ -152,7 +148,7 @@
 }
 
 scpi_result_t SCPI_SystemCommTcpipControlQ(scpi_t * context) {
-    SCPI_ResultInt(context, CONTROL_PORT);
+    SCPI_ResultInt(context, SCPI_CONTROL_PORT);
     return SCPI_RES_OK;
 }
 
@@ -379,10 +375,10 @@
 
     scpi_context.user_context = &user_data;
 
-    user_data.io_listen = createServer(DEVICE_PORT);
+    user_data.io_listen = createServer(SCPI_DEVICE_PORT);
     LWIP_ASSERT("user_data.io_listen != NULL", user_data.io_listen != NULL);
 
-    user_data.control_io_listen = createServer(CONTROL_PORT);
+    user_data.control_io_listen = createServer(SCPI_CONTROL_PORT);
     LWIP_ASSERT("user_data.control_io_listen != NULL", user_data.control_io_listen != NULL);
 
     while (1) {
diff --git a/examples/test-LwIP-netconn/scpi_server.h b/examples/test-LwIP-netconn/scpi_server.h
index 9a8f944..1c04dda 100644
--- a/examples/test-LwIP-netconn/scpi_server.h
+++ b/examples/test-LwIP-netconn/scpi_server.h
@@ -32,6 +32,9 @@
 extern "C" {
 #endif
 
+#define SCPI_DEVICE_PORT  5025 // scpi-raw standard port
+#define SCPI_CONTROL_PORT 5026 // libscpi control port (not part of the standard)
+
 #include <stdint.h>
 
 void scpi_server_init(void);

--
Gitblit v1.9.1