Bluetooth-based firmware upgrading method and device, electronic equipment and medium

By dividing the firmware upgrade file into multiple data blocks and adopting an adaptive retransmission strategy, the problem of interruption in the firmware upgrade process in an unstable network environment is solved, and efficient and stable firmware upgrades are achieved.

CN120144153APending Publication Date: 2025-06-13GUANGZHOU KETENG INFORMATION TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510236091.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

In an unstable network environment, the firmware upgrade process of Bluetooth transmission is susceptible to factors such as signal interference, bandwidth fluctuations and excessive device load, resulting in interruption or failure.

Method used

The firmware upgrade file is divided into at least two data blocks and sent through a Bluetooth channel, each data block containing a sending serial number, a first check value, and a sending time stamp. Receive feedback information to identify transmission interruption, adjust the transmission policy for retransmission until successful.

Benefits of technology

It realizes efficient and stable firmware upgrades in unstable network environments, and through breakpoint recovery and adaptive retransmission strategies, resource waste is reduced and equipment operation efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120144153A_ABST
    Figure CN120144153A_ABST
Patent Text Reader

Abstract

The invention discloses a Bluetooth-based firmware upgrading method and device, electronic equipment and a medium. The method comprises the following steps: dividing a firmware upgrading file required by target equipment into at least two data blocks, and determining a sending serial number and a first check value of each data block; sending the first data block to the target device through the Bluetooth channel according to the sending serial number; receiving feedback information which is returned by the target equipment and generated for the first data block, if transmission of the first data block is interrupted according to the feedback information, determining an interruption reason, and adjusting a transmission strategy for the interruption reason to resend the first data block; and until the first data block is successfully sent, sending of other data blocks in the at least two data blocks is completed according to the sending serial number, so that the target device restores the firmware upgrading file according to the at least two data blocks for firmware upgrading. According to the technical scheme provided by the embodiment of the invention, efficient and stable firmware upgrading can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Bluetooth transmission, and particularly to a firmware upgrade method, device, electronic device and storage medium based on Bluetooth. Background Art

[0002] With the development of smart grids, the degree of intelligence and networking of power equipment has been continuously improved, and remote monitoring, control and upgrade of equipment have become key links to achieve the efficient operation of smart grids. Grid equipment includes substation equipment, distribution terminals, power monitoring equipment, smart meters, etc. These equipment are often widely distributed, located in remote areas, and some equipment cannot be directly connected to a fixed network. Therefore, firmware upgrade based on wireless communication protocols has become an important means to solve this problem.

[0003] Bluetooth technology, as a low-power and short-distance wireless communication protocol, has been gradually applied to the field of smart grids, especially in the communication and maintenance of low-power devices. By performing firmware upgrade through the Bluetooth protocol, the maintenance cost of grid equipment can be effectively reduced, the stability of equipment operation can be improved, and it can be ensured that the equipment can quickly adapt to new control strategies or function upgrades.

[0004] However, due to the fact that grid equipment often operates in an unstable network environment, the transmission process may be affected by factors such as signal interference, bandwidth fluctuation, and overloaded equipment, resulting in interruptions or failures during the firmware upgrade process. Summary of the Invention

[0005] The present invention provides a firmware upgrade method, device, electronic device and storage medium based on Bluetooth, which can achieve efficient and stable firmware upgrade.

[0006] According to one aspect of the present invention, a firmware upgrade method based on Bluetooth is provided, and the method includes:

[0007] Dividing the firmware upgrade file required by the target device into at least two data blocks, and determining the transmission sequence number and the first check value of each data block;

[0008] Sending the first data block to the target device through the Bluetooth channel according to the transmission sequence number; wherein, the first data block further includes its corresponding first check value and transmission timestamp;

[0009] Receiving the feedback information generated by the target device for the first data block, if it is found according to the feedback information that the transmission of the first data block is interrupted, determining the interruption reason, and adjusting the transmission strategy according to the interruption reason to retransmit the first data block;

[0010] Until the first data block is successfully sent, complete the sending of the other data blocks in the at least two data blocks according to the sending sequence number, so that the target device can restore the firmware upgrade file according to the at least two data blocks for firmware upgrade.

[0011] According to another aspect of the present invention, there is provided a Bluetooth-based firmware upgrade device, the device comprising:

[0012] A data block division module, configured to divide a firmware upgrade file required by a target device into at least two data blocks, and determine a sending sequence number and a first check value for each data block;

[0013] A data block sending module, configured to send the first data block to the target device through a Bluetooth channel according to the sending sequence number; wherein, the first data block further includes its corresponding first check value and a sending timestamp;

[0014] A data block retransmission module, configured to receive feedback information generated by the target device for the first data block, if it is found according to the feedback information that the transmission of the first data block is interrupted, determine the interruption reason, and adjust the transmission strategy for re-sending the first data block according to the interruption reason;

