CN114978906A - Intelligent equipment firmware upgrading method based on local area network and storage medium - Google Patents

Intelligent equipment firmware upgrading method based on local area network and storage medium Download PDF

Info

Publication number
CN114978906A
CN114978906A CN202210593498.1A CN202210593498A CN114978906A CN 114978906 A CN114978906 A CN 114978906A CN 202210593498 A CN202210593498 A CN 202210593498A CN 114978906 A CN114978906 A CN 114978906A
Authority
CN
China
Prior art keywords
firmware
control node
node
area network
local area
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.)
Granted
Application number
CN202210593498.1A
Other languages
Chinese (zh)
Other versions
CN114978906B (en
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 Net Is Internet Co ltd
Original Assignee
Shenzhen Net Is Internet 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 Net Is Internet Co ltd filed Critical Shenzhen Net Is Internet Co ltd
Priority to CN202210593498.1A priority Critical patent/CN114978906B/en
Publication of CN114978906A publication Critical patent/CN114978906A/en
Application granted granted Critical
Publication of CN114978906B publication Critical patent/CN114978906B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/30Decision processes by autonomous network management units using voting and bidding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/082Configuration setting characterised by the conditions triggering a change of settings the condition being updates or upgrades of network functionality
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/084Configuration by using pre-existing information, e.g. using templates or copying from other elements

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses an intelligent equipment firmware upgrading method based on a local area network, which comprises the steps of firstly determining a main control node and other controlled nodes from the local area network according to a main control node election mechanism; establishing tcp long links between the master control node and all controlled nodes, recording the models and version numbers of all intelligent devices, and calculating the latest version number of each model; the main control node respectively sends an instruction to each intelligent device with the latest version number, extracts the firmware of the main control node and sends the firmware to other intelligent devices with the same type and the latest version number one by one, so that the other intelligent devices with the same type and the latest version number can upgrade the firmware to the latest version in the current local area network. The invention effectively overcomes the defect of firmware upgrading of the existing intelligent equipment, is complementary with the existing firmware upgrading scheme and does not influence each other, reduces the operation complexity, improves the firmware upgrading efficiency and reduces the bandwidth pressure of a terminal network and a server.

Description

Intelligent equipment firmware upgrading method based on local area network and storage medium
Technical Field
The present invention relates to local area network communication technology, and is especially firmware upgrading method and memory medium for intelligent equipment based on local area network.
Background
With the popularization of intelligent devices, the situation that a plurality of intelligent devices exist in the same local area network is more and more common. At present, the upgrading modes generally adopted by each intelligent device are generally divided into two types: online upgrade and local upgrade.
For online upgrade, the current mainstream solution is that each smart device queries the upgrade server for new firmware version information. And when the new firmware exists in the upgrading server, each intelligent device downloads the new firmware respectively for upgrading. This results in a large waste of terminal network and server bandwidth.
For local upgrades, smart devices currently generally provide one or more of web, usb, uart, app, and the like. When a plurality of devices need to be upgraded, a terminal user needs to operate the devices one by one, and the steps are complex and time-consuming.
Disclosure of Invention
Aiming at the technical problems of the existing intelligent terminal equipment upgrading scheme, the invention provides an intelligent equipment firmware upgrading method based on a local area network, which reduces the operation complexity, improves the upgrading efficiency and reduces the bandwidth pressure of a terminal network and a server.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
a method for upgrading intelligent equipment firmware based on a local area network comprises the following steps:
s100, selecting a master control node from intelligent equipment with a function of extracting the firmware running in the local area network according to a master control node election mechanism, and configuring other intelligent equipment as controlled nodes;
s200, establishing tcp long links between the master control node and all controlled nodes, recording the models and version numbers of all intelligent devices, and determining the latest version number of each model of the intelligent devices in the current local area network;
s300, the main control node sends an instruction to each intelligent device with the latest version number, extracts the firmware of the main control node and sends the firmware to other intelligent devices with the same type and the latest version number one by one, so that the other intelligent devices with the same type and the latest version number can upgrade the firmware to the latest version in the current local area network.
Specifically, in step S300, the master node first sends an instruction to open a port to prepare for receiving the firmware to the controlled node to receive the firmware, and sends an instruction to send the firmware to the specified port of the specified controlled node after the controlled node feeds back the opened specified port to the controlled node with the latest version number in the model, and the controlled node with the latest version number in the model extracts its own firmware and sends the firmware to the specified port of the specified controlled node.
Specifically, after receiving feedback that the designated controlled node completes firmware reception, the master control node instructs the designated controlled node to execute firmware upgrade operation.
Furthermore, the main control node is also provided with an additional storage space for storing the firmware of other intelligent devices except the main control node in the local area network;
after the master control node obtains the models and the version numbers of all the controlled nodes through tcp long-chain connection in step S200, judging whether the version number of each firmware in the extra storage space is the latest version number of the corresponding model, if not, obtaining the firmware with the latest version number of the model from the controlled node with the latest version number of the corresponding model for storage;
in step S300, the firmware for upgrading the firmware of the intelligent device with the non-latest version number comes from the extra storage space or the intelligent device with the latest version number of the corresponding model.
Specifically, the process of acquiring the firmware storage of the latest version number of the model from the controlled node of which the corresponding model has the latest version number is as follows: the master control node opens a designated port, sends a command of sending firmware to the designated port of the master control node to the controlled node with the corresponding model and the latest version number, extracts the firmware of the controlled node with the corresponding model and the latest version number and sends the firmware to the designated port of the master control node.
Specifically, the process of making the firmware of the non-latest version number of the smart device updated come from the extra storage space is as follows: the main control node sends an instruction for opening a port to prepare for receiving the firmware to a controlled node to receive the firmware, and after the controlled node feeds back the opened designated port, the main control node sends the firmware with the latest version number of the corresponding model in the extra storage space to the designated port of the controlled node.
Specifically, the process of the master node election mechanism in step S100 is as follows:
when the X1 intelligent equipment is accessed to a local area network or is initially started in the local area network, firstly operating with the identity of a controlled node, and broadcasting information which is received and responded by a main control node in the local area network so as to search the main control node in the local area network;
x2, judging whether the intelligent device receives the response of the main control node, if so, indicating that the main control node exists in the local area network, configuring the intelligent device as a controlled node, finishing election, if not, indicating that the main control node does not exist in the local area network temporarily, configuring the intelligent device as the main control node temporarily, and executing the next step;
and X3, the intelligent device broadcasts the information that only the master control node can receive and respond in the local area network again, judges whether the intelligent device receives the responses of other master control nodes, if not, the intelligent device is formally configured as the master control node, the election is finished, if so, the election fails, and the step X1-X3 is executed again after a period of time with random parameters is delayed according to a set back-off mechanism to carry out the election process for a new time.
In particular, the time T with a random parameter in the back-off mechanism is denoted as T ═ a × 2 (N-1) +rand[0,x]Wherein A is a set multiple parameter, N is election failure times, rand [0, x]Representing a random number generated between 0 and a set natural number x.
Furthermore, the main control node is also provided with a visual human-computer interaction interface for a terminal user to upload a firmware of a specified type and a specified version number on the main control node by using the visual human-computer interaction interface to upgrade a specified controlled node;
the process of upgrading the appointed controlled node by using the visual human-computer interaction interface to upload the firmware with the appointed model number and the edition number is as follows:
after receiving the firmware uploaded by the terminal user, the main control node analyzes the firmware to obtain the version number and the corresponding model of the firmware;
listing all controlled nodes with the models matched with the firmware on the visual man-machine interaction interface according to the models and the version numbers of all intelligent devices recorded by the main control node;
and distributing the firmware to controlled nodes selected by the terminal user according to the selection feedback of the terminal user, upgrading the selected controlled nodes, and feeding the upgrading result back to the terminal user.
Still further, the present invention provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the above-mentioned local area network-based firmware upgrade method for an intelligent device.
Furthermore, the present invention also provides an intelligent device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned firmware upgrading method for an intelligent device based on a local area network when executing the computer program.
Compared with the prior art, the invention has the following beneficial effects:
the invention determines the master control node through the master control node election mechanism, utilizes the master control node to obtain the latest version of each model of controlled node and mutually transmits the firmware data in the local area network to realize the update of the non-latest version firmware, effectively solves the defect of firmware update of the existing intelligent equipment, is complementary with the existing firmware update scheme and does not mutually influence, reduces the operation complexity, improves the firmware update efficiency, reduces the bandwidth pressure of a terminal network and a server, can operate among various intelligent equipment of different models, and improves the interoperability among the intelligent equipment of different models.
Drawings
FIG. 1 is a schematic flow chart of example 1 of the present invention.
Fig. 2 is a schematic interaction flow diagram according to embodiment 1 of the present invention.
Fig. 3 is a flowchart illustrating a master node election mechanism according to an embodiment of the present invention.
Fig. 4 is a schematic diagram of an interaction flow in embodiment 2 of the present invention.
Fig. 5 is a schematic interaction flow diagram according to embodiment 3 of the present invention.
Fig. 6 is a schematic interaction flow diagram according to embodiment 4 of the present invention.
Fig. 7 is a schematic diagram of an application example of an embodiment of the present invention.
Detailed Description
The present invention is further illustrated by the following figures and examples, which include, but are not limited to, the following examples.
Example 1
As shown in fig. 1 to fig. 3, the method for upgrading firmware of an intelligent device based on a local area network according to this embodiment includes the following steps:
s100, selecting a master control node from intelligent equipment with a function of extracting the firmware running in the local area network according to a master control node election mechanism, and configuring other intelligent equipment into a controlled node;
s200, establishing tcp long links between the master control node and all controlled nodes, recording self information at least comprising models and version numbers of all intelligent devices through the tcp long links, and determining the latest version number of each model of the intelligent devices in the current local area network;
s300, the main control node sends an instruction to each intelligent device with the latest version number, extracts the firmware of the main control node and sends the firmware to other intelligent devices with the same type and the latest version number one by one, so that the other intelligent devices with the same type and the latest version number can upgrade the firmware to the latest version in the current local area network.
Specifically, in step S300, the master node first sends an instruction to open a port to prepare for receiving the firmware to the controlled node to receive the firmware, and sends an instruction to send the firmware to the specified port of the specified controlled node after the controlled node feeds back the opened specified port to the controlled node with the latest version number in the model, and the controlled node with the latest version number in the model extracts its own firmware and sends the firmware to the specified port of the specified controlled node.
Specifically, after receiving feedback that the designated controlled node completes firmware reception, the master control node instructs the designated controlled node to execute firmware upgrade operation.
As shown in fig. 2, 1 master control node and 3 controlled nodes are determined in the current local area network, where the controlled node 1 is of type 1 and version number 1, the controlled node 2 is of type 1 and version number 2, and the controlled node 3 is of type 2 and version number 3. The master control node and 3 controlled nodes establish tcp long links so as to transmit data information; then, all the 3 controlled nodes send self information to the main control node, and the self information at least comprises a model number and a version number. After receiving the information of the controlled node, the master control node selects proper time according to a pre-configured strategy (such as idle upgrade) and calculates and determines the latest version number of each model in the current local area network by comparing the model information with the version number information, wherein the latest version number of the model 1 is 2, and the latest version number of the model 2 is 3, so that the controlled node 1 is determined to be upgraded, and the controlled node 2 and the controlled node 3 are determined not to be upgraded; then the master control node sends an instruction to the controlled node through a tcp long link for version synchronization, in the version synchronization, the master control node sends an instruction of opening a random port to prepare to receive firmware to the controlled node 1 needing to be upgraded, the controlled node 1 opens a port with a port number Y after receiving the instruction and feeds back information of successfully opening the port with the port number Y to the master control node, then the master control node sends an instruction of sending firmware to the port number Y of the controlled node 1 to the controlled node 2 with the latest version number, and the controlled node 2 extracts self firmware and sends the firmware to the controlled node 1 after receiving the instruction; the controlled node 1 feeds back to the main control node after finishing receiving the firmware, then the main control node sends an instruction of 'start upgrading' to the controlled node 1, and the controlled node 1 executes the process of upgrading the firmware after receiving the instruction.
Specifically, as shown in fig. 3, the process of the master node election mechanism is as follows:
when the X1 intelligent equipment is accessed to a local area network or is initially started in the local area network, firstly operating with the identity of a controlled node, and broadcasting information which is received and responded by a main control node in the local area network so as to search the main control node in the local area network;
x2, judging whether the intelligent device receives the response of the main control node, if so, indicating that the main control node exists in the local area network, configuring the intelligent device as a controlled node, finishing election, if not, indicating that the main control node does not exist in the local area network temporarily, configuring the intelligent device as the main control node temporarily, and executing the next step;
and X3, the intelligent device broadcasts the information that only the master control node can receive and respond in the local area network again, judges whether the intelligent device receives the response of other master control nodes, if not, the intelligent device is formally configured as the master control node, the election is finished, if yes, the election fails, and the step X1-X3 is executed again to perform a new election process after a period of time with random parameters is delayed according to a set backoff mechanism.
In particular, the time T with a random parameter in the back-off mechanism is denoted as T ═ a × 2 (N-1) +rand[0,x]Wherein A is a set multiple parameter, N is election failure times, rand [0, x]Representing a random number generated between 0 and a set natural number x. When a plurality of intelligent devices are simultaneously accessed or simultaneously and initially started in a local area network, the back-off mechanism is skillfully adopted, so that the re-election time of different intelligent devices can be reset to be a random parameter, and the master control node can be elected and determined more quickly.
If the master control node is suddenly off-line in the operation process, in order to avoid information transmission conflict confusion, the following strategy configuration can be adopted: all the controlled nodes are configured to wait for a set time, such as 5 minutes, so that the master node is on line again; and if the main control node is not on-line again after the set time, all the controlled nodes carry out new main control node election according to the main control node election mechanism.
Example 2
The difference between this embodiment and embodiment 1 is that the master control node is further configured with an additional storage space for storing the firmware of other intelligent devices in the local area network except for the master control node;
after the master control node obtains the models and the version numbers of all the controlled nodes through tcp long-chain connection in step S200, judging whether the version number of each firmware in the extra storage space is the latest version number of the corresponding model, if not, obtaining the firmware with the latest version number of the model from the controlled node with the latest version number of the corresponding model for storage;
in step S300, the firmware for upgrading the non-latest version number of the smart device comes from the smart device with the latest version number of the corresponding model.
Specifically, the process of acquiring the firmware storage of the latest version number of the model from the controlled node of which the corresponding model has the latest version number is as follows: the master control node opens a designated port, sends a command of sending firmware to the designated port of the master control node to the controlled node with the corresponding model and the latest version number, extracts the firmware of the controlled node with the corresponding model and the latest version number and sends the firmware to the designated port of the master control node.
As shown in fig. 4, 1 master control node and 3 controlled nodes are determined in the current local area network, the master control node is configured with an extra storage space, in which the firmware of type 1 and type 2 are stored, and the version numbers are both 0; the controlled node 1 is of a model 1 and a version number 1, the controlled node 2 is of a model 1 and a version number 2, and the controlled node 3 is of a model 2 and a version number 3. The master control node and 3 controlled nodes establish tcp long links so as to transmit data information; then, all the 3 controlled nodes send self information to the main control node, and the self information at least comprises a model number and a version number. After receiving the information of the controlled node, the master control node selects an appropriate time according to a pre-configured strategy (such as idle upgrading and the like), calculates and determines the latest version number of each model in the current local area network by comparing the model and the version number information and judges whether the firmware version number in the extra storage space is the latest version number of the corresponding model, if the latest version number of the model 1 is 2, the latest version number of the model 2 is 3 and the firmware version number in the extra storage space is not the latest version number, the master control node determines that the controlled node 1 needs to be upgraded, the controlled node 2 and the controlled node 3 do not need to be upgraded and the firmware of the model 1 and the model 2 in the extra storage space needs to be upgraded; and then the master control node sends an instruction to the controlled node through the tcp long link for version synchronization, and in the version synchronization, updating the firmware in the extra storage space and updating the firmware of the controlled node can be performed in any sequence according to requirements. The process of updating the firmware of the controlled node is described in embodiment 1, and is not described herein again; the process of updating the firmware in the extra storage space is as follows: the master control node opens a random port with the port number of X, and respectively sends an instruction of sending firmware to the port number X of the master control node to the controlled node 2 and the controlled node 3, the controlled node 2 and the controlled node 3 extract the firmware of the controlled node and send the firmware to the master control node after receiving the instruction, and the master control node replaces the firmware with the corresponding model in the extra storage space after receiving the firmware to complete updating.
The method comprises the steps that a main control node firstly sends an instruction of opening a random port to prepare for receiving firmware to a controlled node 1 needing to be upgraded, the controlled node 1 opens a port with a port number Y after receiving the instruction and feeds back information of successfully opening the port with the port number Y to the main control node, then the main control node sends an instruction of sending the firmware to the port number Y of the controlled node 1 to a controlled node 2 with the latest version number, and the controlled node 2 extracts self firmware after receiving the instruction and sends the firmware to the controlled node 1; the controlled node 1 feeds back to the main control node after finishing receiving the firmware, then the main control node sends an instruction of 'start upgrading' to the controlled node 1, and the controlled node 1 executes the process of upgrading the firmware after receiving the instruction.
Example 3
The difference between this embodiment and embodiment 2 is that, on the basis that the master node is configured with an additional storage space, the firmware that updates the firmware of the intelligent device with the non-latest version number in step S300 comes from the additional storage space.
Specifically, the process of making the firmware of the non-latest version number of the smart device updated come from the extra storage space is as follows: the master control node sends an instruction for opening a port to prepare for receiving the firmware to a controlled node of the firmware to be received, and sends the firmware with the latest version number of the corresponding model in the extra storage space to the specified port of the controlled node after the controlled node feeds back the opened specified port.
As shown in fig. 5, on the basis that the main control node in embodiment 2 updates the firmware of the extra storage space, when a new controlled node 4 (model 2, version number 2) comes online, the controlled node 4 establishes a tcp long link with the main control node and sends its own information, where the own information at least includes the model and the version number. After receiving the information of the controlled node 4, the master control node calculates and determines that the latest version number of the model 2 in the current local area network is 3 by comparing the model number and the version number information according to a pre-configured strategy and opportunity, and the latest version number is located in the extra storage space of the master control node, so that the controlled node 4 needs to be upgraded; then the master control node sends an instruction to the controlled node 4 through the tcp long link for version synchronization, in the version synchronization, the master control node sends an instruction of opening a random port to prepare for receiving firmware to the controlled node 4 needing to be upgraded, the controlled node 4 opens a port with a port number Z after receiving the instruction and feeds back information of successfully opening the port with the port number Z to the master control node, then the master control node sends the firmware with the model 2 and the version 3 of the extra storage space to the port number Z of the controlled node 4, the controlled node 4 feeds back the information to the master control node after finishing receiving the firmware, then the master control node sends an instruction of starting upgrading to the controlled node 4, and the controlled node 4 executes the process of upgrading the firmware after receiving the instruction.
Example 4
The main difference between the embodiment and the embodiment 1 is that the main control node is configured with a visual human-computer interaction interface, and the visual human-computer interaction interface is used for a terminal user to upload a firmware with a specified model number and a specified version number on the main control node to upgrade a specified controlled node;
as shown in fig. 6, the process of using the visual human-computer interaction interface to upload the firmware with the specified model and version number to upgrade the corresponding controlled node is as follows:
after receiving the firmware uploaded by the terminal user, the main control node analyzes the firmware to obtain the version number and the corresponding model of the firmware; the firmware uploaded by the terminal user is temporarily stored in the memory of the main control node, and when the main control node is configured with an additional storage space, the firmware uploaded by the terminal user can be stored in the additional storage space;
listing all controlled nodes with the models matched with the firmware on the visual man-machine interaction interface according to the models and the version numbers of all intelligent devices recorded by the main control node;
and distributing the firmware to controlled nodes selected by the terminal user according to the selection feedback of the terminal user, upgrading the selected controlled nodes, and feeding the upgrading result back to the terminal user.
The process is mainly applied to uniformly upgrade all nodes in the local area network to the specified latest version in a manual active control mode and upgrade part of nodes in the local area network to the characteristic version under the condition that the versions are synchronously closed.
Example 5
The embodiment provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the above-mentioned local area network-based firmware upgrade method for a smart device. The method for upgrading the firmware of the intelligent equipment based on the local area network comprises the following steps:
s100, selecting a master control node from intelligent equipment with a function of extracting the firmware running in the local area network according to a master control node election mechanism, and configuring other intelligent equipment into a controlled node; the process of the master node election mechanism comprises the following steps:
when the X1 intelligent equipment is accessed to a local area network or is initially started in the local area network, firstly operating with the identity of a controlled node, and broadcasting information which is received and responded by a main control node in the local area network so as to search the main control node in the local area network;
x2, judging whether the intelligent device receives the response of the main control node, if so, indicating that the main control node exists in the local area network, configuring the intelligent device as a controlled node, finishing election, if not, indicating that the main control node does not exist in the local area network temporarily, configuring the intelligent device as the main control node temporarily, and executing the next step;
the X3, the intelligent device broadcasts the information that only the main control node can receive and respond in the local area network again, judges whether the response of other main control nodes is received, if not, the intelligent device is formally configured as the main control node, the election is finished, if yes, the election fails, and the step X1-X3 is executed again after a period of time with random parameters is delayed according to a set back-off mechanism to carry out the election process for a new time;
s200, establishing tcp long links between the master control node and all the controlled nodes, recording self information at least comprising models and version numbers of all the intelligent devices through the tcp long links, and determining the latest version number of each model of the intelligent devices in the current local area network;
s300, the main control node sends an instruction to each type of intelligent equipment with the latest version number respectively, extracts the firmware of the main control node and sends the instruction to other intelligent equipment with the same type and non-latest version number one by one, so that the other intelligent equipment with the same type and non-latest version number can upgrade the firmware to the latest version in the current local area network.
The computer program stored on the computer readable storage medium provided in this embodiment is not limited to the above method steps, and may also perform operations related to the method for upgrading firmware of an intelligent device based on a local area network provided in any embodiment of the present application.
The computer storage media of the embodiments of the present application may take any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or FLASH FLASH), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, or the like, as well as conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
In another embodiment, there is also provided an intelligent device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned local area network-based intelligent device firmware upgrade method when executing the computer program.
Through the process, the operation complexity is reduced, the upgrading efficiency is improved, and the bandwidth pressure of a terminal network and a server is reduced in the process of upgrading the intelligent equipment in the local area network; moreover, even if various intelligent devices with different models run in the local area network, corresponding upgrading can be realized, and the interoperability among the devices with different models is improved.
The following invention specifically introduces the method for upgrading the firmware of the intelligent equipment through the practical application process:
the invention comprehensively uses two transmission protocols of UDP and TCP, the master control node uses UDP transmission in the election stage, and all nodes monitor the broadcast information of other nodes at the UDP 1835 port. After the master node finishes election, the master node starts to monitor a TCP 1835 port for establishing TCP connection with a controlled node. All controlled nodes close the UDP 1835 port and in turn establish a TCP connection with the master node. Meanwhile, the master control node keeps monitoring the UDP 1835 port so as to receive and respond to the UDP message of the new device when the new device accesses the network.
When the versions are synchronous or local upgrade is carried out, the intelligent equipment transmits firmware by using a TCP protocol, a receiver firstly opens a random TCP port for monitoring and waits for a sender to establish connection. After the TCP connection is established, the sender starts to send the firmware, and after the firmware transmission is finished, the sender should actively disconnect. If the TCP connection is accidentally disconnected in the transmission process, the receiving and transmitting parties also regard the firmware transmission as complete, and follow-up operation is continued. After the transmission is finished, the receiver checks the integrity and the adaptability of the firmware (the adaptability refers to whether the firmware is adapted to the current device).
Regarding the message format, except for firmware transmission, all communication messages adopt a unified TLV format. The message format is defined as follows:
msg_type|msg_len|payload 1|……|payload N
in the present protocol, all data is in network endianness and the string must contain the end character '\ 0'.
msg _ type: message type, 4-byte integer, specifically defined as:
Figure BDA0003666649760000131
Figure BDA0003666649760000141
regarding the firmware format, in order to enhance the user experience of the native upgrade function in the master mode, it is recommended (not mandatory) to package the firmware in the following way.
Figure BDA0003666649760000151
Note: the above firmware packaging manner is derived from OpenWRT, which is described in detail in OpenWRT fwtool source code.
Metadata should be in json format, should contain at least the up _ model field for marking the device model to which the firmware corresponds, and may contain other custom fields. For example, a valid metadata may be { "up _ model", "Stonet-N6E", "supported _ devices" ", [" mt7621-rfb-ax-nor "]," version ": 1.3.0.1" }.
The application comprises the following steps:
configuring a scene that a router with a model NETCORE-N6 exists in a local area network; the models of the two wireless repeaters are NETCORE-R1200, the version numbers are 1.0.0.0, and the network topology is as shown in FIG. 7. The three devices are started simultaneously, and the master control node election is started. Assuming that the final router elects as the master control node, then the user upgrades the relay 1 to the version 1.0.0.1 through the router management page, and finally the router upgrades the relay 2 to 1.0.0.1 through the version synchronization, the specific implementation steps of the process are as follows:
step 1, according to the main control node election mechanism flow, three devices set themselves as controlled nodes and send broadcast messages at the same time, wherein the broadcast messages are as follows:
the router: 000000000000003700000000000000134 e4554434f52452d4e 3600000000020000000 c 000000020000000100000008322 e312e302e3000
1-4 bytes, message TYPE, value 00000000, i.e. MSG _ TYPE _ DISCOVER
5-8 bytes, total message length, value 00000037, so the total message length is 55 bytes
9-12 bytes, load TYPE, value 00000000, PAYLOAD _ TYPE _ MODEL
13-16 bytes, payload length, value 00000013, so the payload length is 19 bytes
17-27 bytes, value 4e4554434f52452d4e3600, device model NETCORE-N6
28-31 bytes, load TYPE, value 00000002, PAYLOAD _ TYPE _ ROLE
32-35 bytes, load length, value 0000000c, so the load length is 12 bytes
36-39 bytes, value 00000002, so the device role is 2, i.e. the controlled node.
40-43 bytes, load TYPE, value 00000001, PAYLOAD _ TYPE _ VERSION
44-47 bytes, load length, value 00000008, so load length is 8 bytes
48-55 bytes, value 322e312e302e3000, i.e. version number 2.1.0.0.
A repeater: 000000000000003 a 00000000000000164 e4554434f52452d 523132303000000000020000000 c 000000020000000100000008312 e302e302e3000
The structure of the repeater message is the same as that of the router, but the field value of the model is NETCORE-R1200, and the version is 1.0.0.0.
And 2, no master control node exists in the current network, so that the three devices do not receive a response from the master control node after sending the broadcast message, and all the three devices set the three devices as the master control nodes and send the broadcast message again (except that the role value of the device is changed to 00000001, other contents in the message are consistent with those in the step 1).
And 3, after the message is sent in the step 2, the three devices receive and respond to the broadcast messages of the other two devices. At this point, the first round of elections is finished with failure, and each node sets itself as the controlled node again.
And 4, after the first round of election fails, starting a back-off mechanism by each node, and sleeping 5 x2 (N-1) +rand[0,10]The next round of election begins after a second. And N is the failure times, and when N is greater than 6, 6 is always selected, so that the delay waiting time is avoided from being too long. rand [0,10 ]]Refers to a random number between 0 and 10.
And 5, supposing that the router sleeps for 15 seconds and the relays 1 and 2 both sleep for 7 seconds according to the calculation in the step 4. After 7 seconds, the repeaters 1 and 2 repeat the above steps 1 to 4 and fail to sleep again. After 15 seconds, the router repeats the steps 1 and 2, and at this time, because the relays 1 and 2 are controlled nodes, the router sets itself as a master node.
And 6, after the second dormancy of the repeaters 1 and 2 is finished, repeating the step 1 again, and obtaining the response of the main control node router, thereby setting the repeaters as controlled nodes. And the master control node election is finished, and the router is elected as the master control node finally.
And 7, the relays 1 and 2 establish tcp long connection with the router respectively, and periodically send self information to the router through the tcp long connection, wherein the content of the message is consistent with that in the step 1.
And 8, the router records and maintains the IP addresses, the models and the version information of the repeaters 1 and 2 respectively.
And 9, uploading the firmware of the repeater by the user through the router management page, and analyzing the firmware by the router to obtain metadata of { "up _ model": NETCORE-R1200 { (version): 1.0.0.1 }, so that the firmware is suitable for the NETCORE-R1200. The router lists all the upgradeable nodes, i.e. relays 1, 2 on the page, and the user finally selects relay 1 for upgrade.
Step 10, the router sends the following messages to the repeater 1 through tcp long connection, and requires the repeater 1 to prepare to receive firmware:
00000002 00000014 00000003 0000000c c0a80101
1-4 bytes, message TYPE, value 00000002, MSG _ TYPE _ CMD _ FIRMWARE _ RECV
5-8 bytes, total message length, value 00000014, so the total message length is 20 bytes
9-12 bytes, load TYPE, value 00000003, PAYLOAD _ TYPE _ IP
13-16 bytes, load length, value 0000000c, so load length is 12 bytes
17-20 bytes, the value c0a80101, i.e. the IP address is 192.168.1.1. This load indicates that the repeater 1 will only receive firmware from the IP during the subsequent firmware transmission.
Step 11, after receiving the message, the relay 1 opens a tcp random port (assumed to be 2000), and replies an ACK message as follows:
00000003 00000012 00000004 0000000a 07d0
1-4 bytes, message TYPE, value 00000003, MSG _ TYPE _ ACK _ FIRMWARE _ RECV
5-8 bytes, total length of message, value 00000012, so the total length of message is 18 bytes
9-12 bytes, load TYPE, value 00000004, i.e., PAYLOAD _ TYPE _ PORT
13-16 bytes, load length, value 0000000a, so the load length is 10 bytes
17-18 bytes, value 07d0, i.e., port number 2000.
And step 12, connecting the router with the 1tcp 2000 port of the repeater, sending the firmware through the connection, and closing the connection after the completion. The repeater sends a message to the router to inform the firmware of completing receiving, wherein the message is as follows:
00000004 00000008
1-4 bytes, message TYPE, value 00000004, MSG _ TYPE _ FIRMWARE _ RECV _ DONE
5-8 bytes, the total length of the message, value 00000008, the total length of the message is 8 bytes, so the message is not loaded.
Step 13, the router sends a message to inform the repeater 1 to start burning the firmware, and the message is as follows:
00000005 00000008
1-4 bytes, message TYPE, value 00000005, MSG _ TYPE _ CMD _ FIRMWARE _ BURN
5-8 bytes, the total length of the message, value 00000008, the total length of the message is 8 bytes, so the message has no load.
And step 14, automatically restarting and rejoining the network after the repeater 1 is upgraded, wherein the version number of the repeater 1 is 1.0.0.1, and the version number of the repeater 2 is 1.0.0.0. The router synchronizes the firmware of the repeater 1 to the repeater 2 at the appropriate time according to the configuration policy to upgrade the repeater 2.
Step 15, when the FIRMWARE is synchronized, the router first sends an MSG _ TYPE _ CMD _ fixed _ RECV message to the relay 2, and the relay 2 replies the MSG _ TYPE _ ACK _ fixed _ RECV message, where the message content is the same as steps 10 and 11, and is not described here again. Then the router informs the repeater 1 to send the firmware to the repeater 2 again, and the message is as follows:
00000001 0000001e 00000003 0000000c c0a80103 00000004 0000000a 07d0
1-4 bytes, message TYPE, value 00000001, MSG _ TYPE _ QUERY _ FIRMWARE
5-8 bytes, total length of message, value 0000001e, so the total length of message is 30 bytes
9-12 bytes, load TYPE, value 00000003, PAYLOAD _ TYPE _ IP
13-16 bytes, load length, value 0000000c, so load length is 12 bytes
17-20 bytes, value c0a80103, so the destination IP is 192.168.1.3
21-24 bytes, load TYPE, value 00000004, i.e., PAYLOAD _ TYPE _ PORT
25-28 bytes, load length, value 0000000a, so the load length is 10 bytes
29-30 bytes, value 07d0, i.e. port number 2000.
Step 16, after receiving the MSG _ TYPE _ QUERY _ FIRMWARE message, the repeater 1 first extracts its FIRMWARE, and then sends the FIRMWARE to the destination IP and port specified in the message.
Step 17, the relay 2 sends the MSG _ TYPE _ FIRMWARE _ RECV _ DONE message to the router after receiving the FIRMWARE (same as step 12), the router sends the MSG _ TYPE _ CMD _ FIRMWARE _ sink to the relay 2 (same as step 13), the relay 2 starts burning the FIRMWARE, and finally the version synchronization is completed.
The above-described embodiments are only preferred embodiments of the present invention, and are not intended to limit the scope of the present invention, but all changes that can be made by applying the principles of the present invention and performing non-inventive work on the basis of the principles shall fall within the scope of the present invention.

Claims (10)

1. A method for upgrading firmware of an intelligent device based on a local area network is characterized by comprising the following steps:
s100, selecting a master control node from intelligent equipment with a function of extracting the firmware running in the local area network according to a master control node election mechanism, and configuring other intelligent equipment into a controlled node;
s200, establishing tcp long links between the master control node and all the controlled nodes, recording the models and the version numbers of all the intelligent devices, and determining the latest version number of each model of the intelligent devices in the current local area network;
s300, the main control node sends an instruction to each intelligent device with the latest version number, extracts the firmware of the main control node and sends the firmware to other intelligent devices with the same type and the latest version number one by one, so that the other intelligent devices with the same type and the latest version number can upgrade the firmware to the latest version in the current local area network.
2. The method according to claim 1, wherein in step S300, the master node first sends an instruction to open a port to prepare for receiving the firmware to the controlled node that is to receive the firmware, and after the controlled node feeds back the opened designated port, sends an instruction to send the firmware to the designated port of the designated controlled node to the controlled node of the model with the latest version number, and the controlled node of the model with the latest version number extracts its own firmware and sends the firmware to the designated port of the designated controlled node.
3. The local area network-based firmware upgrading method for intelligent devices, according to claim 2, wherein the master control node instructs the designated controlled node to execute firmware upgrading operation after receiving feedback that the designated controlled node completes firmware reception.
4. The local area network-based intelligent device firmware upgrading method according to claim 1, wherein the master control node is further configured with an additional storage space for storing firmware of other intelligent devices in the local area network except the master control node;
after the master control node obtains the models and the version numbers of all the controlled nodes through tcp long-chain connection in step S200, judging whether the version number of each firmware in the extra storage space is the latest version number of the corresponding model, if not, obtaining the firmware with the latest version number of the model from the controlled node with the latest version number of the corresponding model for storage;
in step S300, the firmware for upgrading the firmware of the intelligent device with the non-latest version number comes from the extra storage space or the intelligent device with the latest version number of the corresponding model.
5. The method for upgrading firmware of intelligent equipment based on local area network according to claim 4, wherein the process of obtaining the firmware storage of the latest version number of the model from the controlled node of the corresponding model with the latest version number is as follows: the master control node opens a designated port, sends a command of sending firmware to the designated port of the master control node to the controlled node with the corresponding model and the latest version number, extracts the firmware of the controlled node with the corresponding model and the latest version number and sends the firmware to the designated port of the master control node.
6. The method for upgrading firmware of intelligent equipment based on local area network according to claim 4, wherein the process of making the firmware of the intelligent equipment with non-latest version number come from the extra storage space is as follows: the main control node sends an instruction for opening a port to prepare for receiving the firmware to a controlled node to receive the firmware, and after the controlled node feeds back the opened designated port, the main control node sends the firmware with the latest version number of the corresponding model in the extra storage space to the designated port of the controlled node.
7. The method for upgrading firmware of intelligent equipment based on local area network according to any one of claims 1 to 6, wherein the process of the master node election mechanism in step S100 is as follows:
when the X1 intelligent equipment is accessed to a local area network or is initially started in the local area network, firstly operating with the identity of a controlled node, and broadcasting information which is received and responded by a main control node in the local area network so as to search the main control node in the local area network;
x2, judging whether the intelligent device receives the response of the main control node, if so, indicating that the main control node exists in the local area network, configuring the intelligent device as a controlled node, finishing election, if not, indicating that the main control node does not exist in the local area network temporarily, configuring the intelligent device as the main control node temporarily, and executing the next step;
and X3, the intelligent device broadcasts the information that only the master control node can receive and respond in the local area network again, judges whether the intelligent device receives the responses of other master control nodes, if not, the intelligent device is formally configured as the master control node, the election is finished, if so, the election fails, and the step X1-X3 is executed again after a period of time with random parameters is delayed according to a set back-off mechanism to carry out the election process for a new time.
8. The local area network-based smart device firmware upgrade method according to claim 7, wherein a time T with a random parameter in the backoff mechanism is denoted as T ═ a × 2 (N-1) +rand[0,x]Wherein A is a set multiple parameter, N is election failure times, rand [0, x]Representing a random number generated between 0 and a set natural number x.
9. The local area network-based intelligent device firmware upgrading method according to any one of claims 1 to 6, wherein the master control node is further configured with a visual human-computer interaction interface, and is used for a terminal user to upload a firmware of a specified model and version number on the master control node by using the visual human-computer interaction interface to upgrade a specified controlled node;
the process of upgrading the appointed controlled node by using the visual human-computer interaction interface to upload the firmware with the appointed model number and the edition number is as follows:
after receiving the firmware uploaded by the terminal user, the main control node analyzes the firmware to obtain the version number and the corresponding model of the firmware;
listing all controlled nodes with the models matched with the firmware on the visual man-machine interaction interface according to the models and the version numbers of all intelligent devices recorded by the main control node;
and distributing the firmware to controlled nodes selected by the terminal user according to the selection feedback of the terminal user, upgrading the selected controlled nodes, and feeding the upgrading result back to the terminal user.
10. A computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the method for firmware upgrade of a local area network-based smart device according to any one of claims 1 to 9.
CN202210593498.1A 2022-05-27 2022-05-27 Intelligent device firmware upgrading method based on local area network and storage medium Active CN114978906B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210593498.1A CN114978906B (en) 2022-05-27 2022-05-27 Intelligent device firmware upgrading method based on local area network and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210593498.1A CN114978906B (en) 2022-05-27 2022-05-27 Intelligent device firmware upgrading method based on local area network and storage medium

Publications (2)

Publication Number Publication Date
CN114978906A true CN114978906A (en) 2022-08-30
CN114978906B CN114978906B (en) 2024-05-07

Family

ID=82957545

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210593498.1A Active CN114978906B (en) 2022-05-27 2022-05-27 Intelligent device firmware upgrading method based on local area network and storage medium

Country Status (1)

Country Link
CN (1) CN114978906B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020188934A1 (en) * 2001-06-12 2002-12-12 Nortel Networks Limited Method and system for upgrading existing firmware on third party hardware
CN101778097A (en) * 2009-11-25 2010-07-14 中兴通讯股份有限公司 Network updating method and system and main service side used for realizing network upgrade
CN103945263A (en) * 2014-04-25 2014-07-23 深圳市九洲电器有限公司 Set top box upgrading method and system
CN104301395A (en) * 2014-09-25 2015-01-21 深圳市同洲电子股份有限公司 Method, electronic equipment and system for upgrading devices automatically
CN110022333A (en) * 2018-01-09 2019-07-16 阿里巴巴集团控股有限公司 The communication means and device of distributed system
CN111541564A (en) * 2020-04-16 2020-08-14 网经科技(苏州)有限公司 Method for upgrading equipment firmware in Mesh network
CN113672259A (en) * 2021-08-17 2021-11-19 浪潮思科网络科技有限公司 Intelligent software upgrading method and equipment for distributed network equipment
CN114115939A (en) * 2021-11-10 2022-03-01 广州易而达科技股份有限公司 Firmware upgrading method and device, electronic equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020188934A1 (en) * 2001-06-12 2002-12-12 Nortel Networks Limited Method and system for upgrading existing firmware on third party hardware
CN101778097A (en) * 2009-11-25 2010-07-14 中兴通讯股份有限公司 Network updating method and system and main service side used for realizing network upgrade
CN103945263A (en) * 2014-04-25 2014-07-23 深圳市九洲电器有限公司 Set top box upgrading method and system
CN104301395A (en) * 2014-09-25 2015-01-21 深圳市同洲电子股份有限公司 Method, electronic equipment and system for upgrading devices automatically
CN110022333A (en) * 2018-01-09 2019-07-16 阿里巴巴集团控股有限公司 The communication means and device of distributed system
CN111541564A (en) * 2020-04-16 2020-08-14 网经科技(苏州)有限公司 Method for upgrading equipment firmware in Mesh network
CN113672259A (en) * 2021-08-17 2021-11-19 浪潮思科网络科技有限公司 Intelligent software upgrading method and equipment for distributed network equipment
CN114115939A (en) * 2021-11-10 2022-03-01 广州易而达科技股份有限公司 Firmware upgrading method and device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
贺晓春: "基于C/S模式的客户端软件自动升级设计与实现", 自动化与仪器仪表, no. 3, 25 March 2017 (2017-03-25), pages 137 - 139 *

Also Published As

Publication number Publication date
CN114978906B (en) 2024-05-07

Similar Documents

Publication Publication Date Title
US7539488B2 (en) Over-the-air download (OAD) methods and apparatus for use in facilitating application programming in wireless network devices of ad hoc wireless communication networks
US7814478B2 (en) Methods and apparatus for use in updating application programs in memory of a network device
CN111541564B (en) Method for upgrading equipment firmware in Mesh network
KR101481443B1 (en) A method for management device in a communication network and a system thereof
JP2004534994A (en) Synchronizing database data
CN109286542A (en) A kind of wireless device group cut-in method and terminal based on NB-IOT
CN112737847B (en) Node upgrading method and device, storage medium and electronic device
CN112995269A (en) Data processing method, computer device and readable storage medium
US10489055B2 (en) Z-wave controller shift in thermostats
CN111585801A (en) ZigBee device upgrading method and related device
CN112003943A (en) Voice data synchronization method and device
CN112202877A (en) Gateway linkage method, gateway, cloud server and user terminal
CN109361528A (en) A kind of firmware upgrade method and intelligent appliance
CN110706426A (en) Method and system for managing USB tax control disk
CN114915671A (en) NB-IoT-based remote upgrading method for street lamp controller
WO2014169589A1 (en) Intelligent terminal synchronous operation method and device
CN114172756A (en) Version upgrading method and system for intelligent equipment electronic control firmware
CN114978906B (en) Intelligent device firmware upgrading method based on local area network and storage medium
US6883169B1 (en) Apparatus for managing the installation of software across a network
CN113516980A (en) Scene linkage method, and scene linkage system construction method and device
US20040249923A1 (en) Efficient home network management system and method
CN110149398B (en) User management method for intelligent door lock of intelligent home
CN111866856A (en) Mesh device control method and system, storage medium and electronic device
WO2021203384A1 (en) Device upgrade method and apparatus, and storage medium
CN105071953A (en) Internet-of-things intelligent equipment firmware and application upgrading method

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
GR01 Patent grant
GR01 Patent grant