Connection method of Bluetooth device and related system

By using timers and connection queues to manage connection requests during Bluetooth device connection, the connection latency issue in scenarios where terminal devices interact with multiple Bluetooth devices is resolved, thereby improving connection reliability and user experience.

CN121815452APending Publication Date: 2026-04-07HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

In scenarios where a terminal device connects and interacts with multiple Bluetooth devices, connection latency issues with Bluetooth devices can lead to a degraded user experience, potentially resulting in audio signal delays and connection failures.

Method used

By starting a timer during the connection establishment process between the terminal device and the first Bluetooth device, the connection duration is limited, and connection establishment with other Bluetooth devices is blocked or postponed if the timer has not expired and the connection has not been completed. The timer and connection queue are used to manage connection requests and ensure that the current connection is completed first.

Benefits of technology

It reduces connection latency for Bluetooth devices, improves connection reliability and stability, optimizes user experience, and avoids the risk of connection failure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121815452A_ABST
    Figure CN121815452A_ABST
Patent Text Reader

Abstract

The invention provides a Bluetooth device connection method and a related system. The method comprises the following steps: starting a first timer in a process of establishing Bluetooth connection with first Bluetooth equipment; and when the first timer is not overtime and the connection with the first Bluetooth device is not completed, not starting to establish Bluetooth connection with other Bluetooth devices except the first Bluetooth device. According to the method provided by the invention, the connection delay of the Bluetooth devices can be reduced in a connection interaction scene between the terminal device and the multiple Bluetooth devices.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of terminal device, and in particular, to a connection method of Bluetooth device and a related system. BACKGROUND

[0002] With the wide popularity of Bluetooth devices (such as earphones, sound boxes, vehicle-mounted systems, etc.) and smart interconnection services, terminal devices (such as mobile phones, tablet computers, etc.) are increasingly connected with Bluetooth devices for calls and media playing in daily life.

[0003] Currently, a Bluetooth device and a terminal device first establish a connection of an asynchronous connection-less (ACL) link, and then establish a connection of a call / media channel. The Bluetooth device and the terminal device can send data streams in the call / media channel, thereby realizing successful connection. However, if the ACL link between the terminal device and a first Bluetooth device is successfully established, but the call / media channel between the two has not started to be connected, a connection of the terminal device and another Bluetooth device can be inserted, resulting in that the terminal device displays that it has successfully connected with the first Bluetooth device, but audio signals cannot be transmitted to the first Bluetooth device in time, causing significant delay of audio output. This situation not only affects the user experience, but also can cause actual inconvenience and trouble in some scenarios.

[0004] Therefore, in the scenario of connection and interaction between a terminal device and multiple Bluetooth devices, how to reduce the connection delay of a Bluetooth device is a technical problem to be solved. SUMMARY

[0005] Embodiments of the present application provide a connection method of Bluetooth device and a related system, which can reduce the connection delay of a Bluetooth device in the scenario of connection and interaction between a terminal device and multiple Bluetooth devices.

[0006] In a first aspect, embodiments of the present application provide a connection method of Bluetooth device, which can be executed by a terminal device, or a module (such as a processor, a chip, or a chip system, etc.) applied to the terminal device, or a logic node, a logic module, or software capable of realizing all or part of the functions of the terminal device. The method can include: starting a first timer in the process of establishing a Bluetooth connection with a first Bluetooth device (for example, specifically, when starting to establish a connection of an ACL link, or when discovering and confirming services through a service discovery protocol (SDP), or when starting to establish a connection of a call / media channel); and not starting to establish a Bluetooth connection with other Bluetooth devices except the first Bluetooth device in the case that the first timer has not expired and the connection with the first Bluetooth device has not been completed.

[0007] By starting the first timer, the terminal device can effectively control the duration of the connection in the process of establishing a Bluetooth connection with the first Bluetooth device, and ensure that the connection task is completed within a specified time. In addition, in the case that the first timer does not expire and the connection between the terminal device and the first Bluetooth device is not completed, the terminal device is prevented or delayed from starting to establish a connection with other Bluetooth devices, that is, the terminal device can not start to establish a connection with other Bluetooth devices within the timing duration of the first timer, and the connection task between the current terminal device and the first Bluetooth device can be ensured to be completed in priority. In this way, not only can the connection delay and resource conflict caused by the simultaneous connection of multiple Bluetooth devices be prevented, but also the reliability and stability of the Bluetooth device connection can be improved. This method significantly optimizes the user experience, so that the user does not have to wait for a long time in the interaction scenario of connecting the terminal device with multiple Bluetooth devices, reduces the connection delay of the Bluetooth device, and avoids the potential risk of connection failure.

[0008] In a possible implementation, in the case that the first timer does not expire and the connection with the first Bluetooth device is not completed, the terminal device does not start to establish a Bluetooth connection with other Bluetooth devices except the first Bluetooth device, including: in the case that the first timer does not expire and the connection with the first Bluetooth device is not completed, receiving a first connection request sent by a second Bluetooth device for requesting to establish a Bluetooth connection, starting a second timer, and putting the first connection request into a connection queue for sorting and waiting, wherein the other Bluetooth devices include the second Bluetooth device.

[0009] In the case that the first timer does not expire and the connection between the terminal device and the first Bluetooth device is not completed, for the case that the terminal device passively receives a connection request from other Bluetooth devices, such as when the terminal device receives a connection request from a second Bluetooth device, the terminal device does not immediately establish a connection with the second Bluetooth device, but manages the request by starting a second timer, and puts the request into a connection queue for sorting and waiting. Through the combination of the second timer and the connection queue, the Bluetooth connection management in the interaction scenario of connecting the terminal device with multiple Bluetooth devices is optimized. In this way, each connection request can be processed in order by the terminal device, without causing confusion in the connection order or resource competition.

[0010] In a possible implementation, if the second timer expires, the first connection request is removed from the connection queue.

[0011] In a possible implementation, the starting the first timer comprises starting the first timer at time t1, the starting the second timer comprises starting the second timer at time t2, the time t2 is the same as or after the time t1, a time length of the first timer is T1, and a time length of the second timer is T2; and T2 > T1-(t2-t1), or T1-(t2-t1) > T2 > 0.

[0012] By starting the second timer, the terminal device can effectively avoid the request in the connection queue being indefinitely waiting for processing. When the second timer expires, the method removes the connection request sent by other Bluetooth devices and unable to be processed in time from the connection queue, so that the terminal device can process a new connection request in time, optimizes resource allocation, improves user experience, and ensures that the connection process of the Bluetooth device is faster and more flexible.

[0013] In a possible implementation, the not establishing a connection with other Bluetooth devices except the first Bluetooth device in the case that the first timer does not expire and the connection with the first Bluetooth device is not completed comprises: in the case that the first timer does not expire and the connection with the first Bluetooth device is not completed, generating a second connection request for requesting to establish a Bluetooth connection with a third Bluetooth device, and putting the second connection request into the connection queue for sorting and waiting, the other Bluetooth devices including the third Bluetooth device.

[0014] In the case that the first timer does not expire and the connection of the terminal device with the first Bluetooth device is not completed, for the case that the terminal device initiatively sends a connection request to other Bluetooth devices, such as the terminal device sending a second connection request to the third Bluetooth device, the terminal device does not immediately establish a connection therewith, that is, the terminal device can put the request into the connection queue for waiting. By putting the second connection request into the connection queue and sorting, not only is it ensured that the Bluetooth connection of the terminal device with the first Bluetooth device is established in priority, but also it helps the terminal device to orderly process the connection request initiated by other Bluetooth devices, thereby improving user experience.

[0015] In a possible implementation, in the case that the first timer expires and the connection with the first Bluetooth device is not completed, or in the case that the first timer does not expire and the connection with the first Bluetooth device is completed, if there is a connection request in the connection queue, a Bluetooth device corresponding to the connection request starts to establish a connection, the connection request including the first connection request and / or the second connection request.

