Wireless Upgrade Method and Device for Bluetooth Headset Firmware Connected via Bluetooth

By performing binary difference analysis and transfer parameter adjustment of Bluetooth headset firmware, combined with multiple verification mechanisms and segmented transmission strategies, the problems of low data transmission efficiency and poor reliability during the Bluetooth headset firmware upgrade process are solved, and efficient and reliable firmware upgrades are achieved.

CN119739410BActive Publication Date: 2025-05-27SHENZHEN DACOM ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510247009.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-04
Publication Date
2025-05-27
Estimated Expiration
2045-03-04

AI Technical Summary

Technical Problem

The existing Bluetooth headset firmware upgrade solutions have problems such as low data transmission efficiency, high upgrade failure rate and long time. Especially in complex wireless environments, how to ensure the reliability and efficiency of firmware updates has become a technical problem that needs to be solved urgently.

Method used

By conducting binary differential analysis of the current version of firmware and the target version of firmware, a firmware differential package is generated, and based on the transmission timing function and data transmission control strategy, the transmission parameters are dynamically adjusted, the optimal transmission path is selected, and a multiple verification mechanism and a segmented transmission strategy are adopted to support breakpoint continuous transmission.

Benefits of technology

It significantly reduces the amount of data that needs to be transmitted, improves the upgrade efficiency, ensures the stability and reliability of data transmission in different network environments, reduces the risk of upgrade failure, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119739410B_ABST
    Figure CN119739410B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of wireless firmware upgrade, and discloses a method and device for wirelessly upgrading the firmware of a Bluetooth headset connected via Bluetooth. The method includes: performing binary difference analysis on the current version firmware and the target version firmware to generate a firmware difference package; establishing a transmission timing function according to the firmware difference package and generating a data transmission control strategy; collecting signal parameters between the master and slave headsets and the mobile terminal to generate a data transmission path sequence; monitoring the transmission status of data segments to determine the optimal transmission rate; verifying the integrity check code of the received data segments, writing the data segments that pass the verification into the firmware buffer, and recording the writing status information; generating an updated firmware data packet from the data segments in the firmware buffer and writing the updated firmware data packet into the firmware storage area. The present invention ensures the data storage security and efficiency during the firmware update process, and avoids upgrade failures caused by storage problems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of wireless firmware upgrade for Bluetooth headsets, and particularly to a method and device for wirelessly upgrading the firmware of Bluetooth headsets connected via Bluetooth. Background Art

[0002] With the continuous development of Bluetooth headset technology and the continuous growth of market demand, wireless Bluetooth headsets have become an indispensable electronic device in people's daily lives. In order to continuously optimize product performance, fix potential problems, and provide new functions, manufacturers need to regularly update the firmware of Bluetooth headsets. Traditional firmware update methods usually require a wired connection or a dedicated device, which not only increases the user's usage cost but also reduces the user experience.

[0003] With the popularization of true wireless stereo headsets, data synchronization and firmware update between the master and slave headsets have become more complex. Due to factors such as Bluetooth communication bandwidth limitations, signal interference, and unstable transmission, problems such as low data transmission efficiency, high upgrade failure rate, and long duration are often faced during wireless firmware upgrade. Especially in a complex wireless environment, how to ensure the reliability and efficiency of firmware update has become an urgent technical problem to be solved. In addition, existing Bluetooth headset firmware upgrade solutions often lack effective transmission optimization mechanisms and error recovery strategies, and cannot adaptively adjust according to different network environments and device states. This results in the firmware upgrade process being easily affected by the external environment in actual applications, with risks such as upgrade interruption and data corruption, seriously affecting the user experience and product reliability. Summary of the Invention

[0004] The present invention provides a method and device for wirelessly upgrading the firmware of Bluetooth headsets connected via Bluetooth, which ensures the data storage security and efficiency during the firmware update process and avoids upgrade failures caused by storage problems.

[0005] In a first aspect, the present invention provides a method for wirelessly upgrading the firmware of Bluetooth headsets connected via Bluetooth, the method for wirelessly upgrading the firmware of Bluetooth headsets connected via Bluetooth comprising:

[0006] Performing binary difference analysis on the current version firmware and the target version firmware to generate a firmware differential package;

[0007] Establishing a transmission timing function according to the firmware differential package, and generating a data transmission control strategy based on the transmission timing function;

[0008] Collecting signal parameters between the master and slave headsets and the mobile terminal to generate a data transmission path sequence;

[0009] Monitor the transmission status of data segments according to the data transmission path sequence and the data transmission control policy, and determine the optimal transmission rate;

[0010] Based on the optimal transmission rate, verify the integrity check code of the received data segments, write the data segments that pass the verification into the firmware buffer, and record the write status information;

[0011] According to the write status information, generate an updated firmware data packet from the data segments in the firmware buffer, and write the updated firmware data packet into the firmware storage area.

[0012] In a second aspect, the present invention provides a wireless firmware upgrade device for a Bluetooth-connected Bluetooth headset, and the wireless firmware upgrade device for a Bluetooth-connected Bluetooth headset includes:

[0013] A difference analysis module for performing binary difference analysis on the current version firmware and the target version firmware to generate a firmware difference package;

[0014] A building module for building a transmission timing function according to the firmware difference package and generating a data transmission control policy based on the transmission timing function;

[0015] An acquisition module for acquiring signal parameters between the master and slave headsets and the mobile terminal to generate a data transmission path sequence;

[0016] A status monitoring module for monitoring the transmission status of data segments according to the data transmission path sequence and the data transmission control policy, and determining the optimal transmission rate;

[0017] A writing module for verifying the integrity check code of the received data segments based on the optimal transmission rate, writing the data segments that pass the verification into the firmware buffer, and recording the write status information;

[0018] A generating module for generating an updated firmware data packet from the data segments in the firmware buffer according to the write status information, and writing the updated firmware data packet into the firmware storage area.

[0019] In a third aspect of the present invention, a computer device is provided, including: a memory and at least one processor, wherein instructions are stored in the memory; the at least one processor calls the instructions in the memory so that the computer device executes the above-mentioned wireless firmware upgrade method for a Bluetooth-connected Bluetooth headset.

[0020] The fourth aspect of the present invention provides a computer-readable storage medium, in which instructions are stored. When the instructions run on a computer, the computer is made to execute the above-mentioned wireless upgrade method for the firmware of a Bluetooth-connected Bluetooth headset.

[0021] In the technical solution provided by the present invention, by performing binary difference analysis on the current version firmware and the target version firmware, targeted data segments and firmware differential packages are generated, significantly reducing the amount of data to be transmitted and improving the upgrade efficiency. Based on the transmission timing function and the data transmission control strategy, the system can dynamically adjust the transmission parameters according to the real-time network conditions to ensure the optimal transmission effect in different network environments. By collecting and analyzing the signal parameters between the master and slave headsets and the mobile terminal, the system can evaluate the quality of different transmission paths in real time, select the optimal transmission path, and improve the stability and reliability of data transmission. A multiple verification mechanism is adopted, including CRC32 verification, SHA256 hash verification, etc., to ensure the integrity and accuracy of the data during the firmware upgrade process, greatly reducing the risk of upgrade failure. By real-time monitoring the transmission status, the system can automatically calculate and adjust the optimal transmission rate to maximize the transmission efficiency while ensuring the transmission reliability. By detailed recording of the write status information and adopting the segmented transmission strategy, the system supports the resume function. Even if an interruption occurs during the upgrade process, the upgrade can be continued from the breakpoint, improving the user experience. Through reasonable storage space division and mapping management, the data storage security and efficiency during the firmware update process are ensured, avoiding upgrade failures caused by storage problems. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of 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 some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0023] Figure 1 It is a schematic diagram of the steps of the wireless upgrade method for the firmware of a Bluetooth-connected Bluetooth headset in an embodiment of the present invention;

[0024] Figure 2 It is a schematic diagram of the structure of the wireless upgrade device for the firmware of a Bluetooth-connected Bluetooth headset in an embodiment of the present invention;

[0025] Figure 3 It is a schematic block diagram of the structure of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0026] An embodiment of the present invention provides a method and device for wirelessly upgrading the firmware of a Bluetooth headset connected via Bluetooth. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims, and above-mentioned drawings of the present invention are used to distinguish similar objects and do not necessarily describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the term "comprising" or "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.

