Gas meter upgrade method, device and electronic equipment
By extracting and dividing the upgrade package, the problem of high resource usage and limited cross-platform in gas meter upgrade is solved, and a flexible upgrade method and reduction of transmission time are achieved.
Patent Information
- Application Number
- CN202210087414.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-25
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2042-01-25
AI Technical Summary
In the existing gas meter upgrade method, resource occupancy is high and cross-platform is limited, resulting in an upgrade package that is too large and takes a long time to transmit. In addition, specific differential algorithms cannot run in embedded systems with limited resources and rely on specific communications. The protocol limits how you can upgrade.
By obtaining the upgrade package and the upgrade protocol of the upgrade initiator, the configuration information is extracted and the upgrade package is divided and sent to the gas meter for upgrade. It realizes the divided transmission and verification of the upgrade package, adapts to different platforms and communication methods, and is compatible with differential and coverage upgrades.
It reduces the size and transmission time of the upgrade package, adapts to different platforms and communication methods, solves the problem of high resource usage and limited cross-platform, and realizes a flexible upgrade method.
Smart Images

Figure CN114500508B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communications, and in particular to a gas meter upgrading method, device and electronic equipment. Background Art
[0002] With the development of the gas industry, smart gas meters account for an increasing proportion in the gas industry, making smart gas meters using embedded chips gradually become the mainstream. There are three main existing upgrade solutions: full coverage upgrade solution, whose main feature is that the new version file completely covers the old version file, the upgrade does not need to rely on the old version file, the upgrade is simple, and no complex algorithm is required, but the disadvantage is that the upgrade package is too large and the transmission time is long; the traditional differential upgrade solution uses a specific differential algorithm to calculate the difference between the new and old version files to obtain an upgrade package, and uses the upgrade package to implement software upgrades. Although this upgrade solution makes the upgrade package smaller, the operation of its specific differential algorithm requires too much memory (RAM) and other resources, and it cannot be run in situations where the resources of embedded systems such as gas meters are too small; the embedded differential upgrade solution uses a differential upgrade method that meets the low resource occupation requirements of embedded systems. This type of upgrade solution meets the low resource occupation requirements of embedded systems, but relies on a specific communication protocol or communication method to interact with the master station for upgrades.
[0003] In the existing technology, the full coverage upgrade solution is the most commonly used upgrade method, but its upgrade package is too large, resulting in a long transmission time during the upgrade. In places with strict power requirements such as gas meters, it is not suitable for long-term operation in the upgrade mode; and the specific differential algorithm used in the traditional differential upgrade solution consumes too much resources and cannot be run in places such as gas meters where the embedded system resources are too small; the embedded differential upgrade solution adopts a differential upgrade method that conforms to the embedded system, but relies on a specific communication protocol or communication method to interact with the main station for upgrade. In the gas meter industry, the main station and the gas meter manufacturer are usually not the same, and most custom protocols cannot be connected to the main station. At the same time, the main platform is divided into interactive upgrades, broadcast upgrades and other methods according to different communication methods. The existing embedded differential upgrade solutions are mostly interactive upgrades, which do not meet the conditions for broadcast upgrades. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a gas meter upgrade method to solve the problems of high resource occupancy and cross-platform limitation when upgrading a gas meter in the prior art.
[0005] In order to achieve the above object, the present invention provides the following technical solutions:
[0006] An embodiment of the present invention provides a gas meter upgrade method, which is applied to a master station platform and is characterized by comprising:
[0007] Obtain the upgrade package and the upgrade agreement from the upgrade initiator;
[0008] Extracting configuration information from the upgrade package and sending the configuration information to the gas meter;
[0009] When the upgrade request is received from the gas meter, the upgrade package is segmented according to the upgrade protocol, and the segmented upgrade package is sent to the gas meter, so that the gas meter is upgraded according to the segmented upgrade package. The upgrade request is generated when the gas meter verifies the current version file of the gas meter according to the configuration information and passes the verification.
[0010] Optionally, the gas meter upgrading method further includes:
[0011] Obtaining a new version file and a current version file of the gas meter;
[0012] Compare the new version file with the current version file to obtain a comparison result;
[0013] Based on the comparison result, extract the same data and the different data between the new version and the current version;
[0014] An upgrade package is generated according to the identical data and the differential data.
[0015] The embodiment of the present invention further provides a gas meter upgrade method, which is applied to a gas meter and includes:
[0016] Receive configuration information of the upgrade package sent by the master platform;
[0017] Verifying the current version file of the gas meter according to the configuration information;
[0018] When the verification is passed, an upgrade request is sent to the main station platform;
[0019] Receiving a plurality of first upgrade packages sent by the master station platform, wherein the first upgrade package is an upgrade package obtained by dividing the upgrade package according to the upgrade protocol of the upgrade initiator when the master station platform receives the upgrade request fed back by the gas meter;
[0020] The current version file is upgraded based on the plurality of first upgrade packages.
[0021] Optionally, the upgrading the current version file based on the plurality of first upgrade packages includes:
[0022] Parsing each first upgrade package to obtain upgrade data;
[0023] Determine the upgrade type by analyzing the data format of the first upgrade package;
[0024] Based on the upgrade data, an upgrade process corresponding to the upgrade type is executed according to the upgrade type.
[0025] Optionally, the upgrade type includes: differential upgrade and overlay upgrade.
[0026] Optionally, the gas meter upgrading method further includes:
[0027] Verifying the version file after executing the upgrade process;
[0028] If the verification passes, the version file after executing the upgrade process will overwrite the current version file.
[0029] The embodiment of the present invention further provides a gas meter upgrade device, which is applied to a master station platform, comprising:
[0030] A first acquisition module, used to acquire an upgrade package and an upgrade agreement of an upgrade initiator;
[0031] An extraction module, used for extracting configuration information from the upgrade package and sending the configuration information to the gas meter;
[0032] The transmission module is used to split the upgrade package according to the upgrade protocol when receiving the upgrade request fed back by the gas meter, and send the split upgrade package to the gas meter so that the gas meter is upgraded according to the split upgrade package. The upgrade request is an upgrade request generated by the gas meter when the gas meter verifies the current version file of the gas meter according to the configuration information and passes the verification.
[0033] The embodiment of the present invention further provides a gas meter upgrading device, which is applied to a gas meter and includes:
[0034] The second acquisition module is used to receive the configuration information of the upgrade package sent by the master station platform;
[0035] A verification module, used to verify the current version file of the gas meter according to the configuration information;
[0036] A request module, used to send an upgrade request to the main station platform when the verification is passed;
[0037] A second receiving module is used to receive a plurality of first upgrade packages sent by the master station platform, wherein the first upgrade package is an upgrade package obtained by dividing the upgrade package according to the upgrade protocol of the upgrade initiator when the master station platform receives the upgrade request fed back by the gas meter;
[0038] An upgrade module is used to upgrade the current version file based on the plurality of first upgrade packages.
[0039] The embodiment of the present invention further provides a gas meter upgrade system, comprising: a gas meter and a master station platform, wherein:
[0040] The master station platform obtains the upgrade package and the upgrade agreement of the upgrade initiator; extracts configuration information from the upgrade package, and sends the configuration information to the gas meter;
[0041] The gas meter receives configuration information of the upgrade package sent by the master station platform; verifies the current version file of the gas meter according to the configuration information; and sends an upgrade request to the master station platform when the verification passes;
[0042] When receiving the upgrade request fed back by the gas meter, the master station platform divides the upgrade package according to the upgrade protocol and sends the divided upgrade package to the gas meter;
[0043] The gas meter receives several first upgrade packages sent by the master station platform, wherein the first upgrade packages are upgrade packages obtained by dividing the upgrade packages according to the upgrade protocol of the upgrade initiator when the master station platform receives the upgrade request fed back by the gas meter; and the current version file is upgraded based on the several first upgrade packages.
[0044] An embodiment of the present invention further provides an electronic device, including:
[0045] A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the gas meter upgrade method provided in the embodiment of the present invention by executing the computer instructions.
[0046] The embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the gas meter upgrading method provided by the embodiment of the present invention.
[0047] The technical solution of the present invention has the following advantages:
[0048] The present invention provides a gas meter upgrade method, which is applied to a main station platform, by obtaining an upgrade package and an upgrade protocol of an upgrade initiator; extracting configuration information from the upgrade package, and sending the configuration information to the gas meter; when receiving an upgrade request fed back by the gas meter, segmenting the upgrade package according to the upgrade protocol, and sending the segmented upgrade package to the gas meter, so that the gas meter is upgraded according to the segmented upgrade package, and the upgrade request is an upgrade request generated when the gas meter verifies the current version file of the gas meter according to the configuration information. The present invention does not rely on the communication protocol with the main station by segmenting and transmitting the upgrade package, and the size of the upgrade package is controllable, making the transmission more convenient without affecting the parsing of the upgrade package; at the same time, the upgrade package is segmented according to the upgrade protocol, and can be upgraded according to the upgrade protocol and requirements of the upgrade initiator, and is not limited to the specified upgrade protocol and platform.
[0049] The present invention also provides a gas meter upgrade method, which is applied to the gas meter, by receiving the configuration information of the upgrade package sent by the main station platform; verifying the current version file of the gas meter according to the configuration information; sending an upgrade request to the main station platform when the verification passes; receiving several first upgrade packages sent by the main station platform, the first upgrade package is the upgrade package after the main station platform divides the upgrade package according to the upgrade protocol when receiving the upgrade request fed back by the gas meter; and upgrading the current version file based on the several first upgrade packages. The present invention can be compatible with different upgrade methods by parsing the divided upgrade package, and solves the problem that the upgrade data packet is too large during the full coverage upgrade, resulting in a long upgrade time. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0051] Figure 1 It is a flow chart of a gas meter upgrade method applied to a master station platform in an embodiment of the present invention;
[0052] Figure 2 A flowchart of generating an upgrade package according to an embodiment of the present invention;
[0053] Figure 3 is a flow chart of a gas meter upgrading method applied to a gas meter according to an embodiment of the present invention;
[0054] Figure 4 A flowchart of upgrading the current version file according to an embodiment of the present invention;
[0055] Figure 5 A flowchart of verifying an upgraded version file according to an embodiment of the present invention;
[0056] Figure 6 It is a structural schematic diagram of a gas meter upgrading device applied to a master station platform in an embodiment of the present invention;
[0057] Figure 7 It is a structural schematic diagram of a gas meter upgrading device applied to a gas meter in an embodiment of the present invention;
[0058] Figure 8 is a structural schematic diagram of a gas meter upgrading system in an embodiment of the present invention;
[0059] Fig. 9 Schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0061] According to an embodiment of the present invention, a gas meter upgrade method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0062] In this embodiment, a gas meter upgrade method is provided, which is applied to a master station platform, such as Figure 1 As shown, the gas meter upgrade method specifically includes the following steps:
[0063] Step S11: Obtain the upgrade package and the upgrade agreement of the upgrade initiator.
[0064] Step S12: extracting configuration information from the upgrade package and sending the configuration information to the gas meter.
[0065] Step S13: When an upgrade request is received from the gas meter, the upgrade package is segmented according to the upgrade protocol, and the segmented upgrade package is sent to the gas meter so that the gas meter is upgraded according to the segmented upgrade package. The upgrade request is generated when the gas meter verifies the current version file of the gas meter according to the configuration information and passes the verification.
[0066] Through the above steps S1 to S3, the gas meter upgrade method provided by the embodiment of the present invention, by segmenting the upgrade package for transmission, does not rely on the communication protocol with the main station, and the size of the upgrade package is controllable, making the transmission more convenient without affecting the parsing of the upgrade package; at the same time, the upgrade package is segmented according to the upgrade protocol, and the upgrade can be performed according to the upgrade protocol and requirements of the upgrade initiator, without being limited to the specified upgrade protocol and platform.
[0067] Specifically, in one embodiment, if Figure 2 As shown, the following steps are also included:
[0068] Step S111: Obtain the new version file and the current version file of the gas meter.
[0069] Step S112: Compare the new version file with the current version file to obtain a comparison result. Specifically, the comparison result can be divided into the following six categories:
[0070] Category 1: The content of the new version file is consistent with the current version file and there is no relative address offset;
[0071] Category 2: The content of the new version file is consistent with the current version file, but the relative address is offset;
[0072] Category 3: The new version file has changed content relative to the current version file and the relative address has no offset;
[0073] Category 4: The new version file has changed content relative to the current version file and the relative address is offset;
[0074] Category 5: New content added to the new version file, and no corresponding data in the current version;
[0075] Category 6: The new version of the file deletes content, and the current version has corresponding data.
[0076] Step S113: Based on the comparison result, extract the same data and the different data between the new version and the current version.
[0077] Specifically, the similarities and differences between the new version file and the current version file are extracted according to the six categories of results listed above, and a differential upgrade package is generated according to the custom differential upgrade file protocol. The differential upgrade file protocol is divided into 4 frame format data domain contents:
[0078] The general format of the differential upgrade file protocol frame format: frame header + instruction code + frame sequence number + data field length + data field;
[0079] 1) First frame - configuration information frame: This frame contains the differential package identifier, the hardware version number on which the new version file and the current version file depend, the old version file number, the old version file length, the old version file checksum, the new version file number, the new version file length, the new version file checksum, the length of the generated differential upgrade package, the generated differential upgrade package checksum, the time of producing the differential upgrade package and the frame checksum, etc. It is used by the receiving end to verify the upgrade qualification and whether the upgrade is successful when parsing the differential upgrade package.
[0080] 2) Relative address non-offset data frame: The content of this frame records the first type of corresponding situations among the six categories listed above, extracts and summarizes the same points between the new version file and the current version file, and records them in this data frame.
[0081] 3) Relative address offset data frame: The content of this frame records the situation corresponding to the second category of the six categories listed above. The same points in the new version file and the current version file but with relative position offset are extracted and summarized and recorded in this frame data.
[0082] 4) Difference data frame: The content of this frame records the situations corresponding to the third, fourth and fifth categories of the six categories listed above, extracts and summarizes the differences between the new version file and the current version file, and records them in this data frame.
[0083] Step S114: Generate an upgrade package based on the same data and the different data.
[0084] Specifically, the format of the differential upgrade package finally generated is: configuration information frame + relative address non-offset data frame n + relative address offset data frame n + difference data frame n.
[0085] In this embodiment, a gas meter upgrade method is provided, which is applied to a gas meter, such as Figure 3 As shown, the gas meter upgrade method specifically includes the following steps:
[0086] Step S21: Receive the configuration information of the upgrade package sent by the master station platform. Specifically, some master station platform protocols do not require the extraction of configuration information, but directly enter the upgrade process. The gas meter can also determine whether the upgrade requirements are met by the directly received upgrade package. Or the configuration information is manually entered, and whether the configuration information is extracted depends on the master station platform. The upgrade package can meet the various upgrade processes adopted by the master station. For example, a broadcast upgrade does not require the gas meter to make any reply to the master station platform, but the gas meter directly receives the upgrade package, and then verifies and upgrades according to the received upgrade package.
[0087] Step S22: Verify the current version file of the gas meter according to the configuration information. Specifically, the configuration information of the upgrade package has some requirements for the old version, such as the hardware version number, software version number, program length, and CRC32 check of the program itself, etc. The parameters and CRC32 values of the current version file must be consistent before the upgrade can be performed.
[0088] Step S23: When the verification is passed, an upgrade request is sent to the main station platform. Specifically, after the verification is passed, it means that if the gas meter meets the requirements of the upgrade package for the upgrade object, an upgrade request is sent to the main station platform to request the main station platform to send the upgrade package.
[0089] Step S24: receiving a plurality of first upgrade packages sent by the master station platform, wherein the first upgrade package is an upgrade package obtained by dividing the upgrade package according to the upgrade protocol of the upgrade initiator when the master station platform receives the upgrade request fed back by the gas meter.
[0090] Step S25: Upgrade the current version file based on several first upgrade packages. Specifically, each manufacturer or each gas meter platform will have a specific protocol, and most upgrade protocols and upgrade rules need to be defined by the manufacturer or the gas meter platform. Since the upgrade processes required by different manufacturers may differ, other differential upgrade solutions need to be connected to their own company's platform and upgraded according to the protocol rules defined by themselves, which cannot meet the requirements of connecting to other manufacturers. However, this example can achieve the purpose of not being restricted by the specified upgrade protocol and platform by receiving the segmented upgrade package, parsing the upgrade package, and then upgrading according to its own protocol and requirements based on the parsed upgrade data.
[0091] Through the above steps S21 to S25, the gas meter upgrade method provided by the embodiment of the present invention can be compatible with different upgrade methods by parsing the segmented upgrade package, thereby solving the problem that the upgrade data packet is too large during full coverage upgrade, resulting in a long upgrade time.
[0092] Specifically, in one embodiment, the above step S25, such as Figure 4 As shown, the specific steps include:
[0093] Step S251: parse each first upgrade package to obtain upgrade data.
[0094] Step S252: Determine the upgrade type by analyzing the data format of the first upgrade package.
[0095] Step S253: Based on the upgrade data, execute the upgrade process corresponding to the upgrade type according to the upgrade type.
[0096] Specifically, since the first upgrade package is obtained by segmenting and transmitting the upgrade package, the RAM requirement in the process of parsing each first upgrade package is relatively low, which can meet the needs of occasions with low RAM such as gas meters.
[0097] Specifically, in one embodiment, the upgrade type includes: differential upgrade and overwrite upgrade. Specifically, by analyzing the data format of the first upgrade package itself (the two upgrade packages have obvious differences in data format, for example, the 4 bytes of the overwrite upgrade package header are not 0, and the differential upgrade package is arranged according to specific rules), it is determined that the upgrade package is a differential upgrade package or an overwrite upgrade package, and then the upgrade type is determined to be a differential upgrade or an overwrite upgrade.
[0098] Specifically, the table side determines the data difference between the upgrade data and the current version file, so as to be compatible with the two upgrade methods without changing the communication protocol and the upgrade process.
[0099] Specifically, in one embodiment, the above-mentioned gas meter upgrade, such as Figure 6 As shown, the following steps are also included:
[0100] Step S261: verify the version file after the upgrade process is executed.
[0101] Step S262: If the verification passes, the version file after the upgrade process is executed will overwrite the current version file.
[0102] Specifically, the first upgrade package is parsed and combined with the current version file to generate a new version of the software for storage. When the final parsing is completed, the new version of the software is verified according to the content of the first frame configuration frame to verify whether the new version of the software is correct. If the version file after the upgrade process is completed is verified, the version file after the upgrade process is completed will overwrite the current version file to complete the upgrade operation.
[0103] The following is an example to illustrate the solution:
[0104] Example 1: Remote upgrade method based on gas platform
[0105] Take the remote upgrade of the gas platform with NB module as an example:
[0106] 1) After the gas meter is connected to the gas platform, data interaction is performed using the gas platform-specific protocol;
[0107] 2) When an upgrade is required, a differential upgrade package is made according to the old and new programs, and the differential package is uploaded to the main station according to the gas platform operation requirements, and a remote upgrade task is set;
[0108] 3) When the gas meter reports data next time, the master station initiates an upgrade request process to the meter end according to the set upgrade task;
[0109] 4) After receiving the upgrade request, the gas meter responds and receives the subsequent upgrade package;
[0110] 5) The gas meter parses the upgrade package file and determines whether the upgrade package type is a differential upgrade or a full coverage upgrade;
[0111] 6) If it is a differential upgrade, the gas meter enters the differential upgrade package analysis process; if it is a full coverage upgrade, jump directly to 8);
[0112] 7) After the differential upgrade package is parsed, the gas meter combines the differential upgrade package with its own program to generate a new version file and verifies the accuracy of the new version file;
[0113] 8) After the new version file is processed, use the new version file to replace the old version file to complete the upgrade process.
[0114] Example 2: Broadcast differential packet upgrade method based on lorawan communication module
[0115] Take the broadcast upgrade using lorawan communication module as an example:
[0116] 1) After the gas meter uses the lorawan communication module, the lorawan broadcast upgrade protocol is used for remote upgrade;
[0117] 2) When an upgrade is required, a differential upgrade package is made according to the new and old programs, and the differential package is uploaded to the broadcast upgrade station according to the lorawan broadcast upgrade protocol operation requirements, and the upgrade station is set to enter the broadcast upgrade;
[0118] 3) When the gas meter detects the lorawan broadcast upgrade signal, the gas meter enters the broadcast upgrade data packet receiving process;
[0119] 4) The gas meter parses the upgrade package file and determines whether the upgrade package type is a differential upgrade or a full coverage upgrade;
[0120] 5) If it is a differential upgrade, the gas meter enters the differential upgrade package analysis process; if it is a full coverage upgrade, jump directly to 7);
[0121] 6) After the differential upgrade package is parsed, the gas meter combines the differential upgrade package with its own program to generate a new version file and verifies the accuracy of the new version file;
[0122] 7) After the new version file is processed, use the new version file to replace the old version file to complete the upgrade process.
[0123] Example 3 Broadcast differential packet upgrade method based on LCFDA communication module
[0124] Take the broadcast upgrade using the LCFDA communication module as an example:
[0125] 1) After the gas meter uses the LCFDA communication module, it uses the LCFDA broadcast upgrade protocol for remote upgrade;
[0126] 2) When an upgrade is required, a differential upgrade package is made according to the old and new programs, and the differential package is uploaded to the broadcast upgrade station according to the LCFDA broadcast upgrade protocol operation requirements, and the upgrade station is set to enter the broadcast upgrade;
[0127] 3) When the gas meter detects the LCFDA broadcast upgrade signal, the gas meter enters the broadcast upgrade data packet receiving process;
[0128] 4) The gas meter parses the upgrade package file and determines whether the upgrade package type is a differential upgrade or a full coverage upgrade;
[0129] 5) If it is a differential upgrade, the gas meter enters the differential upgrade package analysis process; if it is a full coverage upgrade, jump directly to 7);
[0130] 6) After the differential upgrade package is parsed, the gas meter combines the differential upgrade package with its own program to generate a new version file and verifies the accuracy of the new version file;
[0131] 7) After the new version file is processed, use the new version file to replace the old version file to complete the upgrade process.
[0132] In this embodiment, a gas meter upgrade device is also provided, which is used to implement the above embodiments and preferred implementations, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0133] This embodiment provides a gas meter upgrade device, which is applied to a master station platform, such as Figure 7 As shown, including:
[0134] The first acquisition module 101 is used to acquire the upgrade package and the upgrade agreement of the upgrade initiator. For details, please refer to the relevant description of step S11 in the above method embodiment, which will not be repeated here.
[0135] The extraction module 102 is used to extract the configuration information from the upgrade package and send the configuration information to the gas meter. For details, please refer to the relevant description of step S12 in the above method embodiment, which will not be repeated here.
[0136] The transmission module 103 is used to split the upgrade package according to the upgrade protocol when receiving the upgrade request fed back by the gas meter, and send the split upgrade package to the gas meter so that the gas meter can be upgraded according to the split upgrade package. The upgrade request is that the gas meter verifies the current version file of the gas meter according to the configuration information, and generates an upgrade request when the verification passes. For details, please refer to the relevant description of step S13 in the above method embodiment, which will not be repeated here.
[0137] This embodiment provides a gas meter upgrade device, which is applied to a gas meter, such as Figure 8 As shown, including:
[0138] The second acquisition module 201 is used to receive the configuration information of the upgrade package sent by the master station platform. For details, please refer to the relevant description of step S21 in the above method embodiment, which will not be repeated here.
[0139] The verification module 202 is used to verify the current version file of the gas meter according to the configuration information. For details, please refer to the relevant description of step S22 in the above method embodiment, which will not be repeated here.
[0140] The request module 203 is used to send an upgrade request to the main station platform when the verification is passed. For details, please refer to the relevant description of step S23 in the above method embodiment, which will not be repeated here.
[0141] The second receiving module 204 is used to receive several first upgrade packages sent by the main station platform. The first upgrade package is an upgrade package obtained by dividing the upgrade package according to the upgrade protocol of the upgrade initiator when the main station platform receives the upgrade request fed back by the gas meter. For details, please refer to the relevant description of step S24 in the above method embodiment, which will not be repeated here.
[0142] The upgrade module 205 is used to upgrade the current version file based on several first upgrade packages. For details, please refer to the relevant description of step S25 in the above method embodiment, which will not be repeated here.
[0143] The gas meter upgrade device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0144] The further functional description of each of the above modules is the same as that of the above corresponding embodiments and will not be repeated here.
[0145] In this embodiment, a gas meter upgrading system is also provided. The system is used to implement the above-mentioned embodiments and preferred implementation modes, and those that have been explained will not be repeated here.
[0146] This embodiment provides a gas meter upgrade system, including: a gas meter and a master station platform, wherein:
[0147] The master station platform obtains the upgrade package and the upgrade agreement of the upgrade initiator; extracts the configuration information from the upgrade package and sends the configuration information to the gas meter;
[0148] The gas meter receives the configuration information of the upgrade package sent by the master station platform; verifies the current version file of the gas meter according to the configuration information; and sends an upgrade request to the master station platform when the verification passes;
[0149] When the master station platform receives the upgrade request fed back by the gas meter, it divides the upgrade package according to the upgrade protocol and sends the divided upgrade package to the gas meter;
[0150] The gas meter receives several first upgrade packages sent by the master station platform. The first upgrade package is an upgrade package obtained by dividing the upgrade package according to the upgrade protocol of the upgrade initiator when the master station platform receives the upgrade request fed back by the gas meter; the current version file is upgraded based on the several first upgrade packages.
[0151] Specifically, the above-mentioned gas meter upgrade system transmits the upgrade package in segments, does not rely on the communication protocol with the main station, and the size of the upgrade package is controllable, making the transmission more convenient without affecting the parsing of the upgrade package. At the same time, the upgrade package is segmented according to the upgrade protocol, and can be upgraded according to the upgrade protocol and requirements of the upgrade initiator, without being restricted to the specified upgrade protocol and platform. By parsing the segmented upgrade package, it can be compatible with different upgrade methods, which solves the problem of the upgrade data packet being too large during full coverage upgrade, resulting in a long upgrade time.
[0152] According to an embodiment of the present invention, there is also provided an electronic device, such as Fig. 9 As shown, the electronic device may include a processor 901 and a memory 902, wherein the processor 901 and the memory 902 may be connected via a bus or other means. Fig. 9 The example of connecting through bus is taken in the following.
[0153] The processor 901 may be a central processing unit (CPU). The processor 901 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0154] The memory 902 is a non-transitory computer-readable storage medium that can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the methods in the method embodiments of the present invention. The processor 901 executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory 902, that is, implementing the methods in the above method embodiments.
[0155] The memory 902 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created by the processor 901, etc. In addition, the memory 902 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 902 may optionally include a memory remotely arranged relative to the processor 901, and these remote memories may be connected to the processor 901 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0156] One or more modules are stored in the memory 902 , and when executed by the processor 901 , the method in the above method embodiment is executed.
[0157] The specific details of the above electronic device can be understood by referring to the corresponding related descriptions and effects in the above method embodiments, and will not be repeated here.
[0158] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.
[0159] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A gas meter upgrade method, applied to a master station platform, characterized in that: include: Obtain the upgrade package and the upgrade agreement from the upgrade initiator; Extracting configuration information from the upgrade package and sending the configuration information to the gas meter; Upon receiving the upgrade request fed back by the gas meter, the upgrade package is segmented according to the upgrade protocol, and the segmented upgrade package is sent to the gas meter, so that the gas meter is upgraded according to the segmented upgrade package, wherein the upgrade request is generated when the gas meter verifies the current version file of the gas meter according to the configuration information and the verification passes; The method further includes: obtaining a new version file and a current version file of the gas meter; The new version file is compared with the current version file to obtain a comparison result; the comparison results are divided into six categories: the first category: the content of the new version file is consistent with the current version file and the relative address has no offset; the second category: the content of the new version file is consistent with the current version file but the relative address has an offset; the third category: the content of the new version file is changed relative to the current version file and the relative address has no offset; the fourth category: the content of the new version file is changed relative to the current version file and the relative address has an offset; the fifth category: the new version file has new content and the current version has no corresponding data; the sixth category: the new version file has deleted content and the current version has corresponding data; Based on the comparison result, extract the same data and the different data between the new version and the current version; Generate an upgrade package according to the same data and the difference data; the generating of the upgrade package according to the same data and the difference data includes: generating a differential upgrade package according to the same data and the difference data in accordance with a custom differential upgrade file protocol, wherein the differential upgrade file protocol is divided into 4 types of frame format data domain contents, including: first frame-configuration information frame, relative address no offset data frame, relative address offset data frame and difference data frame; Among them, the relative address no-offset data frame content records the first category of corresponding situations among the six categories, the relative address offset data frame content records the second category of corresponding situations among the six categories, and the difference data frame content records the third, fourth, fifth and sixth categories of corresponding situations among the six categories.
2. A gas meter upgrade method, applied to a gas meter, characterized in that: include: Receiving configuration information of an upgrade package sent by a master station platform for executing the gas meter upgrade method according to claim 1; Verifying the current version file of the gas meter according to the configuration information; When the verification is passed, an upgrade request is sent to the main station platform; Receiving a plurality of first upgrade packages sent by the master station platform, wherein the first upgrade package is an upgrade package obtained by dividing the upgrade package according to the upgrade protocol of the upgrade initiator when the master station platform receives the upgrade request fed back by the gas meter; The current version file is upgraded based on the plurality of first upgrade packages.
3. The gas meter upgrading method according to claim 2, characterized in that: The step of upgrading the current version file based on the plurality of first upgrade packages includes: Parsing each first upgrade package to obtain upgrade data; Determine the upgrade type by analyzing the data format of the first upgrade package; Based on the upgrade data, an upgrade process corresponding to the upgrade type is executed according to the upgrade type.
4. The gas meter upgrading method according to claim 3, characterized in that: The upgrade types include: differential upgrade and overlay upgrade.
5. The gas meter upgrading method according to claim 2, characterized in that: Also includes: Verifying the version file after executing the upgrade process; If the verification passes, the version file after executing the upgrade process will overwrite the current version file.
6. A gas meter upgrade device, applied to the master station platform in the gas meter upgrade method according to claim 1, characterized in that: include: A first acquisition module, used to acquire an upgrade package and an upgrade agreement of an upgrade initiator; An extraction module, used for extracting configuration information from the upgrade package and sending the configuration information to the gas meter; a transmission module, configured to, upon receiving an upgrade request fed back by the gas meter, segment the upgrade package according to the upgrade protocol, and send the segmented upgrade package to the gas meter, so that the gas meter is upgraded according to the segmented upgrade package, wherein the upgrade request is generated when the gas meter verifies the current version file of the gas meter according to the configuration information and the verification passes; The device is also used to: obtain a new version file and a current version file of the gas meter; The new version file is compared with the current version file to obtain a comparison result; the comparison result is divided into six categories: the first category: the content of the new version file is consistent with the current version file and the relative address has no offset; the second category: the content of the new version file is consistent with the current version file but the relative address has an offset; Category 3: The new version file has changed its content relative to the current version file and the relative address has no offset; Category 4: The new version file has changed its content relative to the current version file and the relative address has an offset; Category 5: The new version file has added content and the current version has no corresponding data; Category 6: The new version file has deleted content and the current version has corresponding data; Based on the comparison result, extract the same data and the different data between the new version and the current version; Generate an upgrade package according to the same data and the difference data; Generating an upgrade package according to the same data and the difference data includes: generating a differential upgrade package according to the same data and the difference data in accordance with a custom differential upgrade file protocol, wherein the differential upgrade file protocol is divided into four frame format data domain contents, including: a first frame-configuration information frame, a relative address no-offset data frame, a relative address offset data frame, and a difference data frame; Among them, the relative address no-offset data frame content records the first category of corresponding situations among the six categories, the relative address offset data frame content records the second category of corresponding situations among the six categories, and the difference data frame content records the third, fourth, fifth and sixth categories of corresponding situations among the six categories.
7. A gas meter upgrading device, applied to the gas meter in the gas meter upgrading method according to any one of claims 2 to 5, characterized in that: include: The second acquisition module is used to receive the configuration information of the upgrade package sent by the master station platform; A verification module, used to verify the current version file of the gas meter according to the configuration information; A request module, used to send an upgrade request to the main station platform when the verification is passed; A second receiving module is used to receive a plurality of first upgrade packages sent by the master station platform, wherein the first upgrade package is an upgrade package obtained by dividing the upgrade package according to the upgrade protocol of the upgrade initiator when the master station platform receives the upgrade request fed back by the gas meter; An upgrade module is used to upgrade the current version file based on the plurality of first upgrade packages.
8. A gas meter upgrade system, characterized in that: include: The gas meter in the gas meter upgrade method according to any one of claims 2 to 5 and the master station platform in the gas meter upgrade method according to claim 1, wherein: The master station platform obtains the upgrade package and the upgrade agreement of the upgrade initiator; extracts configuration information from the upgrade package, and sends the configuration information to the gas meter; The gas meter receives configuration information of the upgrade package sent by the master station platform; verifies the current version file of the gas meter according to the configuration information; and sends an upgrade request to the master station platform when the verification passes; When receiving the upgrade request fed back by the gas meter, the master station platform divides the upgrade package according to the upgrade protocol and sends the divided upgrade package to the gas meter; The gas meter receives several first upgrade packages sent by the master station platform, wherein the first upgrade packages are upgrade packages obtained by dividing the upgrade packages according to the upgrade protocol of the upgrade initiator when the master station platform receives the upgrade request fed back by the gas meter; and the current version file is upgraded based on the several first upgrade packages.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the gas meter upgrading method according to claim 1 or any one of claims 2-5.
