Terminal equipment upgrading method and device, electronic equipment and readable storage medium
By using a dual-control-channel architecture to process firmware upgrades and user commands in parallel, the problem of insufficient response to user commands during terminal device upgrades is solved, achieving a seamless user experience and state synchronization.
Patent Information
- Application Number
- CN202510950718.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-10
- Publication Date
- 2025-11-21
AI Technical Summary
During the firmware upgrade process of a terminal device, the main processor may be occupied, causing it to be unable to respond to user commands, which affects the user experience and may cause security risks.
It adopts a dual control channel architecture. The first control channel is responsible for firmware upgrades, and the second control channel is responsible for user command processing. They are connected through a serial peripheral interface to enable parallel operation, including real-time queue management, differential status packet synchronization, and heartbeat packet verification to ensure status consistency.
User commands can still be processed in real time during firmware upgrades, avoiding control interruptions, ensuring user experience, and maintaining the consistency of terminal device status.
Smart Images

Figure CN120994229A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of Internet, in particular to a terminal device upgrading method, a terminal device upgrading apparatus, an electronic device and a computer readable storage medium. BACKGROUND
[0002] Terminal devices (such as smart lights, smart sockets, etc.) optimize functions, repair vulnerabilities or enhance security through firmware upgrading. However, in the related technical solutions, the main processor of the terminal device is usually occupied during the firmware upgrading process of the terminal device, resulting in suspension of responding to user instructions. For example, the smart light cannot be turned on or off during upgrading, and the smart socket may interrupt timing tasks during upgrading, the control interruption of the terminal device reduces user experience, and in some critical scenarios, the control terminal may cause inconvenience, even safety hazards. SUMMARY
[0003] In view of the above problems, a terminal device upgrading method, apparatus, electronic device and readable storage medium are provided to overcome the above problems or at least partially solve the above problems. The specific technical solutions are as follows:
[0004] Embodiments of the present application disclose a terminal device upgrading method, the terminal device comprising at least two control channels, the control channels comprising at least a first control channel and a second control channel, wherein the second control channel is used to execute user instructions received by the terminal device during firmware upgrading, and the method comprises:
[0005] triggering the terminal device to trigger upgrading, and recording key state variables of the terminal device through the first control channel;
[0006] during the process of controlling firmware upgrading of the terminal device through the first control channel, switching to control the terminal device through the second control channel;
[0007] when receiving a user instruction, processing the user instruction through the second control channel;
[0008] when firmware upgrading of the terminal device controlled through the first control channel is completed, switching to control the terminal device through the first control channel, and restoring the terminal device after firmware upgrading to the key state variables.
[0009] In an embodiment of the present application, the first control channel and the second control channel are two independent control channels; the first control channel and the second control channel are connected through a serial peripheral interface; the firmware of the second control channel is simpler than that of the first control channel.
[0010] In an embodiment of the present application, the processing the user instruction through the second control channel comprises:
[0011] When the user instruction is a first preset priority instruction, buffering the user instruction into a real-time queue and executing the user instruction in the real-time queue through the second control channel;
[0012] When the user instruction is a second preset priority instruction, discarding the user instruction through the second control channel;
[0013] When the user instruction is neither the first preset priority instruction nor the second preset priority instruction, buffering the user instruction into a buffer queue through the second control channel; the user instruction in the buffer queue is executed through the first control channel when the firmware upgrade of the terminal device is completed.
[0014] In an embodiment of the present application, during the process of controlling the firmware upgrade of the terminal device through the first control channel, after switching to control the terminal device through the second control channel, the method further comprises:
[0015] receiving a differential state packet sent by the first control channel through the second control channel; the differential state packet is sent by the first control channel when a preset progress is completed;
[0016] performing a cyclic redundancy check on the differential state packet;
[0017] when the cyclic redundancy check on the differential state packet is successful, synchronizing the upgrade progress and the key state variable of the terminal device of the second control channel and the first control channel according to the differential state packet through the second control channel.
[0018] In an embodiment of the present application, during the process of controlling the firmware upgrade of the terminal device through the first control channel, after switching to control the terminal device through the second control channel, the method further comprises:
[0019] sending a heartbeat packet to the first control channel through the second control channel; the heartbeat packet is sent at a preset time interval; the first control channel is used to resend a differential state packet to the second control channel when it is determined according to the heartbeat packet that the upgrade progress and / or the key state variable of the terminal device of the second control channel and the first control channel are inconsistent.
[0020] In an embodiment of the present application, when the firmware upgrade of the terminal device controlled by the first control channel is completed, the terminal device is switched to be controlled by the first control channel, and the terminal device after the firmware upgrade is restored to the critical state variable, comprising:
[0021] When the firmware upgrade of the terminal device controlled by the first control channel is completed, a hardware trigger signal is received by the second control channel;
[0022] The second control channel switches to use the firmware of the terminal device after the upgrade according to the hardware trigger signal, and switches to control the terminal device by the first control channel, and restores the terminal device after the firmware upgrade to the critical state variable.
[0023] In an embodiment of the present application, the method further comprises:
[0024] Obtaining the network state of the terminal device;
[0025] Adjusting the size of the firmware upgrade data block obtained from the cloud server according to the network state;
[0026] Obtaining the firmware upgrade data block of the size from the cloud server to control the firmware upgrade of the terminal device by the first control channel according to the firmware upgrade data block.
[0027] In an embodiment of the present application, obtaining the firmware upgrade data block of the size from the cloud server to control the firmware upgrade of the terminal device by the first control channel according to the firmware upgrade data block, comprising:
[0028] Obtaining the firmware upgrade data block of the size from the cloud server;
[0029] Performing cyclic redundancy check on the firmware upgrade data block;
[0030] When the cyclic redundancy check of the firmware upgrade data block is successful, controlling the firmware upgrade of the terminal device by the first control channel according to the firmware upgrade data block;
[0031] When the cyclic redundancy check of the firmware upgrade data block fails, returning to perform the step of obtaining the firmware upgrade data block of the size from the cloud server.
[0032] In an embodiment of the present application, the method further comprises:
[0033] When the number of firmware-updated terminal devices in the specified area is less than or equal to the number of firmware-unupdated terminal devices, a target terminal device is determined from the firmware-updated terminal devices, firmware upgrade data blocks are acquired from the target terminal device, and firmware upgrade of the terminal device is controlled according to the firmware upgrade data blocks through the first control channel.
[0034] When the number of firmware-updated terminal devices in the specified area is greater than the number of firmware-unupdated terminal devices, firmware upgrade data blocks are acquired from the firmware-updated terminal devices, and firmware upgrade of the terminal device is controlled according to the firmware upgrade data blocks through the first control channel.
[0035] The embodiment of the present application also discloses a terminal device upgrading device, the terminal device comprising at least two control channels, the control channels comprising at least a first control channel and a second control channel, wherein the second control channel is used to execute a user instruction received by the terminal device during firmware upgrade, and the device comprises:
[0036] An acquisition module is configured to trigger the terminal device to trigger upgrade, and record key state variables of the terminal device through the first control channel.
[0037] A first switching module is configured to switch to control the terminal device through the second control channel in the process of controlling firmware upgrade of the terminal device through the first control channel.
[0038] A processing module is configured to process the user instruction through the second control channel when the user instruction is received.
[0039] A second switching module is configured to switch to control the terminal device through the first control channel when firmware upgrade of the terminal device through the first control channel is completed, and restore the terminal device after firmware upgrade to the key state variables.
[0040] The embodiment of the present application also discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus.
[0041] The memory is used to store a computer program.
[0042] The processor is used to execute the program stored on the memory, and realize the method as described in the embodiment of the present application.
[0043] The embodiment of the present application also discloses a computer program product stored in a storage medium, and the computer program product is executed by at least one processor to realize the method as described in the embodiment of the present application.
[0044] The application also discloses a computer readable storage medium, which stores instructions, and when the instructions are executed by one or more processors, the processors execute the method.
[0045] The application has the following advantages:
[0046] In the application, the terminal device comprises at least two control channels, including at least a first control channel and a second control channel, the second control channel is used to execute a user instruction received by the terminal device during firmware upgrade, the key state variable of the terminal device can be recorded through the first control channel when the terminal device is triggered to upgrade, the terminal device can be controlled through the second control channel during the process of controlling the firmware upgrade of the terminal device through the first control channel, the user instruction can be processed through the second control channel if the user instruction is received, finally, the terminal device can be controlled through the first control channel again when the firmware upgrade of the terminal device through the first control channel is completed, and the terminal device after firmware upgrade is restored to the key state variable. In the application, the terminal device is controlled to upgrade firmware through the first control channel during the process of firmware upgrade of the terminal device, and the user instruction is received and processed through the second control channel, so that the user instruction can be processed in real time during the firmware upgrade of the terminal device, the control of the terminal device is not interrupted, and the user experience is ensured. Meanwhile, the key state variable can be recorded before the firmware upgrade of the terminal device, and the recorded key state variable can be used to realize synchronization after the firmware upgrade of the terminal device, so that the consistency of the key state variable of the terminal device is ensured. BRIEF DESCRIPTION OF DRAWINGS
[0047] Figure 1 is a step flow chart of a terminal device upgrade method provided in the application;
[0048] Figure 2 is a schematic diagram of a dual-channel parallel control system architecture provided in the application;
[0049] Figure 3 is a flow chart of a firmware upgrade of a smart home device provided in the application;
[0050] Figure 4 is a structural block diagram of a terminal device upgrade device provided in the application;
[0051] Figure 5 is a schematic diagram of a hardware structure of an electronic device for implementing various embodiments of the application. DETAILED DESCRIPTION
[0052] In order to make the above objectives, features and advantages of the present application more obvious and comprehensible, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0053] With reference to Figure 1 , a flow chart of steps of a terminal device upgrading method provided in an embodiment of the present application is shown, the terminal device comprising at least two control channels, the control channels comprising at least a first control channel and a second control channel, wherein the second control channel is used to execute a user instruction received by the terminal device during firmware upgrading, and the method can specifically comprise the following steps:
[0054] Step 101, triggering the terminal device to trigger upgrading, and recording key state variables of the terminal device through the first control channel.
[0055] In an embodiment of the present application, the terminal device can be a smart home device or other device, and exemplarily, the terminal device can comprise at least an air conditioner device, a smart lamp, a smart socket, a lighting device, a dehumidifier, a switch, a socket, a sensor device, a smoke alarm, a smart door lock, a security camera and the like. The terminal device can comprise at least two control channels, and the control channels can comprise at least a first control channel and a second control channel. The first control channel and the second control channel are two independent control channels, and the first control channel and the second control channel are connected through SPI (Serial Peripheral Interface). The firmware of the second control channel is simpler than that of the first control channel. The first control channel can be a main control channel, and the second control channel can be an auxiliary control channel. The second control channel is used to execute a user instruction received by the terminal device during firmware upgrading, such as a user instruction about turning on, turning off, timing and the like. In order to facilitate the description, the smart home device is mainly taken as an example for description, and of course, the terminal device of the present embodiment is not limited to the smart home device.
[0056] With reference to Figure 2Fig. 1 is a schematic diagram of a dual-channel parallel control system architecture provided in an embodiment of the present application, the system architecture comprising a server (cloud server) and a terminal device, wherein the terminal device can be composed of a main control channel, an auxiliary control channel, a communication module, an instruction queue module and a state synchronization module. Specifically, the main control channel is responsible for normal operation of smart home devices, firmware download and installation, etc., and runs complete function logic; the auxiliary control channel is a special module for smart home devices, and runs a minimalist firmware, and only handles user instructions during firmware upgrade of the smart home devices. The main control channel and the auxiliary control channel are connected through a high-speed SPI interface, so that when the control right of the terminal device is switched between the two channels, the switching delay is low. The communication module supports bidirectional communication between the smart home device and the cloud server and a mobile phone APP (Application, application program); the instruction queue module adopts a double-buffering design to separately manage real-time user instructions and delayed user instructions; and the state synchronization module ensures the state consistency between the main control channel and the auxiliary control channel. Among them, the cloud server is responsible for firmware distribution, and can use block checking to reduce bandwidth requirements, i.e., firmware upgrade data used for firmware upgrade of the terminal device can be divided into multiple firmware upgrade data blocks, and then the firmware upgrade data blocks are sent to the terminal device, so that the terminal device can perform firmware upgrade based on the firmware upgrade data blocks.
[0057] Among them, the main control channel adopts an MCU (Microcontroller Unit, microcontroller unit), such as a 32-bit ARM Cortex-M4, the auxiliary control channel adopts a low-power MCU, such as an 8-bit AVR, and the main control channel and the auxiliary control channel can communicate through a 1 Mbps (Megabit per second, megabit per second) SPI interface, with logic isolation and power sharing. The auxiliary control channel can independently run and report to the cloud server in case of exception. The embodiment of the present application only needs a small amount of hardware modification, has low cost, and is suitable for various smart home devices.
[0058] In the embodiment of the present application, when the smart home device triggers the firmware upgrade, the cloud server pushes a new firmware notification, and after the smart home device confirms the new firmware notification, the smart home device enters an upgrade mode to perform the firmware upgrade. Before the firmware upgrade is performed, the smart home device has control over a first control channel. At this time, the current key state variables of the smart home device can be recorded through the first control channel. The key state variables refer to key operating parameters of the smart home device at a certain time. The key state variables of the smart home device can include key state variables (such as switch states), timing tasks (such as countdown remaining time), network configurations (such as WiFi connection keys), and the like. For example, assuming that the temperature of the air conditioner device is set to 23 degrees before the firmware upgrade is performed, the temperature of 23 degrees can be recorded as the current key state variable of the air conditioner device.
[0059] Step 102, in the process of controlling the firmware upgrade of the terminal device through the first control channel, switching to control the terminal device through the second control channel.
[0060] Step 103, when receiving a user instruction, processing the user instruction through the second control channel.
[0061] In the embodiment of the present application, the smart home device can be controlled to perform the firmware upgrade through the first control channel. In the process of controlling the smart home device to perform the firmware upgrade through the first control channel, the first control channel can focus on the firmware upgrade and does not respond to other operations at this time. For example, if the smart home device receives a user instruction, the first control channel does not process the user instruction.
[0062] In addition, the smart home device can be switched to be controlled through the second control channel, so that the user instruction can be received through the second control channel and processed accordingly according to the user instruction. The processing of the user instruction can include but is not limited to real-time processing, buffering, and / or discarding.
[0063] Step 104, when the firmware upgrade of the terminal device through the first control channel is completed, switching to control the terminal device through the first control channel, and restoring the terminal device after the firmware upgrade to the key state variables.
[0064] In the embodiment of the present application, when the firmware upgrade of the smart home device through the first control channel is completed, the smart home device can be switched to continue to be controlled through the first control channel. At this time, the smart home device after the firmware upgrade can be restored to the key state variables. For example, the temperature of the air conditioner device is originally 23 degrees. If the key state variables do not change during the firmware upgrade, the temperature of the air conditioner device can continue to be maintained at 23 degrees.
[0065] In the related technical solutions, some high-end devices use dual-core processors to realize separated firmware upgrade and user instruction processing, but the cost is high and the low-cost demand of smart home devices is not met. The embodiment of the present application separates firmware upgrade and user instruction processing through a main control channel and an auxiliary control channel, realizes parallel running of the two, only needs a small amount of hardware modification, has low cost, and is suitable for various smart home devices.
[0066] In the embodiment of the present application, the terminal device includes at least two control channels, including at least a first control channel and a second control channel, wherein the second control channel is used to execute user instructions received by the terminal device during firmware upgrade, the key state variables of the terminal device can be recorded through the first control channel when the terminal device is triggered to upgrade, the terminal device can be controlled through the second control channel during firmware upgrade of the terminal device controlled through the first control channel, if the user instructions are received, the user instructions can be processed through the second control channel, finally, when the firmware upgrade of the terminal device controlled through the first control channel is completed, the terminal device can be controlled through the first control channel again, and the terminal device after firmware upgrade is restored to the key state variables. In the process of firmware upgrade of the terminal device, the terminal device is controlled through the first control channel for firmware upgrade, and the user instructions are received and processed through the second control channel, so that the user instructions can be processed in real time during firmware upgrade of the terminal device, the control of the terminal device is not interrupted, and the user experience is ensured. At the same time, the key state variables can be recorded before firmware upgrade of the terminal device, and synchronization can be realized through the recorded key state variables after firmware upgrade of the terminal device, so that the consistency of the key state variables of the terminal device is ensured.
[0067] In one embodiment of the present application, the step 103 of processing the user instructions through the second control channel can include:
[0068] When the user instructions are first preset priority instructions, the user instructions are buffered into a real-time queue, and the user instructions in the real-time queue are executed through the second control channel;
[0069] When the user instructions are second preset priority instructions, the user instructions are discarded through the second control channel;
[0070] When the user instructions are not first preset priority instructions and not second preset priority instructions, the user instructions are buffered into a buffer queue through the second control channel; the user instructions in the buffer queue are executed through the first control channel when firmware upgrade of the terminal device is completed.
[0071] In the embodiment of the present application, the dynamic priority allocation adopts a preemptive scheduling algorithm, and the user instructions are divided into three priority levels of instructions: real-time instructions (such as emergency power-off) are directly responded by the auxiliary control channel; buffer instructions (such as mode switching) are stored in a ring buffer of instructions, and are executed by the main control channel after the smart home device firmware upgrade is completed; and discarded instructions (such as non-critical state query) avoid invalid requests from occupying system resources. Of course, the above-mentioned division of user instructions is only an example, and in actual application, the priority levels of user instructions can be divided into other priority levels according to needs, and the processing mode corresponding to the user instructions of the priority level, and the embodiment of the present application does not need to be limited thereto.
[0072] Exemplarily, the first preset priority instruction can be a real-time instruction, and the second preset priority instruction can be a discarded instruction. When the user instruction is the first preset priority instruction, that is, the user instruction is a real-time instruction, the user instruction can be buffered to the real-time queue, and the user instruction in the real-time queue is executed through the second control channel; when the user instruction is the second preset priority instruction, that is, the user instruction is a discarded instruction, the user instruction can be discarded through the second control channel; when the user instruction is not the first preset priority instruction and not the second preset priority instruction, it is indicated that the user instruction is not a real-time instruction or a discarded instruction, and at this time, the user instruction can be buffered to the buffer queue through the second control channel, wherein the user instruction in the buffer queue is executed through the first control channel when the firmware upgrade of the smart home device is completed and the first control channel takes control. It should be noted that if the user instruction in the real-time queue is executed through the second control channel, if the user instruction affects the critical state variable of the smart home device, for example, the user instruction is to increase the temperature of the air conditioning device from 23 degrees to 24 degrees, the critical state variable of the air conditioning device will be updated to 24 degrees.
[0073] The embodiment of the present application sets a queue management strategy for user instructions, the queue management strategy is designed with a double-buffer queue, which includes a real-time queue and a buffer queue, wherein the real-time queue is used to save user instructions (real-time instructions) that need to be executed immediately, for example, controlling the smart home device to start or close immediate operations, the buffer queue (with a capacity slightly larger than the real-time queue) can store non-real-time instructions, the complexity of these non-real-time instructions can be higher than that of real-time instructions, and the user instructions are sorted according to the emergency priority. Wherein, the system realizes the quick retrieval of user instructions in the real-time queue and the buffer queue through a hash linked list, and executes according to the timestamp order, ensuring the time sequence correctness of user instruction processing. The embodiment of the present application provides an instruction queue redirection mechanism, dynamically allocates real-time instructions to an auxiliary control channel, and stores non-real-time instructions to a buffer queue, and seamlessly executes after upgrading, that is, the smart home device can still respond to user instructions in real time during the firmware upgrade of the embodiment of the present application, eliminating operation interruption, and realizing seamless user experience.
[0074] In an embodiment of the present application, during the process of controlling the firmware upgrade of the terminal device through the first control channel, after switching to control the terminal device through the second control channel, the method can further include:
[0075] receiving a differential state package sent by the first control channel through the second control channel; the differential state package is sent by the first control channel when a preset progress is completed;
[0076] performing cyclic redundancy check on the differential state package;
[0077] when the cyclic redundancy check on the differential state package is successful, synchronizing the upgrade progress and the key state variable of the terminal device of the second control channel and the first control channel according to the differential state package through the second control channel.
[0078] In the embodiment of the present application, the smart home device sets a differential synchronization mechanism, specifically, the main control channel sends a differential state package to the auxiliary control channel every time it completes a preset progress, for example, every time it completes 1% of the firmware writing progress. It should be noted that these differential state packages only contain the state change amount of the key state variable rather than the complete key state variable, so as to reduce the bandwidth and reduce the overall power consumption. Each differential state package can use a CRC (Cyclic Redundancy Check) check mechanism to ensure data integrity, wherein the CRC-8 check mechanism in the CRC check mechanism can be used for the check of the differential state package. When the cyclic redundancy check of the differential state package is successful, the second control channel can synchronize the upgrade progress and the key state variable of the terminal device of the first control channel and the second control channel according to the differential state package, so that the upgrade progress and the key state variable of the first control channel and the second control channel remain consistent.
[0079] In an embodiment of the present application, during the process of controlling the firmware upgrade of the terminal device through the first control channel, after switching to control the terminal device through the second control channel, the method can further include:
[0080] sending a heartbeat package to the first control channel through the second control channel; the heartbeat package is sent at a preset time interval; the first control channel is used to resend a differential state package to the second control channel when it is determined that the upgrade progress and / or the key state variable of the terminal device of the second control channel and the first control channel are inconsistent according to the heartbeat package.
[0081] In the embodiment of the present application, the auxiliary control channel can send a heartbeat package to the first control channel at a preset time interval, for example, send a heartbeat package to the first control channel every second. Based on the heartbeat package, it can be determined whether the upgrade progress and / or the key state variable of the smart home device of the second control channel and the first control channel are consistent. If the heartbeat package check is successful, it can be determined that the upgrade progress and the key state variable of the smart home device of the second control channel and the first control channel are consistent, and no further processing is required. If the heartbeat package check fails or data is lost, it is determined that the upgrade progress and / or the key state variable of the smart home device of the second control channel and the first control channel are inconsistent, which triggers the main control channel to perform data retransmission. At this time, the first control channel can resend a differential state package to the second control channel to synchronize the upgrade progress and the key state variable of the second control channel and the first control channel, thereby ensuring the state synchronization reliability of the system during the firmware upgrade process.
[0082] In an embodiment of the present application, when the firmware upgrade of the terminal device controlled through the first control channel is completed, switching to control the terminal device through the first control channel and restoring the terminal device after firmware upgrade to the key state variable can include:
[0083] When the firmware upgrade of the terminal device controlled through the first control channel is completed, receiving a hardware trigger signal through the second control channel;
[0084] The second control channel switches to use the firmware of the terminal device after upgrade according to the hardware trigger signal, and switches to control the terminal device through the first control channel, and restores the terminal device after firmware upgrade to the key state variable.
[0085] In a specific implementation, the key state variable of the smart home device can include a key state variable (such as a switch state), a timing task (such as a countdown remaining time), a network configuration (such as a WiFi connection key), and the like.
[0086] In an embodiment of the present application, atomic operation guarantees the key state variable, and a memory barrier technology can be used to avoid multi-thread access conflicts. After the firmware upgrade of the smart home device is completed, the system will notify the auxiliary control channel to switch to the new firmware after upgrade through a hardware trigger signal, such as a GPIO (General-purpose input / output) interrupt. After switching to control the terminal device through the main control channel, the consistency of the device state and other key state variables before and after upgrade is ensured through snapshot and real-time update and the like. Through a lightweight state synchronization protocol, efficient state synchronization of the main control channel and the auxiliary control channel is realized, and the consistency of the device state and other key state variables before and after firmware upgrade is ensured.
[0087] In an embodiment of the present application, the method can further include:
[0088] Obtaining a network state of the terminal device;
[0089] Adjusting the size of the firmware upgrade data block obtained from the cloud server according to the network state;
[0090] Obtaining the firmware upgrade data block of the size from the cloud server, so as to control the firmware upgrade of the terminal device through the first control channel according to the firmware upgrade data block.
[0091] In the embodiment of the present application, the network state of the smart home device can be acquired in real time, for example, whether there are abnormal conditions such as lag, delay, etc., and then the size of the firmware upgrade data block acquired from the cloud server can be adjusted according to the network state. The smart home device can acquire the firmware upgrade data block of the size from the cloud server to control the firmware upgrade of the terminal device according to the firmware upgrade data block through the first control channel. For example, if it is determined according to the network state of the smart home device that the network state is good at this time, there are no abnormal conditions such as lag, delay, etc., the size of the firmware upgrade data block acquired from the cloud server can be increased, so that the firmware upgrade efficiency can be improved. On the contrary, if it is determined according to the network state of the smart home device that the network has abnormal conditions such as lag, delay, etc. at this time, the size of the firmware upgrade data block acquired from the cloud server can be reduced. In this way, even if the transmitted firmware upgrade data block has a problem, the transmission can be quickly completed again, and since the firmware upgrade data block is small, the cost of retransmission is also small.
[0092] In an embodiment of the present application, the firmware upgrade data block of the size is acquired from the cloud server to control the firmware upgrade of the terminal device according to the firmware upgrade data block through the first control channel, comprising:
[0093] The firmware upgrade data block of the size is acquired from the cloud server;
[0094] The firmware upgrade data block is cyclic redundancy checked;
[0095] When the cyclic redundancy check of the firmware upgrade data block is successful, the firmware upgrade of the terminal device is controlled according to the firmware upgrade data block through the first control channel;
[0096] When the cyclic redundancy check of the firmware upgrade data block fails, the step of acquiring the firmware upgrade data block of the size from the cloud server is returned.
[0097] In the embodiment of the present application, the size of the firmware upgrade data block obtained from the cloud is dynamically adjusted in real time according to the network state, and then the obtained firmware upgrade data block can be subjected to cyclic redundancy check (CRC), wherein the firmware upgrade data block can be subjected to CRC32 check, when the CRC32 check fails, the firmware upgrade data block of the size is automatically obtained from the cloud server again; when the CRC32 check succeeds, the smart home device can be controlled to perform firmware upgrade through the first control channel according to the firmware upgrade data block, until the firmware upgrade of the smart home device is completed. In the embodiment of the present application, the check data (including the differential state package and the firmware upgrade data block) and the user instruction share the channel, so that the existing hardware can be multiplexed without additional communication interface. Of course, if the firmware upgrade of the smart home device fails, the firmware of the smart home device before the upgrade is rolled back. Through real-time verification of the integrity of the firmware upgrade data block during firmware upgrade, the efficiency and stability are taken into account.
[0098] In an embodiment of the present application, the method can further comprise:
[0099] When the number of the firmware-updated terminal devices in the specified area is less than or equal to the number of the non-firmware-updated terminal devices, a target terminal device is determined from the firmware-updated terminal devices, a firmware upgrade data block is obtained from the target terminal device, and firmware upgrade of the terminal device is controlled through the first control channel according to the firmware upgrade data block.
[0100] When the number of the firmware-updated terminal devices in the specified area is greater than the number of the non-firmware-updated terminal devices, a firmware upgrade data block is obtained from the firmware-updated terminal devices, and firmware upgrade of the terminal device is controlled through the first control channel according to the firmware upgrade data block.
[0101] In a specific implementation, the terminal device can be a smart home device, in a designated area, for example, a plurality of smart home devices are usually deployed in a family, and there can also be a plurality of same smart home devices, when the number of smart home devices that have been upgraded in firmware in the designated area is small, for example, less than or equal to the smart home devices that have not been upgraded in firmware, the target device is preferentially selected from the smart home devices that have been upgraded in firmware with low load or good network quality to provide the firmware upgrade data block, reducing the dependence on the cloud server, and at the same time, the transmission efficiency can be improved; on the contrary, if the number of smart home devices that have been upgraded in firmware is large, for example, greater than the smart home devices that have not been upgraded in firmware, then all the smart home devices that have been upgraded in firmware are selected to obtain the firmware upgrade data block, and the localized transmission (such as a Mesh network) between devices is used to accelerate the firmware upgrade process. For example, in a certain family, there are 10 smart home devices, if only 2 of them have completed firmware upgrade, then the smart home device with the strongest signal or closest to the data distribution node is selected to distribute the firmware upgrade data block to the smart home devices that have not been upgraded in firmware; if 7 of the smart home devices have been upgraded in firmware, then all the smart home devices that have been upgraded in firmware can be selected to respectively transmit different firmware upgrade data blocks, thereby reducing the cloud bandwidth pressure and improving the speed of the smart home devices to obtain all the firmware upgrade data blocks.
[0102] It can be seen that, when there are a small number of smart home devices that have been upgraded in firmware in a designated area, the embodiment of the present application selects the optimal (low load, good network) smart home device to distribute the firmware upgrade data block, avoids performance bottlenecks, when there are a large number of smart home devices that have been upgraded in firmware, fully utilizes the distribution capability of all smart home devices, parallel transmission, flexible adaptation to different scenarios, and optimizes resource utilization.
[0103] In the embodiment of the present application, when the smart home device triggers firmware upgrade, the cloud server pushes a new firmware notification, and the smart home device confirms the new firmware notification and enters an upgrade mode to perform firmware upgrade. The state synchronization module first records the current key state variable, and then the main control channel transfers the control right to the auxiliary control channel. During the firmware upgrade process, the main control channel performs firmware download, block verification and installation in parallel, and the auxiliary control channel processes user core instructions / real-time instructions in real time (classified by the instruction queue module: real-time instructions are directly executed, and non-real-time instructions are stored in a buffer queue). After the firmware upgrade is completed, the main control channel verifies the integrity of the newly upgraded firmware and generates the latest device state, and the auxiliary control channel returns the buffer queue instructions and the device state. Finally, the smart home device switches back to the main control channel, executes the buffered instructions in the buffer queue, and restores the complete function.
[0104] The embodiment of the present application solves the problem of the smart home device in the related scheme that cannot respond to the user instruction due to the processor resource occupation during the firmware upgrade, and specifically realizes seamless control through double-channel parallel control and instruction queue redirection. In order to enable those skilled in the art to better understand the embodiment of the present application, the following is described with one example.
[0105] Referring to Figure 3 , the embodiment of the present application provides a flowchart of firmware upgrade of a smart home device, and the specific steps executed by the smart home device can include: detecting firmware update; if the firmware is the latest firmware, continuing normal operation; if the firmware is not the latest firmware, generating a state snapshot according to a key state variable of the smart home device, and transmitting to an auxiliary control channel through an SPI interface; upgrading the main control channel; checking the firmware in blocks; processing real-time instructions by the auxiliary channel; redirecting non-real-time instructions to a buffer queue; returning the buffer instructions; synchronizing the state and the queue by the main control channel; restoring the main control channel; executing the buffer instructions; and ending.
[0106] It should be noted that, for the method embodiment, in order to simply describe, it is expressed as a series of action combinations, but those skilled in the art should know that the embodiment of the present application is not limited by the described action sequence, because according to the embodiment of the present application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the involved actions are not necessarily required by the embodiment of the present application.
[0107] Referring to Figure 4 , a structure block diagram of a terminal device upgrading apparatus provided in the embodiment of the present application is shown, the terminal device includes at least two control channels, the control channels at least include a first control channel and a second control channel, wherein the second control channel is used for executing a user instruction received by the terminal device during firmware upgrade, and the apparatus specifically can include the following modules:
[0108] The acquisition module 401 is used for triggering the terminal device to trigger upgrade, and recording key state variables of the terminal device through the first control channel;
[0109] The first switching module 402 is used for switching to control the terminal device through the second control channel in the process of controlling firmware upgrade of the terminal device through the first control channel;
[0110] The processing module 403 is used for processing the user instruction through the second control channel when the user instruction is received;
[0111] The second switching module 404 is configured to switch to control the terminal device through the first control channel when the firmware upgrade of the terminal device controlled through the first control channel is completed, and restore the terminal device after the firmware upgrade to the key state variable.
[0112] In an embodiment of the present application, the first control channel and the second control channel are two independent control channels; the first control channel and the second control channel are connected through a serial peripheral interface; and the firmware of the second control channel is simpler than the firmware of the first control channel.
[0113] In an embodiment of the present application, the processing module 403 is configured to:
[0114] When the user instruction is a first preset priority instruction, the user instruction is buffered into a real-time queue, and the user instruction in the real-time queue is executed through the second control channel;
[0115] When the user instruction is a second preset priority instruction, the user instruction is discarded through the second control channel;
[0116] When the user instruction is neither a first preset priority instruction nor a second preset priority instruction, the user instruction is buffered into a buffer queue through the second control channel; and the user instruction in the buffer queue is executed through the first control channel when the firmware upgrade of the terminal device is completed.
[0117] In an embodiment of the present application, the device further comprises a first checking module configured to:
[0118] The second control channel receives a differential state packet sent by the first control channel; the differential state packet is sent by the first control channel when a preset progress is completed;
[0119] The differential state packet is subjected to cyclic redundancy check;
[0120] When the cyclic redundancy check of the differential state packet is successful, the second control channel synchronizes the upgrade progress and the key state variable of the terminal device of the second control channel and the first control channel according to the differential state packet.
[0121] In an embodiment of the present application, the device further comprises a synchronization module configured to:
[0122] sending a heartbeat packet to the first control channel through the second control channel; the heartbeat packet is sent at a preset time interval; the first control channel is used to resend a differential state packet to the second control channel when it is determined according to the heartbeat packet that the upgrade progress and / or the key state variable of the terminal device of the second control channel and the first control channel are inconsistent.
[0123] In an embodiment of the present application, the second switching module 404 is configured to
[0124] receiving a hardware trigger signal through the second control channel when the firmware upgrade of the terminal device controlled through the first control channel is completed;
[0125] switching, according to the hardware trigger signal, to use the upgraded firmware of the terminal device and to control the terminal device through the first control channel, and restoring the terminal device after the firmware upgrade to the key state variable.
[0126] In an embodiment of the present application, the apparatus further comprises a block transmission module configured to:
[0127] obtaining a network state of the terminal device;
[0128] adjusting the size of the firmware upgrade data block obtained from the cloud server according to the network state;
[0129] obtaining the firmware upgrade data block of the size from the cloud server to control the firmware upgrade of the terminal device through the first control channel according to the firmware upgrade data block.
[0130] In an embodiment of the present application, the block transmission module is configured to:
[0131] obtaining the firmware upgrade data block of the size from the cloud server;
[0132] performing a cyclic redundancy check on the firmware upgrade data block;
[0133] controlling the firmware upgrade of the terminal device through the first control channel according to the firmware upgrade data block when the cyclic redundancy check on the firmware upgrade data block is successful;
[0134] returning to the step of obtaining the firmware upgrade data block of the size from the cloud server when the cyclic redundancy check on the firmware upgrade data block fails.
[0135] In an embodiment of the present application, the apparatus further comprises a firmware upgrade module configured to:
[0136] When the number of the firmware-updated terminal devices in the specified area is less than or equal to the number of the firmware-unupdated terminal devices, a target terminal device is determined from the firmware-updated terminal devices, firmware upgrade data blocks are acquired from the target terminal device, and the firmware upgrade of the terminal device is controlled according to the firmware upgrade data blocks through the first control channel.
[0137] When the number of the firmware-updated terminal devices in the specified area is greater than the number of the firmware-unupdated terminal devices, firmware upgrade data blocks are acquired from the firmware-updated terminal devices, and the firmware upgrade of the terminal device is controlled according to the firmware upgrade data blocks through the first control channel.
[0138] For the apparatus embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts refer to the part of the description of the method embodiment.
[0139] In addition, the embodiment of the present application further provides an electronic device, which comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program is executed by the processor to implement each process of the terminal device upgrade method embodiment and achieve the same technical effects, and details are not repeated here.
[0140] The embodiment of the present application further provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement each process of the terminal device upgrade method embodiment and achieve the same technical effects, and details are not repeated here. The computer readable storage medium includes a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, etc.
[0141] The embodiment of the present application further provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement each process of the terminal device upgrade method embodiment and achieve the same technical effects, and details are not repeated here.
[0142] Figure 5 A hardware structure schematic diagram of an electronic device for implementing the embodiments of the present application.
[0143] The electronic device 500 includes, but is not limited to, a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, a processor 510, and a power supply 511, etc. Those skilled in the art can understand that the electronic device structure shown in the figure is not a limitation on the electronic device, and the electronic device can include more or less components than the figure, or combine certain components, or different component arrangements. In the embodiments of the present application, the electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle terminal, a wearable device, and a pedometer, etc. Figure 5 The electronic device structure shown in the figure is not a limitation on the electronic device, and the electronic device can include more or less components than the figure, or combine certain components, or different component arrangements. In the embodiments of the present application, the electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle terminal, a wearable device, and a pedometer, etc.
[0144] It should be understood that in the embodiments of the present application, the radio frequency unit 501 can be used for receiving and transmitting signals in the process of information or call, specifically, receiving downlink data from the base station for the processor 510 to process, and transmitting uplink data to the base station. Generally, the radio frequency unit 501 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 501 can also communicate with the network and other devices through a wireless communication system.
[0145] The electronic device provides wireless broadband Internet access for users through the network module 502, such as helping users to send and receive emails, browse web pages, and access streaming media, etc.
[0146] The audio output unit 503 can convert audio data received by the radio frequency unit 501 or the network module 502 or stored in the memory 509 into an audio signal and output as a sound. Moreover, the audio output unit 503 can also provide audio output related to a specific function performed by the electronic device 500 (for example, a call signal receiving sound, a message receiving sound, etc.). The audio output unit 503 includes a speaker, a buzzer, and a receiver, etc.
[0147] The input unit 504 is configured to receive audio or video signals. The input unit 504 can include a graphics processor (GPU) 5041 and a microphone 5042. The graphics processor 5041 processes image data of a still picture or a video obtained by an image capture device (e.g., a camera) in a video capture mode or an image capture mode. Processed image frames can be displayed on the display unit 506. Processed image frames can be stored in the memory 509 (or other storage medium) or transmitted via the radio frequency unit 501 or the network module 502. The microphone 5042 can receive sound and can process such sound as audio data. Processed audio data can be converted into a format that can be transmitted to a mobile communication base station via the radio frequency unit 501 in a telephone call mode.
[0148] The electronic device 500 further includes at least one sensor 505, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 5061 according to the brightness of ambient light, and the proximity sensor can turn off the display panel 5061 and / or the backlight when the electronic device 500 is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when at rest, and can be used to identify the electronic device posture (such as screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, knock), and the like. The sensor 505 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, and the like, which will not be described here.
[0149] The display unit 506 is configured to display information input by a user or information provided to the user. The display unit 506 can include a display panel 5061, which can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0150] The user input unit 507 can be used to receive inputted digital or character information, and to generate key signal input related to user settings of the electronic device and function control. Specifically, the user input unit 507 includes a touch panel 5071 and other input devices 5072. The touch panel 5071, also called a touch screen, can collect a user's touch operation (such as a user's operation on or near the touch panel 5071 using a finger, a stylus, or any suitable object or accessory) on or near it. The touch panel 5071 can include two parts, a touch detection device and a touch controller. The touch detection device detects the user's touch position and detects a signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch coordinates, and sends it to the processor 510, receives commands from the processor 510 and executes them. In addition, the touch panel 5071 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 5071, the user input unit 507 can also include other input devices 5072. Specifically, the other input devices 5072 can include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, on / off buttons, etc.), trackballs, mice, joysticks, and the like, which will not be described here.
[0151] Further, the touch panel 5071 can be overlaid on the display panel 5061, and when the touch panel 5071 detects a touch operation on or near it, it transmits to the processor 510 to determine the type of touch event, and then the processor 510 provides corresponding visual output on the display panel 5061 according to the type of touch event. Although in the above embodiment, the touch panel 5071 and the display panel 5061 are implemented as two independent components to realize the input and output functions of the electronic device, in some embodiments, the touch panel 5071 and the display panel 5061 can be integrated to realize the input and output functions of the electronic device, which is not limited here. Figure 5
[0152] The interface unit 508 is an interface for connecting external devices to the electronic device 500. For example, the external devices can include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input / output (I / O) port, a video I / O port, an earphone port, and the like. The interface unit 508 can be used to receive input (e.g., data information, power, etc.) from external devices and transmit the received input to one or more elements within the electronic device 500 or can be used to transmit data between the electronic device 500 and external devices.
[0153] The memory 509 can be used to store software programs and various data. The memory 509 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; and the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), and the like. In addition, the memory 509 can include a high-speed random access memory, and can also include a nonvolatile memory, for example, at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device.
[0154] The processor 510 is the control center of the electronic device, connects all parts of the electronic device through various interfaces and lines, executes various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory 509 and calling data stored in the memory 509, and thus monitors the whole electronic device. The processor 510 can include one or more processing units; preferably, the processor 510 can integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the like, and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 510.
[0155] The electronic device 500 can further include a power supply 511 (such as a battery) for supplying power to various components; preferably, the power supply 511 can be logically connected to the processor 510 through a power management system, so as to realize the functions of managing charging, discharging, power consumption management, and the like through the power management system.
[0156] In addition, the electronic device 500 includes some functional modules that are not shown here and will not be described here.
[0157] It should be noted that, in this document, the term “comprising” or “including” or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such a process, method, article, or device. Without more limitations, the element defined by the statement “including a…” does not exclude the presence of additional identical elements in the process, method, article, or device including the element.
[0158] Those skilled in the art can clearly understand that the above-mentioned embodiment method can be realized by means of software and necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes a plurality of instructions for making a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute the method described in each embodiment of the present application.
[0159] The embodiments of the present application are described above with reference to the accompanying drawings, but the present application is not limited to the above-mentioned specific embodiments, and the above-mentioned specific embodiments are only illustrative, not restrictive. Those skilled in the art can make many forms without departing from the purpose of the present application and the scope protected by the claims under the inspiration of the present application, which all belong to the protection of the present application.
[0160] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the embodiments of the present application can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solutions. Those skilled in the art can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0161] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-mentioned system, device and unit can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
[0162] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0163] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0164] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present alone, or two or more units can be integrated in one unit.
[0165] If the functions are realized in the form of software functional units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the part of the prior art that essentially contributes or the part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, and various program code storage media.
[0166] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for upgrading a terminal device, characterized in that, The terminal device includes at least two control channels, each control channel including at least a first control channel and a second control channel, wherein the second control channel is used to execute user instructions received by the terminal device during firmware upgrades, and the method includes: The terminal device is triggered to upgrade, and key status variables of the terminal device are recorded through the first control channel. During the firmware upgrade process of the terminal device controlled through the first control channel, the control is switched to the second control channel to control the terminal device. Upon receiving a user instruction, the user instruction is processed through the second control channel; When the firmware upgrade of the terminal device is completed by controlling it through the first control channel, switch to controlling the terminal device through the first control channel and restore the terminal device after firmware upgrade to the key state variable.
2. The method according to claim 1, characterized in that, The first control channel and the second control channel are two independent control channels; the first control channel and the second control channel are connected through a serial peripheral interface; the firmware of the second control channel is simpler than the firmware of the first control channel.
3. The method according to claim 1, characterized in that, The process of processing the user command through the second control channel includes: When the user instruction is a first preset priority instruction, the user instruction is buffered into a real-time queue, and the user instruction in the real-time queue is executed through the second control channel; When the user instruction is a second preset priority instruction, the user instruction is discarded through the second control channel; When the user instruction is neither a first preset priority instruction nor a second preset priority instruction, the user instruction is buffered to a buffer queue through the second control channel; the user instruction in the buffer queue is executed through the first control channel when the terminal device firmware upgrade is completed.
4. The method according to claim 1, characterized in that, During the firmware upgrade process of the terminal device controlled via the first control channel, after switching to controlling the terminal device via the second control channel, the method further includes: The differential status packet sent by the first control channel is received through the second control channel; the differential status packet is sent by the first control channel when a preset progress is completed. Cyclic redundancy check is performed on the differential state packet; When the cyclic redundancy check of the differential status packet is successful, the upgrade progress and key status variables of the terminal device of the second control channel and the first control channel are synchronized through the second control channel according to the differential status packet.
5. The method according to claim 1, characterized in that, During the firmware upgrade process of the terminal device controlled via the first control channel, after switching to controlling the terminal device via the second control channel, the method further includes: The second control channel sends a heartbeat packet to the first control channel; the heartbeat packet is sent at a preset time interval; the first control channel is used to resend a differential status packet to the second control channel when it is determined from the heartbeat packet that the upgrade progress and / or key status variables of the terminal devices of the second control channel and the first control channel are inconsistent.
6. The method according to claim 1, characterized in that, When the firmware upgrade of the terminal device is completed via the first control channel, the system switches to control the terminal device via the first control channel and restores the upgraded terminal device to the key state variable, including: When the firmware upgrade of the terminal device is completed via the first control channel, a hardware trigger signal is received via the second control channel. The second control channel switches to using the upgraded firmware of the terminal device according to the hardware trigger signal, and switches to controlling the terminal device through the first control channel, and restores the terminal device with upgraded firmware to the key state variable.
7. The method according to claim 1, characterized in that, The method further includes: Obtain the network status of the terminal device; Adjust the size of the firmware upgrade data block obtained from the cloud server according to the network status; A firmware upgrade data block of the specified size is obtained from the cloud server, and the firmware upgrade of the terminal device is controlled via the first control channel based on the firmware upgrade data block.
8. The method according to claim 7, characterized in that, Obtaining a firmware upgrade data block of the specified size from the cloud server, and controlling the firmware upgrade of the terminal device via the first control channel based on the firmware upgrade data block, includes: Obtain firmware upgrade data blocks of the specified size from the cloud server; Cyclic redundancy check is performed on the firmware upgrade data block; When the cyclic redundancy check of the firmware upgrade data block is successful, the firmware upgrade of the terminal device is controlled through the first control channel according to the firmware upgrade data block. If the cyclic redundancy check of the firmware upgrade data block fails, return to the step of obtaining the firmware upgrade data block of the specified size from the cloud server.
9. The method according to claim 1, characterized in that, The method further includes: When the number of firmware-upgraded terminal devices in a specified area is less than or equal to the number of firmware-unupgraded terminal devices, a target terminal device is determined from the firmware-upgraded terminal devices, and a firmware upgrade data block is obtained from the target terminal device, so as to control the firmware upgrade of the terminal device according to the firmware upgrade data block through the first control channel. When the number of firmware-upgraded terminal devices in a designated area is greater than the number of firmware-unupgraded terminal devices, a firmware upgrade data block is obtained from the firmware-upgraded terminal devices, and the firmware upgrade of the terminal devices is controlled through the first control channel based on the firmware upgrade data block.
10. A terminal equipment upgrade device, characterized in that, The terminal device includes at least two control channels, each control channel including at least a first control channel and a second control channel, wherein the second control channel is used to execute user instructions received by the terminal device during firmware upgrades, and the device includes: The acquisition module is used to trigger the terminal device to trigger an upgrade and to record the key status variables of the terminal device through the first control channel. The first switching module is used to switch to controlling the terminal device through the second control channel during the firmware upgrade process of the terminal device controlled through the first control channel. The processing module is used to process the user instruction through the second control channel when a user instruction is received; The second switching module is used to switch to controlling the terminal device through the first control channel when the firmware upgrade of the terminal device is completed through the first control channel, and to restore the terminal device after firmware upgrade to the key state variable.
11. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store computer programs; When the processor executes a program stored in the memory, it implements the method as described in any one of claims 1-9.
12. A computer-readable storage medium having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method as described in any one of claims 1-9.