[0027] For ease of understanding, the specific process of the embodiment of the present invention is described below. Please refer to Figure 1 , an embodiment of the method for wirelessly upgrading the firmware of a Bluetooth headset connected via Bluetooth in the embodiment of the present invention includes:

[0028] Step S1: Perform binary difference analysis on the current version firmware and the target version firmware to generate a firmware differential package;

[0029] It can be understood that the execution subject of the present invention can be a device for wirelessly upgrading the firmware of a Bluetooth headset connected via Bluetooth, or a terminal or a server. Specifically, it is not limited here. The embodiment of the present invention is described by taking the server as the execution subject as an example.

[0030] Specifically, perform a binary scan on the current version firmware and the target version firmware, parse the two versions of firmware into byte-level data representation forms, and obtain the complete byte sequences of each firmware. Divide the firmware byte sequences into blocks. Use data blocks with a fixed size of 512 bytes as the basic unit. By splitting the byte sequence into multiple independent blocks, the data complexity can be significantly reduced during the comparison process, and at the same time, the efficiency of difference analysis can be improved. Perform binary comparison operations on the data blocks. By comparing each corresponding data block in the current version firmware and the target version firmware, mark the byte positions where changes occur to obtain difference data records. The difference data records indicate the specific positions and contents where changes exist between the two versions. Merge the continuous change regions in the difference data records to generate the minimum difference unit. Integrate adjacent byte regions where changes occur into a continuous data block to reduce the dispersion of transmitted data and improve the overall efficiency of data packaging and transmission. According to the size and distribution positions of the minimum difference units, perform data segmentation operations. Based on the actual distribution of the data, divide the difference data into data segments with relatively balanced lengths. This segmentation method can reduce the deviation of data during transmission and adapt to the transmission characteristics under the Bluetooth protocol, thereby ensuring the smoothness of the transmission process. Number the data segments with relatively balanced lengths based on the serialization algorithm. By generating a unique segment sequence number for each data segment and combining its position information in the firmware, create a segment identification code. Perform the CRC32 checksum algorithm operation on each data segment to generate its corresponding integrity checksum. The integrity checksum is a verification mechanism that generates a fixed-length check value by encoding the content of the data segment to quickly verify whether the segmented data has been tampered with or damaged during data reception. After packing and combining the data segments, the segment identification code, and the integrity checksum, generate the final firmware difference package. This firmware difference package contains all the key information required for firmware updates, including data content, position information, and integrity verification mechanisms.

[0031] Step S2: Establish a transmission timing function based on the firmware difference package, and generate a data transmission control strategy based on the transmission timing function;

[0032] Specifically, parse the firmware differential package to extract the size sequence and segment identification code sequence of the data segments contained therein. These pieces of information respectively correspond to the actual data volume of each data segment and the unique identifier used to identify its position during transmission. By constructing the size sequence and segment identification code sequence into a binary tuple, the size and identification information of each data segment are associated. Sort the binary tuples in the order of the segment identification codes to ensure the orderliness and consistency of data transmission. Through sorting, a data transmission sequence is generated, which defines the logical order of each data segment during transmission, avoiding the risk of data chaos or loss. Calculate the transmission time interval between adjacent data segments according to the data transmission sequence. The calculation of the transmission time interval is based on parameters such as the size of the data segment, the transmission rate of the Bluetooth protocol, and the signal delay between devices. By accurately measuring these time intervals, the time behavior characteristics during data transmission are obtained. Based on these transmission time intervals, construct a monotonically increasing time behavior monitoring function, which can dynamically reflect the time regularity and stability during the data segment transmission process. Based on the time behavior monitoring function, calculate the timing characteristic value of data transmission. The timing characteristic value is a quantitative expression of the time pattern during the transmission process, used to evaluate whether the current transmission state meets the expectations. Compare the timing characteristic value with a preset threshold to obtain the judgment result of the timing state. If the timing characteristic value exceeds the threshold range, it indicates that there is an abnormality in the transmission process, such as an increase in network delay or an intensification of signal interference, thus requiring adjustment measures. According to the judgment result of the timing state, group the data segments to optimize the transmission process. The grouping process divides the data segments into multiple transmission tasks according to the transmission conditions, and each transmission task contains a certain number of segmented data. For each transmission task, calculate its corresponding execution time sequence, that is, the time arrangement for task execution. Construct a transmission timing function based on the priority of the transmission task queue and the execution time sequence. The transmission timing function defines the time arrangement and priority rules during the data segment transmission process, enabling the transmission tasks to be efficiently executed in the established order. At the same time, based on the transmission timing function, set the retransmission trigger condition. The retransmission trigger condition is used to dynamically start the retransmission mechanism when the data segment transmission fails, thus ensuring data integrity. The setting of the retransmission condition takes into account various factors such as transmission delay, data loss rate, and timing characteristic value to achieve fast and reliable retransmission. Combine the transmission timing function and the retransmission trigger condition into a data transmission control strategy. This control strategy can dynamically adjust the data segment transmission process to adapt to different network environments and transmission states.

[0033] Step S3: Collect the signal parameters between the master and slave earphones and the mobile terminal to generate a data transmission path sequence;

[0034] Specifically, sample the signal strength (RSSI) between the master earphone, the slave earphone and the mobile terminal, and obtain a matrix representing the signal strength by real-time monitoring of the signal transmission environment between devices. , where represents the device and the device at time of the signal strength value. Sampling of the signal strength can reflect the link quality between devices. At the same time, measure the bit error rate (BER) between the master and slave earphones and the mobile terminal to generate a bit error rate sequence , where represents the device and the device at time of the bit error rate value. Measurement of the bit error rate can reflect the reliability during data transmission. According to the signal strength matrix and the bit error rate sequence , calculate the link quality index (LQI), which is defined as . Among them, and are coefficients used to balance the weights of the signal strength and the bit error rate. This formula comprehensively considers the positive impact of the signal strength and the negative impact of the bit error rate, can quantify the comprehensive quality of each link, and provides a quantitative basis for path optimization. Perform threshold classification processing on the link quality index to generate a link level sequence . The link level sequence divides the link quality into different levels for subsequent path evaluation. Based on , construct a connection topology graph between devices, where represents the set of device nodes, represents the set of links between nodes. Use the device connection topology graph to perform path optimization, calculate the optimal path between nodes through the shortest path algorithm, and obtain a path weight matrix , where represents from node to node The weight value of the optimal path. The calculation of the path weight matrix is based on link quality indicators and the topology structure, which can ensure that the selected path achieves a better balance in terms of signal strength, bit error rate, etc. After obtaining the path weight matrix, the paths are sorted to generate a priority queue for data transmission between the master earphone and the slave earphone. The generation of the priority queue is based on the path weights. The higher the weight, the lower the priority of the path, while the lower the weight, the higher the priority of the path. At the same time, combined with the path weight matrix, the data throughput threshold of each path is calculated to ensure that the path can carry the corresponding amount of data during actual transmission and avoid performance degradation caused by overloading. Availability verification is performed on each path in the priority queue. By detecting parameters such as the current load status and link interference degree of the path, a path status vector is generated. The path status vector is a marking mechanism used to indicate whether each path is available at a specific moment and the current state of its transmission capacity. The priority queue and the path status vector are combined and calculated to generate the final data transmission path sequence. The data transmission path sequence comprehensively considers various factors such as path priority, status vector, and throughput threshold, and can dynamically adapt to the actual network environment.

[0035] Step S4: According to the data transmission path sequence and the data transmission control strategy, monitor the transmission status of the data segments and determine the optimal transmission rate;