[0016] In this way, the terminal device can timely switch to other connection requests (which can include the first connection request and / or the second connection request) in the connection queue, so that the terminal device can timely establish a Bluetooth connection with the Bluetooth device corresponding to the connection request, thereby avoiding unnecessary connection delay.

[0017] The above method provides a flexible and efficient Bluetooth connection method. Whether the connection between the terminal device and the first Bluetooth device is completed or not, the terminal device can reasonably process the connection request of other Bluetooth devices according to the state of the timer and the situation in the connection queue. In the interactive scenario of the connection between the terminal device and multiple Bluetooth devices, the method not only reduces the connection delay of the Bluetooth device and improves the efficiency of the management of multiple Bluetooth devices, but also enables the user to obtain a smoother Bluetooth connection experience and avoids the situation that other Bluetooth devices cannot be timely connected due to the failure or delay of a connection.

[0018] In a second aspect, the embodiments of the present application provide a connection system of a Bluetooth device, which includes a terminal device and a first Bluetooth device. The terminal device is configured to start a first timer during the process of establishing a Bluetooth connection with the first Bluetooth device. The terminal device is further configured to not start to establish a Bluetooth connection with other Bluetooth devices except the first Bluetooth device in the case that the first timer is not timed out and the connection with the first Bluetooth device is not completed. The first Bluetooth device is configured to establish a Bluetooth connection with the terminal device.

[0019] In a possible implementation, the system further includes a second Bluetooth device. In the case that the first timer is not timed out and the connection with the first Bluetooth device is not completed, the terminal device does not start to establish a Bluetooth connection with other Bluetooth devices except the first Bluetooth device, specifically configured to: in the case that the first timer is not timed out and the connection with the first Bluetooth device is not completed, receive a first connection request sent by a second Bluetooth device and used to request to establish a Bluetooth connection, start a second timer, and put the first connection request into a connection queue for sorting and waiting. The other Bluetooth devices include the second Bluetooth device.

[0020] In a possible implementation, the terminal device is further configured to: if the second timer is timed out, remove the first connection request from the connection queue.

[0021] In a possible implementation, the terminal device starts a first timer, specifically, starts the first timer at time t1; the terminal device starts a second timer, specifically, starts the second timer at time t2, the time t2 is the same as or after the time t1, a time length of the first timer is T1, and a time length of the second timer is T2; and T2>T1-(t2-t1) or T1-(t2-t1)>T2>0.

[0022] In a possible implementation, the system further includes a third Bluetooth device; and the terminal device does not establish a connection with other Bluetooth devices except the first Bluetooth device in a case that the first timer is not expired and the connection with the first Bluetooth device is not completed, specifically, generates a second connection request for requesting the third Bluetooth device to establish a Bluetooth connection, and puts the second connection request into a connection queue for sorting and waiting, the other Bluetooth devices include the third Bluetooth device.

[0023] In a possible implementation, the terminal device is further configured to: in a case that the first timer is expired and the connection with the first Bluetooth device is not completed, or in a case that the first timer is not expired and the connection with the first Bluetooth device is completed, if there is a connection request in the connection queue, a Bluetooth device corresponding to the connection request starts to establish a connection, the connection request includes the first connection request and / or the second connection request.

[0024] The beneficial effects can refer to the description of the first aspect, which will not be repeated here. The connection system includes a module for executing the method in the first aspect and possible implementations thereof. The module in the second aspect can also be replaced by a unit or means, etc. The foregoing module can be implemented by software, or by hardware, or by a combination of software and hardware.

[0025] In a third aspect, the present application provides a terminal device. The terminal device can include a memory and one or more processors. The memory is coupled to the one or more processors. The memory is configured to store computer program codes. The computer program codes include computer instructions. The one or more processors are configured to invoke the computer instructions to enable the terminal device to execute any one of the possible implementations of the first aspect.

[0026] In a fourth aspect, the present application provides a computer storage medium including instructions, when the instructions are executed on a terminal device, enable the terminal device to execute any one of the possible implementations of the first aspect.

[0027] In a fifth aspect, an embodiment of the present application provides a chip, which is applied to a terminal device, and the chip comprises one or more processors configured to invoke computer instructions to cause the terminal device to perform any possible implementation manner of the first aspect.

[0028] In a sixth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a device, cause the terminal device to perform any possible implementation manner of the first aspect.

[0029] It can be understood that the Bluetooth device connection system provided in the second aspect, the terminal device provided in the third aspect, the computer storage medium provided in the fourth aspect, the chip provided in the fifth aspect, and the computer program product provided in the sixth aspect are all used to execute the method provided in the embodiments of the present application. Therefore, the beneficial effects that can be achieved by them can refer to the beneficial effects in the corresponding method, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS

[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background art, the drawings needed to be used in the embodiments of the present application or the background art will be described below.

[0031] Figure 1 is an architecture schematic diagram of a Bluetooth device connection system provided by an embodiment of the present application;

[0032] Figures 2A-2C is a group of user interface schematic diagrams provided by an embodiment of the present application;

[0033] Figure 3 is a flow schematic diagram of a Bluetooth device connection method provided by an embodiment of the present application;

[0034] Figure 4 is a flow schematic diagram of another Bluetooth device connection method provided by an embodiment of the present application;

[0035] FIGS. 5(1) and 5(2) are schematic diagrams of a second timer duration provided by an embodiment of the present application;

[0036] Figure 6 is a flow schematic diagram of another Bluetooth device connection method provided by an embodiment of the present application;

[0037] Figure 7 is a flow schematic diagram of another Bluetooth device connection method provided by an embodiment of the present application;

[0038] Figure 8 is a flow schematic diagram of another Bluetooth device connection method provided by an embodiment of the present application;

[0039] Figure 9Fig. 1 is a schematic diagram of a hardware structure of a terminal device 900 according to an embodiment of the present application.

[0040] Figure 10 Fig. 2 is a schematic diagram of a software structure of the terminal device 900 according to an embodiment of the present application. DETAILED DESCRIPTION

[0041] The embodiments of the present application will be described in further detail below with reference to the accompanying drawings.

[0042] The terms "first" and "second" and the like in the description, claims, and drawings of the application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. Furthermore, the terms "comprises", "comprising", "includes", "including" and the like are used synonymously to denote a non-exclusive inclusion such that processes, methods, articles, or apparatuses that comprise, include or are including some named but also comprise, include or are including other not named elements, without precluding other intended embodiments are also intended to be embraced by the expression of including, comprising or consisting of.

[0043] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive of one another. It is expressly understood that the embodiments described herein are merely examples from a whole class of comparable embodiments which are claimed as falling within the scope of the application.

[0044] In the present application, "at least one" means one or more, "multiple" means two or more, "at least two" means two or three or more, and "and / or" is used to describe the relationship between associated objects, indicating that there can be three relationships, for example, "A and / or B" can mean: only A, only B, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects. "At least one of the following" or the like means any combination of these items, including any combination of single or multiple items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0045] In this application, "send request" can be understood as one device sending a request to another device, or it can also be understood as one logic module within a device sending a request to another logic module. For example, "terminal device send request" can be understood as a terminal device sending a request to another device (such as a terminal), or it can be understood as logic module 1 in the terminal device sending a request to logic module 2 in the terminal device.

[0046] In this application, "receive request" can be understood as one device receiving a request from another device, or it can also be understood as a logical module within a device receiving a request from another logical module. For example, "terminal device receive request" can be understood as a terminal device receiving a request from another device (such as a terminal), or it can be understood as logical module 1 in the terminal device receiving a request from logical module 2 in the terminal device.

