CN114610353A - Firmware upgrading method, system, device, gateway, electronic tag and storage medium - Google Patents

Firmware upgrading method, system, device, gateway, electronic tag and storage medium Download PDF

Info

Publication number
CN114610353A
CN114610353A CN202210262648.0A CN202210262648A CN114610353A CN 114610353 A CN114610353 A CN 114610353A CN 202210262648 A CN202210262648 A CN 202210262648A CN 114610353 A CN114610353 A CN 114610353A
Authority
CN
China
Prior art keywords
packet
package
target
upgrading
description information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210262648.0A
Other languages
Chinese (zh)
Inventor
庄严
郭己
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Minew Technologies Co ltd
Original Assignee
Shenzhen Minew Technologies Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Minew Technologies Co ltd filed Critical Shenzhen Minew Technologies Co ltd
Priority to CN202210262648.0A priority Critical patent/CN114610353A/en
Publication of CN114610353A publication Critical patent/CN114610353A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application is applicable to the technical field of data processing, and provides a firmware upgrading method, a system, a device, a gateway, an electronic tag and a storage medium, wherein the firmware upgrading method comprises the following steps: when the total data volume of the upgrading packet in the description information of the packet to be upgraded is larger than the data volume transmitted by each packet, the gateway divides the packet to be upgraded into N sub-packets, and determines a first sub-packet as a target upgrading packet; 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 a target upgrade package; the gateway transmits the description information of the package to be upgraded for M times to the electronic tag, and transmits the target upgrade package to the electronic tag based on the transmission repetition times of the target upgrade package in the description information when the transmission time of the target upgrade package is reached; under the condition that the electronic tag monitors the description information, receiving a target upgrade package when countdown in the description information is finished; and performing firmware upgrade based on the target upgrade package. The scheme can improve the efficiency of firmware upgrading.

Description