[0036] Specifically, the transmission process of each data segment is monitored in real time according to the data transmission path sequence. During this process, status parameters related to transmission are collected, including the packet loss rate and transmission delay of the data segment. The packet loss rate can reflect the reliability of data transmission, while the transmission delay directly affects the transmission efficiency. These parameters are collected through the low-level mechanism of the Bluetooth protocol. For example, the packet loss event is reported using the transmission feedback signal or the delay is calculated by comparing timestamps, forming a complete set of transmission status parameter data sets. The transmission status parameters are subjected to time window statistical operations to extract the dynamic characteristics of data transmission. By setting a fixed time window range, the change trend of the packet loss rate and the fluctuation range of the transmission delay during data transmission are analyzed to generate a status feature sequence. The status feature sequence can provide a description of the continuity and change law of the current data transmission status, facilitating subsequent quality assessment and rate optimization operations. For example, when the status feature sequence shows that the packet loss rate continues to increase or the delay fluctuation increases significantly, it means that the stability of the current transmission path is decreasing. Based on the generated status feature sequence and the retransmission trigger condition in the data transmission control strategy, a comprehensive evaluation of the current data transmission quality is carried out to obtain a transmission quality score. The transmission quality score is a quantitative indicator used to measure the quality of the current transmission status. The calculation of the score combines multi-dimensional parameters such as the packet loss rate and delay, and is compared with the preset control strategy threshold. For example, when the transmission quality score is lower than a certain threshold, it indicates that the current transmission status cannot meet the expected requirements and adjustment measures need to be taken. After completing the transmission quality assessment, the current transmission rate is dynamically adjusted and calculated according to the transmission quality score. The adjustment process is achieved by generating a rate adjustment factor, which is dynamically determined based on the deviation magnitude of the transmission quality score and is used to increase or decrease the current transmission rate. At the same time, considering the transmission priority of the data segment, the rate adjustment factor and the priority are weighted and calculated to obtain the target transmission rate of each data segment. According to the transmission timing function in the data transmission control strategy, rate constraint processing is performed on the generated target transmission rate. Based on the target transmission rate, combined with the rate limit of the Bluetooth protocol and the signal conditions between devices, the effective transmission rate range is determined. The effective transmission rate range defines the acceptable interval of the transmission rate in the current environment, which should not only meet the requirements of transmission quality but also avoid packet loss or delay problems caused by too high a rate. After determining the effective transmission rate range, the rate values within this range are traversed and tested to evaluate the transmission performance at different rates. The traversal test simulates the transmission process and records the key performance indicators such as the packet loss rate, delay, and throughput at different rates to generate a test result sequence. According to the test result sequence, the rate value with the optimal performance indicator is selected as the final optimal transmission rate.

[0037] Step S5: Based on the optimal transmission rate, verify the integrity check code of the received data segment, write the data segment that passes the verification into the firmware buffer, and record the write status information;

[0038] Specifically, the double-check mechanism is executed on the received data segments in the order of the segment identification codes. The first-level check uses the CRC check algorithm. By calculating the CRC check value of the received data segment and comparing it with the check value attached to the original segment, it is verified whether the data segment has been damaged during transmission. In this way, the integrity problems of the data can be quickly detected and marked, ensuring that the data segments entering the subsequent processing flow are all valid transmission results. The result of the first-level CRC check is recorded as the basic integrity status identifier of the data, which is used to determine whether further checks are required. After the data passes the first-level CRC check, the identifier sequence comparison is performed according to its segment identification code, thus completing the second-level check. The purpose of this level of check is to confirm whether the transmission order of the data segments is correct, avoiding logical errors caused by out-of-order or duplicate transmission during the process. By comparing the consistency of the identification code of each segment with the expected sequence, it is ensured that the data segments logically meet the requirements of updating the firmware. After the double-check is successful, the real-time transmission reliability index R is calculated. This index is calculated by the ratio of the number of successful checks to the total number of checks. The real-time transmission reliability index can reflect the overall quality of the current data transmission. According to the real-time transmission reliability index R, the data segments that pass the check are classified and processed to generate a write priority queue. The write priority queue is sorted according to the importance, reliability, and logical requirements of the segments, so that high-priority data can be written into the buffer as soon as possible. Through the dynamic priority control mechanism, the maximum efficiency of data writing is achieved under limited processing resources, while reducing data redundancy caused by delays or retransmissions. After generating the write priority queue, the data segments are written into the pre-allocated firmware buffer in the order of the queue, and a write completion mark is generated for each successfully written segment. The write completion mark is a status record indicating that the segment has completed the write operation and can enter the next verification and processing flow. The write operation also needs to consider the space management of the buffer to ensure efficient writing while avoiding data overwriting or space waste. When the data segment is successfully written into the firmware buffer, the SHA256 hash operation is performed on it to generate the data integrity verification value of the segment. By comparing the hash value of the segment data with the preset reference hash value, the integrity of the data can be verified again, and additional detection capabilities for potential transmission or storage errors are provided. If the hash value comparison is successful, the final verification result is generated for the data segment, and the write completion mark is updated according to the result. The final verification result is a comprehensive confirmation of the data reliability, ensuring that only the data that passes the integrity verification will be included in the firmware update process. According to the write completion mark and the final verification result, the complete write status information is generated. The write status information includes the write progress identifier and the check status identifier, where the write progress identifier is used to record the overall completion degree of the current firmware update, and the check status identifier reflects the checksum and verification results of each data segment.

[0039] Step S6: According to the write status information, segment the data in the firmware buffer to generate an updated firmware data packet, and write the updated firmware data packet into the firmware storage area.

[0040] Specifically, the written status information is parsed and calculated to extract the write position table of data segments. The write position table contains the start address and length information of each data segment in the firmware buffer, and these information provide an accurate position index for data storage in the buffer. By parsing the written status information, each successfully written data segment can be accurately located to ensure that subsequent operations can correctly read and process this data. The firmware buffer is read according to the start address and length information in the write position table to generate a data sequence to be synthesized. After the reading is completed, the segment identifiers of the data sequence to be synthesized are checked. The checking operation ensures that there are no omissions, out-of-order or duplicate writes during the transmission process by comparing the identifiers of the data segments with the expected order. The data segments in the data sequence to be synthesized are sorted according to the segment identifiers to generate an ordered data stream. The data is reorganized in the logical order of the segments to ensure that it can be correctly mapped to the corresponding position of the target firmware after merging. The generated ordered data stream is merged with the current version of the firmware. During this process, the part to be updated is overwritten by the ordered data stream, while the unchanged part remains unchanged, forming the firmware data content containing the latest changes. The merged data is aligned at the boundary to ensure that the firmware data conforms to the physical page division rules of the device storage area during storage and to avoid storage anomalies or performance degradation caused by misalignment. The aligned data is divided into multiple firmware data blocks, and these data blocks are organized into a firmware page sequence. The size of each page is usually the same as the storage page size of the device. After generating the firmware page sequence, the firmware storage area is divided according to its size to create a storage area mapping table. The storage area mapping table records the target storage address of each firmware page, providing a clear address reference for page writing. The generation of the mapping table needs to ensure that the firmware pages do not overwrite existing data or exceed the storage space, and at the same time meet the address allocation strategy of the storage area. Based on the storage area mapping table, the firmware page sequence is written into the firmware storage area in sequence. During the writing operation, the write status is recorded for each successfully written page, so that the pages that are not successfully written can be retransmitted or rewritten when needed. After the page writing is completed, a firmware data packet containing the complete update content is generated. An integrity check operation is performed on the updated firmware data packet after writing. By calculating its firmware integrity check value and comparing it with the reference check value of the target version firmware, it is verified whether the data packet completely conforms to the expected content of the target firmware. A firmware update completion flag is generated according to the comparison result of the check values. The firmware update completion flag records the current update status information, including whether the update is successfully completed, whether a retry is required, etc. The generated firmware update completion flag is written into the firmware storage area to provide the device with traceable information about the current firmware status, completing the entire firmware update process.

[0041] In the embodiments of the present invention, by performing binary difference analysis on the current version firmware and the target version firmware, targeted data segmentation and firmware differential packages are generated, significantly reducing the amount of data to be transmitted and improving the upgrade efficiency. Based on the transmission timing function and the data transmission control strategy, the system can dynamically adjust the transmission parameters according to the real-time network conditions to ensure the optimal transmission effect in different network environments. By collecting and analyzing the signal parameters between the master and slave earphones and the mobile terminal, the system can evaluate the quality of different transmission paths in real time, select the optimal transmission path, and improve the stability and reliability of data transmission. A multiple verification mechanism is adopted, including CRC32 verification, SHA256 hash verification, etc., to ensure the integrity and accuracy of the data during the firmware upgrade process, greatly reducing the risk of upgrade failure. By real-time monitoring the transmission status, the system can automatically calculate and adjust the optimal transmission rate to maximize the transmission efficiency while ensuring the transmission reliability. By detailed recording of the write status information and adopting the segmented transmission strategy, the system supports the breakpoint resume function, that is, even if an interruption occurs during the upgrade process, it can continue to complete the upgrade from the breakpoint, improving the user experience. Through reasonable storage space division and mapping management, it ensures the data storage security and efficiency during the firmware update process and avoids upgrade failures caused by storage problems.

