Equipment connection switching method and device, electronic equipment and computer readable storage medium

By prohibiting the connection mode according to the service execution status when the Bluetooth device establishes a connection with the terminal device, the problem of unreasonable preemption in the prior art is solved, and the stability of business interaction and data security are achieved.

CN119545453APending Publication Date: 2025-02-28GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411576559.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2021-11-30
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

In the prior art, Bluetooth devices may interrupt the service interaction of terminal device A when preempting the connection, resulting in unreasonable preemption.

Method used

When the Bluetooth device establishes a connection with the first terminal device, if the Bluetooth device is performing the service of the first terminal device, the connection mode is prohibited, and the Bluetooth device does not respond to the connection request of the second terminal device.

Benefits of technology

By prohibiting the connection mode, Bluetooth devices are avoided from being occupied by other terminal devices when performing services, thus ensuring the continuity of business interaction, optimizing user experience and improving data security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119545453A_ABST
    Figure CN119545453A_ABST
Patent Text Reader

Abstract

The invention relates to an equipment connection switching method and device, electronic equipment and a computer readable storage medium. The method comprises the following steps: under the condition that a Bluetooth device establishes a Bluetooth connection with a first terminal device and determines that the Bluetooth device is executing a service of the first terminal device, the Bluetooth device prohibits a connection grabbing mode, and the Bluetooth device does not respond to a connection request sent by a second terminal device. In the method, when the Bluetooth device determines that the Bluetooth device is executing a service, the Bluetooth device prohibits a robbing connection mode, and when the Bluetooth device prohibits the robbing connection mode, the Bluetooth device cannot accept connection requests sent by other terminal devices and cannot respond to the connection requests of the other terminal devices naturally. The service interaction between the Bluetooth device and the first terminal device is ensured not to be interrupted, and the user experience is optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a device connection switching method, apparatus, electronic device and computer-readable storage medium. Background Art

[0002] As people's lives become more diverse, users have more and more electronic devices, and the technology of Bluetooth devices is also advancing rapidly. In real life, the same Bluetooth device may switch to connect to different terminal devices. In order to provide users with a more convenient switching experience, Bluetooth devices often need to support the preemptive connection mode.

[0003] In the prior art, there is a method for preemptively connecting a Bluetooth device without any restrictions, that is, when the Bluetooth device is connected to terminal device A, after receiving a connection request from terminal device B, the connection with terminal device A is interrupted to achieve connection with terminal device B.

[0004] However, the above-mentioned method for preempting the connection of Bluetooth devices without any restrictions may interrupt the service interaction of the terminal device A, and there is a problem of unreasonable preemption. Summary of the invention

[0005] The embodiments of the present application provide a device connection switching method, apparatus, electronic device and computer-readable storage medium, which can solve the problem of unreasonable terminal preemption in the prior art, and at the same time can improve the data security of Bluetooth devices and terminal devices.

[0006] In a first aspect, a device connection switching method is provided, which is applied to a Bluetooth device, and the method includes:

[0007] When establishing a Bluetooth connection with the first terminal device, if the Bluetooth device is executing the service of the first terminal device, the Bluetooth device prohibits the connection grabbing mode and the Bluetooth device does not respond to the connection request sent by the second terminal device; the connection grabbing mode means that the second terminal device is allowed to grab the Bluetooth connection between the Bluetooth device and the first terminal device.

[0008] In a second aspect, a device connection switching device is provided, the device comprising:

[0009] An execution module is used to, when establishing a Bluetooth connection with a first terminal device, prohibit the Bluetooth device from entering a connection grabbing mode if the Bluetooth device is executing a service of the first terminal device, and the Bluetooth device does not respond to a connection request sent by a second terminal device; the connection grabbing mode indicates that the second terminal device is allowed to seize the Bluetooth connection between the Bluetooth device and the first terminal device.

[0010] In a third aspect, an electronic device is provided, comprising a communication module, a memory and a processor, wherein the memory stores a computer program; when the computer program is executed by the processor, the processor executes the device connection switching method as described in the first aspect.

[0011] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the device connection switching method described in the first aspect is implemented.

[0012] In the above-mentioned device connection switching method, apparatus, electronic device and computer-readable storage medium, when the Bluetooth device establishes a Bluetooth connection with the first terminal device, if it is determined that the Bluetooth device is executing the service of the first terminal device, the Bluetooth device prohibits the connection grabbing mode, and the Bluetooth device does not respond to the connection request sent by the second terminal device, wherein the connection grabbing mode indicates that the second terminal device is allowed to seize the Bluetooth connection between the Bluetooth device and the first terminal device. In this method, the Bluetooth device can prohibit the connection grabbing mode of the Bluetooth device based on whether the Bluetooth device is executing a service when the Bluetooth device establishes a Bluetooth connection with the first terminal device. For example, when it is determined that the Bluetooth device is executing a service, the Bluetooth device prohibits the connection grabbing mode. When the Bluetooth device prohibits the connection grabbing mode, the Bluetooth device cannot accept the connection request sent by other terminal devices, and naturally will not respond to the connection request of other terminal devices. That is, the Bluetooth device will not be interfered by other terminal devices during the service interaction with the first terminal device, ensuring that the service interaction between the Bluetooth device and the first terminal device is not interrupted, thereby optimizing the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0014] FIG1 is an application environment diagram of a device connection switching method in one embodiment;

[0015] Figure 2 A flowchart of a device connection switching method in one embodiment;

[0016] Figure 3 is a flow chart of a device connection switching method in another embodiment;

[0017] Figure 4 is a flow chart of a device connection switching method in another embodiment;

[0018] Figure 5 is a flow chart of a device connection switching method in another embodiment;

[0019] Figure 6 is a flow chart of a device connection switching method in another embodiment;

[0020] Figure 7 is a flow chart of a device connection switching method in another embodiment;

[0021] Figure 8 is a flow chart of a device connection switching method in another embodiment;

[0022] Fig. 9 It is a structural block diagram of a device connection switching device in one embodiment;

[0023] Fig.10 It is a structural block diagram of a device connection switching apparatus in another embodiment;

[0024] Fig.11 FIG. 1 is a schematic diagram of the structure of an electronic device in an embodiment. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0026] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first terminal device may be referred to as a second terminal device, and similarly, a second terminal device may be referred to as a first terminal device. Both the first terminal device and the second terminal device are terminal devices, but they are not the same terminal device.

[0027] During the connection process between a Bluetooth device and a first terminal device, there may be a situation where the second terminal device initiates a connection request to the Bluetooth device. Generally, the Bluetooth device in the prior art needs to have a one-to-many connection function, or needs to have a function that allows switching connections with other terminal devices in a one-to-one connection scenario. In the case where the Bluetooth device has a function that allows switching connections with other terminal devices in a one-to-one connection scenario, the Bluetooth device in the prior art either directly responds to the connection request of the second terminal device, thereby interrupting the connection with the first terminal device, affecting the service execution of the first terminal device, and also threatening the data security of the Bluetooth device; or does not respond to the connection request of the second terminal device, and cannot achieve the effect of switching connections with other terminal devices.