[0047] In this application, "send a request to... (e.g., a terminal)" can be understood as the destination of the request being the terminal. This can include sending the request directly or indirectly to the terminal. "Receive a request from... (e.g., a terminal)" or "receive a request from... (e.g., a terminal)" can be understood as the source of the information being the terminal, and can include receiving the request directly or indirectly from the terminal. The request may undergo necessary processing between the source and destination, such as format changes, but the destination can understand a valid request from the source. Similar expressions in this application can be interpreted similarly, and will not be elaborated further here.

[0048] To better understand the embodiments of this application, the technical terms involved in the embodiments of this application will be introduced first:

[0049] Profiles are a set of standardized protocols and functions that define how Bluetooth devices communicate with each other. Each Bluetooth profile describes a specific type of Bluetooth application scenario or use case, such as audio transmission, file transfer, and keyboard input. These profiles are built on the Bluetooth core specification, ensuring that Bluetooth devices from different manufacturers can interoperate. For example, two devices that support the same audio profile can pair with each other and transmit audio data. Common Bluetooth profiles include the Advanced Audio Distribution Profile (A2DP), used for high-quality audio transmission, such as transmitting music from a mobile phone to headphones or speakers via Bluetooth.

[0050] An ACL link refers to the basic data transmission link between Bluetooth devices. It is an asynchronous connection suitable for most Bluetooth data transmission applications. It provides reliable data communication services and can be used to transmit various types of data that do not require strict time synchronization.

[0051] The Audio / Video Distribution Transport Protocol (AVDTP) is a transport protocol used for A2DP and other Bluetooth profiles related to audio / video data transmission. It is responsible for establishing, managing, and releasing transmission channels for audio / video streams between devices.

[0052] Page timeout is a concept in the Bluetooth protocol that defines the maximum time a Bluetooth device will wait for a response from another device when attempting to establish a connection. If no response is received within this time, the connection request will be automatically abandoned, and the Bluetooth device will stop attempting to connect. The default page timeout is typically 10.24 seconds, which is a typical value specified in the Bluetooth protocol. However, the specific page timeout duration can be adjusted according to device and application requirements.

[0053] HCI (Host Controller Interface) exists within the Bluetooth protocol stack of terminal devices (including Bluetooth devices). It is a key interface in the Bluetooth protocol stack, connecting the terminal device's processor and controller. HCI is responsible for transmitting commands, events, and data between the processor and controller, ensuring smooth communication between the terminal devices. HCI is not a protocol itself, but rather a standardized interface within the protocol stack.

[0054] To better understand the embodiments of this application, the system architecture involved in the embodiments of this application is described below:

[0055] like Figure 1 As shown, Figure 1 This is a schematic diagram of the architecture of a Bluetooth device connection system provided in an embodiment of this application. The system architecture includes, but is not limited to, the following components: a terminal device, a first Bluetooth device, a second Bluetooth device, and a third Bluetooth device. During the Bluetooth connection process between the terminal device and the first Bluetooth device, the second Bluetooth device can send a connection request to the terminal device, and the terminal device can also send a connection request to the third Bluetooth device. Optionally, the second Bluetooth device and the third Bluetooth device can be the same device. This system architecture can be applied to Bluetooth device connection systems, including but not limited to: smart interconnection systems, smart home systems, in-vehicle infotainment systems, multimedia playback systems, smart office systems, and mobile device interaction systems.

[0056] The following section will provide a detailed explanation of the terminal devices, the first Bluetooth device, the second Bluetooth device, and the third Bluetooth device involved in this system architecture.

[0057] The terminal device is a device capable of Bluetooth interaction with the first Bluetooth device, the second Bluetooth device, and the third Bluetooth device. For example, the terminal device can be any one of the following: a terminal device, smartphone, tablet, laptop, desktop computer, smartwatch, smart TV, game console, e-book reader, handheld game console, etc. The first Bluetooth device, the second Bluetooth device, and the third Bluetooth device are devices capable of Bluetooth interaction with the terminal device. The first Bluetooth device, the second Bluetooth device, and the third Bluetooth device can also be understood as Bluetooth devices that interact with the terminal device via Bluetooth. For example, the first Bluetooth device, the second Bluetooth device, and the third Bluetooth device can be any one of the following: Bluetooth in-ear headphones, Bluetooth headphones, Bluetooth hearing aids, portable Bluetooth speakers, home Bluetooth speakers, Bluetooth audio repeaters, etc.

[0058] This application does not limit the form of terminal devices such as terminal devices, first Bluetooth devices, second Bluetooth devices, and third Bluetooth devices. The device used to implement the functions of a terminal device can be the terminal device itself; it can also be a device capable of supporting the terminal device in implementing that function, such as a chip system. This device can be installed in the terminal device or used in conjunction with the terminal device. Similarly, the device used to implement the functions of a Bluetooth device can be a Bluetooth device; it can also be a device capable of supporting the Bluetooth device in implementing that function, such as a chip system. This device can be installed in the Bluetooth device or used in conjunction with the Bluetooth device. In the embodiments of this application, the chip system can be composed of chips, or it can include chips and other discrete components.

[0059] Figure 1 The system architecture shown is only illustrated using one terminal device and three Bluetooth devices as an example; there is no limit to the number of terminal devices and Bluetooth devices.

[0060] The following is combined Figures 2A-2C This application introduces some user interfaces provided in its embodiments.

[0061] In this application's embodiments, the term "user interface" refers to the medium interface through which an application or operating system interacts and exchanges information with the user. It converts information between its internal form and a form acceptable to the user. A common form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operation displayed graphically. It can be an icon, window, control, or other interface element displayed on the screen of a terminal device. Controls can include visual interface elements such as icons, button icons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and widgets.

[0062] Figures 2A-2CThese are schematic diagrams of a set of user interfaces provided in the embodiments of this application.

[0063] Figure 2A An example is shown of a user interface 210 on a terminal device. Figure 2A As shown, the user interface 210 displays a page for connecting to Bluetooth devices. This page may include a button icon 211 for turning Bluetooth on or off. Users can click button icon 211 to automatically connect to Bluetooth devices; illuminating button icon 211 establishes an ACL link connection with the Bluetooth device. Icon 212 displays paired devices, i.e., Bluetooth devices that have established an ACL link connection with the terminal device. In this embodiment, this Bluetooth device is 'DEVICE4'. Additionally, users can click icon 213 to configure and manage Bluetooth connections for paired devices. This embodiment does not limit the content displayed on the user interface 210.

[0064] Clicking icon 213 in user interface 210 will display Figure 2B The user interface 220 is shown. (As shown) Figure 2B As shown, the user interface 220 displays a page for setting up and managing Bluetooth connections for paired devices. This page may include a button icon 221 for turning the call audio connection on or off, and a button icon 222 for turning the media audio connection on or off. Normally, when the terminal device connects to a Bluetooth device, button icons 221 and 222 will automatically light up. Figure 2B The fact that button icons 221 and 222 are still lit indicates that the terminal device and the Bluetooth device are establishing a call / media channel connection based on the established ACL link connection. This embodiment of the application does not limit the content displayed on the user interface 220.

[0065] Figure 2C An example is shown of a user interface 230 on a terminal device. For example... Figure 2C As shown, user interface 230 displays a page for setting up and managing Bluetooth connections for paired devices. This page, based on user interface 220, completes the connection of the call / media channel. The content of this page is the same as that of user interface 220, and therefore will not be described again. This application embodiment does not limit the content displayed on user interface 230. Furthermore, this application embodiment does not limit the names of the aforementioned icons.

[0066] To facilitate understanding of the embodiments of this application, the specific technical problems to be solved by this application are further analyzed and proposed.