[0042] In a specific embodiment, the process of executing step S1 may specifically include the following steps:

[0043] Perform a binary scan on the current version firmware and the target version firmware to obtain the firmware byte sequence, and perform block division on the firmware byte sequence to generate data blocks with a fixed size of 512 bytes;

[0044] Perform a binary comparison operation on the data blocks, mark the changed data positions to obtain the differential data record, and based on the differential data record, perform a merging process on the continuously changed data regions to generate the minimum differential unit;

[0045] According to the size and distribution position of the minimum differential unit, perform a data segmentation division operation to obtain data segments with balanced lengths;

[0046] Number the data segments with balanced lengths based on the serialization algorithm to generate a segmentation identification code including the segment sequence number and position information;

[0047] Perform the CRC32 verification algorithm operation on each data segment to generate an integrity verification code, and package and combine the data segment, the segmentation identification code, and the integrity verification code to generate a firmware differential package.

[0048] Specifically, perform a binary scan on the current version firmware and the target version firmware and convert them into a byte-level data representation form, that is, the firmware byte sequence. Let the byte sequence of the current version firmware be , the byte sequence of the target version firmware is , where and represent the byte value of the firmware data at position , is the total number of bytes of the firmware. For and , perform block partitioning to generate data blocks with a fixed size of 512 bytes. Let the size of a block be , then is divided into data blocks , and the content of each data block is 512 consecutive bytes, specifically represented as . The byte sequence of the target version firmware is also divided into according to the same rule. Perform binary comparison operations on the data blocks of the current version and the target version. By comparing the content of and byte by byte, mark the positions of the changed bytes. For example, for data blocks and , the comparison formula is If , otherwise , where represents whether the th byte in the th data block has changed. Through this process, obtain the difference matrix , recording the positions of all changed bytes. After marking the changed positions, perform merging processing on the difference data to generate the smallest difference unit. Let the continuous range of changed bytes be , where start and end represent the start and end positions of the changed area. By merging the continuous areas of the difference matrix , it is possible to effectively reduce the fragmentation of data segmentation and generate larger difference units. For example, if two adjacent difference data areas are respectively and , then merge them into . After obtaining the smallest difference unit, perform data segmentation division operations according to its size and distribution position. To generate data segments with balanced lengths, calculate the byte length of each difference unit and divide it into segments close to the preset length. Let the target length of each data segment be , and the division formula is , where represents dividing a single difference unit into The number of segments. For example, if the length of the differential unit is 800 bytes and the target segment length is 256 bytes, it is divided into "800 / 256| = 4 segments. After each segment is generated, a unique segment sequence number and position information are assigned to it based on the serialization algorithm. Let the segment number be , and the starting position of the segment in the target firmware is , then a segment identification code is generated for each data segment , where is an integer number, increasing sequentially. For example, the identification code of the first segment can be , indicating that the first segment starts from byte 0 of the target firmware. The CRC32 check algorithm operation is performed on each data segment to generate an integrity check code. The calculation formula for the CRC32 check value is mod , where is the binary representation of the data segment as a polynomial, is a predefined generating polynomial. The CRC check value is used to detect whether an error occurs in the data during transmission. For example, if the binary representation of a certain data segment is , and the generating polynomial is , then the calculated check value may be . The data segment, segment identification code, and integrity check code are packed and combined into a firmware differential package.

[0049] Before performing the binary comparison operation on the data block in this embodiment, it further includes: constructing a dynamic block optimization tree T(V, E) based on the recursive dichotomy method, where V is the set of block nodes and E is the set of splitting edges; performing a sliding window scan on the firmware byte sequence to calculate the local entropy value H(i)=-Σp(x i )log(p(x i ))), where p(x i ) is the occurrence probability of the byte x i within the window; constructing a data complexity distribution graph C(x) based on the local entropy value H(i), and marking the set of mutation points P={p 1 ,p 2 ,...,p n} on the data complexity distribution graph C(x); performing a splitting operation on the dynamic block optimization tree T(V, E) based on the set of mutation points P to generate a set of candidate block scheme S={s 1 ,s 2 ,...,s m}; constructing a block evaluation function F(s)=λ 1 ×D(s)+λ 2 ×B(s)+λ 3×O(s), where D(s) is the data similarity, B(s) is the block balance, O(s) is the transmission overhead, and λ 1 and λ 2 and λ 3 are weight coefficients; calculate the evaluation score for each scheme in the candidate block scheme set S, and perform scheme ranking and screening based on the evaluation score; use the simulated annealing algorithm to perform local optimization on the screened block scheme to obtain the optimal block scheme ; according to the optimal block scheme generate a block instruction sequence, and use the block instruction sequence for subsequent binary comparison operations of data blocks.

[0050] In a specific embodiment, the process of executing step S2 may specifically include the following steps:

[0051] Parse the firmware differential package to obtain the size sequence and segment identification code sequence of the data segments, and construct the size sequence and segment identification code sequence into a binary tuple;

[0052] Sort the binary tuple in the order of the segment identification code to generate a data transmission sequence, and calculate the transmission time interval between adjacent data segments according to the data transmission sequence;

[0053] Construct a monotonically increasing time behavior monitoring function based on the transmission time interval, calculate the timing characteristic value of data transmission according to the time behavior monitoring function, and compare the timing characteristic value with a preset threshold to obtain a timing state judgment result;

[0054] Group the data segments based on the timing state judgment result to generate a transmission task queue, and calculate the execution time sequence of the transmission task queue;

[0055] Construct a transmission timing function according to the priority and execution time sequence of the transmission task queue, and set a retransmission trigger condition based on the transmission timing function;

[0056] Combine the transmission timing function and the retransmission trigger condition into a data transmission control strategy, and the data transmission control strategy is used to control the transmission process of data segments.

[0057] Specifically, parse the firmware differential package to extract the data segment size sequence and segment identification code sequence contained therein. Assume that the firmware differential package contains data segments, and the size of each data segment is represented by , and its segment identification code is represented by , where represents the serial number of the segment. After parsing, two sequences are obtained: the size sequence and the identification code sequence This information is used to describe the specific attributes of each segment. The size sequence and the identification code sequence are constructed in the form of a binary tuple , where represents the identification code and size information of the th segment. By constructing the binary tuple, the attributes of each data segment are associated, providing a structured representation for sorting and processing. The binary tuples are sorted in the order of the segment identification code to generate a data transmission sequence , where is the sorted binary tuple. After obtaining the data transmission sequence, calculate the transmission time interval between adjacent data segments. Let the transmission rate of each data segment be , then the time interval between segment and segment is expressed as:

[0058] ;

[0059] where is the transmission time interval between segment and , is the size of segment , is the data transmission rate per unit time. By calculating the transmission time intervals one by one, a time interval sequence is generated. Based on the calculated time intervals, a monotonically increasing time behavior monitoring function is constructed to dynamically record the cumulative time behavior of data transmission. The definition of the monitoring function is:

[0060] ;

[0061] where represents the current cumulative to the th segment, reflects the total elapsed time of data transmission up to the current moment . According to this function, calculate the timing characteristic value of data transmission, and its definition is:

[0062] ;

[0063] where represents the fluctuation amplitude of the transmission time, used to evaluate the stability of the data transmission process. Compare the timing characteristic value with a preset threshold . If , it is considered that the transmission process is stable, otherwise it is considered that there is a fluctuation anomaly. The timing state judgment result is expressed as:

[0064] ;

