Program upgrading method and device for power terminal equipment and power terminal equipment

By comparing the current program version and the upgrade program version in the power terminal device, and using SM3 values ​​to verify the integrity and consistency of the upgrade file, the upgrade failure and system instability caused by corruption or tampering of the upgrade file is solved, and the reliability and stability of the upgrade is improved.

CN119690486APending Publication Date: 2025-03-25SHENZHEN CLOU ELECTRONICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411773628.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

During the upgrade process of power terminal equipment, the upgrade failed and the system was unstable due to the damage or tampered upgrade files.

Method used

By obtaining the current program version information of the power terminal device and the upgrade program version information, compare whether the two are consistent; if they are inconsistent, receive the program file and its SM3 value, calculate the SM3 value of the program file, and match the received SM3 value. If it matches, install the program file.

Benefits of technology

It effectively avoids upgrade failure and system instability caused by corruption or tampering of the upgrade file, and improves the reliability and stability of program upgrades of power terminal equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690486A_ABST
    Figure CN119690486A_ABST
Patent Text Reader

Abstract

The invention provides a program upgrading method and device of power terminal equipment and the power terminal equipment, and relates to the technical field of the power terminal equipment. The method comprises the steps of obtaining first version information of a current program of the power terminal equipment in response to upgrading input; under the condition that the first version information is inconsistent with the second version information of the upgrading program, receiving a program file and a first SM3 value; determining a second SM3 value of the program file; and under the condition that the second SM3 value is matched with the first SM3 value, installing the program file. According to the method, invalid upgrading can be avoided, the problems of upgrading failure and system instability caused by upgrading file damage or tampering can be avoided, and the reliability and the stability of the power terminal equipment during program upgrading are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of power terminal equipment, and in particular to a method and device for program upgrading of power terminal equipment, and power terminal equipment. Background Art

[0002] In related technologies, power terminal equipment is used to realize functions such as data collection, monitoring and control, and thus plays a vital role in the power system. In order to ensure the system security and stability of the current terminal equipment and provide better performance, it is necessary to regularly upgrade the system and programs of the power terminal equipment. When the upgrade file is damaged or tampered with, it will lead to problems such as failure of the current terminal equipment upgrade and system instability. Summary of the invention

[0003] The present application aims to at least solve the technical problems existing in the prior art or related art that when upgrading power terminal equipment, upgrade files may be damaged or tampered with, leading to upgrade failure and system instability.

[0004] To this end, the first aspect of the present application proposes a program upgrade method for power terminal equipment.

[0005] A second aspect of the present application provides a program upgrade device for power terminal equipment.

[0006] A third aspect of the present application provides a program upgrade device for power terminal equipment.

[0007] A fourth aspect of the present application provides a readable storage medium.

[0008] A fifth aspect of the present application provides a power terminal device.

[0009] In view of this, the first aspect of the present application provides a program upgrade method for an electric power terminal device, comprising: in response to an upgrade input, obtaining first version information of a current program of the electric power terminal device; when the first version information is inconsistent with the second version information of the upgrade program, receiving a program file and a first SM3 value; determining a second SM3 value of the program file; and when the second SM3 value matches the first SM3 value, installing the program file.

[0010] In this technical solution, the power terminal equipment includes but is not limited to electric energy meters, electric metering equipment, power metering equipment, etc. The power terminal equipment can collect, monitor and control the power consumption data of power-consuming equipment and power-consuming units according to needs. In order to achieve the above functions, the power terminal equipment installs and runs the corresponding system and program software.

[0011] In order to ensure the operational safety and stability of power terminal equipment and optimize the performance and functions of power terminal equipment according to actual needs, power terminal equipment needs to undergo regular system (program) upgrades.

[0012] When performing a system upgrade or a program upgrade on a power terminal device, the user can input the upgrade through the management interface of the power terminal device. Exemplarily, the power terminal device includes a human-computer interaction module, and the management interface is displayed through the human-computer interaction module and the user's upgrade input is received. Exemplarily, the power terminal device can communicate with a management terminal, and the management interface is displayed through the management terminal and the user's upgrade input is received, wherein the management terminal includes but is not limited to a host computer, a computer, and a mobile terminal.

[0013] After receiving the user's upgrade input, the power terminal device first obtains the first version information of the currently running program and confirms the second version information of the upgrade program. In some embodiments, the power terminal device is upgraded online through a remote server. In this case, the power terminal device initiates a request to the target server to obtain the second version information of the upgrade program. In other embodiments, the power terminal device can be upgraded offline through a removable storage medium, such as a USB flash drive, and the power terminal device obtains the second version information of the upgrade program by accessing the offline storage medium.

[0014] After obtaining the second version information, the power terminal device compares the second version information with the first version information. When the second version information is consistent with the first version information, a prompt message is output through the above management interface, such as outputting: "The current system is consistent with the upgrade package version, and the upgrade operation is invalid" to prevent repeated upgrades.

[0015] If the second version information is inconsistent with the first version information, the program file of the upgrade program is obtained. Exemplarily, the power terminal device can download the program file from the target server. Exemplarily, the power terminal device can read the program file stored in the removable storage medium.

