Bluetooth resource management method, electronic device, and computer readable storage medium
By detecting and adjusting the resource occupancy information of the Bluetooth link, the problem of terminal device performance degradation caused by Bluetooth link occupancy is solved, ensuring reasonable distribution of link load and accuracy of performance testing.
Patent Information
- Application Number
- PCT/CN2023/136244
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-21
- Filing Date
- 2023-12-04
- Publication Date
- 2024-08-29
AI Technical Summary
If the Bluetooth link is occupied by other applications for a long time, the signal reception and feedback of the terminal device are not timely, affecting the performance of the terminal device.
By obtaining the Bluetooth resource occupancy information of multiple Bluetooth links, detect whether each link meets the preset resource load requirements. If not, close or adjust the target application or Bluetooth resources to ensure that each link meets the preset load. requirements to start the performance testing process.
Ensure that Bluetooth link load does not affect terminal device performance, improve the accuracy of performance testing, and optimize Bluetooth resource usage without affecting the use of original applications.
Smart Images

Figure CN2023136244_29082024_PF_FP_ABST
Abstract
Description
Bluetooth resource management method, electronic device, and computer-readable storage medium
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on February 21, 2023, with application number 202310180116.7 and application name “Bluetooth Resource Management Method, Electronic Device and Computer-readable Storage Medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of communication technology, and in particular to a Bluetooth resource management method, an electronic device, and a computer-readable storage medium. Background Art
[0003] The rapid development of the internet and wireless communications has led to a rapidly growing demand for various data and mobile services. As a global, open wireless communication standard, Bluetooth technology connects various voice and data devices via wireless links, enabling people to exchange and transmit voice and data within their personal area anytime and anywhere. With the development and improvement of Bluetooth technology, Bluetooth connections have gradually become the preferred high-speed and secure wireless data transmission channel between electronic devices.
[0004] In related technologies, if the Bluetooth link of a terminal device is occupied by other applications for a long time, it may cause the terminal device to fail to receive and feedback signals in a timely manner, thereby affecting the performance of the terminal device.
[0005] Summary of the Invention
[0006] In view of this, an embodiment of the present application provides a Bluetooth resource management method to ensure that the load of the Bluetooth link does not affect the performance of the terminal device.
[0007] A first aspect of an embodiment of the present application provides a Bluetooth resource management method, which is applied to a terminal device having multiple Bluetooth links, and the method includes: obtaining Bluetooth resource occupancy information of each Bluetooth link in the multiple Bluetooth links; determining whether the multiple Bluetooth links all meet the preset resource load requirements based on the Bluetooth resource occupancy information of each Bluetooth link; when the multiple Bluetooth links all meet the preset resource load requirements, starting a preset performance test process; when a target Bluetooth link that does not meet the preset resource load requirements is detected in the multiple Bluetooth links, closing or prompting the user to close the target application matching the target Bluetooth link, or adjusting or prompting the user to adjust the Bluetooth resources of the target Bluetooth link.
[0008] Compared with the related art, the embodiments of the present application have at least the following advantages: by detecting whether each Bluetooth link meets the preset resource load requirements based on the Bluetooth resource occupancy information, when a target communication link that does not meet the preset resource load requirements is detected, it is possible to close or prompt the user to close the application that matches the target Bluetooth link, and to adjust or prompt the user to adjust the Bluetooth resources of the target Bluetooth link so that each Bluetooth link can meet the preset resource load requirements, thereby ensuring that the load of the Bluetooth link will not affect the performance of the terminal device, thereby making the preset performance test process more accurate.
[0009] In some possible implementations, the Bluetooth resource occupancy information includes a data transmission time interval; and obtaining the Bluetooth resource occupancy information of the multiple Bluetooth links includes: obtaining multiple data transmission time intervals of the multiple Bluetooth links, wherein one Bluetooth link corresponds to one data transmission time interval.
[0010] In some possible implementations, determining whether the multiple Bluetooth links all meet the preset load requirements based on the Bluetooth resource occupancy information of each Bluetooth link includes: separately detecting whether the data transmission time interval of each Bluetooth link is greater than or equal to a first preset time interval; wherein, the multiple Bluetooth links all meet the preset resource load requirements, including: the data transmission time interval of each Bluetooth link is greater than or equal to the first preset time interval; detecting a target Bluetooth link that does not meet the preset resource load requirements among the multiple Bluetooth links, including: detecting that the data transmission time interval of the target Bluetooth link is less than the first preset time interval, wherein the target Bluetooth link is one or more of the multiple Bluetooth links.
[0011] By adopting this technical solution, the resource load of each Bluetooth link can be accurately known.
[0012] In some possible implementations, determining whether the multiple Bluetooth links all meet the preset load requirements based on the Bluetooth resource occupancy information of each Bluetooth link includes: calculating the median of the data transmission time intervals of the multiple Bluetooth links; detecting whether the median is greater than or equal to a second preset time interval; wherein, the multiple Bluetooth links all meet the preset resource load requirements, including: the median is greater than or equal to the second preset time interval; detecting a target Bluetooth link that does not meet the preset resource load requirements among the multiple Bluetooth links, including: detecting that the median is less than the second preset time interval; wherein, the data transmission time interval of the target Bluetooth link is less than the median.
[0013] By adopting this technical solution, it is possible to ensure the use of the original application as much as possible while ensuring that the load of each Bluetooth link does not affect the performance of the terminal device.
[0014] In some possible implementations, before calculating the median of the data transmission time intervals of the multiple Bluetooth links, it also includes: detecting whether the minimum data transmission time interval among the data transmission time intervals of the multiple Bluetooth links is greater than a third preset time interval, wherein the third preset time interval is less than the second preset time interval; calculating the median of the data transmission time intervals of the multiple Bluetooth links includes: when detecting that the minimum data transmission time interval among the data transmission time intervals of the multiple Bluetooth links is greater than the third preset time interval, calculating the median of the data transmission time intervals of the multiple Bluetooth links.
[0015] By adopting this technical solution, it can be more accurately ensured that the load of each Bluetooth link will not affect the performance of the terminal device.
[0016] In some possible implementations, when it is detected that the median is less than the second preset time interval, the application matching the target Bluetooth link is obtained in the following manner: when it is detected that the median is less than the second preset time interval, the smallest data transmission time intervals among all data transmission time intervals are filtered out one by one in ascending order until the median of the remaining data transmission time intervals is greater than or equal to the second preset time interval; the Bluetooth link corresponding to the filtered data transmission time is used as the target Bluetooth link, and the application matching the target Bluetooth link is obtained.
[0017] By adopting this technical solution, it is possible to ensure the use of the original application as much as possible while ensuring that the load of each Bluetooth link does not affect the performance of the terminal device.
[0018] In some possible implementations, the adjusting or prompting the user to adjust the Bluetooth resources of the target Bluetooth link includes: adjusting the data transmission time interval of the target Bluetooth link to a fifth preset time interval; or prompting the user to adjust the data transmission time interval of the target Bluetooth link to the fifth preset time interval; or sending a first confirmation message to the Bluetooth device for adjusting the data transmission time interval of the target Bluetooth link to the fifth preset time interval, wherein the fifth preset time interval is used to enable the Bluetooth link to meet the preset load requirement.
[0019] By adopting this technical solution, different methods can be selected to improve the connection resources of the target Bluetooth link.
[0020] In some possible implementations, obtaining the Bluetooth resource occupancy information of each Bluetooth link in the multiple Bluetooth links includes: before starting the time synchronization or ranging process with the Bluetooth device, obtaining the Bluetooth resource occupancy information of each Bluetooth link in the multiple Bluetooth links; starting the preset performance test process includes: starting the time synchronization or ranging process with the Bluetooth device.
[0021] By adopting this technical solution, time synchronization or distance measurement between a terminal device and a Bluetooth device can be achieved.
[0022] In some possible implementations, before initiating the time synchronization or ranging process with the Bluetooth device, it also includes: selecting a Bluetooth link from the multiple Bluetooth links as a test link; setting the data transmission time interval of the test link to a fourth preset time interval; the fourth preset time interval is less than or equal to the first preset time interval.
[0023] By adopting this technical solution, the ranging speed between the terminal device and the Bluetooth device can be improved while ensuring the ranging accuracy between the terminal device and the Bluetooth device.
[0024] In a second aspect, the present application discloses a computer-readable storage medium, comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes any one of the methods in the first aspect.
[0025] The third aspect of the present application discloses an electronic device, which includes a processor and a memory, wherein the memory is used to store instructions, and the processor is used to call the instructions in the memory so that the electronic device executes any one of the methods in the first aspect above.
[0026] The fourth aspect of the present application discloses a computer program product, comprising: computer program code, which, when executed by a device, enables the device to execute any one of the methods in the first aspect.
[0027] It can be understood that the computer-readable storage medium of the second aspect, the electronic device of the third aspect, and the computer program product of the fourth aspect provided above all correspond to the method of the first aspect. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] FIG1 is a flowchart of a Bluetooth resource management method provided by an embodiment of the present application;
[0029] FIG2 is a flowchart of a Bluetooth resource management method provided by an embodiment of the present application;
[0030] FIG3 is a flowchart of a Bluetooth resource management method provided by an embodiment of the present application;
[0031] FIG4 is a flowchart of a Bluetooth resource management method provided by an embodiment of the present application;
[0032] FIG5 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] In order to more clearly understand the above-mentioned objectives, features and advantages of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features therein can be combined with each other in the absence of conflict.
[0034] In the following description, many specific details are set forth to facilitate a full understanding of the present application. The described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0035] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application pertains. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0036] It should be further noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0037] In this application, "at least one" means one or more, and "more than one" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0038] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0039] To facilitate understanding, some illustrations of concepts related to the embodiments of the present application are given for reference.
[0040] Terminal devices may include, but are not limited to, mobile phones, smart TVs, smart speakers, wearable devices, tablet computers, desktop computers, all-in-one computers, handheld computers, laptop computers, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), laptop computers, mobile computers, augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, vehicle-mounted devices, and any other terminal devices or portable terminal devices.
[0041] Please refer to Figure 1, which is a flowchart of the Bluetooth resource management method provided in an embodiment of the present application. This embodiment is applied to a terminal device with multiple Bluetooth links, as shown in Figure 1, and includes the following steps:
[0042] Step 101: The terminal device obtains Bluetooth resource occupancy information of multiple Bluetooth links.
[0043] In some embodiments, the Bluetooth resource occupancy information includes a data transmission time interval. Specifically, after the terminal device is connected to the Bluetooth device, data is transmitted between the terminal device and the Bluetooth device via a Bluetooth link. The shorter the data transmission time interval between the terminal device and the Bluetooth device, the heavier the load on the Bluetooth link. For example, when the terminal device is connected to a Bluetooth headset and music is playing, the data transmission time interval between the terminal device and the Bluetooth headset is very short, which means the load on the Bluetooth link between the terminal device and the Bluetooth headset is heavy. Conversely, the longer the data transmission time interval between the terminal device and the Bluetooth device, the lighter the load on the Bluetooth link. For example, when the terminal device is connected to a Bluetooth bracelet, the data transmission time interval between the terminal device and the Bluetooth bracelet is long, which means the load on the Bluetooth link between the terminal device and the Bluetooth bracelet is light.
[0044] In some embodiments, there is no limit on the number of Bluetooth links of the terminal device, and the terminal device may include three Bluetooth links, five Bluetooth links, etc.
[0045] Step 102: The terminal device determines whether multiple Bluetooth links meet the preset resource load requirements based on the Bluetooth resource occupancy information of each Bluetooth link. When multiple Bluetooth links meet the preset resource load requirements, execute step 103; when a target Bluetooth link that does not meet the preset resource load requirements is detected among multiple Bluetooth links, execute step 104.
[0046] In some embodiments, taking the Bluetooth resource occupancy information including the data transmission time interval as an example, detecting whether multiple Bluetooth links meet the preset resource load requirement based on the Bluetooth resource occupancy information can include: detecting whether each data transmission time interval is greater than or equal to a first preset time interval. If the data transmission time interval is greater than or equal to the first preset time interval, it indicates that the Bluetooth link corresponding to the data transmission time interval meets the preset resource load requirement; if the data transmission time interval is less than the first preset time interval, it indicates that the Bluetooth link corresponding to the data transmission time interval does not meet the preset resource load requirement.
[0047] In some embodiments, the value range of the first preset time interval can be any value between 7.5 milliseconds and 4 seconds, and can be set according to actual needs.
[0048] In some embodiments, the value of the first preset time interval is related to the number of target Bluetooth links. For example, when there are multiple target Bluetooth links, the first preset time interval is T1; when there is only one target Bluetooth link, the first preset time interval is T2, and T1 is greater than or equal to T2.
[0049] In some embodiments, the Bluetooth resource occupancy information can also be the size of the data packet transmitted by the Bluetooth link per unit time. Assuming that the terminal device needs to transmit a 10-megabyte data packet to the Bluetooth device, the terminal device detects whether multiple Bluetooth links meet the preset resource load requirements based on the Bluetooth resource occupancy information. It can be: separately detecting the time required for each Bluetooth link to transmit a 10-megabyte data packet to the Bluetooth device. If the transmission time of each Bluetooth link is less than the preset transmission time, whether multiple Bluetooth links meet the preset resource load requirements.
[0050] Step 103: The terminal device starts a preset performance test process.
[0051] In some embodiments, initiating a preset performance test process involves initiating a time synchronization or ranging process with a Bluetooth device. Specifically, taking the initiation of the ranging process with a Bluetooth device as an example, ranging between terminal devices and Bluetooth devices is widely used, such as mobile tracking, lost property retrieval, door lock proximity detection, and smart home audio and video. The ranging process in this embodiment is one-way ranging. One-way ranging does not require both the terminal device and the Bluetooth device to have receiving and transmitting functions, and therefore has lower functional requirements for the Bluetooth device. However, one-way ranging requires the terminal device and the Bluetooth device to be timed synchronously, that is, the clocks of the terminal device and the Bluetooth device must be consistent.
[0052] Therefore, before performing the ranging process between the terminal device and the Bluetooth device, the terminal device and the Bluetooth device must be accurately synchronized. This synchronization requires that all Bluetooth links on the terminal device have low loads. If a Bluetooth link on the terminal device has a high load, the terminal device may not receive and respond to signals from the Bluetooth device in a timely manner, affecting the timing accuracy between the terminal device and the Bluetooth device, and thus resulting in inaccurate ranging process results.
[0053] It can be understood that the above steps can detect that the target Bluetooth link of the terminal device does not meet the preset load requirements. In the subsequent steps, the Bluetooth resources of the target Bluetooth link will be adjusted so that all Bluetooth links of the terminal device can meet the preset load requirements, thereby improving the accuracy of the results of the ranging process.
[0054] In some embodiments, before starting the ranging process with the Bluetooth device, it also includes: selecting a Bluetooth link from multiple Bluetooth links as a test link; setting the data transmission time interval of the test link to a fourth preset time interval, wherein the fourth preset time interval is less than or equal to the first preset time interval.
[0055] Specifically, the terminal device selects a Bluetooth link as a test link from multiple Bluetooth links according to the Bluetooth protocol, and sets the data transmission time interval of the test link to a fourth preset time interval. Since the fourth preset time interval is less than or equal to the first preset time interval, the data transmission speed between the test links is faster, which can ensure the ranging accuracy between the terminal device and the Bluetooth device while improving the ranging speed between the terminal device and the Bluetooth device.
[0056] In some embodiments, according to the Bluetooth protocol, the fourth preset time interval has a value ranging from 7.5 milliseconds to 4 seconds, and the fourth preset time interval is preferably a multiple of 1.25 milliseconds.
[0057] Step 104: The terminal device obtains an application that matches the target Bluetooth link.
[0058] In some embodiments, assuming that the target Bluetooth link is Bluetooth link A and application B occupies the Bluetooth resources of Bluetooth link A, the application matching Bluetooth link A is application B.
[0059] In some embodiments, there may be one or more applications that match the target Bluetooth link. Specifically, multiple applications can use the same target Bluetooth link for data transmission at the same time.
[0060] Step 105: The terminal device closes or prompts the user to close the application program acquired in step 104, or adjusts or prompts the user to adjust the Bluetooth resources of the target Bluetooth link.
[0061] In some embodiments, the terminal device can directly close the application to release the Bluetooth resources of the target Bluetooth link.
[0062] In some embodiments, the terminal device executes step 103 after directly closing the application.
[0063] In some embodiments, the terminal device displays a second confirmation message for prompting the user to close the application. The user operates the displayed second confirmation message, and the terminal device closes the application in response to the user's operation.
[0064] In some embodiments, after the terminal device closes the application in response to a user operation, step 103 is executed.
[0065] Specifically, the type of the second confirmation information can be voice broadcast, pop-up window, etc. Taking the second confirmation information as a "pop-up window" as an example, a confirmation window pops up on the display interface of the terminal device, and after the user clicks the "Confirm" button, the terminal device closes the application to release the Bluetooth resources of the target Bluetooth link.
[0066] It is understandable that the user does not need to operate on the second confirmation information. For example, after a confirmation window pops up on the display interface of the terminal device, the user does not need to perform any operation on the confirmation window. The terminal device automatically closes the application after the preset length of time when the confirmation window pops up.
[0067] In some embodiments, adjusting or prompting the user to adjust the Bluetooth resources of the target Bluetooth link includes: adjusting the data transmission time interval of the target Bluetooth link to a fifth preset time interval; or prompting the user to adjust the data transmission time interval of the target Bluetooth link to the fifth preset time interval; or sending a first confirmation message to the Bluetooth device for adjusting the data transmission time interval of the target Bluetooth link to the fifth preset time interval, wherein the fifth preset time interval is used to enable the Bluetooth link to meet the preset load requirement.
[0068] Specifically, the terminal device directly adjusts the data transmission time interval of the target Bluetooth link to the fifth preset time interval; or the terminal device prompts the user to adjust the data transmission time interval of the target Bluetooth link to the fifth preset time interval through voice broadcast, pop-up window, etc.; or the terminal device sends a first confirmation message to the Bluetooth device, and the Bluetooth device itself determines whether to agree to change the data transmission time interval to the fifth preset time interval. If the determination result of the Bluetooth device is agreement, the Bluetooth device returns a confirmation message to the terminal device. After receiving the confirmation message, the terminal device changes the data transmission time interval to the fifth preset time interval.
[0069] In some embodiments, the terminal device performs step 103 after adjusting the data transmission time interval of the target Bluetooth link to the fifth preset time interval.
[0070] In some embodiments, the fifth preset time interval is equal to the first preset time interval mentioned above, thereby ensuring that the target communication link after adjusting the data transmission time interval meets the preset resource load requirement.
[0071] In some embodiments, the size of the fifth preset time interval is not specifically limited. It is only necessary to ensure that the target communication link after adjusting the data transmission time interval does not affect the preset performance test process of the terminal device.
[0072] For ease of understanding, the Bluetooth resource management method of this embodiment is specifically described below by taking the preset performance test process as a distance measurement process with a Bluetooth device as an example in conjunction with FIG. 2 .
[0073] Please refer to FIG2 , which is a flowchart of a Bluetooth resource management method.
[0074] Step 1001: The terminal device obtains the data transmission time interval of each Bluetooth link.
[0075] Specifically, before the terminal device starts the time calibration with the Bluetooth device, the load condition of each Bluetooth link in the terminal device is first obtained, such as the data transmission time interval of each Bluetooth link data packet.
[0076] Step 1002: The terminal device detects whether all data transmission time intervals are greater than or equal to the first preset time interval. When the terminal device detects that all data transmission time intervals are greater than or equal to the first preset time interval, execute step 1003; otherwise, execute step 1004.
[0077] Step 1003: The terminal device starts a distance measurement process with the Bluetooth device.
[0078] Specifically, if all data transmission time intervals are greater than or equal to the first preset time interval, indicating that the loads of all current Bluetooth links of the terminal device are low, the terminal device maintains the normal ranging process, ie, starts the time calibration with the Bluetooth device.
[0079] Step 1004: The terminal device filters out target applications in the Bluetooth link that are less than a first preset time interval.
[0080] Step 1005: The terminal device interrupts the target application and starts a distance measurement process with the Bluetooth device.
[0081] Step 1006: The application interface of the terminal device displays a confirmation message prompting the user to close the target application. After the terminal device detects the user's confirmation operation, step 1007 is executed; otherwise, step 1008 is executed.
[0082] Step 1007: The terminal device starts a distance measurement process with the Bluetooth device.
[0083] Step 1008: The terminal device does not start the distance measurement process with the Bluetooth device.
[0084] Regarding steps 1005 to 1008, specifically, if the data transmission time interval of some Bluetooth links is less than the first preset time interval, the target applications corresponding to these target Bluetooth links are screened out. Assuming that the data transmission time interval of Bluetooth link M is less than the first preset time interval, and the application corresponding to Bluetooth link M is application N, the following two parallel processing methods can be used, and the terminal device selects one of them for processing:
[0085] 1. As described in step 1005, the terminal device directly closes application N to ensure the accuracy of time synchronization and thus the accuracy of ranging;
[0086] 2. As described in steps 1006 to 1008, a confirmation window pops up on the display interface of the terminal device. After the user clicks the "Confirm" button, the terminal device closes application N and maintains the normal ranging process. After the user clicks the "Cancel" button, the terminal device notifies the Bluetooth device that the ranging process has failed.
[0087] It is understandable that FIG2 describes an application scenario in which the terminal device shuts down or prompts the user to shut down an application. In actual applications, the terminal device may also adjust or prompt the user to adjust the Bluetooth resources of the Bluetooth link.
[0088] Specifically, when the terminal device detects that there is a target Bluetooth link whose data transmission time interval is less than the first preset time interval, the terminal device directly changes the data transmission time interval of the target Bluetooth link to the fifth preset time interval; or, the terminal device sends a time interval change request to the Bluetooth device, and the Bluetooth device itself determines whether to agree to change the data transmission time interval of the Bluetooth link M. If the determination result of the Bluetooth device is agreement, the Bluetooth device returns a confirmation message to the terminal device. After receiving the confirmation message, the terminal device changes the data transmission time interval of the Bluetooth link M to maintain the normal ranging process.
[0089] Compared with the related art, the embodiments of the present application have at least the following advantages: by detecting whether each Bluetooth link meets the preset resource load requirements based on the Bluetooth resource occupancy information, when a target communication link that does not meet the preset resource load requirements is detected, it is possible to close or prompt the user to close the application that matches the target Bluetooth link, and to adjust or prompt the user to adjust the Bluetooth resources of the target Bluetooth link so that each Bluetooth link can meet the preset resource load requirements, thereby ensuring that the load of the Bluetooth link will not affect the performance of the terminal device, thereby making the preset performance test process more accurate.
[0090] Please refer to Figure 3, which is a flowchart of Bluetooth resource management provided in one embodiment of the present application. This embodiment is a further improvement of the previous embodiment. The main improvement is that in this embodiment, if there is a target Bluetooth link with a data transmission time interval less than the first preset time interval, the median of all data transmission time intervals will be calculated. If the median is greater than or equal to the second preset time interval, the preset performance test process will still be initiated. In this way, the use of the original application can be guaranteed as much as possible while ensuring that the load of each Bluetooth link does not affect the performance of the terminal device.
[0091] This embodiment is applied to the terminal device side, as shown in FIG3 , and includes the following steps:
[0092] Step 201: The terminal device obtains the data transmission time interval of each Bluetooth link among multiple Bluetooth links.
[0093] Step 202: The terminal device detects whether each data transmission time interval is greater than or equal to the first preset time interval. If multiple data transmission time intervals are greater than or equal to the first preset time interval, execute step 203; if a target Bluetooth link with a data transmission time interval less than the first preset time interval is detected among multiple Bluetooth links, execute step 204.
[0094] Step 203: The terminal device starts a preset performance test process.
[0095] Step 204: The terminal device calculates the median of all data transmission time intervals.
[0096] In some embodiments, before calculating the median of the data transmission time intervals corresponding to all Bluetooth links, the method further includes: detecting whether the minimum data transmission time interval among all data transmission time intervals is greater than a third preset time interval. If it is detected that the minimum data transmission time interval among all data transmission time intervals is greater than the third preset time interval, the median of all data transmission time intervals is calculated. In this way, it can be more accurately ensured that the load of each Bluetooth link does not affect the performance of the terminal device.
[0097] It is understood that if it is detected that the smallest data transmission time interval among all data transmission time intervals is less than or equal to the third preset time interval, the smallest data transmission time interval is filtered out until the remaining data transmission time intervals are all greater than the third preset time interval. The Bluetooth link corresponding to the filtered data transmission time interval is used as the target Bluetooth link.
[0098] To facilitate understanding, the following example illustrates how to calculate the median of the data transmission time intervals corresponding to all Bluetooth links in this embodiment:
[0099] Assuming that the third preset time interval is 500 milliseconds, the terminal device has a total of 5 Bluetooth links, and the data transmission time intervals of each Bluetooth link are 600 milliseconds, 1 second, 1.5 seconds, 2 seconds, and 5 seconds respectively; then the minimum data transmission time interval is 600 milliseconds, which is greater than 500 milliseconds; the median of the above data transmission time intervals is 1.5 seconds.
[0100] In some embodiments, the third preset time interval is smaller than the second preset time interval, and the value range of the third preset time interval can be any value between 7.5 milliseconds and 4 seconds.
[0101] Step 205: The terminal device detects whether the median is greater than or equal to the second preset time interval. When it is detected that the median is greater than or equal to the second preset time interval, step 203 is executed; when it is detected that the median is less than the second preset time interval, step 206 is executed.
[0102] In some embodiments, the second preset time interval is smaller than the first preset time interval, and the value range of the second preset time interval can be any value between 7.5 milliseconds and 4 seconds.
[0103] In some embodiments, when it is detected that the median is less than the second preset time interval, the smallest data transmission time intervals among all data transmission time intervals are filtered out one by one in ascending order until the median of the remaining data transmission time intervals is greater than or equal to the second preset time interval. The Bluetooth link corresponding to the filtered data transmission time interval is then used as the target Bluetooth link.
[0104] To facilitate understanding, the following example illustrates how to detect a target Bluetooth link in this embodiment:
[0105] Assume that the second preset time interval is 300 milliseconds, the terminal device has a total of 5 Bluetooth links, and the data transmission time intervals of Bluetooth links A and E are 80 milliseconds, 100 milliseconds, 240 milliseconds, 760 milliseconds, and 3 seconds, respectively. At this time, the median is 240 milliseconds, which is less than 300 milliseconds. The data transmission time interval of 80 milliseconds corresponding to Bluetooth link A is screened out, and the median of the remaining data transmission time intervals is calculated. The remaining data transmission time intervals are 100 milliseconds, 240 milliseconds, 760 milliseconds, and 3 seconds, and the median is 500 milliseconds, which is greater than 300 milliseconds. In this case, the screened Bluetooth link A is used as the target Bluetooth link.
[0106] Step 206: The terminal device obtains an application that matches the target Bluetooth link.
[0107] Step 207: The terminal device closes or prompts the user to close the application program acquired in step 206, or adjusts or prompts the user to adjust the Bluetooth resources of the target Bluetooth link.
[0108] In some embodiments, the terminal device executes step 203 after closing the application or adjusting the Bluetooth resources of the target Bluetooth link.
[0109] For ease of understanding, the Bluetooth resource management method of this embodiment is specifically described below by taking the preset performance test process as a distance measurement process with a Bluetooth device as an example in conjunction with FIG. 4 .
[0110] Please refer to FIG4 , which is a flowchart of the Bluetooth resource management method.
[0111] Step 2001: The terminal device obtains the data transmission time interval of each Bluetooth link.
[0112] Specifically, before the terminal device starts the time calibration with the Bluetooth device, the load condition of each Bluetooth link in the terminal device is first obtained, such as the data transmission time interval of each Bluetooth link data packet.
[0113] Step 2002: The terminal device detects whether the time intervals of all data transmissions are greater than or equal to the first preset time interval. When the terminal device detects that the time intervals of all data transmissions are greater than or equal to the first preset time interval, step 2003 is executed; otherwise, step 2005 is executed.
[0114] Step 2003: The terminal device starts a distance measurement process with the Bluetooth device.
[0115] Step 2004: The terminal device sets the data transmission time interval of the Bluetooth link that needs to be synchronized to a fifth preset time interval.
[0116] Regarding steps 2003 to 2004, specifically, if all data transmission time intervals are greater than or equal to the first preset time interval, indicating that the load of all current Bluetooth links of the terminal device is low, the normal ranging process is maintained, the time synchronization calibration between the Bluetooth device is started, and the data transmission time interval of the Bluetooth link that needs to be synchronized is set to the fifth preset time interval.
[0117] Step 2005: The terminal device calculates the median of all data transmission time intervals.
[0118] Step 2006: The terminal device detects whether the median is greater than or equal to the second preset time interval. If the median is greater than or equal to the second preset time interval, execute step 2003; otherwise, execute step 2007.
[0119] Regarding steps 2005 to 2006, specifically, if the data transmission time interval of some Bluetooth links is less than the first preset time interval, calculate the median of the data transmission time intervals of all Bluetooth links, and determine whether the median is greater than or equal to the second preset time interval. If the median is greater than or equal to the second preset time interval, maintain the normal ranging process, start the time synchronization calibration with the Bluetooth device, and set the data transmission time interval of the Bluetooth link that needs to be synchronized to the fifth preset time interval.
[0120] Step 2007: The terminal device selects the smallest data transmission time interval from all data transmission time intervals one by one in ascending order, calculates the median of the remaining data transmission time intervals, and returns to step 2006.
[0121] Specifically, if the median is less than the second preset time interval, the smallest data transmission time intervals among all data transmission time intervals are filtered out one by one in ascending order until the median of the remaining data transmission time intervals is greater than or equal to the second preset time interval, and the Bluetooth link corresponding to the filtered data transmission time interval is used as the target Bluetooth link.
[0122] Step 2008: The terminal device uses the Bluetooth link corresponding to the filtered data transmission time interval as the target Bluetooth link, and obtains a target application that matches the target Bluetooth link.
[0123] Step 2009: The terminal device interrupts the target application and starts a distance measurement process with the Bluetooth device.
[0124] Step 2010: The application interface of the terminal device displays a confirmation message prompting the user to close the target application. After the terminal device detects the user's confirmation operation, step 2012 is executed; otherwise, step 2013 is executed.
[0125] Step 2011: The terminal device starts a distance measurement process with the Bluetooth device.
[0126] Step 2012: The terminal device does not start the distance measurement process with the Bluetooth device.
[0127] Regarding steps 2009 to 2012, specifically, assuming that Bluetooth link P is the target Bluetooth link and the application corresponding to Bluetooth link P is application Q, there are two parallel processing methods, and the terminal device selects one of them for processing:
[0128] 1. As described in steps 2010 to 2012, a confirmation window pops up on the display interface of the terminal device. After the user clicks the "Confirm" button, the terminal device closes the application Q and maintains the normal ranging process. After the user clicks the "Cancel" button, the terminal device notifies the Bluetooth device that the ranging process has failed.
[0129] 2. As described in step 2009, the terminal device directly closes the application Q to ensure the accuracy of time synchronization and thus the accuracy of ranging.
[0130] It is understandable that FIG4 describes an application scenario in which the terminal device shuts down or prompts the user to shut down an application. In actual applications, the terminal device may also adjust or prompt the user to adjust the Bluetooth resources of the Bluetooth link.
[0131] Specifically, when the terminal device detects that there is a target Bluetooth link with a data transmission time interval less than the first preset time interval, the terminal device directly changes the data transmission time interval of the target Bluetooth link to the fifth preset time interval; or, the terminal device sends a time interval change request to the Bluetooth device, and the Bluetooth device itself determines whether to agree to change the data transmission time interval of the Bluetooth link P. If the determination result of the Bluetooth device is agreement, the Bluetooth device returns a confirmation message to the terminal device. After receiving the confirmation message, the terminal device changes the data transmission time interval of the Bluetooth link P to maintain the normal ranging process.
[0132] Compared with the related art, the embodiments of the present application have at least the following advantages: by detecting whether each Bluetooth link meets the preset resource load requirements based on the Bluetooth resource occupancy information, when a target communication link that does not meet the preset resource load requirements is detected, it is possible to close or prompt the user to close the application that matches the target Bluetooth link, and to adjust or prompt the user to adjust the Bluetooth resources of the target Bluetooth link so that each Bluetooth link can meet the preset resource load requirements, thereby ensuring that the load of the Bluetooth link will not affect the performance of the terminal device, thereby making the preset performance test process more accurate.
[0133] Please refer to Figure 5, which is a schematic diagram of the hardware structure of an electronic device 1000 provided in an embodiment of the present application. As shown in Figure 5, the electronic device 1000 may include a processor 1001 and a memory 1002. The memory 1002 is used to store one or more computer programs 1003. The one or more computer programs 1003 are configured to be executed by the processor 1001. The one or more computer programs 1003 include instructions, and the above instructions can be used to implement the above-mentioned Bluetooth resource management method in the electronic device 1000.
[0134] It is understood that the structure shown in this embodiment does not constitute a specific limitation on the electronic device 1000. In other embodiments, the electronic device 1000 may include more or fewer components than shown, or combine or separate some components, or arrange the components differently.
[0135] The processor 1001 may include one or more processing units. For example, the processor 1001 may include an application processor (AP), a modem, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.
[0136] Processor 1001 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in processor 1001 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 1001. If processor 1001 needs to use the same instruction or data again, it can directly access it from this memory. This avoids duplicate accesses, reduces the waiting time of processor 1001, and thus improves system efficiency.
[0137] In some embodiments, the processor 1001 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM interface, and / or a USB interface.
[0138] In some embodiments, memory 1002 may include high-speed random access memory and may also include non-volatile memory, such as a hard disk, memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0139] This embodiment further provides a computer-readable storage medium, which stores computer instructions. When the instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the Bluetooth resource management method in the above-mentioned embodiment.
[0140] Among them, the electronic device and computer storage medium provided in this embodiment are used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0141] In practical applications, the above functions can be distributed to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0142] In the several embodiments provided in this application, the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are schematic. For example, the division of the modules or units is a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0143] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0144] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0145] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0146] The above description is only a specific implementation method of the present application, but the protection scope of the present application is not limited thereto. Any changes or replacements within the technical scope disclosed in the present application should be included in the protection scope of the present application.
Claims
1. A Bluetooth resource management method, characterized in that: Applied to a terminal device having multiple Bluetooth links, the method comprises: Obtaining Bluetooth resource occupancy information of each Bluetooth link in the multiple Bluetooth links; Determining whether the plurality of Bluetooth links all meet a preset resource load requirement according to the Bluetooth resource occupancy information of each Bluetooth link; When the plurality of Bluetooth links all meet the preset resource load requirement, starting a preset performance test process; When a target Bluetooth link that does not meet the preset resource load requirement is detected among the multiple Bluetooth links, a target application matching the target Bluetooth link is closed or the user is prompted to close, or the Bluetooth resources of the target Bluetooth link are adjusted or the user is prompted to adjust.
2. The method according to claim 1, characterized in that The Bluetooth resource occupancy information includes a data transmission time interval; The obtaining of the Bluetooth resource occupancy information of each Bluetooth link in the plurality of Bluetooth links includes: The data transmission time interval of each Bluetooth link in the multiple Bluetooth links is obtained, wherein one Bluetooth link corresponds to one data transmission time interval.
3. The method according to claim 2, characterized in that The determining, according to the Bluetooth resource occupancy information of each Bluetooth link, whether the plurality of Bluetooth links all meet the preset load requirement includes: respectively detecting whether a data transmission time interval of each Bluetooth link is greater than or equal to a first preset time interval; The multiple Bluetooth links all meet the preset resource load requirement, including: the data transmission time interval of each Bluetooth link is greater than or equal to the first preset time interval; A target Bluetooth link that does not meet the preset resource load requirement is detected among the multiple Bluetooth links, including: detecting that the data transmission time interval of the target Bluetooth link is less than the first preset time interval, wherein the target Bluetooth link is one or more of the multiple Bluetooth links.
4. The method according to claim 2, characterized in that The determining, according to the Bluetooth resource occupancy information of each Bluetooth link, whether the plurality of Bluetooth links all meet the preset load requirement includes: Calculating the median of the data transmission time intervals of the multiple Bluetooth links; Detecting whether the median is greater than or equal to a second preset time interval; The plurality of Bluetooth links all satisfy the preset resource load requirement, including: the median is greater than or equal to the second preset time interval; The target Bluetooth link that does not meet the preset resource load requirement is detected in the multiple Bluetooth links, including: It is detected that the median is smaller than the second preset time interval; wherein the data transmission time interval of the target Bluetooth link is smaller than the median.
5. The method according to claim 4, characterized in that Before calculating the median of the data transmission time intervals of the plurality of Bluetooth links, the method further includes: Detecting whether the smallest data transmission time interval among the data transmission time intervals of the multiple Bluetooth links is greater than a third preset time interval, wherein the third preset time interval is less than the second preset time interval; The calculating the median of the data transmission time intervals of the plurality of Bluetooth links comprises: When it is detected that the smallest data transmission time interval among the data transmission time intervals of the multiple Bluetooth links is greater than the third preset time interval, a median of the data transmission time intervals of the multiple Bluetooth links is calculated.
6. The method according to claim 4 or 5, characterized in that When it is detected that the median is less than the second preset time interval, an application matching the target Bluetooth link is obtained in the following manner: When it is detected that the median is less than the second preset time interval, the smallest data transmission time intervals among all the data transmission time intervals are screened out one by one in ascending order until the median of the remaining data transmission time intervals is greater than or equal to the second preset time interval; The filtered Bluetooth link corresponding to the data transmission time is used as the target Bluetooth link, and the application matching the target Bluetooth link is acquired.
7. The method according to any one of claims 2 to 6, characterized in that: The adjusting or prompting the user to adjust the Bluetooth resources of the target Bluetooth link includes: adjusting the data transmission time interval of the target Bluetooth link to a fifth preset time interval; or Prompting the user to adjust the data transmission time interval of the target Bluetooth link to the fifth preset time interval; or Sending, to the Bluetooth device, first confirmation information for adjusting the data transmission time interval of the target Bluetooth link to a fifth preset time interval; The fifth preset time interval is used to make the Bluetooth link meet the preset load requirement.
8. The method according to any one of claims 1 to 7, characterized in that: The obtaining of the Bluetooth resource occupancy information of each Bluetooth link in the plurality of Bluetooth links includes: Before starting a time synchronization or distance measurement process with a Bluetooth device, obtaining Bluetooth resource occupancy information of each Bluetooth link in the multiple Bluetooth links; The starting of the preset performance test process includes: Start the time synchronization or distance measurement process with the Bluetooth device.
9. The method according to claim 8, characterized in that Before starting the time synchronization or distance measurement process with the Bluetooth device, the method further includes: Selecting a Bluetooth link from the multiple Bluetooth links as a test link; The data transmission time interval of the test link is set to a fourth preset time interval; the fourth preset time interval is less than or equal to the first preset time interval.
10. A computer-readable storage medium, characterized in that: The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method according to any one of claims 1 to 9.
11. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein the memory is used to store instructions, and the processor is used to call the instructions in the memory, so that the electronic device executes the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Bluetooth communication method, Bluetooth communication system, Bluetooth receiving method and Bluetooth receiving device
CN108111194A
Memory recovery method and device, terminal equipment and computer readable storage medium
CN108228341A
Program optimization method, device, terminal and storage medium
CN108491275A
Bluetooth communication method and device supporting multi-antenna transceiving channel
CN114050851A
Link traffic control method and device
WO2018133783A1