[0065] Based on the timing status judgment result , group the data segments to generate a transmission task queue. The task queue is adjusted according to the value. If the transmission is stable ( ), add the data to the current queue in sequence; if there are fluctuations ( ), re - assign priorities to the data segments. Each task in the task queue contains several segments, and the execution time series is defined as the expected start and end transmission times for each task. Combining the task queue and the execution time series, construct a transmission timing function , which is defined as:

[0066] ;

[0067] This function describes the transmission activities of data segments in each time period and is used to dynamically adjust the transmission strategy. Based on the transmission timing function , set the re - transmission trigger condition. The re - transmission condition is defined as

[0068] ;

[0069] When the task is not completed within the expected time and the timing status is abnormal, trigger re - transmission. Combine the transmission timing function and the re - transmission trigger condition into a data transmission control strategy, which describes the transmission order, time arrangement, and exception handling process of data segments.

[0070] In a specific embodiment, the process of executing step S3 may specifically include the following steps:

[0071] Sample the signal strength RSSI between the master - slave earphones and the mobile terminal to obtain a signal strength matrix M(t) = {m ij (t)}, where m ij (t) represents the signal strength value between device i and device j at time t;

[0072] Measure the bit error rate BER between the master - slave earphones and the mobile terminal to generate a bit error rate sequence B(t) = {b ij (t)}, where b ij (t) represents the bit error rate value between device i and device j at time t;

[0073] Calculate the link quality index LQI(t)=α×M(t)-β×B(t) according to the signal strength matrix M(t) and the bit error rate sequence B(t), where α and β are weight coefficients;

[0074] Perform threshold classification processing on the link quality index LQI(t) to generate a link level sequence L(t), and construct a device connection topology graph G(V, E) based on the link level sequence L(t);

[0075] Calculate the shortest path P(i, j) between nodes according to the device connection topology graph G(V, E) to obtain a path weight matrix W = {w ij}, where w ij represents the optimal path weight from node i to node j;

[0076] Perform path sorting based on the path weight matrix W to generate a priority queue for data transmission between the master and slave headphones, and calculate the data throughput threshold for each path;

[0077] Verify the availability of the paths in the priority queue to generate a path status vector, and perform a combined operation on the priority queue and the path status vector to generate a data transmission path sequence.

[0078] Specifically, perform real-time sampling on the signal strength (RSSI) between the master headphone, the slave headphone, and the mobile terminal to generate a signal strength matrix . Among them, represents the signal strength value of device and device at time . Assume that there are three devices in the system: the master headphone (device 1), the slave headphone (device 2), and the mobile terminal (device 3), then the representation form of the signal strength matrix at time is:

[0079] ;

[0080] Among them is the signal strength from device to device , and the elements on the diagonal are always 0 because a device cannot sample its own signal. Measure the bit error rate (BER) between the master headphone, the slave headphone, and the mobile terminal to generate a bit error rate sequence . Among them, represents the bit error rate of device and device at time , such as 0.01 representing a 1% bit error rate. The form of the bit error rate matrix is similar to that of the signal strength matrix and is defined as:

[0081] ;

[0082] After collecting the signal strength and the bit error rate, calculate the link quality index (LQl) based on the two, and the formula is:

[0083] ;

[0084] where and are weight coefficients used to balance the impacts of signal strength and bit error rate on link quality. The selection of the weight coefficients depends on system requirements. For example, in cases where higher reliability is required, increase the value of to place more emphasis on the impact of bit error rate on link quality. Perform threshold classification processing on the link quality index matrix to divide the link quality indicators into several levels. Based on these classification results, generate a link level sequence , and construct a topology graph of device connections based on the link levels, where represents the set of devices, and represents the set of links whose connection quality meets the minimum requirements. Through the constructed topology graph of device connections, calculate the shortest paths between devices. Use the Dijkstra algorithm or the Floyd-Warshall algorithm to find paths based on the weighted values of link quality. Let the path weight from node to node be , and the definition of the weight is , that is, the higher the link quality, the lower the weight. The generated path weight matrix is:

[0085] ;

[0086] Based on the path weight matrix , sort the paths to generate a priority queue for master-slave headphone data transmission. The sorting is performed in ascending order of path weight values, and the lower the weight, the higher the path priority. Calculate the data throughput threshold for each path according to the path priority. The throughput calculation formula is:

[0087] ;

[0088] where represents the throughput threshold of path , is the theoretical maximum throughput, and is the bit error rate of the corresponding path. The calculated throughput threshold is used to evaluate the transmission capacity of the path and help screen applicable paths. Perform availability verification on the paths in the priority queue to generate a path status vector , where indicates that path is available, and Indicates unavailable. Combine the priority queue with the path status vector to generate the final data transmission path sequence.

[0089] In a specific embodiment, the process of executing step S4 may specifically include the following steps:

[0090] Monitor the transmission process of data segments according to the data transmission path sequence to obtain the transmission status parameters of each data segment. The transmission status parameters include packet loss rate and transmission delay;

[0091] Perform time window statistical operations on the transmission status parameters to generate a status feature sequence. The status feature sequence includes the change trend of the packet loss rate and the fluctuation range of the transmission delay;

[0092] Evaluate the data transmission quality based on the status feature sequence and the retransmission trigger condition in the data transmission control strategy to obtain a transmission quality score. The transmission quality score is used to measure the current transmission status;

[0093] Perform dynamic adjustment calculations on the current transmission rate according to the transmission quality score to generate a rate adjustment factor, and perform weighted calculations on the rate adjustment factor and the transmission priority of the data segment to obtain the target transmission rate of each data segment;

[0094] Perform rate constraint processing according to the target transmission rate and the transmission timing function in the data transmission control strategy to generate an effective transmission rate range;

[0095] Traverse and test the rate values within the effective transmission rate range to obtain a test result sequence, and select the rate value with the optimal transmission performance index as the optimal transmission rate according to the test result sequence.

[0096] Specifically, according to the data transmission path sequence, monitor the transmission process of each data segment in real time and collect the transmission status parameters. The transmission status parameters include the packet loss rate and the transmission delay , where represents the packet loss probability on the path , and the calculation formula is:

[0097] ;

[0098] where is the number of segments that have not successfully arrived on the path , is the total number of transmission attempts. And the transmission delay It is the time required for data to be transmitted from the source device to the target device, measured by the network protocol layer during the transmission process. Through these monitoring parameters, the current transmission status of each data segment on different paths is obtained. Statistical operations on the collected transmission status parameters are performed within a time window to generate a status feature sequence . The time window is defined as a fixed time period, for example, within the past 1 second. Statistics are performed on the packet loss rate and delay data within this time period. The changing trend of the packet loss rate is represented by calculating the average change rate over a period of time:

[0099] ;

[0100] where is the packet loss rate within the time window , and is the number of time windows. Similarly, the fluctuation range of the delay is defined by calculating the difference between the maximum value and the minimum value:

[0101] ;

[0102] The status feature sequence records the changing trend of the packet loss rate and the fluctuation range of the delay. Based on the status feature sequence and the retransmission trigger condition in the data transmission control strategy , data transmission quality assessment is performed. The formula for calculating the transmission quality score is:

[0103] ;

[0104] where and are weight coefficients used to balance the impact of the packet loss rate and the delay on the transmission quality, is the maximum allowable delay value. The higher the score, the better the transmission quality of the current path. If the score is lower than a certain threshold , the retransmission mechanism is triggered. According to the transmission quality score , dynamic adjustment calculations are performed on the current transmission rate . The core of the adjustment is to generate a rate adjustment factor , and its formula is:

[0105] ;

[0106] where represents the multiple of increasing the rate, represents the multiple of decreasing the rate, and and are the upper and lower thresholds used to evaluate the transmission status. The adjusted rate is:

[0107] ;

[0108] Based on the rate adjustment, combined with the transmission priority of data segmentation , perform weighted calculation on the rate adjustment factor and the priority to obtain the target transmission rate of each data segment :

[0109] ;

[0110] Priority is determined according to the importance and time sensitivity of the segment. For example, data segments that are sensitive to delay have higher priority. According to the target transmission rate and the transmission timing function in the data transmission control strategy perform rate constraint processing. The transmission timing function describes the maximum and minimum allowable transmission rates in different time periods. For example, the function is defined as:

[0111] ;

