CN113938971A - Device connection switching method and device, electronic device and computer readable storage medium - Google Patents

Device connection switching method and device, electronic device and computer readable storage medium Download PDF

Info

Publication number
CN113938971A
CN113938971A CN202111448807.8A CN202111448807A CN113938971A CN 113938971 A CN113938971 A CN 113938971A CN 202111448807 A CN202111448807 A CN 202111448807A CN 113938971 A CN113938971 A CN 113938971A
Authority
CN
China
Prior art keywords
bluetooth
connection
terminal
equipment
terminal device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111448807.8A
Other languages
Chinese (zh)
Inventor
包建全
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202111448807.8A priority Critical patent/CN113938971A/en
Publication of CN113938971A publication Critical patent/CN113938971A/en
Priority to PCT/CN2022/119645 priority patent/WO2023098233A1/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W36/00Hand-off or reselection arrangements
    • H04W36/08Reselecting an access point
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup

Abstract

The application relates to a device connection switching method, a device connection switching apparatus, an electronic device and a computer-readable storage medium. The method comprises the following steps: under the condition that the Bluetooth device establishes Bluetooth connection with the first terminal device and determines that the Bluetooth device is executing the service of the first terminal device, the Bluetooth device prohibits the connection robbing mode, and the Bluetooth device does not respond to the connection request sent by the second terminal device. In the method, the Bluetooth device prohibits the connection robbing mode under the condition that the Bluetooth device determines that the Bluetooth device is executing the service, and cannot accept connection requests sent by other terminal devices and naturally respond to the connection requests of other terminal devices under the condition that the Bluetooth device prohibits the connection robbing mode, so that the service interaction between the Bluetooth device and the first terminal device is not interrupted, and the user experience is optimized.

Description