[0016] Exemplarily, taking the example of a power terminal device downloading a program file of an upgrade program through a target server, after the power terminal device receives the upgrade input and determines that the upgrade program version is inconsistent with the current version, the power terminal device sends an upgrade download request to the target server. After receiving the upgrade download request, the target server sends the program file corresponding to the upgrade program and the first SM3 value corresponding to the program file to the power terminal device.

[0017] After receiving the program file, the power terminal device calculates the SM3 value of the program file to obtain a second SM3 value, and compares the second SM3 value to see whether it matches the first SM3 value sent by the server.

[0018] If the second SM3 value matches the first SM3 value, it means that the received program file is complete and has not been tampered with, and the power terminal device executes the upgrade program and installs the program file corresponding to the upgrade program.

[0019] It can be understood that if the second SM3 value does not match the first SM3 value, it means that the received program file is damaged and may have been tampered with. At this time, the power terminal device can output an error prompt, or try to re-download the program file and re-check the SM3 value.

[0020] After obtaining the program file of the upgrade program, the power terminal device performs an SM3 value check on the obtained program file. For example, the program file can be encrypted by an SM3 (a cryptographic hash function standard) algorithm. After receiving the program file, the power terminal device calculates the SM3 value of the program file and performs a security check by using the SM3 value.

[0021] After completing the SM3 value verification, the specific method of executing the upgrade program is determined based on the verification result. For example, if the verification result is passed, the upgrade program is executed. If the verification result is failed, an error prompt message is output, or the program file is downloaded again.

[0022] The present application performs version verification upon receiving an upgrade instruction, which can avoid invalid upgrades, and performs SM3 value verification on the program file used for the upgrade before starting to execute the upgrade program. This can avoid upgrade failures and system instability caused by damage or tampering of the upgrade file, and improve the reliability and stability of power terminal equipment during program upgrades.

[0023] In addition, the program upgrade method of the power terminal device in the above technical solution provided by this application may also have the following additional technical features:

[0024] In some technical solutions of the present application, optionally, the program file includes at least one first subprogram file and an SM3 value list corresponding to at least one first subprogram file; installing the program file includes: obtaining at least one first subprogram file based on the program file, and determining a third SM3 value of each first subprogram file; and installing each first subprogram file separately when the third SM3 value matches the SM3 value list.

[0025] In this technical solution, during one upgrade, the power terminal device may need to upgrade multiple program files, that is, the program file of the upgrade program includes one or more sub-program files, which are recorded as the above-mentioned first sub-program file.

[0026] After receiving the program file, the power terminal device unpacks the program file to obtain one or more first subprogram files and an SM3 value list including the correct SM3 value of each first subprogram file. The power terminal device calculates the SM3 value of each unpacked first subprogram file and compares the SM3 values ​​recorded in the remaining SM3 value lists to see if they are consistent.

[0027] If the consistency is confirmed, it means that the first subprogram file is complete and has not been tampered with, and the first subprogram file that has passed the SM3 value verification can be installed. It can be understood that if the third SM3 value of a first subprogram file does not match the one recorded in the SM3 value list, it means that the first subprogram file may be damaged or tampered with, and a corresponding prompt message can be output at this time, or an attempt can be made to re-decompress the program file, or an attempt can be made to download the program file again.

[0028] In some technical solutions of the present application, optionally, each first subprogram file is used to update and upgrade a second subprogram file in the power terminal device; before installing each first subprogram file separately, the program upgrade method also includes: backing up each second subprogram file.

[0029] In this technical solution, when performing an upgrade installation, each first subprogram file is used to upgrade a second subprogram file of the current program, and the upgrade operations here include file overwriting, file modification, and file addition operations.

[0030] Before installing the first subprogram file, each second subprogram file to be changed is backed up. Exemplarily, the power terminal device includes a secure storage space, and before executing the upgrade program, each second subprogram file to be changed is backed up to the secure storage space. When the upgrade fails, or after the upgrade, there are problems such as system function loss and system instability, the system program of the power terminal device can be safely rolled back to a normal working state by restoring the backed-up second subprogram file, thereby improving reliability.

[0031] In some technical solutions of the present application, optionally, after installing each first subprogram file respectively, the program upgrade method also includes: determining a fourth SM3 value corresponding to the installed first subprogram file; when the fourth SM3 value matches the SM3 value list, determining that the first subprogram file is successfully installed; or, when the fourth SM3 value does not match the SM3 value list, performing at least one of the following operations: outputting an upgrade failure prompt message, re-executing the upgrade program, and restoring the backed-up second subprogram file.

[0032] In this technical solution, after the first subprogram file is installed, the SM3 value of the installed file is checked again to ensure that the first subprogram file is correctly and completely installed. Exemplarily, after installing a first subprogram file, the power terminal device calculates the SM3 value of each installed first subprogram file, obtains the fourth SM3 value of the first subprogram file, and compares the fourth SM3 value again to see if it matches the correct SM3 value recorded in the SM3 value list.

