|
@@ -88,7 +88,7 @@ const char *akb_args_list[] = {
|
|
|
"lifetime",
|
|
|
"dataset",
|
|
|
"upspower",
|
|
|
-#else if HARDWARE_BT6711
|
|
|
+#else if HARDWARE_BT6711 || HARDWARE_BT6711_V1
|
|
|
"capacity",
|
|
|
"voltakb",
|
|
|
"upspower",
|
|
@@ -258,6 +258,10 @@ static portBASE_TYPE prvTaskUploadCommand(cli_state_t *cli_state, int8_t *pcWrit
|
|
|
*/
|
|
|
static portBASE_TYPE prvTaskUPSCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
|
|
|
|
|
|
+/*
|
|
|
+ * Implements the гзs serial command.
|
|
|
+ */
|
|
|
+static portBASE_TYPE prvSetUPSserialCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString );
|
|
|
|
|
|
/* Structure that defines the "info" command line command. This
|
|
|
generates a table that shows how much run time each task has */
|
|
@@ -342,7 +346,7 @@ static const CLI_Command_Definition_t prvAKBCommandDefinition = {
|
|
|
"\takb lifetime <value>: ввод срока службы АКБ (лет)\r\n"
|
|
|
"\takb dataset <YYYY-MM-DD>: ввод даты установки АКБ\r\n"
|
|
|
"\takb upspower <value>: ввод полной мощности ИБП (ВА)\r\n"
|
|
|
-#else if HARDWARE_BT6711
|
|
|
+#else if HARDWARE_BT6711 || HARDWARE_BT6711_V1
|
|
|
"\takb capacity <value>: ввод ёмкости АКБ (Ач)\r\n"
|
|
|
"\takb voltakb <value>: ввод номинального напряжения АКБ (В)\r\n"
|
|
|
"\takb upspower <value>: ввод полной мощности ИБП (ВА)\r\n"
|
|
@@ -591,6 +595,14 @@ static const CLI_Command_Definition_t prvRADIUSCommandDefinition = {
|
|
|
};
|
|
|
#endif
|
|
|
|
|
|
+static const CLI_Command_Definition_t prvSetUPSserialCommandDefinition =
|
|
|
+{
|
|
|
+ ( const int8_t * const ) "setupsid", /* The command string to type. */
|
|
|
+ ( const int8_t * const ) "\tsetupsid <password> <SN>: установка серийного номера ИБП\r\n",
|
|
|
+ prvSetUPSserialCommand, /* The function to run. */
|
|
|
+ 2 /* Two parameters are expected, which can take any value. */
|
|
|
+};
|
|
|
+
|
|
|
/* Structure that defines the "quit" command line command. This
|
|
|
generates a table that shows how much run time each task has */
|
|
|
static const CLI_Command_Definition_t prvQuitCommandDefinition = {
|
|
@@ -635,6 +647,7 @@ void vRegisterCLICommands( void )
|
|
|
#ifdef RADIUS_SERVER_ENABLE
|
|
|
FreeRTOS_CLIRegisterCommand( &prvRADIUSCommandDefinition );
|
|
|
#endif
|
|
|
+ FreeRTOS_CLIRegisterCommand( &prvSetUPSserialCommandDefinition );
|
|
|
FreeRTOS_CLIRegisterCommand( &prvQuitCommandDefinition );
|
|
|
}
|
|
|
/*-----------------------------------------------------------*/
|
|
@@ -1290,10 +1303,15 @@ static portBASE_TYPE prvTaskNetworkCommand(cli_state_t *cli_state, int8_t *pcWri
|
|
|
break;
|
|
|
case ARG_NETWORK_MASK:
|
|
|
if (xParameterStringLength <= 15) {
|
|
|
- if (ipaddr_addr(str) != IPADDR_NONE) {
|
|
|
- SetMaskStr(str);
|
|
|
- strcpy( ( char * ) pcWriteBuffer,
|
|
|
+ uint32_t mask = ipaddr_addr(str);
|
|
|
+ if (mask != IPADDR_NONE) {
|
|
|
+ if(ip4_addr_netmask_valid(mask)) {
|
|
|
+ SetMaskStr(str);
|
|
|
+ strcpy( ( char * ) pcWriteBuffer,
|
|
|
"\t\tСохраните конфигурацию сетевых настроек\r\n" );
|
|
|
+ } else {
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ }
|
|
|
} else {
|
|
|
strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
}
|
|
@@ -1563,7 +1581,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
|
|
|
+#if HARDWARE_BT6709 || HARDWARE_BT6709_MTS || HARDWARE_BT6711 || HARDWARE_BT6711_V1
|
|
|
case ARG_AKB_CAPACITY:
|
|
|
if (value >= CAPACITY_MIN_RANGE && value <= CAPACITY_MAX_RANGE && (value - (int32_t)value) == 0) {
|
|
|
SetCapacityNominalAKBStr(str);
|
|
@@ -1580,7 +1598,7 @@ static portBASE_TYPE prvTaskAKBCommand(cli_state_t *cli_state, int8_t *pcWriteBu
|
|
|
strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
}
|
|
|
break;
|
|
|
-#ifndef HARDWARE_BT6711
|
|
|
+#if HARDWARE_BT6709 || HARDWARE_BT6709_MTS
|
|
|
case ARG_AKB_LIFETIME:
|
|
|
if (value >= LIFETIME_MIN_RANGE && value <= LIFETIME_MAX_RANGE && (value - (int32_t)value) == 0) {
|
|
|
SetLifeTimeAKBStr(str);
|
|
@@ -3440,5 +3458,63 @@ static portBASE_TYPE prvTaskFTPCommand(cli_state_t *cli_state, int8_t *pcWriteBu
|
|
|
return xReturn;
|
|
|
}
|
|
|
#endif // FTP_ENABLE
|
|
|
+
|
|
|
+
|
|
|
+/*
|
|
|
+ * Implements the ups serial command.
|
|
|
+ */
|
|
|
+static portBASE_TYPE prvSetUPSserialCommand(cli_state_t *cli_state, int8_t *pcWriteBuffer, size_t xWriteBufferLen, const int8_t *pcCommandString ){
|
|
|
+ int8_t *pcParameterString;
|
|
|
+ signed portBASE_TYPE xParameterStringLength;
|
|
|
+ portBASE_TYPE xParameterNumber = 1;
|
|
|
+ char str[10];
|
|
|
+
|
|
|
+ ( 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;
|
|
|
+ }
|
|
|
+
|
|
|
+ if( strncmp( ( const char * ) pcParameterString, "SvUsn", xParameterStringLength ) != 0 ){
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ 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. */
|
|
|
+ );
|
|
|
+ memset(str, 0, sizeof(str));
|
|
|
+ if(xParameterStringLength != 8){
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ return pdFALSE;
|
|
|
+ }
|
|
|
+ strncat(str, ( const char * ) pcParameterString, xParameterStringLength);
|
|
|
+ for(uint8_t j = 0; j < xParameterStringLength; j++){
|
|
|
+ if(!isdigit_int(str[j])){
|
|
|
+ strncpy( ( char * ) pcWriteBuffer, ( const char * ) pcInvalidCommand, strlen( ( char * ) pcInvalidCommand ) );
|
|
|
+ return pdFALSE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SetUPSSerialStr(str);
|
|
|
+ cli_save_config(cli_state);
|
|
|
+
|
|
|
+ return pdFALSE;
|
|
|
+}
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|