Firmware upgrading method, system, device, gateway, electronic tag and storage medium
Technical Field
The present application belongs to the field of data processing technologies, and in particular, to a firmware upgrading method, system, device, gateway, electronic tag, and storage medium.
Background
With the progress and development of science and technology, specialized and large-scale application of the electronic tag technology is developing at a fast speed, the electronic tag has a large information storage capacity, and supports the tag to be identified in a mobile state, even multiple tags to be identified simultaneously, and the key to realize the above functions of the electronic tag is that a driver, i.e. firmware, inside the electronic tag is driven by the firmware, and all hardware components of the electronic tag work cooperatively and determine the functions of the electronic tag and the information contained in the electronic tag.
Electronic tags are also often applied to application places such as supermarkets, convenience stores, pharmacies and the like, are usually called electronic shelf tags and are electronic display devices capable of replacing traditional paper price tags, each electronic shelf tag is connected with a computer database of a shopping mall through a wired or wireless network, and the latest commodity information can be displayed through the screen display of the electronic shelf notes by upgrading the firmware of the electronic shelf tag, so that people can conveniently view the latest commodity information.
Disclosure of Invention
The embodiment of the application provides a firmware upgrading method, a system, a device, a gateway, an electronic tag and a storage medium, which can reduce the time cost of firmware upgrading so as to improve the upgrading efficiency of the firmware upgrading.
A first aspect of an embodiment of the present application provides a firmware upgrading method, which is applied to a firmware upgrading system including a gateway and at least one electronic tag, and the firmware upgrading method includes:
when the total data volume of the upgrading packet in the description information of the packet to be upgraded is larger than the data volume transmitted by each packet, the gateway calculates the total packet number corresponding to the packet to be upgraded based on the total data volume of the upgrading packet and the data volume transmitted by each packet; dividing the packet to be upgraded into N sub-packets, and determining a first sub-packet as a target upgrade packet; n is the total number of the sub-packets, N is an integer greater than 1, and the first sub-packet is a sub-packet in a first transmission sequence in the N sub-packets; when the total data volume of the upgrade package is less than or equal to the data volume transmitted by each package, determining that the package to be upgraded is the target upgrade package;
the gateway transmits description information of a package to be upgraded for M times to the electronic tag, and transmits the target upgrade package to the electronic tag based on the transmission repetition times of the target upgrade package in the description information when the transmission time of the target upgrade package is reached, wherein M is an integer greater than zero;
under the condition that the electronic tag monitors the description information, receiving the target upgrade package when the countdown in the description information is finished; the countdown in the description information is a difference value between the transmission time of the target upgrade package and first transmission time, wherein the first transmission time is a product of data transmission time between the gateway and the electronic tag and the transmission times of the description information; and upgrading the firmware based on the target upgrading package.
A second aspect of the embodiments of the present application provides a firmware upgrading method, which is applied to a gateway, and the firmware upgrading method includes:
when the total data volume of the upgrading package in the description information of the package to be upgraded is larger than the data volume transmitted by each package, calculating the total package number 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;
dividing the packet to be upgraded into N sub-packets, and determining a first sub-packet as a target upgrade packet; n is the total number of the sub-packets, N is an integer greater than 1, and the first sub-packet is a sub-packet in a first transmission sequence in the N sub-packets;
when the total data volume of the upgrade package is less than or equal to the data volume transmitted by each package, determining that the package to be upgraded is the target upgrade package;
transmitting description information of a package to be upgraded M times to an electronic tag, and transmitting the target upgrade package to the electronic tag based on the transmission repetition times of the target upgrade package in the description information when the transmission time of the target upgrade package is reached, wherein M is an integer larger than zero, and the target upgrade package is used for upgrading the firmware of the electronic tag.
A third aspect of the embodiments of the present application provides a firmware upgrading method, which is applied to an electronic tag, and the firmware upgrading method includes:
under the condition that the description information of a packet to be upgraded transmitted by a gateway is monitored, receiving a target upgrade packet when the countdown in the description information is finished; the countdown in the description information is a difference value between the transmission time of the target upgrade package and first transmission time consumption, wherein the transmission time is the time for the gateway to transmit the target upgrade package, and the first transmission time consumption is the product of the data transmission time between the gateway and the electronic tag and the transmission times of the description information; when the total data volume of the upgrade package in the description information is less than or equal to the data volume transmitted by each package, the target upgrade package refers to the package to be upgraded; when the total data volume of the upgrading packet is larger than the data volume transmitted by each packet, the target upgrading packet is a first sub-packet obtained by dividing the packet to be upgraded into N sub-packets, the first sub-packet is a sub-packet in a first transmission sequence in the N sub-packets, N is the total packet number, and N is an integer larger than 1;
and upgrading the firmware based on the target upgrading packet.
A fourth aspect of an embodiment of the present application provides a firmware upgrade system, where the firmware upgrade system includes a gateway and at least one electronic tag, and the firmware upgrade system includes:
the gateway is used for calculating the total package number 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 when the total data volume of the upgrade package in the description information of the package to be upgraded is larger than the data volume transmitted by each package; dividing the packet to be upgraded into N sub-packets, and determining a first sub-packet as a target upgrade packet, wherein N is the total number of the packets; n is an integer greater than 1, and the first sub-packet refers to a sub-packet in a first transmission sequence in the N sub-packets; when the total data volume of the upgrade package is less than or equal to the data volume transmitted by each package, determining that the package to be upgraded is the target upgrade package;
the gateway is used for transmitting description information of the package to be upgraded for M times to the electronic tag, and transmitting the target upgrade package to the electronic tag based on the transmission repetition times of the target upgrade package in the description information when the transmission time of the target upgrade package is reached, wherein M is an integer greater than zero;
the electronic tag is used for receiving the target upgrade package when the countdown in the description information is finished under the condition that the description information is monitored; the countdown in the description information is a difference value between the transmission time of the target upgrade package and first transmission time, wherein the first transmission time is a product of data transmission time between the gateway and the electronic tag and the transmission times of the description information; and upgrading the firmware based on the target upgrading package.
A fifth aspect of an embodiment of the present application provides a firmware upgrading apparatus, including:
the computing module is used for computing the total packet number corresponding to the packet to be upgraded based on the total data amount of the packet to be upgraded 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 larger than the data amount transmitted by each packet;
the dividing module is used for dividing the packet to be upgraded into N sub-packets, and determining that a first sub-packet is a target upgrading packet, wherein N is the total number of the packets, N is an integer greater than 1, and the first sub-packet refers to a sub-packet in a first transmission sequence in the N sub-packets;
the target determining module is used for determining the package to be upgraded as the target upgrading package when the total data volume of the upgrading package is less than or equal to the data volume transmitted by each package;
the transmitting module is used for transmitting description information of the package to be upgraded for M times to the electronic tag, and transmitting the target upgrade package to the electronic tag based on the transmission repetition times of the target upgrade package in the description information when the transmission time of the target upgrade package is reached, wherein M is an integer larger than zero, and the target upgrade package is used for upgrading the firmware of the electronic tag.
A sixth aspect of an embodiment of the present application provides a firmware upgrading apparatus, including:
the receiving module is used for receiving the target upgrading packet when the countdown in the description information is finished under the condition that the description information of the packet to be upgraded transmitted by the gateway is monitored; the countdown in the description information is a difference value between the transmission time of the target upgrade package and first transmission time consumption, wherein the transmission time is the time for the gateway to transmit the target upgrade package, and the first transmission time consumption is the product of the data transmission time between the gateway and the electronic tag and the transmission times of the description information; when the total data volume of the upgrade package in the description information is less than or equal to the data volume transmitted by each 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 by each package, the target upgrade package is a first sub-package obtained by dividing the package to be upgraded into N sub-packages, the first sub-package is a sub-package positioned in a first transmission sequence in the N sub-packages, N is the total number of packages, and N is an integer greater than 1;
and the upgrading module is used for upgrading the firmware based on the target upgrading package.
A seventh aspect of the embodiments of the present application provides a gateway, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the firmware upgrade method according to the second aspect when executing the computer program.
An eighth aspect of the embodiments of the present application provides an electronic tag, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the firmware upgrade method according to the third aspect is implemented.
A ninth aspect of an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the firmware upgrade method according to the second aspect, or implements the firmware upgrade method according to the third aspect.
A tenth aspect of embodiments of the present application provides a computer program product, which, when running on a terminal device, causes the terminal device to execute the firmware upgrade method described in the second aspect, or execute the firmware upgrade method described in the third aspect.
Compared with the prior art, the embodiment of the application has the beneficial effects that: in the embodiment of the application, firstly, when the total data volume of an upgrading packet in the description information of the packet to be upgraded is greater than the data volume transmitted by each packet, the gateway calculates the total packet number corresponding to the packet to be upgraded based on the total data volume of the upgrading packet and the data volume transmitted by each packet, divides the packet to be upgraded into N sub-packets, wherein N is an integer greater than 1, and determines a first sub-packet as a target upgrading packet; when the total data volume of the upgrade package is less than or equal to the data volume transmitted by each package, the sub-packages are not required to be divided, and the package to be upgraded can be determined to be a target upgrade package; secondly, the gateway transmits description information of the package to be upgraded for M times to the electronic tag, and transmits a target upgrade package to the electronic tag based on the transmission repetition times of the target upgrade package in the description information when the transmission time of the target upgrade package is reached, wherein M is an integer greater than zero; and finally, under the condition that the electronic tag monitors the description information, receiving a target upgrading packet when countdown in the description information is finished, and upgrading the firmware based on the target upgrading packet, wherein the countdown in the description information is the difference between the transmission time of the target upgrading 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 transmission times of the description information. Under the setting of the countdown, the at least one electronic tag can simultaneously receive the target upgrading packet sent by the gateway and simultaneously upgrade based on the target upgrading packet, so that batch upgrading of the at least one electronic tag can be realized, time cost of firmware upgrading is reduced, and upgrading efficiency of firmware upgrading is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a firmware upgrading system provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of a firmware upgrading method according to a second embodiment of the present application;
fig. 3 is a timing diagram of data transmission of the gateway interacting with at least one electronic tag;
fig. 4 is a schematic flowchart of a firmware upgrading method according to a third embodiment of the present application;
fig. 5 is a schematic flowchart of a firmware upgrading method according to a fourth embodiment of the present application;
fig. 6 is a schematic structural diagram of a firmware upgrading apparatus according to a fifth embodiment of the present application;
fig. 7 is a schematic structural diagram of a firmware upgrading apparatus according to a sixth embodiment of the present application;
fig. 8 is a schematic structural diagram of a gateway according to a seventh embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic tag according to an eighth embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
In order to improve the efficiency of firmware upgrading, the application provides a method for firmware upgrading, and the efficiency of firmware upgrading of electronic tags can be improved by realizing batch upgrading of at least one electronic tag. The concrete implementation is as follows: when the total data volume of the upgrading packet in the description information of the packet to be upgraded is larger than the data volume transmitted by each packet, the gateway calculates the total packet number corresponding to the packet to be upgraded based on the total data volume of the upgrading packet and the data volume transmitted by each packet; dividing a packet to be upgraded into N sub-packets, and determining a first sub-packet as a target upgrade packet; when the total data of the upgrading packet is less than or equal to the data volume transmitted by each packet, sub-packets do not need to be divided, and the packet to be upgraded can be determined to be a target upgrading packet; secondly, when a target upgrading packet is sent to the electronic tag, the gateway firstly transmits description information of the packet to be upgraded for M times to the electronic tag, and when the transmission time of the target upgrading packet is reached, the target upgrading packet is transmitted to the electronic tag based on the transmission repetition times of the target upgrading packet in the description information; the electronic tag monitors description information of the package to be upgraded for M times sent by the gateway, receives the target upgrade package when countdown in the description information is finished when the description information is monitored, and upgrades the firmware based on the target upgrade package. The firmware upgrading method can be applied to a firmware upgrading system comprising a gateway and at least one electronic tag, so that the at least one electronic tag can simultaneously receive a target upgrading packet sent by the gateway under the countdown setting, and can be upgraded based on the target upgrading packet, batch upgrading of the at least one electronic tag can be realized, the time cost for sequentially upgrading the firmware of the at least one electronic tag is reduced, and the upgrading efficiency of the firmware upgrading is improved.
It should be understood that, the sequence numbers of the steps in this embodiment do not mean the execution sequence, and the execution sequence of each process should be determined by the function and the inherent logic of the process, and should not constitute any limitation to the implementation process of the embodiment of the present application.
In order to explain the technical solution of the present application, the following description is given by way of specific examples.
Referring to fig. 1, a schematic structural diagram of a firmware upgrade system provided in a first embodiment of the present application is shown. As shown in fig. 1, the firmware upgrade system includes a gateway and L electronic tags, where L is an integer greater than zero.
When the firmware upgrading efficiency of the L electronic tags is improved, data interaction between the gateway and the L electronic tags is needed, firstly, the gateway can divide the package to be upgraded into N sub-packages when the total quantity of the upgrading package in the description information of the package to be upgraded is larger than the data quantity transmitted by each package, so that the transmission of the package to be upgraded is facilitated, and the package to be upgraded is divided into N sub-packages, so that the total package number corresponding to the package to be upgraded can be calculated firstly based on the total data quantity of the upgrading package and the data quantity transmitted by each package, and then the package to be upgraded is divided into N sub-packages based on the total package number, wherein N is the total package number and N is an integer larger than 1. After the packet to be upgraded is divided into N sub-packets, it is determined that the first sub-packet is the target upgrade packet, and transmission of the target upgrade packet is started, where the first sub-packet is a sub-packet in the first transmission sequence among the N sub-packets. When the total number of the upgrade packages is less than or equal to the data volume transmitted by each package, the packages to be upgraded can be directly determined to be target upgrade packages without dividing sub-packages.
Secondly, when the gateway sends a target upgrade package to the electronic tag, the gateway can firstly transmit description information of the package to be upgraded for 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 transmission repetition times of the target upgrade package in the description information;
and the electronic tag monitors the description information of the M times of packages to be upgraded sent by the gateway, and receives the target upgrade package when the countdown in the description information is finished when the description information is monitored. The L electronic tags monitor that the transmission times of the description information are different, and the countdown of correspondingly receiving the target upgrade package is also different, wherein the countdown is the difference between the transmission time of the target upgrade package and the first transmission time consumption, and the first transmission time consumption is the product of the data transmission time between the gateway and the electronic tags and the transmission times of the description information. By adopting the counting method of the countdown, the L electronic tags can be ensured to receive the target upgrade package at the same time, and the firmware is upgraded based on the target upgrade package. The L electronic tags can simultaneously receive the target upgrading packet and upgrade simultaneously, so that the time cost for sequentially upgrading the firmware of the L electronic tags is reduced, and the upgrading efficiency of the firmware is improved.
The gateway can perform unpacking operation on the package to be upgraded when receiving an upgrade instruction sent by the server and the package to be upgraded, and according to the total data volume of the package to be upgraded and the data volume transmitted by each package, judge whether the package to be upgraded needs to be divided into N sub-packages, and generate the 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 package to be upgraded, the data volume transmitted by each package and a countdown corresponding to the repeated transmission times of the description information, for example, the countdown corresponding to the first sending of the description information is 14998 milliseconds, the countdown corresponding to the second sending of the description information is 14996 milliseconds, and the countdown is used for indicating the electronic tag to receive the target upgrade package after the countdown is finished.
According to the transmission times of the description information, the countdown in the description information may be determined, for example, the gateway transmits the description information of the packet to be upgraded at a frequency of 2 milliseconds per packet, continuously transmits for 10 seconds, and may transmit the description information of the packet to be upgraded 1000 times, if the target upgrade packet is a first sub-packet, and it is set that data of the first sub-packet is transmitted for the first time after the gateway transmits the description information of the packet to be upgraded for 15 seconds, the corresponding countdown in the description information of the packet to be upgraded, which is 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 packet and the first transmission time); similarly, the corresponding countdown in the description information of the package to be upgraded, which is 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 packet to be upgraded, which is transmitted by the gateway for the third time, should be 15000-3 × 2 ═ 14994 milliseconds; by analogy, when the gateway transmits the description information of the package to be upgraded once, the corresponding countdown in the description information is reduced by 2 milliseconds.
For the L electronic tags, in order to keep low power consumption, the electronic tags cannot be in a receiving state for a long time, and it is usually set that 1.5 milliseconds are in the receiving state every 1 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, so the L electronic tags can receive the target upgrade package by using the counting method of the countdown. For example, if the electronic tag a listens to the description information when the gateway transmits the description information of the packet to be upgraded for the first time, the electronic tag a may prepare to receive the data of the first sub-packet in 14998 milliseconds after the electronic tag a listens to the description information; assuming that the electronic tag B listens to the description information when the gateway transmits the description information of the packet to be upgraded for the third time, the electronic tag may prepare to receive the data of the first sub-packet 14994 milliseconds after the electronic tag listens to the description information; therefore, the electronic tags a and B start to receive the data of the first sub-packet at the same time, and so on, all L electronic tags can ensure that the data of the first sub-packet starts to be received at the same time.
It should be understood that if the target upgrade package is the to-be-upgraded package, the counting method of the countdown corresponding to the transmission frequency to which the description information belongs is the same as that when the target upgrade package is the first sub-package, that is, if the target upgrade package is the to-be-upgraded package, the counting method of the countdown corresponding to the transmission frequency to which the description information belongs is adopted, and it can also be ensured that all the L electronic tags can start to receive the data of the to-be-upgraded package at the same time.
In a possible implementation manner, when the target upgrade packet is the first sub-packet, the target upgrade packet further includes a transmission time and a transmission repetition number of a next sub-packet of the target upgrade packet, and before performing firmware upgrade based on the target upgrade packet, the method further includes:
when the gateway reaches the transmitting time of the next sub-packet, transmitting a target upgrading packet to the electronic tag based on the transmitting repetition times of the next sub-packet;
the electronic tag determines that the upgrading packet data in the target upgrading packet is the total upgrading packet data, receives a next sub-packet when the countdown in the target upgrading packet is finished, adds the upgrading packet data in the next sub-packet to the total upgrading packet data, and determines that the next sub-packet is the target upgrading packet; judging whether the target upgrading packet contains countdown or not, if the target upgrading packet contains countdown, returning to the step of receiving the next sub-packet when the countdown of the electronic tag in the target upgrading packet is finished and the subsequent steps until the target upgrading packet does not contain countdown;
and upgrading the firmware based on the target upgrade package, wherein the upgrading process comprises the following steps:
and updating the firmware based on the total updating packet data.
In this embodiment of the present application, the number of times of repeatedly transmitting the next sub-packet may be set according to the number of devices of the electronic tag to be upgraded, that is, the number of devices of the electronic tag to be upgraded is larger, and the number of times of repeatedly transmitting the next sub-packet is larger.
Illustratively, the electronic tag firstly determines the upgrade packet data in a first sub-packet as total upgrade packet data, transmits the first sub-packet according to the repeated transmission times of a target upgrade packet (in this case, the first sub-packet), calculates countdown corresponding to the repeated transmission times of a second sub-packet in the first sub-packet according to the repeated transmission times of the second sub-packet, receives the second sub-packet when the countdown in the first sub-packet is over, adds the upgrade packet data in the second sub-packet to the total upgrade packet, determines that the second sub-packet is the target upgrade packet, judges whether the second sub-packet comprises the countdown of the third sub-packet, if the second sub-packet comprises the countdown of the third sub-packet, continues to receive the third sub-packet after the countdown in the second sub-packet is over, adds the upgrade packet data in the third sub-packet to the total upgrade packet, determines that the third sub-packet is the target upgrade packet, and sequentially judges each target upgrade packet, and when the target upgrade package does not contain the countdown, finishing receiving, determining the total upgrade package data, and upgrading the firmware based on the total upgrade package data.
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; the firmware upgrading method further comprises the following steps:
the gateway transmits the target upgrading packet to the electronic tag at the transmitting frequency point of the target upgrading packet;
under the condition that the electronic tag monitors the description information, the electronic tag receives a target upgrade package when the countdown in the description information is finished, and the method comprises the following steps:
and under the condition that the electronic tag monitors the description information, skipping to a transmitting frequency point of the target upgrading packet to receive the target upgrading packet when the countdown of the description information is finished.
In the embodiment of the application, the transmitting frequency point in the description information enables the electronic tag to jump to a designated frequency point (namely the transmitting frequency point) to receive the target upgrade package under the condition that the electronic tag monitors the description information, so that the electronic tag can accurately receive the target upgrade package.
According to the method and the device, the electronic tags can receive the target upgrading packet at the appointed time according to countdown after monitoring the description information of the packet to be upgraded through countdown corresponding to the transmitting times of the description information configured by the gateway, and upgrading is carried out based on the target upgrading packet, so that batch upgrading of L electronic tags is realized, the time cost for upgrading the L electronic tags in sequence is reduced, and the upgrading efficiency of firmware upgrading is improved.
Referring to fig. 2, a flowchart of a firmware upgrading method provided in the second embodiment of the present application is shown, where the firmware upgrading method is applied to the firmware upgrading system shown in fig. 1. As shown in fig. 2, the firmware upgrade method may include the steps of:
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 package number 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 dividing the packet to be upgraded into N sub-packets, and determining the first sub-packet as a target upgrade packet.
In this embodiment of the application, in order to reduce the data transmission burden of the system, a certain upper limit needs to be set on the data amount during data transmission between the gateway and the electronic tag, for example, the data amount transmitted each time cannot exceed 100 bytes, at this time, if the total data amount of the upgrade package in the description information of the package to be upgraded is 500000 bytes, and transmission cannot be completed at one time, the total packet number corresponding to the package to be upgraded needs to be calculated according to the total data amount of the upgrade package and the data amount transmitted each package, that is, the total packet number is 500000/100 ═ 5000 packages, according to the total packet number corresponding to the package to be upgraded, the package to be upgraded is divided into 5000 sub-packets, and the sub-packet in the first transmission order among the 5000 sub-packets is determined as the target upgrade package.
Step 202, when the total data volume of the upgrade package is less than or equal to the data volume transmitted by each package, the gateway determines that the package to be upgraded is the target upgrade package.
In the embodiment of the application, if the total data volume of the upgrade package is less than or equal to the data volume transmitted by each package, subpackaging is not needed, the package to be upgraded can be directly determined as the target upgrade package, and the method can be applied to application scenes with less transmission data volume, such as batch updating of pictures or batch configuration of electronic tags.
Step 203, the gateway transmits the description information of the package to be upgraded for M times to the electronic tag, and transmits the target upgrade package to the electronic tag based on the transmission repetition times of the target upgrade package in the description information when the transmission time of the target upgrade package is reached.
In this embodiment of the application, M is an integer greater than zero, and as shown in fig. 3, it is a data transmission timing diagram of interaction between the gateway and the electronic tag, where the number of times that the gateway first transmits the description information of the package to be upgraded to the electronic tag is M times, so as to ensure that each electronic tag can monitor the description information. At this time, the transmission repetition times in the description information is M times, and when the transmission time of the target upgrade package is reached, the times that the gateway transmits the target upgrade package to the electronic tag is also M times.
And 204, under the condition that the electronic tag monitors the description information, receiving the target upgrade package when the countdown in the description information is finished, and upgrading the firmware based on the target upgrade package.
In this embodiment of the application, the electronic tag may monitor the description information transmitted by the gateway by setting the network interface to a monitoring mode, and specifically, may monitor the description information of the packet to be upgraded wirelessly or by using a private 2.4G protocol.
In the embodiment of the application, firstly, when the total data volume of an upgrading packet in the description information of the packet to be upgraded is greater than the data volume transmitted by each packet, a gateway divides the packet to be upgraded into N sub-packets, and determines a first sub-packet as a target upgrading packet; 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 a target upgrade package; secondly, when the gateway reaches the transmitting time of the target upgrading packet, transmitting the target upgrading packet to the electronic tag based on the transmitting repetition times of the target upgrading packet in the description information; and finally, under the condition that the electronic tag monitors the description information, receiving a target upgrading packet when countdown in the description information is finished, and upgrading the firmware based on the target upgrading packet, wherein the countdown in the description information is the difference between the transmission time of the target upgrading 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 transmission times of the description information. Under the setting of the countdown, the at least one electronic tag can simultaneously receive the target upgrading packet sent by the gateway and simultaneously upgrade based on the target upgrading packet, so that batch upgrading of the at least one electronic tag can be realized, time cost of firmware upgrading is reduced, and upgrading efficiency of firmware upgrading is improved.
Referring to fig. 4, a flowchart of a firmware upgrading method provided by the third embodiment of the present application is shown, where the firmware upgrading method is applied to a gateway in the firmware upgrading system shown in fig. 1. As shown in fig. 4, the firmware upgrade method may include the steps of:
step 401, 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 package number 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.
Step 401 of this embodiment is the same as step 201 of the previous embodiment, and may refer to each other, which is not described herein again.
Step 402, dividing the packet to be upgraded into N sub-packets, and determining the first sub-packet as a target upgrade packet.
In this embodiment of the present application, N is an integer greater than 1, the first sub-packet is a sub-packet in a first transmission order among the N sub-packets, the first sub-packet is used as a target upgrade packet, and the gateway transmits the first sub-packet first when the transmission time of the target upgrade packet is reached.
Step 403, when the total data volume of the upgrade package is less than or equal to the data volume transmitted by each package, determining that the package to be upgraded is the target upgrade package.
And step 404, transmitting the description information of the package to be upgraded for M times to the electronic tag, and transmitting the target upgrade package to the electronic tag based on the transmission repetition times of the target upgrade package in the description information when the transmission time of the target upgrade package is reached.
The steps 403 and 404 in this embodiment are the same as the steps 202 and 203 in the previous embodiment, and reference may be made to these steps, which are not described herein again.
In the embodiment of the application, the gateway determines the target upgrade package according to the total data volume of the upgrade package and the data volume transmitted by each package, transmits the description information of the package to be upgraded for M times to the electronic tag in order to ensure that all the electronic tags can monitor the description information, and transmits the target upgrade package for M times to the electronic tag when the transmission time of the target upgrade package is reached, so as to ensure that each electronic tag can receive the target upgrade package.
Referring to fig. 5, a flowchart of a firmware upgrading method provided by the fourth embodiment of the present application is shown, where the firmware upgrading method is applied to an electronic tag in the firmware upgrading system shown in fig. 1. As shown in fig. 4, the firmware upgrade method may include the steps of:
step 501, under the condition that the description information of the package to be upgraded transmitted by the gateway is monitored, receiving the target upgrade package when the countdown in the description information is finished.
In this embodiment of the application, when the total data volume of the upgrade package is less than or equal to the data volume transmitted by each package, the target upgrade package is the package to be upgraded, and the package to be upgraded is received when the countdown in the description information is finished, where the countdown in the description information is a difference between the transmission time of the package to be upgraded and the first transmission time, and the first transmission time is a product of the data transmission time between the gateway and the electronic tag and the transmission times of the description information. 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 at the 5 th time, the countdown for receiving the package to be upgraded corresponding to the description information sent at the 5 th time can be obtained in the description information, and the electronic tag is ready to receive the package to be upgraded before the countdown is finished, so that the package to be upgraded is received when the countdown is finished.
In this embodiment of the present application, when the total data amount of an upgrade package in description information is greater than the data amount transmitted by each package, a target upgrade package refers to a first sub-package obtained by dividing a package to be upgraded into N sub-packages, and receives the first sub-package when countdown in the description information is finished, where the countdown in the description information is a difference between transmission time of the first sub-package and first transmission time consumption, and the first transmission time consumption is a product of data transmission time between a gateway and an electronic tag and the number of transmission times 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 5 th time, the countdown for receiving the first sub-packet corresponding to the description information sent for the 5 th time can be obtained in the description information, and the electronic tag should prepare for receiving the first sub-packet before the countdown is finished, so as to receive the first sub-packet when the countdown is finished.
In a possible implementation, the description information further includes a target firmware version and a target device number, and in a case that the description information of the packet to be upgraded transmitted by the gateway is monitored, the receiving of the target upgrade packet at the end of the countdown in the description information includes:
and under the condition of monitoring the description information, if the target equipment number is the same as the equipment number of the electronic tag and the target firmware version is different from the firmware version of the electronic tag, receiving the target upgrade package when the countdown in the description information is finished.
The method and the device can be applied to upgrading of a part of all electronic tags meeting the upgrading conditions.
The target device number may be divided into a target major number and a target subclass number, the device number of the electronic tag may be divided into a major number and a subclass number, and the target device number may be determined to be the same as the device number of the electronic tag if the target major number is the same as the device number of the electronic tag and the target subclass number is the same as the subclass number of the electronic tag.
In the embodiment of the application, the target firmware version is different from the firmware version of the electronic tag, which means 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.
And 502, upgrading the firmware based on the target upgrading package.
In the embodiment of the application, the firmware upgrade based on the target upgrade package may firstly determine the total upgrade package data in the target upgrade package, and secondly perform the firmware upgrade based on the total upgrade package data.
If the target upgrade package is the package to be upgraded, the total upgrade package data in the target upgrade package can be 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 the N sub-packages.
In one possible implementation, before the firmware upgrade is performed based on the target upgrade package, the firmware upgrade method further includes:
and checking the target upgrade packet data, if the checking result is that the target upgrade packet is a correct upgrade packet, upgrading the firmware based on the target upgrade packet, and if the checking result is that the target upgrade packet is an incorrect upgrade packet, reporting the result of upgrade failure and uploading an error code.
In the embodiment of the present application, the description information further includes a first version protocol, first signature data, and a first current packet data volume; the target upgrading package also comprises a second version protocol, second signature data, a second current package data volume and upgrading package data;
when the target upgrade package is a package to be upgraded, the data volume of the first current package in the description information is the data volume of the package to be upgraded, and when the target upgrade package is a first sub-package, the data volume of the first current package in the description information is the data volume of the first sub-package allocated by the gateway. The second current packet data amount refers to the data amount of the transmitted packet in the process of data transmission between the gateway and the electronic tag, and is determined by the gateway allocation.
The first version protocol, the first signature data and the first current packet data volume may be encapsulated in header information of the description information, and the second version protocol, the second signature data and the second current packet data volume may be encapsulated in header information of the target upgrade packet.
Verifying the target upgrade package data may specifically include:
under the condition that 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, determining that the description information 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 second current packet data volume is the same as the data volume of the upgrade packet data in the target upgrade packet, determining that the target upgrade packet is legal;
if the index number of the target upgrading packet is N when the receiving is finished, determining that the first verification result of the target upgrading packet is correct;
if the second current packet data volume is the same as the data volume of the upgrade packet data in the target upgrade packet, determining that the second check result of the target upgrade packet is correct;
if the index number of the target upgrade package meets the preset index number increasing requirement, determining 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, determining that the fourth verification result of the target upgrade package is correct, wherein the total upgrade package data comprises all the received upgrade package data of the target upgrade package;
when the target upgrading packet is the packet to be upgraded, if the second check result and the fourth check result are both correct, the description information is legal, and the target upgrading packet is legal, determining that the target upgrading packet is the correct upgrading packet;
when the target upgrade package is a first sub-package, if the first check result, the second check result, the third check result and the fourth check result are all correct, the description information is legal, and the target upgrade package is legal, determining that the target upgrade package is a correct upgrade package;
in this embodiment of the application, when the third verification result is determined, an increment requirement for the index number may be preset in the gateway, and then it is determined whether the index number of the target upgrade package meets the preset increment requirement for the index number, for example, if the increment requirement for the index number in the gateway is 1, it is determined whether the index number of the target upgrade package meets the preset increment requirement for the index number by comparing whether the index number of the adjacent target upgrade package is incremented by 1.
It should be understood that when the target upgrade package is a package to be upgraded, if any one of the second check result and the fourth check result is incorrect or the description information is illegal or the target upgrade package is illegal, the target upgrade package is determined to be an erroneous upgrade package; and when the target upgrading packet is the first sub-packet, if any one of the first check result, the second check result, the third check result and the fourth check result is incorrect or the description information is illegal or the target upgrading packet is illegal, determining that the target upgrading packet is an error upgrading packet.
In a possible implementation manner, the description information further includes the number of devices of the electronic tag to be upgraded, and the firmware upgrading method further includes:
acquiring the time required for reporting the firmware upgrading result of the electronic tag and the preset times for reporting the firmware upgrading result;
generating random time, and calculating a reporting time interval based on the number of the electronic tags to be updated, the time required for reporting the firmware updating result of the electronic tags and the random time;
determining the reporting time of the firmware upgrading result based on the reporting time interval;
and reporting the firmware upgrading result according to the reporting time, and returning to execute the step of generating the random time and the subsequent steps until the number of reporting the firmware upgrading result is equal to the preset number.
Illustratively, if the number of the devices of the electronic tag to be upgraded is 1000, and the time required for reporting the firmware upgrade result of the electronic tag is 1 millisecond, the reporting time interval is 1000 × 1+ rand (1-1000), the rand (1-1000) is a random number selected from 1 to 1000, the time for finishing upgrading is determined according to the reporting time interval and the electronic tag, the reporting time of the firmware upgrade result is determined, after the firmware upgrade result is reported for the first time according to the reporting time, the time interval is calculated again according to the method for calculating the time interval, after the time interval passes, the firmware upgrade result is reported again until the number of times for reporting the firmware upgrade result is equal to the preset number of times. Since at least one electronic tag is easy to collide when reporting the firmware upgrade result at the same time, a method of reporting for multiple times based on the reporting time interval can be selected to ensure that each electronic tag can report the firmware upgrade result successfully.
In the embodiment of the application, when the electronic tag monitors the description information, the electronic tag receives the target upgrade package when countdown in the description information is finished, and performs firmware upgrade based on the target upgrade package, where the countdown in the description information is a difference between transmission time of the target upgrade package and first transmission time, and the first transmission time is a product of data transmission time between the gateway and the electronic tag and transmission times of the description information. Under the setting of the countdown, the at least one electronic tag can simultaneously receive the target upgrading packet sent by the gateway and simultaneously upgrade based on the target upgrading packet, so that batch upgrading of the at least one electronic tag can be realized, time cost of firmware upgrading is reduced, and upgrading efficiency of firmware upgrading is improved.
Referring to fig. 6, a schematic structural diagram of a firmware upgrading apparatus provided in the fifth embodiment of the present application is shown, and for convenience of description, only the parts related to the fifth embodiment of the present application are shown.
The firmware upgrading device specifically includes the following modules:
a calculating module 601, configured to calculate a total packet number corresponding to the package to be upgraded based on the total data amount of the package to be upgraded and the data amount transmitted by each package when the total data amount of the upgrade package in the description information of the package to be upgraded is greater than the data amount transmitted by each package;
a dividing module 602, configured to divide a packet to be upgraded into N sub-packets, and determine that a first sub-packet is a target upgrade packet, where N is a total number of packets, and N is an integer greater than 1, and the first sub-packet is a sub-packet in a first transmission sequence of the N sub-packets;
a target determining module 603, configured to determine, when the total data amount of the upgrade package is less than or equal to the data amount transmitted by each package, that the package to be upgraded is a target upgrade package;
the transmitting module 604 is configured to transmit description information of the package to be upgraded M times to the electronic tag, and transmit a target upgrade package to the electronic tag based on the transmission repetition times of the target upgrade package in the description information when the transmission time of the target upgrade package is reached, where M is an integer greater than zero, and the target upgrade package is used to upgrade firmware of the electronic tag.
The firmware upgrading device provided in the embodiment of the present application may be applied to the third method embodiment, and for details, refer to the description of the third method embodiment, and are not described herein again.
Referring to fig. 7, a schematic structural diagram of a firmware upgrading apparatus provided in a sixth embodiment of the present application is shown, and for convenience of description, only parts related to the embodiment of the present application are shown.
The firmware upgrading device specifically includes the following modules:
a receiving module 701, configured to receive a target upgrade package when countdown in description information is finished under the condition that description information of a package to be upgraded, which is transmitted by a gateway, is monitored; the countdown in the description information is a difference value between the transmission time of the target upgrade package and the first transmission time consumption, wherein the transmission time is the time for the gateway to transmit the target upgrade package, and the first transmission time consumption is the product of the data transmission time between the gateway and the electronic tag and the transmission times of the description information; when the total data volume of the upgrade package in the description information is less than or equal to the data volume transmitted by each package, the target upgrade package is a package to be upgraded; when the total data volume of the upgrading packet is larger than the data volume transmitted by each packet, the target upgrading packet is a first sub-packet obtained by dividing the packet to be upgraded into N sub-packets, the first sub-packet is a sub-packet positioned in a first transmission sequence in the N sub-packets, N is the total packet number, and N is an integer larger than 1;
and an upgrade module 702, configured to upgrade firmware based on the target upgrade package.
In this embodiment, the receiving module 701 may specifically include the following sub-modules:
and the upgrading judgment sub-module is used for receiving the target upgrading packet when the countdown in the description information is finished if the target equipment number is the same as the equipment number of the electronic tag and the target firmware version is different from the firmware version of the electronic tag under the condition that the description information is monitored.
In this embodiment, the firmware upgrading apparatus may further include the following modules:
the time acquisition module is used for acquiring the time required for reporting the firmware upgrading result of the electronic tag and the preset times for reporting the firmware upgrading result;
the generation module is used for generating random time and calculating reporting time interval based on the number of the electronic tags to be updated, the time required for reporting the firmware updating result of the electronic tags and the random time;
a reporting time determining module, configured to determine reporting time of a firmware upgrade result based on a reporting time interval;
and the circulating module is used for reporting the firmware upgrading result according to the reporting time, and returning to execute the step of generating the random time and the subsequent steps until the number of times of reporting the firmware upgrading result is equal to the preset number of times.
In this embodiment, the firmware upgrading apparatus may further include the following modules:
the first legality judging module is used for determining 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 under the condition that the description information is monitored;
the second legal judging module is used for determining that the target upgrade package is legal if a second version protocol is the same as the version protocol of the electronic tag, second signature data is the same as signature data of the electronic tag, and the data volume of second current package data is the same as the data volume of upgrade package data in the target upgrade package;
the first checking module is used for determining that the first checking result of the target upgrading packet is correct if the index number of the target upgrading packet is N after the receiving is finished;
the second checking module is used for determining that a second checking result of the target upgrading packet is correct if the second current packet data volume is the same as the data volume of the upgrading packet data in the target upgrading packet;
the third checking module is used for determining that the third checking result of the target upgrading packet is correct if the index number of the target upgrading packet meets the preset index number increasing requirement;
the fourth verification module is used for determining that the 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 comprises the received upgrade package data of all the target upgrade packages;
the first upgrading judgment module is used for determining that the target upgrading packet is the correct upgrading packet if the second check result and the fourth check result are both correct, the description information is legal and the target upgrading packet is legal when the target upgrading packet is the to-be-upgraded packet;
the second upgrading judgment module is used for determining that the target upgrading packet is a correct upgrading packet if the first check result, the second check result, the third check result and the fourth check result are correct, the description information is legal and the target upgrading packet is legal when the target upgrading packet is a first sub-packet;
correspondingly, the upgrade module 702 may further include the following sub-modules:
and the target upgrading submodule is used for upgrading the firmware based on the target upgrading packet if the target upgrading packet is a correct upgrading packet.
The firmware upgrading device provided in the embodiment of the present application may be applied to the fourth method embodiment, and for details, reference is made to the description of the fourth method embodiment, and details are not described herein again.
Fig. 8 is a schematic structural diagram of a gateway according to a seventh embodiment of the present application. As shown in fig. 8, the gateway 800 of this embodiment includes: at least one processor 810 (only one is shown in fig. 8), a memory 820, and a computer program 821 stored in the memory 820 and operable on the at least one processor 810, wherein the processor 810 implements the steps in the third embodiment of the firmware upgrading method when executing the computer program 821.
The gateway 800 may be a computer device such as an internet connector, a protocol converter, etc. for realizing network interconnection. The gateway may include, but is not limited to, a processor 810, a memory 820. Those skilled in the art will appreciate that fig. 8 is merely an example of the gateway 800, and does not constitute a limitation on the gateway 800, and may include more or less components than those shown, or combine certain components, or different components, such as may also include input-output devices, network access devices, etc.
The Processor 810 may be a Central Processing Unit (CPU), and the Processor 810 may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 820 may be an internal storage unit of the terminal device 800 in some embodiments, such as a hard disk or a memory of the gateway 800. The memory 820 may also be an external storage device of the gateway 800 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the gateway 800. Further, the memory 820 may also include both an internal storage unit and an external storage device of the gateway 800. The memory 820 is used for storing an operating system, an application program, a Boot Loader (Boot Loader), data, and other programs, such as program codes of the computer programs. The memory 820 may also be used to temporarily store data that has been output or is to be output.
Fig. 9 is a schematic structural diagram of an electronic tag according to an eighth embodiment of the present application. As shown in fig. 9, the electronic tag 900 of this embodiment includes: at least one processor 910 (only one is shown in fig. 9), a memory 920, and a computer program 921 stored in the memory 920 and operable on the at least one processor 910, wherein the processor 910 executes the computer program 921 to implement the steps in the fourth embodiment of the firmware upgrading method.
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 is merely an example of the electronic tag 900, and does not constitute a limitation of the electronic tag 900, and may include more or less components than those shown, or combine some of the components, or different components, such as input and output devices, network access devices, etc.
The Processor 910 may be a Central Processing Unit (CPU), and the Processor 910 may also be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 920 may be an internal storage unit of the electronic tag 900 in some embodiments, for example, a hard disk or a memory of the electronic tag 900. The memory 920 may also be an external storage device of the electronic tag 900 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like provided on the electronic tag 900. Further, the memory 920 may also include both an internal storage unit and an external storage device of the electronic tag 900. The memory 920 is used for storing an operating system, an application program, a Boot Loader (Boot Loader), data, and other programs, such as program codes of the computer programs. The memory 920 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. For the specific working processes of the units and modules in the system, reference may be made to the corresponding processes in the foregoing method embodiments, which are not described herein again.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same. Although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (14)

