|
@@ -467,7 +467,7 @@ static const CLI_Command_Definition_t prvSensorCommandDefinition = {
|
|
|
"\tsensor setup DIname <num> <name>: установка названия сухого контакта\r\n"
|
|
|
#endif
|
|
|
#endif
|
|
|
-#ifdef DALLAS_SENSOR_ENABLE
|
|
|
+#if defined(DALLAS_SENSOR_ENABLE) || defined(AM2301_SENSOR_ENABLE)
|
|
|
"\tsensor setup TS <num> <function>: установка назначения датчика температуры:\r\n"
|
|
|
"\t\t\t\t0 - нет\r\n"
|
|
|
"\t\t\t\t1 - Шкаф\r\n"
|
|
@@ -622,8 +622,8 @@ const char *pgw_args_list[] = {
|
|
|
"ENA",
|
|
|
"DIS",
|
|
|
"port",
|
|
|
+ "boardrate",
|
|
|
"parity",
|
|
|
- "odd",
|
|
|
"datalen",
|
|
|
"stopbit"
|
|
|
};
|
|
@@ -649,8 +649,8 @@ static const CLI_Command_Definition_t prvPGWCommandDefinition = {
|
|
|
"\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"
|
|
|
+ "\t\t\t\t1 - нечетный\r\n"
|
|
|
+ "\t\t\t\t2 - четный\r\n"
|
|
|
"\tpgw datalen <datalen>: установка битов данных порта RS-485\r\n"
|
|
|
"\tpgw stopbit <stopbit>: установка стоповых бит порта RS-485\r\n",
|
|
|
prvTaskPGWCommand, /* The function to run. */
|
|
@@ -2504,7 +2504,7 @@ static portBASE_TYPE prvTaskConfigCommand(cli_state_t *cli_state, int8_t *pcWrit
|
|
|
strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInfoTableHeader, strlen( ( char * ) pcInfoTableHeader ) );
|
|
|
snmp_config_param(pcWriteBuffer);
|
|
|
break;
|
|
|
-#ifdef DINS_ENABLE || DOUTS_ENABLE
|
|
|
+#ifdef DINS_ENABLE || DOUTS_ENABLE || DALLAS_SENSOR_ENABLE || AM2301_SENSOR_ENABLE
|
|
|
case PARAM_CONFIG_INOUTS:
|
|
|
inouts_config_param(pcWriteBuffer);
|
|
|
break;
|
|
@@ -2533,6 +2533,11 @@ static portBASE_TYPE prvTaskConfigCommand(cli_state_t *cli_state, int8_t *pcWrit
|
|
|
case PARAM_CONFIG_NET:
|
|
|
net_config_param(pcWriteBuffer);
|
|
|
break;
|
|
|
+ #ifdef PORTGW_ENABLE
|
|
|
+ case PARAM_CONFIG_PGW:
|
|
|
+ pgw_config_param(pcWriteBuffer);
|
|
|
+ break;
|
|
|
+#endif
|
|
|
case PARAM_CONFIG_TIME:
|
|
|
time_config_param(pcWriteBuffer);
|
|
|
break;
|
|
@@ -2823,7 +2828,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 || DALLAS_SENSOR_ENABLE
|
|
|
+#ifdef DINS_ENABLE || DOUTS_ENABLE || DALLAS_SENSOR_ENABLE || AM2301_SENSOR_ENABLE
|
|
|
MAX_CONFIG_PARAM = 3;
|
|
|
#else
|
|
|
MAX_CONFIG_PARAM = 2;
|
|
@@ -2876,7 +2881,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 || DALLAS_SENSOR_ENABLE
|
|
|
+#ifdef DINS_ENABLE || DOUTS_ENABLE || DALLAS_SENSOR_ENABLE || AM2301_SENSOR_ENABLE
|
|
|
case 2:
|
|
|
inouts_sensor_param(pcWriteBuffer);
|
|
|
break;
|
|
@@ -2895,7 +2900,7 @@ static portBASE_TYPE prvTaskSensorCommand(cli_state_t *cli_state, int8_t *pcWrit
|
|
|
}
|
|
|
} else {
|
|
|
switch (i) {
|
|
|
-#ifdef DINS_ENABLE || DOUTS_ENABLE || DALLAS_SENSOR_ENABLE
|
|
|
+#ifdef DINS_ENABLE || DOUTS_ENABLE || DALLAS_SENSOR_ENABLE || AM2301_SENSOR_ENABLE
|
|
|
case ARG_SENSOR_SETUP:
|
|
|
if (cli_state->user_id != ADMIN) {
|
|
|
strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcPermissionDenied, strlen( ( char * ) pcPermissionDenied ) );
|
|
@@ -2906,7 +2911,7 @@ static portBASE_TYPE prvTaskSensorCommand(cli_state_t *cli_state, int8_t *pcWrit
|
|
|
xParameterStringLength = sizeof(str) - 1;
|
|
|
}
|
|
|
strncat(str, ( const char * ) pcParameterString, xParameterStringLength);
|
|
|
- if (xParameterStringLength < 3) {
|
|
|
+ if (xParameterStringLength < 7) {
|
|
|
xParameterNumber ++;
|
|
|
/* Obtain the parameter string. */
|
|
|
pcParameterString = ( int8_t * ) FreeRTOS_CLIGetParameter
|
|
@@ -2936,19 +2941,18 @@ static portBASE_TYPE prvTaskSensorCommand(cli_state_t *cli_state, int8_t *pcWrit
|
|
|
&xParameterStringLength /* Store the parameter string length. */
|
|
|
);
|
|
|
memset(temp_str, 0, sizeof(str));
|
|
|
- if (xParameterStringLength > 1) {
|
|
|
- fail = 1;
|
|
|
- break;
|
|
|
- }
|
|
|
- strncat(temp_str, ( const char * ) pcParameterString, xParameterStringLength);
|
|
|
- if (!isdigit_int(temp_str[0])) {
|
|
|
- fail = 1;
|
|
|
- break;
|
|
|
- }
|
|
|
+
|
|
|
fail = 1;
|
|
|
#ifdef DINS_ENABLE
|
|
|
- if (strncmp(str, "DI", 2) == 0) {
|
|
|
- if (val < 0 || val > INPUTS_TOTAL_COUNT) {
|
|
|
+ if (strncmp(str, "DI", 2) == 0 && strlen(str) == 2) {
|
|
|
+ if (xParameterStringLength > 1) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ strncat(temp_str, ( const char * ) pcParameterString, xParameterStringLength);
|
|
|
+ if (!isdigit_int(temp_str[0])) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (val < 1 || val > INPUTS_TOTAL_COUNT) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -2962,23 +2966,35 @@ static portBASE_TYPE prvTaskSensorCommand(cli_state_t *cli_state, int8_t *pcWrit
|
|
|
}
|
|
|
#ifdef HARDWARE_BT6710
|
|
|
else if (strncmp(str, "DIname", 6) == 0) {
|
|
|
- if (val < 0 || val > INPUTS_TOTAL_COUNT) {
|
|
|
+ if (val < 1 || val > INPUTS_TOTAL_COUNT) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- val2 = strlen(temp_str);
|
|
|
- if (val2 < 0 || val2 >= 21) {
|
|
|
+ if (xParameterStringLength > 21) {
|
|
|
+ fail = 1;
|
|
|
break;
|
|
|
}
|
|
|
+ strncat(temp_str, ( const char * ) pcParameterString, xParameterStringLength);
|
|
|
+ if (!control_string_en_digit(temp_str, strlen(temp_str))) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
SetDINNameStr(temp_str, (val - 1));
|
|
|
cli_save_config(cli_state);
|
|
|
fail = 0;
|
|
|
}
|
|
|
#endif
|
|
|
#endif
|
|
|
-#ifdef DALLAS_SENSOR_ENABLE
|
|
|
+#if defined(DALLAS_SENSOR_ENABLE) || defined(AM2301_SENSOR_ENABLE)
|
|
|
if (strncmp(str, "TS", 2) == 0) {
|
|
|
- if (val < 1 || val > (MAX_T_SENSORS + 1)) {
|
|
|
+ if (xParameterStringLength > 1) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ strncat(temp_str, ( const char * ) pcParameterString, xParameterStringLength);
|
|
|
+ if (!isdigit_int(temp_str[0])) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (val < 1 || val > MAX_T_SENSORS) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -2993,6 +3009,13 @@ static portBASE_TYPE prvTaskSensorCommand(cli_state_t *cli_state, int8_t *pcWrit
|
|
|
#endif
|
|
|
#ifdef DOUTS_ENABLE
|
|
|
if (strncmp(str, "DO", 2) == 0) {
|
|
|
+ if (xParameterStringLength > 1) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ strncat(temp_str, ( const char * ) pcParameterString, xParameterStringLength);
|
|
|
+ if (!isdigit_int(temp_str[0])) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
if (val < 1 || val > 3) {
|
|
|
break;
|
|
|
}
|
|
@@ -3602,7 +3625,7 @@ static portBASE_TYPE prvTaskPGWCommand(cli_state_t *cli_state, int8_t *pcWriteB
|
|
|
}
|
|
|
}
|
|
|
int temp_parity = atoi(str_temp);
|
|
|
- if (temp_parity >= GW_NO_PAR || temp_parity < MAX_PARITY_TYPES) {
|
|
|
+ if (temp_parity >= GW_NO_PAR && temp_parity < MAX_PARITY_TYPES) {
|
|
|
uint32_t parity;
|
|
|
GetPortGwParityInt(&parity);
|
|
|
if ((int)parity != temp_parity) {
|