[0033] If it is determined that the fourth SM3 value of each installed first subprogram file matches the one recorded in the SM3 value list, it means that the first subprogram file is correctly and completely installed, and at this time, it is determined that the first subprogram file is successfully installed. If there is any first subprogram file after installation that does not match the one recorded in the SM3 value list, it means that the first subprogram file is incorrectly installed or not completely installed, and at this time, the preset operation is executed.

[0034] Exemplarily, the preset operation includes outputting an upgrade failure prompt message, such as outputting “Upgrade failed, please try again”, or outputting “Upgrade failed, please restore backup”.

[0035] Exemplarily, the preset operation includes re-executing the upgrade program, such as re-downloading the program file of the upgrade program, re-unpacking the program file and performing an SM3 value check on the unpacked first subprogram file, and re-installing the first subprogram file after the check passes.

[0036] Exemplarily, the preset operation includes restoring the backed-up second subprogram file, that is, after the installation of the first subprogram file fails, restoring the modified second subprogram file backed up before the upgrade from the safe storage space, thereby restoring the system version of the power terminal equipment to the stable version before the upgrade.

[0037] In some technical solutions of the present application, optionally, after installing each first subprogram file respectively, the program upgrade method also includes: in response to an uninstall input, uninstalling the installed first subprogram file, and restoring the backed-up second subprogram file; obtaining the third version information of the program of the power terminal device after uninstalling the first subprogram file; and determining that the first subprogram file has been successfully uninstalled when the third version information is consistent with the first version information.

[0038] In this technical solution, the user can choose to uninstall the executed upgrade program according to their own needs. For example, the user can choose to uninstall the upgrade through the management interface. When the power terminal device receives the user's uninstall input, each installed first subprogram file is uninstalled one by one, and after uninstalling the installed first subprogram file, the backed-up second subprogram file is restored, thereby rolling back the system program version of the power terminal device to the version before the upgrade.

[0039] Exemplarily, after uninstalling each first subprogram file, the restored second subprogram file may be subjected to SM3 verification again to ensure that the uninstallation operation is correctly performed.

[0040] After the uninstallation is completed, the power terminal device obtains the third version information of the system program at this time, and determines whether the third version information after the uninstallation is consistent with the first version information before the upgrade operation is performed. If it is determined to be consistent, it means that the uninstallation operation is performed correctly. If it is inconsistent, it means that the uninstallation failed, and a prompt message indicating the uninstallation failure is output at this time.

[0041] In some technical solutions of the present application, optionally, after executing the upgrade program based on the verification result, the program upgrade method also includes: performing configuration verification on the upgraded program of the power terminal device, and obtaining the fourth version information of the upgraded program of the power terminal device; when the configuration verification passes and the fourth version information is consistent with the second version information, it is determined that the program upgrade of the power terminal device is successful.

[0042] In this technical solution, after completing the program upgrade of the power terminal device, the power terminal device verifies the upgraded program configuration, obtains the upgraded program version information, and obtains the fourth version information. When the upgraded program configuration verification is successful, and the upgraded fourth version information is consistent with the second version information of the upgraded program, it means that the upgrade is successful. At this time, the upgrade operation is completed and the prompt information of "upgrade successful" is output.

[0043] If the configuration verification fails, or the fourth version information is inconsistent with the second version information, a prompt message indicating that the upgrade failed is output, and specific key content of the failure is output.

[0044] The second aspect of the present application provides a program upgrade device for an electric power terminal device, comprising: an acquisition module for acquiring first version information of a current program of the electric power terminal device in response to an upgrade input; a receiving module for receiving a program file and a first SM3 value when the first version information is inconsistent with the second version information of the upgrade program; a verification module for determining the second SM3 value of the program file; and an upgrade execution module for installing the program file when the second SM3 value matches the first SM3 value.

[0045] In this technical solution, the power terminal equipment includes but is not limited to electric energy meters, electric metering equipment, power metering equipment, etc. The power terminal equipment can collect, monitor and control the power consumption data of power-consuming equipment and power-consuming units according to needs. In order to achieve the above functions, the power terminal equipment installs and runs the corresponding system and program software.

[0046] In order to ensure the operational safety and stability of power terminal equipment and optimize the performance and functions of power terminal equipment according to actual needs, power terminal equipment needs to undergo regular system (program) upgrades.

[0047] When performing a system upgrade or a program upgrade on a power terminal device, the user can input the upgrade through the management interface of the power terminal device. Exemplarily, the power terminal device includes a human-computer interaction module, and the management interface is displayed through the human-computer interaction module and the user's upgrade input is received. Exemplarily, the power terminal device can communicate with a management terminal, and the management interface is displayed through the management terminal and the user's upgrade input is received, wherein the management terminal includes but is not limited to a host computer, a computer, and a mobile terminal.

[0048] After receiving the user's upgrade input, the power terminal device first obtains the first version information of the currently running program and confirms the second version information of the upgrade program. In some embodiments, the power terminal device is upgraded online through a remote server. In this case, the power terminal device initiates a request to the target server to obtain the second version information of the upgrade program. In other embodiments, the power terminal device can be upgraded offline through a removable storage medium, such as a USB flash drive, and the power terminal device obtains the second version information of the upgrade program by accessing the offline storage medium.

