Explorar o código

ftp: export settings to the web

Sergey Alirzaev %!s(int64=4) %!d(string=hai) anos
pai
achega
1a3f608694
Modificáronse 3 ficheiros con 39 adicións e 1 borrados
  1. 5 0
      config/board_bt6711.h
  2. 24 1
      modules/parameters.c
  3. 10 0
      modules/parameters.h

+ 5 - 0
config/board_bt6711.h

@@ -130,6 +130,11 @@ XSETTING( FTP_Update_t,	sFTPUpdate, SETTINGS_SetFTPUpdateDef, ALL_DEFAULT ) \
   XJSON_SETTINGS_TAG("loadvolt_high",      GetLoadAlarmHighRangeStr,            SetLoadAlarmHighRangeStr) \
   XJSON_SETTINGS_TAG("loadvolt_hist",      GetLoadAlarmHisteStr,                SetLoadAlarmHistStr) \
   XJSON_SETTINGS_TAG("netsettings_changed",GetWebReinitFlag,                    SetEmptyFuncStr) \
+  XJSON_SETTINGS_TAG("ftp_server",         GetFTPServer,                        SetEmptyFuncStr) \
+  XJSON_SETTINGS_TAG("ftp_port",           GetFTPPort,                          SetEmptyFuncStr) \
+  XJSON_SETTINGS_TAG("ftp_path",           GetFTPPath,                          SetEmptyFuncStr) \
+  XJSON_SETTINGS_TAG("ftp_login",          GetFTPLogin,                         SetEmptyFuncStr) \
+  XJSON_SETTINGS_TAG("ftp_password",       GetFTPPassword,                      SetEmptyFuncStr) \
 
 #define WEB_PARAMS_TAGS_TABLE \
   XJSON_PARAMS_TAG("AC",                 GetInputVoltageStr) \

+ 24 - 1
modules/parameters.c

@@ -1608,7 +1608,30 @@ void GetSSHEnableStateStr(char *str, uint8_t *len)
     *len = 1;
 }
 #endif // SSH_ENABLE
-#endif
+#endif // TELNET_ENABLE
+#ifdef HARDWARE_BT6711
+void GetFTPServer(char *str, uint8_t *len)
+{
+  *len = sprintf(str, "%s", ipaddr_ntoa(&sSettings.sFTPUpdate.server_ip));
+}
+void GetFTPPort(char *str, uint8_t *len)
+{
+  *len = sprintf(str, "%d", sSettings.sFTPUpdate.server_port);
+}
+void GetFTPPath(char *str, uint8_t *len)
+{
+  *len = sprintf(str, "%s", sSettings.sFTPUpdate.remote_path);
+}
+void GetFTPLogin(char *str, uint8_t *len)
+{
+  *len = sprintf(str, "%s", sSettings.sFTPUpdate.user);
+}
+void GetFTPPassword(char *str, uint8_t *len)
+{
+  *len = sprintf(str, "%s", sSettings.sFTPUpdate.pass);
+}
+#endif // HARDWARE_BT6711
+
 
 // ************************************************************************** //
 //                          Флаги

+ 10 - 0
modules/parameters.h

@@ -605,6 +605,16 @@ void GetSSHPortStr(char *str, uint8_t *len);
 void GetSSHEnableStateStr(char *str, uint8_t *len);
 #endif
 
+
+// ************************************************************************** //
+//                             Параметры FTP
+
+void GetFTPServer(char *str, uint8_t *len);
+void GetFTPPort(char *str, uint8_t *len);
+void GetFTPPath(char *str, uint8_t *len);
+void GetFTPLogin(char *str, uint8_t *len);
+void GetFTPPassword(char *str, uint8_t *len);
+
 // ************************************************************************** //
 //                                Флаги