Explorar o código

[snmp]add check and save snmp system parameter

balbekova %!s(int64=5) %!d(string=hai) anos
pai
achega
17156e5864
Modificáronse 2 ficheiros con 18 adicións e 0 borrados
  1. 8 0
      modules/Ethernet/snmp_api.c
  2. 10 0
      modules/Ethernet/snmp_api.h

+ 8 - 0
modules/Ethernet/snmp_api.c

@@ -17,6 +17,7 @@
 #include "common_config.h"
 #include "rtc.h"
 #include "megatec.h"
+#include "log.h"
 
 #include "apps/snmp.h"
 #include "snmp_mib2.h"
@@ -202,6 +203,13 @@ void SNMP_SetObjDescr(void)
   snmp_mib2_set_sysdescr((u8_t*)sSettings.sSnmp.sysDesc.description, &sSettings.sSnmp.sysDesc.len);
 }
 
+void SNMP_SettingsSave(void)
+{
+	SETTINGS_Save();
+	log_event_data(LOG_SETTING_SAVE, "Администратор (SNMP)");
+	SNMP_SetObjDescr();
+}
+
 /**
   * @brief  Установить SNMP Community для чтения
   */

+ 10 - 0
modules/Ethernet/snmp_api.h

@@ -15,6 +15,7 @@
 #define SNMP_API_H
 
 #include "settings_api.h"
+#include "control_symbol.h"
 
 /**
   * @brief  Инициализация параметров SNMP
@@ -118,6 +119,15 @@ void SNMP_GetWriteCommunity(char *str, uint8_t *len);
   */
 void SNMP_GetManagerIp(char *str, uint8_t *len);
 
+/**
+  * @brief  Сохранение настроек контроллера через SNMP
+  */
+void SNMP_SettingsSave(void);
+
+#define SNMP_SYS_PARAM_SAVE() SNMP_SettingsSave()
+
+#define SNMP_SYS_PARAM_CHECK(value, len) control_string_en_digit(value, len)
+
 #endif /* #ifndef SNMP_API_H */
 
 /********************************* (C) РОТЕК **********************************/