[0067] Currently, Bluetooth devices and terminal devices first establish an ACL link connection, and then establish a call / media channel connection through protocols such as AVDTP and related profiles. The Bluetooth device and terminal device can then send data streams through the call / media channel, thus achieving a successful connection. However, as... Figure 2A As shown, although the user interface of the terminal device displays that it has successfully connected to the 'DEVICE4' Bluetooth device, this only means that the ACL link between the terminal device and the 'DEVICE4' device has been successfully established, and does not mean that a call / media channel between the two has been successfully established. Figure 2B As shown, the user interface displays that the call / media channel is connecting. At this time, it's highly likely that connections to other Bluetooth devices will be interrupted, causing audio signals from the terminal device to fail to be transmitted to the 'DEVICE4' Bluetooth device in a timely manner, resulting in a significant delay in audio output. This situation not only affects the user experience but can also cause practical inconvenience and frustration in some scenarios. Therefore, reducing the connection latency of Bluetooth devices in scenarios where the terminal device interacts with multiple Bluetooth devices is a pressing technical problem that needs to be solved.

[0068] The technical problem to be solved by the embodiments of this application is: how to reduce the connection latency of Bluetooth devices in scenarios where terminal devices connect and interact with multiple Bluetooth devices.

[0069] Based on the above, this application proposes a method for connecting Bluetooth devices, which will be described below through various embodiments. It should be understood that these methods can be used in combination. The technical solution provided by this application is not limited to the process described below. Furthermore, the scenario descriptions in the embodiments of this application are merely illustrative and do not limit the solutions of this application to the described scenarios; they are also applicable to scenarios with similar problems.

[0070] The terminal device in this application embodiment (as described in the corresponding embodiments below) can be Figure 1 The terminal device shown in this embodiment can perform functions that are executed by the terminal device itself, but these functions can also be performed by devices within the terminal device (e.g., a chip, a chip system, or a circuit). The first Bluetooth device in this embodiment can be... Figure 1 The first Bluetooth device shown in this embodiment can perform functions that are executed by the first Bluetooth device itself, but these functions can also be performed by a device within the first Bluetooth device (e.g., a chip, a chip system, or a circuit). The second Bluetooth device in this embodiment can be... Figure 1 The functions performed by the second Bluetooth device shown in this embodiment can also be performed by a device within the second Bluetooth device (e.g., a chip, a chip system, or a circuit). The third Bluetooth device in this embodiment can be... Figure 1The functions performed by the third Bluetooth device shown in this embodiment can also be performed by a device within the third Bluetooth device (e.g., a chip, a chip system, or a circuit). This embodiment is described uniformly here and will not be repeated hereafter.

[0071] Please see Figure 3 , Figure 3 This is a flowchart illustrating a Bluetooth device connection method provided in an embodiment of this application. Figure 3 As shown:

[0072] Step S301: The terminal device and the first Bluetooth device begin to establish a Bluetooth connection.

[0073] The connection can be initiated by either the terminal device to the first Bluetooth device or vice versa. In either case, the receiving party agrees to the connection request, and a connection is established. In this embodiment, the connection established between the terminal device and various Bluetooth devices, including the first Bluetooth device, is a Bluetooth connection. This Bluetooth connection can be in various modes, such as classic Bluetooth, Bluetooth Low Energy, Bluetooth point-to-point, Bluetooth multipoint, Bluetooth broadcast, Bluetooth pairing-free, NFC-assisted Bluetooth pairing, and Wi-Fi-assisted Bluetooth. This embodiment does not specifically limit the Bluetooth connection method. It is understood that in practical applications, other suitable Bluetooth connection methods between the terminal device and various Bluetooth devices, including the first Bluetooth device, can also be selected, and will not be elaborated further hereafter.

[0074] Step S302: During the process of establishing a Bluetooth connection between the terminal device and the first Bluetooth device, the first timer is started.

[0075] The first timer can be a software timer or a hardware timer in the terminal device, used to detect whether the Bluetooth connection process between the terminal device and the first Bluetooth device has timed out. The first timer is started during the process of establishing a Bluetooth connection between the terminal device and the first Bluetooth device (for example, specifically when establishing an ACL link connection, when using the SDP discovery and confirmation service, or when establishing a call / media channel connection). In this embodiment, the timing of the terminal device starting the first timer is not specifically limited; it can be understood that the first timer can be started at any time before the Bluetooth connection between the terminal device and the first Bluetooth device is completed. It should be noted that this embodiment only uses three examples—establishing an ACI link connection, using the SDP discovery and confirmation service, and establishing a call / media channel connection—as examples for illustration. Of course, the Bluetooth connection process may also include other connection stages, which will not be listed in this embodiment.

[0076] When the time taken for the terminal device to establish a Bluetooth connection with the first Bluetooth device (from the start of establishing the ACL link connection between the terminal device and the first Bluetooth device to the completion of the call / media channel connection between the terminal device and the first Bluetooth device) exceeds the duration of the first timer (for example, the default value of page timeout, which is usually 10.24 seconds), it can be determined that the Bluetooth connection process between the terminal device and the first Bluetooth device has timed out.

[0077] Step S303: If the first timer has not expired and the connection between the terminal device and the first Bluetooth device has not been completed, the terminal device shall not establish a connection with any other Bluetooth device besides the first Bluetooth device.

[0078] Other Bluetooth devices include second Bluetooth devices and / or third Bluetooth devices.

[0079] Optionally, the second and third Bluetooth devices can be the same device.

[0080] The failure to complete the connection between the terminal device and the first Bluetooth device can be due to several reasons, including: the ACL link connection not being established; the SDP discovery and confirmation service steps not being completed; or the call / media channel connection not being established. This application does not specifically limit the scenarios where the connection between the terminal device and the first Bluetooth device is incomplete. It is understood that in practical applications, other scenarios where the connection between the terminal device and the first Bluetooth device is incomplete can also be considered, and will not be elaborated further hereafter.

[0081] The terminal device does not establish a connection with any Bluetooth device other than the first Bluetooth device. This means that as long as the first timer has not expired and the connection between the terminal device and the first Bluetooth device has not been completed, the terminal device will continue the Bluetooth connection process with the first Bluetooth device, and this process will not be interrupted by other Bluetooth connection operations.

[0082] For example, the terminal device does not establish a connection with any other Bluetooth device besides the first Bluetooth device, which can be any one or more of the following possible implementations:

[0083] In the first possible implementation, if the first timer has not expired and the connection between the terminal device and the first Bluetooth device has not been completed, the terminal device will not immediately establish a connection with the other Bluetooth device when it passively receives a connection request from the other Bluetooth device, such as when the terminal device receives a connection request from the second Bluetooth device.

[0084] In the second possible implementation, if the first timer has not expired and the connection between the terminal device and the first Bluetooth device has not been completed, and the terminal device actively sends a connection request to other Bluetooth devices, such as the terminal device generating a second connection request to initiate a connection request to the third Bluetooth device, the terminal device will not immediately start establishing a Bluetooth connection with the third Bluetooth device.

[0085] pass Figure 3 In the illustrated embodiment, by activating a first timer, the terminal device can effectively limit the connection duration during the connection establishment process with the first Bluetooth device, preventing excessive time consumption. Furthermore, if the first timer has not expired and the connection between the terminal device and the first Bluetooth device is not yet complete, the terminal device will avoid connecting to other Bluetooth devices, thereby ensuring that the current connection with the first Bluetooth device is completed first. This avoids latency and resource conflicts caused by multiple devices connecting simultaneously, improving the reliability and stability of Bluetooth device connections. This method reduces Bluetooth device connection latency in interaction scenarios where the terminal device connects to multiple Bluetooth devices.

[0086] for Figure 3 The method embodiments shown below, along with their specific implementations and beneficial effects, can be found in the following text. Figures 4-6 The description, that is, Figures 4-6 The example shown is Figure 3 The specific implementation of the illustrated embodiment is omitted to avoid redundancy. Figure 3 The specific details are elaborated in the examples. Among them, Figure 4 The method embodiment shown can correspond to the first possible implementation of step S303 above, in which the terminal device does not establish a connection with other Bluetooth devices besides the first Bluetooth device. Figure 6 The method embodiment shown can correspond to the second possible implementation of step S303 above, in which the terminal device does not establish a connection with other Bluetooth devices besides the first Bluetooth device.