[0112] The target transmission rate needs to satisfy , generate a valid transmission rate range . Within the valid transmission rate range, traverse and test the rate values to evaluate their performance. Performance testing includes calculating key metrics such as packet loss rate, delay, and throughput at different rates, generating a test result sequence , where is the rate value of the test, is the corresponding transmission quality score. Select the rate value with the highest score as the optimal transmission rate, and the formula is:

[0113] ;

[0114] Through the above steps, dynamically adjust the transmission rate to adapt to the actual transmission status. For example, when the packet loss rate and delay fluctuate little, the rate will be increased to improve transmission efficiency; while when the network condition deteriorates, the rate will be decreased to improve transmission reliability.

[0115] Before determining the optimal transmission rate in this embodiment, the following steps are also included: constructing an upper-layer deep reinforcement learning model A including a policy network and a value network, and a lower-layer deep reinforcement learning model B including a Q network; constructing a state space S with transmission state parameters, a link quality indicator LQI(t), and a path weight matrix W, and constructing an action space A with a transmission rate adjustment range; sampling the state space S based on a γ random search strategy to generate a training sample sequence, and inputting the training sample sequence into the upper-layer deep reinforcement learning model A; generating a rate adjustment policy π(s) by the policy network, evaluating the state value V(s) by the value network, and constructing a reward function R(s, a) based on the rate adjustment policy π(s) and the state value V(s); inputting the reward function R(s, a) into the lower-layer deep reinforcement learning model B, calculating the action value Q(s, a) by the Q network, and selecting an optimal action sequence based on the action value Q(s, a); performing γ random perturbation on the optimal action sequence to generate an exploration action sequence, and applying the exploration action sequence to the transmission environment; collecting environmental feedback data, updating the state space S, and optimizing the parameters of the upper-layer deep reinforcement learning model A and the lower-layer deep reinforcement learning model B based on the environmental feedback data to obtain an optimized rate adjustment policy, and determining the optimal transmission rate based on the optimized rate adjustment policy.

[0116] In a specific embodiment, the process of executing step S5 may specifically include the following steps:

[0117] Perform a dual-check mechanism on the received data segments in the order of the segment identification codes to obtain a first-level CRC check result, which is used to verify the data integrity;

[0118] Perform an identifier sequence comparison on the data segments according to the first-level CRC check result to obtain a second-level check result, which is used to confirm the transmission order;

[0119] Calculate a real-time transmission reliability index R for the data segments that pass the dual-check. The real-time transmission reliability index R is equal to the ratio of the number of successful checks to the total number of checks;

[0120] Perform a grading process on the data segments based on the real-time transmission reliability index R to generate a write priority queue, which is used to control the data write order;

[0121] Write the data segments into the pre-allocated firmware buffer according to the write priority queue and generate a write completion flag;

[0122] Perform a SHA256 hash operation on the data segments written into the firmware buffer to obtain a data integrity verification value, compare the data integrity verification value with a preset hash value to generate a final verification result, and update the write completion flag;

[0123] Generate write status information based on the write completion flag and the final verification result. The write status information includes a write progress identifier and a verification status identifier.

[0124] Specifically, when a data segment is received, a dual verification mechanism is executed on it in the order of the segment identification code to ensure the integrity of the data and the correctness of the order. The first-level verification uses the cyclic redundancy check (CRC) algorithm, and the verification value is calculated by the following formula:

[0125] ;

[0126] where is the binary representation of the data segment as a polynomial, is a predefined generating polynomial. For example, the binary string of the data segment is , and the generating polynomial is . The calculated CRC value is compared with the verification value attached to the segment. If the two are consistent, the first-level verification passes, indicating that no error has occurred during the transmission of the data segment. After the first-level verification passes, the identifier sequence of the data segment is compared, which is the second level of the dual verification. The segment identification code is the unique number of each data segment, and its order must be consistent with the expected transmission sequence. Compare the currently received set of segment identification codes with the expected sequence to ensure they are consistent. If out-of-order or duplicate is detected, the identifier verification will fail, and the segment will be re-requested or ignored. For segments that pass the dual verification, calculate the real-time transmission reliability index , which is defined as the ratio of the number of successful verifications to the total number of verifications:

[0127] ;

[0128] where is the number of segments that pass the dual verification, is the total number of segments attempted to be transmitted. The real-time transmission reliability index is a key indicator that dynamically reflects the current transmission status and is used to measure the success rate of data transmission. Based on the real-time transmission reliability index , perform hierarchical processing on the data segments that pass the verification to generate a write priority queue. The priority of a segment is jointly determined by its importance and the value of . The higher the priority of a segment, the more forward it will be sorted in the queue. The rules for grading are defined as:

[0129] ;

[0130] where and is a weight coefficient used to balance the impact of data importance and transmission reliability on priority. Queues are arranged from highest to lowest priority to ensure that critical data segments can be written to the firmware buffer as soon as possible. According to the order of the priority queue, data segments are written to the pre-allocated firmware buffer. After each write operation is completed, a corresponding write completion mark is generated to record the write status of the segment. For example, the write completion mark is represented as a binary tuple , Status), where is the segment identification code, and Status indicates whether the write is successful. After the data segment is successfully written to the buffer, it is subjected to SHA256 hashing to verify data integrity. The calculation formula for the hash value is:

[0131] ;

[0132] where is the content of the data segment, is the generated hash value. By comparing the calculated hash value with the preset reference hash value, it is determined whether the data has been tampered with or damaged during the write process. If the hash values are the same, a final verification result of success is generated, and the write completion mark is updated. According to the write completion mark and the final verification result, write status information is generated. The write status information includes a write progress identifier and a verification status identifier, which respectively reflect the overall completion degree of the current firmware upgrade and the verification result of each segment. The calculation formula for the write progress identifier is:

[0133] ;

[0134] where is the number of segments that have been successfully written, is the total number of segments to be written. The verification status identifier is generated by marking the verification result of each segment. For example, CheckStatus indicates that the segment has passed the verification, and 0 indicates that it has not passed.

[0135] In a specific embodiment, the process of executing step S6 may specifically include the following steps:

[0136] Perform parsing operations on the write status information to obtain a write location table for the data segments. The write location table contains the start address and length information of the data segments in the firmware buffer;

[0137] Read data from the firmware buffer according to the start address and length information in the write location table to generate a data sequence to be synthesized, and check the segment identifiers of the data sequence to be synthesized;

[0138] Sort the data segments in the data sequence to be synthesized based on the segment identifier to generate an ordered data stream, and merge the ordered data stream with the current version of the firmware;

[0139] Perform boundary alignment on the merged data to generate a firmware data block, and perform page division on the firmware data block to generate a firmware page sequence;

[0140] Divide the firmware storage area according to the size of the firmware page sequence to generate a storage area mapping table, and the storage area mapping table contains the target storage address of each firmware page;

[0141] Perform a write operation on the firmware page sequence based on the storage area mapping table to generate an updated firmware data packet, and record the write status of each page;

[0142] Perform an integrity check operation on the updated firmware data packet after writing to obtain a firmware integrity check value, and compare the firmware integrity check value with the check value of the target version of the firmware;

[0143] Generate a firmware update completion flag according to the comparison result of the check values, and write the firmware update completion flag to the firmware storage area.