Device connection switching method and device, electronic device and computer readable storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a device connection switching method and apparatus, an electronic device, and a computer-readable storage medium.
Background
Along with the abundance of life contents of people, more and more electronic equipment owned by users are provided, and the technology of Bluetooth equipment is rapidly improved. In actual life, the same bluetooth device may be switched to be connected with different terminal devices, and in order to provide more convenient switching experience for users, the bluetooth device often needs to support a connection robbing mode.
In the prior art, there is a connection preemption method for a bluetooth device without any limitation, that is, when the bluetooth device is connected to a terminal device a, after receiving a connection request from the terminal device B, the connection with the terminal device a is interrupted, so as to implement the connection with the terminal device B.
However, the connection preemption method of the bluetooth device without any limitation may interrupt the service interaction of the terminal device a, and has the problem of unreasonable preemption.
Disclosure of Invention
The embodiment of the application provides a device connection switching method and device, an electronic device and a computer readable storage medium, which can solve the problem of unreasonable terminal preemption in the prior art and can improve the data security of Bluetooth devices and terminal devices.
In a first aspect, a device connection switching method is provided, which is applied to a bluetooth device, and includes:
under the condition of establishing Bluetooth connection with first terminal equipment, if the Bluetooth equipment is executing the service of the first terminal equipment, the Bluetooth equipment forbids a connection robbing mode, and does not respond to a connection request sent by second terminal equipment; the connection preemption mode indicates that the second terminal device is allowed to preempt the bluetooth connection between the bluetooth device and the first terminal device.
In a second aspect, there is provided a device connection switching apparatus, the apparatus including:
the execution module is used for forbidding the connection robbing mode by the Bluetooth equipment if the Bluetooth equipment executes the service of the first terminal equipment under the condition of establishing Bluetooth connection with the first terminal equipment, and the Bluetooth equipment does not respond to a connection request sent by the second terminal equipment; the connection preemption mode indicates that the second terminal device is allowed to preempt the bluetooth connection between the bluetooth device and the first terminal device.
In a third aspect, an electronic device is provided, comprising a communication module, a memory, and a processor, the memory having a computer program stored therein; the computer program, when executed by the processor, causes the processor to perform the device connection switching method according to the first aspect.
In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the device connection switching method of the first aspect described above.
According to the device connection switching method, the device connection switching apparatus, the electronic device and the computer-readable storage medium, when the bluetooth device establishes the bluetooth connection with the first terminal device, and determines that the bluetooth device is executing the service of the first terminal device, the bluetooth device prohibits the connection preemption mode, and the bluetooth device does not respond to the connection request sent by the second terminal device, wherein the connection preemption mode indicates that the second terminal device is allowed to preempt the bluetooth connection between the bluetooth device and the first terminal device. In the method, the bluetooth device may enable the bluetooth device to prohibit the connection preemption mode based on whether the bluetooth device is executing the service under the condition that the first terminal device establishes the bluetooth connection, for example, the bluetooth device prohibits the connection preemption mode under the condition that the bluetooth device is determining to execute the service, and the bluetooth device cannot accept the connection request sent by other terminal devices and naturally cannot respond to the connection request of other terminal devices under the condition that the bluetooth device prohibits the connection preemption mode, that is, the bluetooth device cannot be interfered by other terminal devices in the process of 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, and optimizing user experience.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a diagram of an application environment of a device connection switching method according to an embodiment;
FIG. 2 is a flow diagram of a method for device connection switching in one embodiment;
FIG. 3 is a flowchart of a method for device connection switching in another embodiment;
FIG. 4 is a flowchart of a method for device connection switching in another embodiment;
FIG. 5 is a flowchart of a method for device connection switching in another embodiment;
FIG. 6 is a flowchart of a method for device connection switching in another embodiment;
fig. 7 is a flowchart of a device connection switching method in another embodiment;
fig. 8 is a flowchart of a device connection switching method in another embodiment;
FIG. 9 is a block diagram showing the configuration of a device connection switching apparatus according to an embodiment;
fig. 10 is a block diagram showing the configuration of a device connection switching apparatus according to another embodiment;
fig. 11 is a schematic structural diagram of an electronic device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
It will be understood that, as used herein, the terms "first," "second," and the like may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another. For example, a first client may be referred to as a second client, and similarly, a second client may be referred to as a first client, without departing from the scope of the present application. Both the first client and the second client are clients, but they are not the same client.
In the process of connecting the bluetooth device and the first terminal device, there may be a case where the second terminal device initiates a connection establishment request to the bluetooth device. Generally, a bluetooth device in the prior art needs to have a one-to-many connection function, or needs to have a function of allowing a connection to be switched with other terminal devices in a one-to-one connection scenario. Under the condition that the Bluetooth device has the function of allowing switching connection with other terminal devices in a one-to-one connection scene, the Bluetooth device in the prior art directly responds to a connection request of a second terminal device, so that the connection with a first terminal device is interrupted, the service execution of a first client side is influenced, and meanwhile, the data security of the Bluetooth device is threatened; or the effect of switching connection of other terminal equipment cannot be realized without responding to the connection request of the second terminal equipment.
Currently, bluetooth technology supports one-to-one connection between a bluetooth device and a terminal device, and therefore, in a situation where the bluetooth device has established a bluetooth connection with a first terminal device, the bluetooth device needs to support a connection preemption function, so that the bluetooth device can receive a connection request sent by another terminal device, and thus perform a corresponding operation according to the connection request. For example, in the prior art, bluetooth devices supporting a connection preemption function are roughly divided into two types, one type of bluetooth device supports connection preemption without any restriction condition, that is, when a first terminal device establishes a connection with a bluetooth device, if a connection request initiated by a second terminal device to the bluetooth device exists, the bluetooth device directly responds to the connection request, disconnects the connection with the first terminal device, establishes a connection with the second terminal device, and realizes connection preemption of the bluetooth device by the second terminal device. Another type of bluetooth device supports connection preemption with a certain limitation, for example, after receiving a connection request initiated by a second terminal device, the bluetooth device sends an identifier (e.g., a local area network Address (MAC Address) and a cloud account) of the second terminal device to a server, and the server determines whether the second terminal device can perform connection preemption operation according to the identifier of the second terminal device, so that the bluetooth device performs corresponding connection switching operation according to a determination result returned by the server.
Although the above-mentioned method of unrestrained support of the connection preemption or the method of legal discrimination via the server can achieve the purpose of switching different terminal devices to use the bluetooth device, they all have certain technical defects. For example, no matter the first-type bluetooth device which supports connection preemption without limit or the legal device which is connected after legal judgment is performed by the server, there may be a situation that when the bluetooth device is executing a service, connection preemption is performed by other bluetooth devices, which causes service interruption of the current bluetooth device, and brings bad user experience to the user of the first terminal device.
Based on this, the present embodiment provides a device connection switching method to solve the above problems in the prior art.
Fig. 1 is a schematic application environment diagram of a device connection switching method in an embodiment. As shown in fig. 1, the application environment includes a bluetooth device 1 and at least two terminal devices 2. 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, wearable equipment, vehicle-mounted bluetooth equipment, and the like; the terminal equipment can be a Bluetooth watch, wearable equipment, a mobile phone, a tablet computer, a server and the like. Specifically, after the bluetooth headset establishes a bluetooth connection with the headset, the bluetooth headset may receive a connection establishment request sent by the bluetooth watch by starting a connection preemption function of the bluetooth headset, so as to implement a connection switching of the bluetooth device with respect to the mobile phone and the bluetooth watch according to any one of the device connection switching methods provided in the following embodiments.
Fig. 2 is a flowchart of a device connection switching method according to an embodiment. The device connection switching method in this embodiment is described by taking the bluetooth device in fig. 1 as an example. As illustrated in the interaction diagram shown in fig. 2, the device connection switching method includes the following schemes.
Under the condition of establishing Bluetooth connection with the first terminal equipment, if the Bluetooth equipment is executing the service of the first terminal equipment, the Bluetooth equipment forbids a connection robbing mode, and the Bluetooth equipment does not respond to a connection request sent by the second terminal equipment.
The bluetooth Connection established 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 procedures of Asynchronous transfer Access Control (ACL) Connection, bluetooth pairing, and bluetooth Connection. In the case of establishing a bluetooth connection, the first terminal device may perform service interaction with the bluetooth device.
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, which is exemplified by taking the bluetooth device as a bluetooth headset and the first terminal device as a mobile phone, and the bluetooth device executing the service of the first terminal device may be that the bluetooth headset is playing music of the mobile phone, or that the mobile phone is performing voice call through the bluetooth headset.
In this embodiment, the bluetooth device determines whether the service of the first terminal device is currently executed under the condition that the bluetooth device determines to establish the bluetooth connection with the first terminal device, for example, the bluetooth device may acquire a currently running application program, and determine whether the service of the first terminal device exists in the running application program; or, the bluetooth device may also monitor whether there is data interaction with the first terminal device, and if there is data interaction, determine that the service of the first terminal device is currently being executed.
Under the condition that the Bluetooth device determines that the service of the first terminal device is being executed, the Bluetooth device forbids the connection robbing mode in order to avoid causing the problem of the service terminal to the service of the first terminal device.
And the connection preempting mode represents that the second terminal equipment is allowed to preempt the Bluetooth connection between the Bluetooth equipment and the first terminal equipment.
In this embodiment, the bluetooth device forbids the contention mode means that the connection request sent by another second terminal device is not received, or the bluetooth device does not respond to the connection request sent by the second terminal device.
For example, the bluetooth device connection prohibition mode may be that after the bluetooth device establishes a bluetooth connection with the first terminal device, the bluetooth device is in a state that bluetooth search is invisible, that is, when other terminal devices perform bluetooth search, a bluetooth signal of the bluetooth device cannot be acquired, so obviously, other terminal devices cannot initiate a bluetooth connection request to the bluetooth device, and accordingly, the bluetooth device cannot receive a bluetooth connection request sent by other terminal devices; alternatively, the bluetooth device may receive the connection request from the other terminal device, but does not respond to the connection request sent by the other terminal device, where the non-response may be to send a reject response to the other terminal device or directly ignore the connection request.
According to the device connection switching method, under the condition that the Bluetooth device establishes Bluetooth connection with the first terminal device and determines that the Bluetooth device is executing the service of the first terminal device, the Bluetooth device prohibits the connection robbing mode, and the Bluetooth device does not respond to the connection request sent by the second terminal device, wherein the connection robbing mode indicates that the second terminal device is allowed to seize the Bluetooth connection between the Bluetooth device and the first terminal device. In the method, the bluetooth device may enable the bluetooth device to prohibit the connection preemption mode based on whether the bluetooth device is executing the service under the condition that the first terminal device establishes the bluetooth connection, for example, the bluetooth device prohibits the connection preemption mode under the condition that the bluetooth device is determining to execute the service, and the bluetooth device cannot accept the connection request sent by other terminal devices and naturally cannot respond to the connection request of other terminal devices under the condition that the bluetooth device prohibits the connection preemption mode, that is, the bluetooth device cannot be interfered by other terminal devices in the process of 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, and optimizing user experience.
In another scenario of the foregoing embodiment, in an optional embodiment, the method further includes:
and if the Bluetooth equipment does not execute the service of the first terminal equipment, the Bluetooth equipment enables the connection robbing mode.
In this embodiment, the bluetooth device determines that there is no currently running application program that matches the service of the first terminal device, or detects that there is no data interaction with the first terminal device currently, in this case, the bluetooth device determines that the service of the first terminal device is not executed, and at this time, because the current bluetooth device has no service execution, the other terminal devices perform switching connection without causing problems such as service interruption to the service of the first terminal device executed by the bluetooth device, and based on this, the bluetooth device enables the connection preemption mode.
The Bluetooth device enabling connection mode means that the Bluetooth device can still receive connection requests sent by other terminal devices after establishing Bluetooth connection with the first terminal device. For example, the bluetooth device still exists in a state in which bluetooth search is visible, that is, when performing bluetooth search, other terminal devices may still acquire a bluetooth signal of the bluetooth device, so that a bluetooth connection request may be initiated to the bluetooth device. Or, the bluetooth device setting may respond to a connection request sent by other terminal devices, thereby completing connection switching between different terminal devices.
In this embodiment, if the bluetooth device does not execute 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 preemption allowing mode, and a connection request sent by another second terminal device can be received, so that connection switching of different terminal devices is realized.
After the bluetooth device establishes a bluetooth connection with a first terminal device, if the bluetooth device wants to receive a connection request sent by another terminal device, the bluetooth device needs to have a function of allowing the another terminal device to perform a connection handover, in an optional embodiment, as shown in fig. 3, the method further includes:
step 301, receiving a connection request sent by the second terminal device in the bluetooth device enabling connection preemption mode.
In this embodiment, as described in the foregoing embodiment, in the case that the bluetooth device enables the contention mode, the bluetooth device may receive a connection request sent by any one of the other terminal devices, for example, in the case that the second terminal device is an electronic device including a bluetooth module, the connection request sent by the second terminal device may be a bluetooth connection request.
Step 302, in response to the connection request, disconnecting the bluetooth connection with the first terminal device and establishing the bluetooth connection with the second terminal device.
In this embodiment, in a case where it is determined that the bluetooth device does not execute the service of the first client, the bluetooth device enables the connection preemption mode, and accepts the connection request sent by the second terminal device in this mode, and the bluetooth device may directly respond to the connection request. It should be noted that before establishing the bluetooth connection with the second terminal device, the bluetooth connection with the first terminal device needs to be disconnected, that is, the bluetooth device responds to the connection request of the second terminal device, and performs the action of disconnecting the bluetooth connection with the first terminal device, and then establishes the bluetooth connection with the second terminal device.
In this embodiment, the connection request initiated by the second terminal device can be received only when the bluetooth device enables the connection preemption mode, and whether the connection request of the second terminal device can be received is determined based on whether the bluetooth device enables the connection preemption mode, so that the number of the second terminal devices initiating the connection request is reduced to a certain extent, the interference to the first terminal device caused by the connection request initiated by the second terminal device is avoided, and the user experience of the user using the bluetooth device is optimized.
However, in actual situations, when the bluetooth device is executing the service of the first terminal device, there is an actual requirement for performing the connection switching of the second terminal device, and in such a requirement scenario, it may be determined whether the bluetooth device enables the connection preemption function through further condition judgment on the second terminal device, so as to achieve the purpose of connection switching in the actual requirement. In one optional embodiment, as shown in fig. 4, the method further includes:
step 401, if the bluetooth device is executing the service of the first terminal device, determining whether the first client has an associated device according to the first associated device information of the first terminal device.
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 may be a terminal device connected to the first terminal device, a terminal device of the same type as the first terminal device, a terminal device of the same account as the first terminal device belongs to, a terminal device in the same local area network as the first terminal device, and the like.
Optionally, the first associated device information may include device information of a terminal device 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 connected to the first terminal device may be a smart watch, a tablet computer, a smart bracelet, or another terminal device having a bluetooth module, which is connected to the mobile phone within a preset historical duration, and correspondingly, the device information of the client includes a device name, a device type, an MAC address, a device serial number, a factory serial number, a service type, and the like. The preset historical time period may be the past month, the past half year, etc. In this scenario, aiming at the defect that the connection switching cannot be realized if the terminal device does not have the function of account login in the prior art, the terminal device connected with the first terminal device can be determined as a legal device capable of performing connection switching through the first association information provided in this embodiment, so as to realize the purpose of connection switching of the bluetooth device.
Optionally, the first associated device information may further include device information of a terminal device of the same type as the first terminal device. For example, in the case that the first terminal device is a brand a mobile phone, the first associated device information may include device information of other terminal devices having a bluetooth module of the brand a, such as a smart watch of the brand a and a tablet computer of the brand a; it should be noted that the same brand type may be considered as the same as a specified field in the factory serial number, the device serial number, or the terminal model number of the first terminal device, where the specified field indicates the brand type. In addition, for example, the type may 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 types are mobile phones.
Optionally, the first associated device information may further include device information of a terminal device of the same account to which the first terminal device belongs. For example, the cloud account of the first terminal device is the user a, and then the first associated device information includes device information of other terminal devices that the user a logs in, for example, device information of a smart watch that the user a logs in, device information of a smart band that the user a logs in, device information of a tablet computer that the user a logs in, and the like.
In this embodiment, the first associated device information may be information that is sent to the bluetooth device by the first terminal device after establishing a bluetooth connection with the bluetooth device; or the first associated device information may be information sent to the bluetooth device after the first terminal device updates its corresponding associated information. In order to avoid the situation that the switching connection of the second terminal device cannot be performed by one time under the condition that the bluetooth device determines that the service of the first client is being executed, the bluetooth device may determine whether to control the bluetooth device to enter the connection preemption allowing mode according to a further judgment condition. Here, a further determination condition may be that the bluetooth device determines whether the first terminal device has the associated device, for example, the bluetooth device may obtain first associated device information of the first terminal device, and determine whether the first terminal device has the associated device based on the first associated device information, for example, if the first associated device information is empty, it is determined that the first terminal device does not have the associated device; and if the first associated equipment information is not null, determining that the first terminal equipment has associated equipment.
Step 402, if the first terminal device has the associated device, the bluetooth device enables the connection preemption mode.
In this embodiment, if the bluetooth device determines that the first terminal device has the associated device, in this case, the bluetooth device enables the connection preemption mode, and the purpose is to allow the bluetooth device to receive a connection request sent by another second terminal device, or allow the bluetooth device to respond to a connection request of another second terminal device.
In this embodiment, especially for the case that the bluetooth device is executing the service of the first terminal device, the bluetooth device enables the connection preemption mode to protect the currently ongoing service to the greatest extent, and when it is determined that the first terminal device has the associated device, the bluetooth device fundamentally avoids the problem that some unrelated devices rob the bluetooth device, so that the data security of the first terminal device and the bluetooth device is enhanced, and the user experience is optimized.
Optionally, in an implementation, the bluetooth device enables a connection preemption mode, including:
and starting a paging scanning function of the Bluetooth device, or enabling the Bluetooth device to respond to the connection request.
In this embodiment, the bluetooth device turning on the Page scanning function of the bluetooth device refers to placing the bluetooth device in a state where bluetooth search is visible, for example, the relevant information of the bluetooth device may be displayed in a bluetooth search list of a terminal device within a bluetooth signal coverage range of the bluetooth device, where the Page scanning function may control whether to turn on or not by setting a parameter Page scan. Illustratively, when the parameter value of the Page scan is a first value, it indicates that the Page scanning function of the bluetooth device is turned on; when the parameter value of the Page scan is a second value, indicating that the Page scanning function of the bluetooth device is turned off, wherein the first value may be 0 or 1, and the second value may be 1 or 0; the first and second values may also be other specified characters. The Bluetooth device starts the Page scanning function by setting the value of the Page scan, so that the Bluetooth device enables the connection preemption mode under the condition of determining that the Page scanning function is started, and receives the connection request initiated by the second terminal device.
The starting of the paging scanning function of the Bluetooth device is described from the point that the Bluetooth device can receive connection requests of other terminal devices; allowing the bluetooth device to respond to the connection request means that when the bluetooth device receives the connection request sent by the other terminal device, the bluetooth device is allowed to respond to the connection request of the other terminal device, that is, the bluetooth device is always in a state where bluetooth search is visible, and the connection request sent by the other terminal device can be always received, but only in a state where the bluetooth device is enabled to respond to the connection request, that is, only in a case where the bluetooth device is enabled to enable a connection preemption mode, the connection request sent by the terminal device can be responded, otherwise, even if the connection request sent by the other device is received, the connection request cannot be responded, and the non-response here may be that the bluetooth device sends a rejection response to the second terminal device or directly ignores the connection request.
In this embodiment, when determining that there is no currently executed service of the first terminal device, the bluetooth device enables the connection preemption mode by starting a page scanning function or allowing the bluetooth device to respond to a connection request, so that connection requests sent by other second terminal devices can be received and responded.
There is another scenario in step 401, and in an alternative embodiment, the method further includes:
and if the first terminal equipment does not have associated equipment, the Bluetooth equipment prohibits the connection robbing mode.
In this embodiment, if the bluetooth device determines that the first terminal device does not have the associated device, that is, the first associated device information is null, in this case, all other terminal devices may be regarded as illegal devices, and in order to avoid sending a connection request to the bluetooth device by another strange second terminal device, the bluetooth device prohibits the connection preemption mode, that is, does not allow the other terminal devices to send connection requests to the bluetooth device to affect service execution of the first terminal device; alternatively, the bluetooth device receives the connection request sent by the other terminal device, but does not respond to the connection request, where the non-response may be understood as the bluetooth device sending a rejection response to the second terminal device or directly ignoring the connection request.
In this embodiment, after determining that the first terminal device does not have the associated device, that is, after determining that there is no other terminal device except the first terminal device that is in the connection robbery mode, the bluetooth device prohibits the connection robbery mode, thereby ensuring the currently executed service operation of the 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.
Optionally, in one implementation, the method for disabling the connection preemption mode by the bluetooth device includes:
the page scanning function of the bluetooth device is turned off, or the bluetooth device is prohibited from responding to the connection request.
In this embodiment, the bluetooth device turning off the page scanning function of the bluetooth device refers to placing the bluetooth device in a state where bluetooth search is invisible, for example, the relevant information of the bluetooth device may not be displayed in the bluetooth search list of the terminal device within the bluetooth signal coverage range. Similar to the above-mentioned opening of the Page scanning function, whether to close the Page scanning function can be controlled by setting a parameter Page scan. Illustratively, when the parameter value of the Page scan is a first value, it indicates that the Page scanning function of the bluetooth device is turned on; when the parameter value of the Page scan is a second value, indicating that the Page scanning function of the bluetooth device is turned off, wherein the first value may be 0 or 1, and the second value may be 1 or 0; the first and second values may also be other specified characters. The Bluetooth device closes the Page scanning function by setting the value of the Page scan, so that the Bluetooth device is in the connection-robbing-prohibited mode under the condition that the Page scanning function is determined to be closed, and the connection request initiated by any second terminal device is refused to be received.
The turning off of the page scanning function of the bluetooth device is from the point of view that the bluetooth device does not receive a connection request to other terminal devices; the prohibition of the bluetooth device responding to the connection request refers to that the bluetooth device may receive a connection request of another terminal device, but the bluetooth device does not respond to the connection request of the other terminal device, that is, here, the non-response to the connection request may be that the bluetooth device sends a rejection response to the second terminal device or directly ignores the connection request.
In this embodiment, when determining that the service of the first terminal device that is currently being executed exists, the bluetooth device disables the connection robbery mode by turning off the page scanning function or disabling the bluetooth device from responding to the connection request, so as not to receive or respond to the connection request sent by the other second terminal device.
Furthermore, in the bluetooth device enabled contention mode, the bluetooth device may receive a connection request sent by another terminal device, or allow to respond to a connection request of another terminal device, in an alternative embodiment, as shown in fig. 5, the method further includes:
step 501, receiving a connection request sent by a second terminal device under the condition that the Bluetooth device enables a connection preemption mode; the connection request comprises a device identification of the second terminal device.
Under the condition that the Bluetooth connection is established between the Bluetooth device and the first terminal device, the Bluetooth device enables the connection robbing function, so that the connection request sent by the second terminal device is received. Optionally, the connection request sent by the second terminal device often carries a device identifier of the second terminal device, for example, the device identifier may be an MAC address of the second terminal device, a device serial number of the second terminal device, a factory serial number of the second terminal device, and the like, and the connection request may also carry information of a device type, a service type, and the like of the second terminal device, which is not limited in this embodiment.
Step 502, determining whether the second terminal device is the associated device of the first terminal device according to the first associated device information of the first terminal device and the device identifier of the second terminal device included in the received connection request.
In this embodiment, the first associated device information may be information that the first terminal device transmits to the bluetooth device after establishing a bluetooth connection with the bluetooth device. Therefore, the bluetooth device can perform traversal query on the device identifier of the second terminal device and the device information in the first associated device information according to the first associated device information, and if the device information matched with the device identifier of the second terminal device exists in the first associated device information, the second terminal device is determined to be the associated device of the first terminal device; and if the first associated device information does not contain the device information matched with the device identifier of the second terminal device, determining that the second terminal device is not the associated device of the first terminal device. For example, the bluetooth device may compare the field of the device identifier of the second terminal device with the device identifier fields of all terminal devices in the first associated device information, and if the field of the device identifier of the terminal device is consistent with the field of the device identifier of the second terminal device, determine that the second terminal device is an associated device of the first terminal device; if the field of the device identifier of the second terminal device is not consistent with the device identifier fields of all the terminal devices, it is determined that the second terminal device is not the associated device of the first terminal device, which is not limited in this embodiment.
Step 503, if the second terminal device is the associated device of the first terminal device, the bluetooth connection with the first terminal device is disconnected in response to the connection request, and the bluetooth connection with the second terminal device is established.
In this embodiment, after determining that the second terminal device is the associated device of the first terminal device, that is, after determining that the second terminal device is a legal device, the bluetooth device responds to the connection request initiated by the second terminal device, disconnects the bluetooth connection with the first terminal device, and establishes the 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 further respond to the connection request initiated by the second terminal device according to the priorities 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, and 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 the bluetooth connection with the second terminal device; the priority can be the priority of the terminal type or the priority of the service initiated by the terminal; exemplarily, the terminal types include a mobile phone, a watch, an earphone, a computer, and the like, and the corresponding priorities are mobile phone > computer > earphone > watch; the terminal type further comprises a brand A, a brand B, a brand C and the like, and the corresponding priority is brand A > brand B > brand C; the services include a call service, an audio playing service, and the like, and the priority corresponding to the call service > the audio playing service, and the bluetooth device may respond to the connection request initiated by the second terminal device according to the preset priority of the terminal type or the preset priority of the service, under the condition that the priority of the second terminal device is determined to be greater than the priority of the first terminal device, which is not limited in this embodiment.
In this embodiment, the bluetooth device may receive the connection request of the second terminal device in the connection preemption permission mode, determine whether the second terminal device is the associated device of the first terminal device according to the first associated device information, that is, perform validity judgment on the second terminal device that sends the connection request, and when it is determined that the second terminal device is the associated device of the first terminal device, that is, when it is determined that the second terminal device is the valid device, respond to the connection request of the second terminal device, thereby avoiding a problem of current service interruption of the bluetooth device caused by an illegal terminal device initiating the connection request to the bluetooth device And the data security of the first terminal equipment and the second terminal equipment.
The first association information may be information sent after the first terminal device establishes a bluetooth connection with a bluetooth device, and in an optional embodiment, the method further includes:
and receiving first associated equipment information sent by the first terminal equipment under the condition that the connection between the Bluetooth equipment and the first terminal equipment is successful.
In this embodiment, the bluetooth device may receive first associated device information of the first terminal device when establishing a bluetooth connection with the first terminal device, where the first associated device information may be an operation triggered and executed by the first terminal device after determining that the bluetooth connection is established with the bluetooth device; the bluetooth device may also send a request for associating device information to the first terminal device, so that the first terminal device returns the first associating device information to the bluetooth device in response to the request.
In this embodiment, each time after the bluetooth device establishes the bluetooth connection with the new terminal device, the bluetooth device needs to receive the associated device information sent by the current new terminal device, and update the associated device information stored locally in time, so that the associated device information stored locally is more accurate and effective.
In one optional embodiment, after receiving the first associated device information sent by the first terminal device, the method further includes:
and receiving and storing third associated device information sent by the first terminal device, wherein the third associated device information indicates the change update of the associated device of the first terminal device.
In this embodiment, the bluetooth device may receive, at any time, third associated device information sent by the first terminal device, where the third associated device information refers to associated device information obtained by updating the associated device of the first terminal device after the bluetooth connection is established between the first terminal device and the bluetooth device, so as to determine the updated associated device information corresponding to the first terminal device. Optionally, the first terminal device may generate third associated device information when detecting that the associated device changes, and send the third associated device information to the bluetooth device; or, the bluetooth device may further send an acquisition request of the associated device to the first terminal device before performing a determination operation of the associated device of the first terminal device based on the associated device information to acquire 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.
In this embodiment, the bluetooth device may receive the third associated device information sent by the first terminal device, and update the local associated information according to the third associated device information, so as to ensure 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.
After the bluetooth device establishes the bluetooth connection with the second terminal device, that is, after the bluetooth device completes the handover connection of the second terminal device, in an optional embodiment of the present invention, the method further includes:
and after the Bluetooth connection with the second terminal equipment is established, receiving second associated equipment information sent by the second terminal equipment.
In this embodiment, after the bluetooth device establishes the bluetooth connection with the second terminal device, the bluetooth device needs to receive second associated device information of the second terminal device, where the second associated device information may be an operation triggered and executed by the second terminal device after determining that the bluetooth device establishes the bluetooth connection with the second terminal device; the bluetooth device may also send a request for associating device information to the second terminal device, so that the second terminal device returns the second associating 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 of a device associated with the second terminal device, and exemplarily, the second associated device information includes at least one of device information of a terminal device connected to the second terminal device, device information of a terminal device of the same type as the second terminal device, and device information of a terminal device of the same account to which the second terminal device belongs, which is not limited in this embodiment.
After the bluetooth device receives the second associated device information, the second associated device information may be stored in the storage space where the first associated device information is stored, that is, the second associated device information and the associated information of the history terminal device are merged and stored, which is not limited in this embodiment.
In this embodiment, after the bluetooth device establishes the bluetooth connection with the second terminal device, the bluetooth device timely receives and stores the second associated device information sent by the second terminal device, and stores the second associated device information in the local storage space, so as to provide data support for the subsequent step of performing associated device judgment based on the second associated device information.
However, in practical situations, the storage space of the bluetooth device is limited, and in this case, the method further includes:
and replacing the first associated device information stored by the Bluetooth device with the second associated device information.
In this embodiment, the bluetooth device may overwrite the second associated device information to the first associated device information, that is, take the second associated device information as the local final associated device information of the bluetooth device; the bluetooth device may also use a union of the first associated device information and the second associated device information as local final associated device information, which is not limited in this embodiment.
In this embodiment, after the bluetooth device establishes the bluetooth connection with the second terminal device, the bluetooth device timely receives the second associated device information sent by the second terminal device to update the associated device information in the local area, so as to provide effective data support for the bluetooth device to perform associated device judgment based on the associated device information, and reduce the occupation of the storage space of the bluetooth device.
In the bluetooth device enabling the connection permission mode, it may also be determined whether the second terminal device sending the connection request is a legal device by other methods, that is, whether the connection request of the second terminal device needs to be responded.
In one optional embodiment, as shown in fig. 6, the method further includes:
step 601, receiving a connection request sent by the second terminal device under the condition that the bluetooth device enables the connection preemption mode.
Similar to the above step 301, in the case that the bluetooth device is in the contention resolution enabled mode, the bluetooth device may receive the connection request sent by any other terminal device, for example, in the case that the second terminal device is an electronic device including a bluetooth module, the connection request sent by the second terminal device may be a bluetooth connection request.
Step 602, determining whether the second terminal device is the terminal device which has been disconnected from the bluetooth device last time.
Wherein, the last disconnection from the bluetooth device refers to the terminal device which is disconnected from the bluetooth device for the last time determined based on the time domain dimension. The bluetooth device may record the time when it establishes bluetooth connection with each terminal device and/or the time when it disconnects bluetooth, further, the bluetooth device may generate a record table based on the recorded time when it establishes bluetooth connection with each terminal device and the time when it disconnects bluetooth, where the record table includes the device identifier of each terminal device and its corresponding time when establishing bluetooth connection and time when disconnecting bluetooth connection, so that, in the case that the bluetooth device determines that the second terminal device is the associated device of the first terminal device, the bluetooth device acquires the device identifier of the second terminal device, and based on the device identifier of the terminal device which last disconnects bluetooth connection and the device identifier of the second terminal device in the record table, determines whether the second terminal device is the terminal device which last disconnects bluetooth connection with the bluetooth device, exemplarily, if the device identifier of the terminal device which last disconnects bluetooth connection is consistent with the device identifier of the second terminal device, determining that the second terminal equipment is the terminal equipment which is disconnected with the Bluetooth equipment for the last time; if the device identifier of the terminal device that has last disconnected from the bluetooth connection is not consistent with the device identifier of the second terminal device, it is determined that the second terminal device is not the terminal device that has last disconnected from the bluetooth connection, which is not limited in this embodiment.
Step 603, if the second terminal device is not the terminal device which has been disconnected from the bluetooth device for the last time, responding to the connection request, disconnecting the bluetooth connection with the first terminal device, and establishing the bluetooth connection with the second terminal device.
In this embodiment, if the bluetooth device determines that the second terminal device is not the terminal device that has been disconnected from the bluetooth device most recently, that is, the second terminal device is not the last terminal device that has established the bluetooth connection with the bluetooth device, in this case, a situation that the second terminal device spontaneously sends a connection request to the bluetooth device multiple times in a short period is excluded, and in this case, the bluetooth device responds to the connection request, disconnects the bluetooth connection with the first terminal device, and establishes the bluetooth connection with the second terminal device.
In this embodiment, the bluetooth device responds to the connection request to disconnect the bluetooth connection with the first terminal device and establish the bluetooth connection with the second terminal device when determining that the second terminal device is not the terminal device that was disconnected from the bluetooth device most recently, thereby avoiding the second terminal device from frequently establishing a connection with the bluetooth device in a short time and further optimizing user experience.
In the above step 603, in a case that the bluetooth device determines whether the second terminal device is a terminal device that has been disconnected from the bluetooth device most recently, there is another scenario, and in an alternative embodiment, as shown in fig. 7, the method further includes:
and 701, if the second terminal device is the terminal device which is disconnected with the Bluetooth device for the last time, acquiring the time difference between the moment of disconnecting with the Bluetooth device for the last time and the current moment.
In this embodiment, if the bluetooth device determines that the second terminal device is the terminal device that has been disconnected from the bluetooth device most recently, in order to avoid a situation that the second terminal device frequently sends a connection request to the bluetooth device in a short time, the bluetooth device needs to determine whether a time difference between a time of the last disconnection of the second terminal device and a time of a new connection request initiated currently satisfies a preset condition. Alternatively, the bluetooth device may obtain the time of the last disconnection from the bluetooth device based on the log table in the above embodiment, and obtain the current time from the local clock module, so as to calculate the time difference between the time of the last disconnection from the bluetooth device and the current time.
Step 702, if the time difference is greater than the time difference threshold, responding to the connection request, disconnecting the bluetooth connection with the first terminal device, and establishing the bluetooth connection with the second terminal device.
In this embodiment, the time difference threshold may be 1 hour, 3 hours, 5 hours, 1 day, etc., and if the time difference is greater than the time difference threshold, it indicates that the second terminal device is the terminal device that has disconnected the bluetooth connection from the bluetooth device last time, but has been separated from the last time of disconnecting the bluetooth connection by a long time, and the connection request initiated to the bluetooth device may be considered as not an autonomous initiation request but an actual initiation request.
In step 703, if the time difference is not greater than the time difference threshold, the connection request is not responded.
In this embodiment, if the time difference is not greater than the time difference threshold, there may be a situation that the second terminal device automatically triggers connection, that is, the connection request sent by the second terminal device to the bluetooth device is not due to an actual requirement, in this situation, in order to not 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 for the connection request sent by the second terminal device; optionally, the unresponsive connection request may further include sending a response to reject connection to the second terminal device, which is not limited in this embodiment.
In this embodiment, after determining that the second terminal device is the associated device of the first terminal device, the bluetooth device may further determine whether the second terminal device is the terminal device that frequently initiates the connection request in a short period according to parameters such as the terminal device that was disconnected from the bluetooth device most recently, the time when the second terminal device was disconnected from the bluetooth device most recently, and the like, thereby further ensuring that the connection of the second client is an effective connection, making the connection switching more accurate, and optimizing the user experience.
Optionally, in order to better adapt to the requirement of the user when the bluetooth device establishes the bluetooth connection, the method may further perform device priority determination on the terminal device initiating the connection request to the terminal device according to the local associated device information, and in one optional embodiment, the method further includes:
and under the condition that the Bluetooth device does not establish Bluetooth connection with any terminal device, if connection requests sent by at least two third terminal devices are received, determining the third terminal device with the highest priority according to the currently stored fourth associated device information, and responding to the connection request of the third terminal device with the highest priority.
In this embodiment, when the bluetooth device does not establish a connection with any terminal device, a connection request sent by at least two third terminal devices is received, the bluetooth device needs to determine, from the at least two third terminal devices, one target terminal device with which a connection is established, and in the process of determining the target terminal device, the bluetooth device may determine the target terminal device based on locally stored fourth associated device information. Here, the fourth associated device information may also be the updated associated device information finally stored to the local after the bluetooth device in the above embodiment. In the process of determining the target terminal device, the bluetooth device may determine, according to the preset device type priority, the service priority and other priorities of different dimensions, a third terminal device with the highest device type priority and/or the highest service priority as the target terminal device; a third terminal device with the highest factory serial number priority may also be determined as the target terminal device according to a preset factory serial number priority, which is not limited in this embodiment.
In this embodiment, after the bluetooth device establishes a connection with the terminal device, the associated device information of the terminal device is synchronized, that is, after the bluetooth connection with the terminal device is established, the associated device information always exists in the local storage space of the bluetooth device, and when the bluetooth reconnection is initiated by a plurality of terminal devices, the bluetooth device may determine, based on the local associated device information, the terminal device with the highest priority to establish the bluetooth connection, so that the procedure of the bluetooth device and the terminal device for reconnection is optimized to a certain extent, and the reconnection efficiency of the terminal device is improved.
To better explain the above method, as shown in fig. 8, this embodiment provides an apparatus connection switching method involving interaction of a bluetooth apparatus, a first terminal apparatus, and a second terminal apparatus, which specifically includes:
step 101, under the condition that a Bluetooth device establishes Bluetooth connection with a first terminal device, the first terminal device synchronizes first associated device information to the Bluetooth device;
step 102, the Bluetooth device determines whether a currently executed service exists; if not, go to step 103; if yes, go to step 104;
103, enabling a connection preemption mode by the Bluetooth equipment, receiving a connection request sent by second terminal equipment, responding to the connection request, disconnecting the Bluetooth connection with the first terminal equipment, and establishing the Bluetooth connection with the second terminal equipment;
step 104, judging whether the first terminal equipment has associated equipment information, if so, executing step 105; if not, go to step 112;
105, enabling a connection preemption mode by the Bluetooth equipment, receiving a connection request sent by the second terminal equipment, and updating first associated equipment information from the first terminal equipment to obtain the updated first associated equipment information;
step 106, determining whether the second terminal equipment is the associated equipment of the first terminal equipment or not according to the equipment identifier and the updated first associated equipment information; if the device is a related device, go to step 107; if not, go to step 112;
step 107, under the condition that the second terminal device is the associated device of the first terminal device, judging whether the second terminal device is the terminal device which is disconnected with the Bluetooth device for the last time; if not, go to step 108; if yes, go to step 109;
step 108, responding to the connection request, disconnecting the Bluetooth connection with the first terminal device, and establishing the Bluetooth connection with the second terminal device;
step 109, acquiring the time difference between the moment of disconnecting the Bluetooth device for the last time and the current moment;
step 110, judging whether the time difference is greater than a time difference threshold value, if so, executing step 112; if not, go to step 112;
step 111, responding to the connection request, disconnecting the Bluetooth connection with the first terminal device, and establishing the Bluetooth connection with the second terminal device;
and step 112, the Bluetooth equipment forbids the connection robbing mode and does not respond to the connection request.
In this embodiment, after the bluetooth connection is established between the bluetooth device and the first terminal device, when the bluetooth device determines that the service of the first terminal device is not currently executed, the bluetooth device is in a connection preemption allowing mode, so as to receive a connection request of the second terminal device, and then determine whether to respond to the connection request of the second terminal device according to the first associated device information sent by the first terminal device, the terminal device information of the bluetooth device which is disconnected for the last time, and the like, and judge conditions for multiple times, so that when the bluetooth device performs connection switching, the completeness of interaction with the first terminal device is ensured to the maximum extent, the legality of the second terminal device is also ensured to the maximum extent, so that the bluetooth device can realize switching connection of legal terminal devices in a safe and effective scene, and user experience is optimized.
The implementation principle and technical effect of the device connection switching method provided by the above embodiment are similar to those of the method embodiment, and are not described herein again.
It should be understood that although the various steps in the flow charts of fig. 2-8 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-8 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
Fig. 9 is a block diagram of a device connection switching apparatus according to an embodiment. As shown in fig. 9, the apparatus includes:
the execution module 01 is configured to, under the condition that a bluetooth connection is established with the first terminal device, prohibit the bluetooth device from performing the contention mode if the bluetooth device is executing the service of the first terminal device, and the bluetooth device does not respond to the connection request sent by the second terminal device; the connection preemption mode indicates that the second terminal device is allowed to preempt the bluetooth connection between the bluetooth device and the first terminal device.
In one optional embodiment, the executing module 01 is further configured to enable the connection preemption mode by the bluetooth device if the bluetooth device does not execute the service of the first terminal device.
In one of the alternative embodiments, as shown in fig. 10, the apparatus further includes a receiving module 02;
the receiving module 02 is used for receiving a connection request sent by the second terminal device in the bluetooth device enabling connection mode;
the executing module 01 is further configured to, in response to the connection request, disconnect the bluetooth connection with the first terminal device and establish the bluetooth connection with the second terminal device.
In one optional embodiment, the executing module 01 is further configured to, if the bluetooth device is executing a service of the first terminal device, determine whether the first client has an associated device according to first associated device information of the first terminal device; and if the first terminal equipment has associated equipment, enabling the connection robbing mode by the Bluetooth equipment.
In one optional embodiment, the execution module 01 is further configured to disable the connection preemption mode by the bluetooth device if the first terminal device does not have an associated device.
In one optional embodiment, the receiving module 02 is further configured to receive a connection request sent by the second terminal device when the bluetooth device enables the connection preemption mode; the connection request comprises a device identification of the second terminal device;
the execution module 01 is further configured to determine whether the second terminal device is the associated device of the first terminal device according to the first associated device information of the first terminal device and the device identifier of the second terminal device included in the received connection request;
the executing module 01 is further configured to, if the second terminal device is a device associated with the first terminal device, respond to the connection request, disconnect the bluetooth connection with the first terminal device, and establish the bluetooth connection with the second terminal device.
In one optional embodiment, the receiving module 02 is further configured to receive the first associated device information sent by the first terminal device, when the bluetooth device is successfully connected with the first terminal device.
In an optional embodiment, the receiving module 02 is further configured to receive and store third associated device information sent by the first terminal device, where the third associated device information is used to indicate a change update of an associated device of the first terminal device.
In one optional embodiment, the receiving module 02 is further configured to receive second associated device information sent by the second terminal device after the bluetooth connection is established with the second terminal device.
In an optional embodiment, 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.
In an alternative embodiment, the execution module 01 is further configured to turn off a page scanning function of the bluetooth device, or prohibit the bluetooth device from responding to the connection request.
In an alternative embodiment, the execution module 01 is further configured to start a page scanning function of the bluetooth device, or enable the bluetooth device to respond to the connection request.
In one optional embodiment, the receiving module 02 is further configured to receive a connection request sent by the second terminal device when the bluetooth device enables the connection preemption mode;
the execution module 01 is further configured to determine whether the second terminal device is a terminal device that has been disconnected from the bluetooth device for the last time;
the executing module 01 is further configured to, if the second terminal device is not the terminal device that has been disconnected from the bluetooth device most recently, respond to the connection request, disconnect the bluetooth connection with the first terminal device, and establish the bluetooth connection with the second terminal device.
In one optional embodiment, the executing module 01 is further configured to, if the second terminal device is a terminal device that has been disconnected from the bluetooth device last time, obtain a time difference between a time of the last disconnection from the bluetooth device and a current time; if the time difference is larger than the time difference threshold value, responding to the connection request, disconnecting the Bluetooth connection with the first terminal equipment, and establishing the Bluetooth connection with the second terminal equipment; if the time difference is not greater than the time difference threshold, the connection request is not responded to.
In an optional embodiment, the first associated device information includes at least one of:
device information of the terminal device connected to the first terminal device;
device information of a terminal device of the same type as the first terminal device;
and the equipment information of the terminal equipment of the same account number with the first terminal equipment.
The division of each module in the device connection switching apparatus is merely used for illustration, and in other embodiments, the device connection switching apparatus may be divided into different modules as needed to complete all or part of the functions of the device connection switching apparatus.
For the specific limitation of the device connection switching apparatus, reference may be made to the above limitation on the device connection switching method, which is not described herein again. The respective modules in the above-described device connection switching apparatus may be wholly or partially implemented by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
Fig. 11 is a schematic diagram of an internal structure of an electronic device in one embodiment. The electronic device can be an intelligent electronic device comprising a Bluetooth module, for example, any terminal device such as a Bluetooth headset, a mobile phone, a tablet computer, a notebook computer, a desktop computer, a vehicle-mounted computer and a wearable device. The electronic device includes a processor and a memory connected by a system bus. The processor may include one or more processing units, among others. The processor may be a CPU (Central Processing Unit), a DSP (Digital Signal processor), or the like. 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 a processor to implement a device connection switching method provided in the following embodiments. The internal memory provides a cached execution environment for the operating system computer programs in the non-volatile storage medium.
The implementation of each module in the device connection switching apparatus provided in the embodiments of the present application may be in the form of a computer program. The computer program may be run on a terminal or a server. Program modules constituted by such computer programs may be stored on the memory of the electronic device. Which when executed by a processor, performs the steps of the method described in the embodiments of the present application.
The embodiment of the application also provides a computer readable storage medium. One or more non-transitory computer-readable storage media containing computer-executable instructions that, when executed by one or more processors, cause the processors to perform the steps of the device connection switching method.
Embodiments of the present application also provide a computer program product containing instructions that, when run on a computer, cause the computer to perform a device connection switching method.
Any reference to memory, storage, database, or other medium used herein may include non-volatile and/or volatile memory. The nonvolatile Memory may include a ROM (Read-Only Memory), a PROM (Programmable Read-Only Memory), an EPROM (Erasable Programmable Read-Only Memory), an EEPROM (Electrically Erasable Programmable Read-Only Memory), or a flash Memory. Volatile Memory can include RAM (Random Access Memory), which acts as 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 Random Access Memory), ESDRAM (Enhanced Synchronous Dynamic Random Access Memory), SLDRAM (Synchronous Link Dynamic Random Access Memory), RDRAM (Random Dynamic Random Access Memory), and DRmb DRAM (Dynamic Random Access Memory).
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (18)