[0087] Please see Figure 4 , Figure 4 This is a flowchart illustrating another Bluetooth device connection method provided in an embodiment of this application. Figure 4 As shown:

[0088] Step S401: The terminal device and the first Bluetooth device begin to establish a Bluetooth connection.

[0089] Step S402: During the process of establishing a Bluetooth connection between the terminal device and the first Bluetooth device, the first timer is started.

[0090] The descriptions of steps S401 and S402 can be found in steps S301 and S302 above.

[0091] Step S403: The second Bluetooth device sends a first connection request to the terminal device.

[0092] The first connection request is used to request the establishment of a Bluetooth connection with the terminal device and is sent by the second Bluetooth device. The first connection request can be an ACL link request, a synchronous connection-oriented (SCO) link request, an extended synchronous connection-oriented (eSCO) link request, etc. This application embodiment does not specifically limit the type of the first connection request, and will not elaborate further thereafter.

[0093] The method by which the second Bluetooth device sends the first connection request to the terminal device may include point-to-point connection, broadcast transmission, Bluetooth multipoint connection, Bluetooth mesh network communication, and pairing-free communication. This application embodiment does not specifically limit the transmission method; it is understood that in practical applications, other suitable transmission methods for the first connection request can also be selected, and will not be elaborated further thereafter.

[0094] Step S404: When the terminal device receives the first connection request, if the first timer has not expired and the connection between the terminal device and the first Bluetooth device has not been completed, the terminal device starts the second timer and puts the first connection request into the connection queue for sorting and waiting.

[0095] The second timer can be a software timer or a hardware timer in the terminal device, used to detect whether the waiting process of the first connection request has timed out. When the duration of the waiting process exceeds the duration of the second timer, the second timer determines that the waiting process has timed out. The duration of the second timer can be the default value of the page timeout, such as 10.24 seconds.

[0096] Understandably, the waiting time for the first connection request is the time from when the terminal device receives the first connection request sent by the second Bluetooth device to when it processes the first connection request. Understandably, when the terminal device processes the first connection request, it means that the terminal device establishes a connection with the second Bluetooth device that sent the first connection request. The second timer is started when the terminal device receives the first connection request. This application embodiment does not specifically limit the type of the second timer, and will not elaborate further thereafter.

[0097] A connection queue can be a data structure used to store connection requests initiated by various Bluetooth devices to a terminal device, and also to store connection requests initiated by the terminal device to various Bluetooth devices. The connection queue helps arrange each connection request according to a certain priority or order, and helps the terminal device process them according to the order of the connection requests in the queue, while also preventing the terminal device from losing any connection requests. The order of arrangement can be understood as follows: for example, if multiple Bluetooth devices initiate connection requests to the terminal device, the terminal device will place the first received connection request at the first position in the connection queue, the second received connection request at the second position, and so on. It is understandable that connection requests initiated by the terminal device to various Bluetooth devices also follow this order of arrangement, which will not be elaborated further.

[0098] Optionally, the terminal device receives the first connection request through the controller. The controller transmits the events related to the first connection request (including event, event code, event parameters, etc.) to the processor via HCI. After receiving the event, the processor processes it through other commands (e.g., issuing a command to accept or reject the connection). The event related to the first connection request can be an HCI connection request (HCI_connection_request) event, used to indicate that a Bluetooth device requests to establish a Bluetooth connection with the terminal device.

[0099] For example, in the case where the event associated with the first connection request is HCI_connection_request, Table 1 below shows the content related to HCI_connection_request.

[0100] Table 1 contains information related to HCI_connection_request

[0101]

[0102] As shown in Table 1, the event is HCI_connection_request. In this embodiment, it indicates that the second Bluetooth device requests to establish a connection with the terminal device. Specifically, when the controller in the terminal device receives the first connection request sent by the second Bluetooth device, it sends the HCI_connection_request event to the processor in the terminal device. The processor receives the event through HCI and decides whether to accept the connection. The event code is used to identify different events. It is a hexadecimal number that helps the processor identify what type of event has occurred. In this embodiment, the event code is 0x04, which means that the event is an HCI_connection_request event, i.e., a connection request event. Event parameters may include the Bluetooth device address (BD_ADDR), device class (class_of_device), link type (link_type), etc. In this embodiment, the Bluetooth device address refers to the Bluetooth address of the second Bluetooth device, the device class refers to the type of the second Bluetooth device (e.g., an audio device or a data device), and the link type refers to the link type of the first connection request (e.g., an ACL link or an SCO link).

[0103] Optionally, in step S405: if the second timer times out, the terminal device removes the first connection request from the connection queue.

[0104] Optionally, if the terminal device starts the first timer at time t1 and starts the second timer at time t2, where time t2 is the same as time t1 or after time t1, and the duration of the first timer is T1 and the duration of the second timer is T2, then:

[0105] In one possible implementation, as shown in Figure 5(1), T2 satisfies: T2>T1-(t2-t1). For example, if t1 is time 0 and t2 is time 5, and the duration represented by T1 is 10, then T2 satisfies: T2>5. Understandably, in this case, the connection between the terminal device and the first Bluetooth device's call / media channel has been established, and the terminal device begins to process the first connection request and begins to establish an ACL link connection with the second Bluetooth device.

[0106] In one possible implementation, as shown in Figure 5(2), T2 satisfies: T1-(t2-t1)>T2>0. For example, if t1 is time 0 and t2 is time 5, and the duration represented by T1 is 10, then T2 satisfies: 5>T2>0. Understandably, in this case, the first timer has not expired and the connection between the terminal device and the first Bluetooth device has not been completed, the second timer expires, and the terminal device removes the first connection request from the connection queue.

[0107] Steps S403, S404, and S405 are possible scenarios for step S303. If the first timer has not expired and the connection between the terminal device and the first Bluetooth device is not yet complete, the terminal device will not establish a connection with any other Bluetooth device besides the first Bluetooth device. During this process, the terminal device can execute steps S404 and S405, that is, the terminal device receives the first connection request, starts the second timer, and places the first connection request in the connection queue for waiting. If the second timer expires, the first connection request is removed from the connection queue.

[0108] pass Figure 4 In the illustrated embodiment, by activating a second timer, the terminal device can effectively prevent requests in the connection queue from waiting indefinitely. When the second timer expires, the method automatically removes connection requests from other Bluetooth devices that could not be processed in time from the connection queue, enabling the terminal device to process new connection requests promptly. This optimizes resource allocation, improves user experience, and ensures a faster and more flexible Bluetooth device connection process. The combination of the second timer and the connection queue optimizes Bluetooth connection management in scenarios involving multiple Bluetooth devices. This method ensures that each connection request is processed by the terminal device in an orderly manner, without causing connection order chaos or resource contention.

[0109] For further details, please refer to Figure 6 , Figure 6 This is a flowchart illustrating another Bluetooth device connection method provided in an embodiment of this application. Figure 6 As shown:

[0110] Step S601: The terminal device establishes a connection with the first Bluetooth device.

[0111] Step S602: The terminal device starts the first timer.

[0112] The descriptions of steps S601 and S602 can be found in steps S301 and S302 above.

[0113] Step S603: If the first timer has not expired and the connection with the first Bluetooth device has not been completed, generate a second connection request.

[0114] The second connection request is used to request the establishment of a Bluetooth connection with the third Bluetooth device. It is generated by the terminal device and can be sent to the third Bluetooth device. The second connection request can be an ACL link request, SCO link request, eSCO link request, etc. This application embodiment does not specifically limit the type of the second connection request, and will not elaborate further thereafter.

[0115] After generating a second connection request, the terminal device can send the second connection request to the third Bluetooth device. For example, the terminal device can send the request immediately after generating the second connection request; it can also send the request after a delay, that is, after a period of time after generating the second connection request, before the connection of the call / media channel with the first Bluetooth device is established; or it can not send the request after generating the second connection request.