1. The firmware upgrading method is characterized by being applied to a firmware upgrading system comprising a gateway and at least one electronic tag; the firmware upgrading method comprises the following steps:
when the total data volume of the upgrading packet in the description information of the packet to be upgraded is larger than the data volume transmitted by each packet, the gateway calculates the total packet number corresponding to the packet to be upgraded based on the total data volume of the upgrading packet and the data volume transmitted by each packet; dividing the packet to be upgraded into N sub-packets, and determining a first sub-packet as a target upgrade packet; n is the total number of the sub-packets, N is an integer greater than 1, and the first sub-packet is a sub-packet in a first transmission sequence in the N sub-packets; when the total data volume of the upgrade package is less than or equal to the data volume transmitted by each package, determining that the package to be upgraded is the target upgrade package;
the gateway transmits description information of a package to be upgraded for M times to the electronic tag, and transmits the target upgrade package to the electronic tag based on the transmission repetition times of the target upgrade package in the description information when the transmission time of the target upgrade package is reached, wherein M is an integer greater than zero;
under the condition that the electronic tag monitors the description information, receiving the target upgrade package when the countdown in the description information is finished; the countdown in the description information is the difference value between the transmission time of the target upgrade package and first transmission time consumption, wherein the first transmission time consumption is the product of data transmission time between the gateway and the electronic tag and the transmission times of the description information; and upgrading the firmware based on the target upgrading package.
2. The firmware upgrade method according to claim 1, wherein, when the target upgrade packet is a first sub-packet, the target upgrade packet further includes a transmission time and a transmission repetition number of a next sub-packet of the target upgrade packet; before the firmware upgrade is carried out based on the target upgrade package, the method further comprises the following steps:
when the gateway reaches the transmitting time of the next sub-packet, transmitting the target upgrading packet to the electronic tag based on the transmitting repetition times of the next sub-packet;
the electronic tag determines that the upgrading packet data in a target upgrading packet is the total upgrading packet data, receives the next sub-packet when the countdown in the target upgrading packet is finished, adds the upgrading packet data in the next sub-packet to the total upgrading packet data, and determines that the next sub-packet is the target upgrading packet; judging whether the target upgrading packet contains countdown, if so, returning to the step of receiving the next sub-packet when the countdown of the electronic tag in the target upgrading packet is finished and the subsequent steps until the countdown is not contained in the target upgrading packet;
and upgrading the firmware based on the target upgrading package, wherein the upgrading process comprises the following steps:
and updating the firmware based on the total updating packet data.
3. The firmware upgrade method according to claim 1, wherein the description information further includes a transmission frequency point of the target upgrade package; the firmware upgrading method further comprises the following steps:
the gateway transmits the target upgrading packet to the electronic tag at the transmitting frequency point of the target upgrading packet;
under the condition that the electronic tag monitors the description information, the electronic tag receives the target upgrade package when the countdown in the description information is finished, and the method comprises the following steps:
and under the condition that the electronic tag monitors the description information, skipping to a transmitting frequency point of the target upgrading packet to receive the target upgrading packet when the countdown of the description information is finished.
4. A firmware upgrading method is applied to a gateway, and comprises the following steps:
when the total data volume of the upgrading package in the description information of the package to be upgraded is larger than the data volume transmitted by each package, calculating the total package number 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;
dividing the packet to be upgraded into N sub-packets, and determining a first sub-packet as a target upgrade packet; n is the total number of the sub-packets, N is an integer greater than 1, and the first sub-packet is a sub-packet in a first transmission sequence in the N sub-packets;
when the total data volume of the upgrade package is less than or equal to the data volume transmitted by each package, determining that the package to be upgraded is the target upgrade package;
transmitting description information of a package to be upgraded M times to an electronic tag, and transmitting the target upgrade package to the electronic tag based on the transmission repetition times of the target upgrade package in the description information when the transmission time of the target upgrade package is reached, wherein M is an integer larger than zero, and the target upgrade package is used for upgrading the firmware of the electronic tag.
5. A firmware upgrading method is applied to an electronic tag, and comprises the following steps:
under the condition that the description information of a packet to be upgraded transmitted by a gateway is monitored, receiving a target upgrade packet when the countdown in the description information is finished; the countdown in the description information is a difference value between the transmission time of the target upgrade package and first transmission time consumption, wherein the transmission time is the time for the gateway to transmit the target upgrade package, and the first transmission time consumption is the product of the data transmission time between the gateway and the electronic tag and the transmission times of the description information; when the total data volume of the upgrade package in the description information is less than or equal to the data volume transmitted by each 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 by each package, the target upgrade package is a first sub-package obtained by dividing the package to be upgraded into N sub-packages, the first sub-package is a sub-package positioned in a first transmission sequence in the N sub-packages, N is the total number of packages, and N is an integer greater than 1;
and upgrading the firmware based on the target upgrading package.
6. The firmware upgrading method according to claim 5, wherein the description information further includes a target firmware version and a target device number, and in the case of monitoring the description information of the packet to be upgraded transmitted by the gateway, receiving the target upgrading packet at the end of the countdown in the description information includes:
and under the condition that the description information is monitored, if the target equipment number is the same as the equipment number of the electronic tag and the target firmware version is different from the firmware version of the electronic tag, receiving the target upgrade package when the countdown in the description information is finished.
7. The firmware upgrade method according to claim 5, wherein the description information further includes a number of devices to be upgraded, the firmware upgrade method further comprising:
acquiring the time required for reporting the firmware upgrading result of the electronic tag and the preset times for reporting the firmware upgrading result;
generating random time, and calculating a reporting time interval based on the number of the electronic tags to be upgraded, the time required for reporting the firmware upgrading result of the electronic tags and the random time;
determining the reporting time of the firmware upgrading result based on the reporting time interval;
and reporting the firmware upgrading result according to the reporting time, and returning to the step of generating random time and the subsequent steps until the number of reporting the firmware upgrading result is equal to the preset number.
8. The firmware upgrade method according to claim 5, wherein the description information further includes a first version protocol, first signature data, and a first current packet data amount, the target upgrade package further includes a second version protocol, second signature data, a second current packet data amount, and upgrade packet data, and before the firmware upgrade based on the target upgrade package, further includes:
under the condition that 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, determining that the description information 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 second current packet data volume is the same as the data volume of the upgrade packet data in the target upgrade packet, determining that the target upgrade packet is legal;
if the index number of the target upgrading packet is N when the receiving is finished, determining that the first verification result of the target upgrading packet is correct;
if the second current packet data volume is the same as the data volume of the upgrade packet data in the target upgrade packet, determining that a second check result of the target upgrade packet is correct;
if the index number of the target upgrade package meets the preset index number increment requirement, determining that a 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 package in the description information, determining that the fourth verification result of the target upgrade package is correct, wherein the total upgrade package data comprises all the received upgrade package data of the target upgrade package;
when the target upgrade package is a package to be upgraded, if the second check result and the fourth check result are both correct, and the description information is legal and the target upgrade package is legal, determining that the target upgrade package is a correct upgrade package;
when the target upgrade package is the first sub-package, if the first check result, the second check result, the third check result and the fourth check result are all correct, the description information is legal, and the target upgrade package is legal, determining that the target upgrade package is a correct upgrade package;
and upgrading the firmware based on the target upgrading package, wherein the upgrading process comprises the following steps:
and if the target upgrade package is the correct upgrade package, upgrading the firmware based on the target upgrade package.
9. A firmware upgrade system, characterized in that the firmware upgrade system comprises a gateway and at least one electronic tag, the firmware upgrade system comprising:
the gateway is used for calculating the total package number 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 when the total data volume of the upgrade package in the description information of the package to be upgraded is larger than the data volume transmitted by each package; dividing the packet to be upgraded into N sub-packets, and determining a first sub-packet as a target upgrade packet, wherein N is the total number of the packets; n is an integer greater than 1, and the first sub-packet refers to a sub-packet in a first transmission sequence in the N sub-packets; when the total data volume of the upgrade package is less than or equal to the data volume transmitted by each package, determining that the package to be upgraded is the target upgrade package;
the gateway is used for transmitting description information of the package to be upgraded for M times to the electronic tag, and transmitting the target upgrade package to the electronic tag based on the transmission repetition times of the target upgrade package in the description information when the transmission time of the target upgrade package is reached, wherein M is an integer greater than zero;
the electronic tag is used for receiving the target upgrading packet when the countdown in the description information is finished under the condition that the description information is monitored; the countdown in the description information is a difference value between the transmission time of the target upgrade package and first transmission time, wherein the first transmission time is a product of data transmission time between the gateway and the electronic tag and the transmission times of the description information; and upgrading the firmware based on the target upgrading package.
10. A firmware upgrade apparatus, comprising:
the calculation module is used for calculating the total packet number corresponding to the packet to be upgraded based on the total data amount of the packet to be upgraded 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 larger than the data amount transmitted by each packet;
the dividing module is used for dividing the packet to be upgraded into N sub-packets, and determining that a first sub-packet is a target upgrading packet, wherein N is the total number of the packets, N is an integer greater than 1, and the first sub-packet refers to a sub-packet in a first transmission sequence in the N sub-packets;
the target determining module is used for determining the package to be upgraded as the target upgrading package when the total data volume of the upgrading package is less than or equal to the data volume transmitted by each package;
the transmitting module is used for transmitting description information of M times of packages to be upgraded to the electronic tag, and transmitting the target upgrading package to the electronic tag based on the transmission repetition times of the target upgrading package in the description information when the transmission time of the target upgrading package is reached, wherein M is an integer larger than zero, and the target upgrading package is used for upgrading the firmware of the electronic tag.
11. A firmware upgrade apparatus, comprising:
the receiving module is used for receiving the target upgrading packet when the countdown in the description information is finished under the condition that the description information of the packet to be upgraded transmitted by the gateway is monitored; the countdown in the description information is a difference value between the transmission time of the target upgrade package and first transmission time consumption, wherein the transmission time is the time for the gateway to transmit the target upgrade package, and the first transmission time consumption is the product of the data transmission time between the gateway and the electronic tag and the transmission times of the description information; when the total data volume of the upgrade package in the description information is less than or equal to the data volume transmitted by each 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 by each package, the target upgrade package is a first sub-package obtained by dividing the package to be upgraded into N sub-packages, the first sub-package is a sub-package positioned in a first transmission sequence in the N sub-packages, N is the total number of packages, and N is an integer greater than 1;
and the upgrading module is used for upgrading the firmware based on the target upgrading package.
12. A gateway comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to claim 4 when executing the computer program.
13. An electronic tag comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 5 to 8 when executing the computer program.
14. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method of claim 4 or carries out the method of any one of claims 5 to 8.
CN202210262648.0A 2022-03-17 2022-03-17 Firmware upgrading method, system, device, gateway, electronic tag and storage medium Pending CN114610353A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210262648.0A CN114610353A (en) 2022-03-17 2022-03-17 Firmware upgrading method, system, device, gateway, electronic tag and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210262648.0A CN114610353A (en) 2022-03-17 2022-03-17 Firmware upgrading method, system, device, gateway, electronic tag and storage medium