[0028] At present, Bluetooth technology supports one-to-one connection between Bluetooth devices and terminal devices. Therefore, when the Bluetooth device has established a Bluetooth connection with the first terminal device, the Bluetooth device needs to support the connection grabbing function so that the Bluetooth device can receive the connection request sent by other terminal devices, and then perform corresponding operations according to the connection request. For example, in the prior art, Bluetooth devices that support the connection grabbing function are roughly divided into two categories. One type of Bluetooth device supports connection grabbing without any restrictions, that is, when the first terminal device establishes a connection with the Bluetooth device, if there is a connection request initiated by the second terminal device to the Bluetooth device, the Bluetooth device will directly respond to the connection request, disconnect the connection with the first terminal device, and establish a connection with the second terminal device, so as to realize the connection grabbing of the second terminal device by the Bluetooth device. Another type of Bluetooth device supports connection grabbing with certain restrictions. For example, after receiving the connection request initiated by the second terminal device, the Bluetooth device sends the identification of the second terminal device (for example, the local area network address (Media Access Control Address, MAC address), cloud account) to the server, and the server determines whether the second terminal device can perform the connection grabbing operation according to the identification of the second terminal device, so that the Bluetooth device performs the corresponding connection switching operation according to the determination result returned by the server.

[0029] Although the above-mentioned method of unrestricted support for connection grabbing or the method of legal identification via the server can achieve the purpose of switching between different terminal devices and using Bluetooth devices, they both have certain technical defects. For example, whether it is the first type of Bluetooth device that supports connection grabbing without restriction or the legal device that is connected after legal identification via the server, it is possible that when the Bluetooth device is executing a service, it is grabbed by other Bluetooth devices, resulting in interruption of the service of the current Bluetooth device, which brings a bad user experience to the user of the first terminal device.

[0030] Based on this, this embodiment provides a device connection switching method to solve the problems existing in the above-mentioned prior art.

[0031] FIG1 is a schematic diagram of the application environment of the device connection switching method in an embodiment. As shown in FIG1 , the application environment includes a Bluetooth device 1 and at least two terminal devices 2. Among them, the Bluetooth device can be a Bluetooth headset, a True Wireless Stereo (TWS) headset, a Bluetooth watch, a mobile phone, a tablet computer, a computer, a wearable device, a car-mounted Bluetooth device, etc.; the terminal device can be a Bluetooth watch, a wearable device, a mobile phone, a tablet computer, a computer, a server, etc. Specifically, after the Bluetooth headset establishes a Bluetooth connection with the headset, it can receive a connection establishment request sent by the Bluetooth watch by turning on the connection grabbing function of the Bluetooth headset, thereby realizing the switching connection of the Bluetooth device to the mobile phone and the Bluetooth watch according to any one of the device connection switching methods provided in the following embodiments.

[0032] Figure 2 FIG. 1 is a flow chart of a device connection switching method in an embodiment. The device connection switching method in this embodiment is described by taking the method running on the Bluetooth device in FIG. 1 as an example. Figure 2 As shown in the interactive diagram, the device connection switching method includes the following schemes.

[0033] When establishing a Bluetooth connection with the first terminal device, if the Bluetooth device is executing the service of the first terminal device, the Bluetooth device prohibits the connection grabbing mode, and the Bluetooth device does not respond to the connection request sent by the second terminal device.

[0034] The establishment of a Bluetooth connection between the Bluetooth device and the first terminal device refers to a state in which the Bluetooth device and the first terminal device have completed the process of Bluetooth asynchronous transmission logical link (Asynchronous Connection-oriented, ACL) connection, Bluetooth pairing, and Bluetooth connection. When the Bluetooth connection is established, the first terminal device can perform service interaction with the Bluetooth device.

[0035] The Bluetooth device executing the service of the first terminal device means that the Bluetooth device and the first terminal device are performing service interaction. Taking the Bluetooth device as a Bluetooth headset and the first terminal device as a mobile phone as an example, the Bluetooth device executing the service of the first terminal device can be that the Bluetooth headset is playing music of the mobile phone, or the mobile phone is making a voice call through the Bluetooth headset, etc.

[0036] In this embodiment, when determining that a Bluetooth connection is established with a first terminal device, the Bluetooth device determines whether a service of the first terminal device is currently being executed. For example, the Bluetooth device may obtain a currently running application and determine whether the service of the first terminal device exists from the running application; alternatively, the Bluetooth device may also monitor whether there is data interaction with the first terminal device. If there is data interaction, it is determined that the service of the first terminal device is currently being executed.

[0037] When the Bluetooth device determines that the service of the first terminal device is being executed, in order not to cause service termination problems to the service of the first terminal device, the Bluetooth device prohibits the connection grabbing mode.

[0038] The connection grabbing mode indicates that the second terminal device is allowed to grab the Bluetooth connection between the Bluetooth device and the first terminal device.

[0039] In this embodiment, the Bluetooth device prohibiting the connection grabbing mode means that the Bluetooth device will not receive a connection request sent by other second terminal devices, or the Bluetooth device does not respond to a connection request sent by the second terminal device.

[0040] Exemplarily, the Bluetooth device's prohibited connection-preemption mode may be that after the Bluetooth device establishes a Bluetooth connection with the first terminal device, the Bluetooth device is in an invisible Bluetooth search state, that is, other terminal devices cannot obtain the Bluetooth signal of the Bluetooth device when performing a Bluetooth search. Obviously, other terminal devices cannot initiate a Bluetooth connection request to the Bluetooth device, and accordingly, the Bluetooth device cannot receive Bluetooth connection requests sent by other terminal devices; or, the Bluetooth device can receive connection requests from other terminal devices, but does not respond to connection requests sent by other terminal devices. The non-response here can be sending a rejection response to the other terminal device or directly ignoring the connection request.

[0041] In the above-mentioned device connection switching method, when the Bluetooth device establishes a Bluetooth connection with the first terminal device, if it is determined that the Bluetooth device is executing the service of the first terminal device, the Bluetooth device prohibits the connection grabbing mode, and the Bluetooth device does not respond to the connection request sent by the second terminal device, wherein the connection grabbing mode indicates that the second terminal device is allowed to seize the Bluetooth connection between the Bluetooth device and the first terminal device. In this method, the Bluetooth device can prohibit the connection grabbing mode of the Bluetooth device based on whether the Bluetooth device is executing a service when the Bluetooth device establishes a Bluetooth connection with the first terminal device. For example, when it is determined that the Bluetooth device is executing a service, the Bluetooth device prohibits the connection grabbing mode. When the Bluetooth device prohibits the connection grabbing mode, the Bluetooth device cannot accept the connection requests sent by other terminal devices, and naturally will not respond to the connection requests of other terminal devices. That is, the Bluetooth device will not be interfered with by other terminal devices during the service interaction with the first terminal device, thereby ensuring that the service interaction between the Bluetooth device and the first terminal device is not interrupted, thereby optimizing the user experience.

[0042] In another scenario of the above embodiment, in one optional embodiment, the method further includes:

[0043] If the Bluetooth device does not execute the service of the first terminal device, the Bluetooth device enables the connection grabbing mode.

[0044] In this embodiment, the Bluetooth device determines that there is no currently running application that matches the service of the first terminal device, or detects that there is no data interaction with the first terminal device. In this case, the Bluetooth device determines that the service of the first terminal device is not executed. At this time, since the current Bluetooth device has no service to execute, switching connections by other terminal devices will not cause service interruption and other problems for the Bluetooth device executing the service of the first terminal device. Based on this, the Bluetooth device enables the connection grabbing mode.

[0045] Among them, the Bluetooth device enabling the connection grabbing mode means that after the Bluetooth device establishes a Bluetooth connection with the first terminal device, it can still receive connection requests sent by other terminal devices. Exemplarily, the Bluetooth device still exists in a Bluetooth search visible state, that is, other terminal devices can still obtain the Bluetooth signal of the Bluetooth device when performing Bluetooth search, so that they can initiate Bluetooth connection requests to the Bluetooth device. Alternatively, the Bluetooth device is set to respond to connection requests sent by other terminal devices, so as to complete the connection switching between different terminal devices.

[0046] In this embodiment, if the Bluetooth device is not executing the service of the first terminal device, that is, the Bluetooth device is in a service idle state, in this case, the Bluetooth device is controlled to be in a connection-allowing mode, and can receive connection requests sent by other second terminal devices, thereby realizing connection switching between different terminal devices.

[0047] After the Bluetooth device establishes a Bluetooth connection with the first terminal device, if the Bluetooth device wants to receive a connection request sent by other terminal devices, the Bluetooth device needs to have a function of allowing other terminal devices to switch connections. In one optional embodiment, Figure 3 As shown, the method also includes:

[0048] Step 301: In a Bluetooth device enabled connection grabbing mode, a connection request sent by a second terminal device is received.

[0049] In this embodiment, as described in the above embodiments, when the Bluetooth device enables the connection grabbing mode, the Bluetooth device can receive a connection request sent by any other terminal device. For example, when the second terminal device is an electronic device including a Bluetooth module, the connection request sent by the second terminal device can be a Bluetooth connection request.

[0050] Step 302: In response to the connection request, disconnect the Bluetooth connection with the first terminal device, and establish a Bluetooth connection with the second terminal device.

[0051] In this embodiment, when it is determined that the Bluetooth device does not perform the service of the first terminal device, the Bluetooth device enables the connection grabbing mode, and accepts the connection request sent by the second terminal device in this mode, and the Bluetooth device can directly respond to the connection request. It should be noted that before the Bluetooth device establishes the Bluetooth connection with the second terminal device, it needs to first disconnect the Bluetooth connection with the first terminal device, that is, the Bluetooth device responds to the connection request of the second terminal device, first disconnects the Bluetooth connection with the first terminal device, and then establishes the Bluetooth connection with the second terminal device.

[0052] In this embodiment, the Bluetooth device can receive a connection request initiated by a second terminal device only when the pre-emptive connection mode is enabled. By determining whether the connection request of the second terminal device can be received based on whether the Bluetooth device enables the pre-emptive connection mode, the number of second terminal devices that initiate connection requests is reduced to a certain extent, and interference with the first terminal device caused by the connection request initiated by the second terminal device is avoided, thereby optimizing the user experience of users using Bluetooth devices.

[0053] However, in actual situations, when the Bluetooth device is executing the service of the first terminal device, there is also an actual need to switch the connection of the second terminal device. In this demand scenario, further conditional judgment can be made on the second terminal device to determine whether the Bluetooth device enables the connection grabbing function, thereby achieving the purpose of switching the connection in actual demand. In one of the optional embodiments, if Figure 4 As shown, the method also includes:

[0054] Step 401: If the Bluetooth device is executing the service of the first terminal device, it is determined whether the first terminal device has an associated device according to the first associated device information of the first terminal device.

[0055] The first associated device information includes device information of other terminal devices that the first terminal device can trust. It should be noted that the other terminal devices that can be trusted can be terminal devices that have been connected to the first terminal device, terminal devices of the same type as the first terminal device, terminal devices that belong to the same account as the first terminal device, terminal devices that are in the same local area network as the first terminal device, etc.

[0056] Optionally, the first associated device information may include device information of a terminal device that has been connected to the first terminal device. For example, when the Bluetooth device is a Bluetooth device and the first terminal device is a mobile phone, the terminal device that has been connected to the first terminal device may be a smart watch, tablet computer, smart bracelet or other terminal device with a Bluetooth module that has been connected to the mobile phone within a preset historical duration. Correspondingly, the device information of the terminal device includes device name, device type, MAC address, device serial number, factory serial number, service type, etc. The preset historical duration may be the past month, the past six months, etc. In this scenario, in view of the defect in the prior art that the terminal device cannot realize connection switching if it does not have the function of account login, the first associated information provided in this embodiment can be used to determine the terminal device that has been connected to the first terminal device as a legitimate device that can be switched to a connection, thereby achieving the purpose of switching connection of the Bluetooth device.

[0057] Optionally, the first associated device information may also include device information of terminal devices of the same type as the first terminal device. Exemplarily, the same type may be the same as the brand type of the first terminal device. For example, when the first terminal device is a brand A mobile phone, the first associated device information may include device information of other terminal devices of brand A with a Bluetooth module, such as a brand A smartwatch and a brand A tablet. It should be noted that the same brand type here can be considered to be the same as the factory serial number, device serial number, or terminal model of the first terminal device. The specified field represents the brand type. In addition, exemplarily, the same type may also be the same as the terminal type of the first terminal device. For example, when the first terminal device is a mobile phone, the first associated device information includes device information of other terminal devices whose terminal type is a mobile phone.

[0058] Optionally, the first associated device information may also include device information of terminal devices belonging to the same account as the first terminal device. Exemplarily, if the cloud account of the first terminal device is user A, the first associated device information includes device information of other terminal devices logged in by user A, for example, device information of a smart watch logged in by user A, device information of a smart bracelet logged in by user A, device information of a tablet logged in by user A, etc. This embodiment does not limit this.

[0059] In this embodiment, the first associated device information may be information sent by the first terminal device to the Bluetooth device after establishing a Bluetooth connection with the Bluetooth device; or the first associated device information may be information sent by the first terminal device to the Bluetooth device after updating its corresponding associated information. When the Bluetooth device determines that the service of the first terminal device is being executed, in order to avoid the situation where the second terminal device cannot be switched and connected in a one-size-fits-all manner, the Bluetooth device may determine whether to control the Bluetooth device to enter the allowed connection mode based on further judgment conditions. Here, the further judgment condition may be that the Bluetooth device determines whether there is an associated device for the first terminal device. For example, the Bluetooth device may obtain the first associated device information of the first terminal device, and determine whether there is an associated device for the first terminal device based on the first associated device information. For example, if the first associated device information is empty, it is determined that there is no associated device for the first terminal device; if the first associated device information is not empty, it is determined that there is an associated device for the first terminal device.

[0060] Step 402: If the first terminal device has an associated device, the Bluetooth device enables a connection grabbing mode.

[0061] In this embodiment, if the Bluetooth device determines that the first terminal device has an associated device, the Bluetooth device enables the connection grabbing mode in this case, the purpose of which is to allow the Bluetooth device to receive connection requests sent by other second terminal devices, or to allow the Bluetooth device to respond to connection requests from other second terminal devices.

[0062] In this embodiment, especially for the case where the Bluetooth device is executing the service of the first terminal device, in order to maximize the protection of the currently ongoing service, when it is determined that the first terminal device has associated devices, the Bluetooth device enables the preemptive connection mode, thereby fundamentally avoiding the problem of some unrelated devices preempting the connection to the Bluetooth device, enhancing the data security of the first terminal device and the Bluetooth device, and also optimizing the user experience.

[0063] Optionally, in one implementation, the Bluetooth device enables the connection grabbing mode, including:

[0064] Enable the Bluetooth device to respond to connection requests.

[0065] In this embodiment, turning on the paging scan function of the Bluetooth device refers to putting the Bluetooth device in a state where the Bluetooth device is visible in Bluetooth search. For example, the relevant information of the Bluetooth device can be displayed in the Bluetooth search list of the terminal device within the coverage range of its Bluetooth signal, wherein the paging scan function can be controlled by setting the parameter Page scan to be turned on or off. Exemplarily, when the parameter value of Page scan is a first value, it indicates that the paging scan function of the Bluetooth device is turned on; when the parameter value of Page scan is a second value, it indicates that the paging scan function of the Bluetooth device is turned off, wherein the first value can be 0 or 1, and the second value can be 1 or 0; the first value and the second value can also be other specified characters. The Bluetooth device turns on the paging scan function by setting the value of Page scan, so that when it is determined that the paging scan function is turned on, the Bluetooth device enables the connection grabbing mode to receive the connection request initiated by the second terminal device.

[0066] The above-mentioned paging scanning function of turning on the Bluetooth device is described from the perspective that the Bluetooth device can receive connection requests from other terminal devices; allowing the Bluetooth device to respond to connection requests means that when the Bluetooth device receives a connection request sent by other terminal devices, it is allowed to respond to the connection request of other terminal devices, that is, the Bluetooth device is always in a Bluetooth search visible state, and can always receive connection requests sent by other terminal devices, but only when the Bluetooth device is enabled to respond to connection requests, that is, only when the Bluetooth device enables the connection grabbing mode, it will respond to the connection request sent by the terminal device, otherwise, even if it receives a connection request sent by other devices, it will not respond to the connection request. The non-response here can be the Bluetooth device sending a rejection response to the second terminal device or directly ignoring the connection request.

[0067] In this embodiment, when the Bluetooth device determines that there is no service of the first terminal device currently being executed, the Bluetooth device enables the connection grabbing mode by turning on the paging scanning function or allowing the Bluetooth device to respond to the connection request setting, so that it can receive and respond to the connection requests sent by other second terminal devices. Since there is no service of the first terminal device being executed, the connection requests sent by other terminal devices will not cause service interruption to the first terminal device or the Bluetooth device. Based on this, the Bluetooth device can realize fast switching connections between different terminal devices.

[0068] There is another scenario for the above step 401. In one optional embodiment, the method further includes:

[0069] If the first terminal device has no associated device, the Bluetooth device prohibits the connection grabbing mode.

[0070] In this embodiment, if the Bluetooth device determines that the first terminal device has no associated device, that is, the first associated device information is empty, in this case, all other terminal devices can be considered as illegal devices. In order to avoid other unfamiliar second terminal devices from sending connection requests to the Bluetooth device, the Bluetooth device prohibits the connection grabbing mode, that is, other terminal devices are not allowed to send connection requests to the Bluetooth device to affect the service execution of the first terminal device; or, the Bluetooth device receives connection requests sent by other terminal devices, but does not respond to the connection request. The non-response here can be understood as the Bluetooth device sending a rejection response to the second terminal device or directly ignoring the connection request.

[0071] In this embodiment, after determining that the first terminal device has no associated devices, that is, after determining that there are no other terminal devices that are legally eligible for connection except the first terminal device, the Bluetooth device prohibits the connection mode, thereby ensuring the business operation of the currently executing first terminal device, optimizing the user experience, and protecting the data security of the first terminal device and the Bluetooth device to a certain extent.

[0072] Optionally, in one implementation, the Bluetooth device prohibits the connection grabbing mode, including:

[0073] Turn off the paging scanning function of the Bluetooth device, or prohibit the Bluetooth device from responding to connection requests.

[0074] In this embodiment, when the Bluetooth device turns off the paging scan function of the Bluetooth device, it means that the Bluetooth device is in an invisible state in the Bluetooth search. For example, the relevant information of the Bluetooth device may not be displayed in the Bluetooth search list of the terminal device within the coverage range of its Bluetooth signal. Among them, similar to the above-mentioned turning on the paging scan function, whether to turn off the paging scan function can be controlled by setting the parameter Page scan. Exemplarily, when the parameter value of Page scan is the first value, it indicates that the paging scan function of the Bluetooth device is turned on; when the parameter value of Page scan is the second value, it indicates that the paging scan function of the Bluetooth device is turned off, wherein the first value can be 0 or 1, and the second value can be 1 or 0; the first value and the second value can also be other specified characters. The Bluetooth device turns off the paging scan function by setting the value of Page scan, so that when it is determined that the paging scan function is turned off, the Bluetooth device is in a prohibited connection mode, thereby refusing to receive a connection request initiated by any second terminal device.

[0075] The above-mentioned turning off the paging scanning function of the Bluetooth device is described from the perspective that the Bluetooth device cannot receive connection requests from other terminal devices; prohibiting the Bluetooth device from responding to connection requests means that the Bluetooth device can receive connection requests from other terminal devices, but the Bluetooth device does not respond to connection requests from other terminal devices, that is, not responding to the connection request here can be the Bluetooth device sending a rejection response to the second terminal device or directly ignoring the connection request.

[0076] In this embodiment, when the Bluetooth device determines that there is a service of the first terminal device currently being executed, the Bluetooth device prohibits the connection-preempting mode by turning off the paging scanning function or prohibiting the Bluetooth device from responding to the connection request, thereby not receiving or responding to the connection request sent by other second terminal devices. Since the service of the first terminal device is being executed, the sending of connection requests by other terminal devices will cause service interruption to the first terminal device or the Bluetooth device. Based on this, the Bluetooth device achieves the purpose of maintaining the service of the terminal device and the Bluetooth device, and optimizes the user experience.

[0077] Furthermore, in the Bluetooth device enabling connection grabbing mode, the Bluetooth device can receive connection requests sent by other terminal devices, or allow to respond to connection requests from other terminal devices. In one optional embodiment, as Figure 5 As shown, the method also includes:

[0078] Step 501: When the Bluetooth device enables the connection grabbing mode, a connection request sent by a second terminal device is received; the connection request includes a device identification of the second terminal device.

[0079] When the Bluetooth device establishes a Bluetooth connection with the first terminal device, the Bluetooth device enables the connection grabbing function, thereby receiving the connection request sent by the second terminal device. Optionally, the connection request sent by the second terminal device often carries the device identification of the second terminal device. For example, the device identification can be the MAC address of the second terminal device, the device serial number of the second terminal device, the factory serial number of the second terminal device, etc. The connection request can also carry the device type, service type and other information of the second terminal device, which is not limited in this embodiment.

[0080] Step 502: Determine whether the second terminal device is an associated device of the first terminal device according to the first associated device information of the first terminal device and the device identification of the second terminal device included in the received connection request.

[0081] In this embodiment, the first associated device information may be information sent by the first terminal device to the Bluetooth device after establishing a Bluetooth connection with the Bluetooth device. In this way, the Bluetooth device can traverse and query the device identification of the second terminal device and the device information in the first associated device information according to the first associated device information. If there is device information matching the device identification of the second terminal device in the first associated device information, it is determined that the second terminal device is an associated device of the first terminal device; if there is no device information matching the device identification of the second terminal device in the first associated device information, it is determined that the second terminal device is not an associated device of the first terminal device. For example, the Bluetooth device can compare the device identification field of the second terminal device with the device identification field of all terminal devices in the first associated device information. If there is a terminal device whose device identification field is consistent with the device identification field of the second terminal device, it is determined that the second terminal device is an associated device of the first terminal device; if the device identification field of the second terminal device is inconsistent with the device identification field of all terminal devices, it is determined that the second terminal device is not an associated device of the first terminal device. This embodiment does not limit this.

[0082] Step 503: If the second terminal device is an associated device of the first terminal device, in response to the connection request, disconnect the Bluetooth connection with the first terminal device, and establish a Bluetooth connection with the second terminal device.

[0083] In this embodiment, after the Bluetooth device determines that the second terminal device is an associated device of the first terminal device, that is, after the Bluetooth device determines that the second terminal device is a legitimate device, it responds to the connection request initiated by the second terminal device, disconnects the Bluetooth connection with the first terminal device, and establishes a Bluetooth connection with the second terminal device. Optionally, in order to ensure the user experience of the user of the first terminal device using the Bluetooth device, the Bluetooth device may also respond to the connection request initiated by the second terminal device according to the priority of the first terminal device and the second terminal device. For example, the Bluetooth device determines that the priority of the second terminal device is lower than the priority of the first terminal device. In this case, the Bluetooth device may return a rejection response to the second terminal device. If the priority of the second terminal device is higher than the priority of the first terminal device, the Bluetooth device responds to the Bluetooth connection request of the second terminal device, disconnects the Bluetooth connection with the first terminal device, and establishes a Bluetooth connection with the second terminal device; wherein the priority may be the priority of the terminal type or the priority of the service initiated by the terminal; illustratively, the terminal types include mobile phones, watches, headphones, computers, etc., and the corresponding priorities are mobile phones>computers>headphones>watches; the terminal types also include brands A, brand B, brand C, etc., and the corresponding priorities are brand A>brand B>brand C; the services include call services, audio playback services, etc., and the corresponding priorities are call services>audio playback services. The Bluetooth device may respond to the connection request initiated by the second terminal device according to the pre-set terminal type priority or service priority, when it is determined that the priority of the second terminal device is greater than the priority of the first terminal device. This embodiment does not limit this.

[0084] In this embodiment, the Bluetooth device can receive a connection request from a second terminal device when it is in a mode allowing connection grabbing, and determine whether the second terminal device is an associated device of the first terminal device based on the first associated device information, that is, make a legitimacy judgment on the second terminal device that sends the connection request, and respond to the connection request of the second terminal device when it is determined that the second terminal device is an associated device of the first terminal device, that is, when it is determined that the second terminal device is a legitimate device, thereby avoiding the problem of current service interruption of the Bluetooth device caused by an illegal terminal device initiating a connection request to the Bluetooth device. Furthermore, since the second terminal device is an associated device of the first terminal device, that is, the second terminal device is the default legitimate connection device of the Bluetooth device, the data security of the Bluetooth device, the first terminal device, and the second terminal device is guaranteed to a certain extent.

[0085] The first association information may be information sent after the first terminal device establishes a Bluetooth connection with the Bluetooth device. In one optional embodiment, the method further includes:

[0086] When the Bluetooth device is successfully connected to the first terminal device, first associated device information sent by the first terminal device is received.

[0087] In this embodiment, when the Bluetooth device establishes a Bluetooth connection with the first terminal device, it can receive the first associated device information of the first terminal device. The first associated device information can be an operation triggered to be executed by the first terminal device after determining to establish a connection with the Bluetooth device; it can also be the Bluetooth device sending an associated device information request to the first terminal device, so that the first terminal device returns the first associated device information to the Bluetooth device in response to the request.

[0088] In this embodiment, each time after the Bluetooth device establishes a Bluetooth connection with a new terminal device, the Bluetooth device needs to receive the associated device information sent by the new terminal device and timely update the locally stored associated device information, so that the locally stored associated device information is more accurate and effective.

[0089] Since the terminal device is always in a dynamic operation state, the associated devices of the terminal device are also updated in real time, that is, after the terminal device establishes a connection with the Bluetooth device, its corresponding associated device information will still be updated and changed. In one optional embodiment, after receiving the first associated device information sent by the first terminal device, it also includes:

[0090] The third associated device information sent by the first terminal device is received and saved, where the third associated device information indicates a change update of an associated device of the first terminal device.

[0091] In this embodiment, the Bluetooth device can receive the third associated device information sent by the first terminal device at any time. Here, the third associated device information refers to the updated associated device information corresponding to the first terminal device determined after the first terminal device establishes a Bluetooth connection with the Bluetooth device and the associated device of the first terminal device is updated. Optionally, the first terminal device can generate the third associated device information when detecting a change in the associated device, and send the third associated device information to the Bluetooth device; or the Bluetooth device can also send an associated device acquisition request to the first terminal device before performing the judgment operation of the associated device of the first terminal device based on the associated device information, so as to obtain the third associated device information returned by the first terminal device in response to the acquisition request, so that the Bluetooth device updates the locally stored associated device information according to the third associated device information.

[0092] In this embodiment, the Bluetooth device can receive the third associated device information sent by the first terminal device, and complete the update of the local associated information according to the third associated device information, ensuring that the locally stored associated device information is the latest associated device information, thereby improving the accuracy of determining the associated device based on the associated device information.

[0093] After the Bluetooth device establishes a Bluetooth connection with the second terminal device, that is, after the Bluetooth device completes the switching connection of the second terminal device, in one optional embodiment, the method further includes:

[0094] After establishing a Bluetooth connection with the second terminal device, second associated device information sent by the second terminal device is received.

[0095] In this embodiment, after the Bluetooth device establishes a Bluetooth connection with the second terminal device, it needs to receive the second associated device information of the second terminal device. The second associated device information can be an operation triggered and executed by the second terminal device after determining to establish a connection with the Bluetooth device; or it can be a request for associated device information sent by the Bluetooth device to the second terminal device, so that the second terminal device returns the second associated device information to the Bluetooth device in response to the request. Similar to the first associated device information in step 401, the second associated device information includes information about devices associated with the second terminal device. For example, the second associated device information includes at least one of the following information: device information of terminal devices that have been connected to the second terminal device, device information of terminal devices of the same type as the second terminal device, and device information of terminal devices belonging to the same account as the second terminal device. This embodiment does not limit this.

[0096] After the Bluetooth device receives the second associated device information, the second associated device information may be stored in the storage space for storing the first associated device information, that is, the second associated device information is combined and stored with the historical terminal device associated information, which is not limited in this embodiment.

[0097] In this embodiment, after establishing a Bluetooth connection with the second terminal device, the Bluetooth device promptly receives and stores the second associated device information sent by the second terminal device, and stores the second associated device information in a local storage space to provide data support for subsequent steps of performing associated device judgment based on the second associated device information.

[0098] However, in reality, the storage space of Bluetooth devices is limited. In this case, it also includes:

[0099] The second associated device information replaces the first associated device information stored in the Bluetooth device.

[0100] In this embodiment, the Bluetooth device can overwrite the second associated device information with the first associated device information, that is, use the second associated device information as the final local associated device information of the Bluetooth device; the Bluetooth device can also use the union of the first associated device information and the second associated device information as the final local associated device information, which is not limited in this embodiment.

[0101] In this embodiment, after establishing a Bluetooth connection with the second terminal device, the Bluetooth device promptly receives the second associated device information sent by the second terminal device to update the locally stored associated device information, thereby providing effective data support for the Bluetooth device to perform associated device judgment based on the associated device information and reducing the storage space occupied by the Bluetooth device.

[0102] When the Bluetooth device is enabled to allow the connection to be grabbed, other methods can also be used to determine whether the second terminal device that sends the connection request is a legitimate device, that is, whether it is necessary to respond to the connection request of the second terminal device. Figure 6 As shown, the method also includes:

[0103] Step 601: When the Bluetooth device enables the connection grabbing mode, a connection request sent by a second terminal device is received.

[0104] Similar to step 301 above, when the Bluetooth device is in a mode allowing connection grabbing, the Bluetooth device can receive a connection request sent by any other terminal device. For example, when the second terminal device is an electronic device including a Bluetooth module, the connection request sent by the second terminal device can be a Bluetooth connection request.

[0105] Step 602: determine whether the second terminal device is the terminal device that was most recently disconnected from the Bluetooth device.

[0106] Among them, the last disconnection from the Bluetooth device refers to the terminal device that disconnected the Bluetooth connection with the Bluetooth device for the last time determined based on the time domain dimension. The Bluetooth device can record the time when it establishes a Bluetooth connection with each terminal device and / or the time when it disconnects the Bluetooth connection. Further, the Bluetooth device can also generate a record table based on the above-mentioned record of the time when each terminal device establishes a Bluetooth connection and the time when the Bluetooth connection is disconnected. The record table includes the device identification of each terminal device and its corresponding time of establishing a Bluetooth connection and time of disconnecting the Bluetooth connection. In this way, the Bluetooth device obtains the device identification of the second terminal device when determining that the second terminal device is an associated device of the first terminal device, and determines whether the second terminal device is the terminal device that disconnected from the Bluetooth device for the last time based on the device identification of the terminal device that disconnected the Bluetooth connection for the last time and the device identification of the second terminal device in the record table. Exemplarily, if the device identification of the terminal device that disconnected the Bluetooth connection for the last time is consistent with the device identification of the second terminal device, then the second terminal device is determined to be the terminal device that disconnected from the Bluetooth device for the last time; if the device identification of the terminal device that disconnected the Bluetooth connection for the last time is inconsistent with the device identification of the second terminal device, then it is determined that the second terminal device is not the terminal device that disconnected from the Bluetooth device for the last time. This embodiment does not limit this.

[0107] Step 603: If the second terminal device is not the terminal device that was most recently disconnected from the Bluetooth device, in response to the connection request, disconnect the Bluetooth connection with the first terminal device and establish a Bluetooth connection with the second terminal device.

[0108] In this embodiment, if the Bluetooth device determines that the second terminal device is not the terminal device that was most recently disconnected from the Bluetooth device, that is, the second terminal device is not the last terminal device to establish a Bluetooth connection with the Bluetooth device, in this case, the situation where the second terminal device spontaneously sends connection requests to the Bluetooth device multiple times in a short period of time is excluded. In this case, the Bluetooth device responds to the connection request, disconnects the Bluetooth connection with the first terminal device, and establishes a Bluetooth connection with the second terminal device.

[0109] In this embodiment, when the Bluetooth device determines that the second terminal device is not the terminal device that was most recently disconnected from the Bluetooth device, it responds to the connection request, disconnects the Bluetooth connection with the first terminal device, and establishes a Bluetooth connection with the second terminal device, thereby avoiding the second terminal device frequently establishing connections to the Bluetooth device in a short period of time, thereby further optimizing the user experience.

[0110] In the case where the Bluetooth device determines in step 603 whether the second terminal device is the terminal device that was most recently disconnected from the Bluetooth device, there is another scenario. In one of the optional embodiments, Figure 7 As shown, the method also includes:

[0111] Step 701: If the second terminal device is the terminal device that was most recently disconnected from the Bluetooth device, then the time difference between the time when the second terminal device was most recently disconnected from the Bluetooth device and the current time is obtained.

[0112] In this embodiment, if the Bluetooth device determines that the second terminal device is the terminal device that was most recently disconnected from the Bluetooth device, in order to avoid the second terminal device frequently sending connection requests to the Bluetooth device in a short period of time, the Bluetooth device needs to determine whether the time difference between the moment when the second terminal device was most recently disconnected and the moment when a new connection request is currently initiated meets a preset condition. Optionally, the Bluetooth device can obtain the moment when the connection with the Bluetooth device was most recently disconnected based on the record table in the above embodiment, obtain the current moment from the local clock module, and thus calculate the time difference between the moment when the connection with the Bluetooth device was most recently disconnected and the current moment.

[0113] Step 702: If the time difference is greater than the time difference threshold, in response to the connection request, disconnect the Bluetooth connection with the first terminal device and establish a Bluetooth connection with the second terminal device.

[0114] In this embodiment, the time difference threshold can be 1 hour, 3 hours, 5 hours, 1 day, etc. If the time difference is greater than the time difference threshold, it means that although the second terminal device is the terminal device that disconnected the Bluetooth connection with the Bluetooth device last time, it has been a long time since the last disconnection of the Bluetooth connection. The connection request initiated by it to the Bluetooth device can be considered not to be a spontaneous request, but a request initiated due to actual conditions. In this case, the situation where the second terminal device spontaneously sends connection requests to the Bluetooth device multiple times in a short period of time is excluded. In response to the connection request, the Bluetooth connection with the first terminal device is disconnected, and a Bluetooth connection with the second terminal device is established.

[0115] Step 703: If the time difference is not greater than the time difference threshold, then the connection request is not responded to.

[0116] In this embodiment, if the time difference is not greater than the time difference threshold, the second terminal device may automatically trigger a connection, that is, the connection request sent by the second terminal device to the Bluetooth device is not due to actual needs. In this case, in order not to affect the connection between the Bluetooth device and the first terminal device, the Bluetooth device chooses not to respond to the connection request of the second terminal device, that is, the Bluetooth device does not perform any response operation to the connection request sent by the second terminal device; optionally, the non-response to the connection request here may also include sending a response rejecting the connection to the second terminal device, which is not limited in this embodiment.

[0117] In this embodiment, after determining that the second terminal device is an associated device of the first terminal device, the Bluetooth device can also determine whether the second terminal device is a terminal device that frequently initiates connection requests in a short period of time based on parameters such as the terminal device that last disconnected from the Bluetooth device and the time when the connection with the Bluetooth device was last disconnected, thereby further ensuring that the connection of the second terminal device is a valid connection, making connection switching more accurate, and optimizing user experience.

[0118] Optionally, when establishing a Bluetooth connection, in order to better meet the needs of the user, the Bluetooth device may also determine the device priority of the terminal device that initiates the connection request to the Bluetooth device according to the local associated device information. In one of the optional embodiments, the method further includes:

[0119] When the Bluetooth device has not established a Bluetooth connection with any terminal device, if it receives connection requests from at least two third terminal devices, it determines the third terminal device with the highest priority based on the currently stored fourth associated device information and responds to the connection request of the third terminal device with the highest priority.

[0120] In this embodiment, when the Bluetooth device has not established a connection with any terminal device, it receives a connection request sent by at least two third terminal devices. The Bluetooth device needs to determine a target terminal device to establish a connection with from the at least two third terminal devices. In the process of determining the target terminal device, the Bluetooth device can determine the target terminal device based on the fourth associated device information stored locally. Here, the fourth associated device information can also be the associated device information finally stored locally after the Bluetooth device is updated in the above embodiment. In the process of determining the target terminal device, the Bluetooth device can determine the third terminal device with the highest device type priority and / or the highest business priority as the target terminal device according to the priorities of different dimensions such as preset device type priority and business priority; it can also determine the third terminal device with the highest factory serial number priority as the target terminal device according to the preset factory serial number priority. This embodiment does not limit this.

[0121] In this embodiment, after establishing a connection with a terminal device, the Bluetooth device will synchronize the associated device information of the terminal device. That is, after establishing a Bluetooth connection with the terminal device, the associated device information always exists in the local storage space of the Bluetooth device. In the case where multiple terminal devices initiate Bluetooth backconnection, the Bluetooth device can determine the terminal device with the highest priority to establish a Bluetooth connection based on the local associated device information, which optimizes the process of backconnection between the terminal device and the Bluetooth device to a certain extent and improves the backconnection efficiency of the terminal device.

[0122] In order to better illustrate the above method, Figure 8 As shown, this embodiment provides a device connection switching method involving interaction between a Bluetooth device, a first terminal device, and a second terminal device, specifically including:

[0123] Step 101: When a Bluetooth device establishes a Bluetooth connection with a first terminal device, the first terminal device synchronizes first associated device information to the Bluetooth device;

[0124] Step 102, the Bluetooth device determines whether there is a currently executing service; if not, execute step 103; if yes, execute step 104;

[0125] Step 103: The Bluetooth device enables a connection grabbing mode, receives a connection request sent by a second terminal device, and in response to the connection request, disconnects the Bluetooth connection with the first terminal device and establishes a Bluetooth connection with the second terminal device;

[0126] Step 104, determine whether the first terminal device has associated device information, if yes, execute step 105; if no, execute step 112;

[0127] Step 105: The Bluetooth device enables the connection grabbing mode, receives the connection request sent by the second terminal device, and updates the first associated device information from the first terminal device to obtain the updated first associated device information;

[0128] Step 106: Determine whether the second terminal device is an associated device of the first terminal device according to the device identification and the updated first associated device information; if it is an associated device, execute step 107; if it is not an associated device, execute step 112;

[0129] Step 107, when the second terminal device is an associated device of the first terminal device, determine whether the second terminal device is a terminal device that was most recently disconnected from the Bluetooth device; if not, execute step 108; if yes, execute step 109;

[0130] Step 108: respond to the connection request, disconnect the Bluetooth connection with the first terminal device, and establish a Bluetooth connection with the second terminal device;

[0131] Step 109, obtaining the time difference between the last time the connection with the Bluetooth device was disconnected and the current time;

[0132] Step 110, determine whether the time difference is greater than the time difference threshold, if so, execute step 112; if not, execute step 112;

[0133] Step 111: In response to the connection request, disconnect the Bluetooth connection with the first terminal device, and establish a Bluetooth connection with the second terminal device;

[0134] Step 112: The Bluetooth device prohibits the connection grabbing mode and does not respond to the connection request.

[0135] In this embodiment, after the Bluetooth device establishes a Bluetooth connection with the first terminal device, when the Bluetooth device determines that the service of the first terminal device is not currently being executed, the Bluetooth device is placed in a mode allowing connection grabbing, thereby receiving a connection request from the second terminal device, and then determining whether to respond to the connection request from the second terminal device based on the first associated device information sent by the first terminal device, the terminal device information that the Bluetooth device last disconnected, etc., through multiple condition judgments, the Bluetooth device ensures the completeness of the interaction with the first terminal device to the greatest extent when switching connections, and also ensures the legitimacy of the second terminal device to the greatest extent, so that the Bluetooth device can achieve switching connections with legitimate terminal devices in a safe and effective scenario, thereby optimizing the user experience.

[0136] The device connection switching method provided in the above embodiment has similar implementation principles and technical effects as those of the above method embodiment, and will not be described in detail here.

[0137] It should be understood that although Figure 2-8The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-8 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0138] Fig. 9 FIG. 1 is a structural block diagram of a device connection switching device according to an embodiment. Fig. 9 As shown, the device comprises:

[0139] Execution module 01 is used to establish a Bluetooth connection with a first terminal device. If the Bluetooth device is executing the service of the first terminal device, the Bluetooth device prohibits the connection grabbing mode and the Bluetooth device does not respond to the connection request sent by the second terminal device; the connection grabbing mode means that the second terminal device is allowed to grab the Bluetooth connection between the Bluetooth device and the first terminal device.

[0140] In one of the optional embodiments, the execution module 01 is further configured to enable the connection grabbing mode on the Bluetooth device if the Bluetooth device does not execute the service of the first terminal device.

[0141] In one of the optional embodiments, Fig.10 As shown, the device also includes a receiving module 02;

[0142] Receiving module 02, used for receiving a connection request sent by a second terminal device in a Bluetooth device enabling connection grabbing mode;

[0143] The execution module 01 is further configured to disconnect the Bluetooth connection with the first terminal device and establish a Bluetooth connection with the second terminal device in response to the connection request.

[0144] In one of the optional embodiments, the execution module 01 is also used to determine whether the first terminal device has an associated device based on the first associated device information of the first terminal device if the Bluetooth device is executing the service of the first terminal device; if the first terminal device has an associated device, the Bluetooth device enables the connection grabbing mode.

[0145] In one of the optional embodiments, the execution module 01 is further configured to disable the connection grabbing mode of the Bluetooth device if there is no associated device for the first terminal device.

[0146] In one of the optional embodiments, the receiving module 02 is further used to receive a connection request sent by the second terminal device when the Bluetooth device enables the connection grabbing mode; the connection request includes a device identification of the second terminal device;

[0147] The execution module 01 is further used to determine whether the second terminal device is an associated device of the first terminal device according to the first associated device information of the first terminal device and the device identification of the second terminal device included in the received connection request;

[0148] The execution module 01 is further configured to disconnect the Bluetooth connection with the first terminal device and establish a Bluetooth connection with the second terminal device in response to a connection request if the second terminal device is an associated device of the first terminal device.

[0149] In one of the optional embodiments, the receiving module 02 is further used to receive the first associated device information sent by the first terminal device when the Bluetooth device is successfully connected to the first terminal device.

[0150] In one of the optional embodiments, the receiving module 02 is further used to receive and save third associated device information sent by the first terminal device, where the third associated device information is used to indicate changes and updates of associated devices of the first terminal device.

[0151] In one of the optional embodiments, the receiving module 02 is further configured to receive the second associated device information sent by the second terminal device after establishing a Bluetooth connection with the second terminal device.

[0152] In one of the optional embodiments, the receiving module 02 is further configured to replace the first associated device information stored in the Bluetooth device with the second associated device information.

[0153] In one optional embodiment, the execution module 01 is further used to disable the paging scanning function of the Bluetooth device, or to prohibit the Bluetooth device from responding to the connection request.

[0154] In one optional embodiment, the execution module 01 is further used to enable a paging scanning function of the Bluetooth device, or enable the Bluetooth device to respond to a connection request.

[0155] In one of the optional embodiments, the receiving module 02 is further configured to receive a connection request sent by a second terminal device when the Bluetooth device enables the connection grabbing mode;

[0156] The execution module 01 is further used to determine whether the second terminal device is a terminal device that has been disconnected from the Bluetooth device most recently;

[0157] The execution module 01 is further configured to disconnect the Bluetooth connection with the first terminal device and establish a Bluetooth connection with the second terminal device in response to the connection request if the second terminal device is not the terminal device that was disconnected from the Bluetooth device most recently.

[0158] In one of the optional embodiments, the execution module 01 is also used to obtain the time difference between the time of last disconnection from the Bluetooth device and the current time if the second terminal device is the terminal device that was most recently disconnected from the Bluetooth device; if the time difference is greater than a time difference threshold, then in response to the connection request, disconnect the Bluetooth connection with the first terminal device and establish a Bluetooth connection with the second terminal device; if the time difference is not greater than the time difference threshold, then do not respond to the connection request.

[0159] In one optional embodiment, the first associated device information includes at least one of the following:

[0160] Device information of a terminal device that has been connected to the first terminal device;

[0161] Device information of a terminal device of the same type as the first terminal device;

[0162] Device information of a terminal device that belongs to the same account as the first terminal device.

[0163] The division of the various modules in the above-mentioned device connection switching device is only for illustration. In other embodiments, the device connection switching device can be divided into different modules as needed to complete all or part of the functions of the above-mentioned device connection switching device.

[0164] For the specific definition of the device connection switching device, please refer to the definition of the device connection switching method above, which will not be repeated here. Each module in the above-mentioned device connection switching device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0165] Fig.11Schematic diagram of the internal structure of an electronic device in an embodiment. The electronic device may be an intelligent electronic device including a Bluetooth module, for example, any terminal device such as a Bluetooth headset, a mobile phone, a tablet computer, a laptop computer, a desktop computer, a car computer, a wearable device, etc. The electronic device includes a processor and a memory connected via a system bus. Among them, the processor may include one or more processing units. The processor may be a CPU (Central Processing Unit) or a DSP (Digital Signal Processing), etc. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement a device connection switching method provided in each of the following embodiments. The internal memory provides a cache operating environment for the operating system computer program in the non-volatile storage medium.

[0166] The implementation of each module in the device connection switching device provided in the embodiment of the present application can be in the form of a computer program. The computer program can be run on a terminal or a server. The program module constituted by the computer program can be stored in the memory of the electronic device. When the computer program is executed by the processor, the steps of the method described in the embodiment of the present application are implemented.

[0167] The embodiment of the present application also provides a computer-readable storage medium, one or more non-volatile computer-readable storage media containing computer-executable instructions, when the computer-executable instructions are executed by one or more processors, the processors execute the steps of the device connection switching method.

[0168] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute a device connection switching method.

[0169] Any reference to memory, storage, database or other medium used in this application may include non-volatile and / or volatile memory. Non-volatile memory may include ROM (Read-Only Memory), PROM (Programmable Read-only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-only Memory) or flash memory. Volatile memory may include RAM (Random Access Memory), which is used as an external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as SRAM (Static Random Access Memory), DRAM (Dynamic Random Access Memory), SDRAM (Synchronous Dynamic Random Access Memory), Double Data Rate DDR SDRAM (Double Data Rate Synchronous Dynamic Random Access memory), ESDRAM (Enhanced Synchronous Dynamic Random Accessmemory), SLDRAM (Sync Link Dynamic Random AccessMemory), RDRAM (Rambus Dynamic Random Access Memory), and DRDRAM (Direct Rambus Dynamic Random Access Memory).

[0170] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A device connection switching method, characterized in that: Applied to a Bluetooth device, the method comprises: If the Bluetooth device is executing the service of the first terminal device, determining whether the first terminal device has an associated device according to the first associated device information of the first terminal device; If the first terminal device has an associated device, the Bluetooth device enables a connection grabbing mode; If the first terminal device has no associated device, the Bluetooth device prohibits the connection-preemption mode.

2. The method according to claim 1, characterized in that: The Bluetooth device enables the connection grabbing mode, including: Turn on the paging scanning function of the Bluetooth device, or enable the Bluetooth device to respond to connection requests.

3. The method according to claim 1, characterized in that The method further comprises: If the Bluetooth device does not execute the service of the first terminal device, the Bluetooth device enables the connection grabbing mode.

4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: When the Bluetooth device enables the connection grabbing mode, receiving a connection request sent by a second terminal device; In response to the connection request, the Bluetooth connection with the first terminal device is disconnected, and a Bluetooth connection with the second terminal device is established.

5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: When the Bluetooth device enables the connection-preemption mode, receiving a connection request sent by a second terminal device; the connection request includes a device identifier of the second terminal device; determining, according to the first associated device information of the first terminal device and the device identification of the second terminal device included in the received connection request, whether the second terminal device is an associated device of the first terminal device; If the second terminal device is an associated device of the first terminal device, then in response to the connection request, the Bluetooth connection with the first terminal device is disconnected, and a Bluetooth connection with the second terminal device is established.

6. The method according to claim 1, characterized in that The method further comprises: Receive the first associated device information sent by the first terminal device.

7. The method according to claim 6, characterized in that After receiving the first associated device information sent by the first terminal device, the method further includes: Receive and save third associated device information sent by the first terminal device, where the third associated device information is used to indicate changes and updates of associated devices of the first terminal device.

8. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: When the Bluetooth device enables the connection grabbing mode, receiving a connection request sent by a second terminal device; Determining whether the second terminal device is the terminal device that was most recently disconnected from the Bluetooth device; If the second terminal device is not the terminal device that was most recently disconnected from the Bluetooth device, then in response to the connection request, the Bluetooth connection with the first terminal device is disconnected, and a Bluetooth connection with the second terminal device is established.

9. A device connection switching device, characterized in that: include: an execution module, configured to determine whether the first terminal device has an associated device according to the first associated device information of the first terminal device if the Bluetooth device is executing a service of the first terminal device; If the first terminal device has an associated device, the Bluetooth device enables a connection grabbing mode; If the first terminal device has no associated device, the Bluetooth device prohibits the connection-preemption mode.

10. An electronic device, comprising a communication module, a memory and a processor, wherein a computer program is stored in the memory, characterized in that: When the computer program is executed by the processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 8.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.