[0116] The methods by which a terminal device sends a second connection request to a third Bluetooth device may include point-to-point connection, broadcast transmission, Bluetooth multipoint connection, Bluetooth mesh network communication, and pairing-free communication. This application does not specifically limit the transmission method; it is understood that in practical applications, other suitable transmission methods for the second connection request can also be selected, and will not be elaborated further hereafter.

[0117] Optionally, the processor in the terminal device transmits the command related to the second connection request (including the command, opcode command field, command parameters, and return parameters) to the controller in the terminal device via HCI. After receiving the command, the controller then sends the second connection request to the third Bluetooth device. The command related to the second connection request can be an HCI_create_connection command, used to indicate that the terminal device requests to establish a connection with the target Bluetooth device.

[0118] For example, in the case where the command associated with the second connection request is HCI_create_connection, Table 2 below shows the contents related to HCI_create_connection.

[0119] Table 2 contains information related to HCI_create_connection.

[0120]

[0121] As shown in Table 2, the command is HCI_create_connection. In this embodiment, it indicates that the terminal device requests to establish a connection with the third Bluetooth device. Specifically, the processor in the terminal device sends the HCI_create_connection command to the controller in the terminal device via HCI. After receiving the command, the controller sends a second connection request to the third Bluetooth device. The opcode command field (OCF) is used to distinguish different commands. It is usually a hexadecimal number. In this embodiment, the OCF is 0x0005, which means that the command is the HCI_create_connection command, i.e., a connection creation command. Command parameters may include the Bluetooth device address, packet type, page scan repetition mode, reserved, clock offset, allow role switch, etc. In this embodiment, the Bluetooth device address refers to the Bluetooth address of the third Bluetooth device. After the command is executed, the controller will return the result through HCI. This result is called return parameters and is used to notify the processor of the execution result of the command. In this embodiment of the application, there are no return parameters.

[0122] Step S604: The terminal device places the second connection request into the connection queue for sorting and waiting.

[0123] Steps S603 and S604 are another possible scenario for step S303. If the first timer has not expired and the connection between the terminal device and the first Bluetooth device is not yet complete, the terminal device will not establish a connection with any other Bluetooth device besides the first Bluetooth device. During this process, the terminal device can execute steps S603 and S604, that is, the terminal device generates a second connection request to request the establishment of a Bluetooth connection with the third Bluetooth device, and places the second connection request in a connection queue for waiting. It is understandable that... Figure 4 Unlike the embodiments shown, the methods described in steps S603 and S604 do not require the participation of a timer.

[0124] pass Figure 6 The illustrated embodiment, by placing the second connection request into the connection queue and sorting it, not only ensures that the Bluetooth connection between the terminal device and the first Bluetooth device is established first, but also helps the terminal device to process connection requests initiated by other Bluetooth devices in an orderly manner, thereby improving the user experience.

[0125] In combination with the aboveFigure 4 and Figure 6 In the method embodiments, the implementation method in which the terminal device does not establish a connection with other Bluetooth devices besides the first Bluetooth device may include the above-described method. Figure 4 The first possible implementation method and Figure 6 The corresponding second possible implementation method. These two possible implementation methods can be either serial or parallel implementations. Specifically:

[0126] Please see Figure 7 , Figure 7 This is a flowchart illustrating another Bluetooth device connection method provided in an embodiment of this application. Figure 7 As shown:

[0127] Step S701: The terminal device establishes a connection with the first Bluetooth device.

[0128] Step S702: The terminal device starts the first timer.

[0129] The descriptions of steps S701 and S702 can be found in steps S301 and S302 above.

[0130] Step S703: The second Bluetooth device sends a first connection request to the terminal device.

[0131] Step S704: When the terminal device receives the first connection request, if the first timer has not expired and the connection between the terminal device and the first Bluetooth device has not been completed, the terminal device starts the second timer and puts the first connection request into the connection queue for sorting and waiting.

[0132] Step S705: If the second timer times out, the terminal device removes the first connection request from the connection queue.

[0133] The descriptions of steps S703, S704, and S705 can be found in steps S603, S604, and S605 above. Steps S703, S704, and S705 correspond to the first possible implementation described above.

[0134] Step S706: If the first timer has not expired and the connection with the first Bluetooth device has not been completed, the terminal device sends a second connection request to the third Bluetooth device.

[0135] Step S707: The terminal device places the second connection request into the connection queue for sorting and waiting.

[0136] The descriptions of steps S706 and S707 can be found in steps S603 and S604 above. Steps S706 and S707 correspond to the second possible implementation described above.

[0137] Optional, Figure 7 The method embodiments shown may perform the steps corresponding to the first possible implementation first, followed by the steps corresponding to the second possible implementation; alternatively, the steps corresponding to the second possible implementation may be performed first, followed by the steps corresponding to the first possible implementation. Alternatively, the steps corresponding to both the first and second possible implementations may be performed simultaneously. This application embodiment does not limit the implementation order of the above implementation methods.

[0138] For further details, please refer to Figure 8 , Figure 8 This is a flowchart illustrating another Bluetooth device connection method provided in an embodiment of this application. Figure 8 As shown:

[0139] Step S801: The terminal device establishes a connection with the first Bluetooth device.

[0140] Step S802: The terminal device starts the first timer.

[0141] The descriptions of steps S801 and S802 can be found in steps S701 and S702 above.

[0142] Step S803: Determine whether the first timer has not expired and the connection between the terminal device and the first Bluetooth device has not been completed. If yes, proceed to steps S802 to S808; if no, proceed to step S809.

[0143] For example, if not in the case where the first timer has not expired and the connection between the terminal device and the first Bluetooth device has not been completed, then in the case where the first timer has expired and the connection between the terminal device and the first Bluetooth device has not been completed, or in the case where the first timer has not expired and the connection between the terminal device and the first Bluetooth device has been completed.

[0144] The connection between the terminal device and the first Bluetooth device is complete. This can be due to the completion of the ACL link connection during the connection process, the completion of the steps of discovering and confirming the SDP service, or the completion of the call / media channel connection.

[0145] Step S804: The second Bluetooth device sends a first connection request to the terminal device.

[0146] Step S805: The terminal device receives the first connection request, starts the second timer, and puts the first connection request into the connection queue for sorting and waiting.

[0147] Step S806: If the second timer times out, the terminal device removes the first connection request from the connection queue.

[0148] The descriptions of steps S804, S805 and S806 can be found in steps S703, S704 and S705 above.

[0149] Step S807: The terminal device sends a second connection request to the third Bluetooth device.

[0150] Step S808: The terminal device places the second connection request into the connection queue for sorting and waiting.

[0151] The descriptions of steps S807 and S808 can be found in steps S706 and S707 above.

[0152] Step S809: If a first connection request and / or a second connection request exist in the connection queue, the terminal device establishes a connection with the Bluetooth device corresponding to the first connection request and / or the second connection request.

[0153] For example, connection requests existing in the connection queue can satisfy any one or more of the following:

[0154] In one possible implementation, the first connection request exists in the connection queue.

[0155] In one possible implementation, a second connection request exists in the connection queue.

[0156] In one possible implementation, the connection queue contains a first connection request and a second connection request.

[0157] For example, establishing a connection between the terminal device and the Bluetooth device corresponding to the first connection request and / or the second connection request may include:

[0158] If a first connection request exists in the connection queue, the terminal device establishes a connection with the second Bluetooth device; if a second connection request exists in the connection queue, the terminal device establishes a connection with the third Bluetooth device; if both a first and a second connection request exist in the connection queue, the terminal device establishes a connection with both the second and third Bluetooth devices.

[0159] It is understood that, for the aforementioned second Bluetooth device and third Bluetooth device, the second Bluetooth device may include any Bluetooth device that sends a connection request to the terminal device, and the third Bluetooth device may include any Bluetooth device that receives a connection request sent from the terminal device. The embodiments of this application do not limit the number of second Bluetooth devices and third Bluetooth devices.

[0160] Based on step S809, the terminal device can switch to other connection requests in the connection queue in a timely manner (which may include the first connection request and / or the second connection request). Therefore, the terminal device can establish a Bluetooth connection with the Bluetooth device corresponding to these connection requests in a timely manner, thereby avoiding unnecessary connection delays.

[0161] Figure 8 The illustrated method embodiments provide a flexible and efficient Bluetooth connection management mechanism. Regardless of whether the connection between the terminal device and the first Bluetooth device is complete, the terminal device can reasonably handle connection requests from other Bluetooth devices based on the timer status and the status of the connection queue. In interactive scenarios where the terminal device connects to multiple Bluetooth devices, these methods not only reduce the connection latency of Bluetooth devices and improve the efficiency of managing multiple Bluetooth devices, but also provide users with a smoother Bluetooth connection experience, preventing other Bluetooth devices from being unable to connect in a timely manner due to the failure or delay of one connection.

[0162] This application embodiment also provides a Bluetooth device connection system, the system including a terminal device and a first Bluetooth device; the terminal device is used to start a first timer during the process of establishing a Bluetooth connection with the first Bluetooth device; the terminal device is also used to prevent the establishment of a Bluetooth connection with other Bluetooth devices besides the first Bluetooth device if the first timer has not expired and the connection with the first Bluetooth device has not been completed; the first Bluetooth device is used to establish a Bluetooth connection with the terminal device.

[0163] In one possible implementation, the system further includes a second Bluetooth device; the terminal device does not initiate a Bluetooth connection with any other Bluetooth device besides the first Bluetooth device if the first timer has not expired and the connection with the first Bluetooth device has not been completed. Specifically, it is configured to: receive a first connection request sent by the second Bluetooth device to request the establishment of a Bluetooth connection if the first timer has not expired and the connection with the first Bluetooth device has not been completed, start a second timer, and place the first connection request in a connection queue for sorting and waiting, wherein the other Bluetooth devices include the second Bluetooth device.

[0164] In one possible implementation, the terminal device is further configured to: remove the first connection request from the connection queue if the second timer times out.

[0165] In one possible implementation, the terminal device starts a first timer, specifically for: starting the first timer at time t1; the terminal device starts a second timer, specifically for: starting the second timer at time t2, where time t2 is the same as or after time t1, the duration of the first timer is T1, and the duration of the second timer is T2; wherein, T2>T1-(t2-t1); or, T1-(t2-t1)>T2>0.

[0166] In one possible implementation, the system further includes a third Bluetooth device; the terminal device does not establish a connection with any other Bluetooth device besides the first Bluetooth device if the first timer has not expired and the connection with the first Bluetooth device has not been completed. Specifically, it generates a second connection request to request to establish a Bluetooth connection with the third Bluetooth device if the first timer has not expired and the connection with the first Bluetooth device has not been completed, and puts the second connection request into a connection queue for sorting and waiting. The other Bluetooth devices include the third Bluetooth device.

[0167] In one possible implementation, the terminal device is further configured to: if a connection request exists in the connection queue when the first timer expires and the connection with the first Bluetooth device is not completed, or when the first timer does not expire and the connection with the first Bluetooth device is completed, then the Bluetooth device corresponding to the connection request begins to establish a connection, wherein the connection request includes a first connection request and / or a second connection request.

[0168] This application provides a flexible and efficient Bluetooth device connection system. Regardless of whether the connection between the terminal device and the first Bluetooth device is complete, the terminal device can rationally handle connection requests from other Bluetooth devices based on the timer state and the status of the connection queue. In interactive scenarios where the terminal device connects to multiple Bluetooth devices, this connection system not only reduces the connection latency of Bluetooth devices and improves the efficiency of managing multiple Bluetooth devices, but also provides users with a smoother Bluetooth connection experience, preventing other Bluetooth devices from being unable to connect in a timely manner due to the failure or delay of one connection.

[0169] The apparatus involved in the embodiments of this application is described below.

[0170] It is understood that, in order to achieve the functions in the above embodiments, the terminal device includes hardware structures and / or software modules corresponding to each function. Those skilled in the art should readily recognize that, based on the units and method steps described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.

[0171] Figure 9 This is a schematic diagram of the hardware structure of a terminal device 900 provided in an embodiment of this application.

[0172] It is understood that the terminal device 900 can be the terminal device, the first Bluetooth device, the second Bluetooth device, and the third Bluetooth device in the above embodiments.

[0173] Terminal device 900 may include processor 910, external memory interface 920, internal memory 921, Universal Serial Bus (USB) interface 930, charging management module 940, power management module 941, battery 942, antenna 1, antenna 2, mobile communication module 950, wireless communication module 960, audio module 970, speaker 970A, receiver 970B, microphone 970C, headphone jack 970D, sensor module 980, button 990, motor 991, indicator 992, camera 993, display screen 994, and Subscriber Identification Module (SIM) card interface 995, etc. The sensor module 980 may include a pressure sensor 980A, a gyroscope sensor 980B, a barometric pressure sensor 980C, a magnetic sensor 980D, an accelerometer sensor 980E, a distance sensor 980F, a proximity sensor 980G, a fingerprint sensor 980H, a temperature sensor 980J, a touch sensor 980K, an ambient light sensor 980L, a bone conduction sensor 980M, etc.

[0174] It is understood that the structure illustrated in the embodiments of this application does not constitute a specific limitation on the terminal device 900. In other embodiments of this application, the terminal device 900 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0175] The processor 910 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.

[0176] The controller can serve as the central nervous system and command center of the terminal device 900. Based on the instruction opcode and timing signals, the controller generates operation control signals to control the fetching and execution of instructions.

[0177] In the embodiments provided in this application, the terminal device 900 can execute through the processor 910. Figure 3 , Figure 4 , Figure 6 , Figure 7 and Figure 8 The method shown.

[0178] The processor 910 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 910 is a cache memory. This memory can store instructions or data that the processor 910 has just used or that are used repeatedly. If the processor 910 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 910, and thus improves the efficiency of the system.

[0179] In some embodiments, the processor 910 may include one or more interfaces. The USB interface 930 is a USB standard-compliant interface, specifically a Mini USB interface, a Micro USB interface, a USB Type-C interface, etc. The USB interface 930 can be used to connect a charger to charge the terminal device 900, and can also be used for data transfer between the terminal device 900 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other terminal devices 900, such as AR devices.

[0180] The wireless communication function of the terminal device 900 can be implemented through antenna 1, antenna 2, mobile communication module 950, wireless communication module 960, modem processor and baseband processor, etc.

[0181] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal device 900 can be used to cover one or more communication frequency bands. Different antennas can also be reused to improve antenna utilization.

[0182] The mobile communication module 950 can provide solutions for wireless communication applications including 2G / 3G / 4G / 5G on the terminal device 900. The mobile communication module 950 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 950 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 950 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1.

[0183] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through audio devices (not limited to speaker 970A, receiver 970B, etc.) or displays images or videos through the display screen 994.

[0184] The wireless communication module 960 can provide solutions for wireless communication applications on the terminal device 900, including Wireless Local Area Networks (WLAN) (such as Wireless Fidelity (Wi-Fi) networks), Bluetooth (BT), Global Navigation Satellite System (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), and Infrared (IR) technologies. The wireless communication module 960 can be one or more devices integrating at least one communication processing module. The wireless communication module 960 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 910. The wireless communication module 960 can also receive signals to be transmitted from processor 910, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0185] Terminal device 900 can implement audio functions such as music playback and recording through audio module 970, speaker 970A, receiver 970B, microphone 970C, headphone jack 970D, and application processor.