[0049] After obtaining the second version information, the power terminal device compares the second version information with the first version information. When the second version information is consistent with the first version information, a prompt message is output through the above management interface, such as outputting: "The current system is consistent with the upgrade package version, and the upgrade operation is invalid" to prevent repeated upgrades.

[0050] If the second version information is inconsistent with the first version information, the program file of the upgrade program is obtained. Exemplarily, the power terminal device can download the program file from the target server. Exemplarily, the power terminal device can read the program file stored in the removable storage medium.

[0051] Exemplarily, taking the example of a power terminal device downloading a program file of an upgrade program through a target server, after the power terminal device receives the upgrade input and determines that the upgrade program version is inconsistent with the current version, the power terminal device sends an upgrade download request to the target server. After receiving the upgrade download request, the target server sends the program file corresponding to the upgrade program and the first SM3 value corresponding to the program file to the power terminal device.

[0052] After receiving the program file, the power terminal device calculates the SM3 value of the program file to obtain a second SM3 value, and compares the second SM3 value to see whether it matches the first SM3 value sent by the server.

[0053] If the second SM3 value matches the first SM3 value, it means that the received program file is complete and has not been tampered with, and the power terminal device executes the upgrade program and installs the program file corresponding to the upgrade program.

[0054] It can be understood that if the second SM3 value does not match the first SM3 value, it means that the received program file is damaged and may have been tampered with. At this time, the power terminal device can output an error prompt, or try to re-download the program file and re-check the SM3 value.

[0055] After obtaining the program file of the upgrade program, the power terminal device performs an SM3 value check on the obtained program file. For example, the program file can be encrypted by an SM3 (a cryptographic hash function standard) algorithm. After receiving the program file, the power terminal device calculates the SM3 value of the program file and performs a security check by using the SM3 value.

[0056] After completing the SM3 value verification, the specific method of executing the upgrade program is determined based on the verification result. For example, if the verification result is passed, the upgrade program is executed. If the verification result is failed, an error prompt message is output, or the program file is downloaded again.

[0057] The present application performs version verification upon receiving an upgrade instruction, which can avoid invalid upgrades, and performs SM3 value verification on the program file used for the upgrade before starting to execute the upgrade program. This can avoid upgrade failures and system instability caused by damage or tampering of the upgrade file, and improve the reliability and stability of power terminal equipment during program upgrades.

[0058] The third aspect of the present application provides a program upgrade device for an electric terminal device, comprising: a memory for storing programs or instructions; a processor for executing programs or instructions to implement the steps of a program upgrade method for an electric terminal device as provided in any of the above technical solutions, thereby also being able to achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0059] The fourth aspect of the present application provides a readable storage medium on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the program upgrade method of the power terminal equipment provided in any of the above technical solutions are implemented, and thus the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0060] The fifth aspect of the present application provides an electric power terminal device, including: a program upgrade device for the electric power terminal device as provided in any of the above technical solutions; and / or a readable storage medium as provided in any of the above technical solutions, so that the same technical effect can be achieved. To avoid repetition, it will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0062] Figure 1 A flowchart showing a program upgrade method for a power terminal device in some embodiments of the present application;

[0063] Figure 2 A flowchart showing a program upgrade method for a power terminal device in some embodiments of the present application;

[0064] Figure 3 A structural block diagram showing a program upgrade device for a power terminal device in some embodiments of the present application;

[0065] Figure 4 A structural block diagram of a program upgrade device for an electric power terminal device in some embodiments of the present application is shown. DETAILED DESCRIPTION

[0066] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.

[0067] In the following description, many specific details are set forth to facilitate a full understanding of the present application. However, the present application may also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present application is not limited to the specific embodiments disclosed below.

[0068] Refer to the following Figures 1 to 4 A program upgrade method and apparatus for power terminal equipment, and power terminal equipment according to some embodiments of the present application are described.

[0069] In some embodiments of the present application, a method for program upgrading of a power terminal device is provided. Figure 1 A flowchart showing a program upgrade method for a power terminal device in some embodiments of the present application is shown. Figure 1 As shown, the method includes:

[0070] Step 102, in response to the upgrade input, obtaining first version information of the current program of the power terminal device;

[0071] Step 104, receiving the program file and the first SM3 value when the first version information is inconsistent with the second version information of the upgrade program;

[0072] Step 106, determining a second SM3 value of the program file;

[0073] Step 108, when the second SM3 value matches the first SM3 value, install the program file.

[0074] In this embodiment, the power terminal device includes but is not limited to an energy meter, an electricity metering device, a power metering device, etc. The power terminal device can collect, monitor and control the power consumption data of the power-consuming devices and power-consuming units according to the needs. In order to realize the above functions, the power terminal device installs and runs the corresponding system and program software.

[0075] In order to ensure the operational safety and stability of power terminal equipment and optimize the performance and functions of power terminal equipment according to actual needs, power terminal equipment needs to undergo regular system (program) upgrades.