[0015] A firmware upgrade module, configured to, until the first data block is successfully sent, sequentially complete the sending of the other data blocks in the at least two data blocks according to the sending sequence number, so that the target device can restore the firmware upgrade file according to the at least two data blocks for firmware upgrade.

[0016] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0017] At least one processor; and

[0018] A memory communicatively connected to the at least one processor; wherein,

[0019] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor, so that the at least one processor can execute the Bluetooth-based firmware upgrade method according to any embodiment of the present invention.

[0020] According to another aspect of the present invention, there is provided a computer-readable storage medium, the computer-readable storage medium stores computer instructions, and the computer instructions are used to implement the Bluetooth-based firmware upgrade method according to any embodiment of the present invention when executed by a processor.

[0021] In the technical solution of the embodiment of the present invention, the firmware upgrade file required by the target device is divided into at least two data blocks, and the transmission sequence number and the first check value of each data block are determined; through the Bluetooth channel, the first data block is sent to the target device according to the transmission sequence number; wherein, the first data block further includes its corresponding first check value and transmission timestamp; receive the feedback information generated by the target device for the first data block, if it is found according to the feedback information that the transmission of the first data block is interrupted, determine the interruption reason, and adjust the transmission strategy according to the interruption reason to retransmit the first data block; until the first data block is successfully sent, complete the sending of the other data blocks in the at least two data blocks according to the transmission sequence number, so that the target device can restore the firmware upgrade file according to the at least two data blocks for firmware upgrade. In the technical solution of the embodiment of the present invention, by receiving the feedback information returned by the target device, the situation of data block transmission interruption can be identified in time, and a suitable retransmission strategy can be selected according to the interruption reason for breakpoint recovery, so as to achieve efficient and stable firmware upgrade.

[0022] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. Brief Description of the Drawings

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to these drawings.

[0024] Figure 1 is a flowchart of a Bluetooth-based firmware upgrade method provided in Embodiment 1 of the present invention;

[0025] Figure 2 is a flowchart of a Bluetooth-based firmware upgrade method provided in Embodiment 2 of the present invention;

[0026] Figure 3 is a schematic structural diagram of a Bluetooth-based firmware upgrade device provided in Embodiment 3 of the present invention;

[0027] Figure 4 is a schematic structural diagram of an electronic device for implementing the Bluetooth-based firmware upgrade method of the embodiment of the present invention. Detailed Description of the Embodiments

[0028] To enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative work shall fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.

[0030] Embodiment 1

[0031] Figure 1 The following is a flowchart of a firmware upgrade method based on Bluetooth provided for Embodiment 1 of the present invention. This embodiment is applicable to the situation of upgrading the firmware of a target device through Bluetooth technology. This method can be executed by a firmware upgrade device based on Bluetooth. The firmware upgrade device based on Bluetooth can be implemented in the form of hardware and / or software, and the firmware upgrade device based on Bluetooth can be configured in an electronic device. As Figure 1 shown, the method includes:

[0032] S110. Divide the firmware upgrade file required by the target device into at least two data blocks, and determine the transmission sequence number and the first check value of each data block.

[0033] Among them, the firmware is a software embedded in a hardware device, responsible for managing the basic functions and operations of the hardware device. Firmware upgrade is to update the corresponding software in the hardware device, replacing the old version with a new version. The firmware upgrade file is a necessary component for performing the update operation.

[0034] Among them, the transmission sequence number is used to identify the transmission order of the data blocks to ensure that the data blocks can be recombined in the correct order at the target device. The first check value is usually calculated based on the content of the data block and is used to verify the integrity and correctness of the data block at the target device.

[0035] In the embodiments of the present invention, the firmware upgrade file required by the target device can be first divided into at least two data blocks. By dividing the firmware upgrade file, the amount of data transmitted at one time can be reduced, and the transmission efficiency can be improved. At the same time, when an error or loss occurs in a certain data block, only this data block needs to be retransmitted, rather than retransmitting the entire firmware upgrade file, thus avoiding waste of resources. Then, for each of the at least two data blocks, a unique transmission sequence number can be assigned to it, and its corresponding first check value can be calculated through a check algorithm, so as to ensure the order and integrity of each data block. Optionally, the check algorithm can be a 32-bit cyclic redundancy check algorithm or other check algorithms, and the embodiments of the present invention do not limit this.

[0036] S120. Send the first data block to the target device through the Bluetooth channel according to the transmission sequence number; wherein, the first data block further includes its corresponding first check value and transmission timestamp.

[0037] In the embodiments of the present invention, before sending the firmware upgrade file, a Bluetooth connection needs to be established between the sending end and the target device to transmit the firmware upgrade file through the Bluetooth channel. Specifically, the first data block to be sent can be determined according to the transmission sequence number, and the first data block can be sent to the target device in the form of a data packet through the Bluetooth channel, and wait for the confirmation feedback of the target device to ensure the reliable reception of the data block. It should be noted that the data packet needs to include the first check value and transmission timestamp corresponding to the first data block for the target device to determine the feedback information according to the first check value and transmission timestamp.

[0038] S130. Receive the feedback information generated by the target device for the first data block. If it is found according to the feedback information that the transmission of the first data block is interrupted, determine the interruption reason, and adjust the transmission strategy according to the interruption reason to retransmit the first data block.

[0039] Among them, the feedback information includes timeout detection information and check detection information. The timeout detection information refers to the difference between the transmission timestamp when the sending end sends the first data block and the timestamp corresponding to when the target device returns the feedback information. The check detection information refers to the matching situation between the first check value corresponding to the first data block sent by the sending end and the second check value calculated by the target device according to the content of the first data block received. It should be noted that when calculating the second check value, only the content related to the firmware upgrade file in the received first data block is calculated. The interruption reasons include unstable Bluetooth channel, insufficient processing capacity of the sending end, insufficient processing capacity of the target device, data block loss, check failure, etc.

[0040] In an embodiment of the present invention, after receiving the first data block sent by the sending end, the target device determines feedback information according to the content in the first data block, and returns the feedback information to the sending end through the Bluetooth channel to indicate whether the first data block is successfully received. If the first data block is successfully received, the subsequent data blocks are continued to be sent according to the sending sequence number. If it is found according to the feedback information that the transmission of the first data block is interrupted, such as transmission timeout, checksum failure, etc., at this time, it is necessary to first determine the reason for the transmission interruption, such as unstable Bluetooth channel, insufficient processing capacity of the sending end, etc., and then adjust the transmission strategy according to the interruption reason, and retransmit the first data block based on the adjusted transmission strategy. By receiving the feedback information returned by the target device, the sending end can timely identify the situation of transmission interruption, and select an appropriate retransmission strategy for breakpoint recovery according to the interruption reason, so as to achieve efficient and stable firmware upgrade.

[0041] S140. Until the first data block is successfully sent, complete the sending of other data blocks in at least two data blocks according to the sending sequence number, so that the target device can restore the firmware upgrade file from at least two data blocks for firmware upgrade.

[0042] In an embodiment of the present invention, after the first data block is successfully sent, the sending of other data blocks in at least two data blocks can be completed in sequence according to the sending sequence number in the manner of steps S120 - S130. After receiving at least two data blocks, the target device reorganizes the complete firmware upgrade file in the correct order according to the sending sequence number and data content of the received data blocks, and after the reorganized firmware upgrade file passes the overall checksum, the firmware upgrade process is executed according to the reorganized firmware upgrade file, including steps such as erasing the old firmware, writing the new firmware, and restarting the target device. It should be noted that before upgrading the firmware, it is necessary to back up the important data in the target device to prevent data loss.

[0043] In the technical solution of the embodiment of the present invention, the firmware upgrade file required by the target device is divided into at least two data blocks, and the transmission sequence number and the first check value of each data block are determined; through the Bluetooth channel, the first data block is sent to the target device according to the transmission sequence number; wherein, the first data block further includes its corresponding first check value and transmission timestamp; receive the feedback information generated by the target device for the first data block, if it is found according to the feedback information that the transmission of the first data block is interrupted, determine the interruption reason, and adjust the transmission strategy according to the interruption reason to resend the first data block; until the first data block is successfully sent, complete the sending of other data blocks in at least two data blocks according to the transmission sequence number, so that the target device can restore the firmware upgrade file according to at least two data blocks for firmware upgrade. In the technical solution of the embodiment of the present invention, by receiving the feedback information returned by the target device, the situation of data block transmission interruption can be identified in time, and a suitable retransmission strategy can be selected according to the interruption reason for breakpoint recovery, so as to achieve efficient and stable firmware upgrade.

[0044] Embodiment 2

[0045] Figure 2 The flowchart of a Bluetooth-based firmware upgrade method provided by Embodiment 2 of the present invention. The embodiment of the present invention is optimized based on the above embodiment. For the solutions not described in detail in the embodiment of the present invention, please refer to the above embodiment. As Figure 2 shown, the method includes:

[0046] S210. Determine the actual capacity of each data block based on a preset data block capacity limit, the available memory of the target device, and the actual bandwidth of the Bluetooth channel, and divide the firmware upgrade file into at least two data blocks according to the actual capacity.

[0047] In the embodiment of the present invention, the actual capacity of each data block can be adaptively determined based on a preset data block capacity limit, the available memory of the target device, and the actual bandwidth of the Bluetooth channel, and the firmware upgrade file is divided into at least two data blocks according to the actual capacity to ensure the effective transmission of the data block and the normal operation of the target device. Optionally, the calculation formula for determining the actual capacity of each data block based on a preset data block capacity limit, the available memory of the target device, and the actual bandwidth of the Bluetooth channel is as follows:

[0048]

[0049] wherein, Blk Size is the actual capacity of each data block, MaxBlkSize is the preset data block capacity limit, AvailMem is the available memory of the target device, AdjBW is the actual bandwidth of the Bluetooth channel, Time is the transmission time limit of each data block, and PktOverhead is the protocol overhead factor.

