Bluetooth automatic switching method and system, electronic equipment and storage medium
Through intelligent control algorithms and state machine management, the in-vehicle Bluetooth device automatically switches to connect to the terminal device, solving the problem of cumbersome switching of Bluetooth devices on the vehicle's infotainment system. This achieves fast and seamless device connection, improving user experience and driving safety.
Patent Information
- Application Number
- CN202511693610.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-18
- Publication Date
- 2026-02-13
AI Technical Summary
When multiple Bluetooth devices are connected to the vehicle's infotainment system at the same time, users need to manually disconnect and reconnect, which affects ease of use and driving safety, and makes it impossible to effectively control the switching of audio output devices.
It employs intelligent control algorithms to achieve automatic pairing and connection management between in-vehicle Bluetooth devices and multiple terminal devices, manages audio playback status through a state machine, supports differential processing between iOS and Android systems, establishes Bluetooth connections using the A2DP protocol, and automatically switches between valid connected devices.
It enables fast and seamless connection when playing songs on different terminal devices, improving user experience and driving safety, avoiding complicated manual operation steps, and ensuring the continuity of audio entertainment and the flexibility of the device.
Smart Images

Figure CN121531489A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent driving technology, and in particular to a Bluetooth automatic switching method, system, electronic device, and storage medium. Background Technology
[0002] In modern life, Bluetooth technology is widely used, especially in in-vehicle infotainment systems. Many users face the problem that when multiple devices are connected to their in-vehicle system simultaneously, they often need to manually disconnect and reconnect Bluetooth devices to switch between different phones playing music. This operation is not only cumbersome but also seriously affects user experience and driving safety. During the Bluetooth connection process in in-vehicle systems, the original Bluetooth protocol typically only supports one mobile Bluetooth device connection. When users want to quickly switch playback devices, they must first disconnect the currently connected device and connect the new one, completing the process through multiple steps, impacting usability. Many in-vehicle systems now modify their native Bluetooth code to support two mobile Bluetooth devices. While this eliminates the Bluetooth connection process, it also makes it difficult to control the current audio output device when switching audio between the two phones. Summary of the Invention
[0003] To address the aforementioned technical problems, this invention proposes a Bluetooth automatic switching method, system, electronic device, and storage medium. Through an intelligent control algorithm, it automatically switches to the corresponding in-vehicle Bluetooth device when playing songs on different terminals (mobile phones, tablets, etc.), achieving fast and seamless device connection and solving the connection management problem for users using multiple Bluetooth devices. The technical solution adopted by this invention is as follows.
[0004] A Bluetooth automatic switching method, applied to an in-vehicle Bluetooth device, the method comprising: In response to receiving a Bluetooth pairing request from a terminal device, a Bluetooth pairing relationship is established with the terminal device; the terminal device can establish a Bluetooth pairing relationship with at least one terminal device at the same time. Upon receiving a playback request from any of the aforementioned terminal devices, the terminal device that sent the playback request is determined to be a valid connection device. Establish a Bluetooth connection with the valid connected device; the in-vehicle Bluetooth device can establish a Bluetooth connection with at most one terminal device at the same time. If it is detected that the validly connected device is not playing audio, and a playback request is received from another terminal device, the validly connected device will be changed to the other terminal device.
[0005] Furthermore, upon receiving a playback request from any of the terminal devices, the method further includes: Determine the connection status between the terminal device that sent the playback request and the in-vehicle Bluetooth device; When the terminal device that sends the playback request is connected to the vehicle Bluetooth device via Bluetooth, a playback command is sent to the vehicle playback device in the current vehicle so that the vehicle playback device plays the playback content corresponding to the playback request. If the terminal device sending the playback request and the vehicle Bluetooth device are only paired via Bluetooth, determine whether the vehicle Bluetooth device has established a Bluetooth connection with other terminal devices. If the vehicle Bluetooth device has not established a Bluetooth connection with other terminal devices, determine the terminal device sending the playback request as a valid connected device. If the vehicle Bluetooth device has established a Bluetooth connection with other terminal devices, determine the playback status of the vehicle playback device. If the vehicle playback device is in playback mode, do not execute the playback request. If the vehicle playback device is not in playback mode, disconnect the current Bluetooth connection and determine the terminal device sending the playback request as a valid connected device.
[0006] Furthermore, after establishing a Bluetooth pairing relationship with the terminal device, the method further includes: A state machine corresponding to the terminal device is established; the state machine is used to manage the audio playback state of the terminal device; when the terminal device establishes a Bluetooth connection with the vehicle Bluetooth device and is playing audio, the corresponding state machine marks the state of the terminal device as playing.
[0007] Furthermore, after establishing a Bluetooth pairing relationship with the terminal device, the method further includes: Determine the system type of the terminal device; the system type includes: iOS system and Android system.
[0008] Furthermore, the method also includes: When it is determined that the system type of the terminal device with the status marked as "playing" is Android, the state of the terminal device with the status marked as "playing" is updated to true through the state machine corresponding to the terminal device with the status marked as "playing". It is then determined whether the playback content of the in-vehicle playback device is consistent with the playback content of the terminal device with the status marked as "true". If they are inconsistent, a new Bluetooth connection is established with the terminal device with the status marked as "true".
[0009] Furthermore, if the playback content of the in-vehicle playback device is consistent with the playback content of the terminal device whose status is marked as true, then it is determined whether there are other terminal devices that have established a Bluetooth pairing relationship with the in-vehicle Bluetooth device; if so, a playback pause command is sent to the other terminal devices.
[0010] Furthermore, establishing a Bluetooth connection includes: Establish a Bluetooth connection via the A2DP protocol.
[0011] Furthermore, the playback request is sent automatically when the terminal device plays audio.
[0012] A non-transitory computer-readable storage medium storing at least one instruction or at least one program segment, the at least one instruction or the at least one program segment being loaded and executed by a processor to implement the aforementioned method.
[0013] An electronic device includes a processor and the aforementioned non-transitory computer-readable storage medium.
[0014] The present invention has at least the following beneficial effects: This invention utilizes intelligent control algorithms to provide users with a high-quality audio entertainment experience, ensuring safety while enjoying music while driving. It supports connection to multiple Bluetooth devices on the vehicle's infotainment system, allowing users to easily play audio from mobile devices and other terminals to the vehicle's system. Simultaneously, the vehicle's system maintains connectivity with other terminals and can display real-time information about the currently playing song, including song title, artist, and album art, enhancing the user's audio entertainment experience. It automatically switches to the appropriate in-vehicle Bluetooth device when playing songs on different terminals, achieving fast and seamless device connection without complex manual Bluetooth switching procedures or disconnection, significantly improving the user experience. It solves the inconveniences of traditional Bluetooth connections, significantly improving the practicality and flexibility of Bluetooth playback, allowing users to focus more on road conditions while driving rather than being distracted by device connectivity issues, thus enhancing driving safety. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 A flowchart of a Bluetooth automatic switching method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the user-side audio playback process during Bluetooth automatic switching, provided by an embodiment of the present invention. Figure 3 This is a schematic diagram of a device state switching process in Bluetooth automatic switching provided by an embodiment of the present invention; Figure 4 This is a structural diagram of a Bluetooth automatic switching system provided in an embodiment of the present invention. Detailed Implementation
[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0018] This invention provides an embodiment of a Bluetooth automatic switching method, such as... Figure 1 As shown, it is applied to in-vehicle Bluetooth devices, including: S01: In response to receiving a Bluetooth pairing request from a terminal device, establish a Bluetooth pairing relationship with the terminal device; the terminal device can establish a Bluetooth pairing relationship with at least one terminal device at the same time; S02: Upon receiving a playback request from any of the terminal devices, the terminal device that sent the playback request is determined as a valid connection device; S03: Establish a Bluetooth connection with the effective connected device; the vehicle Bluetooth device can establish a Bluetooth connection with at most one terminal device at the same time. S04: If it is detected that the validly connected device is not playing audio, and a playback request is received from another terminal device, the validly connected device is changed to the other terminal device.
[0019] Figure 1The embodiment first controls the in-vehicle Bluetooth device to establish a Bluetooth pairing relationship with the terminal device to which a Bluetooth connection needs to be established. In the initial state, that is, when the in-vehicle Bluetooth device is started, according to the pairing requests of its surrounding devices, the in-vehicle Bluetooth device can establish a Bluetooth pairing relationship with at least one terminal device. Then, when any terminal device sends a playback request, a Bluetooth connection is established with the corresponding terminal device, so that the in-vehicle playback device automatically plays the content played by the corresponding terminal device. When the corresponding terminal device pauses playback, the in-vehicle playback device pauses synchronously until the corresponding terminal device resumes playback or receives a playback request from another terminal device. When the corresponding terminal device loses power or there is other interference that interferes with the Bluetooth connection, the connection with the in-vehicle Bluetooth device will be automatically disconnected. When the effective connected device, that is, the terminal device currently connected to the in-vehicle Bluetooth device, is not playing audio, and at this time another terminal device sends a playback request, the effective connected device is changed to the terminal device currently sending the playback request, so that the terminal device establishes a Bluetooth connection with the in-vehicle Bluetooth device.
[0020] Figure 1 The embodiments described above utilize intelligent control algorithms to provide users with a high-quality audio entertainment experience, ensuring safety while enjoying music while driving. They support connection to multiple Bluetooth devices on the vehicle's infotainment system, allowing users to easily play audio from mobile devices and other terminals to the vehicle's system. Simultaneously, the vehicle's system maintains connectivity with other terminals and can display real-time information about the currently playing song, including song title, artist, and album art, enhancing the user's audio entertainment experience. The system automatically switches to the appropriate in-vehicle Bluetooth device when playing songs on different terminals, achieving fast and seamless device connection without complex manual Bluetooth switching procedures or disconnection, significantly improving the user experience. It solves the inconveniences of traditional Bluetooth connections, significantly improving the practicality and flexibility of Bluetooth playback, allowing users to focus more on road conditions while driving rather than being distracted by device connectivity issues, thus enhancing driving safety.
[0021] In one embodiment, upon receiving a playback request from any of the terminal devices, the method further includes: Determine the connection status between the terminal device that sent the playback request and the in-vehicle Bluetooth device; When the terminal device that sends the playback request is connected to the vehicle Bluetooth device via Bluetooth, a playback command is sent to the vehicle playback device in the current vehicle so that the vehicle playback device plays the playback content corresponding to the playback request. If the terminal device sending the playback request and the vehicle Bluetooth device are only paired via Bluetooth, determine whether the vehicle Bluetooth device has established a Bluetooth connection with other terminal devices. If the vehicle Bluetooth device has not established a Bluetooth connection with other terminal devices, determine the terminal device sending the playback request as a valid connected device. If the vehicle Bluetooth device has established a Bluetooth connection with other terminal devices, determine the playback status of the vehicle playback device. If the vehicle playback device is in playback mode, do not execute the playback request. If the vehicle playback device is not in playback mode, disconnect the current Bluetooth connection and determine the terminal device sending the playback request as a valid connected device.
[0022] The above embodiment further details the process of determining a valid connected device. When the vehicle Bluetooth device receives a playback request from any terminal device, it first determines the connection status between itself and the terminal device that sent the playback request. If it is in a Bluetooth connection status, it can be determined that the terminal device that sent the playback request has been determined as a valid connected device. If the playback request is resent to the vehicle Bluetooth device due to reasons such as playback pause, a playback command is directly sent to the vehicle's in-vehicle playback device so that the in-vehicle playback device plays the playback content corresponding to the playback request. If the connection status is only a Bluetooth pairing relationship, it can be determined that the terminal device currently sending the playback request is not a currently valid connected device. At this time, the in-vehicle Bluetooth device determines whether a Bluetooth connection has been established with other terminal devices. If not, the terminal device currently sending the playback request is determined to be a valid connected device, and a Bluetooth connection is automatically established with it so that the in-vehicle playback device can automatically play the corresponding content. If so, it needs to determine whether the in-vehicle playback device is currently playing content played by a currently valid connected device. If not, the current Bluetooth connection is automatically disconnected, and the terminal device currently sending the playback request is determined to be a valid connected device, and a Bluetooth connection is automatically established with it so that the in-vehicle playback device can automatically play the corresponding content. If so, the received playback request is not executed, and the current state is maintained to ensure the user's audio entertainment experience.
[0023] In one embodiment, after establishing a Bluetooth pairing relationship with the terminal device, the method further includes: A state machine corresponding to the terminal device is established; the state machine is used to manage the audio playback state of the terminal device; when the terminal device establishes a Bluetooth connection with the vehicle Bluetooth device and is playing audio, the corresponding state machine marks the state of the terminal device as playing.
[0024] In one embodiment, after establishing a Bluetooth pairing relationship with the terminal device, the method further includes: Determine the system type of the terminal device; the system type includes: iOS system and Android system.
[0025] In one embodiment, the method further includes: When it is determined that the system type of the terminal device with the status marked as "playing" is Android, the state of the terminal device with the status marked as "playing" is updated to true through the state machine corresponding to the terminal device with the status marked as "playing". It is then determined whether the playback content of the in-vehicle playback device is consistent with the playback content of the terminal device with the status marked as "true". If they are inconsistent, a new Bluetooth connection is established with the terminal device with the status marked as "true".
[0026] In one embodiment, if the playback content of the in-vehicle playback device is consistent with the playback content of a terminal device whose status is marked as true, then it is determined whether there are other terminal devices that have established a Bluetooth pairing relationship with the in-vehicle Bluetooth device; if so, a playback pause command is sent to the other terminal devices.
[0027] The above embodiments are designed with different algorithm logics to address the differences between iOS and Android systems. For iOS, once a Bluetooth connection is established with the in-vehicle Bluetooth device, playback requests from other terminal devices are no longer processed. For Android, some applications (such as WeChat) use the native MediaPlayer component to play audio, which has the problem of instantaneous state changes. This may lead to inaccurate state switching. If the logic of iOS is followed, the Bluetooth connection will be switched incorrectly when receiving brief pause and play signals. Therefore, a true state tag is introduced, and a process is added to track whether the content played by the in-vehicle playback device is consistent with the content played by the terminal device with the state tag of true, so as to ensure that the currently playing audio is not interrupted or paused, which affects the user experience.
[0028] The method for determining whether the playback content of the in-vehicle playback device is consistent with the playback content of the target terminal device whose status is marked as true includes: comparing whether the playback progress bar of the in-vehicle playback device is consistent with the playback progress bar of the terminal device whose status has been updated to true.
[0029] In one embodiment, establishing a Bluetooth connection includes: Bluetooth connections are established via the A2DP protocol. This embodiment designs a new algorithm based on the original Bluetooth protocol, supporting connections between multiple in-vehicle Bluetooth devices and multiple terminal devices. The connection includes establishing a Bluetooth pairing relationship and establishing a Bluetooth connection, where establishing a Bluetooth pairing relationship is a prerequisite for establishing a Bluetooth connection.
[0030] In one embodiment, the playback request is sent automatically when the terminal device plays audio. This embodiment automates the Bluetooth switching process, avoiding manual operation and fully automating the process of playing audio from the terminal device on the in-vehicle system, further improving the user experience and ensuring driving safety.
[0031] To further illustrate the method described in this invention, an embodiment of this invention provides a schematic diagram of the user-side audio playback process during Bluetooth automatic switching, as shown below. Figure 2 The above includes: Assuming the in-vehicle Bluetooth device has established a Bluetooth pairing relationship with devices A and B via the A2DP protocol, and the device that has established a Bluetooth connection with the in-vehicle Bluetooth device is defined as the valid connected device on the vehicle's infotainment system, then when device A is the valid connected device on the vehicle's infotainment system, if device A is playing audio, the vehicle's music interface will be playing and will display information corresponding to the content played by device A, including the music title, artist, album art, and playback progress, unaffected by device B. If playback on device A is paused, the vehicle's music interface will be paused, unaffected by device B, unless device B plays audio. When device B is the valid connected device on the vehicle's infotainment system and device B is playing audio, if device A is playing, the vehicle's music interface will continue to display information corresponding to the content played by device B, unaffected by device A. When device B is the valid connected device on the vehicle's infotainment system and device B is not playing audio, if device A is playing, the vehicle's music interface will switch to display information corresponding to the content played by device A, unaffected by device B, unless playback on device A is paused and device B is playing audio.
[0032] To further illustrate the method described in this invention, an embodiment of this invention provides a schematic diagram of a device state switching process during Bluetooth automatic switching, as shown below. Figure 3 As shown, it includes: Assuming the in-vehicle Bluetooth device has established a Bluetooth pairing relationship with devices A and B via the A2DP protocol, and the device that has established a Bluetooth connection with the in-vehicle Bluetooth device is identified as the valid connected device on the vehicle's infotainment system, then when device A is a valid connected device on the vehicle's infotainment system, it is determined whether device A is playing audio. If so, device A is in a playing state on the vehicle's infotainment system, and device B is in a paused state. If playback on device A is paused at this time, the music interface on the vehicle's infotainment system will change to paused, and the state of device B will remain unchanged. If device A is not playing audio, both device A and device B are in a paused state on the vehicle's infotainment system. If device B plays audio at this time, the vehicle's infotainment system will receive a playback request from device B, and the state of device B on the vehicle's infotainment system will change accordingly. When device A is playing audio, the car's music interface changes to play, while device B's status remains unchanged. When device B is in play mode, the car's system receives playback progress updates from device B. The playback progress bar on device B changes as the system monitors these updates. If device B is in play mode, the system checks if device B is the currently active connected device. If so, it sends a pause command to device A; otherwise, it switches the active connected device to device B, displays relevant playback information based on device B's current progress bar, sends a pause command to device A, and sends a play command to device B, so that the in-vehicle playback device plays the corresponding audio at the current playback progress of device B.
[0033] Based on the aforementioned assumptions, when device B is a validly connected device on the vehicle's infotainment system, it is determined whether device B is playing audio. If so, device B's status on the vehicle's infotainment system is "playing," and device A's status is "paused." If playback on device B is paused, the music interface on the vehicle's infotainment system changes to "paused," while device A's status remains unchanged. If device B is not playing audio, both device A and device B are in a paused state on the vehicle's infotainment system. If device A plays audio, the vehicle's infotainment system receives a playback request from device A, and device A's status on the vehicle's infotainment system changes to "playing." If device B plays audio, the music interface on the vehicle's infotainment system changes to "playing." Device A's status remains unchanged. When device A in the vehicle's infotainment system is in playback mode, the system receives changes in the playback progress of device A. At this time, the playback progress bar in device A's status changes. While the progress bar changes, the system determines whether the currently connected device in the vehicle is device A. If it is, a pause command is sent to device B. Otherwise, the system switches the currently connected device to device A, displays relevant playback information based on the current progress bar of device A, and sends a pause command to device B and a play command to device A, so that the in-vehicle playback device plays the corresponding audio at the current playback progress of device A.
[0034] The states of the aforementioned in-vehicle infotainment devices A and B are determined and modified by their respective state machines based on the actual playback or pause status. Sending a pause command to device A or device B informs them that they are no longer a valid connected device to the in-vehicle infotainment system, and the corresponding in-vehicle playback device will not play their content. However, this does not affect the independent playback of audio by device A or device B, nor does it affect their individual audio applicability. As long as they maintain a Bluetooth pairing relationship with the in-vehicle Bluetooth device, their corresponding state will be tracked and recorded in real time to ensure seamless playback of the corresponding audio through the in-vehicle playback device when they become a valid connected device to the in-vehicle infotainment system.
[0035] The present invention also provides an embodiment of a Bluetooth automatic switching system, applied to in-vehicle Bluetooth devices, such as... Figure 4 The following are included: Bluetooth pairing module 41, in response to receiving a Bluetooth pairing request sent by a terminal device, establishes a Bluetooth pairing relationship with the terminal device; the terminal device can establish a Bluetooth pairing relationship with at least one terminal device at the same time; The valid device determination module 42 is used to determine the terminal device that sends the playback request as a valid connection device when a playback request is received from any of the terminal devices. Bluetooth connection module 43 is used to establish a Bluetooth connection with the effective connected device; the vehicle Bluetooth device can establish a Bluetooth connection with at most one terminal device at the same time; The effective device switching module 44 is used to change the effective connected device to the other terminal device when it is detected that the effective connected device is not playing audio and a playback request is received from the other terminal device.
[0036] In one embodiment, upon receiving a playback request from any of the terminal devices, the valid device determination module 42 is further configured to: Determine the connection status between the terminal device that sent the playback request and the in-vehicle Bluetooth device; When the terminal device that sends the playback request is connected to the vehicle Bluetooth device via Bluetooth, a playback command is sent to the vehicle playback device in the current vehicle so that the vehicle playback device plays the playback content corresponding to the playback request. If the terminal device sending the playback request and the vehicle Bluetooth device are only paired via Bluetooth, determine whether the vehicle Bluetooth device has established a Bluetooth connection with other terminal devices. If the vehicle Bluetooth device has not established a Bluetooth connection with other terminal devices, determine the terminal device sending the playback request as a valid connected device. If the vehicle Bluetooth device has established a Bluetooth connection with other terminal devices, determine the playback status of the vehicle playback device. If the vehicle playback device is in playback mode, do not execute the playback request. If the vehicle playback device is not in playback mode, disconnect the current Bluetooth connection and determine the terminal device sending the playback request as a valid connected device.
[0037] In one embodiment, after establishing a Bluetooth pairing relationship with the terminal device, the Bluetooth pairing module 41 is further configured to: A state machine corresponding to the terminal device is established; the state machine is used to manage the audio playback state of the terminal device; when the terminal device establishes a Bluetooth connection with the vehicle Bluetooth device and is playing audio, the corresponding state machine marks the state of the terminal device as playing.
[0038] In one embodiment, after establishing a Bluetooth pairing relationship with the terminal device, the Bluetooth pairing module 41 is further configured to: Determine the system type of the terminal device; the system type includes: iOS system and Android system.
[0039] In one embodiment, the system further includes a status flag module for: When it is determined that the system type of the terminal device with the status marked as "playing" is Android, the state of the terminal device with the status marked as "playing" is updated to true through the state machine corresponding to the terminal device with the status marked as "playing". It is then determined whether the playback content of the in-vehicle playback device is consistent with the playback content of the terminal device with the status marked as "true". If they are inconsistent, a new Bluetooth connection is established with the terminal device with the status marked as "true".
[0040] In one embodiment, the status marking module is further configured to: if the playback content of the in-vehicle playback device is consistent with the playback content of the terminal device with the status marking as true, determine whether there are other terminal devices that have established a Bluetooth pairing relationship with the in-vehicle Bluetooth device; if so, send a playback pause command to the other terminal devices.
[0041] In one embodiment, establishing a Bluetooth connection includes: Establish a Bluetooth connection via the A2DP protocol.
[0042] Figure 4 The embodiment is as follows: Figure 1 The system implementation corresponding to the method implementation is described above. Figure 4 The implementation process and technical effects of the embodiments are as follows: Figure 1 The embodiments described are similar, therefore, for Figure 4 The description of the embodiments is relatively simple; please refer to relevant details. Figure 1 The embodiment described above.
[0043] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.
[0044] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0045] In an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.
[0046] Those skilled in the art will understand that various aspects of this application can be implemented as a system, method, or program product. Therefore, various aspects of this application can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, collectively referred to herein as a "circuit," "module," or "system."
[0047] An electronic device according to this embodiment of the present application. The electronic device is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of this application.
[0048] Electronic devices are manifested in the form of general-purpose computing devices. Components of an electronic device may include, but are not limited to: at least one processor, at least one memory, and buses connecting different system components (including memory and processor).
[0049] The storage device stores program code that can be executed by the processor to perform the steps described in the "Exemplary Methods" section above, according to various exemplary embodiments of this application.
[0050] The storage may include readable media in the form of volatile storage, such as random access memory (RAM) and / or cache memory, and may further include read-only memory (ROM).
[0051] The storage may also include programs / utilities having a set (at least one) of program modules, including but not limited to: an operating system, one or more applications, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0052] A bus can represent one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus that uses any of the various bus architectures.
[0053] The electronic device can also communicate with one or more external devices (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a user to interact with the electronic device, and / or any device that enables the electronic device to communicate with one or more other computing devices (e.g., routers, modems, etc.). This communication can be performed via input / output (I / O) interfaces. Furthermore, the electronic device can communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter. The network adapter communicates with other modules of the electronic device via a bus. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0054] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0055] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible implementations, various aspects of this application may also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of this application described in the "Exemplary Methods" section above.
[0056] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0057] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0058] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0059] Program code for performing the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0060] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of this application, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0061] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0062] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A Bluetooth automatic switching method, applied to in-vehicle Bluetooth devices, characterized in that, The method includes: In response to receiving a Bluetooth pairing request from a terminal device, a Bluetooth pairing relationship is established with the terminal device; the terminal device can establish a Bluetooth pairing relationship with at least one terminal device at the same time. Upon receiving a playback request from any of the aforementioned terminal devices, the terminal device that sent the playback request is determined to be a valid connection device. Establish a Bluetooth connection with the valid connected device; the vehicle Bluetooth device can establish a Bluetooth connection with at most one terminal device at a time. If it is detected that the validly connected device is not playing audio, and a playback request is received from another terminal device, the validly connected device will be changed to the other terminal device.
2. The method according to claim 1, characterized in that, Upon receiving a playback request from any of the terminal devices, the method further includes: Determine the connection status between the terminal device that sent the playback request and the in-vehicle Bluetooth device; When the terminal device that sends the playback request is connected to the vehicle Bluetooth device via Bluetooth, a playback command is sent to the vehicle playback device in the current vehicle so that the vehicle playback device plays the playback content corresponding to the playback request. If the terminal device sending the playback request and the vehicle Bluetooth device are only paired via Bluetooth, determine whether the vehicle Bluetooth device has established a Bluetooth connection with other terminal devices. If the vehicle Bluetooth device has not established a Bluetooth connection with other terminal devices, determine the terminal device sending the playback request as a valid connected device. If the vehicle Bluetooth device has established a Bluetooth connection with other terminal devices, determine the playback status of the vehicle playback device. If the vehicle playback device is in playback mode, do not execute the playback request. If the vehicle playback device is not in playback mode, disconnect the current Bluetooth connection and determine the terminal device sending the playback request as a valid connected device.
3. The method according to claim 2, characterized in that, After establishing a Bluetooth pairing relationship with the terminal device, the method further includes: A state machine corresponding to the terminal device is established; the state machine is used to manage the audio playback state of the terminal device; when the terminal device establishes a Bluetooth connection with the vehicle Bluetooth device and is playing audio, the corresponding state machine marks the state of the terminal device as playing.
4. The method according to claim 3, characterized in that, After establishing a Bluetooth pairing relationship with the terminal device, the method further includes: Determine the system type of the terminal device; the system type includes: iOS system and Android system.
5. The method according to claim 4, characterized in that, The method further includes: When it is determined that the system type of the terminal device with the status marked as "playing" is Android, the state of the terminal device with the status marked as "playing" is updated to true through the state machine corresponding to the terminal device with the status marked as "playing". It is then determined whether the playback content of the in-vehicle playback device is consistent with the playback content of the terminal device with the status marked as "true". If they are inconsistent, a new Bluetooth connection is established with the terminal device with the status marked as "true".
6. The method according to claim 5, characterized in that, If the playback content of the in-vehicle playback device is consistent with the playback content of the terminal device with the status flag set to true, then it is determined whether there are other terminal devices that have established a Bluetooth pairing relationship with the in-vehicle Bluetooth device; if so, a playback pause command is sent to the other terminal devices.
7. The method according to any one of claims 1-6, characterized in that, Establishing a Bluetooth connection includes: Establish a Bluetooth connection via the A2DP protocol.
8. The method according to claim 7, wherein the playback request is sent automatically when the terminal device plays audio.
9. A non-transitory computer-readable storage medium storing at least one instruction or at least one program segment, said at least one instruction or said at least one program segment being loaded and executed by a processor to implement the method of any one of claims 1-8.
10. An electronic device, characterized in that, Includes a processor and a non-transitory computer-readable storage medium as described in claim 9.