examples/ntpclient_test: make ntp server port configurable in .config
authorWonsang Ryou <wonsang.yoo@samsung.com>
Tue, 18 Jul 2017 09:50:26 +0000 (18:50 +0900)
committerEunBong Song <eunb.song@samsung.com>
Wed, 30 Aug 2017 04:15:46 +0000 (21:15 -0700)
This patch enables ntp server's port number to be configurable in
.config. You can set ntp server's port number using the following
config variable.
 - CONFIG_EXAMPLES_NTPCLIENT_TEST_SERVER_PORT

Change-Id: I39e8f46cbfc677449771016ac4048abcc9165e78
Signed-off-by: Wonsang Ryou <wonsang.yoo@samsung.com>
apps/examples/ntpclient_test/Kconfig
apps/examples/ntpclient_test/ntpclient_main.c

index 0ba92cc..fd1c7d1 100644 (file)
@@ -20,6 +20,12 @@ config EXAMPLES_NTPCLIENT_TEST_PROGNAME
                This is the name of the program that will be use when the NSH ELF
                program is installed.
 
+config EXAMPLES_NTPCLIENT_TEST_SERVER_PORT
+       int "NTP server port number"
+       default 123
+       ---help---
+               This is the port number of NTP server.
+
 endif
 
 config USER_ENTRYPOINT
index d38b747..2f5c0c9 100644 (file)
  ****************************************************************************/
 #define TIME_STRING_LEN         16
 #define DATE_STRING_LEN         16
-#define NTP_SERVER_PORT         123
+
+#ifndef CONFIG_EXAMPLES_NTPCLIENT_TEST_SERVER_PORT
+#define CONFIG_EXAMPLES_NTPCLIENT_TEST_SERVER_PORT     123
+#endif
 
 /****************************************************************************
  * Enumeration
@@ -272,7 +275,7 @@ int ntpclient_main(int argc, char *argv[])
                memset(&g_server_conn, 0x0, sizeof(g_server_conn));
                for (i = 0; i < num_of_servers; i++) {
                        g_server_conn[i].hostname = argv[3 + i];
-                       g_server_conn[i].port = NTP_SERVER_PORT;
+                       g_server_conn[i].port = CONFIG_EXAMPLES_NTPCLIENT_TEST_SERVER_PORT;
                }
                if (test_ntpclient_start(g_server_conn, interval_secs, num_of_servers) != 0) {
                        goto errout;