Fuel gas equipment firmware upgrading method and device, equipment and storage medium
Through the Scada system issuing firmware upgrade instructions and file transfer functions, firmware upgrades are directly completed in the gas equipment, solving the problem that equipment in the gas industry does not support URL downloads and server push upgrade packages, and achieving efficient upgrades of the equipment firmware.
Patent Information
- Application Number
- CN202411485792.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-01-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
There are a large number of existing equipment in the gas industry that do not support downloading upgrade packages through URLs, and the support capability of actively pushing upgrade packages on the server side is poor, which leads to difficulty in upgrading firmware.
The firmware upgrade instructions are issued to the gas equipment through the Scada system, the current firmware information feedback from the equipment is received, the upgrade task is created, the upgrade method is determined and the upgrade package is selected, and the file transfer function of the Scada system is used to directly issue the upgrade package to complete the firmware upgrade.
There is no need to download the upgrade package using URL. The firmware upgrade is achieved using the Scada system's own functions, which solves the problems of small device memory and battery power, and improves the feasibility and efficiency of firmware upgrades.
Smart Images

Figure CN119292633A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing technology, and in particular to a method, device, equipment and storage medium for upgrading gas equipment firmware. Background Art
[0002] The Scada system manages a large number of sensor devices, some of which have large memory and support mains electricity. Such devices can be upgraded by downloading upgrade packages through URLs. However, there are a large number of existing devices in the gas industry, which have small memory and are powered by batteries. They do not support downloading through URLs and have poor support for the server to actively push upgrade packages.
[0003] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of the present invention is to provide a gas equipment firmware upgrade method, device, equipment and storage medium, aiming to solve the technical problem that a large number of existing devices in the gas industry do not support downloading upgrade packages via URLs and have poor support for the server's active push of upgrade packages.
[0005] To achieve the above object, the present invention provides a method for upgrading the firmware of a gas device, the method comprising the following steps:
[0006] Send firmware upgrade instructions to each gas device through the Scada system;
[0007] Receiving current firmware information fed back by each gas device based on the firmware upgrade instruction;
[0008] Creating an upgrade task, and determining a list of gas devices to be upgraded corresponding to the upgrade task according to the current firmware information;
[0009] Determine the firmware upgrade mode of each gas device to be upgraded, and select an upgrade package according to the firmware upgrade mode, wherein the firmware upgrade mode includes a first firmware upgrade mode and a second firmware upgrade mode. If the second firmware upgrade mode is used, select the upgrade package according to the difference between the current firmware of the gas device to be upgraded and the new upgrade firmware;
[0010] Initiate an upgrade task, and distribute the upgrade package based on the list of gas equipment to be upgraded through the Scada system;
[0011] The upgrade results fed back by each gas device to be upgraded after completing the firmware upgrade are received, and the Scada system updates the status of the upgrade task to complete the firmware upgrade.
[0012] In some embodiments, the sending of firmware upgrade instructions to each gas device through the Scada system includes:
[0013] Get the status information of each gas device;
[0014] Extracting a corresponding status identifier from the status information;
[0015] The status identifiers are compared with the status identifiers stored in the identifier library respectively. If it is determined through the comparison that the gas device is in an online state, a firmware upgrade instruction is sent to the gas device in the online state through the Scada system.
[0016] In some embodiments, determining the list of gas devices to be upgraded corresponding to the upgrade task according to the current firmware information includes:
[0017] Comparing the current firmware information with the target firmware information;
[0018] If the versions of the current firmware information and the target firmware information are inconsistent, and the gas device supports the functions after the upgrade package is upgraded, the corresponding gas device is determined to be a gas device to be upgraded, and a corresponding list of gas devices to be upgraded is generated.
[0019] In some embodiments, if the second firmware upgrade method is used, selecting an upgrade package according to the difference between the current firmware of the gas device to be upgraded and the new upgrade firmware includes:
[0020] identifying a first region and a second region between the current firmware and the new upgraded firmware based on the byte changes;
[0021] Determine a byte difference within the first region, store the byte difference in a difference memory block, and store all bytes within the second region as a whole in an additional memory block;
[0022] Adding the bytes in the current firmware and the byte differences in the first area byte by byte, and adding the bytes of the additional memory block to the end of the byte segment after the addition, to obtain a first differential packet;
[0023] Generate a second differential packet based on the first differential packet, and compress the second differential packet to obtain a target differential packet;
[0024] A corresponding upgrade package is selected based on the target differential package.
[0025] In some embodiments, generating the second differential packet based on the first differential packet includes:
[0026] Determine that the zero elimination coding pointer points to the starting position of the difference memory block in the first difference packet;
[0027] If the starting position is a zero byte, statistical zero elimination encoding is performed on the continuous zero byte sequence, and a flag byte is inserted;
[0028] If the starting position is a non-zero byte, shift the non-zero byte backward by one position;
[0029] Return to the step of determining that the zero elimination coding pointer points to the starting position of the difference memory block in the first difference packet until all bytes of the difference memory block are processed to obtain a second difference packet.
[0030] In some embodiments, compressing the second differential packet to obtain a target differential packet includes:
[0031] Setting two sliding windows of the same size, sliding the second differential packet through the two windows in sequence, putting the processed data in the differential packet into the first window, and putting the unprocessed data into the second window, wherein the first window is used as a dictionary;
[0032] Starting from the first character string of the second window, the processing is performed in sequence according to the byte order;
[0033] When processing the current string, the first three bytes of the current string are used to search whether there is a matching string in the dictionary;
[0034] If there is a matching string, the longest string is determined by matching, the matching length is used to replace the longest string for output, and the string is put into the dictionary;
[0035] If there is no matching string, the current character is output and placed in the dictionary;
[0036] A target differential packet is obtained according to the data contained in the dictionary obtained after the processing of the second window is completed.
[0037] In some embodiments, the method further comprises:
[0038] After receiving the upgrade package, each gas device to be upgraded parses the upgrade package and determines the upgrade file start identifier, upgrade package data type and upgrade data based on the parsing result;
[0039] Each gas device to be upgraded performs a legitimacy check based on the upgrade file start identifier, and when the upgrade file start identifier is a legal start identifier, performs a consistency comparison of the upgrade package data type, and performs a firmware upgrade according to the upgrade data after the upgrade package data type is met.
[0040] In addition, to achieve the above-mentioned purpose, the present invention further proposes a gas equipment firmware upgrade device, the gas equipment firmware upgrade device comprising:
[0041] The issuing module is used to issue firmware upgrade instructions to each gas device through the Scada system;
[0042] A receiving module, used for receiving current firmware information fed back by each gas device based on the firmware upgrade instruction;
[0043] A creation module, used to create an upgrade task, and determine a list of gas devices to be upgraded corresponding to the upgrade task according to the current firmware information;
[0044] An upgrade module, used to determine a firmware upgrade mode for each gas device to be upgraded, and select an upgrade package according to the firmware upgrade mode, wherein the firmware upgrade mode includes a first firmware upgrade mode and a second firmware upgrade mode. If the second firmware upgrade mode is used, the upgrade package is selected according to the difference between the current firmware of the gas device to be upgraded and the new upgrade firmware;
[0045] The upgrade module is used to start the upgrade task and send the upgrade package based on the list of gas equipment to be upgraded through the Scada system;
[0046] The update module is used to receive the upgrade results fed back by each gas device to be upgraded after completing the firmware upgrade, and the Scada system updates the status of the upgrade task to complete the firmware upgrade.
[0047] In addition, to achieve the above-mentioned purpose, the present invention also proposes a gas equipment firmware upgrade device, which includes: a memory, a processor, and a gas equipment firmware upgrade program stored in the memory and executable on the processor, and the gas equipment firmware upgrade program is configured to implement the steps of the gas equipment firmware upgrade method described above.
[0048] In addition, to achieve the above objectives, the present invention also proposes a storage medium, on which a gas equipment firmware upgrade program is stored, and when the gas equipment firmware upgrade program is executed by a processor, the steps of the gas equipment firmware upgrade method described above are implemented.
[0049] The present invention sends firmware upgrade instructions to each gas device through the Scada system, receives current firmware information fed back by each gas device based on the firmware upgrade instruction; creates an upgrade task, and determines a list of gas devices to be upgraded corresponding to the upgrade task according to the current firmware information; determines the firmware upgrade method of each gas device to be upgraded, and selects an upgrade package according to the firmware upgrade method; starts the upgrade task, and sends the upgrade package based on the list of gas devices to be upgraded through the Scada system; receives the upgrade result fed back by each gas device to be upgraded after completing the firmware upgrade, and the Scada system updates the status of the upgrade task to complete the firmware upgrade, without the need to download the upgrade package through a URL, and uses the file transfer function of the Scada system itself to send the upgrade package, thereby completing the firmware upgrade. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 This is a flow chart of a first embodiment of a method for upgrading the gas equipment firmware according to the present invention;
[0051] Figure 2 This is a structural block diagram of the first embodiment of the gas equipment firmware upgrade device of the present invention.
[0052] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0053] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0054] The embodiment of the present invention provides a method for upgrading the firmware of a gas device, referring to Figure 1 , Figure 1 The figure is a flow chart of a first embodiment of a method for upgrading the firmware of a gas device according to the present invention.
[0055] In this embodiment, the gas equipment firmware upgrade method includes the following steps:
[0056] Step S10: Sending firmware upgrade instructions to each gas device via the Scada system.
[0057] In this embodiment, the executor of this embodiment is a gas equipment firmware upgrade device, wherein the gas equipment firmware upgrade device has functions such as data processing, data communication and program running. The gas equipment firmware upgrade device can be a computer terminal device or other network device, and of course it can also be other devices with similar functions, and this embodiment does not limit this.
[0058] It should be noted that the Scada system manages a large number of sensor devices, some of which have large memory and support mains electricity. Such devices can be upgraded by downloading upgrade packages through URLs. However, there are a large number of existing devices in the gas industry, which have small memory and many of which are powered by batteries. They do not support downloading through URLs and have poor support for the server to actively push upgrade packages.
[0059] In order to solve the above technical problems, this embodiment sends firmware upgrade instructions to each gas device through the Scada system, receives the current firmware information fed back by each gas device based on the firmware upgrade instruction; creates an upgrade task, and determines the list of gas devices to be upgraded corresponding to the upgrade task according to the current firmware information; determines the firmware upgrade method of each gas device to be upgraded, and selects the upgrade package according to the firmware upgrade method; starts the upgrade task, and sends the upgrade package based on the list of gas devices to be upgraded through the Scada system; receives the upgrade results fed back by each gas device to be upgraded after completing the firmware upgrade, and the Scada system updates the status of the upgrade task to complete the firmware upgrade. There is no need to download the upgrade package through the URL method, and the upgrade package is sent using the file transfer function of the Scada system itself, thereby completing the firmware upgrade. Specifically, it can be implemented as follows.
[0060] In the specific implementation, in this embodiment, the firmware upgrade instruction is sent to each gas device through the Scada system, wherein the SCADA (Supervisory Control and Data Acquisition) system is a collection and monitoring system for the Internet of Things.
[0061] It should be noted that before issuing a firmware upgrade instruction, it is necessary to first detect the operating status of each gas device. Specifically, obtain the status information of each gas device; extract the corresponding status identifier from the status information; compare the status identifier with the status identifier stored in the identifier library. If it is determined through comparison that the gas device is online, the firmware upgrade instruction is issued to the online gas device through the Scada system.
[0062] Each status identifier corresponds to an operating status of a gas device, such as online status, offline status, and fault status. The firmware upgrade in this embodiment is for gas devices that are in an online state. Therefore, the gas devices that are in an online state can be determined by comparing the status identifiers. Finally, the Scada system sends firmware upgrade instructions to these gas devices that are in an online state.
[0063] Step S20: receiving current firmware information fed back by each gas appliance based on the firmware upgrade instruction.
[0064] After receiving the firmware upgrade instruction, each gas device will feedback the current firmware information to the Scada system based on the firmware upgrade instruction. The current firmware information is used to determine the subsequent firmware upgrade to avoid repeated delivery of upgrade packages.
[0065] Step S30: creating an upgrade task, and determining a list of gas devices to be upgraded corresponding to the upgrade task according to the current firmware information.
[0066] After receiving the current firmware information of each gas device, the corresponding upgrade task will be created in this embodiment. The upgrade task corresponds to the corresponding list of gas devices to be upgraded, and the upgrade task is in an unfinished state before the firmware upgrade is completed. The gas devices to be upgraded in each gas device can be determined by the current firmware information of each gas device obtained above. The specific process is to compare the current firmware information with the target firmware information; if the current firmware information is inconsistent with the version of the target firmware information, and the gas device supports the function after the upgrade package is upgraded, then the corresponding gas device is determined to be a gas device to be upgraded, and a corresponding list of gas devices to be upgraded is generated.
[0067] It should be noted that in this embodiment, the determination of whether the gas device is a gas device to be upgraded is divided into two dimensions. The first dimension is based on the version. For example, if the current version of the gas device is lower than the latest version corresponding to the target firmware information, the gas device meets the first condition for upgrading. The second dimension is based on whether the current gas device can support the upgraded function. In actual situations, different models of gas devices lead to differences in the functions of the gas devices. For example, some new gas devices have different hardware structures compared to old gas devices, resulting in different supported functions. Therefore, in this embodiment, in order to ensure that the gas device can use all the upgraded functions normally after upgrading, it is necessary to judge through the second dimension. If the upgraded function can be supported, the gas device meets the second condition for upgrading. When the above-mentioned first condition and second condition are met at the same time, the gas device is determined to be a gas device to be upgraded. According to the judgment of all gas devices, a list of gas devices to be upgraded can be finally formed.
[0068] In addition, for gas equipment that meets the first condition but does not meet the second condition, this embodiment can adopt the method of not upgrading to handle it, or it can adopt the upgrade package of relatively low version to upgrade it. This embodiment does not limit the above specific processing methods and can be selected according to actual conditions.
[0069] Step S40: Determine the firmware upgrade method of each gas device to be upgraded, and select an upgrade package according to the firmware upgrade method. The firmware upgrade method includes a first firmware upgrade method and a second firmware upgrade method. If it is the second firmware upgrade method, select the upgrade package according to the difference between the current firmware of the gas device to be upgraded and the new upgrade firmware.
[0070] After determining the gas equipment to be upgraded, the upgrade package needs to be issued in this embodiment. Before issuing the upgrade package, the firmware upgrade method needs to be determined. The firmware upgrade method in this embodiment includes a first firmware upgrade method and a second firmware upgrade method. Specifically, the first firmware upgrade method is to directly replace the old firmware information in the gas equipment to be upgraded with the new firmware information in the upgrade package. For this firmware upgrade method, the completed upgrade package can be directly issued in this embodiment. The second firmware upgrade method is to update the old firmware information by using the difference between the new firmware information in the upgrade package and the old firmware information in the gas equipment to be upgraded.
[0071] In this embodiment, for the second firmware upgrade method, it is necessary to select an upgrade package based on the difference between the current firmware of the gas equipment to be upgraded and the target firmware. Specifically, the first area and the second area between the current firmware and the new upgraded firmware are identified based on byte changes; the byte difference in the first area is determined, and the byte difference is stored in a difference memory block, and all bytes in the second area are stored as a whole in an additional memory block; the bytes in the current firmware and the byte difference in the first area are added byte by byte, and the bytes of the additional memory block are added to the end of the byte segment after the addition to obtain a first differential package; a second differential package is generated based on the first differential package, and the second differential package is compressed to obtain a target differential package; and a corresponding upgrade package is selected based on the target differential package.
[0072] It should be noted that the first area is a similar area, that is, an area where the current firmware and the new upgraded firmware are similar, for example, there are only small changes in some bytes. The byte difference between the current firmware and the new upgraded firmware can be directly determined based on the first area. The second area is a dissimilar area, that is, an area where there are obvious changes between the current firmware and the new upgraded firmware, for example, there is an offset, increase or decrease of a whole segment of bytes. The first differential packet can be obtained by adding the byte difference byte by byte based on the bytes of the current firmware and adding the bytes in the second area to the end of the byte segment after the addition.
[0073] Furthermore, after obtaining the first differential packet, a second differential packet can be obtained based on the first differential packet, specifically by determining that the zero elimination coding pointer points to the starting position of the difference memory block in the first differential packet; if the starting position is a zero byte, statistical zero elimination coding is performed on the continuous zero byte sequence, and a flag byte is inserted; if the starting position is a non-zero byte, the non-zero byte is shifted back one position, and the above two processes are repeated.
[0074] It should be noted that the process of statistical zero elimination coding is to count the number of consecutive 0 bytes, and the statistical value is the copy length. The copy length is used to replace the consecutive 0 bytes to eliminate redundant bytes. The above method can reduce the amount of differential packet data while retaining key information.
[0075] In order to further improve the efficiency of firmware upgrade, the second differential packet also needs to be compressed again in this embodiment. The specific process is to set two sliding windows of the same size, slide the second differential packet over the two windows in turn, put the processed data in the differential packet into the first window, and put the unprocessed data into the second window, wherein the first window is used as a dictionary; starting from the first string of the second window, the processing is performed in sequence according to the byte order; when processing the current string, the first three bytes of the current string are used to search whether there is a matching string in the dictionary; if there is a matching string, the longest string is determined by matching, and the matching length is used to replace the longest string for output and put it into the dictionary; if there is no matching string, the current character is output and put into the dictionary; the target differential packet is obtained according to the data contained in the dictionary obtained after completing the processing of the second window.
[0076] It should be noted that the process of obtaining the second differential package through the first differential package is actually the first compression, so the compressed data is also the processed data, and the first window can be used as a dictionary. For the unprocessed data in the second window, the above-mentioned dictionary-based duplicate check is performed to find the longest string, and the matching length is used to replace the output of the longest string for the longest string. For the string without a match, the string can be regarded as a short string or a small string, and can be directly output.
[0077] Step S50: starting the upgrade task, and issuing the upgrade package based on the list of gas equipment to be upgraded through the Scada system.
[0078] After the upgrade package is distributed, the upgrade task can be started. When the upgrade package is distributed, in this embodiment, the gas equipment to be upgraded does not need to download the upgrade package via a URL. Instead, the upgrade package is directly distributed to each gas equipment to be upgraded through the file transfer function of the above-mentioned Scada system.
[0079] Step S60: receiving the upgrade results fed back by each gas device to be upgraded after completing the firmware upgrade, and the Scada system updates the status of the upgrade task to complete the firmware upgrade.
[0080] It should be noted that after receiving the upgrade package, each gas device to be upgraded parses the upgrade package, determines the upgrade file start identifier, upgrade package data type and upgrade data based on the parsing result, and performs the upgrade after verifying the above information in sequence. Specifically, each gas device to be upgraded performs a legality check based on the upgrade file start identifier, and when the upgrade file start identifier is a legal start identifier, performs a consistency comparison of the upgrade package data type, and performs a firmware upgrade based on the upgrade data after satisfying the upgrade package data type. By performing a legality check on the upgrade file start identifier, the integrity of the upgrade can be guaranteed, and by performing a consistency comparison on the upgrade package data type, the accuracy of the upgrade package being issued can be guaranteed. Subsequent upgrades can be performed after ensuring the above integrity and accuracy.
[0081] Furthermore, after completing the firmware upgrade, each gas device to be upgraded will provide feedback on the upgrade result, and then the Scada system will update the upgrade task from an unfinished state to a completed update state.
[0082] This embodiment sends firmware upgrade instructions to each gas device through the Scada system, receives the current firmware information fed back by each gas device based on the firmware upgrade instruction; creates an upgrade task, and determines the list of gas devices to be upgraded corresponding to the upgrade task according to the current firmware information; determines the firmware upgrade method of each gas device to be upgraded, and selects an upgrade package according to the firmware upgrade method; starts the upgrade task, and sends the upgrade package based on the list of gas devices to be upgraded through the Scada system; receives the upgrade results fed back by each gas device to be upgraded after completing the firmware upgrade, and the Scada system updates the status of the upgrade task to complete the firmware upgrade. There is no need to download the upgrade package through the URL method, and the upgrade package is sent using the file transfer function of the Scada system itself, thereby completing the firmware upgrade.
[0083] In addition, an embodiment of the present invention further provides a storage medium, on which a gas equipment firmware upgrade program is stored. When the gas equipment firmware upgrade program is executed by a processor, the steps of the gas equipment firmware upgrade method described above are implemented.
[0084] Reference Figure 2 , Figure 2 This is a structural block diagram of the first embodiment of the gas equipment firmware upgrade device of the present invention.
[0085] like Figure 2As shown, the gas equipment firmware upgrade device proposed in the embodiment of the present invention includes:
[0086] The sending module 10 is used to send firmware upgrade instructions to each gas device through the Scada system.
[0087] The receiving module 20 is used to receive the current firmware information fed back by each gas appliance based on the firmware upgrade instruction.
[0088] The creation module 30 is used to create an upgrade task and determine a list of gas devices to be upgraded corresponding to the upgrade task according to the current firmware information.
[0089] The upgrade module 40 is used to determine the firmware upgrade method of each gas device to be upgraded, and select an upgrade package according to the firmware upgrade method. The firmware upgrade method includes a first firmware upgrade method and a second firmware upgrade method. If it is the second firmware upgrade method, the upgrade package is selected according to the difference between the current firmware of the gas device to be upgraded and the new upgrade firmware.
[0090] The upgrade module 40 is used to start the upgrade task and send the upgrade package based on the list of gas equipment to be upgraded through the Scada system.
[0091] The updating module 50 is used to receive the updating results fed back by each gas device to be updated after completing the firmware updating, and the Scada system updates the status of the updating task to complete the firmware updating.
[0092] This embodiment sends firmware upgrade instructions to each gas device through the Scada system, receives the current firmware information fed back by each gas device based on the firmware upgrade instruction; creates an upgrade task, and determines the list of gas devices to be upgraded corresponding to the upgrade task according to the current firmware information; determines the firmware upgrade method of each gas device to be upgraded, and selects an upgrade package according to the firmware upgrade method; starts the upgrade task, and sends the upgrade package based on the list of gas devices to be upgraded through the Scada system; receives the upgrade results fed back by each gas device to be upgraded after completing the firmware upgrade, and the Scada system updates the status of the upgrade task to complete the firmware upgrade. There is no need to download the upgrade package through the URL method, and the upgrade package is sent using the file transfer function of the Scada system itself, thereby completing the firmware upgrade.
[0093] In some embodiments, the sending module 10 is used to obtain status information of each gas device; extract corresponding status identifiers from the status information; compare the status identifiers with the status identifiers stored in the identifier library respectively, and if it is determined through the comparison that the gas device is in an online state, a firmware upgrade instruction is sent to the online gas device through the Scada system.
[0094] In some embodiments, the creation module 30 is used to compare the current firmware information with the target firmware information; if the versions of the current firmware information and the target firmware information are inconsistent, and the gas device supports the functions after the upgrade package is upgraded, the corresponding gas device is determined to be a gas device to be upgraded, and a corresponding list of gas devices to be upgraded is generated.
[0095] In some embodiments, the upgrade module 40 is used to identify the first area and the second area between the current firmware and the new upgraded firmware based on byte changes; determine the byte difference within the first area, store the byte difference in a difference memory block, and store all the bytes in the second area as a whole in an additional memory block; add the bytes in the current firmware and the byte difference in the first area byte by byte, and add the bytes of the additional memory block to the end of the byte segment after the addition to obtain a first differential package; generate a second differential package based on the first differential package, and compress the second differential package to obtain a target differential package; select a corresponding upgrade package based on the target differential package.
[0096] In some embodiments, the upgrade module 40 is used to determine that the zero elimination coding pointer points to the starting position of the difference memory block in the first differential package; if the starting position is a zero byte, statistical zero elimination coding is performed on the continuous zero byte sequence, and a flag byte is inserted; if the starting position is a non-zero byte, the non-zero byte is shifted back one position; return to execute the step of determining that the zero elimination coding pointer points to the starting position of the difference memory block in the first differential package, until all the bytes of the difference memory block are processed to obtain the second differential package.
[0097] In some embodiments, the upgrade module 40 is used to set two sliding windows of the same size, slide the second differential package over the two windows in turn, put the processed data in the differential package into the first window, and put the unprocessed data into the second window, wherein the first window serves as a dictionary; starting from the first string of the second window, processing is performed in sequence in byte order; when processing the current string, the first three bytes of the current string are used to search whether there is a matching string in the dictionary; if there is a matching string, the longest string is determined by matching, and the matching length is used instead of the longest string for output and placed in the dictionary; if there is no matching string, the current character is output and placed in the dictionary; the target differential package is obtained based on the data contained in the dictionary obtained after completing the processing of the second window.
[0098] In some embodiments, the update module 50 is used for each gas device to be upgraded to parse the upgrade package after receiving the upgrade package, and determine the upgrade file start identifier, upgrade package data type and upgrade data based on the parsing result; each gas device to be upgraded performs a legitimacy check based on the upgrade file start identifier, and when the upgrade file start identifier is a legal start identifier, performs a consistency comparison of the upgrade package data type, and after satisfying the upgrade package data type, performs a firmware upgrade according to the upgrade data.
[0099] An embodiment of the present application also provides a gas equipment firmware upgrade device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus, and the memory is used to store the gas equipment firmware upgrade program; the processor is used to implement the above-mentioned gas equipment firmware upgrade method when executing the program stored in the memory.
[0100] The communication bus mentioned in the gas equipment firmware upgrade device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc.
[0101] The communication interface is used for communication between the above-mentioned gas equipment firmware upgrade device and other devices.
[0102] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0103] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components.
[0104] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0105] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0106] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0107] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
[0108] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present invention. In specific applications, technicians in this field can make settings as needed, and the present invention does not limit this.
[0109] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present invention. In practical applications, technicians in this field can select part or all of them according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.
[0110] In addition, for technical details not fully described in this embodiment, reference can be made to the gas equipment firmware upgrade method provided in any embodiment of the present invention, and will not be repeated here.
[0111] In addition, it should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0112] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0113] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory (ROM) / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0114] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
[0115] It is understandable that the system provided by the embodiment of the present invention corresponds to the method provided by the embodiment of the present invention, and the explanation, examples and beneficial effects of the relevant contents can refer to the corresponding parts in the above method.
Claims
1. A method for upgrading gas equipment firmware, characterized in that: The gas equipment firmware upgrade method comprises: Send firmware upgrade instructions to each gas device through the Scada system; Receiving current firmware information fed back by each gas device based on the firmware upgrade instruction; Creating an upgrade task, and determining a list of gas devices to be upgraded corresponding to the upgrade task according to the current firmware information; Determine the firmware upgrade mode of each gas device to be upgraded, and select an upgrade package according to the firmware upgrade mode, wherein the firmware upgrade mode includes a first firmware upgrade mode and a second firmware upgrade mode. If the second firmware upgrade mode is used, select the upgrade package according to the difference between the current firmware of the gas device to be upgraded and the new upgrade firmware; Initiate an upgrade task, and distribute the upgrade package based on the list of gas equipment to be upgraded through the Scada system; The upgrade results fed back by each gas device to be upgraded after completing the firmware upgrade are received, and the Scada system updates the status of the upgrade task to complete the firmware upgrade.
2. The gas equipment firmware upgrade method according to claim 1, characterized in that: The sending of firmware upgrade instructions to each gas device through the Scada system includes: Get the status information of each gas device; Extracting a corresponding status identifier from the status information; The status identifiers are compared with the status identifiers stored in the identifier library respectively. If it is determined through the comparison that the gas device is in an online state, a firmware upgrade instruction is sent to the gas device in the online state through the Scada system.
3. The method for upgrading the gas equipment firmware according to claim 1, characterized in that: The determining, according to the current firmware information, a list of gas equipment to be upgraded corresponding to the upgrade task includes: Comparing the current firmware information with the target firmware information; If the versions of the current firmware information and the target firmware information are inconsistent, and the gas device supports the functions after the upgrade package is upgraded, the corresponding gas device is determined to be a gas device to be upgraded, and a corresponding list of gas devices to be upgraded is generated.
4. The method for upgrading the gas equipment firmware according to claim 1, characterized in that: If the second firmware upgrade method is used, selecting an upgrade package according to the difference between the current firmware of the gas device to be upgraded and the new upgrade firmware includes: identifying a first region and a second region between the current firmware and the new upgraded firmware based on the byte changes; Determine a byte difference within the first region, store the byte difference in a difference memory block, and store all bytes within the second region as a whole in an additional memory block; Adding the bytes in the current firmware and the byte differences in the first area byte by byte, and adding the bytes of the additional memory block to the end of the byte segment after the addition, to obtain a first differential packet; Generate a second differential packet based on the first differential packet, and compress the second differential packet to obtain a target differential packet; A corresponding upgrade package is selected based on the target differential package.
5. The method for upgrading the gas equipment firmware according to claim 4, characterized in that: The generating a second differential packet based on the first differential packet includes: Determine that the zero elimination coding pointer points to the starting position of the difference memory block in the first difference packet; If the starting position is a zero byte, statistical zero elimination encoding is performed on the continuous zero byte sequence, and a flag byte is inserted; If the starting position is a non-zero byte, shift the non-zero byte backward by one position; Return to the step of determining that the zero elimination coding pointer points to the starting position of the difference memory block in the first difference packet until all bytes of the difference memory block are processed to obtain a second difference packet.
6. The method for upgrading the gas equipment firmware according to claim 4, characterized in that: The compressing the second differential packet to obtain a target differential packet includes: Setting two sliding windows of the same size, sliding the second differential packet through the two windows in sequence, putting the processed data in the differential packet into the first window, and putting the unprocessed data into the second window, wherein the first window is used as a dictionary; Starting from the first character string of the second window, the processing is performed in sequence according to the byte order; When processing the current string, the first three bytes of the current string are used to search whether there is a matching string in the dictionary; If there is a matching string, the longest string is determined by matching, the matching length is used to replace the longest string for output, and the string is put into the dictionary; If there is no matching string, the current character is output and placed in the dictionary; A target differential packet is obtained according to the data contained in the dictionary obtained after the processing of the second window is completed.
7. The method for upgrading the gas equipment firmware according to any one of claims 1 to 6, characterized in that: The method further comprises: After receiving the upgrade package, each gas device to be upgraded parses the upgrade package and determines the upgrade file start identifier, upgrade package data type and upgrade data based on the parsing result; Each gas device to be upgraded performs a legitimacy check based on the upgrade file start identifier, and when the upgrade file start identifier is a legal start identifier, performs a consistency comparison of the upgrade package data type, and performs a firmware upgrade according to the upgrade data after the upgrade package data type is met.
8. A gas equipment firmware upgrade device, characterized in that: The gas equipment firmware upgrade device comprises: The issuing module is used to issue firmware upgrade instructions to each gas device through the Scada system; A receiving module, used for receiving current firmware information fed back by each gas device based on the firmware upgrade instruction; A creation module, used to create an upgrade task, and determine a list of gas devices to be upgraded corresponding to the upgrade task according to the current firmware information; An upgrade module, used to determine a firmware upgrade mode for each gas device to be upgraded, and select an upgrade package according to the firmware upgrade mode, wherein the firmware upgrade mode includes a first firmware upgrade mode and a second firmware upgrade mode. If the second firmware upgrade mode is used, the upgrade package is selected according to the difference between the current firmware of the gas device to be upgraded and the new upgrade firmware; The upgrade module is used to start the upgrade task and send the upgrade package based on the list of gas equipment to be upgraded through the Scada system; The update module is used to receive the upgrade results fed back by each gas device to be upgraded after completing the firmware upgrade, and the Scada system updates the status of the upgrade task to complete the firmware upgrade.
9. A gas equipment firmware upgrade device, characterized in that: The gas equipment firmware upgrade device comprises: a memory, a processor and a gas equipment firmware upgrade program stored in the memory and executable on the processor, wherein the gas equipment firmware upgrade program is configured to implement the steps of the gas equipment firmware upgrade method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores a gas equipment firmware upgrade program, and when the gas equipment firmware upgrade program is executed by the processor, the steps of the gas equipment firmware upgrade method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Over-the-air upgrading method and device, electronic equipment and readable storage medium
CN112073994A
Vehicle remote upgrading method and device and server
CN113094073A
System software upgrading method and device, equipment and computer storage medium
CN113900682A
Firmware upgrading method and system, storage medium and equipment
CN113918197A
Communication module remote upgrading method and system
CN114518897A