[0076] When performing a system upgrade or a program upgrade on a power terminal device, the user can input the upgrade through the management interface of the power terminal device. Exemplarily, the power terminal device includes a human-computer interaction module, and the management interface is displayed through the human-computer interaction module and the user's upgrade input is received. Exemplarily, the power terminal device can communicate with a management terminal, and the management interface is displayed through the management terminal and the user's upgrade input is received, wherein the management terminal includes but is not limited to a host computer, a computer, and a mobile terminal.

[0077] After receiving the user's upgrade input, the power terminal device first obtains the first version information of the currently running program and confirms the second version information of the upgrade program. In some embodiments, the power terminal device is upgraded online through a remote server. In this case, the power terminal device initiates a request to the target server to obtain the second version information of the upgrade program. In other embodiments, the power terminal device can be upgraded offline through a removable storage medium, such as a USB flash drive, and the power terminal device obtains the second version information of the upgrade program by accessing the offline storage medium.

[0078] After obtaining the second version information, the power terminal device compares the second version information with the first version information. When the second version information is consistent with the first version information, a prompt message is output through the above management interface, such as outputting: "The current system is consistent with the upgrade package version, and the upgrade operation is invalid" to prevent repeated upgrades.

[0079] If the second version information is inconsistent with the first version information, the program file of the upgrade program is obtained. Exemplarily, the power terminal device can download the program file from the target server. Exemplarily, the power terminal device can read the program file stored in the removable storage medium.

[0080] Exemplarily, taking the example of a power terminal device downloading a program file of an upgrade program through a target server, after the power terminal device receives the upgrade input and determines that the upgrade program version is inconsistent with the current version, the power terminal device sends an upgrade download request to the target server. After receiving the upgrade download request, the target server sends the program file corresponding to the upgrade program and the first SM3 value corresponding to the program file to the power terminal device.

[0081] After receiving the program file, the power terminal device calculates the SM3 value of the program file to obtain a second SM3 value, and compares the second SM3 value to see whether it matches the first SM3 value sent by the server.

[0082] If the second SM3 value matches the first SM3 value, it means that the received program file is complete and has not been tampered with, and the power terminal device executes the upgrade program and installs the program file corresponding to the upgrade program.

[0083] It can be understood that if the second SM3 value does not match the first SM3 value, it means that the received program file is damaged and may have been tampered with. At this time, the power terminal device can output an error prompt, or try to re-download the program file and re-check the SM3 value.

[0084] After obtaining the program file of the upgrade program, the power terminal device performs an SM3 value check on the obtained program file. For example, the program file can be encrypted by an SM3 (a cryptographic hash function standard) algorithm. After receiving the program file, the power terminal device calculates the SM3 value of the program file and performs a security check by using the SM3 value.

[0085] After completing the SM3 value verification, the specific method of executing the upgrade program is determined based on the verification result. For example, if the verification result is passed, the upgrade program is executed. If the verification result is failed, an error prompt message is output, or the program file is downloaded again.

[0086] The present application performs version verification upon receiving an upgrade instruction, which can avoid invalid upgrades, and performs SM3 value verification on the program file used for the upgrade before starting to execute the upgrade program. This can avoid upgrade failures and system instability caused by damage or tampering of the upgrade file, and improve the reliability and stability of power terminal equipment during program upgrades.

[0087] In some embodiments of the present application, optionally, the program file includes at least one first subprogram file and an SM3 value list corresponding to at least one first subprogram file; installing the program file includes: obtaining at least one first subprogram file based on the program file, and determining a third SM3 value for each first subprogram file; and installing each first subprogram file separately when the third SM3 value matches the SM3 value list.

[0088] In this embodiment, in one upgrade, the power terminal device may need to upgrade multiple program files, that is, the program file of the upgrade program includes one or more sub-program files, which are recorded as the above-mentioned first sub-program files.

[0089] After receiving the program file, the power terminal device unpacks the program file to obtain one or more first subprogram files and an SM3 value list including the correct SM3 value of each first subprogram file. The power terminal device calculates the SM3 value of each unpacked first subprogram file and compares the SM3 values ​​recorded in the remaining SM3 value lists to see if they are consistent.

[0090] If the consistency is confirmed, it means that the first subprogram file is complete and has not been tampered with, and the first subprogram file that has passed the SM3 value verification can be installed. It can be understood that if the third SM3 value of a first subprogram file does not match the one recorded in the SM3 value list, it means that the first subprogram file may be damaged or tampered with, and a corresponding prompt message can be output at this time, or an attempt can be made to re-decompress the program file, or an attempt can be made to download the program file again.

[0091] In some embodiments of the present application, optionally, each first subprogram file is used to update and upgrade a second subprogram file in the power terminal device; before installing each first subprogram file separately, the program upgrade method also includes: backing up each second subprogram file.

[0092] In this embodiment, when performing an upgrade installation, each first subprogram file is used to upgrade a second subprogram file of the current program, and the upgrade operations here include file overwriting, file modification, and file addition operations.

[0093] Before installing the first subprogram file, each second subprogram file to be changed is backed up. Exemplarily, the power terminal device includes a secure storage space, and before executing the upgrade program, each second subprogram file to be changed is backed up to the secure storage space. When the upgrade fails, or after the upgrade, there are problems such as system function loss and system instability, the system program of the power terminal device can be safely rolled back to a normal working state by restoring the backed-up second subprogram file, thereby improving reliability.

[0094] In some embodiments of the present application, optionally, after installing each first subprogram file respectively, the program upgrade method also includes: determining a fourth SM3 value corresponding to the installed first subprogram file; when the fourth SM3 value matches the SM3 value list, determining that the first subprogram file is successfully installed; or, when the fourth SM3 value does not match the SM3 value list, performing at least one of the following operations: outputting an upgrade failure prompt message, re-executing the upgrade program, and restoring the backed-up second subprogram file.

[0095] In this embodiment, after the first subprogram file is installed, the SM3 value of the installed file is checked again to ensure that the first subprogram file is correctly and completely installed. Exemplarily, after installing a first subprogram file, the power terminal device calculates the SM3 value of each installed first subprogram file, obtains the fourth SM3 value of the first subprogram file, and compares the fourth SM3 value again to see if it matches the correct SM3 value recorded in the SM3 value list.

[0096] If it is determined that the fourth SM3 value of each installed first subprogram file matches the one recorded in the SM3 value list, it means that the first subprogram file is correctly and completely installed, and at this time, it is determined that the first subprogram file is successfully installed. If there is any first subprogram file after installation that does not match the one recorded in the SM3 value list, it means that the first subprogram file is incorrectly installed or not completely installed, and at this time, the preset operation is executed.

[0097] Exemplarily, the preset operation includes outputting an upgrade failure prompt message, such as outputting “Upgrade failed, please try again”, or outputting “Upgrade failed, please restore backup”.

[0098] Exemplarily, the preset operation includes re-executing the upgrade program, such as re-downloading the program file of the upgrade program, re-unpacking the program file and performing an SM3 value check on the unpacked first subprogram file, and re-installing the first subprogram file after the check passes.

[0099] Exemplarily, the preset operation includes restoring the backed-up second subprogram file, that is, after the installation of the first subprogram file fails, restoring the modified second subprogram file backed up before the upgrade from the safe storage space, thereby restoring the system version of the power terminal equipment to the stable version before the upgrade.

[0100] In some embodiments of the present application, optionally, after installing each first subprogram file respectively, the program upgrade method also includes: in response to an uninstall input, uninstalling the installed first subprogram file, and restoring the backed-up second subprogram file; obtaining third version information of the program of the power terminal device after uninstalling the first subprogram file; and determining that the first subprogram file has been successfully uninstalled when the third version information is consistent with the first version information.

[0101] In this embodiment, the user can choose to uninstall the executed upgrade program according to his own needs. Exemplarily, the user can choose to uninstall the upgrade through the management interface. When the power terminal device receives the user's uninstall input, each installed first subprogram file is uninstalled one by one, and after uninstalling the installed first subprogram file, the backed-up second subprogram file is restored, thereby rolling back the system program version of the power terminal device to the version before the upgrade.

[0102] Exemplarily, after uninstalling each first subprogram file, the restored second subprogram file may be subjected to SM3 verification again to ensure that the uninstallation operation is correctly performed.

[0103] After the uninstallation is completed, the power terminal device obtains the third version information of the system program at this time, and determines whether the third version information after the uninstallation is consistent with the first version information before the upgrade operation is performed. If it is determined to be consistent, it means that the uninstallation operation is performed correctly. If it is inconsistent, it means that the uninstallation failed, and a prompt message indicating the uninstallation failure is output at this time.

[0104] In some embodiments of the present application, optionally, after executing the upgrade program based on the verification result, the program upgrade method also includes: performing a configuration check on the upgraded program of the power terminal device, and obtaining fourth version information of the upgraded program of the power terminal device; when the configuration check passes and the fourth version information is consistent with the second version information, it is determined that the program upgrade of the power terminal device is successful.

[0105] In this embodiment, after completing the program upgrade of the power terminal device, the power terminal device verifies the upgraded program configuration, obtains the upgraded program version information, and obtains the fourth version information. When the upgraded program configuration verification is successful, and the upgraded fourth version information is consistent with the second version information of the upgraded program, it means that the upgrade is successful. At this time, the upgrade operation is completed and the prompt information of "upgrade successful" is output.

[0106] If the configuration verification fails, or the fourth version information is inconsistent with the second version information, a prompt message indicating that the upgrade failed is output, and specific key content of the failure is output.

[0107] In some embodiments of the present application, Figure 2 A flowchart showing a program upgrade method for a power terminal device in some embodiments of the present application is shown. Figure 2 As shown, the method includes:

[0108] Step 202, current version verification.

[0109] In this embodiment, the user obtains the current version information through the management interface of the power terminal device. If the user chooses to upgrade, but the current system version is consistent with the upgrade package version, it will return "the current system is consistent with the upgrade package version, and the upgrade operation is invalid" to prevent repeated upgrades.

[0110] Step 204, downloading the upgrade package;

[0111] Step 206: Verify the upgrade package.

[0112] In this embodiment, the user selects the upgrade operation through the management interface of the power terminal device. The system downloads the upgrade package from the preset trusted server and calculates its SM3 value. The calculated SM3 value is compared with the SM3 value provided by the server to ensure that the downloaded upgrade package has not been tampered with.

[0113] Step 208, back up the current system.

[0114] In this embodiment, before upgrading, all modified or overwritten files are backed up, and the backup files are stored in a safe storage medium so as to be restored when needed.

[0115] Step 210, installing the upgrade package;

[0116] Step 212, verify the file and version after installation.

[0117] In this embodiment, the downloaded upgrade package is decompressed and installed file by file. Before and after each file is installed, its SM3 value is calculated and compared with the SM3 value in the upgrade package to ensure that the file is written correctly. After the installation is completed, the key system files and the upgrade files are fully verified to ensure that all files and configurations are correct. The current system version and the upgrade package version are compared to ensure that the system version has been correctly changed to the upgraded version.

[0118] Step 214, choose whether to uninstall the upgrade package as needed.

[0119] In this embodiment, if uninstallation is required, the user selects the uninstallation operation through the management interface, uninstalls the previously installed files one by one, and performs SM3 verification to ensure the correctness of the uninstallation operation. After the uninstallation is completed, the system is restored to the state before the upgrade, and the current system version and the upgrade package version are compared to ensure that the version information has been rolled back.

[0120] Through the above method, the present application can effectively improve the reliability and safety of power terminal equipment system upgrades and reduce problems such as system failures and data loss caused by upgrade failures.

[0121] In some embodiments of the present application, a program upgrade device for a power terminal device is provided. Figure 3 The structural block diagram of the program upgrade device of the power terminal equipment in some embodiments of the present application is shown as follows Figure 3 As shown, the program upgrade device 300 of the power terminal device includes:

[0122] An acquisition module 302 is used to acquire first version information of a current program of the power terminal device in response to an upgrade input;

[0123] A receiving module 304, configured to receive a program file and a first SM3 value when the first version information is inconsistent with the second version information of the upgrade program;

[0124] A verification module 306, used to determine a second SM3 value of the program file;

[0125] The upgrade execution module 308 is used to install the program file when the second SM3 value matches the first SM3 value.

[0126] In this embodiment, the power terminal device includes but is not limited to an energy meter, an electricity metering device, a power metering device, etc. The power terminal device can collect, monitor and control the power consumption data of the power-consuming devices and power-consuming units according to the needs. In order to realize the above functions, the power terminal device installs and runs the corresponding system and program software.

[0127] In order to ensure the operational safety and stability of power terminal equipment and optimize the performance and functions of power terminal equipment according to actual needs, power terminal equipment needs to undergo regular system (program) upgrades.

[0128] When performing a system upgrade or a program upgrade on a power terminal device, the user can input the upgrade through the management interface of the power terminal device. Exemplarily, the power terminal device includes a human-computer interaction module, and the management interface is displayed through the human-computer interaction module and the user's upgrade input is received. Exemplarily, the power terminal device can communicate with a management terminal, and the management interface is displayed through the management terminal and the user's upgrade input is received, wherein the management terminal includes but is not limited to a host computer, a computer, and a mobile terminal.

[0129] After receiving the user's upgrade input, the power terminal device first obtains the first version information of the currently running program and confirms the second version information of the upgrade program. In some embodiments, the power terminal device is upgraded online through a remote server. In this case, the power terminal device initiates a request to the target server to obtain the second version information of the upgrade program. In other embodiments, the power terminal device can be upgraded offline through a removable storage medium, such as a USB flash drive, and the power terminal device obtains the second version information of the upgrade program by accessing the offline storage medium.

[0130] After obtaining the second version information, the power terminal device compares the second version information with the first version information. When the second version information is consistent with the first version information, a prompt message is output through the above management interface, such as outputting: "The current system is consistent with the upgrade package version, and the upgrade operation is invalid" to prevent repeated upgrades.

[0131] If the second version information is inconsistent with the first version information, the program file of the upgrade program is obtained. Exemplarily, the power terminal device can download the program file from the target server. Exemplarily, the power terminal device can read the program file stored in the removable storage medium.

[0132] After obtaining the program file of the upgrade program, the power terminal device performs an SM3 value check on the obtained program file. For example, the program file can be encrypted by an SM3 (a cryptographic hash function standard) algorithm. After receiving the program file, the power terminal device calculates the SM3 value of the program file and performs a security check by using the SM3 value.

[0133] After completing the SM3 value verification, the specific method of executing the upgrade program is determined based on the verification result. For example, if the verification result is passed, the upgrade program is executed. If the verification result is failed, an error prompt message is output, or the program file is downloaded again.

[0134] The present application performs version verification upon receiving an upgrade instruction, which can avoid invalid upgrades, and performs SM3 value verification on the program file used for the upgrade before starting to execute the upgrade program. This can avoid upgrade failures and system instability caused by damage or tampering of the upgrade file, and improve the reliability and stability of power terminal equipment during program upgrades.