Publications (1)

Publication Number Publication Date
CN114610353A true CN114610353A (en) 2022-06-10

Family

ID=81862604

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210262648.0A Pending CN114610353A (en) 2022-03-17 2022-03-17 Firmware upgrading method, system, device, gateway, electronic tag and storage medium

Country Status (1)

Country Link
CN (1) CN114610353A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024060874A1 (en) * 2022-09-20 2024-03-28 深圳Tcl新技术有限公司 Device upgrading method, system, and apparatus, and computer-readable storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024060874A1 (en) * 2022-09-20 2024-03-28 深圳Tcl新技术有限公司 Device upgrading method, system, and apparatus, and computer-readable storage medium

Similar Documents

Publication Publication Date Title
CN110471692B (en) Over-the-air upgrading method, device, equipment and storage medium of terminal program
CN105389177A (en) Software version confirmation method, device and system
CN110875850B (en) Firmware upgrading method and system, readable storage medium and terminal equipment
CN110377440B (en) Information processing method and device
CN103714289A (en) Method and device for determining mobile application antivirus results
CN114610353A (en) Firmware upgrading method, system, device, gateway, electronic tag and storage medium
CN114035987A (en) Data transmission method and device based on message queue, electronic equipment and medium
CN111478751B (en) Data breakpoint continuous transmission method and device and terminal equipment
CN111736866A (en) One-to-one and one-to-many compatible online upgrading method and terminal equipment
CN112506584A (en) Resource file loading method, device, equipment, storage medium and product
CN111176685A (en) Upgrading method and device
CN116466986B (en) Equipment software upgrading method and device of energy storage system, communication module and medium
CN110392096A (en) A kind of method, apparatus of file distributing, master controller and storage medium
CN114070763B (en) Test method, client, server and medium based on improved REST protocol
CN111200653B (en) Multi-platform communication method, multi-platform communication device and intermediate server
CN111984287A (en) Equipment upgrading method and system
CN111885564B (en) Data transmission method, equipment upgrading method and computer readable storage medium
CN112148333B (en) Block chain server firmware updating system
CN114500280A (en) Firmware upgrading method and device and computer readable storage medium
CN110688138A (en) Multi-split program upgrading method and device, multi-split system equipment and medium
CN117270902B (en) OTA upgrade package generation method and device, OTA upgrade method and device
CN114428464B (en) Robot cluster control interaction method and device, terminal equipment and storage medium
CN117883789B (en) Data acquisition method, apparatus, device, readable storage medium, and program product
CN113141603B (en) Data communication method, system, master terminal device and slave terminal device
CN117519747A (en) Robot upgrading method and device, storage medium, robot and terminal equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination