Device upgrading method and apparatus, and computer-readable storage medium

CN117544500BActive Publication Date: 2026-09-08TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210922473.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-02
Publication Date
2026-09-08
Estimated Expiration
2042-08-02

AI Technical Summary

Technical Problem

然而,本申请发明人在实际应用过程中发现,现有蓝牙设备程序升级方式存在由于丢包率高导致重传率高,进而导致升级速度慢的问题

Benefits of technology

[0046] In this embodiment, firstly, since the maximum received data packet size can reflect the buffer size of the device to be upgraded to a certain extent, by obtaining the maximum received data packet size of the device to be upgraded for a preset test file; and based on the maximum received data packet size, determining the single data packet size for transmitting the upgrade file to the device to be upgraded, and sending the upgrade file according to the single data packet size, it is possible to avoid the buffer size occupied by the single data packet size being greater than the buffer size of the device to be upgraded, thereby avoiding the problem of data packets overflowing the buffer of the device to be upgraded when sending the upgrade file, thus avoiding the packet loss rate during the upgrade of the device to be upgraded, and thus solving the problem of high retransmission rate caused by high packet loss rate, thereby reducing the retransmission rate during the upgrade of the device to be upgraded, thereby improving the upgrade speed of the device to be upgraded to a certain extent. Secondly, since the size of a single data packet can be determined based on the maximum received data packet size, it avoids using the same upgrade parameters (i.e., the same single data packet size and single packet data size) for the same upgrade file across different devices. This prevents packet loss issues where the same upgrade parameters may not cause packet loss on some devices but will cause packet loss on others, thus avoiding significant differences in upgrade speed across different devices using the same upgrade parameters. Thirdly, since different single packet data sizes and single data packet sizes can be determined for different devices to be upgraded, it avoids the problem of data packets overflowing the buffer of the device being upgraded. This allows full utilization of the inherent hardware characteristics of the device being upgraded to reduce packet loss rate, thereby reducing retransmission rate and increasing upgrade speed. Therefore, the increase in transmission speed does not depend on the hardware performance improvement of the device being upgraded, reducing the hardware cost of the device being upgraded.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117544500B_ABST
    Figure CN117544500B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a device upgrading method and device and a computer readable storage medium, which can acquire an upgrading file of a device to be upgraded, acquire a single packet data amount of transmission when the upgrading file is transmitted to the device to be upgraded, acquire a maximum received packet data amount of a preset test file by the device to be upgraded, determine a single slice data packet amount of transmission when the upgrading file is transmitted to the device to be upgraded based on the maximum received packet data amount, and send the upgrading file to the device to be upgraded based on the single packet data amount of transmission and the single slice data packet amount of transmission, so as to upgrade the device to be upgraded. The scheme can avoid the problem of high retransmission rate caused by high packet loss rate, and improve the upgrading rate of the device to be upgraded to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, specifically to a device upgrade method, apparatus, and computer-readable storage medium. Background Technology

[0002] With the rapid development of the Internet of Things (IoT), related smart devices such as Bluetooth devices are becoming increasingly diversified. Given Bluetooth's superior low-power performance, it is widely used in the IoT field. During use, Bluetooth devices can be upgraded via software.

[0003] Existing methods for upgrading Bluetooth devices primarily involve establishing a connection between the Bluetooth device and a smartphone, tablet, or similar device via built-in Bluetooth, and then performing over-the-air (OTA) updates to the device's software. However, the inventors of this application have discovered in practical applications that existing Bluetooth device upgrade methods suffer from high packet loss rates, leading to high retransmission rates and consequently slow upgrade speeds. Summary of the Invention

[0004] This application provides a device upgrade method, apparatus, computer equipment, and computer-readable storage medium, which can avoid the problem of high retransmission rate caused by high packet loss rate and improve the upgrade speed of the device to be upgraded to a certain extent.

[0005] In a first aspect, embodiments of this application provide a device upgrade method, the method comprising:

[0006] Obtain the upgrade file for the device to be upgraded;

[0007] Obtain the data volume of a single transmission packet when transmitting the upgrade file to the device to be upgraded;

[0008] Obtain the maximum number of data packets received by the device to be upgraded for the preset test file;

[0009] Based on the maximum received data packet size, determine the size of a single data packet to be transmitted when transmitting the upgrade file to the device to be upgraded;

[0010] Based on the amount of data transmitted in a single packet and the amount of data transmitted in a single fragment, the upgrade file is sent to the device to be upgraded in order to upgrade the device.

[0011] Secondly, embodiments of this application provide a device upgrade apparatus, the device upgrade apparatus comprising:

[0012] The first acquisition unit is used to acquire the upgrade file of the device to be upgraded.

[0013] The second acquisition unit is used to acquire the amount of data transmitted in a single packet when transmitting the upgrade file to the device to be upgraded.

[0014] The second acquisition unit is further configured to acquire the maximum number of data packets received by the device to be upgraded for a preset test file;

[0015] The second acquisition unit is further configured to determine the number of single data packets to be transmitted when transmitting the upgrade file to the device to be upgraded, based on the maximum number of received data packets;

[0016] The upgrade unit is used to send the upgrade file to the device to be upgraded based on the amount of data in the single transmission packet and the amount of data in the single transmission fragment, so as to upgrade the device to be upgraded.

[0017] In some embodiments of this application, the second acquisition unit is specifically used for:

[0018] Based on the preset test packet data volume, a preset test file is sent to the device to be upgraded;

[0019] Obtain the maximum number of data packets received by the device to be upgraded based on the preset test file.

[0020] In some embodiments of this application, the second acquisition unit is specifically used for:

[0021] Based on the data volume of the test packet, the preset test file is divided into packets to obtain multiple test data packets with numbered order;

[0022] The multiple test data packets are sent sequentially to the device to be upgraded according to their numerical order.

[0023] In some embodiments of this application, the second acquisition unit is specifically used for:

[0024] Obtain the data packet number fed back by the device to be upgraded based on the multiple test data packets;

[0025] The maximum number of data packets to be received is determined based on the data packet number.

[0026] In some embodiments of this application, the second acquisition unit is specifically used for:

[0027] The buffer size of the device to be upgraded is determined based on the maximum number of received data packets and the number of test single packets.

[0028] Based on the buffer size and the amount of data transmitted per packet, the amount of data transmitted per packet is determined when transmitting the upgrade file to the device to be upgraded.

[0029] In some embodiments of this application, the upgrade unit is specifically used for:

[0030] The upgrade file is divided into multiple upgrade data packets based on the amount of data transmitted in a single packet;

[0031] Based on the amount of single data packet transmitted, the multiple upgrade data packets are sliced ​​to obtain multiple upgrade data fragments of the upgrade file;

[0032] Obtain the upgrade connection interval of the device to be upgraded;

[0033] Based on the upgrade connection interval, the multiple upgrade data segments are sequentially sent to the device to be upgraded in order to upgrade the device.

[0034] In some embodiments of this application, the upgrade unit is specifically used for:

[0035] Query the current connection interval of the device to be upgraded;

[0036] If the current connection interval is greater than a preset Bluetooth connection interval threshold, a connection interval change request is sent to the device to be upgraded so that the device to be upgraded can adjust the current connection interval.

[0037] The adjusted connection interval of the device to be upgraded is taken as the upgrade connection interval.

[0038] In some embodiments of this application, the second acquisition unit is specifically used for:

[0039] Query the maximum transmission unit of the device to be upgraded;

[0040] Obtain the size of the header data of the upgrade file;

[0041] Based on the maximum transmission unit and the header data size, the amount of data per transmission packet when transmitting the upgrade file to the device to be upgraded is determined.

[0042] Thirdly, embodiments of this application also provide a computer device, the computer device including a processor and a memory, the memory storing a computer program, and the processor executing the steps in any of the device upgrade methods provided in embodiments of this application when calling the computer program in the memory.

[0043] Fourthly, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, the computer program being loaded by a processor to execute the steps in the device upgrade method.

[0044] Fifthly, embodiments of this application also provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the steps in any of the device upgrade methods provided in the embodiments of this invention.

[0045] From the above, it can be concluded that the embodiments of this application have the following beneficial effects:

[0046] In this embodiment, firstly, since the maximum received data packet size can reflect the buffer size of the device to be upgraded to a certain extent, by obtaining the maximum received data packet size of the device to be upgraded for a preset test file; and based on the maximum received data packet size, determining the single data packet size for transmitting the upgrade file to the device to be upgraded, and sending the upgrade file according to the single data packet size, it is possible to avoid the buffer size occupied by the single data packet size being greater than the buffer size of the device to be upgraded, thereby avoiding the problem of data packets overflowing the buffer of the device to be upgraded when sending the upgrade file, thus avoiding the packet loss rate during the upgrade of the device to be upgraded, and thus solving the problem of high retransmission rate caused by high packet loss rate, thereby reducing the retransmission rate during the upgrade of the device to be upgraded, thereby improving the upgrade speed of the device to be upgraded to a certain extent. Secondly, since the size of a single data packet can be determined based on the maximum received data packet size, it avoids using the same upgrade parameters (i.e., the same single data packet size and single packet data size) for the same upgrade file across different devices. This prevents packet loss issues where the same upgrade parameters may not cause packet loss on some devices but will cause packet loss on others, thus avoiding significant differences in upgrade speed across different devices using the same upgrade parameters. Thirdly, since different single packet data sizes and single data packet sizes can be determined for different devices to be upgraded, it avoids the problem of data packets overflowing the buffer of the device being upgraded. This allows full utilization of the inherent hardware characteristics of the device being upgraded to reduce packet loss rate, thereby reducing retransmission rate and increasing upgrade speed. Therefore, the increase in transmission speed does not depend on the hardware performance improvement of the device being upgraded, reducing the hardware cost of the device being upgraded. Attached Figure Description

[0047] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0048] Figure 1 This is a schematic diagram illustrating an application scenario of the device upgrade method provided in the embodiments of this application;

[0049] Figure 2 This is a schematic flowchart of an embodiment of the device upgrade method provided in this application;

[0050] Figure 3 This is a schematic diagram of a scenario interface provided in the embodiments of this application when upgrading a device;

[0051] Figure 4 This is an illustrative diagram illustrating the file transfer method provided in the embodiments of this application;

[0052] Figure 5 This is an illustrative diagram illustrating the sending of a preset test file to the device to be upgraded, provided in an embodiment of this application.

[0053] Figure 6 Another embodiment of the device upgrade method provided in this application is illustrated in the flowchart.

[0054] Figure 7 A schematic diagram of an embodiment of the device upgrade apparatus in this application;

[0055] Figure 8 A schematic diagram of the structure of the computer device involved in the embodiments of this application. Detailed Implementation

[0056] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0057] In the description of the embodiments of this application, it should be understood that the terms "first" and "second" are used to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Features defined with "first" and "second" may explicitly or implicitly include one or more of the stated features, rather than being used to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion.

[0058] This application provides a device upgrade method, apparatus, computer device, and computer-readable storage medium. The device upgrade apparatus can be integrated into the computer device, which can be a server or a terminal device such as a mobile phone, tablet computer, laptop computer, or desktop computer.

[0059] The device upgrade method in this embodiment can be implemented by a server or jointly by a terminal and a server. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms, but is not limited to these. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited herein.

[0060] The following example illustrates the method of upgrading a device using both a terminal and a server.

[0061] refer to Figure 1 The device upgrade system provided in this embodiment of the invention includes a terminal 10 and a server 20, etc.; the terminal 10 and the server 20 are connected through a network, such as through a wired or wireless network.

[0062] Terminal 10, which can be a terminal provided with the upgrade file, is used to send the upgrade file for device upgrade to server 20. Server 20 can receive the upgrade file sent by terminal 10, obtain the data volume of a single packet when transmitting the upgrade file to the device to be upgraded; obtain the maximum number of data packets received by the device to be upgraded for a preset test file; determine the data volume of a single data packet when transmitting the upgrade file to the device to be upgraded based on the maximum number of data packets received; and send the upgrade file to the device to be upgraded based on the data volume of a single packet and the data volume of a single data packet to upgrade the device.

[0063] The following is a detailed description in conjunction with the accompanying drawings. It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments. Although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than that shown in the drawings.

[0064] This application provides a device upgrade method, which relates to the field of Internet of Things (IoT) technology, and more specifically to the field of cloud IoT technology. In this embodiment, the device to be upgraded can be a cloud IoT device. The following description uses a computer device as the executing entity of this device upgrade method; for simplicity, this executing entity will be omitted in the subsequent text.

[0065] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to achieve data computing, storage, processing, and sharing.

[0066] The Internet of Things (IoT) refers to the use of various information sensors, RFID technology, GPS, infrared sensors, laser scanners, and other devices and technologies to collect real-time data on any object or process that needs to be connected or interacted with. This data includes information on sound, light, heat, electricity, mechanics, chemistry, biology, location, and other parameters. Through various possible network access methods, it enables ubiquitous connectivity between things and between things and people, achieving intelligent perception, identification, and management of objects and processes. The IoT is an information carrier based on the internet and traditional telecommunications networks, allowing all independently addressable ordinary physical objects to form an interconnected network.

[0067] Cloud IoT aims to connect the information sensed and commands received by traditional IoT devices to the Internet, truly achieving networking. It also enables massive data storage and computation through cloud computing technology. Due to the nature of IoT, which involves connecting things to each other and sensing the current operating status of each "object" in real time, a large amount of data information is generated in this process. How to aggregate this information and how to sift out useful information from the massive amount of data to support decision-making for future development have become key issues affecting the development of IoT. As a result, IoT cloud based on cloud computing and cloud storage technology has become a powerful support for IoT technology and applications.

[0068] like Figure 2 As shown, the specific process of this equipment upgrade method can be summarized in steps 201 to 205, as follows:

[0069] 201. Obtain the upgrade file for the device to be upgraded.

[0070] Among them, the devices to be upgraded refer to Bluetooth devices that need to be upgraded, such as smart home devices such as air conditioners, refrigerators, robot vacuums, and washing machines.

[0071] There are several ways to obtain the upgrade file in step 201, including, for example:

[0072] (1) After establishing a connection between the computer device and the device to be upgraded, the computer device obtains the upgrade file for the device to be upgraded. Specifically, firstly, the computer device establishes a connection with the device to be upgraded via Bluetooth. After the connection is established, the computer device, based on the device upgrade control component in the computer device, queries the network to see if a new version of the upgrade file exists for the device to be upgraded. Finally, if a new version of the upgrade file exists for the device to be upgraded, the computer device obtains the new version of the upgrade file from the upgrade file provider for subsequent upgrades of the device to be upgraded.

[0073] Device upgrade control components refer to control components used to upgrade the device to be upgraded, such as mini-programs or clients used to control the device. A specific example of a device upgrade control component is a mini-program used to control the operation, shutdown, working mode, firmware upgrade, etc. of smart home devices.

[0074] Please refer to Figure 3 Taking firmware upgrades of the device to be upgraded as an example: After the computer connects to the device to be upgraded via Bluetooth, a pop-up program on the computer prompts the device to be upgraded that an upgradeable firmware exists (i.e., the provider of the upgrade file has the latest upgrade file for the device to be upgraded). Figure 3 As shown, the upgrade file for the device to be upgraded is the file corresponding to "latest firmware version 0.5.6". The user clicks "Upgrade Now" through the applet on the computer device. At this time, the computer device will obtain the file corresponding to "latest firmware version 0.5.6" from the upgrade file provider and use it as the upgrade file for the device to be upgraded.

[0075] (2) Before the computer device establishes a connection with the device to be upgraded, the computer device maintains a network connection with the provider of the upgrade file of the device to be upgraded. The computer device obtains the upgrade file of the device to be upgraded by receiving the upgrade file sent by the provider of the upgrade file in real time.

[0076] 202. Obtain the data volume of a single transmission packet when transmitting upgrade files to the device to be upgraded.

[0077] To facilitate understanding, the transmission method of the upgrade files and some of the terms involved in the device upgrade method of this embodiment will be explained first.

[0078] In this embodiment, the upgrade process uses a fragmented transmission method. An upgrade file is divided into several data fragments. One data fragment is sent to the device to be upgraded. Upon receiving the fragment, the device sends an ACK (Acknowledgement character) to confirm that the received data is error-free. Once the computer receives the ACK from the device to be upgraded, it continues sending the next data fragment, and so on, until the entire upgrade file is transmitted to the device. Each data fragment is further divided into several data packets; sending one data fragment is equivalent to continuously sending several data packets.

[0079] like Figure 4 As shown in the embodiments of this application, the inventors discovered the following problem in practical application: During the transmission of upgrade files to the device to be upgraded, the computer device transmits data packets to the device one by one. If a data packet is lost and needs to be retransmitted, excessive retransmissions due to excessive packet loss will affect the file transmission speed, and consequently, the upgrade speed of the device to be upgraded. For example, taking a BLE (Bluetooth Low Energy) terminal as an example, where the upgrade file is transmitted to the BLE terminal via a device upgrade control component (such as a mini-program) in the computer device, and the upgrade file is divided into n data packets, where the numbers SN of these n data packets are 0, 1, 2, ..., n-1 respectively, the mini-program sends data packets numbered SN=0, 1, 2, ..., n-1 to the BLE terminal sequentially. When a data packet (such as the data packet numbered SN=2) is lost during transmission, it will be retransmitted until the data packet numbered SN=n-1 is successfully transmitted, at which point the entire upgrade file transmission is considered complete.

[0080] The single packet data size refers to the amount of data (i.e., the size of each data packet) transmitted when transferring files to the device to be upgraded; for example, the single packet data size is 16 bytes.

[0081] The single data packet size refers to the number of data packets in each data packet transmitted when transferring files to the device to be upgraded; for example, the single data packet size is 16 data packets.

[0082] The connection interval is the interval between two connection events. It is the time interval between the master (i.e., the computer device) starting to send data to the slave (i.e., the device to be upgraded) and the next time the master starts sending data to the slave. Each communication between the master and slave is a connection event (but different from the first time the master connects to the slave while the slave is in broadcast mode). For example, the connection interval is in units of 1.25ms, and can take values ​​from 7.5ms to 4s (i.e., 6 to 3200 units). In this embodiment, the connection interval specifically refers to the transmission time interval between two data slices.

[0083] The data volume per packet refers to the data volume of each data packet transmitted when transmitting the upgrade file to the device to be upgraded, which is predetermined before transmitting the upgrade file to the device to be upgraded; for example, the data volume per packet is 16 bytes.

[0084] There are several ways to obtain the data volume of a single transmission packet in step 202, including, for example:

[0085] (1) Obtain the default single-packet data size for transmission, and use it as the single-packet data size when transmitting upgrade files to the device to be upgraded. For example, the default single-packet data size of the device to be upgraded (e.g., 20 bytes) can be used as the single-packet data size when transmitting upgrade files to the device to be upgraded. Alternatively, the default single-packet data size of the Bluetooth transmission protocol (e.g., 16 bytes) can be used as the single-packet data size when transmitting upgrade files to the device to be upgraded.

[0086] (2) Obtain the single packet data volume determined based on the maximum transmission unit (MTU) of the device to be upgraded, and use it as the single packet data volume for transmission.

[0087] The maximum transmission unit (MPU) refers to the maximum amount of data that can be transmitted in a PDU (Protocol Data Unit) (i.e., how many bytes can be transmitted to the other party at once).

[0088] The following examples, using methods 1, 2, and 3, illustrate the method of "obtaining the single packet data volume determined based on the maximum transmission unit of the device to be upgraded, and using it as the single packet data volume for transmission". It should be understood that methods 1, 2, and 3 are only used as examples and are not intended to restrict the method of "obtaining the single packet data volume determined based on the maximum transmission unit of the device to be upgraded, and using it as the single packet data volume for transmission".

[0089] Method 1: In some embodiments, the amount of data transmitted per packet can be determined by querying the maximum transmission unit of the device to be upgraded in real time. In this case, step 202 may specifically include the following steps 2021A to 2023A, as follows:

[0090] 2021A. Query the maximum transmission unit of the device to be upgraded.

[0091] For example, before transmitting the upgrade file to the device to be upgraded, some test data can be transmitted to the device to be upgraded to confirm the maximum transmission unit of the device to be upgraded, and then the amount of data to be transmitted per packet can be determined based on the maximum transmission unit of the device to be upgraded.

[0092] 2022A, Obtain the header data size of the upgrade file.

[0093] The header data size refers to the size of the header data used to identify information such as filename and data packet number of the upgrade file.

[0094] 2023A. Based on the maximum transmission unit and header data size, determine the amount of data per transmission packet when transmitting upgrade files to the device to be upgraded.

[0095] As shown in formula (1) below, the transmission rate when transmitting upgrade files to the device to be upgraded can be expressed by formula (1) below:

[0096]

[0097] In formula (1), Rate represents the transmission rate, mSecs represents the time unit, t0 represents the number of data packets sent within a connection interval, t1 represents the total connection interval required to transmit the entire file, and p represents the amount of data transmitted per packet (the amount of data in each data packet transmitted).

[0098] As can be seen from formula (1), the amount of data in each data packet transmitted when transmitting the upgrade file to the device to be upgraded (i.e., the amount of data in a single packet) is an important parameter affecting the transmission rate. The larger the amount of data in a single packet, the faster the transmission rate when transmitting the upgrade file to the device to be upgraded; conversely, the smaller the amount of data in a single packet, the slower the transmission rate when transmitting the upgrade file to the device to be upgraded. To facilitate understanding, a specific data example is used to illustrate the impact of the size of the single packet data on the transmission rate: When the upgrade file being sent, the number of data packets t0 sent within a connection interval (e.g., t0 = 4), and the total connection interval t1 required to transmit the entire file (e.g., t1 = 30) are all the same, when the amount of data in a single packet sent p = 20 bytes, the transmission rate Rate = (1000 * 4 * 20) / 30 = 2666.67 B / s; when the amount of data in a single packet sent p = 127 bytes, the transmission rate Rate = (1000 * 4 * 127) / 30 = 16933.33 B / s.

[0099] Therefore, to improve the transmission rate when transmitting upgrade files to the device to be upgraded, the data size of a single transmission packet can be maximized without exceeding the maximum transmission unit (MTU) of the device. Thus, to maximize the data size of a single transmission packet and improve the transmission rate, the difference between the maximum transmission unit (MTU) of the device to be upgraded and the header size of the upgrade file (referred to as "h") can be used as the data size of a single transmission packet when transmitting upgrade files to the device to be upgraded.

[0100] For example, assuming the header data size of the upgrade file is h = 3, then the data size of a single packet when transmitting the upgrade file to the device to be upgraded is MTU - 3.

[0101] Method 2: In some embodiments, before upgrading the device to be upgraded (e.g., during the last upgrade), the maximum transmission unit of the device to be upgraded is queried, and the maximum transmission unit of the device to be upgraded is associated with the device number of the device to be upgraded and stored in a preset database, as shown in Table 1. In step 202, the maximum transmission unit of the device to be upgraded is first read from the preset database, and then, referring to a method similar to Method 1 above, the single packet data size is determined based on the maximum transmission unit of the device to be upgraded, which is used as the single packet data size when transmitting the upgrade file to the device to be upgraded.

[0102] Table 1

[0103] Equipment 1 MTU1 Equipment 2 MTU2 … …

[0104] Method 3: In some embodiments, before upgrading the device to be upgraded (e.g., during the previous upgrade), referring to Method 1 or Method 2 above, the single packet data volume is determined based on the maximum transmission unit of the device to be upgraded; and the determined single packet data volume is associated with the device number of the device to be upgraded and stored in a preset database, as shown in Table 2. In step 202, the single packet data volume associated with the device number of the device to be upgraded can be found and used as the single packet data volume for transmitting upgrade files to the device to be upgraded.

[0105] Table 2

[0106] Equipment 1 20 Equipment 2 127 … …

[0107] 203. Obtain the maximum number of data packets that the device to be upgraded can receive for the preset test file.

[0108] The preset test file is used to test the buffer size of the device to be upgraded, specifically the Bluetooth physical layer RX buffer size of the device to be upgraded. In this article, we take the buffer size of the device to be upgraded as the Bluetooth physical layer RX buffer size as an example.

[0109] The maximum number of data packets received refers to the maximum number of data packets that the device to be upgraded can successfully receive without causing an RX buffer overflow when transmitting a preset test file. The method of transmitting the preset test file to the device to be upgraded is similar to the "upgrade file transmission method" described earlier: the entire preset test file is first divided into n data packets, and then these n data packets are sent continuously as a single data chunk to the device to be upgraded. For easier understanding, please refer to [link to previous text]. Figure 4The n data packets are numbered SN as 0, 1, 2, ..., n-1, and can be sent sequentially to the device to be upgraded. Finally, the device to be upgraded replies to the computer with the number X of the last received data packet. X represents the maximum number of data packets the device to be upgraded can continuously receive without causing an RX buffer overflow (i.e., the maximum number of data packets that can be received). Therefore, the maximum number of received data packets can, to some extent, reflect the size of the Bluetooth physical layer RX buffer of the device to be upgraded.

[0110] There are several ways to obtain the maximum number of received data packets in step 203. For example, the following two methods (i) and (ii) illustrate how to obtain the maximum number of received data packets:

[0111] (i) This is obtained by sending a preset test file to the device to be upgraded during real-time testing each time the device is upgraded, before the upgrade file is officially transmitted to the device. In this case, step 203 may specifically include the following steps 2031A to 2032A, as follows:

[0112] 2031A. Based on the preset test packet data volume, send the preset test file to the device to be upgraded.

[0113] The test packet data size refers to the data size of each data packet transmitted when transmitting upgrade files to the device to be upgraded; for example, the test packet data size is 16 bytes.

[0114] Among them, the test data packet refers to the data packet obtained by dividing the preset test file into packets according to the preset test single packet data volume.

[0115] In some embodiments, the data volume of a test packet is equal to the data volume of a transmission packet obtained in step 202. That is, the data volume of a transmission packet obtained in step 202 can be used as the preset data volume of a test packet. The device to be upgraded is divided into packets according to the data volume of the transmission packet to obtain multiple test data packets (at this time, the data volume of each test data packet = the data volume of the transmission packet). Then, the multiple test data packets are sent to the device to be upgraded as a data slice.

[0116] In some embodiments, the data size of a test packet is not equal to the data size of a transmission packet obtained in step 202. For example, a default data size or a data size smaller than the transmission packet size can be used as the preset test packet size. The device to be upgraded is divided into packets according to the default data size or the data size smaller than the transmission packet size to obtain multiple test data packets (at this time, the data size of each test data packet is equal to the default data size or the data size smaller than the transmission packet size). Then, the multiple test data packets are sent to the device to be upgraded as a single data segment.

[0117] 2032A. Obtain the maximum number of received data packets from the device to be upgraded based on the preset test file.

[0118] In step 2032A, there are several ways for the device to be upgraded to report the maximum number of received data packets. For example, these include:

[0119] Scenario 1: The device to be upgraded first counts the maximum number of data packets that can be received continuously without causing RX buffer overflow, and then provides feedback in the form of "the maximum number of data packets that can be received continuously without causing RX buffer overflow".

[0120] Scenario 2: Feedback via data packet number. To improve the speed of determining the maximum number of data packets to be received and further improve the upgrade speed of the device to be upgraded, multiple test data packets can be numbered and sent to the device to be upgraded sequentially according to the number. After receiving the last test data packet, the device to be upgraded feeds back the number of the last received data packet to the computer. Thus, the computer can quickly determine the maximum number of data packets to be received based on the number fed back by the device to be upgraded.

[0121] For details, please refer to Figure 5 In step 2031A, the preset test file can be divided into multiple test data packets based on the data volume of a single test packet, resulting in multiple test data packets with sequential numbering. These multiple test data packets are then sent sequentially to the device to be upgraded according to their numbering order. After receiving the last test data packet, the device to be upgraded replies with the number X of that last data packet to the computer. In step 2032A, the data packet numbers returned by the device to be upgraded based on the multiple test data packets can be obtained; the maximum number of data packets to be received is determined based on these data packet numbers.

[0122] Here, the data packet number refers to the sequential numbering of the test data packets. In some embodiments, after receiving the last test data packet, the device to be upgraded may only reply to the computer device with the number of the last received data packet (e.g., X). In other embodiments, it may also reply to the computer device with the numbers of the last received data packet and all previously received data packets (e.g., 0, 1, 2, ..., X).

[0123] For example, such as Figure 5 As shown, taking the example of replying to the computer device only with the number of the last received data packet (e.g., X), multiple test data packets being consecutively numbered, the largest number being (the number of multiple test data packets - 1), the single packet data size of the test data packet LEN = MTU - 3, the device to be upgraded being a BLE terminal, and sending a preset test file to the device to be upgraded through a small program in the computer device (used to control the operation, shutdown, working mode, firmware upgrade, etc. of the BLE terminal): While the preset test file is divided into packets based on the single packet data, multiple consecutively numbered test data packets are obtained from the packetization (e.g., n test data packets are obtained, and the numbers SN of the n test data packets are 0, 1, 2, ..., n-1 respectively); then, the n test data packets are treated as a data slice, and the test data packets with numbers SN = 0, 1, 2, ..., n-1 are sent sequentially to the device to be upgraded according to the number order of each test data packet in the n test data packets. The device to be upgraded sends the last test data packet it received (i.e., the test data packet preceding the device's initial overflow test data packet, which is the test data packet from which the RX buffer overflow begins when the device to be upgraded receives n consecutive test data packets) with the number LastSN = X, back to the computer device. Thus, the computer device can receive the data packet number (i.e., X) returned by the device to be upgraded based on n test data packets, and uses the number of data packet numbers X returned by the device to be upgraded based on n test data packets as the maximum number of data packets that can be received.

[0124] For example, consider the scenario where only the number of the last received data packet and the numbers of all previously received data packets (e.g., 0, 1, 2, ..., X) are returned to the computer device, multiple test data packets are consecutively numbered, and the largest number equals (the number of test data packets minus 1). While the preset test file is divided into packets based on the single test packet data, multiple consecutively numbered test data packets are generated (e.g., n test data packets are generated, with numbers SN = 0, 1, 2, ..., n-1). Then, these n test data packets are treated as a single data slice, and the test data packets with numbers SN = 0, 1, 2, ..., n-1 are sequentially sent to the device to be upgraded according to the order of their numbers. The device to be upgraded returns the last received test data packet (i.e., the test data packet preceding the device's initial overflow test data packet; the initial overflow test data packet refers to the test data packet that causes the RX buffer overflow when the device continuously receives n test data packets) and the numbers of all previously received data packets (e.g., 0, 1, 2, ..., X) to the computer device. Therefore, the computer device can receive multiple data packet numbers (i.e., 0, 1, 2, ..., X) fed back by the device to be upgraded based on n test data packets, and select the largest number from the multiple data packet numbers fed back by the device to be upgraded based on n test data packets, and take the number corresponding to the largest number as the maximum number of data packets to be received.

[0125] (II) Before upgrading the device, the device can be tested using the method described in (I) above to obtain the maximum number of data packets that the device can receive. This maximum number of data packets received is then associated with the device number of the device and stored in a preset database, as shown in Table 3. In step 203, the maximum number of data packets received associated with the device number of the device can be directly retrieved from the preset database, thus obtaining the maximum number of data packets that the device can receive from the preset test file.

[0126] Table 3

[0127] Equipment 1 4 Equipment 2 5 … …

[0128] 204. Based on the maximum number of received data packets, determine the number of single data packets to be transmitted when transmitting upgrade files to the device to be upgraded.

[0129] The number of data packets transmitted per data segment refers to the number of data packets for each data segment that are transmitted when transmitting the upgrade file to the device to be upgraded, which is predetermined before transmitting the upgrade file to the device to be upgraded.

[0130] There are multiple ways to determine the amount of data packet to be transmitted in step 204. For example, it can include two determination methods: Case (I) and Case (II).

[0131] Case (1): The ratio between the buffer size occupied by the number of transmitted single data packets and the buffer size occupied by the maximum number of received data packets is less than or equal to a preset percentage threshold.

[0132] To prevent overflow, the buffer size occupied by the transmitted single data packet should be smaller than the buffer size of the device to be upgraded, thereby reducing packet loss rate and improving the upgrade speed of the device to be upgraded. The maximum received data packet size reflects, to some extent, the Bluetooth physical layer RX buffer size of the device to be upgraded (wherein, in this embodiment, the buffer size occupied by the maximum received data packet size is approximately considered to be close to the Bluetooth physical layer RX buffer size of the device to be upgraded). Therefore, the buffer size occupied by the transmitted single data packet should be smaller than the buffer size occupied by the maximum received data packet size. For example, the ratio between the buffer size occupied by the transmitted single data packet size and the buffer size occupied by the maximum received data packet size can be less than or equal to a preset percentage threshold. In this case, step 204 can specifically include the following steps 2041A to 2042A, as follows:

[0133] 2041A. Determine the buffer size of the device to be upgraded based on the preset test packet data volume, maximum received packet volume, and preset percentage threshold.

[0134] The specific value of the preset percentage threshold can be set according to the actual business scenario requirements. There is no specific restriction on the specific value of the preset percentage threshold here. For example, the preset percentage threshold can be 90%.

[0135] 2042A. Determine the number of single data packets to be transmitted when transmitting upgrade files to the device to be upgraded, based on the buffer size of the device to be upgraded and the amount of data transmitted per packet.

[0136] For example, taking the ratio of the buffer size occupied by the transmitted single data packet to the buffer size occupied by the maximum received data packet as equal to a preset percentage threshold, assuming the preset test single packet data size is 20, the maximum received data packet size is 4, the preset percentage threshold is 90%, and the transmitted single packet data size is 12, then firstly, based on the preset test single packet data size of 20, the maximum received data packet size of 4, and the preset percentage threshold of 90%, the buffer size of the device to be upgraded can be calculated as 20 * 4 * 90% = 72. Then, based on the buffer size of the device to be upgraded of 72 and the transmitted single packet data size of 12, the transmitted single data packet size when transmitting the upgrade file to the device to be upgraded can be calculated as 72 / 12 = 6.

[0137] Case (2): Make the buffer size occupied by the transmission of a single data packet equal to the buffer size occupied by the maximum number of data packets received.

[0138] On the one hand, to prevent overflow, the buffer size occupied by the transmitted single data packet should be smaller than the buffer size of the device to be upgraded, so as to reduce the packet loss rate and thus improve the upgrade speed of the device to be upgraded. On the other hand, in order to maximize the utilization of the buffer size of the device to be upgraded, so as to reduce the total connection time interval required to transmit the entire upgrade file and thus improve the upgrade speed of the device to be upgraded, the buffer size occupied by the transmitted single data packet should be as close as possible to the buffer size occupied by the maximum received data packet. For example, the buffer size occupied by the transmitted single data packet can be made equal to the buffer size occupied by the maximum received data packet, so that the transmitted single data packet size determined in step 204 can be set to the maximum. In this case, step 204 may specifically include the following steps 2041B to 2042B, as follows:

[0139] 2041B. Determine the buffer size of the device to be upgraded based on the maximum number of received data packets and the data volume of a single test packet.

[0140] 2042B. Based on the buffer size and the amount of data transmitted per packet, determine the amount of data packet to be transmitted when transmitting upgrade files to the device to be upgraded.

[0141] For example, assuming the preset test packet size is 20, the maximum received packet size is 4, and the transmitted packet size is 16, then firstly, based on the preset test packet size of 20 and the maximum received packet size of 4, the buffer size of the device to be upgraded can be calculated as 20 * 4 = 80. Then, based on the buffer size of the device to be upgraded (80) and the transmitted packet size of 16, the transmitted packet size can be calculated as 80 / 16 = 5.

[0142] For example, suppose the preset test packet size is 20, the maximum received packet size is 4, and the transmitted packet size is 20. First, based on the preset test packet size of 20 and the maximum received packet size of 4, the buffer size of the device to be upgraded can be calculated as 20 * 4 = 80. Then, based on the buffer size of the device to be upgraded (80) and the transmitted packet size of 20, the transmitted packet size can be calculated as 80 / 20 = 4.

[0143] Furthermore, depending on the preset test packet data size, the determination of the buffer size and transmission method for the device to be upgraded will differ. For ease of understanding, the following examples illustrate two scenarios: Scenario ① and Scenario ②.

[0144] Case 1: The preset test packet data size equals the transmission packet data size in step 202. In this case, the maximum received data packet size can be directly used as the transmission packet size when transmitting the upgrade file to the device to be upgraded in step 204. As can be seen from the calculation process exemplified in case (II) above, when the test packet data size equals the transmission packet data size in step 202, the transmission packet size calculated according to steps 2041B to 2042B is the same as the maximum received data packet size. Therefore, when the preset test packet data size equals the transmission packet data size in step 202, the maximum received data packet size can be directly used as the transmission packet size when transmitting the upgrade file to the device to be upgraded in step 204.

[0145] As can be seen, since the test packet data size equals the transmission packet data size in step 202, the maximum received data packet size can be directly used as the transmission packet size. Therefore, when testing the maximum received data packet size of the device to be upgraded to the preset test file, by using the transmission packet data size as the preset test packet data size, and then sending the preset test file to the device to be upgraded after packetizing according to the transmission packet data size, the determination speed of the transmission packet size can be improved, thereby improving the upgrade speed of the device to be upgraded.

[0146] Method 2: The preset test packet data size equals the transmission packet data size in step 202. In this case, the buffer size of the device to be upgraded can be determined first based on the maximum received data packet size and the test packet data size; then, based on the buffer size of the device to be upgraded and the transmission packet data size in step 202, the transmission packet size when transmitting the upgrade file to the device to be upgraded can be determined. For a detailed explanation of how to determine the transmission packet size, please refer to the relevant descriptions in cases (I) and (II) above. For simplicity, these details will not be repeated here.

[0147] 205. Based on the amount of data transmitted in a single packet and the amount of data transmitted in a single fragment, send an upgrade file to the device to be upgraded in order to upgrade the device.

[0148] For example, after determining the data size of a single data packet and the data size of a single data segment when transmitting the upgrade file to the device to be upgraded, the upgrade file can be sent to the device to be upgraded in accordance with the following steps (1) to (4) to upgrade the device to be upgraded, as follows:

[0149] (1) The upgrade file is divided into multiple upgrade data packets based on the amount of data transmitted in a single packet.

[0150] Among them, the upgrade data packet refers to the data packet obtained by dividing the upgrade file of the device to be upgraded into packets according to the data volume of a single transmission packet.

[0151] For example, assuming the data size of a single transmission packet is 16 bytes and the upgrade file of the device to be upgraded is 1600, the upgrade file of the device to be upgraded is divided into 100 upgrade data packets according to the data size of each data packet = the data size of a single transmission packet (16 bytes).

[0152] (2) Slice multiple upgrade data packets based on the amount of single data packet transmitted to obtain multiple upgrade data slices of the upgrade file.

[0153] Among them, upgrade data fragments refer to data fragments obtained by dividing multiple upgrade data packets of the upgrade file of the device to be upgraded into fragments according to the transmission single data packet size.

[0154] To make it easier to understand, let's continue with the example in step (1) above. For example, the upgrade file of the device to be upgraded is divided into 100 upgrade data packets. Assuming that the number of data packets to be transmitted is 4, the 100 upgrade data packets of the upgrade file of the device to be upgraded are divided into 25 upgrade data packets according to the rule that the number of data packets in each data packet = the number of data packets to be transmitted (i.e., 4).

[0155] (3) Obtain the upgrade connection interval of the device to be upgraded.

[0156] The upgrade connection interval refers to the transmission time interval between two upgrade data slices when transmitting upgrade files to the device to be upgraded.

[0157] In some implementations, the default Bluetooth connection interval can be obtained and used as the upgrade connection interval for the device to be upgraded.

[0158] In other implementations, a query request can be sent to the device to be upgraded before transmitting the upgrade file to the device to be upgraded to query the current connection interval of the device to be upgraded; if the current connection interval is greater than the preset Bluetooth connection interval threshold, a connection interval change request is sent to the device to be upgraded so that the device to be upgraded can adjust the current connection interval; the adjusted connection interval of the device to be upgraded is used as the upgrade connection interval.

[0159] The specific value of the preset Bluetooth connection interval threshold can be set according to specific needs. There is no restriction on the specific value of the preset Bluetooth connection interval threshold here. For example, in order to maximize the upgrade speed of the device to be upgraded, the minimum Bluetooth connection interval specified by the protocol followed when the computer device and the device to be upgraded establish a Bluetooth connection can be used as the preset Bluetooth connection interval threshold.

[0160] (4) Based on the upgrade connection interval, multiple upgrade data slices are sent sequentially to the device to be upgraded in order to upgrade the device.

[0161] For example, please refer to Figure 6, Figure 6 This is a flowchart illustrating another embodiment of the device upgrade method provided in this application. To better understand the device upgrade method provided in this application, the following example illustrates the specific implementation process of the device upgrade method, taking a BLE terminal as the device to be upgraded and the upgrade of the BLE terminal being implemented through a small program in a computer device (used to control the operation, shutdown, working mode, firmware upgrade, etc. of the BLE terminal). The specific process of upgrading the BLE terminal includes the following steps 601 to 609:

[0162] 601. The mini-program establishes a connection with the BLE terminal via Bluetooth.

[0163] The specific implementation of step 601 can be found in the previous explanations, and will not be repeated here.

[0164] 602. Obtain upgrade files for BLE terminals via mini-program.

[0165] The implementation of step 602 is similar to that of step 201 above. For details, please refer to the relevant explanations above. It will not be repeated here.

[0166] 603. The mini-program queries and determines the data volume of a single packet when transmitting upgrade files to the BLE terminal based on the maximum transmission unit of the BLE terminal.

[0167] The implementation of step 603 is similar to that of steps 2021A to 2023A above. For details, please refer to the relevant explanations above. It will not be repeated here.

[0168] 604. The mini-program queries the current connection interval of the BLE terminal. When the current connection interval of the BLE terminal is greater than the preset Bluetooth connection interval threshold, a connection interval change request is sent to the BLE terminal so that the BLE terminal can adjust the current connection interval; and the adjusted connection interval of the BLE terminal is used as the upgrade connection interval.

[0169] The upgrade connection interval acquisition in step 604 is similar to the upgrade connection interval acquisition method described in step 205 above. For details, please refer to the relevant explanations above, which will not be repeated here.

[0170] 605. The mini-program uses the data volume of a single transmitted packet as the preset test data volume, and sends a preset test file to the BLE terminal according to the data volume of a single transmitted packet.

[0171] 606. The mini-program receives the data packet number fed back by the BLE terminal based on the preset test file, and uses it as the maximum number of data packets to be received; and uses the maximum number of data packets to be received as the number of single data packets to be transmitted when transmitting upgrade files to the BLE terminal.

[0172] The implementation of steps 605 to 606 is similar to that of steps 2031A to 2032A above. For details, please refer to the relevant explanations above. They will not be repeated here.

[0173] 607. The mini-program divides the upgrade file of the BLE terminal into multiple upgrade data packets according to the single packet data volume determined in step 603 when transmitting the upgrade file to the BLE terminal.

[0174] 608. The mini-program fragments multiple upgrade data packets according to the single data packet size determined in step 606 when transmitting upgrade files to the BLE terminal, resulting in multiple upgrade data fragments.

[0175] 609. The mini-program sends multiple upgrade data slices to the BLE terminal sequentially according to the upgrade connection interval determined in 604, in order to upgrade the BLE terminal.

[0176] The implementation of steps 607 to 608 is similar to that of step 205 above. For details, please refer to the relevant explanations above. They will not be repeated here.

[0177] As can be seen from the above, firstly, since the maximum received data packet size can reflect the buffer size of the device to be upgraded to a certain extent, by obtaining the maximum received data packet size of the device to be upgraded for the preset test file, and based on the maximum received data packet size, determining the single data packet size for transmitting the upgrade file to the device to be upgraded, and sending the upgrade file according to the single data packet size, it is possible to avoid the buffer size occupied by the single data packet size being greater than the buffer size of the device to be upgraded. This avoids the problem of data packets overflowing the buffer of the device to be upgraded when sending the upgrade file, thereby avoiding the packet loss rate during the upgrade of the device to be upgraded, and thus solving the problem of high retransmission rate caused by high packet loss rate, thereby reducing the retransmission rate during the upgrade of the device to be upgraded, and thus improving the upgrade speed of the device to be upgraded to a certain extent.

[0178] Secondly, since the maximum number of received data packets can be used to determine the number of single data packets to be transmitted when transmitting the upgrade file to the device to be upgraded, the same upgrade parameters (i.e., the same number of single data packets, the same number of single data packets, and the same upgrade connection interval) are avoided when the same upgrade parameters are used on different devices. This avoids the problem that the same upgrade parameters may not cause packet loss when transmitting data on some devices, but may cause packet loss when transmitting data on others. This also avoids the problem of large differences in upgrade speed when using the same upgrade parameters on different devices.

[0179] Thirdly, since different data packet sizes and data packet sizes can be determined for different devices to be upgraded, the problem of data packets overflowing the buffer of the device to be upgraded during the upgrade can be avoided. This allows full use of the inherent hardware characteristics of the device to be upgraded to reduce packet loss rate, thereby reducing retransmission rate and increasing the upgrade speed of the device. Therefore, the improvement of transmission speed does not depend on the improvement of hardware performance of the device to be upgraded, thus reducing the hardware cost of the device to be upgraded.

[0180] To better implement the device upgrade method in this application embodiment, based on the device upgrade method, this application embodiment also provides a device upgrade apparatus, which can be integrated into computer equipment, such as servers or terminals.

[0181] For example, such as Figure 7 The diagram shown is a schematic representation of an embodiment of the device upgrade apparatus in this application. The device upgrade apparatus may include a first acquisition unit 701, a second acquisition unit 702, an upgrade unit 703, etc., as follows:

[0182] The first acquisition unit 701 is used to acquire the upgrade file of the device to be upgraded;

[0183] The second acquisition unit 702 is used to acquire the data volume of a single transmission packet when transmitting an upgrade file to the device to be upgraded.

[0184] The second acquisition unit 702 is also used to acquire the maximum number of data packets received by the device to be upgraded for the preset test file;

[0185] The second acquisition unit 702 is also used to determine the number of single data packets to be transmitted when transmitting upgrade files to the device to be upgraded, based on the maximum number of received data packets.

[0186] The upgrade unit 703 is used to send an upgrade file to the device to be upgraded based on the amount of data transmitted in a single packet and the amount of data transmitted in a single piece, so as to upgrade the device to be upgraded.

[0187] In some embodiments of this application, the second acquisition unit 702 is specifically used for:

[0188] Based on the preset test packet data volume, a preset test file is sent to the device to be upgraded;

[0189] Obtain the maximum number of data packets received by the device to be upgraded based on the preset test file.

[0190] In some embodiments of this application, the second acquisition unit 702 is specifically used for:

[0191] Based on the data volume of a single test packet, the preset test file is divided into packets to obtain multiple test data packets containing numbered sequences;

[0192] The multiple test data packets are sent sequentially to the device to be upgraded, according to their numerical order.

[0193] In some embodiments of this application, the second acquisition unit 702 is specifically used for:

[0194] Obtain the data packet number returned by the device to be upgraded based on multiple test data packets;

[0195] The maximum number of data packets to be received is determined based on the data packet number.

[0196] In some embodiments of this application, the second acquisition unit 702 is specifically used for:

[0197] The buffer size of the device to be upgraded is determined based on the maximum number of received data packets and the data size of a single test packet.

[0198] Based on the buffer size and the amount of data transmitted per packet, determine the amount of data packet to be transmitted when transmitting upgrade files to the device to be upgraded.

[0199] In some embodiments of this application, the upgrade unit 703 is specifically used for:

[0200] The upgrade file is divided into multiple upgrade data packets based on the data volume of a single transmission packet.

[0201] Slice multiple upgrade data packets based on the amount of a single data packet transmitted to obtain multiple upgrade data slices of the upgrade file;

[0202] Obtain the upgrade connection interval for the device to be upgraded;

[0203] Multiple upgrade data segments are sequentially sent to the device to be upgraded based on the upgrade connection interval, so as to upgrade the device.

[0204] In some embodiments of this application, the upgrade unit 703 is specifically used for:

[0205] Query the current connection interval of the device to be upgraded;

[0206] If the current connection interval is greater than the preset Bluetooth connection interval threshold, a connection interval change request is sent to the device to be upgraded so that the device to be upgraded can adjust the current connection interval.

[0207] The adjusted connection interval of the device to be upgraded will be used as the upgrade connection interval.

[0208] In some embodiments of this application, the second acquisition unit 702 is specifically used for:

[0209] Query the maximum transmission unit of the device to be upgraded;

[0210] Get the size of the header data of the upgrade file;

[0211] Based on the maximum transmission unit and header data size, determine the amount of data per transmission packet when transmitting upgrade files to the device to be upgraded.

[0212] As can be seen from the above, the device upgrade apparatus of this application embodiment can acquire the upgrade file of the device to be upgraded by the first acquisition unit 701; acquire the single packet data volume when transmitting the upgrade file to the device to be upgraded by the second acquisition unit 702; acquire the maximum number of data packets received by the device to be upgraded for a preset test file by the second acquisition unit 702; determine the single data packet volume when transmitting the upgrade file to the device to be upgraded based on the maximum number of data packets received by the second acquisition unit 702; and send the upgrade file to the device to be upgraded by the upgrade unit 703 based on the single packet data volume and the single data packet volume, so as to upgrade the device to be upgraded.

[0213] Therefore, the device upgrade apparatus provided in this application embodiment can bring the following technical effects: Firstly, since the maximum received data packet size can reflect the buffer size of the device to be upgraded to a certain extent, by obtaining the maximum received data packet size of the device to be upgraded for a preset test file; based on the maximum received data packet size, determining the single data packet size when transmitting the upgrade file to the device to be upgraded, and sending the upgrade file according to the single data packet size, it is possible to avoid the buffer size occupied by the single data packet size being greater than the buffer size of the device to be upgraded, thereby avoiding the problem of the data packet overflowing the buffer of the device to be upgraded when sending the upgrade file to the device to be upgraded, thereby avoiding the packet loss rate during the upgrade of the device to be upgraded, thereby solving the problem of high retransmission rate caused by high packet loss rate, thereby reducing the retransmission rate during the upgrade of the device to be upgraded, thereby improving the upgrade speed of the device to be upgraded to a certain extent. Secondly, since the size of a single data packet can be determined based on the maximum received data packet size, it avoids using the same upgrade parameters (i.e., the same single data packet size and single packet data size) for the same upgrade file across different devices. This prevents packet loss issues where the same upgrade parameters may not cause packet loss on some devices but will cause packet loss on others, thus avoiding significant differences in upgrade speed across different devices using the same upgrade parameters. Thirdly, since different single packet data sizes and single data packet sizes can be determined for different devices to be upgraded, it avoids the problem of data packets overflowing the buffer of the device being upgraded. This allows full utilization of the inherent hardware characteristics of the device being upgraded to reduce packet loss rate, thereby reducing retransmission rate and increasing upgrade speed. Therefore, the increase in transmission speed does not depend on the hardware performance improvement of the device being upgraded, reducing the hardware cost of the device being upgraded.

[0214] Furthermore, to better implement the device upgrade method in the embodiments of this application, based on the device upgrade method, the embodiments of this application also provide a computer device, such as... Figure 8 As shown, it illustrates a schematic diagram of the computer device involved in the embodiments of this application, specifically:

[0215] The computer device may include components such as a processor 801 with one or more processing cores, a memory 802 with one or more computer-readable storage media, a power supply 803, and an input unit 804. Those skilled in the art will understand that... Figure 8 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0216] The processor 801 is the control center of the computer device. It connects various parts of the computer device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 802, and by calling data stored in the memory 802, it performs various functions of the computer device and processes data, thereby performing overall detection of the computer device. Optionally, the processor 801 may include one or more processing cores; preferably, the processor 801 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 801.

[0217] The memory 802 can be used to store software programs and modules. The processor 801 executes various functional applications and data processing by running the software programs and modules stored in the memory 802. The memory 802 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, video playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 802 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 802 may also include a memory controller to provide the processor 801 with access to the memory 802.

[0218] The computer device also includes a power supply 803 that supplies power to the various components. Preferably, the power supply 803 can be logically connected to the processor 801 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 803 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0219] The computer device may also include an input unit 804, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0220] Although not shown, the computer device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 801 in the computer device loads the executable files corresponding to the processes of one or more application programs into the memory 802 according to the following instructions, and the processor 801 runs the application programs stored in the memory 802 to realize various functions, as follows:

[0221] Obtain the upgrade file for the device to be upgraded;

[0222] Obtain the data volume of a single packet transmitted when transmitting upgrade files to the device to be upgraded;

[0223] Obtain the maximum number of data packets received by the device to be upgraded for the preset test file;

[0224] Based on the maximum number of received data packets, determine the number of single data packets to be transmitted when transmitting upgrade files to the device to be upgraded.

[0225] Based on the amount of data transmitted in a single packet and the amount of data transmitted in a single fragment, an upgrade file is sent to the device to be upgraded in order to upgrade the device.

[0226] For details of each of the above operations, please refer to the previous embodiments, which will not be repeated here.

[0227] Therefore, the computer device of this embodiment can bring the following technical effects: Firstly, since the maximum received data packet size can reflect the buffer size of the device to be upgraded to a certain extent, by obtaining the maximum received data packet size of the device to be upgraded for the preset test file; based on the maximum received data packet size, determining the single data packet size when transmitting the upgrade file to the device to be upgraded, and sending the upgrade file according to the single data packet size, it is possible to avoid the buffer size occupied by the single data packet size being greater than the buffer size of the device to be upgraded, thereby avoiding the problem of the data packet overflowing the buffer of the device to be upgraded when sending the upgrade file, thus avoiding the packet loss rate during the upgrade of the device to be upgraded, and thus solving the problem of high retransmission rate caused by high packet loss rate, thereby reducing the retransmission rate during the upgrade of the device to be upgraded, thereby improving the upgrade speed of the device to be upgraded to a certain extent. Secondly, since the size of a single data packet can be determined based on the maximum received data packet size, it avoids using the same upgrade parameters (i.e., the same single data packet size and single packet data size) for the same upgrade file across different devices. This prevents packet loss issues where the same upgrade parameters may not cause packet loss on some devices but will cause packet loss on others, thus avoiding significant differences in upgrade speed across different devices using the same upgrade parameters. Thirdly, since different single packet data sizes and single data packet sizes can be determined for different devices to be upgraded, it avoids the problem of data packets overflowing the buffer of the device being upgraded. This allows full utilization of the inherent hardware characteristics of the device being upgraded to reduce packet loss rate, thereby reducing retransmission rate and increasing upgrade speed. Therefore, the increase in transmission speed does not depend on the hardware performance improvement of the device being upgraded, reducing the hardware cost of the device being upgraded.

[0228] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0229] Therefore, embodiments of this application provide a computer-readable storage medium storing a computer program that can be loaded by a processor to execute the steps of any of the object detection methods provided in the embodiments of this application. For example, the computer program can execute the following steps:

[0230] Obtain the upgrade file for the device to be upgraded;

[0231] Obtain the data volume of a single packet transmitted when transmitting upgrade files to the device to be upgraded;

[0232] Obtain the maximum number of data packets received by the device to be upgraded for the preset test file;

[0233] Based on the maximum number of received data packets, determine the number of single data packets to be transmitted when transmitting upgrade files to the device to be upgraded.

[0234] Based on the amount of data transmitted in a single packet and the amount of data transmitted in a single fragment, an upgrade file is sent to the device to be upgraded in order to upgrade the device.

[0235] As can be seen, a computer program can be loaded by a processor to execute the steps in any of the device upgrade methods provided in the embodiments of this application. Therefore, the computer-readable storage medium of the embodiments of this application can bring the following technical effects: Firstly, since the maximum received data packet size can reflect the buffer size of the device to be upgraded to a certain extent, by obtaining the maximum received data packet size of the device to be upgraded for a preset test file; and based on the maximum received data packet size, determining the single data packet size for transmitting the upgrade file to the device to be upgraded, and sending the upgrade file according to the single data packet size, it is possible to avoid the buffer size occupied by the single data packet size being greater than the buffer size of the device to be upgraded, thereby avoiding the problem of data packets overflowing the buffer of the device to be upgraded when sending the upgrade file to the device to be upgraded. This avoids the packet loss rate during the upgrade of the device to be upgraded, and solves the problem of high retransmission rate caused by high packet loss rate, thereby reducing the retransmission rate during the upgrade of the device to be upgraded, thereby improving the upgrade speed of the device to be upgraded to a certain extent. Secondly, since the size of a single data packet can be determined based on the maximum received data packet size, it avoids using the same upgrade parameters (i.e., the same single data packet size and single packet data size) for the same upgrade file across different devices. This prevents packet loss issues where the same upgrade parameters may not cause packet loss on some devices but will cause packet loss on others, thus avoiding significant differences in upgrade speed across different devices using the same upgrade parameters. Thirdly, since different single packet data sizes and single data packet sizes can be determined for different devices to be upgraded, it avoids the problem of data packets overflowing the buffer of the device being upgraded. This allows full utilization of the inherent hardware characteristics of the device being upgraded to reduce packet loss rate, thereby reducing retransmission rate and increasing upgrade speed. Therefore, the increase in transmission speed does not depend on the hardware performance improvement of the device being upgraded, reducing the hardware cost of the device being upgraded.

[0236] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0237] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0238] According to the device upgrade method of this application, a computer program product or computer program is also provided, which includes computer instructions stored in a computer-readable storage medium. The processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the methods provided in the various optional implementations of the above embodiments.

[0239] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process and beneficial effects of the above-described equipment upgrade device, computer-readable storage medium, computer program product or computer program, computer equipment and its corresponding units can be referred to the description of the equipment upgrade method in the above embodiments, and will not be repeated here.

[0240] The above provides a detailed description of a device upgrade method, apparatus, computer device, and computer-readable storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for upgrading equipment, characterized in that, The method includes: Obtain the upgrade file for the device to be upgraded; Obtain the data volume of a single transmission packet when transmitting the upgrade file to the device to be upgraded; Obtain the maximum number of data packets received by the device to be upgraded for the preset test file; Based on the maximum received data packet size, the number of single data packets to be transmitted when transmitting the upgrade file to the device to be upgraded is determined; wherein, the number of single data packets to be transmitted refers to the number of data packets of each data segment to be transmitted when transmitting the upgrade file to the device to be upgraded, which is predetermined before transmitting the upgrade file to the device to be upgraded. Based on the transmitted single packet data volume and the transmitted single packet data volume, the upgrade file is sent to the device to be upgraded to upgrade the device, including: splitting the upgrade file into multiple upgrade data packets based on the transmitted single packet data volume; slicing the multiple upgrade data packets into multiple upgrade data fragments based on the transmitted single packet data volume; obtaining the upgrade connection interval of the device to be upgraded; and sequentially sending the multiple upgrade data fragments to the device to be upgraded based on the upgrade connection interval to upgrade the device.

2. The equipment upgrade method according to claim 1, characterized in that, The step of obtaining the maximum number of data packets received by the device to be upgraded for the preset test file includes: Based on the preset test packet data volume, a preset test file is sent to the device to be upgraded; Obtain the maximum number of data packets received by the device to be upgraded based on the preset test file.

3. The equipment upgrade method according to claim 2, characterized in that, The step of sending a preset test file to the device to be upgraded based on a preset test packet data volume includes: Based on the data volume of the test packet, the preset test file is divided into packets to obtain multiple test data packets with numbered order; The multiple test data packets are sent sequentially to the device to be upgraded according to their numerical order.

4. The equipment upgrade method according to claim 3, characterized in that, The step of obtaining the maximum number of received data packets from the device to be upgraded based on the preset test file includes: Obtain the data packet number fed back by the device to be upgraded based on the multiple test data packets; The maximum number of data packets to be received is determined based on the data packet number.

5. The equipment upgrade method according to claim 2, characterized in that, The step of determining the number of single data packets to be transmitted when transmitting the upgrade file to the device to be upgraded based on the maximum received data packet size includes: The buffer size of the device to be upgraded is determined based on the maximum number of received data packets and the number of test single packets. Based on the buffer size and the amount of data transmitted per packet, the amount of data transmitted per packet is determined when transmitting the upgrade file to the device to be upgraded.

6. The equipment upgrade method according to claim 1, characterized in that, The step of obtaining the upgrade connection interval of the device to be upgraded includes: Query the current connection interval of the device to be upgraded; If the current connection interval is greater than a preset Bluetooth connection interval threshold, a connection interval change request is sent to the device to be upgraded so that the device to be upgraded can adjust the current connection interval. The adjusted connection interval of the device to be upgraded is taken as the upgrade connection interval.

7. The equipment upgrade method according to claim 1, characterized in that, The step of obtaining the data volume of a single transmission packet when transmitting the upgrade file to the device to be upgraded includes: Query the maximum transmission unit of the device to be upgraded; Obtain the size of the header data of the upgrade file; Based on the maximum transmission unit and the header data size, the amount of data per transmission packet when transmitting the upgrade file to the device to be upgraded is determined.

8. An equipment upgrade device, characterized in that, The equipment upgrade device includes: The first acquisition unit is used to acquire the upgrade file of the device to be upgraded. The second acquisition unit is used to acquire the amount of data transmitted in a single packet when transmitting the upgrade file to the device to be upgraded. The second acquisition unit is further configured to acquire the maximum number of data packets received by the device to be upgraded for a preset test file; The second acquisition unit is further configured to determine the number of single data packets to be transmitted when transmitting the upgrade file to the device to be upgraded based on the maximum number of received data packets; wherein, the number of single data packets to be transmitted refers to the number of data packets of each data segment to be transmitted when transmitting the upgrade file to the device to be upgraded, which is predetermined before transmitting the upgrade file to the device to be upgraded. An upgrade unit is configured to send the upgrade file to the device to be upgraded based on the transmission single packet data volume and the transmission single fragment data volume to upgrade the device to be upgraded. The upgrade unit includes: splitting the upgrade file into multiple upgrade data packets based on the transmission single packet data volume; slicing the multiple upgrade data packets into multiple upgrade data fragments based on the transmission single fragment data volume to obtain multiple upgrade data fragments of the upgrade file; obtaining the upgrade connection interval of the device to be upgraded; and sequentially sending the multiple upgrade data fragments to the device to be upgraded based on the upgrade connection interval to upgrade the device to be upgraded.

9. A computer device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the device upgrade method as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, wherein, When the computer program is executed by the processor, it implements the device upgrade method as described in any one of claims 1-7.

11. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by the processor, they implement the device upgrade method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Device and method for fragmented upgrade of ONU software version

    CN105183519A

  • OTA upgrading method

    CN108446130A