Browse Source

telnet: implemented `ftp info` command

Sergey Alirzaev 4 years ago
parent
commit
0eed12f8c9
1 changed files with 18 additions and 1 deletions
  1. 18 1
      modules/cli/CLI_Commands.c

+ 18 - 1
modules/cli/CLI_Commands.c

@@ -483,6 +483,7 @@ static const CLI_Command_Definition_t prvUPSCommandDefinition = {
 #include "ftp.h"
 #include "ftp.h"
 
 
 #define FTP_ARGS_LIST \
 #define FTP_ARGS_LIST \
+X(info) \
 X(server_ip) \
 X(server_ip) \
 X(server_port) \
 X(server_port) \
 X(remote_path) \
 X(remote_path) \
@@ -505,7 +506,8 @@ FTP_ARGS_LIST
 static portBASE_TYPE prvTaskFTPCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
 static portBASE_TYPE prvTaskFTPCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
 static const CLI_Command_Definition_t prvFTPCommandDefinition = {
 static const CLI_Command_Definition_t prvFTPCommandDefinition = {
     (const int8_t *const)"ftp",  /* The command string to type. */
     (const int8_t *const)"ftp",  /* The command string to type. */
-    (const int8_t *const)"\tftp server_ip <ip address>: задать адрес FTP-сервера\r\n"
+    (const int8_t *const)"\tftp info: вывод информации о настройках обновления по ftp\r\n"
+                         "\tftp server_ip <ip address>: задать адрес FTP-сервера\r\n"
                          "\tftp server_port <port>: задать порт FTP-сервера\r\n"
                          "\tftp server_port <port>: задать порт FTP-сервера\r\n"
                          "\tftp remote_path <file path>: задать путь к файлу обновления ПО\r\n"
                          "\tftp remote_path <file path>: задать путь к файлу обновления ПО\r\n"
                          "\tftp user <username>: задать имя пользователя для аутентификации на FTP-сервере\r\n"
                          "\tftp user <username>: задать имя пользователя для аутентификации на FTP-сервере\r\n"
@@ -3100,6 +3102,21 @@ static portBASE_TYPE prvTaskFTPCommand(cli_state_t *cli_state, int8_t *pcWriteBu
     strncat(str, (const char *) pcParameterString, xParameterStringLength);
     strncat(str, (const char *) pcParameterString, xParameterStringLength);
 
 
     switch (i) {
     switch (i) {
+        case ARG_FTP_info:
+            ;
+            snprintf((char *)pcWriteBuffer, configCOMMAND_INT_MAX_OUTPUT_SIZE, "\r\n"
+                     "*******************Настройки FTP********************\r\n"
+                     "Адрес сервера: %s\r\n"
+                     "Порт: %u\r\n"
+                     "Путь к файлу: %s\r\n"
+                     "Имя пользователя: %s\r\n"
+                     "Пароль: %s\r\n",
+                     ipaddr_ntoa(&sSettings.sSyslog.server_ip),
+                     sSettings.sFTPUpdate.server_port,
+                     sSettings.sFTPUpdate.remote_path,
+                     sSettings.sFTPUpdate.user,
+                     sSettings.sFTPUpdate.pass);
+            break;
         case ARG_FTP_server_ip:
         case ARG_FTP_server_ip:
             ;
             ;
             ip_addr_t server_ip_old = sSettings.sFTPUpdate.server_ip;
             ip_addr_t server_ip_old = sSettings.sFTPUpdate.server_ip;