[0050] S220. Add transmission sequence numbers to at least two data blocks in a sequential increasing manner starting from 1, and calculate the first check value corresponding to each data block according to the content of each data block.

[0051] In an embodiment of the present invention, transmission sequence numbers can be added to at least two data blocks in a sequential increasing manner starting from 1, and the first check value corresponding to each data block can be calculated according to the content of each data block through a check algorithm, so as to ensure the order and integrity of each data block. Optionally, an end flag can be added to the last data block to facilitate the target device to determine whether the firmware upgrade file has been transmitted completely.

[0052] S230. Send the first data block to the target device through the Bluetooth channel according to the transmission sequence number; wherein, the first data block further includes its corresponding first check value and transmission timestamp.

[0053] S240. Receive the difference between the timestamp of the feedback information returned by the target device and the transmission timestamp, and the matching situation between the second check value calculated by the target device according to the content of the first data block and the first check value.

[0054] In an embodiment of the present invention, after the target device determines the difference between the transmission timestamp when the sending end sends the first data block and the timestamp corresponding to the feedback information returned by the target device, and the matching situation between the first check value corresponding to the first data block sent by the sending end and the second check value calculated by the target device itself according to the content of the received first data block, the target device returns the difference and the matching situation to the sending end as feedback information. After receiving the feedback information returned by the target device, the sending end determines whether the transmission of the first data block is interrupted according to the feedback information. It should be noted that when the target device calculates the second check value, it only calculates the content related to the firmware upgrade file in the received first data block.

[0055] S250. If the difference is greater than the first preset period or the matching situation is a mismatch, determine that the transmission of the first data block is interrupted.

[0056] Wherein, the first preset period is used to represent the maximum allowable transmission duration of the data block. In an embodiment of the present invention, the first preset period can be dynamically adjusted according to the actual bandwidth of the Bluetooth channel to flexibly adapt to different network environments. When the network condition is good, shorten the first preset period to reduce unnecessary waiting. When the network condition is poor, increase the first preset period to avoid misjudging as a transmission interruption due to too short a timeout. Optionally, the calculation formula of the first preset period is as follows:

[0057]

[0058] Among them, T timeout is the first preset period, Blk Size is the actual capacity of the data block, AdjBW is the actual bandwidth of the Bluetooth channel, and PktOverhead is the protocol overhead factor. It can be seen from the above formula that in addition to the actual bandwidth of the Bluetooth channel, the determination of the first preset period also takes into account the actual capacity of the data block and the protocol overhead factor, which can reasonably estimate the time required for data block transmission, make the timeout determination more scientific, avoid transmission failures caused by occasional delays, ensure that the data block can be successfully transmitted to the target device, and improve the stability and reliability of the system in complex environments.

[0059] In the embodiment of the present invention, if the difference between the transmission timestamp when the sending end sends the first data block and the timestamp corresponding to the time when the target device returns feedback information is greater than the first preset period, it indicates that the transmission of the first data block times out and is determined as a transmission interruption; if the matching situation between the first check value corresponding to the first data block sent by the sending end and the second check value calculated by the target device itself according to the content of the received first data block is a mismatch, it indicates that an error occurs during the transmission process of the first data block and is regarded as a transmission interruption.

[0060] S260. Determine the interruption reason, and adjust the transmission strategy according to the interruption reason to resend the first data block.

[0061] In the embodiment of the present invention, before resending the first data block, it is necessary to first determine the reason for the transmission interruption, such as unstable Bluetooth channel, insufficient processing capacity of the sending end, insufficient processing capacity of the target device, data block loss, check failure, etc., so as to select a suitable retransmission strategy for breakpoint recovery in a targeted manner, thereby achieving efficient and stable firmware upgrade. For example, if the interruption is caused by an unstable Bluetooth channel, the retransmission times can be increased or the retransmission interval can be extended, so as to effectively reduce unnecessary retransmissions and improve the overall transmission efficiency. At the same time, since different retransmission strategies will have different impacts on resource consumption, by accurately identifying the interruption reason, bandwidth and memory resources can be reasonably allocated on the premise of ensuring successful transmission, avoiding resource waste, and improving the operating efficiency of the device.

[0062] Optionally, determining the interruption reason and adjusting the transmission strategy according to the interruption reason to resend the first data block includes: determining the signal strength and connection quality of the Bluetooth channel, if the signal strength is lower than the first preset threshold or the connection quality is lower than the second preset threshold, determining that the interruption reason is an unstable Bluetooth channel; adjusting the transmission strategy to at least one of timeout retransmission, increasing the retransmission interval, and reducing the data block capacity, and resending the first data block.