1. A device connection switching method is applied to a Bluetooth device, and comprises the following steps:
under the condition of establishing Bluetooth connection with a first terminal device, if the Bluetooth device is executing the service of the first terminal device, the Bluetooth device forbids a connection robbing mode, and the Bluetooth device does not respond to a connection request sent by a second terminal device; the connection preemption mode represents that the second terminal device is allowed to preempt the Bluetooth connection between the Bluetooth device and the first terminal device.
2. The method of claim 1, further comprising:
and if the Bluetooth equipment does not execute the service of the first terminal equipment, enabling the connection preempting mode by the Bluetooth equipment.
3. The method of claim 2, further comprising:
receiving a connection request sent by the second terminal equipment under the condition that the Bluetooth equipment enables the connection preempting mode;
and responding to the connection request, disconnecting the Bluetooth connection with the first terminal equipment and establishing the Bluetooth connection with the second terminal equipment.
4. The method of claim 1, further comprising:
if the Bluetooth equipment is executing the service of the first terminal equipment, judging whether the first client has associated equipment according to first associated equipment information of the first terminal equipment;
and if the first terminal equipment has associated equipment, enabling the connection preempting mode by the Bluetooth equipment.
5. The method of claim 4, further comprising:
and if the first terminal equipment does not have associated equipment, the Bluetooth equipment forbids the connection robbing mode.
6. The method of claim 4, further comprising:
receiving a connection request sent by the second terminal equipment under the condition that the Bluetooth equipment enables the connection preempting mode; the connection request comprises a device identification of the second terminal device;
determining whether the second terminal equipment is the associated equipment of the first terminal equipment or not according to the first associated equipment information of the first terminal equipment and the equipment identifier of the second terminal equipment included in the received connection request;
and if the second terminal equipment is the associated equipment of the first terminal equipment, responding to the connection request, disconnecting the Bluetooth connection with the first terminal equipment and establishing the Bluetooth connection with the second terminal equipment.
7. The method according to claim 4 or 6, characterized in that the method further comprises:
and receiving the first associated device information sent by the first terminal device under the condition that the connection between the Bluetooth device and the first terminal device is successful.
8. The method according to claim 7, wherein after said receiving the first associated device information sent by the first terminal device, the method further comprises:
and receiving and storing third associated device information sent by the first terminal device, wherein the third associated device information is used for indicating the change update of the associated device of the first terminal device.
9. The method of claim 6, further comprising:
and after the Bluetooth connection with the second terminal equipment is established, receiving second associated equipment information sent by the second terminal equipment.
10. The method of claim 9, further comprising:
and replacing the first associated equipment information stored by the Bluetooth equipment with the second associated equipment information.
11. The method of claim 1, wherein disabling the preemptive connection mode by the Bluetooth device comprises:
and closing the paging scanning function of the Bluetooth equipment, or forbidding the Bluetooth equipment to respond to the connection request.
12. The method of claim 2, wherein the Bluetooth device enables the preemptive-connect mode, comprising:
and starting a paging scanning function of the Bluetooth device, or enabling the Bluetooth device to respond to a connection request.
13. The method of claim 2, further comprising:
under the condition that the Bluetooth equipment enables the connection preempting mode, receiving a connection request sent by the second terminal equipment;
judging whether the second terminal equipment is the terminal equipment which is disconnected with the Bluetooth equipment for the last time or not;
and if the second terminal equipment is not the terminal equipment which is disconnected with the Bluetooth equipment for the last time, responding to the connection request, disconnecting the Bluetooth connection with the first terminal equipment, and establishing the Bluetooth connection with the second terminal equipment.
14. The method of claim 13, further comprising:
if the second terminal equipment is the terminal equipment which is disconnected with the Bluetooth equipment for the last time, acquiring the time difference between the moment of disconnection with the Bluetooth equipment for the last time and the current moment;
if the time difference is larger than a time difference threshold value, responding to the connection request, disconnecting the Bluetooth connection with the first terminal device, and establishing the Bluetooth connection with the second terminal device;
and if the time difference is not larger than the time difference threshold value, not responding to the connection request.
15. The method according to any of claims 4-6, wherein the first associated device information comprises at least one of:
device information of the terminal device connected to the first terminal device;
device information of a terminal device of the same type as the first terminal device;
and the equipment information of the terminal equipment of the same account number as the first terminal equipment.
16. An apparatus connection switching device, comprising:
the execution module is used for controlling the Bluetooth equipment to be in a connection prohibition mode if the Bluetooth equipment is executing the service of the first terminal equipment under the condition of establishing Bluetooth connection with the first terminal equipment; the Bluetooth equipment forbids receiving a connection request sent by second terminal equipment in the connection-robbing-forbidding mode; the connection preemption mode represents that the second terminal device is allowed to preempt the Bluetooth connection between the Bluetooth device and the first terminal device.
17. An electronic device comprising a communication module, a memory and a processor, the memory having stored thereon a computer program, wherein the computer program, when executed by the processor, causes the processor to carry out the steps of the method according to any of claims 1 to 15.
18. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 15.
CN202111448807.8A 2021-11-30 2021-11-30 Device connection switching method and device, electronic device and computer readable storage medium Pending CN113938971A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202111448807.8A CN113938971A (en) 2021-11-30 2021-11-30 Device connection switching method and device, electronic device and computer readable storage medium
PCT/CN2022/119645 WO2023098233A1 (en) 2021-11-30 2022-09-19 Device connection switching method and apparatus, electronic device, and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111448807.8A CN113938971A (en) 2021-11-30 2021-11-30 Device connection switching method and device, electronic device and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN113938971A true CN113938971A (en) 2022-01-14

Family

ID=79288649

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111448807.8A Pending CN113938971A (en) 2021-11-30 2021-11-30 Device connection switching method and device, electronic device and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN113938971A (en)
WO (1) WO2023098233A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023098233A1 (en) * 2021-11-30 2023-06-08 Oppo广东移动通信有限公司 Device connection switching method and apparatus, electronic device, and computer readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190182878A1 (en) * 2016-08-18 2019-06-13 Huawei Technologies Co., Ltd. Bluetooth communication method and terminal
CN110191442A (en) * 2019-04-18 2019-08-30 华为技术有限公司 A kind of Bluetooth connecting method, equipment and system
CN113127190A (en) * 2019-12-31 2021-07-16 华为技术有限公司 Method for occupying equipment and electronic equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7826411B2 (en) * 2007-05-10 2010-11-02 Broadcom Corporation Cooperative transceiving between wireless interface devices of a host device with shared modules
CN113360108B (en) * 2020-03-05 2022-09-09 荣耀终端有限公司 Screen projection connection control method and electronic equipment
CN114125803A (en) * 2021-11-30 2022-03-01 Oppo广东移动通信有限公司 Device connection switching method and device, electronic device and computer readable storage medium
CN113938971A (en) * 2021-11-30 2022-01-14 Oppo广东移动通信有限公司 Device connection switching method and device, electronic device and computer readable storage medium
CN114040465A (en) * 2021-11-30 2022-02-11 Oppo广东移动通信有限公司 Device connection switching method and device, electronic device and computer readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190182878A1 (en) * 2016-08-18 2019-06-13 Huawei Technologies Co., Ltd. Bluetooth communication method and terminal
CN110191442A (en) * 2019-04-18 2019-08-30 华为技术有限公司 A kind of Bluetooth connecting method, equipment and system
CN113382397A (en) * 2019-04-18 2021-09-10 华为技术有限公司 Bluetooth connection method, equipment and system
CN113127190A (en) * 2019-12-31 2021-07-16 华为技术有限公司 Method for occupying equipment and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023098233A1 (en) * 2021-11-30 2023-06-08 Oppo广东移动通信有限公司 Device connection switching method and apparatus, electronic device, and computer readable storage medium

Also Published As

Publication number Publication date
WO2023098233A1 (en) 2023-06-08

Similar Documents

Publication Publication Date Title
CN114125803A (en) Device connection switching method and device, electronic device and computer readable storage medium
US11729594B2 (en) Network access method, device, and system
CN101340444B (en) Fireproof wall and server policy synchronization method, system and apparatus
WO2023098234A1 (en) Device connection switching method and apparatus, and electronic device and computer-readable storage medium
US20170141932A1 (en) Internet Access Traffic Sharing Method, Device and Terminal
US20050235019A1 (en) Method and system for transmitting data for data synchronization between server and client when data synchronization session was abnormally terminated
RU2632161C2 (en) Method and device for providing information
CN108781473B (en) Method and equipment for sharing files among different terminals
US11682922B2 (en) Contraband detection through smart power components
CN115086481B (en) Incoming call reminding method and electronic equipment
CN105916100A (en) Heartbeat packet agency method, device and communication system
WO2016082656A1 (en) Method and device for mobile terminal to select a resident cell
CN106488534B (en) Method and system for acquiring network access point
CN111405627A (en) Network switching method and device of mobile terminal, electronic equipment and storage medium
CN113938971A (en) Device connection switching method and device, electronic device and computer readable storage medium
CN110336794B (en) Intranet access method, system and related device
WO2017219587A1 (en) Master-slave device switching method, slave device, management server, and storage medium
US20200245121A1 (en) Mobile-initiated sms cell broadcast
CN113452770B (en) Data synchronization method, device, computer equipment and storage medium
CN112866984B (en) Call record synchronization method, cloud platform and terminal
CN108712280B (en) Network function management method and device, storage medium and intelligent terminal
US20230096372A1 (en) Localized authorization for secure communication
CN110324826B (en) Intranet access method and related device
CN108076009B (en) Resource sharing method, device and system
CN111246404A (en) Method and device for processing verification code short message

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination