Remote upgrading method and device, terminal equipment and storage medium

文档序号:7214 发布日期:2021-09-17 浏览:35次 中文

1. A remote upgrading method is applied to a lower computer, and comprises the following steps:

receiving upgrade communication data, the upgrade communication data including an upgrade program;

storing the upgrading program and writing the value of an upgrading mark as a first preset value;

restarting the lower computer and detecting the value of the upgrading mark;

if the value of the upgrading mark is the first preset value, acquiring the upgrading program and writing the value of the upgrading mark into a second preset value;

and operating the upgrading program.

2. The remote upgrade method according to claim 1, wherein the storing the upgrade program comprises: storing the upgrading program in a backup area;

correspondingly, the obtaining the upgrade program includes: copying the upgrading program stored in the backup area to an upgrading area;

correspondingly, the running the upgrade program includes: and running the upgrading program stored in the upgrading area.

3. The remote upgrade method according to claim 2, wherein said receiving upgrade communication data comprises:

receiving a protocol header of the upgrading communication data and the upgrading program, and caching the upgrading program;

if the protocol tail of the upgrading communication data is received within the set time, verifying the upgrading program to obtain a verification result;

correspondingly, the storing the upgrade program in the backup area includes: and if the verification result is that the verification is passed, storing the upgrading program in a backup area.

4. A remote upgrade method according to claim 3, wherein the method further comprises: if the protocol tail of the upgrading communication data is not received within the set time, judging that the remote upgrading fails and returning to receive the protocol head again.

5. The remote upgrade method according to any one of claims 2 to 4, further comprising, prior to said detecting a value of the upgrade flag: acquiring the state of a mode switch;

correspondingly, the detecting the value of the upgrade flag includes: if the state of the mode switch is a normal mode, detecting the value of the upgrading mark;

correspondingly, the running of the upgrade program stored in the upgrade area includes: if the value of the upgrading mark is not the first preset value but the second preset value, running an upgrading program stored in the upgrading area;

the method further comprises the following steps: and if the value of the upgrading mark is not the first preset value or the second preset value, running a factory program stored in a factory to receive the upgrading communication data.

6. The remote upgrade method of claim 5, wherein said obtaining a state of a mode switch comprises:

receiving a state switching instruction sent by a user through a trigger mode switch;

and generating the state of the mode switch according to the state switching instruction.

7. The remote upgrade method of claim 5, wherein the method further comprises: and if the mode switch is in the abnormal mode, running a factory program stored in a factory to receive the upgrading communication data.

8. The utility model provides a remote upgrading device which characterized in that is applied to the next machine, the device includes:

a receiving module to: receiving upgrade communication data, the upgrade communication data including an upgrade program;

a backup module to: storing the upgrading program and writing the value of an upgrading mark as a first preset value;

a processing module to: restarting the lower computer and detecting the value of the upgrading mark;

an upgrade program acquisition module configured to: if the value of the upgrading mark is the first preset value, acquiring the upgrading program and writing the value of the upgrading mark into a second preset value;

the upgrading program running module is used for: and operating the upgrading program.

9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the method of any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the method of any one of claims 1 to 7.

Background

In the field of lightning protection, the internet of things monitored by lightning protection is becoming mainstream. The realization of the Internet of things brings the convenience of improving the early warning efficiency, quickly reacting, having clear lightning protection equipment conditions, effectively managing the lightning protection equipment, saving manpower and the like for users. The lightning protection internet of things is most critical to monitoring the installation unit point and feeding the current state back to the background server in real time. However, in the current application scenario, if some parameter modification, or optimization error, etc. needs to be performed on the monitoring system of the installation unit point, a technician needs to go to the site to update the program of the installation unit point, which brings great inconvenience to the later maintenance.

Disclosure of Invention

Embodiments of the present application provide a remote upgrade method, apparatus, terminal device, and storage medium, which are convenient for later maintenance.

In a first aspect, an embodiment of the present application provides a remote upgrade method, which is applied to a lower computer, and the method includes:

receiving upgrade communication data, the upgrade communication data including an upgrade program;

storing the upgrading program and writing the value of an upgrading mark as a first preset value;

restarting the lower computer and detecting the value of the upgrading mark;

if the value of the upgrading mark is the first preset value, acquiring the upgrading program and writing the value of the upgrading mark into a second preset value;

and operating the upgrading program.

In a possible implementation manner of the first aspect, the storing the upgrade program includes: storing the upgrading program in a backup area;

correspondingly, the obtaining the upgrade program includes: copying the upgrading program stored in the backup area to an upgrading area;

correspondingly, the running the upgrade program includes: and running the upgrading program stored in the upgrading area.

In a possible implementation manner of the first aspect, the receiving upgrade communication data includes:

receiving a protocol header of the upgrading communication data and the upgrading program, and caching the upgrading program;

if the protocol tail of the upgrading communication data is received within the set time, verifying the upgrading program to obtain a verification result;

correspondingly, the storing the upgrade program in the backup area includes: and if the verification result is that the verification is passed, storing the upgrading program in a backup area.

In a possible implementation manner of the first aspect, the updating communication data includes a preset check code, and the checking the updating program to obtain a check result includes:

generating a real-time check code of the upgrading program;

and comparing the real-time check code with the preset check code to obtain a check result.

In a possible implementation manner of the first aspect, the method further includes: if the protocol tail of the upgrading communication data is not received within the set time, judging that the remote upgrading fails and returning to receive the protocol head again.

In a possible implementation manner of the first aspect, before the detecting the value of the upgrade flag, the method further includes: acquiring the state of a mode switch;

correspondingly, the detecting the value of the upgrade flag includes: if the state of the mode switch is a normal mode, detecting the value of the upgrading mark;

correspondingly, the running of the upgrade program stored in the upgrade area includes: if the value of the upgrading mark is not the first preset value but the second preset value, running an upgrading program stored in the upgrading area;

the method further comprises the following steps: and if the value of the upgrading mark is not the first preset value or the second preset value, running a factory program stored in a factory to receive the upgrading communication data.

In a possible implementation manner of the first aspect, the obtaining the state of the mode switch includes:

receiving a state switching instruction sent by a user through a trigger mode switch;

and generating the state of the mode switch according to the state switching instruction.

In a possible implementation manner of the first aspect, the method further includes: the method further comprises the following steps: and if the mode switch is in the abnormal mode, running a factory program stored in a factory to receive the upgrading communication data.

In a second aspect, an embodiment of the present application further provides a remote upgrade method, which is applied to an upper computer, and the method includes:

sending upgrade communication data, the upgrade communication data including an upgrade program;

and receiving return data sent by the lower computer, wherein the return data is sent after the lower computer stores the upgrading program and writes the value of the upgrading mark into a first preset value.

In one possible implementation manner of the second aspect, before the sending the upgrade communication data, the method further includes:

receiving an upgrading instruction sent by a user, wherein the upgrading instruction corresponds to the lower computer;

receiving a heartbeat packet sent by the lower computer in response to receiving the upgrading instruction;

correspondingly, the sending upgrade communication data includes: in response to receiving the heartbeat packet, sending upgrade communication data.

In a third aspect, an embodiment of the present application provides a remote upgrade apparatus, which is applied to a lower computer, the apparatus including:

a receiving module to: receiving upgrade communication data, the upgrade communication data including an upgrade program;

a backup module to: storing the upgrading program and writing the value of an upgrading mark as a first preset value;

a processing module to: restarting the lower computer and detecting the value of the upgrading mark;

an upgrade program acquisition module configured to: if the value of the upgrading mark is the first preset value, acquiring the upgrading program and writing the value of the upgrading mark into a second preset value;

the upgrading program running module is used for: and operating the upgrading program.

In a fourth aspect, an embodiment of the present application further provides a remote upgrade apparatus, which is applied to an upper computer, the apparatus includes:

a sending module configured to: sending upgrade communication data, the upgrade communication data including an upgrade program;

a return data receiving module for: and receiving return data sent by the lower computer, wherein the return data is sent after the lower computer stores the upgrading program and writes the value of the upgrading mark into a first preset value.

In a fifth aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the method of any one of the first aspect or the second aspect when executing the computer program.

In a sixth aspect, embodiments of the present application provide a computer-readable storage medium storing a computer program, which when executed by a processor implements the method of any one of the first or second aspects.

In a seventh aspect, an embodiment of the present application provides a computer program product, which, when run on a terminal device, causes the terminal device to perform the method of any one of the first aspect or the second aspect.

Compared with the prior art, the embodiment of the application has the beneficial effects that:

in an embodiment of the present application, upgrade communication data is received, wherein the upgrade communication data includes an upgrade program; storing the received upgrading program, and writing the value of the upgrading mark into a first preset value; restarting the lower computer and detecting the value of the upgrading mark; if the value of the upgrading mark is the first preset value, acquiring a stored upgrading program and writing the value of the upgrading mark into a second preset value; the first preset value corresponds to the stored received upgrading program, the second preset value corresponds to the upgrading program which is obtained after the lower computer is restarted, and therefore correct remote upgrading can be guaranteed, reliable remote upgrading is achieved, technicians can be prevented from hurrying to the site for processing, later maintenance is facilitated, and later maintenance cost can be saved.

Some possible implementations of embodiments of the present application have the following beneficial effects:

receiving upgrade communication data, wherein the upgrade communication data includes an upgrade program; storing the received upgrading program in a backup area, and writing the value of an upgrading mark into a first preset value; restarting the lower computer and detecting the value of the upgrading mark; if the value of the upgrading mark is the first preset value, copying the upgrading program stored in the backup area to the upgrading area, and writing the value of the upgrading mark into a second preset value; the upgrading mark is a second preset value and indicates that the upgrading program is stored in the upgrading area, so that the upgrading program stored in the upgrading area can be operated; the first preset value is corresponding to the backup area and stores the received upgrading program, the second preset value is corresponding to the upgrading program which is copied to the upgrading area after the lower computer is restarted, the upgrading program can be reliably and continuously received, the upgrading is completed, and therefore the upgrading can be stably carried out for multiple times in later maintenance;

receiving a protocol header for upgrading communication data and an upgrading program, and storing the upgrading program; if the protocol tail of the upgrading communication data is received within the set time, the upgrading program is verified to obtain a verification result; if the verification result is that the verification is passed, the upgrading program is stored in the backup area; therefore, the completeness and the correctness of the received upgrade communication data can be ensured;

acquiring the state of a mode switch before detecting the value of an upgrade flag; if the state of the mode switch is a normal mode, detecting the value of the upgrading mark; if the value of the upgrading mark is not the first preset value but the second preset value, running an upgrading program stored in an upgrading area; therefore, the reliable proceeding of the upgrading process can be ensured, and the upgrading correctness can be ensured;

if the value of the upgrading mark is neither the first preset value nor the second preset value, operating a factory program stored in a factory to receive upgrading communication data; thus, even if an error occurs in the upgrading process, the upgrading can be restarted, and the robustness of the system can be improved.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.

FIG. 1 is a schematic structural diagram of a remote upgrade system provided in an embodiment of the present application;

fig. 2 is a schematic structural diagram of a lower computer according to an embodiment of the present application;

FIG. 3 is an information interaction diagram of a remote upgrade system provided by an embodiment of the present application;

FIG. 4 is a flowchart illustrating step A1 of a remote upgrade method according to an embodiment of the present application;

FIG. 5 is a flowchart illustrating step A12 of a remote upgrade method according to an embodiment of the present application;

fig. 6 is a schematic structural diagram of an upper computer provided in an embodiment of the present application

FIG. 7 is a logic diagram of a remote upgrade method provided by an embodiment of the present application;

FIG. 8 is a schematic structural diagram of a remote upgrading device applied to a lower computer according to an embodiment of the present application;

fig. 9 is a schematic structural diagram of a receiving module of a remote upgrade apparatus according to an embodiment of the present application;

fig. 10 is a schematic structural diagram of a check submodule of a remote upgrade apparatus according to an embodiment of the present application;

FIG. 11 is a schematic structural diagram of a variation of a remote upgrade apparatus provided in an embodiment of the present application;

FIG. 12 is a schematic structural diagram of another variation of a remote upgrade apparatus provided in an embodiment of the present application;

fig. 13 is a schematic structural diagram of a remote upgrade apparatus applied to an upper computer according to an embodiment of the present application;

fig. 14 is a schematic structural diagram of a terminal device according to an embodiment of the present application.

Detailed Description

In order to make the technical problems, technical solutions and advantages to be solved by the present application more clearly apparent, the present application is further described in detail below with reference to fig. 1 to 14 and the embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.

In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.

It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.

It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".

Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.

Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.

Fig. 1 is a schematic structural diagram of a remote upgrade system according to an embodiment of the present application, and the system is specifically a remote upgrade system applied to a lightning protection internet of things. The system comprises the background server and the lightning protection monitoring unit, and can realize remote upgrade of the lightning protection monitoring unit. The lightning protection monitoring Unit comprises a micro control Unit (MCU for short). In this embodiment, referring to fig. 1, the background server is an upper computer 10, and the micro control unit is a lower computer 20.

The upper computer 10 runs an Application (APP). The application program is used for receiving the signals fed back by the lightning protection monitoring unit, analyzing and processing the signals and storing the data in the background server. The current data and the historical data can be viewed on the application program, and an instruction can be sent to the lightning protection monitoring unit.

Fig. 2 is a schematic structural diagram of a lower computer according to an embodiment of the present disclosure, and referring to fig. 2, the lower computer 20 includes a memory 21, and the memory 21 is a flash memory (flash). In the present embodiment, the memory 21 includes an outbound area 211, a backup area 212, and an upgrade area 213.

In this embodiment, to realize the remote upgrade of the lightning protection monitoring unit, the lower computer 20 includes two sets of programs: the first set of programs is used as original programs for leaving a factory (hereinafter referred to as factory programs); the second set of programs is an IAP (Application Programming) program, which is a program requiring an upgrade (which may be referred to as an online upgrade program, hereinafter referred to as an upgrade program), specifically, upgrade program firmware.

The embodiment also provides a remote upgrading method, which can be applied to the remote upgrading system. Fig. 3 shows an information interaction diagram of the foregoing remote upgrade system, where steps a1 to a5 are specifically applied to the lower computer 20, and steps C1 to C4 are specifically applied to the upper computer 10, where step C1 and step C2 are optional.

And step C1, receiving an upgrade instruction sent by the user, wherein the upgrade instruction corresponds to the lower computer 20.

The application program running on the upper computer 10 provides a column of interface specially used for remote upgrading, and new upgrading program firmware can be added for selective upgrading; in addition, the aforementioned interface also has an upgraded diary, such as: the upgrade object, the upgrade time, state, version, etc.

Determining a lightning protection monitoring unit to be upgraded, for example, determining an ID (Identification) of the lightning protection monitoring unit, where the ID of the lightning protection monitoring unit to be upgraded may be specifically selected by a user; the application program has a corresponding upgrading program, such as adding a new upgrading program firmware by a user; then, an upgrade instruction issued by the user is received, for example, the user clicks the upgrade to issue an upgrade instruction to the application program, where the upgrade instruction is used to upgrade the selected lightning protection monitoring unit (the lower computer 20).

And step C2, receiving the heartbeat packet sent by the lower computer 20 in response to receiving the upgrade instruction.

After the step C1 is completed, the upper computer 10 has received the upgrade instruction, and the application program is ready, and then the upper computer 10 receives the heartbeat packet that is periodically uploaded by the object unit (i.e., the lightning protection monitoring unit) corresponding to the upgrade instruction, where the received heartbeat packet indicates that the lower computer 20 of the lightning protection monitoring unit is operating normally.

And step C3, sending the upgrading communication data, wherein the upgrading communication data comprises an upgrading program.

After receiving the heartbeat packet of the lower computer 20, the application program sends an upgrade packet (including an upgrade program) plus the protocol header and the protocol trailer as upgrade communication data to the lower computer 20. Accordingly, the lower computer 20 executes step a 1.

Step A1, receiving upgrade communication data, wherein the upgrade communication data comprises an upgrade program.

As described above, the upper computer 10 transmits the upgrade communication data to the lower computer 20 through the application program, and accordingly, the lower computer 20 receives the upgrade communication data.

Fig. 4 is a schematic flowchart of step a1 of the remote upgrade method provided in this embodiment, where in this embodiment, step a1 specifically includes step a11 and step a 12.

And step A11, receiving the protocol header of the upgrade communication data and the upgrade program, and caching the upgrade program.

As described above, the upgrade communication data sent by the upper computer 10 to the lower computer 20(MCU) includes the protocol header, the upgrade program, and the protocol trailer. In the normal operation process, when the protocol header corresponding to the upgrade program is received from the upper computer 10, the lower computer 20 stores the corresponding code in the cache of the RAM (Random Access Memory) until the protocol end at the end, thereby implementing the cache of the upgrade program.

And step A12, if the protocol end of the upgrading communication data is received within the set time, the upgrading program is verified to obtain a verification result.

It takes time for the upper computer 10 to transmit the upgrade communication data, and if a missing code or an error occurs during the transmission, the lower computer 20 cannot receive the complete upgrade communication data. For this reason, in the present embodiment, the lower computer 20 sets the time of receiving the protocol end of the upgrade communication data, and if the protocol end of the upgrade communication data is received within the set time, indicates that the communication is successful. After receiving the protocol trailer of the upgrade communication data, the lower computer 20 checks the upgrade program therein. Specifically, the aforementioned step a12 includes a step a121 and a step a 122. Fig. 5 is a flowchart illustrating step a12 of the remote upgrade method provided in this embodiment.

And step A121, generating a real-time check code of the upgrading program.

After receiving the complete upgrade communication data, the lower computer 20 checks the upgrade program therein, specifically, performs CRC32 (cyclic redundancy check 32) check, and generates a corresponding real-time check code.

And A122, comparing the real-time check code with a preset check code to obtain a check result.

And after the real-time check code of the upgrading program is generated, comparing the real-time check code with a preset check code. The preset check code is contained in the upgrading communication data, and the preset check code and the upgrading program are jointly used as an upgrading packet; illustratively, the preset check code is the last 4 bytes of the upgrade package, wherein the upgrade communication data has a 4-byte CRC32 check code as a suffix bin format file, and thus the real-time check code is compared with the last 4 bytes of the received upgrade package, and the comparison result is used as the check result.

And step A2, storing the upgrading program and writing the value of the upgrading mark as a first preset value.

As described above, the storage space of the memory 21 (e.g., flash) of the lower computer 20 includes three portions, which are the factory area 211, the backup area 212, and the upgrade area 213, respectively, where the factory area 211 is used to run the factory original program, the backup area 212 is used to receive the upgrade program firmware, and the upgrade area 213 is used to upgrade the running space of the program firmware.

After receiving the protocol header, the lower computer 20 stores the code before the protocol end in the backup area 212 of the memory 21 for analysis; thus, step a2 is to store the upgrade program in the backup area 212 and write the value of the upgrade flag to the first preset value. Specifically, if the verification result is that the verification is passed, indicating that the receiving is successful, the upgrade program is stored in the backup area 212; the verification is passed, that is, the real-time verification code is consistent with the last 4 bytes of the received upgrade package, and the lower computer 20 erases the upgrade program in the cache to the backup area 212, so that the cache can store a new upgrade program. Meanwhile, the lower computer 20 writes the value of the upgrade flag as the first preset value in a designated storage space, where the designated storage space may be the flag area 214 of the memory 21, or may be a storage space existing outside the memory 21. Illustratively, the value of the upgrade flag is written to be 1, that is, the first preset value is 1. The lower computer 20 sends return data to the upper computer 10 after storing the upgrade program and writing the value of the upgrade flag to the first preset value, and feeds back that the communication is successful. Correspondingly, the upper computer 10 executes step C4, receives the return data and stores the return data for easy viewing.

And A3, restarting the lower computer and detecting the value of the upgrading mark.

After the upgrade program is stored, specifically, after the backup area 212 completes the backup of the upgrade program, the lower computer 20 resets and restarts to end the running program, so as to prepare for the subsequent upgrade. After the restart is completed, the lower computer 20 first detects the value of the upgrade flag.

And step A4, if the value of the upgrading mark is the first preset value, acquiring the upgrading program and writing the value of the upgrading mark as the second preset value.

After the lower computer 20 is restarted, if the detected value of the upgrade flag is 1 (the first preset value), the upgrade program is acquired to perform subsequent processing, and the value of the upgrade flag is rewritten, specifically, the value of the upgrade flag is written as the second preset value, for example, 2.

In this embodiment, after the lower computer 20 is restarted, it detects that the value of the upgrade flag is 1 (the first preset value), copies the code of the backup area 212 to the upgrade area 213, thereby acquiring the upgrade program from the backup area 212, and then writes the value of the upgrade flag to the second preset value.

And step A5, running an upgrading program.

And the lower computer 20 acquires the upgrading program after restarting, and runs the upgrading program to realize upgrading.

In this embodiment, after the upgrade program is stored in the upgrade area 213, the lower computer 20 jumps to the upgrade area 213 to run the upgrade program, and runs the upgrade program stored in the upgrade area 213, thereby completing the upgrade, where the upgrade program runs normally. Further, the lower computer 20 transmits data indicating that the upgrade is completed to the upper computer 10; accordingly, the upper computer 10 executes step C5, receives and stores the data indicating that the upgrade is completed, and facilitates viewing.

As described above, the lower computer 20 receives the upgrade communication data, wherein the upgrade communication data includes the upgrade program; the lower computer 20 stores the received upgrade program in the backup area 212, and writes the value of the upgrade flag as a first preset value; the lower computer 20 restarts and detects the value of the upgrade flag; if the value of the upgrade flag is the first preset value, storing the upgrade program stored in the backup area 212 in the upgrade area 213 of the lower computer, and writing the value of the upgrade flag into the second preset value; the upgrade flag is a second preset value, which indicates that the upgrade area 213 stores the upgrade program, so that the upgrade program stored in the upgrade area 213 can be run; the first preset value is corresponding to the backup area 212 and stores the received upgrading program, the second preset value is corresponding to the upgrading program which is stored in the backup area 212 and copied to the upgrading area 213 after the lower computer 20 is restarted, the upgrading program can be reliably and continuously received and the upgrading can be completed, and therefore the upgrading can be stably carried out for multiple times in later maintenance; therefore, the remote upgrading can be carried out correctly, reliable remote upgrading is realized, technicians can be prevented from going to the field for processing, and the later maintenance cost can be saved.

Referring to fig. 6, the upper computer 10 of the present embodiment includes a mode switch 101. The mode switch 101 is a mode selection switch, and may be a toggle switch, such as a double toggle switch. In other embodiments, the mode switch 101 and the upper computer 10 are two independent components of the remote upgrade system.

Then, the remote upgrade method provided by this embodiment, fig. 7 is a logic diagram of the remote upgrade method provided by this embodiment, and referring to fig. 7, before the step a3 of detecting the value of the upgrade flag, a step B1 is further included.

Step B1, the state of the mode switch 101 is acquired.

The mode switch 101 has at least two states corresponding to a normal mode and an abnormal mode, respectively. The normal mode is a default state, and indicates that the lower computer 20 is operating normally. The abnormal mode is triggered by a user, for example, the gear of the mode switch 101 is shifted to the gear corresponding to the abnormal mode, which indicates that a problem, such as power failure or crash, occurs during the upgrade process. Step B1 specifically includes step B11 and step B12.

And step B11, receiving a state switching instruction sent by the user through the trigger mode switch.

When a user finds that a problem occurs in the upgrading process, the user toggles the mode switch 101 of the upper computer 10 and sends a state switching instruction to the upper computer 10, for example, the normal mode is switched to the abnormal mode. The upper computer 10 receives the state switching instruction and sends the state switching instruction to the lower computer 20.

And step B12, generating the state of the mode switch according to the state switching command.

After receiving the state switching instruction sent by the upper computer 10, the lower computer 20 generates the state of the mode switch 101 according to the state switching instruction.

Of course, the upper computer 10 may generate the state of the mode switch according to the received state switching instruction, and then transmit the state of the mode switch to the lower computer 20, so that the lower computer 20 acquires the state of the mode switch 101.

Referring to fig. 7, after the lower computer 20 is powered on again, the lower computer is a default factory program and then detects the state of the mode switch 101. Correspondingly, the detecting the value of the upgrade flag in the step a3 specifically includes: and if the state of the mode switch is the normal mode, detecting the value of the upgrading mark. The foregoing steps a4 and a5 are then performed.

Correspondingly, the step a5 (running the upgrade program stored in the upgrade area) is specifically: referring to fig. 6, if the value of the upgrade flag is not the first preset value but the second preset value, the upgrade program stored in the upgrade area 213 is operated.

After the status of the mode switch 101 is acquired, it is detected that the value of the upgrade flag is not the first preset value but the second preset value, and this indicates that the upgrade area 213 stores a new upgrade program and needs to be upgraded. Then, the lower computer 20 jumps to the upgrade area 213 to run the upgrade program.

Correspondingly, the remote upgrade method provided by this embodiment further includes step B2.

And step B2, if the value of the upgrade flag is neither the first preset value nor the second preset value, running the factory program stored in the factory leaving area 211 to receive the upgrade communication data.

Various interferences may occur in the process of upgrading the lower computer 20, which may cause an error in running the upgrade program. In order to avoid this possibility, the upper computer 10 is provided with a mode switch 101, and the remote upgrade method provided in connection with this embodiment may select a normal mode or run a factory program. Specifically, referring to fig. 6, in the case that the state of the mode switch is the normal mode, if the value of the upgrade flag is neither the first preset value nor the second preset value, it indicates that a problem occurs in the upgrade process, and for this reason, the lower computer 20 runs the factory program stored in the factory exit area 211, receives upgrade communication data, restarts the upgrade, or starts a new round of upgrade, and can implement multiple upgrades in later maintenance.

Further, referring to fig. 7, if the state of the mode switch is the abnormal mode, it indicates that a problem occurs during the upgrade process. And detecting whether the value of the upgrading mark is a second preset value or not in order to determine whether an error occurs in the upgrading process. If the value of the upgrade flag is the second preset value, it indicates that although a problem occurs in the upgrade process, the upgrade area stores the upgrade program to be updated, and at this time, the foregoing step a5 (running the upgrade program stored in the upgrade area) is performed. If the value of the upgrade flag is not the second preset value, it indicates that a problem occurs in the upgrade process and data in the upgrade area is lost, and in order to perform normal upgrade, a factory program stored in the factory leaving area 211 is run to eliminate the problem, so as to receive upgrade communication data. Thus, the system has good error recovery capability.

Optionally, the step a1 further includes a step a 13.

And step A13, if the protocol tail of the upgrading communication data is not received within the set time, judging that the remote upgrading fails and returning to receive the protocol head again.

If the protocol tail is not received within the set time, the lower computer 20 determines that the communication (remote upgrade) fails, and returns a failure signal to the upper computer 10 (i.e., the background server) and returns to receive the protocol head again. The upper computer 10 receives the signals fed back by the lower computer 20, analyzes and processes the signals, stores the processed data, and realizes that the application program can display the current data and the historical data, such as displaying that a missing code or an error exists in the process of receiving the upgrade communication data.

Corresponding to the method described in the above embodiment, fig. 8 shows a block diagram of a remote upgrade apparatus provided in an embodiment of the present application, and the apparatus is applied to the lower computer 20. For convenience of explanation, only portions related to the embodiments of the present application are shown.

Referring to fig. 8, the apparatus includes a receiving module 1, a backup module 2, a processing module 3, an upgrade program acquisition module 4, and an upgrade program execution module 5.

A receiving module 1, configured to: upgrade communication data is received, the upgrade communication data including an upgrade program.

A backup module 2, configured to: and storing the upgrading program and writing the value of the upgrading mark as a first preset value.

A processing module 3 for: the lower computer 20 is restarted and the value of the upgrade flag is detected.

An upgrade program acquisition module 4 configured to: and if the value of the upgrading mark is the first preset value, acquiring the upgrading program and writing the value of the upgrading mark into a second preset value.

The upgrading program running module 5 is used for: and running an upgrading program.

In some embodiments, the backup module 2 is specifically configured to: the upgrade program is stored in the backup area 212 and the value of the upgrade flag is written as the first preset value. The upgrade program acquisition module 4 is specifically configured to: if the value of the upgrade flag is the first preset value, the upgrade program stored in the backup area 212 is stored in the upgrade area 213, and the value of the upgrade flag is written as the second preset value. The upgrade program running module 5 is specifically configured to: and running the upgrading program stored in the upgrading area.

Fig. 9 is a schematic structural diagram of a receiving module of a remote upgrade apparatus according to an embodiment of the present application, and referring to fig. 9, a receiving module 1 includes a receiving submodule 11, a checking submodule 12, and a feedback submodule 13. Wherein the feedback sub-module 13 is optional.

A receiving submodule 11, configured to: and receiving a protocol header for upgrading communication data and an upgrading program, and storing the upgrading program.

A check submodule 12 for: and if the protocol tail of the upgrading communication data is received within the set time, verifying the upgrading program to obtain a verification result.

A feedback sub-module 13 for: if the protocol tail of the upgrading communication data is not received within the set time, judging that the remote upgrading fails and returning to receive the protocol head again.

Correspondingly, the backup module 2 is specifically configured to: if the verification result is that the verification is passed, the upgrade program is stored in the backup area 212.

Fig. 10 is a schematic structural diagram of a verification sub-module of the remote upgrade apparatus according to an embodiment of the present application, and referring to fig. 10, the verification sub-module 12 includes a verification code generating unit 121 and a comparing unit 122.

And the check code generating unit 121 is configured to generate a real-time check code of the upgrade program.

An alignment unit 122, configured to: and comparing the real-time check code with a preset check code to obtain a check result.

In some embodiments, the receiving submodule 11 is specifically configured to cache the upgrade program. The backup module 2 is specifically configured to: and if the verification result is that the verification is passed, the upgrading program is erased to the backup area.

Fig. 11 is a schematic structural diagram of a modification of the remote upgrade apparatus according to an embodiment of the present application, and referring to fig. 11, the remote upgrade apparatus further includes a status obtaining module 1B.

And a state acquiring module 1B for acquiring the state of the mode switch 101.

The processing module 3 is specifically configured to: if the state of the mode switch 101 is the normal mode, the value of the upgrade flag is detected.

The upgrade program running module 5 is specifically configured to: and if the value of the upgrading mark is not the first preset value but the second preset value, running the upgrading program stored in the upgrading area.

Fig. 12 is a schematic structural diagram of another modification of the remote upgrade apparatus according to an embodiment of the present application, and referring to fig. 12, the remote upgrade apparatus further includes a reset module 2B.

A reset module 2B for: and if the value of the upgrading mark is not the first preset value or the second preset value, running a factory program stored in the factory to receive upgrading communication data.

A reset module 2B, further configured to: if the mode switch 101 is in the abnormal mode, the factory program stored in the factory is run to receive the upgrade communication data.

Corresponding to the method described in the foregoing embodiment, fig. 13 shows a block diagram of a remote upgrade apparatus provided in an embodiment of the present application, and the apparatus is applied to the upper computer 10. For convenience of explanation, only portions related to the embodiments of the present application are shown.

Referring to fig. 13, the apparatus includes an upgrade instruction receiving module 1C, a heartbeat packet receiving module 2C, a transmitting module 3C, and a return data receiving module 4C. The upgrade instruction receiving module 1C and the heartbeat packet receiving module 2C are optional.

An upgrade instruction receiving module 1C configured to: and receiving an upgrading instruction sent by the user, wherein the upgrading instruction corresponds to the lower computer 20.

A heartbeat packet receiving module 2C, configured to: in response to receiving the upgrade instruction, the heartbeat packet transmitted by the lower computer 20 is received.

A sending module 3C, configured to: and sending upgrade communication data, wherein the upgrade communication data comprises an upgrade program. The sending module 3C is specifically configured to: in response to receiving the heartbeat packet, upgrade communication data is transmitted.

A return data receiving module 4C configured to: and receiving the return data sent by the lower computer 20, wherein the return data is sent by the lower computer 20 after the lower computer stores the upgrading program and writes the value of the upgrading mark as the first preset value. The return data receiving module 4C is further configured to: and receiving data indicating that the upgrade is completed, the data being transmitted to the upper computer 10 after the upgrade is completed by the lower computer 20.

It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.

The embodiment of the application can realize the program upgrading and updating of the lower computer 20 only by the application program interface in the background, namely remote upgrading. Specifically, on the basis of not changing the hardware of the system (such as the lightning protection monitoring system), the programs of the upper computer and the lower computer are modified through the agreed protocol of the upper computer and the lower computer, and the upgrading program firmware to be updated by the lower computer 20 is directly downloaded to the lower computer 20 on the application program, so that remote upgrading is realized. Therefore, program upgrading can be realized through software, and hardware expenditure can be saved; when the program of the lower computer 20 needs to be updated, only simple operation on a background application program is needed, so that the reaction speed and efficiency can be improved; in the later maintenance, technicians do not need to rush to the site for treatment every time \36834and \36834respectively, so that a large amount of travel expenses and labor expenses can be saved, and the later maintenance cost can be saved. The embodiment of the application can be applied to a lightning protection Internet of things monitoring system or an industrial Internet of things monitoring system and the like.

Fig. 14 is a schematic structural diagram of a terminal device according to an embodiment of the present application. As shown in fig. 14, the terminal device 14 of this embodiment includes: at least one processor 140 (only one shown in fig. 14), a memory 141, and a computer program 142 stored in the memory 141 and executable on the at least one processor 140; the steps in any of the various method embodiments described above are implemented when the computer program 142 is executed by the processor 140.

The terminal device 14 may be a lightning protection monitoring unit. The terminal equipment may include, but is not limited to, a processor 140 and a memory 141. Those skilled in the art will appreciate that fig. 14 is merely an example of a terminal device, and does not constitute a limitation of the terminal device, and may include more or less components than those shown, or combine some components, or different components, such as input and output devices, network access devices, buses, etc.

The Processor 140 may be a Central Processing Unit (CPU), and the Processor 140 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), off-the-shelf Programmable Gate arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.

The storage 141 may in some embodiments be an internal storage unit of the terminal device 14, such as a hard disk or a memory of the terminal device. The memory 141 may also be an external storage device of the terminal device in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the terminal device. Further, the memory 141 may also include both an internal storage unit of the terminal device and an external storage device. The memory 141 is used for storing an operating system, an application program, a BootLoader (BootLoader), data, and other programs, such as program codes of a computer program. The memory 141 may also be used to temporarily store data that has been output or is to be output.

Illustratively, the computer program 142 may be divided into one or more modules/units, which are stored in the memory 141 and executed by the processor 140 to accomplish the present application. One or more of the modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 142 in the terminal device 14.

It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules, so as to perform all or part of the functions described above. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.

The aforementioned integrated units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above may be implemented by a computer program, which may be stored in a computer-readable storage medium, to instruct related hardware; the computer program may, when being executed by a processor, realize the steps of the respective method embodiments described above. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium includes: any entity or device capable of carrying computer program code to an apparatus/terminal device, recording medium, computer Memory, Read-Only Memory (ROM), Random-Access Memory (RAM), electrical carrier wave signals, telecommunications signals, and software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.

Embodiments of the present application also provide a computer-readable storage medium, which stores a computer program, and the computer program is implemented to realize the steps of the above method embodiments when executed by a processor.

Embodiments of the present application provide a computer program product, which when running on a terminal device, such as a lightning protection monitoring unit, enables the lightning protection monitoring unit to implement the steps in the above-described method embodiments.

In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.

Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.

In the embodiments provided in the present application, it should be understood that the disclosed apparatus/device and method may be implemented in other ways. For example, the above-described apparatus/device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.

The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.

The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:资源包更新方法、装置、设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!