[0063] In an embodiment of the present invention, when determining the cause of an interruption, it is possible to determine whether the cause of the interruption is an unstable Bluetooth channel by determining the signal strength and connection quality of the Bluetooth channel. Specifically, when the signal strength of the Bluetooth channel is lower than a first preset threshold or the connection quality of the Bluetooth channel is lower than a second preset threshold, it is determined that the cause of the interruption is an unstable Bluetooth channel. Herein, the first preset threshold and the second preset threshold can be set according to actual situations, and the embodiments of the present invention do not limit this. An unstable Bluetooth channel is usually caused by factors such as weak Bluetooth signals, interference, and excessive distance, which can lead to packet loss, timeouts, or verification failures during data transmission. At this time, after adjusting the transmission strategy to at least one of timeout retransmission, increasing the retransmission interval, and reducing the data block capacity, the first data block can be resent. Optionally, the calculation formulas for the signal strength and connection quality of the Bluetooth channel are as follows:

[0064]

[0065] Wherein, RSSI is the signal strength, P received is the received signal power, P reference is the reference signal power, Latency avg is the connection quality, N is the number of times of measuring the delay, tency i represents the delay of the i-th transmission.

[0066] Optionally, determining the cause of the interruption and adjusting the transmission strategy for the cause of the interruption to resend the first data block includes: determining the CPU usage rate and memory usage rate of the sending end. If the CPU usage rate is higher than a third preset threshold or the memory usage rate is higher than a fourth preset threshold, it is determined that the cause of the interruption is insufficient processing capacity of the sending end; adjusting the transmission strategy to at least one of restricting the data block sending rate, restricting the number of retransmissions, and reducing the data block capacity, and resending the first data block.

[0067] In an embodiment of the present invention, when determining the cause of an interruption, it is possible to determine whether the cause of the interruption is insufficient processing capacity of the sending end by determining the CPU usage rate and memory usage rate of the sending end. Specifically, when the CPU usage rate is higher than a third preset threshold (such as 70%) or the memory usage rate is higher than a fourth preset threshold (such as 80%), it is determined that the cause of the interruption is insufficient processing capacity of the sending end. Herein, the third preset threshold and the fourth preset threshold can be set according to actual situations, and the embodiments of the present invention do not limit this. Insufficient processing capacity of the sending end may also lead to transmission failures. For example, the sending end device may not be able to process data blocks during transmission in a timely manner due to reasons such as insufficient memory, CPU overload, or insufficient operating system resource allocation. At this time, after adjusting the transmission strategy to at least one of restricting the data block sending rate, restricting the number of retransmissions, and reducing the data block capacity, the first data block can be resent.

[0068] Optionally, determine the interruption reason, and adjust the transmission strategy according to the interruption reason to re - transmit the first data block, including: determining the difference between the timestamp corresponding to the feedback information returned by the target device and the transmission timestamp; if the difference is greater than a second preset period, determining that the interruption reason is insufficient processing capacity of the target device; adjusting the transmission strategy to at least one of increasing the transmission interval, restricting the number of concurrent transmissions, and reducing the data block capacity, and re - transmitting the first data block.

[0069] In an embodiment of the present invention, when determining the interruption reason, it is possible to determine whether the interruption reason is insufficient processing capacity of the target device by determining the difference between the timestamp corresponding to the feedback information returned by the target device and the transmission timestamp. Specifically, when the difference between the timestamp corresponding to the feedback information returned by the target device and the transmission timestamp is greater than a second preset period, it is determined that the interruption reason is insufficient processing capacity of the target device. Among them, the second preset period can be set according to actual situations, and the embodiments of the present invention do not limit this. Insufficient processing capacity of the target device may cause it to be unable to receive and process data blocks in a timely manner, resulting in transmission failure or response delay. At this time, after adjusting the transmission strategy to at least one of increasing the transmission interval, restricting the number of concurrent transmissions, and reducing the data block capacity, the first data block can be re - transmitted.

[0070] Optionally, determine the interruption reason, and adjust the transmission strategy according to the interruption reason to re - transmit the first data block, including: determining the loss rate of the data block; if the loss rate is greater than a fifth preset threshold, determining that the interruption reason is data block loss; adjusting the transmission strategy to at least one of re - transmitting the data block based on the transmission sequence number and optimizing the data block transmission order, and re - transmitting the first data block.

[0071] In an embodiment of the present invention, when determining the interruption reason, it is possible to determine whether the interruption reason is data block loss by determining the loss rate of the data block. Specifically, when the loss rate of the data block is greater than a fifth preset threshold, it is determined that the interruption reason is data block loss. Among them, the fifth preset threshold can be set according to actual situations, and the embodiments of the present invention do not limit this. Data block loss is usually caused by reasons such as signal interference, too long transmission distance, Bluetooth device overload, or network congestion, which may cause the target device not to receive some data blocks, or some data blocks are lost and cannot be confirmed. At this time, after adjusting the transmission strategy to at least one of re - transmitting the data block based on the transmission sequence number and optimizing the data block transmission order, the first data block can be re - transmitted.