[0144] Specifically, perform a parsing operation on the write status information to extract the write position table of each data segment in the firmware buffer. The write position table contains the start address and length information of each data segment, which is used to accurately locate the storage position of the segmented data in the buffer. The structure definition of the position table is , where represents the identifier of the data segment, represents the start address of the segmented data in the buffer, represents the length of the segmented data. According to the start address and length information in the write position table, read each data from the firmware buffer one by one to generate a data sequence to be synthesized , where each represents a segmented data read from the buffer. After the reading is completed, check the segment identifiers of the data sequence to be synthesized to ensure that the read data is consistent with the content recorded in the write status information. The checking process is completed by comparing the actual identifier of the data segment and the expected identifier in the position table. If there is an inconsistency, the corresponding segment is marked as an error and re-reading or re-transmission is triggered. After the segment identifier check is successful, sort the data segments in the data sequence to be synthesized based on the identifier to generate an ordered data stream . The purpose of sorting is to ensure that the segmented data is arranged in the correct logical order for merging with the current version of the firmware. The ordered data stream is connected to the data of the current version of the firmware through a connection operation Perform data merging to generate updated firmware data The core of the merging operation is to replace or supplement new segments in the ordered data stream to the corresponding positions in the firmware while preserving the unchanged parts. The merged data needs to be boundary-aligned to meet the page alignment requirements of the device storage area. Boundary alignment is achieved by padding extra bytes or adjusting the data block size to conform to a fixed page size The aligned data is divided into multiple firmware data blocks Each data block has a size not exceeding the page size These data blocks are organized into a firmware page sequence Each page corresponds to a physical storage unit. Based on the size and quantity of the firmware page sequence, the firmware storage area is spatially partitioned to generate a storage area mapping table where represents the page , represents the target storage address of this page in the storage area. The mapping table ensures that page data can be accurately written to the specified storage area while avoiding data overwriting or storage conflicts. Under the guidance of the storage area mapping table, the system sequentially performs write operations on the firmware page sequence to generate the final updated firmware data packet. After each page is written, the write status Success or Failure is recorded to track the integrity and reliability of the writing process. After the write operation is completed, an integrity check operation is performed on the updated firmware data packet. The integrity check is completed by calculating the check value of the updated data packet and comparing it with the reference check value of the target version firmware. If the two are consistent, it indicates that the firmware update is successful; otherwise, the check failure is recorded and a corrective operation is triggered. The calculation of the check value uses the SHA256 algorithm, and the formula is:

[0145] ;

[0146] where is the firmware data. A firmware update completion flag is generated based on the comparison result of the check values. If the check is successful, then Completed; if the check fails, then Failed. The completion flag is written to a specific location in the firmware storage area as the final confirmation of the firmware status.

[0147] In this embodiment, after recording the write status information, it further includes: constructing an intelligent fault diagnosis decision tree F(N, R), where N represents the set of fault feature nodes and R represents the set of fault recovery rules; collecting the voltage fluctuation curve V(t), current change curve I(t), and temperature change curve T(t) during device operation to generate a feature vector sequence X(t); calculating the power density spectrum P(f) based on the feature vector sequence X(t) and performing wavelet transform on the power density spectrum P(f) to obtain a time-frequency feature matrix M; extracting a set of fault feature indicators K = {k1, k2,..., kn} from the time-frequency feature matrix M, including fluctuation amplitude, frequency offset, and phase difference; inputting the set of fault feature indicators K into the intelligent fault diagnosis decision tree F(N, R) to generate a fault type judgment result Y and a fault level evaluation value L; selecting an optimal recovery strategy r* from the set of fault recovery rules R according to the fault type judgment result Y and the fault level evaluation value L; generating a recovery instruction sequence C based on the optimal recovery strategy r*, where the recovery instruction sequence C includes operations such as data backup, state rollback, and parameter reset; executing the recovery instruction sequence C for fault recovery and updating the write status information.

[0148] The method for wirelessly upgrading the firmware of a Bluetooth headset through Bluetooth connection in the embodiments of the present invention has been described above. Next, a device for wirelessly upgrading the firmware of a Bluetooth headset through Bluetooth connection in the embodiments of the present invention will be described. Please refer to Figure 2 , an embodiment of the device for wirelessly upgrading the firmware of a Bluetooth headset through Bluetooth connection in the embodiments of the present invention includes:

[0149] A difference analysis module for performing binary difference analysis on the current version firmware and the target version firmware to generate a firmware difference package;

[0150] A establishment module for establishing a transmission timing function according to the firmware difference package and generating a data transmission control strategy based on the transmission timing function;

[0151] An acquisition module for acquiring signal parameters between the master and slave headsets and the mobile terminal to generate a data transmission path sequence;

[0152] A status monitoring module for monitoring the transmission status of data segments according to the data transmission path sequence and the data transmission control strategy to determine the optimal transmission rate;

[0153] A write module for verifying the integrity check code of the received data segments based on the optimal transmission rate, writing the data segments that pass the verification into the firmware buffer, and recording the write status information;

[0154] A generation module for generating an updated firmware data packet from the data segments in the firmware buffer according to the write status information and writing the updated firmware data packet into the firmware storage area.

[0155] Through the collaborative cooperation of the above-mentioned various components, by performing binary difference analysis on the current version firmware and the target version firmware, targeted data segments and firmware differential packages are generated, significantly reducing the amount of data that needs to be transmitted and improving the upgrade efficiency. Based on the transmission timing function and the data transmission control strategy, the system can dynamically adjust the transmission parameters according to the real-time network conditions to ensure optimal transmission effects in different network environments. By collecting and analyzing the signal parameters between the master and slave earphones and the mobile terminal, the system can evaluate the quality of different transmission paths in real time, select the optimal transmission path, and improve the stability and reliability of data transmission. A multiple verification mechanism is adopted, including CRC32 verification, SHA256 hash verification, etc., to ensure the integrity and accuracy of data during the firmware upgrade process, greatly reducing the risk of upgrade failure. By real-time monitoring the transmission status, the system can automatically calculate and adjust the optimal transmission rate to maximize the transmission efficiency while ensuring transmission reliability. By detailed recording of the write status information and adopting the segmented transmission strategy, the system supports the resume function, even if an interruption occurs during the upgrade, it can continue to complete the upgrade from the breakpoint, improving the user experience. Through reasonable storage space partitioning and mapping management, it ensures the data storage security and efficiency during the firmware update process, avoiding upgrade failures caused by storage problems.

[0156] Referring to Figure 3 , in an embodiment of the present invention, a computer device is further provided. The computer device may be a server, and its internal structure may be as Figure 3 shown. The computer device includes a processor, a memory, a display screen, an input device, a network interface, and a database connected through a system bus. Among them, the processor of the computer design is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the corresponding data in this embodiment. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the above method is implemented.

[0157] Those skilled in the art can understand that Figure 3 the structure shown in

[0158] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the above method is implemented. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.

[0159] Those of ordinary skill in the art can understand that all or part of the processes in the above method embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above method embodiments. Among them, any reference to a memory, storage, database, or other medium provided by the present invention and used in the embodiments can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM, etc.

[0160] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described system, system, and unit can refer to the corresponding processes in the foregoing method embodiments and will not be described herein again.

[0161] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs.

[0162] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of various embodiments of the present invention.

Claims

1. A method for wirelessly upgrading firmware of a Bluetooth headset connected via Bluetooth, characterized in that: The method comprises: Perform binary difference analysis on the current version firmware and the target version firmware to generate a minimum difference unit, and perform data segmentation operation according to the size and distribution position of the minimum difference unit to generate a firmware difference package; A transmission timing function is established according to the firmware differential packet, and a data transmission control strategy is generated based on the transmission timing function; specifically comprising: parsing the firmware differential packet to obtain a size sequence and a segment identification code sequence of data segments, and constructing the size sequence and the segment identification code sequence into a tuple; sorting the tuple according to the segment identification code sequence to generate a data transmission sequence, and calculating the transmission time interval of adjacent data segments according to the data transmission sequence; constructing a monotonically increasing time behavior monitoring function based on the transmission time interval, calculating the timing characteristic value of data transmission according to the time behavior monitoring function, and comparing the timing characteristic value with a preset threshold to obtain a timing state judgment result; grouping the data segments based on the timing state judgment result, generating a transmission task queue, and calculating the execution time sequence of the transmission task queue; constructing a transmission timing function according to the priority of the transmission task queue and the execution time sequence, and setting a retransmission trigger condition based on the transmission timing function; combining the transmission timing function and the retransmission trigger condition into a data transmission control strategy, and the data transmission control strategy is used to control the transmission process of the data segments; Collect signal parameters between the master and slave earphones and the mobile terminal to generate a data transmission path sequence; According to the data transmission path sequence and the data transmission control strategy, the data segment transmission status is monitored to determine the optimal transmission rate; Based on the optimal transmission rate, the received data segments are verified by integrity check codes, the verified data segments are written into the firmware buffer area, and the writing status information is recorded; According to the write status information, the data in the firmware cache area is segmented to generate updated firmware data packets, and the updated firmware data packets are written into the firmware storage area.