[0135] In some embodiments of the present application, a program upgrade device for a power terminal device is provided. Figure 4 The structural block diagram of the program upgrade device of the power terminal equipment in some embodiments of the present application is shown as follows Figure 4 As shown, the program upgrade device 400 of the power terminal equipment includes: a memory 402, used to store programs or instructions; a processor 404, used to execute programs or instructions to implement the steps of the program upgrade method of the power terminal equipment provided in any of the above embodiments, and thus can also achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0136] In some embodiments of the present application, a readable storage medium is provided, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the program upgrade method of the power terminal equipment provided in any of the above embodiments are implemented, and thus the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0137] In some embodiments of the present application, a power terminal device is provided, including: a program upgrade device for the power terminal device as provided in any of the above embodiments; and / or a readable storage medium as provided in any of the above embodiments, so that the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0138] The methods may be implemented in various ways according to specific features and / or example applications. For example, the methods may be implemented by a combination of hardware, firmware, and / or software. For example, in a hardware implementation, the processor may be implemented in one or at least one application-specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, a microprocessor, an electronic device, other equipment units for performing the above functions, and / or a combination thereof.

[0139] A computer readable storage medium may be a tangible device that can retain and store instructions for use by an instruction execution device. A computer readable storage medium may be an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the above devices, but is not limited thereto. A non-exhaustive list of more specific examples of computer readable storage media includes: a portable computer floppy disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM) or flash memory, a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory card, a floppy disk, a coding mechanical device (such as a punch card or a groove with a raised structure with instructions recorded thereon), and any suitable combination of the above devices. The computer-readable storage medium used herein should not be understood as a transmission signal itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagated through wave guides or other transmission media, or electrical signals transmitted through wires.

[0140] In the description of this application, the term "at least one" refers to two or more than two. Unless otherwise clearly defined, the terms "upper" and "lower" indicate the orientation or position relationship based on the orientation or position relationship described in the drawings. They are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, they cannot be understood as limitations on this application. The terms "connect", "install", "fixed", etc. should be understood in a broad sense. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be directly connected or indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0141] In the description of the present application, the description of the terms "one embodiment", "some embodiments", "specific embodiments", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In the present application, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or at least one embodiment or example in a suitable manner.

[0142] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A program upgrade method for power terminal equipment, characterized in that: include: In response to the upgrade input, obtaining first version information of the current program of the power terminal device; In the case where the first version information is inconsistent with the second version information of the upgrade program, receiving a program file and a first SM3 value; Determining a second SM3 value of the program file; In case the second SM3 value matches the first SM3 value, the program file is installed.

2. The program upgrade method according to claim 1, characterized in that: The program files include at least one first subprogram file and at least one SM3 value list corresponding to the first subprogram file; The installing of the program file comprises: obtaining at least one of the first subprogram files based on the program file, and determining a third SM3 value of each of the first subprogram files; In case the third SM3 value matches the SM3 value list, each of the first subprogram files is installed respectively.

3. The program upgrade method according to claim 2, characterized in that: Each of the first subprogram files is used to update and upgrade a second subprogram file in the power terminal device; Before installing each of the first subprogram files respectively, the program upgrade method further includes: Back up each of the second subprogram files.

4. The program upgrade method according to claim 3, characterized in that: After installing each of the first subprogram files respectively, the program upgrade method further includes: Determine a fourth SM3 value corresponding to the first subprogram file after installation; In a case where the fourth SM3 value matches the SM3 value list, determining that the first subprogram file is successfully installed; Alternatively, when the fourth SM3 value does not match the SM3 value list, at least one of the following operations is performed: outputting an upgrade failure prompt message, re-executing the upgrade program, and restoring the backed-up second subprogram file.

5. The program upgrade method according to claim 3, characterized in that: After installing each of the first subprogram files respectively, the program upgrade method further includes: In response to the uninstall input, uninstall the installed first subprogram file and restore the backed-up second subprogram file; Acquire the third version information of the program of the power terminal device after uninstalling the first subprogram file; When the third version information is consistent with the first version information, it is determined that the first subprogram file is uninstalled successfully.

6. The program upgrade method according to any one of claims 1 to 4, characterized in that: After installing the program file, the program upgrade method further includes: Performing configuration verification on the upgraded program of the power terminal device, and obtaining fourth version information of the upgraded program of the power terminal device; When the configuration verification passes and the fourth version information is consistent with the second version information, it is determined that the program upgrade of the power terminal device is successful.

7. A program upgrade device for power terminal equipment, characterized in that: include: an acquisition module, configured to acquire first version information of a current program of the power terminal device in response to an upgrade input; A receiving module, configured to receive a program file and a first SM3 value when the first version information is inconsistent with the second version information of the upgrade program; A verification module, used for determining a second SM3 value of the program file; An upgrade execution module is used to install the program file when the second SM3 value matches the first SM3 value.

8. A program upgrade device for power terminal equipment, characterized in that: include: Memory, used to store programs or instructions; A processor, used to execute the program or instruction to implement the steps of the program upgrade method for the power terminal equipment as described in any one of claims 1 to 6.

9. A readable storage medium having a program or instruction stored thereon, characterized in that: When the program or instruction is executed by the processor, the steps of the program upgrade method for the power terminal device as described in any one of claims 1 to 6 are implemented.

10. A power terminal device, characterized in that: include: The program upgrading device of the power terminal equipment as claimed in claim 7 or 8; and / or The readable storage medium as claimed in claim 9.