[0186] The audio module 970 is used to convert digital audio information into analog audio signal output, and also to convert analog audio input into digital audio signal.

[0187] The 970A loudspeaker, also known as a "loudspeaker", is used to convert audio electrical signals into sound signals.

[0188] The receiver 970B, also known as the "earpiece", is used to convert audio electrical signals into sound signals.

[0189] Microphone 970C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. Terminal device 900 may be equipped with at least one microphone 970C.

[0190] The 970D headphone jack is used to connect wired headphones.

[0191] Figure 10 This is a schematic diagram of the software structure of a terminal device 900 provided in an embodiment of this application.

[0192] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the system is divided into four layers, from top to bottom: the application layer, the application framework layer, the runtime and system libraries, and the kernel layer.

[0193] The application layer can include a series of application packages.

[0194] like Figure 10 As shown, the application package can include applications (also known as apps) such as camera, gallery, calendar, call, WLAN, music, and video.

[0195] The application framework layer provides an Application Programming Interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0196] like Figure 10 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.

[0197] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.

[0198] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.

[0199] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.

[0200] The phone manager is used to provide communication functions for terminal devices 900. For example, it manages call status (including connection and disconnection).

[0201] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.

[0202] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of download completion or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog-style notifications on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating the device, and flashing indicator lights.

[0203] The runtime consists of the core libraries and the virtual machine. The runtime is responsible for system scheduling and management.

[0204] The core library consists of two parts: one part is the functionalities that the programming language (e.g., Java) needs to call, and the other part is the system's core library.

[0205] The application layer and application framework layer run in a virtual machine. The virtual machine executes the programming files (e.g., Java files) of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0206] System libraries can include multiple functional modules. For example: Surface Manager, Media Libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.

[0207] The Surface Manager is used to manage the display subsystem and provides the fusion of two-dimensional (2D) and three-dimensional (3D) layers for multiple applications.

[0208] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.

[0209] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0210] A 2D graphics engine is a graphics engine for 2D drawing.

[0211] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.

[0212] It should be understood that the memory mentioned in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory can be a hard disk drive (HDD), a solid-state drive (SSD), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DRRAM). Memory is any other medium capable of carrying or storing desired program code having the form of instructions or data structures and accessible by a computer, but is not limited thereto. The memory in the embodiments of this application may also be circuitry or any other means capable of implementing storage functions for storing program instructions and / or data.

[0213] It should also be understood that the processor mentioned in the embodiments of this application can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0214] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA, or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, the memory (storage module) is integrated into the processor.

[0215] It should be noted that the memories described herein are intended to include, but are not limited to, these and any other suitable types of memories.

[0216] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0217] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments provided herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0218] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0219] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0220] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0221] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0222] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the technology, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0223] The steps in the method of this application embodiment can be adjusted, combined, or deleted according to actual needs.

[0224] The modules / units in the device of this application embodiment can be merged, divided, and deleted according to actual needs.

[0225] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A method for connecting a Bluetooth device, applied to a terminal device, characterized in that, The method includes: During the process of establishing a Bluetooth connection with the first Bluetooth device, the first timer is started; If the first timer has not expired and the connection with the first Bluetooth device has not been completed, a Bluetooth connection will not be established with any other Bluetooth device besides the first Bluetooth device.

2. The method according to claim 1, characterized in that, The step of not initiating a Bluetooth connection with any Bluetooth device other than the first Bluetooth device when the first timer has not expired and the connection with the first Bluetooth device has not been completed includes: If the first timer has not expired and the connection with the first Bluetooth device has not been completed, a first connection request for establishing a Bluetooth connection is received from the second Bluetooth device. The second timer is started, and the first connection request is placed in the connection queue for sorting and waiting. The other Bluetooth devices include the second Bluetooth device.

3. The method according to claim 2, characterized in that, The method further includes: If the second timer times out, the first connection request is removed from the connection queue.

4. The method according to claim 2 or 3, characterized in that, Starting the first timer includes starting the first timer at time t1, and starting the second timer includes starting the second timer at time t2. The time t2 is the same as or after the time t1. The duration of the first timer is T1, and the duration of the second timer is T2. Where T2>T1-(t2-t1); or, T1-(t2-t1)>T2>0.

5. The method according to any one of claims 1-4, characterized in that, The step of not establishing a connection with any Bluetooth device other than the first Bluetooth device when the first timer has not expired and the connection with the first Bluetooth device has not been completed includes: If the first timer has not expired and the connection with the first Bluetooth device has not been completed, a second connection request is generated to request the establishment of a Bluetooth connection with the third Bluetooth device. The second connection request is placed in a connection queue for sorting and waiting. The other Bluetooth devices include the third Bluetooth device.

6. The method according to any one of claims 1-5, characterized in that, The method further includes: If the first timer expires and the connection with the first Bluetooth device is not completed, or if the first timer does not expire and the connection with the first Bluetooth device is completed, and if there is a connection request in the connection queue, the Bluetooth device corresponding to the connection request will begin to establish a connection. The connection request includes a first connection request and / or a second connection request.

7. A connection system for a Bluetooth device, characterized in that, The system includes a terminal device and a first Bluetooth device; The terminal device is used to start a first timer during the process of establishing a Bluetooth connection with the first Bluetooth device; The terminal device is also configured to not initiate a Bluetooth connection with any other Bluetooth device besides the first Bluetooth device if the first timer has not expired and the connection with the first Bluetooth device has not been completed. The first Bluetooth device is used to establish a Bluetooth connection with the terminal device.

8. The system according to claim 6, characterized in that, The system also includes a second Bluetooth device; The terminal device, if the first timer has not expired and the connection with the first Bluetooth device has not been completed, will not initiate a Bluetooth connection with any other Bluetooth device besides the first Bluetooth device, specifically for: If the first timer has not expired and the connection with the first Bluetooth device has not been completed, a first connection request for establishing a Bluetooth connection is received from the second Bluetooth device. The second timer is started, and the first connection request is placed in the connection queue for sorting and waiting. The other Bluetooth devices include the second Bluetooth device.

9. The system according to claim 7, characterized in that, The terminal device is also used for: If the second timer times out, the first connection request is removed from the connection queue.

10. The system according to claim 8 or 9, characterized in that, The terminal device starts a first timer, specifically for: The first timer is started at time t1; The terminal device starts a second timer, specifically for: The second timer is started at time t2, where time t2 is the same as or after time t1. The duration of the first timer is T1, and the duration of the second timer is T2. Where T2>T1-(t2-t1); or, T1-(t2-t1)>T2>0.

11. The system according to any one of claims 7-10, characterized in that, The system also includes a third Bluetooth device; The terminal device, if the first timer has not expired and the connection with the first Bluetooth device has not been completed, will not establish a connection with any other Bluetooth device besides the first Bluetooth device, specifically for: If the first timer has not expired and the connection with the first Bluetooth device has not been completed, a second connection request is generated to request the establishment of a Bluetooth connection with the third Bluetooth device. The second connection request is placed in a connection queue for sorting and waiting. The other Bluetooth devices include the third Bluetooth device.

12. The system according to any one of claims 7-11, characterized in that, The terminal device is also used for: If the first timer expires and the connection with the first Bluetooth device is not completed, or if the first timer does not expire and the connection with the first Bluetooth device is completed, and if there is a connection request in the connection queue, the Bluetooth device corresponding to the connection request will begin to establish a connection. The connection request includes a first connection request and / or a second connection request.

13. A terminal device, characterized in that, The terminal device includes: a memory and one or more processors; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code including computer instructions; the one or more processors are used to invoke the computer instructions to cause the terminal device to perform the method of any one of claims 1-6.

14. A chip system applied to a terminal device, characterized in that, The chip system includes at least one processor and an interface, the interface being used to receive instructions and transmit them to the at least one processor; the at least one processor executes the instructions to cause the terminal device to perform the method as described in any one of claims 1-6.