|
@@ -82,7 +82,7 @@ const char *akb_args_list[] = {
|
|
|
"info",
|
|
|
"voltcellmin",
|
|
|
"voltcellmax",
|
|
|
-#if HARDWARE_BT6709 || HARDWARE_BT6709_MTS
|
|
|
+#if HARDWARE_BT6709 || HARDWARE_BT6709_MTS || HARDWARE_BT6710
|
|
|
"capacity",
|
|
|
"voltakb",
|
|
|
"lifetime",
|
|
@@ -98,8 +98,13 @@ const char *akb_args_list[] = {
|
|
|
const char *type_alarm_args_list[] = {
|
|
|
"info",
|
|
|
"temp",
|
|
|
+#ifndef HARDWARE_BT6710
|
|
|
"load",
|
|
|
+#endif
|
|
|
"vout",
|
|
|
+#ifdef TEMP_CABINET_MONITOR
|
|
|
+ "temp_cabinet"
|
|
|
+#endif
|
|
|
#ifdef VAC_IN_MONITOR
|
|
|
"vacin",
|
|
|
#endif
|
|
@@ -340,7 +345,7 @@ static const CLI_Command_Definition_t prvAKBCommandDefinition = {
|
|
|
( const int8_t *const ) "\takb info: вывод информации о параметрах АКБ\r\n"
|
|
|
"\takb voltcellmin <value>: ввод минимального напряжения на ячейки АКБ (В)\r\n"
|
|
|
"\takb voltcellmax <value>: ввод максимального напряжения на ячейки АКБ (В)\r\n"
|
|
|
-#if HARDWARE_BT6709 || HARDWARE_BT6709_MTS
|
|
|
+#if HARDWARE_BT6709 || HARDWARE_BT6709_MTS || HARDWARE_BT6710
|
|
|
"\takb capacity <value>: ввод ёмкости АКБ (Ач)\r\n"
|
|
|
"\takb voltakb <value>: ввод номинального напряжения АКБ (В)\r\n"
|
|
|
"\takb lifetime <value>: ввод срока службы АКБ (лет)\r\n"
|
|
@@ -364,11 +369,18 @@ static const CLI_Command_Definition_t prvAlarmCommandDefinition = {
|
|
|
"\talarm temp low <value>: ввод нижней границы аварии по температуре (С)\r\n"
|
|
|
"\talarm temp high <value>: ввод верxней границы аварии по температуре (С)\r\n"
|
|
|
"\talarm temp hist <value>: ввод гистерезиса аварии по температуре (С)\r\n"
|
|
|
+#ifndef HARDWARE_BT6710
|
|
|
"\talarm load high <value>: ввод верхней границы аварии по нагрузке (%)\r\n"
|
|
|
"\talarm load hist <value>: ввод гистерезиса аварии по нагрузке (%)\r\n"
|
|
|
+#endif
|
|
|
"\talarm vout low <value>: ввод нижней границы аварии по вых. напряжению (В)\r\n"
|
|
|
"\talarm vout high <value>: ввод верxней границы аварии по вых. напряжению (В)\r\n"
|
|
|
"\talarm vout hist <value>: ввод гистерезиса аварии по вых. напряжению (В)\r\n"
|
|
|
+#ifdef TEMP_CABINET_MONITOR
|
|
|
+ "\talarm temp_cabinet low <value>: ввод нижней границы аварии по температуре в шкафу (С)\r\n"
|
|
|
+ "\talarm temp_cabinet high <value>: ввод верxней границы аварии по температуре в шкафу (С)\r\n"
|
|
|
+ "\talarm temp_cabinet hist <value>: ввод гистерезиса аварии по температуре в шкафу (С)\r\n"
|
|
|
+#endif
|
|
|
#ifdef VAC_IN_MONITOR
|
|
|
"\talarm vacin low <value>: ввод нижней границы аварии по вх. напряжению (В)\r\n"
|
|
|
"\talarm vacin high <value>: ввод верxней границы аварии по вх. напряжению (В)\r\n"
|
|
@@ -451,6 +463,15 @@ static const CLI_Command_Definition_t prvSensorCommandDefinition = {
|
|
|
"\tsensor setup DI <num> <state>: установка нормального состояния сухого контакта:\r\n"
|
|
|
"\t\t\t\t0 - разомкнутое состояние\r\n"
|
|
|
"\t\t\t\t1 - замкнутое состояние\r\n"
|
|
|
+#ifdef HARDWARE_BT6710
|
|
|
+ "\tsensor setup DIname <num> <name>: установка названия сухого контакта\r\n"
|
|
|
+#endif
|
|
|
+#endif
|
|
|
+#ifdef DALLAS_SENSOR_ENABLE
|
|
|
+ "\tsensor setup TS <num> <function>: установка назначения датчика температуры:\r\n"
|
|
|
+ "\t\t\t\t0 - нет\r\n"
|
|
|
+ "\t\t\t\t1 - Шкаф\r\n"
|
|
|
+ "\t\t\t\t2 - АКБ\r\n"
|
|
|
#endif
|
|
|
#ifdef DOUTS_ENABLE
|
|
|
"\tsensor setup DO <num> <issue>: установка источника срабатывания реле:\r\n"
|
|
@@ -595,6 +616,48 @@ static const CLI_Command_Definition_t prvRADIUSCommandDefinition = {
|
|
|
};
|
|
|
#endif
|
|
|
|
|
|
+#ifdef PORTGW_ENABLE
|
|
|
+const char *pgw_args_list[] = {
|
|
|
+ "info",
|
|
|
+ "ENA",
|
|
|
+ "DIS",
|
|
|
+ "port",
|
|
|
+ "parity",
|
|
|
+ "odd",
|
|
|
+ "datalen",
|
|
|
+ "stopbit"
|
|
|
+};
|
|
|
+
|
|
|
+typedef enum{
|
|
|
+ ARG_PGW_INFO = 0,
|
|
|
+ ARG_PGW_ENABLE,
|
|
|
+ ARG_PGW_DISABLE,
|
|
|
+ ARG_PGW_PORT,
|
|
|
+ ARG_PGW_RATE,
|
|
|
+ ARG_PGW_PARITY,
|
|
|
+ ARG_PGW_DATALEN,
|
|
|
+ ARG_PGW_STOPBIT,
|
|
|
+ ARG_PGW_ALL
|
|
|
+}pgw_args_t;
|
|
|
+
|
|
|
+static portBASE_TYPE prvTaskPGWCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
|
|
|
+static const CLI_Command_Definition_t prvPGWCommandDefinition = {
|
|
|
+ (const int8_t *const)"pgw", /* The command string to type. */
|
|
|
+ (const int8_t *const)"\tpgw info: вывод информации о настройках прозрачного канала\r\n"
|
|
|
+ "\tpgw ENA|DIS: вкл./выкл. прозрачного канала\r\n"
|
|
|
+ "\tpgw port <port>: установка сетевого парта\r\n"
|
|
|
+ "\tpgw boardrate <boardrate>: установка скорости (бит/с) порта RS-485\r\n"
|
|
|
+ "\tpgw parity <parity>: установка четности порта RS-485:\r\n"
|
|
|
+ "\t\t\t\t0 - нет\r\n"
|
|
|
+ "\t\t\t\t1 - четный\r\n"
|
|
|
+ "\t\t\t\t0 - нечетный\r\n"
|
|
|
+ "\tpgw datalen <datalen>: установка битов данных порта RS-485\r\n"
|
|
|
+ "\tpgw stopbit <stopbit>: установка стоповых бит порта RS-485\r\n",
|
|
|
+ prvTaskPGWCommand, /* The function to run. */
|
|
|
+ -1 /* The user can enter any number of commands. */
|
|
|
+};
|
|
|
+#endif
|
|
|
+
|
|
|
static const CLI_Command_Definition_t prvSetUPSserialCommandDefinition =
|
|
|
{
|
|
|
( const int8_t * const ) "setupsid", /* The command string to type. */
|
|
@@ -646,6 +709,9 @@ void vRegisterCLICommands( void )
|
|
|
#endif
|
|
|
#ifdef RADIUS_SERVER_ENABLE
|
|
|
FreeRTOS_CLIRegisterCommand( &prvRADIUSCommandDefinition );
|
|
|
+#endif
|
|
|
+#ifdef PORTGW_ENABLE
|
|
|
+ FreeRTOS_CLIRegisterCommand( &prvPGWCommandDefinition );
|
|
|
#endif
|
|
|
FreeRTOS_CLIRegisterCommand( &prvSetUPSserialCommandDefinition );
|
|
|
FreeRTOS_CLIRegisterCommand( &prvQuitCommandDefinition );
|
|
@@ -1551,7 +1617,7 @@ static portBASE_TYPE prvTaskAKBCommand(cli_state_t *cli_state, int8_t *pcWriteBu
|
|
|
xParameterStringLength = sizeof(str) - 2;
|
|
|
}
|
|
|
strncat(str, ( const char * ) pcParameterString, strlen(( const char * ) pcParameterString));
|
|
|
-#if HARDWARE_BT6709 || HARDWARE_BT6709_MTS
|
|
|
+#if HARDWARE_BT6709 || HARDWARE_BT6709_MTS || HARDWARE_BT6710
|
|
|
if (i != ARG_AKB_DATASET)
|
|
|
#endif
|
|
|
{
|
|
@@ -1581,7 +1647,7 @@ static portBASE_TYPE prvTaskAKBCommand(cli_state_t *cli_state, int8_t *pcWriteBu
|
|
|
strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
}
|
|
|
break;
|
|
|
-#if HARDWARE_BT6709 || HARDWARE_BT6709_MTS || HARDWARE_BT6711 || HARDWARE_BT6711_V1
|
|
|
+#if HARDWARE_BT6709 || HARDWARE_BT6709_MTS || HARDWARE_BT6711 || HARDWARE_BT6711_V1 || HARDWARE_BT6710
|
|
|
case ARG_AKB_CAPACITY:
|
|
|
if (value >= CAPACITY_MIN_RANGE && value <= CAPACITY_MAX_RANGE && (value - (int32_t)value) == 0) {
|
|
|
SetCapacityNominalAKBStr(str);
|
|
@@ -1598,7 +1664,7 @@ static portBASE_TYPE prvTaskAKBCommand(cli_state_t *cli_state, int8_t *pcWriteBu
|
|
|
strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
}
|
|
|
break;
|
|
|
-#if HARDWARE_BT6709 || HARDWARE_BT6709_MTS
|
|
|
+#if HARDWARE_BT6709 || HARDWARE_BT6709_MTS || HARDWARE_BT6710
|
|
|
case ARG_AKB_LIFETIME:
|
|
|
if (value >= LIFETIME_MIN_RANGE && value <= LIFETIME_MAX_RANGE && (value - (int32_t)value) == 0) {
|
|
|
SetLifeTimeAKBStr(str);
|
|
@@ -1812,6 +1878,7 @@ static portBASE_TYPE prvTaskAlarmCommand(cli_state_t *cli_state, int8_t *pcWrite
|
|
|
break;
|
|
|
}
|
|
|
break;
|
|
|
+#ifndef HARDWARE_BT6710
|
|
|
case ARG_ALARM_LOAD:
|
|
|
switch (j) {
|
|
|
case ARG_ALARM_LINE_LOW:
|
|
@@ -1852,6 +1919,7 @@ static portBASE_TYPE prvTaskAlarmCommand(cli_state_t *cli_state, int8_t *pcWrite
|
|
|
break;
|
|
|
}
|
|
|
break;
|
|
|
+#endif
|
|
|
case ARG_ALARM_VOUT:
|
|
|
switch (j) {
|
|
|
case ARG_ALARM_LINE_LOW:
|
|
@@ -1904,6 +1972,64 @@ static portBASE_TYPE prvTaskAlarmCommand(cli_state_t *cli_state, int8_t *pcWrite
|
|
|
break;
|
|
|
}
|
|
|
break;
|
|
|
+#ifdef TEMP_CABINET_MONITOR
|
|
|
+ case ARG_TEMP_CABINAT:
|
|
|
+ switch (j) {
|
|
|
+ case ARG_ALARM_LINE_LOW:
|
|
|
+ for (k = 0; k < xParameterStringLength; k ++) {
|
|
|
+ if (!isdigit_int(str[k])) {
|
|
|
+ if (k == 0 && str[k] == '-') {
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ return pdFALSE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ value = atof(str);
|
|
|
+ if (value >= MIN_TEMP_MIN_RANGE && value <= MIN_TEMP_MAX_RANGE) {
|
|
|
+ SetTemperatureCabinetAlarmLowRangeStr(str);
|
|
|
+ cli_save_config(cli_state);
|
|
|
+ } else {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case ARG_ALARM_LINE_HIGH:
|
|
|
+ for (k = 0; k < xParameterStringLength; k ++) {
|
|
|
+ if (!isdigit_int(str[k])) {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ return pdFALSE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ value = atof(str);
|
|
|
+ if (value >= MAX_TEMP_MIN_RANGE && value <= MAX_TEMP_MAX_RANGE) {
|
|
|
+ SetTemperatureCabinetAlarmHighRangeStr(str);
|
|
|
+ cli_save_config(cli_state);
|
|
|
+ } else {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case ARG_ALARM_LINE_HIST:
|
|
|
+ for (k = 0; k < xParameterStringLength; k ++) {
|
|
|
+ if (!isfloatdigit(str[k])) {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ return pdFALSE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ value = atof(str);
|
|
|
+ if (value >= HIST_TEMP_MIN_RANGE && value <= HIST_TEMP_MAX_RANGE) {
|
|
|
+ SetTemperatureCabinetAlarmHisteStr(str);
|
|
|
+ cli_save_config(cli_state);
|
|
|
+ } else {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+#endif
|
|
|
#ifdef VAC_IN_MONITOR
|
|
|
case ARG_ALARM_VACIN:
|
|
|
switch (j) {
|
|
@@ -2697,7 +2823,7 @@ static portBASE_TYPE prvTaskSensorCommand(cli_state_t *cli_state, int8_t *pcWrit
|
|
|
static uint8_t config_menu = 0;
|
|
|
uint8_t MAX_CONFIG_PARAM = 0;
|
|
|
|
|
|
-#ifdef DINS_ENABLE || DOUTS_ENABLE
|
|
|
+#ifdef DINS_ENABLE || DOUTS_ENABLE || DALLAS_SENSOR_ENABLE
|
|
|
MAX_CONFIG_PARAM = 3;
|
|
|
#else
|
|
|
MAX_CONFIG_PARAM = 2;
|
|
@@ -2750,7 +2876,7 @@ static portBASE_TYPE prvTaskSensorCommand(cli_state_t *cli_state, int8_t *pcWrit
|
|
|
case 1:
|
|
|
ups_sensor_akb_param(pcWriteBuffer);
|
|
|
break;
|
|
|
-#ifdef DINS_ENABLE || DOUTS_ENABLE
|
|
|
+#ifdef DINS_ENABLE || DOUTS_ENABLE || DALLAS_SENSOR_ENABLE
|
|
|
case 2:
|
|
|
inouts_sensor_param(pcWriteBuffer);
|
|
|
break;
|
|
@@ -2769,7 +2895,7 @@ static portBASE_TYPE prvTaskSensorCommand(cli_state_t *cli_state, int8_t *pcWrit
|
|
|
}
|
|
|
} else {
|
|
|
switch (i) {
|
|
|
-#ifdef DINS_ENABLE || DOUTS_ENABLE
|
|
|
+#ifdef DINS_ENABLE || DOUTS_ENABLE || DALLAS_SENSOR_ENABLE
|
|
|
case ARG_SENSOR_SETUP:
|
|
|
if (cli_state->user_id != ADMIN) {
|
|
|
strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) );
|
|
@@ -2822,7 +2948,7 @@ static portBASE_TYPE prvTaskSensorCommand(cli_state_t *cli_state, int8_t *pcWrit
|
|
|
fail = 1;
|
|
|
#ifdef DINS_ENABLE
|
|
|
if (strncmp(str, "DI", 2) == 0) {
|
|
|
- if (val != 1) {
|
|
|
+ if (val < 0 || val > INPUTS_TOTAL_COUNT) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -2834,6 +2960,36 @@ static portBASE_TYPE prvTaskSensorCommand(cli_state_t *cli_state, int8_t *pcWrit
|
|
|
cli_save_config(cli_state);
|
|
|
fail = 0;
|
|
|
}
|
|
|
+#ifdef HARDWARE_BT6710
|
|
|
+ else if (strncmp(str, "DIname", 6) == 0) {
|
|
|
+ if (val < 0 || val > INPUTS_TOTAL_COUNT) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ val2 = strlen(temp_str);
|
|
|
+ if (val2 < 0 || val2 >= 21) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ SetDINNameStr(temp_str, (val - 1));
|
|
|
+ cli_save_config(cli_state);
|
|
|
+ fail = 0;
|
|
|
+ }
|
|
|
+#endif
|
|
|
+#endif
|
|
|
+#ifdef DALLAS_SENSOR_ENABLE
|
|
|
+ if (strncmp(str, "TS", 2) == 0) {
|
|
|
+ if (val < 1 || val > (MAX_T_SENSORS + 1)) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ val2 = atoi(temp_str);
|
|
|
+ if (val2 < TS_NONE || val2 > TS_AKB) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ SetTSlocationStr(temp_str, (val - 1));
|
|
|
+ cli_save_config(cli_state);
|
|
|
+ fail = 0;
|
|
|
+ }
|
|
|
#endif
|
|
|
#ifdef DOUTS_ENABLE
|
|
|
if (strncmp(str, "DO", 2) == 0) {
|
|
@@ -2848,9 +3004,9 @@ static portBASE_TYPE prvTaskSensorCommand(cli_state_t *cli_state, int8_t *pcWrit
|
|
|
SetROTypeActStr(temp_str, (val - 1));
|
|
|
cli_save_config(cli_state);
|
|
|
fail = 0;
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
#endif
|
|
|
+ }
|
|
|
break;
|
|
|
#endif
|
|
|
default:
|
|
@@ -3311,6 +3467,203 @@ static portBASE_TYPE prvTaskRADIUSCommand(cli_state_t *cli_state, int8_t *pcWri
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
+#ifdef PORTGW_ENABLE
|
|
|
+static portBASE_TYPE prvTaskPGWCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString )
|
|
|
+{
|
|
|
+ int8_t *pcParameterString;
|
|
|
+ signed portBASE_TYPE xParameterStringLength, xReturn;
|
|
|
+ portBASE_TYPE xParameterNumber = 1;
|
|
|
+ char str[110];
|
|
|
+ char str_temp[110];
|
|
|
+ uint8_t len;
|
|
|
+ uint8_t i;
|
|
|
+ bool enable_old_pgw;
|
|
|
+
|
|
|
+ ( void ) pcCommandString;
|
|
|
+ ( void ) xWriteBufferLen;
|
|
|
+ configASSERT( pcWriteBuffer );
|
|
|
+
|
|
|
+ memset(pcWriteBuffer, 0, configCOMMAND_INT_MAX_OUTPUT_SIZE);
|
|
|
+ /* Obtain the parameter string. */
|
|
|
+ pcParameterString = ( int8_t * ) FreeRTOS_CLIGetParameter
|
|
|
+ (
|
|
|
+ pcCommandString, /* The command string itself. */
|
|
|
+ xParameterNumber, /* Return the next parameter. */
|
|
|
+ &xParameterStringLength /* Store the parameter string length. */
|
|
|
+ );
|
|
|
+ if (pcParameterString == NULL) {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ return pdFALSE;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (i = 0; i < ARG_PGW_ALL; i ++) {
|
|
|
+ if ( strncmp( ( const char * ) pcParameterString, pgw_args_list[i], strlen(pgw_args_list[i]) ) == 0
|
|
|
+ && xParameterStringLength == strlen(pgw_args_list[i])) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cli_state->user_id != ADMIN && i != ARG_PGW_INFO) {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) );
|
|
|
+ return pdFALSE;
|
|
|
+ }
|
|
|
+
|
|
|
+ xParameterNumber ++;
|
|
|
+ /* Obtain the parameter string. */
|
|
|
+ pcParameterString = ( int8_t * ) FreeRTOS_CLIGetParameter
|
|
|
+ (
|
|
|
+ pcCommandString, /* The command string itself. */
|
|
|
+ xParameterNumber, /* Return the next parameter. */
|
|
|
+ &xParameterStringLength /* Store the parameter string length. */
|
|
|
+ );
|
|
|
+ if (pcParameterString == NULL) {
|
|
|
+ switch (i) {
|
|
|
+ case ARG_PGW_INFO:
|
|
|
+ /* Return the next command help string, before moving the pointer on to
|
|
|
+ the next command in the list. */
|
|
|
+ pgw_config_param(pcWriteBuffer);
|
|
|
+ break;
|
|
|
+ case ARG_PGW_ENABLE:
|
|
|
+ enable_old_pgw = sSettings.sPortGw.enabled;
|
|
|
+ SetPortGwEnabledStr("on");
|
|
|
+ if (sSettings.sPortGw.enabled != enable_old_pgw) {
|
|
|
+ cli_save_config(cli_state);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case ARG_PGW_DISABLE:
|
|
|
+ enable_old_pgw = sSettings.sPortGw.enabled;
|
|
|
+ SetPortGwEnabledStr("off");
|
|
|
+ if (sSettings.sPortGw.enabled != enable_old_pgw) {
|
|
|
+ cli_save_config(cli_state);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ memset(str_temp, 0, sizeof(str_temp));
|
|
|
+ if (xParameterStringLength > (int32_t)sizeof(str_temp)) {
|
|
|
+ xParameterStringLength = sizeof(str_temp) - 1;
|
|
|
+ }
|
|
|
+ strncat(str_temp, ( const char * ) pcParameterString, xParameterStringLength);
|
|
|
+ switch (i) {
|
|
|
+ case ARG_PGW_PORT:
|
|
|
+ if (xParameterStringLength <= 5) {
|
|
|
+ for (uint8_t j = 0; j < xParameterStringLength; j++) {
|
|
|
+ if (!isdigit_int(str_temp[j])) {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ return pdFALSE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ int temp = atoi(str_temp);
|
|
|
+ if (temp > 0 && temp < 65535) {
|
|
|
+ GetPortGwPortnumStr(str, &len);
|
|
|
+ if (strncmp(str_temp, str, strlen(str_temp)) != 0) {
|
|
|
+ SetPortGwPortnumStr(str_temp);
|
|
|
+ cli_save_config(cli_state);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case ARG_PGW_RATE:
|
|
|
+ if (xParameterStringLength <= 6) {
|
|
|
+ for (uint8_t j = 0; j < xParameterStringLength; j++) {
|
|
|
+ if (!isdigit_int(str_temp[j])) {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ return pdFALSE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ int temp_rate = atoi(str_temp);
|
|
|
+ if (temp_rate == 1200 || temp_rate == 2400 || temp_rate == 4800 || temp_rate == 9600
|
|
|
+ || temp_rate == 19200 || temp_rate == 38400 || temp_rate == 57600 || temp_rate == 115200) {
|
|
|
+ GetPortGwBaudStr(str, &len);
|
|
|
+ if (strncmp(str_temp, str, strlen(str_temp)) != 0 || strlen(str_temp) != strlen(str)) {
|
|
|
+ SetPortGwBaudStr(str_temp);
|
|
|
+ cli_save_config(cli_state);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case ARG_PGW_PARITY:
|
|
|
+ if (xParameterStringLength == 1) {
|
|
|
+ for (uint8_t j = 0; j < xParameterStringLength; j++) {
|
|
|
+ if (!isdigit_int(str_temp[j])) {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ return pdFALSE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ int temp_parity = atoi(str_temp);
|
|
|
+ if (temp_parity >= GW_NO_PAR || temp_parity < MAX_PARITY_TYPES) {
|
|
|
+ uint32_t parity;
|
|
|
+ GetPortGwParityInt(&parity);
|
|
|
+ if ((int)parity != temp_parity) {
|
|
|
+ SetPortGwParityInt(temp_parity);
|
|
|
+ cli_save_config(cli_state);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case ARG_PGW_DATALEN:
|
|
|
+ case ARG_PGW_STOPBIT:
|
|
|
+ if (xParameterStringLength == 1) {
|
|
|
+ for (uint8_t j = 0; j < xParameterStringLength; j++) {
|
|
|
+ if (!isdigit_int(str_temp[j])) {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ return pdFALSE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ char limit1, limit2;
|
|
|
+ if (i == ARG_PGW_DATALEN) {
|
|
|
+ GetPortGwDatabitsStr(str, &len);
|
|
|
+ limit1 = 0x37;
|
|
|
+ limit2 = 0x38;
|
|
|
+ } else {
|
|
|
+ GetPortGwStopbitsStr(str, &len);
|
|
|
+ limit1 = 0x31;
|
|
|
+ limit2 = 0x32;
|
|
|
+ }
|
|
|
+ if (str_temp[0] == limit1 || str_temp[0] == limit2) {
|
|
|
+
|
|
|
+ if (str[0] != str_temp[0]) {
|
|
|
+ if (i == ARG_PGW_DATALEN) {
|
|
|
+ SetPortGwDatabitsStr(str_temp);
|
|
|
+ } else {
|
|
|
+ SetPortGwStopbitsStr(str_temp);
|
|
|
+ }
|
|
|
+ cli_save_config(cli_state);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ xReturn = pdFALSE;
|
|
|
+
|
|
|
+ return xReturn;
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef FTP_ENABLE
|
|
|
#pragma GCC diagnostic error "-Wall"
|
|
|
#pragma GCC diagnostic error "-Wextra"
|