Firmware upgrade method, system, device, gateway, electronic tag and storage medium
By calculating and dividing the packages to be upgraded, and using the countdown mechanism to synchronize the transmission and reception of target upgrade packages, the problem of low efficiency of electronic tag firmware upgrades is solved, and batch upgrades and time costs are reduced.
Patent Information
- Application Number
- CN202210262648.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-17
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2042-03-17
AI Technical Summary
In the prior art, electronic tag firmware upgrade efficiency is low, resulting in high time cost and difficult to achieve batch upgrade.
By calculating the total number of packets to be upgraded, dividing them into multiple sub-packets, and in the data transmission between the gateway and the electronic tag, the countdown mechanism is used to synchronize the transmission of target upgrade packets to ensure that the electronic tag is received at the same time And upgrade.
The batch firmware upgrade of electronic tags has been realized, which significantly reduces the time cost of firmware upgrades and improves the upgrade efficiency.
Smart Images

Figure CN114610353B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data processing technology, and in particular, relates to a firmware upgrade method, system, device, gateway, electronic tag and storage medium. Background Art
[0002] With the advancement and development of science and technology, the professional and large-scale application of electronic tag technology is developing at a rapid pace. Electronic tags have a large amount of information storage and support identification of tags while in motion, and can even support simultaneous identification of multiple tags. To achieve the above functions of electronic tags, the key lies in the driver inside the electronic tag, that is, the firmware. Under the drive of the firmware, the various hardware components of the electronic tag work together and determine the functions of the electronic tag and the information contained in the electronic tag.
[0003] Electronic tags are also often used in supermarkets, convenience stores, pharmacies and other application places, and are placed on shelves. They are usually called electronic shelf labels. They are an electronic display device that can replace traditional paper price tags. Each electronic shelf label is connected to the mall computer database through a wired or wireless network, and the latest product information can be displayed on the screen of the electronic shelf label by upgrading the firmware of the electronic shelf label, making it easier for people to view the latest product information. Summary of the invention
[0004] The embodiments of the present application provide a firmware upgrade method, system, device, gateway, electronic tag and storage medium, which can reduce the time cost of firmware upgrade and improve the upgrade efficiency of firmware upgrade.
[0005] A first aspect of an embodiment of the present application provides a firmware upgrade method, which is applied to a firmware upgrade system including a gateway and at least one electronic tag, and the firmware upgrade method includes:
[0006] When the total data volume of the upgrade package in the description information of the package to be upgraded is greater than the data volume transmitted per package, the gateway calculates the total number of packages corresponding to the package to be upgraded based on the total data volume of the upgrade package and the data volume transmitted per package; divides the package to be upgraded into N sub-packets, and determines the first sub-packet as the target upgrade package; N is the total number of packages, N is an integer greater than 1, and the first sub-packet refers to a sub-packet in the N sub-packets that is located in the first transmission order; when the total data volume of the upgrade package is less than or equal to the data volume transmitted per package, determines the package to be upgraded as the target upgrade package;
[0007] The gateway transmits the description information of the to-be-upgraded package to the electronic tag M times, and when the transmission time of the target upgrade package is reached, transmits the target upgrade package to the electronic tag based on the number of transmission repetitions of the target upgrade package in the description information, where M is an integer greater than zero;
[0008] When the electronic tag monitors the description information, it receives the target upgrade package at the end of the countdown in the description information; the countdown in the description information is the difference between the transmission time of the target upgrade package and the first transmission time, and the first transmission time is the product of the data transmission time between the gateway and the electronic tag and the number of transmissions to which the description information belongs; and firmware upgrade is performed based on the target upgrade package.
[0009] A second aspect of an embodiment of the present application provides a firmware upgrade method, which is applied to a gateway. The firmware upgrade method includes:
[0010] When the total data volume of the upgrade package in the description information of the package to be upgraded is greater than the data volume transmitted by each package, calculating the total number of packages corresponding to the package to be upgraded based on the total data volume of the package to be upgraded and the data volume transmitted by each package;
[0011] Divide the package to be upgraded into N sub-packets, and determine the first sub-packet as the target upgrade package; N is the total number of packages, N is an integer greater than 1, and the first sub-packet refers to a sub-packet in the N sub-packets that is located in the first transmission order;
[0012] When the total data volume of the upgrade package is less than or equal to the data volume transmitted by each package, determining the package to be upgraded as the target upgrade package;
[0013] Transmit the description information of the package to be upgraded M times to the electronic tag, and when the transmission time of the target upgrade package is reached, transmit the target upgrade package to the electronic tag based on the number of transmission repetitions of the target upgrade package in the description information, M is an integer greater than zero, and the target upgrade package is used to perform firmware upgrade on the electronic tag.
[0014] A third aspect of the embodiments of the present application provides a firmware upgrade method, which is applied to an electronic tag. The firmware upgrade method includes:
[0015] In the case of monitoring the description information of the package to be upgraded transmitted by the gateway, receiving the target upgrade package when the countdown in the description information ends; the countdown in the description information is the difference between the transmission time of the target upgrade package and the first transmission time, the transmission time refers to the time when the gateway sends the target upgrade package, and the first transmission time is the product of the data transmission time between the gateway and the electronic tag and the number of transmissions to which the description information belongs; when the total data volume of the upgrade package in the description information is less than or equal to the data volume transmitted per package, the target upgrade package refers to the package to be upgraded; when the total data volume of the upgrade package is greater than the data volume transmitted per package, the target upgrade package refers to the first sub-packet after the package to be upgraded is divided into N sub-packets, and the first sub-packet refers to the sub-packet in the first transmission order among the N sub-packets, N is the total number of packets, and N is an integer greater than 1;
[0016] The firmware is upgraded based on the target upgrade package.
[0017] A fourth aspect of an embodiment of the present application provides a firmware upgrade system, the firmware upgrade system comprising a gateway and at least one electronic tag, the firmware upgrade system comprising:
[0018] The gateway is used to calculate the total number of packets corresponding to the packet to be upgraded based on the total data amount of the upgrade packet and the data amount transmitted by each packet when the total data amount of the upgrade packet in the description information of the packet to be upgraded is greater than the data amount transmitted by each packet; divide the packet to be upgraded into N sub-packets, and determine that the first sub-packet is the target upgrade packet, N is the total number of packets; N is an integer greater than 1, and the first sub-packet refers to a sub-packet located in the first transmission order among the N sub-packets; when the total data amount of the upgrade packet is less than or equal to the data amount transmitted by each packet, determine that the packet to be upgraded is the target upgrade packet;
[0019] The gateway is configured to transmit the description information of the to-be-upgraded package to the electronic tag M times, and when the transmission time of the target upgrade package is reached, transmit the target upgrade package to the electronic tag based on the number of transmission repetitions of the target upgrade package in the description information, where M is an integer greater than zero;
[0020] The electronic tag is used to receive the target upgrade package when the countdown in the description information ends when the description information is monitored; the countdown in the description information is the difference between the transmission time of the target upgrade package and the first transmission time, and the first transmission time is the product of the data transmission time between the gateway and the electronic tag and the number of transmissions to which the description information belongs; and perform firmware upgrade based on the target upgrade package.
[0021] A fifth aspect of the embodiments of the present application provides a firmware upgrade device, the firmware upgrade device comprising:
[0022] A calculation module, configured to calculate the total number of packets corresponding to the packages to be upgraded based on the total data volume of the packages to be upgraded and the data volume of each packet transmitted when the total data volume of the upgrade packages in the description information of the packages to be upgraded is greater than the data volume transmitted per packet;
[0023] a division module, configured to divide the package to be upgraded into N sub-packets, and determine the first sub-packet as the target upgrade package, where N is the total number of packages, N is an integer greater than 1, and the first sub-packet refers to a sub-packet in the N sub-packets that is located in a first transmission order;
[0024] a target determination module, configured to determine the package to be upgraded as the target upgrade package when the total data volume of the upgrade package is less than or equal to the data volume transmitted by each package;
[0025] A transmitting module is used to transmit the description information of the package to be upgraded M times to the electronic tag, and when the transmission time of the target upgrade package is reached, the target upgrade package is transmitted to the electronic tag based on the number of transmission repetitions of the target upgrade package in the description information, M is an integer greater than zero, and the target upgrade package is used to perform firmware upgrade on the electronic tag.
[0026] A sixth aspect of the embodiments of the present application provides a firmware upgrade device, the firmware upgrade device comprising:
[0027] A receiving module, configured to receive a target upgrade package when a countdown in the description information ends upon monitoring description information of a package to be upgraded transmitted by a gateway; the countdown in the description information is the difference between the transmission time of the target upgrade package and a first transmission time, the transmission time refers to the time when the gateway transmits the target upgrade package, the first transmission time is the product of the data transmission time between the gateway and the electronic tag and the number of transmissions to which the description information belongs; when the total data volume of the upgrade package in the description information is less than or equal to the data volume transmitted per package, the target upgrade package refers to the package to be upgraded; when the total data volume of the upgrade package is greater than the data volume transmitted per package, the target upgrade package refers to the first sub-packet after the package to be upgraded is divided into N sub-packets, the first sub-packet refers to the sub-packet in the N sub-packets that is located in the first transmission order, N is the total number of packages, and N is an integer greater than 1;
[0028] An upgrade module is used to perform firmware upgrade based on the target upgrade package.
[0029] A seventh aspect of an embodiment of the present application provides a gateway, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the firmware upgrade method described in the second aspect when executing the computer program.
[0030] An eighth aspect of an embodiment of the present application provides an electronic tag, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the firmware upgrade method described in the third aspect when executing the computer program.
[0031] A ninth aspect of an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the firmware upgrade method described in the second aspect above, or implements the firmware upgrade method described in the third aspect above.
[0032] The tenth aspect of the embodiments of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes the firmware upgrade method described in the second aspect above, or executes the firmware upgrade method described in the third aspect above.
[0033] Compared with the prior art, the embodiments of the present application have the following beneficial effects: in the embodiments of the present application, when the total data volume of the upgrade package in the description information of the package to be upgraded is greater than the data volume transmitted per package, the gateway first calculates the total number of packages corresponding to the package to be upgraded based on the total data volume of the upgrade package and the data volume transmitted per package, divides the package to be upgraded into N sub-packets, where N is an integer greater than 1, and determines that the first sub-packet is the target upgrade package; when the total data volume of the upgrade package is less than or equal to the data volume transmitted per package, there is no need to divide the sub-packets, and the package to be upgraded can be determined to be the target upgrade package; secondly, the gateway transmits the description information of the package to be upgraded M times to the electronic tag, and when the transmission time of the target upgrade package is reached, the target upgrade package is transmitted to the electronic tag based on the number of transmission repetitions of the target upgrade package in the description information, where M is an integer greater than zero; finally, when the electronic tag monitors the description information, it receives the target upgrade package at the end of the countdown in the description information, and performs firmware upgrade based on the target upgrade package, wherein the countdown in the description information is the difference between the transmission time of the target upgrade package and the first transmission time, and the first transmission time is the product of the data transmission time between the gateway and the electronic tag and the number of transmissions to which the description information belongs. Under the above countdown setting, at least one electronic tag can simultaneously receive the target upgrade package sent by the gateway and perform upgrades based on the target upgrade package at the same time, thereby realizing batch upgrades of at least one electronic tag, reducing the time cost of firmware upgrades, and thus improving the upgrade efficiency of firmware upgrades. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0035] Figure 1 It is a structural diagram of a firmware upgrade system provided in Example 1 of the present application;
[0036] Figure 2 It is a flowchart of a firmware upgrade method provided in Embodiment 2 of the present application;
[0037] Figure 3 It is a data transmission timing diagram of the interaction between the gateway and at least one electronic tag;
[0038] Figure 4 It is a flowchart of a firmware upgrade method provided in Embodiment 3 of the present application;
[0039] Figure 5 It is a flowchart of a firmware upgrade method provided in Embodiment 4 of the present application;
[0040] Figure 6 It is a structural schematic diagram of a firmware upgrade device provided in Embodiment 5 of the present application;
[0041] Figure 7 It is a structural schematic diagram of a firmware upgrade device provided in Embodiment 6 of the present application;
[0042] Figure 8 This is a schematic diagram of the structure of a gateway provided in Embodiment 7 of the present application;
[0043] Fig. 9 This is a schematic diagram of the structure of an electronic tag provided in Example 8 of the present application. DETAILED DESCRIPTION
[0044] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0045] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0046] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0047] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0048] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0049] In order to improve the efficiency of firmware upgrade, the present application proposes a method for firmware upgrade, which can improve the efficiency of firmware upgrade of electronic tags by implementing batch upgrade of at least one electronic tag. The specific implementation is: when the total data volume of the upgrade package in the description information of the package to be upgraded is greater than the data volume transmitted per package, the gateway calculates the total number of packages corresponding to the package to be upgraded based on the total data volume of the upgrade package and the data volume transmitted per package; divides the package to be upgraded into N sub-packets, and determines the first sub-packet as the target upgrade package; and when the total data of the upgrade package is less than or equal to the data volume transmitted per package, there is no need to divide the sub-packets, and the package to be upgraded can be determined as the target upgrade package; secondly, when sending the target upgrade package to the electronic tag, the gateway first transmits the description information of the package to be upgraded M times to the electronic tag, and when the transmission time of the target upgrade package is reached, the target upgrade package is transmitted to the electronic tag based on the number of transmission repetitions of the target upgrade package in the description information; the electronic tag monitors the description information of the package to be upgraded M times sent by the gateway, and when the description information is monitored, receives the target upgrade package when the countdown in the description information ends, and performs firmware upgrade based on the target upgrade package. The firmware upgrade method can be applied to a firmware upgrade system including a gateway and at least one electronic tag. Therefore, under the above-mentioned countdown setting, at least one electronic tag can simultaneously receive the target upgrade package sent by the gateway and simultaneously perform an upgrade based on the target upgrade package. Batch upgrades of at least one electronic tag can be achieved, reducing the time cost of performing firmware upgrades on at least one electronic tag in sequence, thereby improving the upgrade efficiency of the firmware upgrade.
[0050] It should be understood that the size of the serial numbers of the steps in this embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0051] In order to illustrate the technical solution of the present application, specific embodiments are provided below.
[0052] Reference Figure 1 , shows a schematic diagram of the structure of a firmware upgrade system provided in Embodiment 1 of the present application. Figure 1 As shown, the firmware upgrade system includes a gateway and L electronic tags, where L is an integer greater than zero.
[0053] When improving the firmware upgrade efficiency of L electronic tags, data interaction is required between the gateway and the L electronic tags. First, when the total number of upgrade packages in the description information of the package to be upgraded is greater than the amount of data transmitted per package, the gateway can divide the package to be upgraded into N sub-packets to facilitate the transmission of the package to be upgraded. The package to be upgraded can be divided into N sub-packets. First, based on the total amount of data in the upgrade package and the amount of data transmitted per package, the total number of packages corresponding to the package to be upgraded can be calculated. Secondly, based on the total number of packages, the package to be upgraded can be divided into N sub-packets, where N is the total number of packages and N is an integer greater than 1. After the package to be upgraded is divided into N sub-packets, the first sub-packet can be confirmed as the target upgrade package, and the transmission of the target upgrade package can be started, where the first sub-packet refers to the sub-packet in the first transmission order among the N sub-packets. When the total number of upgrade packages is less than or equal to the amount of data transmitted per package, there is no need to divide the sub-packets, and the package to be upgraded can be directly determined as the target upgrade package.
[0054] Secondly, when the gateway sends the target upgrade package to the electronic tag, it can first transmit the description information of the package to be upgraded to the electronic tag M times, and when the transmission time of the target upgrade package is reached, it transmits the target upgrade package to the electronic tag based on the transmission repetition number of the target upgrade package in the description information;
[0055] The electronic tag listens to the description information of the M upgrade packages sent by the gateway. When the description information is listened to, the target upgrade package is received when the countdown in the description information ends. Among them, the number of times the L electronic tags listen to the description information is different, and the corresponding countdown for receiving the target upgrade package is also different. The countdown is the difference between the transmission time of the target upgrade package and the first transmission time. The first transmission time refers to the product of the data transmission time between the gateway and the electronic tag and the number of transmissions to which the description information belongs. The calculation method of the countdown can ensure that the L electronic tags can receive the target upgrade package at the same time and perform firmware upgrades based on the target upgrade package. The L electronic tags can receive the target upgrade package at the same time and upgrade at the same time, which reduces the time cost of the L electronic tags performing firmware upgrades in sequence, thereby improving the upgrade efficiency of the firmware upgrade.
[0056] Among them, when the gateway receives the upgrade instruction and the package to be upgraded sent by the server, it can unpack the package to be upgraded, determine whether the package to be upgraded needs to be divided into N sub-packets according to the total data volume of the upgrade package and the data volume transmitted in each package, and generate description information of the package to be upgraded, and the description information of the package to be upgraded includes the total data volume of the upgrade package, the data volume transmitted in each package, and the countdown corresponding to the number of repeated transmissions of the description information. For example, the countdown corresponding to the first sending of the description information is 14998 milliseconds, and the countdown corresponding to the second sending of the description information is 14996 milliseconds, etc. The countdown is used to indicate that the electronic tag receives the target upgrade package after the countdown ends.
[0057] According to the number of transmissions to which the description information belongs, the countdown in the description information can be determined. For example, if the gateway transmits the description information of the package to be upgraded at a frequency of 2 milliseconds per packet and transmits continuously for 10 seconds, the description information of the package to be upgraded can be transmitted 1000 times. If the target upgrade package is the first sub-packet, the data of the first sub-packet is set to be transmitted for the first time 15 seconds after the gateway transmits the description information of the package to be upgraded. Then, the corresponding countdown in the description information of the package to be upgraded transmitted by the gateway for the first time should be 15000-1×2=14998 milliseconds (i.e., the difference between the transmission time of the target upgrade package and the time consumed for the first transmission); similarly, the corresponding countdown in the description information of the package to be upgraded transmitted by the gateway for the second time should be 15000-2×2=14996 milliseconds; similarly, the corresponding countdown in the description information of the package to be upgraded transmitted by the gateway for the third time should be 15000-3×2=14994 milliseconds; and so on, each time the gateway transmits the description information of the package to be upgraded, the corresponding countdown in the description information is reduced by 2 milliseconds.
[0058] As for the L electronic tags, in order to maintain low power consumption, the electronic tags cannot be in the receiving state for a long time. It is usually set to be in the receiving state for 1.5 milliseconds in every second, but it cannot be guaranteed that the L electronic tags can be in the receiving state at the same time, that is, it cannot be guaranteed that the L electronic tags can receive the target upgrade package at the same time. Therefore, the above countdown calculation method can be used to enable the L electronic tags to receive the target upgrade package. For example, when the gateway first transmits the description information of the package to be upgraded, the electronic tag A listens to the description information, then the electronic tag A can prepare to receive the data of the first sub-packet 14998 milliseconds after listening to the description information; and assuming that the electronic tag B listens to the description information of the package to be upgraded when the gateway transmits the description information of the package to be upgraded for the third time, then the electronic tag can prepare to receive the data of the first sub-packet 14994 milliseconds after listening to the description information; therefore, when the electronic tags A and the electronic tags B start to receive the data of the first sub-packet at the same time, and so on, all the L electronic tags can be guaranteed to start receiving the data of the first sub-packet at the same time.
[0059] It should be understood that if the target upgrade package is a package to be upgraded, the calculation method of the countdown corresponding to the number of transmissions to which its description information belongs is the same as when the above-mentioned target upgrade package is the first sub-package, that is, if the target upgrade package is a package to be upgraded, the calculation method of the countdown corresponding to the number of transmissions to which the above-mentioned description information belongs can also ensure that the L electronic tags can all start receiving data from the package to be upgraded at the same time.
[0060] In a possible implementation manner, when the target upgrade package is the first sub-package, the target upgrade package further includes the transmission time and the number of transmission repetitions of the next sub-package of the target upgrade package, and before performing the firmware upgrade based on the target upgrade package, further includes:
[0061] When the gateway reaches the transmission time of the next sub-packet, it transmits the target upgrade package to the electronic tag based on the number of transmission repetitions of the next sub-packet;
[0062] The electronic tag determines that the upgrade package data in the target upgrade package is the total upgrade package data, receives the next sub-package when the countdown in the target upgrade package ends, and adds the upgrade package data in the next sub-package to the total upgrade package data, and determines that the next sub-package is the target upgrade package; determines whether the target upgrade package contains a countdown, and if the target upgrade package contains a countdown, returns to execute the step of receiving the next sub-package when the countdown in the target upgrade package ends and subsequent steps until the target upgrade package does not contain a countdown;
[0063] Firmware upgrade based on the target upgrade package, including:
[0064] Perform firmware upgrade based on the total upgrade package data.
[0065] In the embodiment of the present application, the number of repeated transmissions of the next sub-packet can be set according to the number of devices with electronic tags to be upgraded, that is, the more the number of devices with electronic tags to be upgraded, the more repeated transmissions of the next sub-packet.
[0066] Exemplarily, the electronic tag first determines that the upgrade package data in the first sub-packet is the total upgrade package data, transmits the first sub-packet according to the number of repeated transmissions of the target upgrade package (the first sub-packet in this case), and calculates the countdown corresponding to the number of repeated transmissions of the second sub-packet in the first sub-packet according to the number of repeated transmissions of the second sub-packet, receives the second sub-packet at the end of the countdown in the first sub-packet, and adds the upgrade package data in the second sub-packet to the total upgrade data packet, determines that the second sub-packet is the target upgrade package, and judges whether the second sub-packet contains the countdown of the third sub-packet. If the second sub-packet contains the countdown of the third sub-packet, then after the countdown in the second sub-packet ends, continues to receive the third sub-packet, adds the upgrade package data in the third sub-packet to the total upgrade data packet, determines that the third sub-packet is the target upgrade package, judges each target upgrade package in turn until the target upgrade package does not contain the countdown, completes the reception, determines the total upgrade package data, and performs firmware upgrade based on the total upgrade package data.
[0067] In a possible implementation manner, the description information of the package to be upgraded further includes a transmission frequency point of the target upgrade package; and the firmware upgrade method further includes:
[0068] The gateway transmits the target upgrade package to the electronic tag at the transmission frequency point of the target upgrade package;
[0069] When the electronic tag monitors the description information, it receives the target upgrade package when the countdown in the description information ends, including:
[0070] When the electronic tag monitors the description information, it jumps to the transmitting frequency point of the target upgrade package to receive the target upgrade package when the countdown of the description information ends.
[0071] In the embodiment of the present application, the transmission frequency point in the description information can enable the electronic tag to jump to the specified frequency point (i.e., the transmission frequency point) to receive the target upgrade package when monitoring the description information, so as to ensure that the electronic tag can accurately receive the target upgrade package.
[0072] The embodiment of the present application uses a countdown corresponding to the number of transmissions to which the description information configured by the gateway belongs, so that after the electronic tag monitors the description information of the package to be upgraded, it can receive the target upgrade package at a specified time according to the countdown and perform an upgrade based on the target upgrade package, thereby realizing batch upgrades of L electronic tags and reducing the time cost of upgrading L electronic tags one by one, thereby improving the upgrade efficiency of the firmware upgrade.
[0073] See also Figure 2 , shows a schematic flow chart of a firmware upgrade method provided in Embodiment 2 of the present application, the firmware upgrade method is applied to Figure 1 The firmware upgrade system shown. Figure 2 As shown, the firmware upgrade method may include the following steps:
[0074] Step 201, when the total data volume of the upgrade package in the description information of the package to be upgraded is greater than the data volume transmitted by each package, the gateway calculates the total number of packages corresponding to the package to be upgraded based on the total data volume of the upgrade package and the data volume transmitted by each package; and divides the package to be upgraded into N sub-packets, and determines that the first sub-packet is the target upgrade package.
[0075] In an embodiment of the present application, in order to reduce the data transmission burden of the system, a certain upper limit needs to be set for the amount of data in the data transmission process between the gateway and the electronic tag. For example, the amount of data transmitted each time cannot exceed 100 bytes. At this time, if the total data volume of the upgrade package in the description information of the package to be upgraded is 500,000 bytes and cannot be transmitted in one time, it is necessary to calculate the total number of packages corresponding to the package to be upgraded based on the total data volume of the upgrade package and the data volume transmitted for each package, that is, the total number of packages is 500,000 / 100=5,000 packages. According to the total number of packages corresponding to the package to be upgraded, the package to be upgraded is divided into 5,000 sub-packets, and the sub-packets in the first transmission order among the 5,000 sub-packets are determined as target upgrade packages.
[0076] Step 202: When the total data volume of the upgrade package is less than or equal to the data volume transmitted in each package, the gateway determines that the package to be upgraded is a target upgrade package.
[0077] In an embodiment of the present application, if the total data volume of the upgrade package is less than or equal to the data volume transmitted in each package, there is no need to further sub-packetize, and the package to be upgraded can be directly determined as the target upgrade package, which can be applied to application scenarios with small amounts of transmitted data, such as batch updating of pictures or batch configuration of electronic tags.
[0078] Step 203, the gateway transmits the description information of the package to be upgraded M times to the electronic tag, and when the transmission time of the target upgrade package is reached, transmits the target upgrade package to the electronic tag based on the transmission repetition number of the target upgrade package in the description information.
[0079] In the embodiments of the present application, M is an integer greater than zero, such as Figure 3 The figure shows the data transmission sequence diagram of the interaction between the gateway and the electronic tag. The gateway first transmits the description information of the upgrade package to the electronic tag M times to ensure that each electronic tag can monitor the description information. At this time, the number of transmission repetitions in the description information is M times. When the transmission time of the target upgrade package is reached, the gateway also transmits the target upgrade package to the electronic tag M times.
[0080] Step 204 , when the electronic tag monitors the description information, it receives the target upgrade package when the countdown in the description information ends, and performs firmware upgrade based on the target upgrade package.
[0081] In the embodiment of the present application, the electronic tag can monitor the description information transmitted by the gateway by setting the network interface to the monitoring mode, and specifically can monitor the description information of the package to be upgraded through wireless monitoring or through a private 2.4G protocol.
[0082] In the embodiment of the present application, the gateway first divides the package to be upgraded into N sub-packets when the total data volume of the upgrade package in the description information of the package to be upgraded is greater than the data volume transmitted per package, and determines that the first sub-packet is the target upgrade package; when the total data volume of the upgrade package is less than or equal to the data volume transmitted per package, the package to be upgraded is determined to be the target upgrade package; secondly, when the gateway reaches the transmission time of the target upgrade package, it transmits the target upgrade package to the electronic tag based on the number of transmission repetitions of the target upgrade package in the description information; finally, when the electronic tag monitors the description information, it receives the target upgrade package at the end of the countdown in the description information, and performs firmware upgrade based on the target upgrade package, wherein the countdown in the description information is the difference between the transmission time of the target upgrade package and the first transmission time, and the first transmission time is the product of the data transmission time between the gateway and the electronic tag and the number of transmissions to which the description information belongs. Under the above countdown setting, at least one electronic tag can simultaneously receive the target upgrade package sent by the gateway, and simultaneously perform upgrade based on the target upgrade package, which can realize batch upgrade of at least one electronic tag, reduce the time cost of firmware upgrade, and thus improve the upgrade efficiency of firmware upgrade.
[0083] See also Figure 4 , shows a schematic flow chart of a firmware upgrade method provided in Embodiment 3 of the present application, the firmware upgrade method is applied to Figure 1 The gateway in the firmware upgrade system shown. Figure 4 As shown, the firmware upgrade method may include the following steps:
[0084] Step 401, when the total data volume of the upgrade packages in the description information of the upgrade packages is greater than the data volume transmitted per package, the total number of packages corresponding to the upgrade packages is calculated based on the total data volume of the upgrade packages and the data volume transmitted per package.
[0085] Step 401 of this embodiment is the same as step 201 of the above embodiment, and they can refer to each other, and will not be described in detail in this embodiment.
[0086] Step 402: divide the package to be upgraded into N sub-packages, and determine the first sub-package as the target upgrade package.
[0087] In an embodiment of the present application, N is an integer greater than 1, the first sub-packet refers to the sub-packet located in the first transmission order among the N sub-packets, the first sub-packet is used as the target upgrade packet, and the gateway first transmits the first sub-packet when the transmission time of the target upgrade packet is reached.
[0088] Step 403: When the total data volume of the upgrade package is less than or equal to the data volume transmitted by each package, determine the package to be upgraded as the target upgrade package.
[0089] Step 404, transmit the description information of the package to be upgraded M times to the electronic tag, and when the transmission time of the target upgrade package is reached, transmit the target upgrade package to the electronic tag based on the transmission repetition number of the target upgrade package in the description information.
[0090] Steps 403 - 404 of this embodiment are the same as steps 202 - 203 of the aforementioned embodiment, and can refer to each other, and will not be described in detail in this embodiment.
[0091] In an embodiment of the present application, the gateway determines the target upgrade package based on the total data volume of the upgrade package and the data volume transmitted by each package, and in order to ensure that all electronic tags can monitor the description information, transmits the description information of the package to be upgraded to the electronic tag M times, and when the transmission time of the target upgrade package is reached, transmits the target upgrade package to the electronic tag M times to ensure that each electronic tag can receive the target upgrade package.
[0092] See also Figure 5 , shows a schematic flow chart of a firmware upgrade method provided in Embodiment 4 of the present application, the firmware upgrade method is applied to Figure 1 The electronic label in the firmware upgrade system is shown. Figure 4 As shown, the firmware upgrade method may include the following steps:
[0093] Step 501: When the description information of the package to be upgraded transmitted by the gateway is monitored, a target upgrade package is received when the countdown in the description information ends.
[0094] In the embodiment of the present application, when the total data volume of the upgrade package is less than or equal to the data volume transmitted per package, the target upgrade package refers to the package to be upgraded, and the package to be upgraded is received at the end of the countdown in the description information, and the countdown in the description information is the difference between the transmission time of the package to be upgraded and the first transmission time, and the first transmission time is the product of the data transmission time between the gateway and the electronic tag and the number of transmissions to which the description information belongs. That is, if the description information of the package to be upgraded monitored by the electronic tag is the description information sent by the gateway for the fifth time, then the countdown for receiving the package to be upgraded corresponding to the description information sent for the fifth time can be obtained in the description information, and the electronic tag should be ready to receive the package to be upgraded before the countdown ends, so as to receive the package to be upgraded at the end of the countdown.
[0095] In the embodiment of the present application, when the total data volume of the upgrade package in the description information is greater than the data volume transmitted per package, the target upgrade package refers to the first sub-packet after the package to be upgraded is divided into N sub-packets, and the first sub-packet is received at the end of the countdown in the description information, and the countdown in the description information is the difference between the transmission time of the first sub-packet and the first transmission time, and the first transmission time is the product of the data transmission time between the gateway and the electronic tag and the number of transmissions to which the description information belongs. That is, if the description information of the first sub-packet monitored by the electronic tag is the description information sent by the gateway for the fifth time, then the countdown for receiving the first sub-packet corresponding to the description information sent for the fifth time can be obtained in the description information, and the electronic tag should be ready to receive the first sub-packet before the countdown ends, so as to receive the first sub-packet at the end of the countdown.
[0096] In a possible implementation, the description information further includes a target firmware version and a target device number. When the description information of the upgrade package transmitted by the gateway is monitored, receiving the target upgrade package at the end of the countdown in the description information includes:
[0097] When the description information is monitored, if the target device number is the same as the device number of the electronic tag, and the target firmware version is different from the firmware version of the electronic tag, the target upgrade package is received when the countdown in the description information ends.
[0098] The embodiments of the present application may be applied to upgrade a portion of all electronic tags that meet the upgrade conditions.
[0099] Among them, the target device number can also be divided into a target major category number and a target subcategory number, and the device number of the electronic tag can also be divided into a major category number and a subcategory number. If the target major category number is the same as the device number of the electronic tag and the target subcategory number is also the same as the subcategory number of the electronic tag, then it is determined that the target device number is the same as the device number of the electronic tag.
[0100] In the embodiment of the present application, the fact that the target firmware version is different from the firmware version of the electronic tag indicates that the current firmware version of the electronic tag is different from the firmware version to be upgraded, and therefore the electronic tag needs to be upgraded.
[0101] Step 502: Perform firmware upgrade based on the target upgrade package.
[0102] In an embodiment of the present application, performing a firmware upgrade based on a target upgrade package may first determine the total upgrade package data in the target upgrade package, and then perform a firmware upgrade based on the total upgrade package data.
[0103] Among them, if the target upgrade package is the package to be upgraded, the total upgrade package data in the target upgrade package may refer to the upgrade package data in the package to be upgraded; if the target upgrade package is the first sub-package, the total upgrade package data in the target upgrade package may refer to the sum of the upgrade package data in N sub-packages.
[0104] In a possible implementation, before performing the firmware upgrade based on the target upgrade package, the firmware upgrade method further includes:
[0105] Verify the target upgrade package data. If the verification result shows that the target upgrade package is the correct upgrade package, perform firmware upgrade based on the target upgrade package. If the verification result shows that the target upgrade package is the wrong upgrade package, report the upgrade failure result and upload the error code.
[0106] In the embodiment of the present application, the description information also includes a first version protocol, a first signature data, and a first current package data volume; the target upgrade package also includes a second version protocol, a second signature data, a second current package data volume, and upgrade package data;
[0107] When the target upgrade package is the package to be upgraded, the data volume of the first current package in the description information refers to the data volume of the package to be upgraded. When the target upgrade package is the first sub-package, the data volume of the first current package in the description information refers to the data volume of the first sub-package allocated by the gateway. The data volume of the second current package refers to the data volume of the package transmitted during the data transmission between the gateway and the electronic tag, which is determined by the gateway allocation.
[0108] Among them, the first version protocol, the first signature data and the first current package data volume can be encapsulated in the header information of the description information, and the second version protocol, the second signature data and the second current package data volume can be encapsulated in the header information of the target upgrade package.
[0109] The verification target upgrade package data may specifically include:
[0110] In the case where the description information is monitored, if the first version protocol is the same as the version protocol of the electronic tag and the first signature data is the same as the signature data of the electronic tag, then it is determined that the description information is legal;
[0111] If the second version protocol is the same as the version protocol of the electronic tag, the second signature data is the same as the signature data of the electronic tag, and the data volume of the second current package is the same as the data volume of the upgrade package data in the target upgrade package, then the target upgrade package is determined to be legal;
[0112] If the index number of the target upgrade package is N when the receiving is completed, it is determined that the first verification result of the target upgrade package is correct;
[0113] If the data volume of the second current package is the same as the data volume of the upgrade package data in the target upgrade package, determining that the second verification result of the target upgrade package is correct;
[0114] If the index number of the target upgrade package meets the preset index number increment requirement, determining that the third verification result of the target upgrade package is correct;
[0115] If the data volume of the total upgrade package data is the same as the total data volume of the upgrade packages in the description information, it is determined that the fourth verification result of the target upgrade package is correct, and the total upgrade package data includes the upgrade package data of all received target upgrade packages;
[0116] When the target upgrade package is a package to be upgraded, if the second verification result and the fourth verification result are both correct, the description information is legal, and the target upgrade package is legal, then the target upgrade package is determined to be a correct upgrade package;
[0117] When the target upgrade package is the first sub-package, if the first verification result, the second verification result, the third verification result, and the fourth verification result are all correct, the description information is legal, and the target upgrade package is legal, then it is determined that the target upgrade package is a correct upgrade package;
[0118] In an embodiment of the present application, when determining the third verification result, an index number increment requirement may be preset in the gateway, and then it may be determined whether the index number of the target upgrade package complies with the preset index number increment requirement. For example, if the preset index number increment requirement in the gateway is to increment by 1, then it may be determined whether the index number of the target upgrade package complies with the preset index number increment requirement by comparing whether the index numbers of adjacent target upgrade packages increment by 1.
[0119] It should be understood that when the target upgrade package is the package to be upgraded, if any of the second verification result and the fourth verification result is incorrect or the description information is illegal or the target upgrade package is illegal, then the target upgrade package is determined to be an incorrect upgrade package; when the target upgrade package is the first sub-package, if any of the first verification result, the second verification result, the third verification result and the fourth verification result is incorrect or the description information is illegal or the target upgrade package is illegal, then the target upgrade package is determined to be an incorrect upgrade package.
[0120] In a possible implementation manner, the description information further includes the number of devices whose electronic tags are to be upgraded, and the firmware upgrade method further includes:
[0121] Obtain the time required to report the firmware upgrade result of the electronic tag and the preset number of times to report the firmware upgrade result;
[0122] Generate a random time, and calculate the reporting time interval based on the number of devices whose electronic tags are to be upgraded, the time required to report the firmware upgrade results of the electronic tags, and the random time;
[0123] Based on the reporting time interval, determine the reporting time of the firmware upgrade result;
[0124] According to the reporting time, the firmware upgrade result is reported, and the step of generating a random time and subsequent steps are returned to execute until the number of times the firmware upgrade result is reported is equal to the preset number.
[0125] For example, if the number of devices with electronic tags to be upgraded is 1000, and the time required to report the firmware upgrade result of the electronic tag is 1 millisecond, then the reporting time interval is 1000×1+rand(1~1000), where rand(1~1000) is a random number selected from 1 to 1000. The time when the upgrade ends is determined based on the reporting time interval and the electronic tag, and the reporting time of the firmware upgrade result is determined. After the firmware upgrade result is reported for the first time based on the reporting time, the time interval is calculated again based on the above method for calculating the time interval. After the time interval has passed, the firmware upgrade result is reported again until the number of times the firmware upgrade result is reported is equal to the preset number. Since conflicts are likely to occur when at least one electronic tag reports the firmware upgrade result at the same time, a method of multiple reporting based on the reporting time interval can be selected to ensure that each electronic tag can successfully report the firmware upgrade result.
[0126] In the embodiment of the present application, when the electronic tag monitors the description information, it receives the target upgrade package at the end of the countdown in the description information, and performs a firmware upgrade based on the target upgrade package, wherein the countdown in the description information is the difference between the transmission time of the target upgrade package and the first transmission time, and the first transmission time is the product of the data transmission time between the gateway and the electronic tag and the number of transmissions to which the description information belongs. Under the above countdown setting, at least one electronic tag can simultaneously receive the target upgrade package sent by the gateway and simultaneously perform an upgrade based on the target upgrade package, which can realize batch upgrades of at least one electronic tag, reduce the time cost of firmware upgrades, and thus improve the upgrade efficiency of firmware upgrades.
[0127] See also Figure 6 , shows a schematic diagram of the structure of a firmware upgrade device provided in Example 5 of the present application. For the sake of convenience of explanation, only the parts related to the embodiment of the present application are shown.
[0128] The firmware upgrade device may specifically include the following modules:
[0129] A calculation module 601 is used to calculate the total number of packages corresponding to the packages to be upgraded based on the total data volume of the packages to be upgraded and the data volume of each package transmitted when the total data volume of the upgrade packages in the description information of the packages to be upgraded is greater than the data volume transmitted per package;
[0130] A division module 602 is used to divide the package to be upgraded into N sub-packets, and determine the first sub-packet as the target upgrade package, where N is the total number of packages, N is an integer greater than 1, and the first sub-packet refers to the sub-packet in the first transmission order among the N sub-packets;
[0131] A target determination module 603, configured to determine the package to be upgraded as a target upgrade package when the total data volume of the upgrade package is less than or equal to the data volume transmitted per package;
[0132] The transmitting module 604 is used to transmit the description information of the package to be upgraded M times to the electronic tag, and when the transmission time of the target upgrade package is reached, the target upgrade package is transmitted to the electronic tag based on the number of transmission repetitions of the target upgrade package in the description information, M is an integer greater than zero, and the target upgrade package is used to perform firmware upgrade on the electronic tag.
[0133] The firmware upgrade device provided in the embodiment of the present application can be applied in the aforementioned method embodiment 3. For details, please refer to the description of the aforementioned method embodiment 3, which will not be repeated here.
[0134] See also Figure 7 , shows a schematic diagram of the structure of a firmware upgrade device provided in Example 6 of the present application. For the sake of convenience, only the parts related to the embodiment of the present application are shown.
[0135] The firmware upgrade device may specifically include the following modules:
[0136] The receiving module 701 is used to receive the target upgrade package when the countdown in the description information ends after monitoring the description information of the package to be upgraded transmitted by the gateway; the countdown in the description information is the difference between the transmission time of the target upgrade package and the first transmission time, the transmission time refers to the time when the gateway transmits the target upgrade package, and the first transmission time is the product of the data transmission time between the gateway and the electronic tag and the number of transmission times to which the description information belongs; when the total data volume of the upgrade package in the description information is less than or equal to the data volume transmitted per package, the target upgrade package refers to the package to be upgraded; when the total data volume of the upgrade package is greater than the data volume transmitted per package, the target upgrade package refers to the first sub-packet after the package to be upgraded is divided into N sub-packets, and the first sub-packet refers to the sub-packet in the first transmission order among the N sub-packets, where N is the total number of packets and N is an integer greater than 1;
[0137] The upgrade module 702 is used to perform firmware upgrade based on the target upgrade package.
[0138] In the embodiment of the present application, the receiving module 701 may specifically include the following submodules:
[0139] The upgrade judgment submodule is used to receive the target upgrade package when the countdown in the description information ends, if the target device number is the same as the device number of the electronic tag, and the target firmware version is different from the firmware version of the electronic tag, when the description information is monitored.
[0140] In the embodiment of the present application, the firmware upgrade device may further include the following modules:
[0141] A time acquisition module, used to acquire the time required to report the firmware upgrade result of the electronic tag and the preset number of times to report the firmware upgrade result;
[0142] A generating module, used to generate a random time, and calculate a reporting time interval based on the number of devices whose electronic tags are to be upgraded, the time required to report the firmware upgrade results of the electronic tags, and the random time;
[0143] A reporting time determination module, used to determine the reporting time of the firmware upgrade result based on the reporting time interval;
[0144] The loop module is used to report the firmware upgrade result according to the reporting time, and return to execute the step of generating random time and subsequent steps until the number of times the firmware upgrade result is reported is equal to the preset number.
[0145] In the embodiment of the present application, the firmware upgrade device may further include the following modules:
[0146] A first legality judgment module is used to determine that the description information is legal if the first version protocol is the same as the version protocol of the electronic tag and the first signature data is the same as the signature data of the electronic tag when the description information is monitored;
[0147] A second legal judgment module, configured to determine that the target upgrade package is legal if the second version protocol is the same as the version protocol of the electronic tag, the second signature data is the same as the signature data of the electronic tag, and the data volume of the second current package is the same as the data volume of the upgrade package data in the target upgrade package;
[0148] A first verification module, configured to determine that a first verification result of the target upgrade package is correct if the index number of the target upgrade package is N at the end of receiving;
[0149] A second verification module, configured to determine that a second verification result of the target upgrade package is correct if the data volume of the second current package is the same as the data volume of the upgrade package data in the target upgrade package;
[0150] A third verification module, configured to determine that a third verification result of the target upgrade package is correct if the index number of the target upgrade package meets a preset index number increment requirement;
[0151] a fourth verification module, configured to determine that a fourth verification result of the target upgrade package is correct if the data volume of the total upgrade package data is the same as the total data volume of the upgrade packages in the description information, and the total upgrade package data includes the upgrade package data of all received target upgrade packages;
[0152] A first upgrade judgment module is used to determine that the target upgrade package is a correct upgrade package if the second verification result and the fourth verification result are both correct, the description information is legal, and the target upgrade package is legal when the target upgrade package is a package to be upgraded;
[0153] A second upgrade judgment module is used to determine that the target upgrade package is a correct upgrade package if the first verification result, the second verification result, the third verification result and the fourth verification result are all correct, the description information is legal, and the target upgrade package is legal when the target upgrade package is the first sub-package;
[0154] Correspondingly, the upgrade module 702 may further include the following submodules:
[0155] The target upgrade submodule is used to perform firmware upgrade based on the target upgrade package if the target upgrade package is a correct upgrade package.
[0156] The firmware upgrade device provided in the embodiment of the present application can be applied in the aforementioned method embodiment 4. For details, please refer to the description of the aforementioned method embodiment 4, which will not be repeated here.
[0157] Figure 8 This is a schematic diagram of the structure of the gateway provided in Example 7 of this application. Figure 8 As shown, the gateway 800 of this embodiment includes: at least one processor 810 ( Figure 8 Only one is shown in the figure) a processor, a memory 820, and a computer program 821 stored in the memory 820 and executable on the at least one processor 810, and when the processor 810 executes the computer program 821, the steps in the third embodiment of the above-mentioned firmware upgrade method are implemented.
[0158] The gateway 800 may be a computer device such as an internetwork connector or a protocol converter for realizing network interconnection. The gateway may include, but is not limited to, a processor 810 and a memory 820. Those skilled in the art will appreciate that Figure 8 This is only an example of the gateway 800 and does not constitute a limitation on the gateway 800 . The gateway 800 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0159] The processor 810 may be a central processing unit (CPU), or 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, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0160] In some embodiments, the memory 820 may be an internal storage unit of the terminal device 800, such as a hard disk or memory of the gateway 800. In other embodiments, the memory 820 may also be an external storage device of the gateway 800, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the gateway 800. Further, the memory 820 may also include both an internal storage unit of the gateway 800 and an external storage device. The memory 820 is used to store an operating system, an application program, a boot loader (Boot Loader), data, and other programs, such as the program code of the computer program, etc. The memory 820 may also be used to temporarily store data that has been output or is to be output.
[0161] Fig. 9 Schematic diagram of the structure of the electronic tag provided in Example 8 of the present application. Fig. 9 As shown, the electronic tag 900 of this embodiment includes: at least one processor 910 ( Fig. 9 Only one is shown in the figure) a processor, a memory 920, and a computer program 921 stored in the memory 920 and executable on the at least one processor 910, and when the processor 910 executes the computer program 921, the steps in the fourth embodiment of the above-mentioned firmware upgrade method are implemented.
[0162] The electronic tag 900 may be a data carrier such as a radio frequency tag on an electronic shelf. The electronic tag may include, but is not limited to, a processor 910 and a memory 920. Those skilled in the art will appreciate that Fig. 9 This is only an example of the electronic tag 900 and does not constitute a limitation on the electronic tag 900 . The electronic tag 900 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0163] The processor 910 may be a central processing unit (CPU), or 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, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0164] In some embodiments, the memory 920 may be an internal storage unit of the electronic tag 900, such as a hard disk or memory of the electronic tag 900. In other embodiments, the memory 920 may also be an external storage device of the electronic tag 900, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic tag 900. Further, the memory 920 may also include both the internal storage unit of the electronic tag 900 and an external storage device. The memory 920 is used to store an operating system, an application program, a boot loader (Boot Loader), data and other programs, such as the program code of the computer program, etc. The memory 920 may also be used to temporarily store data that has been output or is to be output.
[0165] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0166] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application is described in detail with reference to the above-mentioned embodiments, a person skilled in the art should understand that the technical solutions described in the above-mentioned embodiments can still be modified, or some of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A firmware upgrade method, characterized in that: Applicable to a firmware upgrade system including a gateway and at least one electronic tag; The firmware upgrade method comprises: When the total data volume of the upgrade package in the description information of the package to be upgraded is greater than the data volume transmitted per package, the gateway calculates the total number of packages corresponding to the package to be upgraded based on the total data volume of the upgrade package and the data volume transmitted per package; divides the package to be upgraded into N sub-packets, and determines the first sub-packet as the target upgrade package; N is the total number of packages, N is an integer greater than 1, and the first sub-packet refers to a sub-packet in the N sub-packets that is located in the first transmission order; when the total data volume of the upgrade package is less than or equal to the data volume transmitted per package, determines the package to be upgraded as the target upgrade package; The gateway transmits the description information of the to-be-upgraded package to the electronic tag M times, and when the transmission time of the target upgrade package is reached, transmits the target upgrade package to the electronic tag based on the number of transmission repetitions of the target upgrade package in the description information, where M is an integer greater than zero; When the electronic tag monitors the description information, it receives the target upgrade package at the end of the countdown in the description information; the countdown in the description information is the difference between the transmission time of the target upgrade package and the first transmission time, and the first transmission time is the product of the data transmission time between the gateway and the electronic tag and the number of transmissions to which the description information belongs; and firmware upgrade is performed based on the target upgrade package.
2. The firmware upgrade method according to claim 1, wherein: When the target upgrade package is the first sub-package, the target upgrade package further includes the transmission time and the number of transmission repetitions of the next sub-package of the target upgrade package; Before performing a firmware upgrade based on the target upgrade package, the method further includes: When the transmission time of the next sub-packet is reached, the gateway transmits the target upgrade package to the electronic tag based on the number of transmission repetitions of the next sub-packet; The electronic tag determines that the upgrade package data in the target upgrade package is the total upgrade package data, receives the next sub-package when the countdown in the target upgrade package ends, and adds the upgrade package data in the next sub-package to the total upgrade package data, and determines that the next sub-package is the target upgrade package; determines whether the target upgrade package contains a countdown, and if the target upgrade package contains a countdown, returns to execute the step of receiving the next sub-package when the countdown in the target upgrade package ends and subsequent steps, until the target upgrade package does not contain a countdown; Performing a firmware upgrade based on the target upgrade package includes: The firmware is upgraded based on the total upgrade package data.
3. The firmware upgrade method according to claim 1, wherein: The description information also includes the transmission frequency of the target upgrade package; The firmware upgrade method further includes: The gateway transmits the target upgrade package to the electronic tag at the transmission frequency point of the target upgrade package; When the electronic tag monitors the description information, receiving the target upgrade package when the countdown in the description information ends includes: When the electronic tag monitors the description information, it jumps to the transmission frequency point of the target upgrade package to receive the target upgrade package when the countdown of the description information ends.
4. The firmware upgrade method according to claim 1, wherein: The description information also includes a target firmware version and a target device number. When the electronic tag monitors the description information, receiving the target upgrade package at the end of the countdown in the description information includes: When the electronic tag monitors the description information, if the target device number is the same as the device number of the electronic tag, and the target firmware version is different from the firmware version of the electronic tag, the electronic tag receives the target upgrade package when the countdown in the description information ends.
5. The firmware upgrade method according to claim 1, wherein: The description information also includes the number of devices whose electronic tags are to be upgraded, and the firmware upgrade method also includes: The electronic tag obtains the time required for reporting the firmware upgrade result of the electronic tag and the preset number of times for reporting the firmware upgrade result; The electronic tag generates a random time, and calculates a reporting time interval based on the number of devices of the electronic tag to be upgraded, the time required to report the firmware upgrade result of the electronic tag, and the random time; The electronic tag determines the reporting time of the firmware upgrade result based on the reporting time interval; The electronic tag reports the firmware upgrade result according to the reporting time, and returns to execute the step of generating a random time and subsequent steps until the number of times the firmware upgrade result is reported is equal to the preset number.
6. The firmware upgrade method according to claim 1, wherein: The description information also includes a first version protocol, first signature data, and a first current package data volume, the target upgrade package also includes a second version protocol, second signature data, a second current package data volume, and upgrade package data, and before performing a firmware upgrade based on the target upgrade package, it also includes: When the electronic tag monitors the description information, if the first version protocol is the same as the version protocol of the electronic tag and the first signature data is the same as the signature data of the electronic tag, then determining that the description information is legal; If the second version protocol is the same as the version protocol of the electronic label, the second signature data is the same as the signature data of the electronic label, and the data volume of the second current package is the same as the data volume of the upgrade package data in the target upgrade package, the electronic label determines that the target upgrade package is legal; If the index number of the target upgrade package is N when the electronic tag receives the target upgrade package, the electronic tag determines that the first verification result of the target upgrade package is correct; If the data volume of the second current package is the same as the data volume of the upgrade package data in the target upgrade package, the electronic tag determines that the second verification result of the target upgrade package is correct; If the index number of the target upgrade package meets the preset index number increment requirement, the electronic tag determines that the third verification result of the target upgrade package is correct; If the data volume of the total upgrade package data is the same as the total data volume of the upgrade packages in the description information, the electronic tag determines that the fourth verification result of the target upgrade package is correct, and the total upgrade package data includes the upgrade package data of all received target upgrade packages; When the target upgrade package is a package to be upgraded, if the second verification result and the fourth verification result are both correct, the description information is legal, and the target upgrade package is legal, then the electronic tag determines that the target upgrade package is a correct upgrade package; When the target upgrade package is the first sub-package, if the first verification result, the second verification result, the third verification result, and the fourth verification result are all correct, the description information is legal, and the target upgrade package is legal, then the electronic tag determines that the target upgrade package is a correct upgrade package; Performing a firmware upgrade based on the target upgrade package includes: If the target upgrade package is a correct upgrade package, the electronic tag performs a firmware upgrade based on the target upgrade package.
7. A firmware upgrade system, characterized in that: The firmware upgrade system includes a gateway and at least one electronic tag, and the firmware upgrade system includes: The gateway is used to calculate the total number of packets corresponding to the packet to be upgraded based on the total data amount of the upgrade packet and the data amount transmitted by each packet when the total data amount of the upgrade packet in the description information of the packet to be upgraded is greater than the data amount transmitted by each packet; divide the packet to be upgraded into N sub-packets, and determine that the first sub-packet is the target upgrade packet, N is the total number of packets; N is an integer greater than 1, and the first sub-packet refers to a sub-packet located in the first transmission order among the N sub-packets; when the total data amount of the upgrade packet is less than or equal to the data amount transmitted by each packet, determine that the packet to be upgraded is the target upgrade packet; The gateway is configured to transmit the description information of the to-be-upgraded package to the electronic tag M times, and when the transmission time of the target upgrade package is reached, transmit the target upgrade package to the electronic tag based on the number of transmission repetitions of the target upgrade package in the description information, where M is an integer greater than zero; The electronic tag is used to receive the target upgrade package when the countdown in the description information ends when the description information is monitored; the countdown in the description information is the difference between the transmission time of the target upgrade package and the first transmission time, and the first transmission time is the product of the data transmission time between the gateway and the electronic tag and the number of transmissions to which the description information belongs; and perform firmware upgrade based on the target upgrade package.
8. A gateway, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
9. An electronic tag, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