[0072] Optionally, determine the interruption reason, and adjust the transmission strategy for the retransmission of the first data block according to the interruption reason, including: determining the failure rate of the matching situation, if the failure rate is greater than a sixth preset threshold, determining that the interruption reason is a verification failure; adjusting the transmission strategy to at least one of recalculating the first verification value corresponding to the data block, increasing the retransmission interval, and limiting the number of retransmissions, and performing the retransmission of the first data block.

[0073] In an embodiment of the present invention, when determining the interruption reason, the failure rate of the matching situation can be determined to judge whether the interruption reason is a verification failure. Specifically, when the failure rate of the matching situation is greater than a sixth preset threshold, it is determined that the interruption reason is a verification failure. Among them, the sixth preset threshold can be set according to the actual situation, and the embodiment of the present invention does not limit this. Verification failure usually occurs during the transmission process, and the content of the data block is damaged or interfered, resulting in the data received by the target device not passing the verification. At this time, after adjusting the transmission strategy to at least one of recalculating the first verification value corresponding to the data block, increasing the retransmission interval, and limiting the number of retransmissions, the retransmission of the first data block can be performed.

[0074] S270. Until the first data block is successfully sent, complete the sending of other data blocks in at least two data blocks according to the sending sequence number, so that the target device can restore the firmware upgrade file according to the at least two data blocks for firmware upgrade.

[0075] The technical solution of the embodiment of the present invention determines the actual capacity of each data block based on a preset data block capacity limit, the available memory of the target device, and the actual bandwidth of the Bluetooth channel, and divides the firmware upgrade file into at least two data blocks according to the actual capacity; adds a transmission sequence number to the at least two data blocks in a sequentially increasing manner starting from 1, and calculates a first check value corresponding to each data block according to the content of each data block; sends the first data block to the target device through the Bluetooth channel according to the transmission sequence number; wherein, the first data block further includes its corresponding first check value and transmission timestamp; receives the difference between the timestamp of the feedback information returned by the target device and the transmission timestamp, and the matching situation between the second check value calculated by the target device according to the content of the first data block and the first check value; if the difference is greater than the first preset period or the matching situation is mismatched, determines that the transmission of the first data block is interrupted; determines the interruption reason, and adjusts the transmission strategy according to the interruption reason to retransmit the first data block; until the first data block is successfully sent, completes the sending of the other data blocks in the at least two data blocks according to the transmission sequence number, so that the target device can restore the firmware upgrade file according to the at least two data blocks for firmware upgrade. The technical solution of the embodiment of the present invention can timely identify the situation of data block transmission interruption by receiving the feedback information returned by the target device, and select an appropriate retransmission strategy according to the interruption reason for breakpoint recovery, so as to achieve efficient and stable firmware upgrade.

[0076] Embodiment III

[0077] Figure 3 FIG. is a schematic structural diagram of a Bluetooth-based firmware upgrade device provided by Embodiment III of the present invention. As Figure 3 shown, the device includes:

[0078] A data block division module 310, configured to divide the firmware upgrade file required by the target device into at least two data blocks, and determine the transmission sequence number and the first check value of each data block;

[0079] A data block sending module 320, configured to send the first data block to the target device through the Bluetooth channel according to the transmission sequence number; wherein, the first data block further includes its corresponding first check value and transmission timestamp;

[0080] A data block retransmission module 330, configured to receive the feedback information generated by the target device for the first data block, if it is found according to the feedback information that the transmission of the first data block is interrupted, determine the interruption reason, and adjust the transmission strategy according to the interruption reason to retransmit the first data block;

[0081] The firmware upgrade module 340 is used to sequentially complete the transmission of the other data blocks in the at least two data blocks according to the transmission sequence number until the first data block is successfully sent, so that the target device can restore the firmware upgrade file from the at least two data blocks for firmware upgrade.

[0082] Optionally, the data block division module 310 includes:

[0083] The data block division unit is used to determine the actual capacity of each data block based on a preset data block capacity limit, the available memory of the target device, and the actual bandwidth of the Bluetooth channel, and divide the firmware upgrade file into at least two data blocks according to the actual capacity;

[0084] The check value calculation unit is used to add a transmission sequence number to the at least two data blocks in a sequentially increasing manner starting from 1, and calculate the first check value corresponding to each data block according to the content of each data block.

[0085] Optionally, the data block retransmission module 330 includes:

[0086] The feedback information receiving unit is used to receive the difference between the timestamp of the feedback information returned by the target device and the transmission timestamp, and the matching situation between the second check value calculated by the target device according to the content of the first data block and the first check value;

[0087] The transmission interruption determination unit is used to determine that the transmission of the first data block is interrupted if the difference is greater than the first preset period or the matching situation is mismatched;

[0088] The data block retransmission unit is used to determine the interruption reason and adjust the transmission strategy for retransmitting the first data block according to the interruption reason.

[0089] Optionally, the interruption reason includes an unstable Bluetooth channel; the data block retransmission unit includes:

[0090] The first interruption reason determination unit is used to determine the signal strength and connection quality of the Bluetooth channel, and if the signal strength is lower than the first preset threshold or the connection quality is lower than the second preset threshold, determine that the interruption reason is an unstable Bluetooth channel;