2. The method for wirelessly upgrading the firmware of a Bluetooth headset connected via Bluetooth according to claim 1, characterized in that: The binary difference analysis is performed on the current version firmware and the target version firmware to generate a minimum difference unit, and a data segmentation operation is performed according to the size and distribution position of the minimum difference unit to generate a firmware difference package, including: Perform binary scanning on the current version firmware and the target version firmware to obtain a firmware byte sequence, and divide the firmware byte sequence into blocks to generate data blocks with a fixed size of 512 bytes; Performing a binary comparison operation on the data block, marking the changed data position, obtaining a difference data record, and merging the continuously changed data area based on the difference data record to generate a minimum difference unit; According to the size and distribution position of the minimum difference unit, a data segmentation operation is performed to obtain data segments with balanced lengths; The length-balanced data segments are numbered based on a serialization algorithm to generate a segment identification code containing segment sequence number and position information; A CRC32 check algorithm operation is performed on each data segment to generate an integrity check code, and the data segment, the segment identification code and the integrity check code are packaged and combined to generate a firmware difference package.

3. The method for wirelessly upgrading the firmware of a Bluetooth headset connected via Bluetooth according to claim 1, characterized in that: The collecting of signal parameters between the master and slave earphones and the mobile terminal to generate a data transmission path sequence includes: The signal strength RSSI between the master and slave earphones and the mobile terminal is sampled to obtain the signal strength matrix M(t)={m ij (t)}, where m ij (t) represents the signal strength value between device i and device j at time t; The bit error rate BER between the master and slave earphones and the mobile terminal is measured to generate a bit error rate sequence B(t)={b ij (t)}, where b ij (t) represents the bit error rate value between device i and device j at time t; Calculate a link quality index LQI(t)=α×M(t)-β×B(t) according to the signal strength matrix M(t) and the bit error rate sequence B(t), where α and β are weight coefficients; Performing threshold grading processing on the link quality indicator LQI(t) to generate a link level sequence L(t), and constructing a device connection topology graph G(V, E) based on the link level sequence L(t); According to the device connection topology G(V, E), the shortest path P(h, k) between nodes is calculated to obtain the path weight matrix W={w hk }, where w hk represents the optimal path weight from node h to node k, where V represents the set of device nodes and E represents the set of links between nodes; Path sorting is performed based on the path weight matrix W, a priority queue for master and slave earphone data transmission is generated, and a data throughput threshold of each path is calculated; Availability verification is performed on the paths in the priority queue to generate a path state vector, and a combination operation is performed on the priority queue and the path state vector to generate a data transmission path sequence.

4. The method for wirelessly upgrading the firmware of a Bluetooth headset connected via Bluetooth according to claim 3, characterized in that: The step of monitoring the transmission status of the data segments and determining the optimal transmission rate according to the data transmission path sequence and the data transmission control strategy includes: Monitoring the transmission process of the data segments according to the data transmission path sequence to obtain transmission status parameters of each data segment, wherein the transmission status parameters include packet loss rate and transmission delay; Performing time window statistical operation on the transmission state parameter to generate a state feature sequence, wherein the state feature sequence includes a change trend of the packet loss rate and a fluctuation range of the transmission delay; Performing data transmission quality evaluation based on the state feature sequence and the retransmission trigger condition in the data transmission control strategy to obtain a transmission quality score, wherein the transmission quality score is used to measure the current transmission state; Dynamically adjust and calculate the current transmission rate according to the transmission quality score to generate a rate adjustment factor, and perform weighted calculation on the rate adjustment factor and the transmission priority of the data segment to obtain a target transmission rate for each data segment; Perform rate constraint processing according to the target transmission rate and the transmission timing function in the data transmission control strategy to generate an effective transmission rate range; The rate values ​​within the effective transmission rate range are traversed and tested to obtain a test result sequence, and the rate value with the best transmission performance index is selected as the optimal transmission rate according to the test result sequence.

5. The method for wirelessly upgrading the firmware of a Bluetooth headset connected via Bluetooth according to claim 4, characterized in that: Based on the optimal transmission rate, the received data segments are verified by integrity check codes, the verified data segments are written into the firmware buffer area, and the writing status information is recorded, including: Performing a double check mechanism on the received data segments according to the sequence of the segment identification codes to obtain a first-level CRC check result, wherein the first-level CRC check result is used to verify data integrity; Perform identifier sequence comparison on the data segments according to the first-level CRC check result to obtain a second-level check result, wherein the second-level check result is used to confirm the transmission order; Calculating a real-time transmission reliability index R for each segment of the data that has passed the double check, wherein the real-time transmission reliability index R is equal to the ratio of the number of successful checks to the total number of checks; Based on the real-time transmission reliability index R, the data segments are graded to generate a write priority queue, wherein the write priority queue is used to control the order of data writing; Writing the data into the pre-allocated firmware buffer area in segments according to the write priority queue, and generating a write completion mark; Performing a SHA256 hash operation on the data segments written into the firmware cache area to obtain a data integrity verification value, comparing the data integrity verification value with a preset hash value to generate a final verification result, and updating the write completion flag; The write status information is generated according to the write completion mark and the final verification result, and the write status information includes a write progress identifier and a verification status identifier.

6. The method for wirelessly upgrading the firmware of a Bluetooth headset connected via Bluetooth according to claim 5, characterized in that: The step of segmenting the data in the firmware cache area to generate an updated firmware data packet according to the write status information, and writing the updated firmware data packet into the firmware storage area includes: Performing a parsing operation on the write status information to obtain a write position table of the data segments, wherein the write position table includes a start address and length information of the data segments in the firmware buffer area; Reading data from the firmware buffer area according to the starting address and length information in the write position table to generate a data sequence to be synthesized, and checking the segment identifier of the data sequence to be synthesized; Sorting the data segments in the to-be-synthesized data sequence based on the segment identifiers to generate an ordered data stream, and merging the ordered data stream with the current version of the firmware; Aligning the merged data at boundaries to generate firmware data blocks, and dividing the firmware data blocks into pages to generate firmware page sequences; Spatially dividing the firmware storage area according to the size of the firmware page sequence, generating a storage area mapping table, wherein the storage area mapping table includes a target storage address of each firmware page; Performing a write operation on the firmware page sequence based on the storage area mapping table, generating the updated firmware data packet, and recording the write status of each page; Performing an integrity check operation on the updated firmware data packet that has been written to obtain a firmware integrity check value, and comparing the firmware integrity check value with a check value of the target version firmware; A firmware update completion flag is generated according to the verification value comparison result, and the firmware update completion flag is written into the firmware storage area.

7. A device for wirelessly upgrading firmware of a Bluetooth headset connected via Bluetooth, characterized in that: Used to execute the method for wirelessly upgrading the firmware of a Bluetooth headset connected via Bluetooth as claimed in any one of claims 1 to 6, the device for wirelessly upgrading the firmware of a Bluetooth headset connected via Bluetooth comprises: A difference analysis module, used to perform binary difference analysis on the current version firmware and the target version firmware, generate a minimum difference unit, and perform data segmentation operation according to the size and distribution position of the minimum difference unit to generate a firmware difference package; An establishment module, used to establish a transmission timing function according to the firmware differential package, and generate a data transmission control strategy based on the transmission timing function; The acquisition module is used to collect signal parameters between the master and slave earphones and the mobile terminal to generate a data transmission path sequence; A status monitoring module, used to monitor the transmission status of the data segments according to the data transmission path sequence and the data transmission control strategy, and determine the optimal transmission rate; A writing module, configured to perform integrity check code verification on the received data segments based on the optimal transmission rate, write the verified data segments into the firmware buffer area, and record writing status information; A generating module is used to generate updated firmware data packets by segmenting the data in the firmware cache area according to the write status information, and write the updated firmware data packets into the firmware storage area.

8. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the method for wirelessly upgrading firmware of a Bluetooth headset connected via Bluetooth as described in any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the processor is enabled to execute the method for wirelessly upgrading firmware of a Bluetooth headset connected via Bluetooth as claimed in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Efficient PLC firmware remote upgrading method

    CN117032771A

  • Data transmission optimization method and device

    CN117998457A