[0091] The first transmission strategy adjustment unit is used to adjust the transmission strategy to at least one of timeout retransmission, increasing the retransmission interval, and decreasing the data block capacity, and retransmit the first data block.

[0092] Optionally, the interruption reason includes insufficient processing capacity of the sending end; the data block retransmission unit includes:

[0093] The second interruption cause determination unit is configured to determine the CPU usage rate and memory usage rate of the sending end. If the CPU usage rate is higher than a third preset threshold or the memory usage rate is higher than a fourth preset threshold, it is determined that the interruption cause is insufficient processing capacity of the sending end;

[0094] The second transmission strategy adjustment unit is configured to adjust the transmission strategy to at least one of restricting the data block sending rate, restricting the number of retransmissions, and reducing the data block capacity, and retransmit the first data block.

[0095] Optionally, the interruption cause includes insufficient processing capacity of the target device; the data block retransmission unit includes:

[0096] The third interruption cause determination unit is configured to determine the difference between the timestamp corresponding to the feedback information returned by the target device and the sending timestamp. If the difference is greater than a second preset period, it is determined that the interruption cause is insufficient processing capacity of the target device;

[0097] The third transmission strategy adjustment unit is configured to adjust the transmission strategy to at least one of increasing the transmission interval, restricting the number of concurrent transmissions, and reducing the data block capacity, and retransmit the first data block.

[0098] Optionally, the interruption cause includes data block loss; the data block retransmission unit includes:

[0099] The fourth interruption cause determination unit is configured to determine the loss rate of the data block. If the loss rate is greater than a fifth preset threshold, it is determined that the interruption cause is data block loss;

[0100] The fourth transmission strategy adjustment unit is configured to adjust the transmission strategy to at least one of retransmitting the data block based on the sending sequence number and optimizing the data block transmission order, and retransmit the first data block;

[0101] Optionally, the interruption cause includes verification failure; the data block retransmission unit includes:

[0102] The fifth interruption cause determination unit is configured to determine the failure rate of the matching situation. If the failure rate is greater than a sixth preset threshold, it is determined that the interruption cause is verification failure;

[0103] The fifth transmission strategy adjustment unit is configured to adjust the transmission strategy to at least one of recalculating the first check value corresponding to the data block, increasing the retransmission interval, and restricting the number of retransmissions, and retransmit the first data block.

[0104] The firmware upgrade device based on Bluetooth provided by the embodiments of the present invention can execute the firmware upgrade method based on Bluetooth provided by any embodiment of the present invention, and has corresponding functional modules and beneficial effects for executing the method.

[0105] Example 4

[0106] Figure 4 FIG. shows a schematic structural diagram of an electronic device 10 that can be used to implement the embodiments of the present invention. The electronic device is intended to represent various forms of digital computers, such as, for example, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, for example, personal digital processors, cellular telephones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0107] As Figure 4 shown, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program executable by the at least one processor, and the processor 11 can execute various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.

[0108] A plurality of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0109] The processor 11 can be various general-purpose and / or special-purpose processing components having processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the firmware upgrade method based on Bluetooth.

[0110] In some embodiments, the Bluetooth-based firmware upgrade method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the Bluetooth-based firmware upgrade method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the Bluetooth-based firmware upgrade method by any other suitable means (e.g., by means of firmware).

[0111] The various embodiments of the systems and techniques described above in this document may be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGA), application specific integrated circuits (ASIC), application specific standard products (ASSP), systems on a chip (SOC), complex programmable logic devices (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs executable and / or interpretable on a programmable system including at least one programmable processor, which may be a special-purpose or general-purpose programmable processor, receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0112] The computer program for implementing the method of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer programs are executed by the processor, the functions / operations specified in the flowchart and / or block diagram are implemented. The computer programs may be executed entirely on the machine, partially on the machine, as a stand-alone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0113] In the context of the present invention, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on 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 memory), 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.

[0114] To provide for interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can also be used to provide for interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0115] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0116] A computing system may include a client and a server. The client and the server are generally far from each other and usually interact via a communication network. The client-server relationship is created by computer programs running on respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, and solves the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services.

[0117] It should be understood that various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in the present invention can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is imposed herein.

[0118] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.

Claims

1. A firmware upgrade method based on Bluetooth, characterized in that: The method comprises: Divide the firmware upgrade file required by the target device into at least two data blocks, and determine a sending sequence number and a first check value of each data block; Sending the first data block to the target device through the Bluetooth channel according to the sending sequence number; wherein the first data block also includes its corresponding first check value and sending timestamp; receiving feedback information generated for the first data block and returned by the target device, and if it is found according to the feedback information that the transmission of the first data block is interrupted, determining the cause of the interruption, and adjusting the transmission strategy according to the cause of the interruption to resend the first data block; Until the first data block is sent successfully, the sending of other data blocks in the at least two data blocks is completed according to the sending sequence number, so that the target device can restore the firmware upgrade file according to the at least two data blocks to perform firmware upgrade.

2. The method according to claim 1, characterized in that Dividing the firmware upgrade file required by the target device into at least two data blocks, and determining a sending sequence number and a first check value of each data block, including: Determine the actual capacity of each data block based on a preset data block capacity limit, available memory of the target device, and an actual bandwidth of the Bluetooth channel, and divide the firmware upgrade file into at least two data blocks according to the actual capacity; A sending sequence number is added to the at least two data blocks in an ascending order starting from 1, and a first check value corresponding to each data block is calculated according to the content of each data block.

3. The method according to claim 1, characterized in that Receiving feedback information generated for the first data block and returned by the target device, if it is found according to the feedback information that the transmission of the first data block is interrupted, determining the interruption cause, and adjusting the transmission strategy according to the interruption cause to resend the first data block, including: receiving a difference between a timestamp corresponding to feedback information returned by the target device and the sending timestamp, and a match between a second check value calculated by the target device according to the content of the first data block and the first check value; If the difference is greater than a first preset period of time or the matching condition is a mismatch, determining that the transmission of the first data block is interrupted; The interruption cause is determined, and a transmission strategy is adjusted according to the interruption cause to resend the first data block.

4. The method according to claim 3, characterized in that The reasons for the interruption include unstable Bluetooth channel; Determining the interruption cause and adjusting the transmission strategy according to the interruption cause to resend the first data block includes: Determine the signal strength and connection quality of the Bluetooth channel, and if the signal strength is lower than a first preset threshold or the connection quality is lower than a second preset threshold, determine that the interruption cause is that the Bluetooth channel is unstable; The transmission strategy is adjusted to at least one of timeout retransmission, increasing the retransmission interval, and reducing the data block capacity, and the first data block is retransmitted.

5. The method according to claim 3, characterized in that: The interruption reasons include insufficient processing capacity of the sending end; Determining the interruption cause and adjusting the transmission strategy according to the interruption cause to resend the first data block includes: Determine a CPU usage rate and a memory usage rate of the sending end, and if the CPU usage rate is higher than a third preset threshold or the memory usage rate is higher than a fourth preset threshold, determine that the interruption cause is insufficient processing capacity of the sending end; The transmission strategy is adjusted to at least one of limiting the data block sending rate, limiting the number of retransmissions, and reducing the data block capacity, and the first data block is resent.

6. The method according to claim 3, characterized in that: The reasons for the interruption include insufficient processing capacity of the target device; Determining the interruption cause and adjusting the transmission strategy according to the interruption cause to resend the first data block includes: Determine a difference between a timestamp corresponding to the feedback information returned by the target device and the sending timestamp, and if the difference is greater than a second preset period of time, determine that the interruption cause is insufficient processing capacity of the target device; The transmission strategy is adjusted to at least one of increasing the transmission interval, limiting the number of concurrent transmissions, and reducing the data block capacity, and the first data block is resent.

7. The method according to claim 3, characterized in that The interruption reason includes data block loss; Determining the interruption cause and adjusting the transmission strategy according to the interruption cause to resend the first data block includes: Determining a loss rate of data blocks, and if the loss rate is greater than a fifth preset threshold, determining that the interruption cause is a loss of data blocks; Adjusting the transmission strategy to at least one of retransmitting the data block based on the sending sequence number and optimizing the data block transmission order, and retransmitting the first data block; The interruption reason includes verification failure; Determining the interruption cause and adjusting the transmission strategy according to the interruption cause to resend the first data block includes: Determining a failure rate of the matching situation, and if the failure rate is greater than a sixth preset threshold, determining that the interruption cause is a verification failure; The transmission strategy is adjusted by at least one of recalculating a first check value corresponding to the data block, increasing a retransmission interval, and limiting the number of retransmissions, and resending the first data block.

8. A firmware upgrade device based on Bluetooth, characterized in that: The device comprises: A data block division module, used to divide the firmware upgrade file required by the target device into at least two data blocks, and determine a sending sequence number and a first check value of each data block; A data block sending module, used to send the first data block to the target device through a Bluetooth channel according to the sending sequence number; wherein the first data block also includes its corresponding first check value and a sending timestamp; a data block retransmission module, configured to receive feedback information generated for the first data block and returned by the target device, and if it is found according to the feedback information that the transmission of the first data block is interrupted, determine the interruption cause, and adjust the transmission strategy according to the interruption cause to resend the first data block; The firmware upgrade module is used to complete the sending of other data blocks in the at least two data blocks in sequence according to the sending sequence number until the first data block is sent successfully, so that the target device can restore the firmware upgrade file according to the at least two data blocks to perform firmware upgrade.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the Bluetooth-based firmware upgrade method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the Bluetooth-based firmware upgrade method according to any one of claims 1 to 7 when executed.

Citation Information

Cited By

  • Equipment upgrading method and system, computer equipment and computer program product

    CN120492003A