CN116419359B - Bluetooth control method and device - Google Patents

Bluetooth control method and device Download PDF

Info

Publication number
CN116419359B
CN116419359B CN202310678121.0A CN202310678121A CN116419359B CN 116419359 B CN116419359 B CN 116419359B CN 202310678121 A CN202310678121 A CN 202310678121A CN 116419359 B CN116419359 B CN 116419359B
Authority
CN
China
Prior art keywords
connection mode
bluetooth
application
electronic device
foreground
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.)
Active
Application number
CN202310678121.0A
Other languages
Chinese (zh)
Other versions
CN116419359A (en
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.)
Honor Device Co Ltd
Original Assignee
Honor Device Co 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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202310678121.0A priority Critical patent/CN116419359B/en
Publication of CN116419359A publication Critical patent/CN116419359A/en
Application granted granted Critical
Publication of CN116419359B publication Critical patent/CN116419359B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W36/00Hand-off or reselection arrangements
    • H04W36/24Reselection being triggered by specific parameters
    • H04W36/26Reselection being triggered by specific parameters by agreed or negotiated communication parameters
    • H04W36/28Reselection being triggered by specific parameters by agreed or negotiated communication parameters involving a plurality of connections, e.g. multi-call or multi-bearer connections
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The present application relates to the field of terminal technologies, and in particular, to a bluetooth control method and apparatus. The Bluetooth control method is applied to a Bluetooth module of the first electronic device, and comprises the following steps: and under the condition that the Bluetooth connection is established with the first Bluetooth device and is in the first connection mode, monitoring the switching condition of the foreground application. And after detecting that the foreground application is switched into the target playing application, exiting the first connection mode and entering the second connection mode. Because the data transmission efficiency of the first electronic equipment and the first Bluetooth equipment in the second connection mode is higher than that of the first connection mode, after a user starts to play the audio and video, the playing time delay of the first Bluetooth equipment is reduced, and the problem that the first Bluetooth equipment sounds slowly is solved.

Description

Bluetooth control method and device
Technical Field
The present application relates to the field of terminal technologies, and in particular, to a bluetooth control method and apparatus.
Background
With the continuous maturity of bluetooth technology, users use bluetooth devices (such as bluetooth headphones and bluetooth sound) in increasingly abundant scenes, such as watching audio and video, making and receiving calls, answering messages, etc. However, users often find such problems in the above usage scenarios: namely, after the audio and video of the main equipment starts to play, the Bluetooth equipment cannot synchronize the sound, but has time delay of a few seconds, and the user experience is poor.
Disclosure of Invention
The application provides a Bluetooth control method and Bluetooth control equipment, which are used for improving the problem of slow sounding of Bluetooth equipment in a scene that the electronic equipment is connected with the Bluetooth equipment.
In a first aspect, the present technical solution provides a bluetooth control method, applied to a bluetooth module of a first electronic device, where the first electronic device and the first bluetooth device are in a bluetooth connection state, where the bluetooth control method includes: in a first connection mode, monitoring a foreground application switching condition; detecting that the foreground application is switched to the target application, and entering a second connection mode; the data transmission frequency between the first electronic device and the first Bluetooth device in the second connection mode is higher than that in the first connection mode.
According to the Bluetooth control method provided by the technical scheme, a plurality of play type applications can be designated as target applications in advance, further, when the play type applications are in a first connection state with Bluetooth equipment, the switching condition of a foreground application can be detected, and after the foreground application is switched to any one target application, the first connection mode can be switched to a second connection mode immediately. Because the foreground application is switched to the target application, the user does not start playing the audio and video, and therefore, the switching from the first connection mode to the second connection mode is executed at this time, and the playing delay on the Bluetooth equipment side of the electronic equipment can be prevented after the user starts playing the audio and video; moreover, since the user already enters the user interface of the target user at this time, there is a high probability that the audio and video will be played, and switching to the second connection mode at this time can also prevent unnecessary power consumption of the device from increasing.
With reference to the first aspect, in some implementation manners of the first aspect, in a first connection mode, monitoring a foreground application switching situation includes: and in the first connection mode, receiving a first notification message sent by the monitoring module.
With reference to the first aspect, in some implementations of the first aspect, the first notification message is used to indicate the switched foreground application as the target application.
In this implementation manner, the monitoring module may identify a handover situation of the foreground application, and further identify, after identifying that the foreground application is handed over, whether the foreground application after the handover is a target application. And the monitoring module sends a corresponding notification message to the Bluetooth module only when the switched foreground application is the target application. Based on the implementation manner, the Bluetooth module can avoid judging whether the foreground application after the switching is the target application.
With reference to the first aspect, in certain implementation manners of the first aspect, the first notification message is used to indicate first identification information of the foreground application after the handover.
In this implementation manner, the monitoring module may identify a switching situation of the foreground application, and after identifying that the foreground application is switched, send a corresponding notification message to the bluetooth module. Further, the bluetooth module may identify whether the switched foreground application is the target application based on the notification message. Based on the implementation manner, the bluetooth module can execute the judgment of whether the foreground application after the switching is the target application.
With reference to the first aspect, in certain implementation manners of the first aspect, detecting that the foreground application is switched to the target application includes: identifying the switched foreground application according to the first identification information; and determining the switched foreground application as a target application according to the identification result.
With reference to the first aspect, in some implementation manners of the first aspect, identifying, according to the first identification information, a foreground application after switching includes: acquiring a first configuration file, wherein second identification information of at least one target application is pre-stored in the first configuration file; and comparing the second identification information with the first identification information.
In the implementation manner, the package name of the target application can be opened based on the configuration file, so that the target application can be flexibly specified according to actual requirements, and the connection mode can be switched based on the service state of the first electronic equipment.
With reference to the first aspect, in certain implementation manners of the first aspect, after entering the second connection mode, the method further includes: determining that media streams to be sent do not exist in a preset duration; the first connection mode is re-entered.
With reference to the first aspect, in certain implementation manners of the first aspect, determining that there is no media stream to be sent within a preset duration includes: detecting that no media stream to be sent exists, and starting a target timer; and determining that the media stream to be sent does not exist in the timing duration of the target timer.
In the implementation manner, under the condition that the user does not exit the application interface of the target application, the user can reenter the first connection mode after stopping playing the audio and video and the stopping time exceeds the set time threshold, so that the power consumption of the device is saved.
With reference to the first aspect, in certain implementation manners of the first aspect, after entering the second connection mode, the method further includes: detecting a media stream to be sent in response to the target application exiting the foreground; determining that no media stream to be transmitted exists currently; the first connection mode is re-entered.
In the implementation manner, under the condition that the user exits from the application interface of the target application, the user can immediately enter the first connection mode after stopping playing the audio and video, so that the power consumption of the equipment is saved.
With reference to the first aspect, in certain implementations of the first aspect, entering the second connection mode includes: sending a first indication message to a Bluetooth chip of the first electronic device, wherein the first indication message is used for enabling the Bluetooth chip to enter a second connection mode; re-entering the first connection mode, comprising: and sending a second indication message to the Bluetooth chip, wherein the second indication message is used for enabling the Bluetooth chip to enter the first connection mode.
In a second aspect, the present technical solution provides an electronic device, including: and the detection unit is used for monitoring the application switching condition of the foreground under the first connection mode. And the execution unit is used for entering a second connection mode after detecting that the foreground application is switched to the target application. The data transmission frequency between the first electronic device and the first Bluetooth device in the second connection mode is higher than that in the first connection mode.
According to the electronic equipment provided by the technical scheme, a plurality of play type applications can be designated as target applications in advance, further, when the electronic equipment is in a first connection state with Bluetooth equipment, the switching condition of a foreground application can be detected, and after the foreground application is switched to any one target application, the electronic equipment can be immediately switched from a first connection mode to a second connection mode. Because the foreground application is switched to the target application, the user does not start playing the audio and video, and therefore, the switching from the first connection mode to the second connection mode is executed at this time, and the playing delay on the Bluetooth equipment side of the electronic equipment can be prevented after the user starts playing the audio and video; moreover, since the user already enters the user interface of the target user at this time, there is a high probability that the audio and video will be played, and switching to the second connection mode at this time can also prevent unnecessary power consumption of the device from increasing.
With reference to the second aspect, in some implementations of the second aspect, the detecting unit is specifically configured to, in the first connection mode, receive a first notification message sent by the listening module.
With reference to the second aspect, in some implementations of the second aspect, the first notification message is used to indicate that the foreground application after the handover is the target application.
With reference to the second aspect, in some implementations of the second aspect, the first notification message is used to indicate first identification information of the foreground application after the handover.
With reference to the second aspect, in some implementations of the second aspect, the executing unit is specifically configured to identify, according to the first identification information, a foreground application after switching; and determining the switched foreground application as a target application according to the identification result.
With reference to the second aspect, in some implementations of the second aspect, the execution unit is specifically configured to obtain a first configuration file, where second identification information of at least one target application is pre-stored in the first configuration file; and comparing the second identification information with the first identification information.
With reference to the second aspect, in some implementations of the second aspect, the execution unit is further configured to determine that there is no media stream to be sent within a preset duration; the first connection mode is re-entered.
With reference to the second aspect, in some implementations of the second aspect, the execution unit is specifically configured to detect that there is no media stream to be sent, and start a target timer; and determining that the media stream to be sent does not exist in the timing duration of the target timer.
With reference to the second aspect, in some implementations of the second aspect, the execution unit is specifically configured to, in response to the target application exiting the foreground, detect a media stream to be sent; determining that no media stream to be transmitted exists currently; the first connection mode is re-entered.
With reference to the second aspect, in some implementations of the second aspect, the execution unit is specifically configured to send a first indication message to a bluetooth chip of the first electronic device, where the first indication message is used for the bluetooth chip to enter the second connection mode; and sending a second indication message to the Bluetooth chip, wherein the second indication message is used for enabling the Bluetooth chip to enter the first connection mode.
In a third aspect, the present technical solution provides an electronic device, including: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs comprising instructions that, when executed by the device, cause the device to perform the method of the first aspect or any of the possible implementations of the first aspect.
In a fourth aspect, the present technical solution provides an electronic device, where the device includes a storage medium and a central processing unit, where the storage medium may be a non-volatile storage medium, where a computer executable program is stored in the storage medium, and where the central processing unit is connected to the non-volatile storage medium and executes the computer executable program to implement the method in the first aspect or any possible implementation manner of the first aspect.
In a fifth aspect, the present technical solution provides a chip, the chip including a processor and a data interface, the processor reading instructions stored on a memory through the data interface, and executing the method in the first aspect or any possible implementation manner of the first aspect.
Optionally, as an implementation manner, the chip may further include a memory, where the memory stores instructions, and the processor is configured to execute the instructions stored on the memory, where the instructions, when executed, are configured to perform the method in the first aspect or any of the possible implementation manners of the first aspect.
In a sixth aspect, the present technical solution provides a computer readable storage medium storing program code for execution by a device, the program code comprising instructions for performing the method of the first aspect or any possible implementation of the first aspect.
Drawings
Fig. 1 is a schematic structural diagram of a first electronic device according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a bluetooth control method according to an embodiment of the present application;
fig. 3 is another schematic flowchart of a bluetooth control method according to an embodiment of the present application;
fig. 4 is another schematic flowchart of a bluetooth control method according to an embodiment of the present application;
fig. 5 is another schematic structural diagram of the first electronic device according to the embodiment of the present application;
fig. 6 is another schematic flowchart of a bluetooth control method according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Before describing the embodiments of the present application, a description will be given first of the related art.
Along with the gradual maturity of bluetooth technology, bluetooth equipment's kind is more and more including bluetooth headset, bluetooth speaker, on-vehicle bluetooth etc. simultaneously, user connects and uses bluetooth equipment to carry out the scene of media service also more and more abundant, like connect the phone call, use all kinds of video applications to watch the video, use all kinds of audio applications to listen to music, use all kinds of social applications to play voice message, use navigation application to accomplish route navigation etc.. In the above usage scenario, the user often finds that after the main device establishes a bluetooth connection with the bluetooth device, when the audio/video in the main device starts playing, the bluetooth device cannot sound synchronously, but has a delay of several seconds. This results in an inferior user experience.
The present application has been made to solve the above-mentioned problems.
Through the research on the above problems, in the bluetooth technical field, there are four connection modes of the main device and the bluetooth device in the bluetooth connection state, including an active mode (active mode), a breathing mode (sniff mode), a hold mode (hold mode), and a sleep mode (park mode).
In the active mode, the bluetooth device monitors the data packet sent from the main device side at all times. The data transmission efficiency is highest and the power consumption is also highest in the connection mode.
In the breathing mode, the master device negotiates a data transmission time slot with the Bluetooth device, and the Bluetooth device monitors a data packet sent from the master device side according to the time slot which is well in protocol with the master device. The data transmission efficiency in the connection mode is lower, but the power consumption of the device can be reduced.
In the hold mode, the master device negotiates the hold period with the Bluetooth device, and the data packet receiving and transmitting is not supported in the hold mode, so that the power consumption is saved.
In the sleep mode, data transmission and reception are stopped between the main equipment and the Bluetooth equipment, so that the power consumption can be saved to the greatest extent.
In the prior art, after the main device is connected with the bluetooth device, if the user does not play audio and video for a long time, the main device does not need to send a media stream to the bluetooth device, so as to save the power consumption of the device, and the main device enters a breathing mode. In the breathing mode, if the user resumes playing the audio-visual data, the master device detects that a corresponding media stream is generated and exits the breathing mode. Therefore, in the current technical scheme, when the user at the main equipment side resumes playing the audio and video, the main equipment and the bluetooth equipment are still in the breathing mode. However, because the response speed of the bluetooth device side to the media data packet of the main device side is slower in the breathing mode, the problem that the audio and video of the main device starts to play and the sound of the bluetooth device side is slow can occur.
In the application, a first Bluetooth device and a first electronic device can be provided. The first bluetooth device may be any bluetooth device, such as a bluetooth headset, a bluetooth speaker, and an onboard bluetooth device. The first electronic device may be any electronic device capable of establishing a bluetooth connection with a bluetooth device. The first electronic device may be, for example, a mobile phone, a tablet computer, a wearable device, an in-vehicle device, an augmented reality (augmented reality, AR)/Virtual Reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (personal digital assistant, PDA), or the like, and the specific type of the first electronic device is not limited in the embodiments of the present application.
The application provides a Bluetooth control method which is applied to first electronic equipment, and particularly can be applied to a Bluetooth module of the first electronic equipment. The first electronic equipment provided by the application can monitor the foreground application switching condition of the local equipment under the condition that Bluetooth connection is established with the first Bluetooth equipment and the first electronic equipment is in a breathing mode. And when the foreground application is detected to be switched into the pre-designated target playing application, the breathing mode is exited, and the activation mode is entered. Based on the technical scheme of the application, when a user enters the target playing application interface and playing of the audio and video is not started, the user immediately exits from the breathing mode and enters into the activation mode. After entering the active mode, the first bluetooth device may high-frequency monitor the media stream sent by the first electronic device. Based on the above, when the user starts to play the audio and video on the first electronic equipment side, the first Bluetooth equipment can realize synchronous play, thereby preventing the play delay of the first Bluetooth equipment side and improving the user experience.
The technical scheme of the present application will be described below with reference to the accompanying drawings.
Fig. 1 is a schematic structural diagram of a first electronic device 100 according to an embodiment of the present application. The first electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, a sensor module 180, keys 190, an indicator 192, a camera 193, a display 194, and a user identification module (subscriber identification module, SIM) card interface 195, etc., and optionally, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an acceleration sensor 180E, a distance sensor 180F, a fingerprint sensor 180H, a touch sensor 180K.
It should be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the first electronic device 100. In other embodiments of the application, the first electronic device 100 may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processing units, such as: the processor 110 may include an application processor (application processor, AP), a central processor (central processing unit, CPU), a bluetooth chip 111, a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural-network processor (neural-network processing unit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors.
The central processing unit may be an operation and control center of the first electronic device 100. The CPU can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution. For example, the bluetooth control method provided by the embodiment of the application can be completed.
The bluetooth chip may be a control unit in the first electronic device 100 for executing bluetooth related services, and may serve various bluetooth scenarios such as bluetooth connection, bluetooth audio transmission, bluetooth data transmission, and the like. For example, the method can be used for executing the Bluetooth control method provided by the embodiment of the application.
A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby improving the efficiency of the system.
In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a universal serial bus (universal serial bus, USB) interface, among others.
It should be understood that the interfacing relationship between the modules illustrated in the embodiment of the present application is only illustrative, and is not limited to the structure of the first electronic device 100. In other embodiments of the present application, the first electronic device 100 may also use different interfacing manners, or a combination of multiple interfacing manners in the foregoing embodiments.
The internal memory 121 may be used to store computer executable program code including instructions. The internal memory 121 may include a storage program area and a storage data area. The storage program area may store an operating system, an application program (such as an audio/video playing function, a bluetooth control function, etc.) required for at least one function, and the like. The storage data area may store data created during use of the first electronic device 100, etc. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (universal flash storage, UFS), and the like. The processor 110 performs various functional applications of the first electronic device 100 and data processing by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
For easy understanding, the following embodiment of the present application will take a first electronic device having a structure shown in fig. 1 as an example, and describes a bluetooth control method provided by the embodiment of the present application. The bluetooth control method provided by the embodiment of the application can be executed in the first electronic device, and can be specifically executed in a bluetooth module of the first electronic device.
Fig. 2 is a schematic flowchart of a bluetooth control method according to an embodiment of the present application. As shown in fig. 2, the bluetooth control method provided by the embodiment of the application includes:
101, a first electronic device establishes a bluetooth connection with a first bluetooth device.
102, the first electronic device determines that it is currently in a first connection mode.
103, the first electronic device monitors the switching condition of the foreground application.
104, the first electronic device detects that the foreground application is switched to the target application.
105, the first electronic device enters a second connection mode.
In the embodiment of the application, when the first electronic device and the first Bluetooth device are in the Bluetooth connection state and in the first connection mode, the Bluetooth module of the first electronic device can monitor the switching condition of the foreground application. Wherein the first connection mode may be a breathing mode. The switching condition of the foreground application may specifically include whether the foreground application is switched or not, and the foreground application after the switching. The switching condition of the foreground application can reflect the application interface where the user is currently staying. For example, if the foreground application switches to the first application, then it may be determined that the user is currently staying at the application interface of the first application.
Based on the above description, when the bluetooth module of the first electronic device detects that the foreground application is switched to the target application, it may be determined that the user is currently staying at the application interface of the target application, and at this time, the first electronic device may exit the first connection mode and may enter the second connection mode.
In the application, the target application is at least one pre-designated application with an audio/video playing function. Examples may include, but are not limited to: various video applications, various short video applications, various audio applications, various social applications, various navigation applications, conversation applications, and the like. The second connection mode may be an active mode. In the second connection mode, the response frequency of the first Bluetooth device to the data packet sent by the first electronic device is higher than that of the first connection mode.
When the user switches to the application interface of the target application, the user can be considered to have a high probability of playing the audio and video immediately, and the user exits the first connection mode and enters the second connection mode, so that the response speed of the first Bluetooth device side to the media stream is improved after the user starts playing the audio and video, the playing time delay of the first Bluetooth device is reduced, the slow sounding condition is improved, and the user experience is improved.
It will be appreciated that in the second connection mode, the data transfer between the first electronic device and the first bluetooth device is more efficient, but the device power consumption is greater. Therefore, after the data transmission requirement disappears, the first electronic device needs to timely exit the second connection mode and reenter the first connection mode.
In another embodiment of the present application, an implementation manner of the first electronic device reentering the first connection mode in the second connection mode is described.
Fig. 3 is another schematic flowchart of a bluetooth control method according to an embodiment of the present application. As shown in fig. 3, after the first electronic device enters the second connection mode, the bluetooth control method provided in the embodiment of the present application may further include:
the first electronic device detects 201 whether there is a media stream to be transmitted. If not, then step 202 is performed; otherwise, step 201 is continued.
202, the first electronic device determines whether to reproduce the media stream to be transmitted within a preset duration. If not, execute step 203; otherwise, step 201 is continued.
203, the first electronic device exits the second connection mode and reenters the first connection mode.
In the embodiment of the application, after entering the second connection mode, the first electronic device can detect whether the media stream to be sent is generated or not according to the set period. In an embodiment of the present application, the media stream to be transmitted may be a media stream based on a high quality audio distribution protocol (Advanced Audio Distribution Profile, A2 DP). If the media stream to be transmitted is detected, the current second connection mode is kept unchanged, and the media stream generation state is continuously detected. When a media stream is detected to be free of transmission, step 202 is performed to further determine the duration of the no media stream state.
Specifically, in step 202, the first electronic device may start a target Timer, where the timing duration of the target Timer may be set according to the requirement, for example, may be X seconds. Furthermore, the first electronic device may detect whether a media stream to be transmitted is generated within a time duration of the target timer. If the media stream to be transmitted is not generated all the time, the user can be considered to have no requirement of playing the audio and video by using the Bluetooth device, so that the first electronic device can exit the second connection mode and reenter the first connection mode, and the power consumption of the device can be saved.
In yet another embodiment of the present application, another implementation manner of the first electronic device reentering the first connection mode in the second connection mode is described.
Fig. 4 is another schematic flowchart of a bluetooth control method according to an embodiment of the present application. As shown in fig. 4, after the first electronic device enters the second connection mode, the bluetooth control method provided in the embodiment of the present application may further include:
301, the first electronic device detects a use state of a target application.
302, the first electronic device detects that a target application exits the foreground.
303, the first electronic device detects whether there is a media stream to be transmitted. If not, then step 304 is performed; otherwise, step 303 is continued.
304, the first electronic device exits the second connection mode and reenters the first connection mode.
In the embodiment of the application, after the first electronic device enters the second connection mode, the first electronic device can monitor the service condition of the foreground target application. If the target application is detected to exit the foreground, the user may be considered to have exited the application interface of the target application at this time. Then it can be immediately detected whether there is still a media stream to be sent.
If the media stream to be sent is detected to still exist, the background still plays the audio and video although the user exits the application interface of the target application. At this point, the current second connection mode may be maintained and the media stream state continues to be detected. And when the fact that the media stream to be sent does not exist is detected, the fact that the user exits the application interface of the target application and the playing of the audio and video by using the target application is stopped is indicated. At this time, the second connection mode may be exited and the first connection mode may be re-entered, thereby saving power consumption of the device.
According to the technical scheme, under the second connection mode, the first electronic equipment is controlled to reenter the first connection mode from the second connection mode based on the triggering conditions of the application state and the media stream state, so that the equipment power consumption can be better saved.
Fig. 5 shows another schematic structural diagram of the first electronic device 100 according to an embodiment of the present application. As shown in fig. 5, the first electronic device 100 provided in the embodiment of the present application may include a listening module 1001, a bluetooth module 1002, and a bluetooth chip 1003. The listening module 1001 may be located in an application framework layer of the first electronic device 100, the bluetooth module 1002 may be located in a system library of the first electronic device 100, and the bluetooth chip 1003 may be a hardware entity.
Based on the block diagram shown in fig. 5, fig. 6 shows another schematic flowchart of the bluetooth control method according to the embodiment of the present application. As shown in fig. 6, the bluetooth control method provided by the embodiment of the application includes:
the bluetooth module determines 401 that it is in a first connection mode with a first bluetooth device.
The listening module identifies 402 whether a foreground application is switched. If a handoff occurs, go to step 403; otherwise, step 402 is continued.
403, the monitoring module sends a first notification message to the bluetooth module.
And 404, the Bluetooth module determines the switched foreground application as the target application according to the first notification message.
In the embodiment of the application, the monitoring module can monitor the use condition of each application in the first electronic equipment. When the monitoring module recognizes that the foreground application is switched, the switching condition of the foreground application can be pushed to the Bluetooth module. Specifically, the monitoring module may send a first notification message to the bluetooth module, so as to push the switching condition of the foreground application to the bluetooth module.
In one possible implementation manner, the first notification message may carry a prompt message for switching the foreground application and identification information of the foreground application after switching. The identification information may be, for example, an application name, or any identification code or the like having a mapping relation with the application name in advance.
In this implementation, after the bluetooth module receives the first notification message, the bluetooth module may acquire the first identification information of the foreground application after the handover. Further, the bluetooth module may identify the first identification information to determine whether the switched foreground application is the target application.
In the embodiment of the present application, the target application may be any one or more applications with audio/video playing functions, and the types of the target application may include, but are not limited to: video applications, audio applications, social applications, navigation applications, conversation applications, etc. Specifically, the configuration file configuration can be preset. Specifically, a configuration file may be pre-established, and identification information of at least one target application may be stored in the configuration file. The identification information may be, for example, an application name, or an identification code associated with the application name, or the like.
Based on the above description, after the bluetooth module obtains the first identification information, the bluetooth module may obtain the configuration file, and compare the first identification information with the identification information of each target application pre-stored in the configuration file. And under the condition that the first identification information is consistent with the identification information of any target application in the configuration file, determining the switched foreground application as the target application.
In another possible implementation manner, the first notification message may carry a prompt message that the foreground application is switched to the target application.
In this implementation manner, when the monitoring module monitors that the foreground application is switched, the monitoring module may determine first identification information of the foreground application after the switching. Then, the monitoring module can acquire the configuration file, and compares the first identification information with the identification information of each target application pre-stored in the configuration file. And under the condition that the first identification information is consistent with the identification information of any target application in the configuration file, the monitoring module can determine that the switched foreground application is the target application. At this time, the listening module may send a first notification message to the bluetooth module, where the first notification message may be used to instruct the foreground application to switch to the target application.
Based on this implementation, the bluetooth module may directly determine the switched foreground application as the target application after receiving the first notification message, without having to perform more operations.
And 405, the Bluetooth module sends a first indication message to the Bluetooth chip.
406, the bluetooth chip exits the first connection mode and enters the second connection mode in response to the first indication message.
In the case that the switched foreground application is the target application, the user can be considered to be currently browsing the application interface of the target application. Because the target application belongs to the playing application, the user can be judged that the playing of the audio and video is about to occur in the subsequent use process. Therefore, the bluetooth module may send a first indication message to the bluetooth chip, where the first indication message may be used to instruct the bluetooth chip to exit the current first connection mode and enter the second connection mode. The specific manner and process of the bluetooth chip exiting the first connection mode and entering the second connection mode may refer to the prior art, and the disclosure is not repeated herein.
In contrast, in the case that the switched foreground application is a non-target application, it can be judged that the user has a high probability of not playing audio and video in the subsequent use process, and then the current first connection mode can be kept unchanged, so that the power consumption of the device is saved. Meanwhile, the monitoring module can continuously identify the switching condition of the foreground application.
According to the technical scheme, the Bluetooth module can monitor the switching condition of the foreground application through the monitoring module, and after the foreground application is identified to be switched into the target playing application, the Bluetooth chip is informed to exit the first connection mode and enter the second connection mode. Because the data transmission frequency between the first electronic equipment and the first Bluetooth equipment in the second connection mode is higher than that in the first connection mode, after the second connection mode is switched, the first Bluetooth equipment can quickly respond to the media stream subsequently sent by the first electronic equipment, so that the playing time delay of the Bluetooth equipment is reduced, and the problem that the Bluetooth equipment sounds slowly is solved.
Further, as shown in fig. 6, after the bluetooth module controls the bluetooth chip to exit the first connection mode and enter the second connection mode, the bluetooth control method provided by the embodiment of the application further includes:
407, the listening module identifies whether the target application exits the foreground. If the target application exits the foreground, execute step 408; otherwise, execution continues 407.
408, the listening module sends a second notification message to the bluetooth module.
409, the bluetooth module determines, according to the second notification message, that the target application exits the foreground.
The bluetooth module detects 410 whether a media stream is currently still to be transmitted. If there is no media stream to be transmitted, step 414 is performed; otherwise, step 410 is continued.
In a possible implementation manner, the first electronic device may further include an audio module, and the bluetooth module may implement monitoring of the media stream based on the audio module. Specifically, the audio module may detect whether a media stream to be transmitted is currently generated, and after determining that there is a media stream to be transmitted, the audio module may transmit a third notification message to the bluetooth module.
414, the bluetooth module sends the second indication information to the bluetooth chip.
415, the bluetooth chip exits the second connection mode according to the second indication information and reenters the first connection mode.
In the above implementation scheme, the current service state of the target application can be detected, and if the target application exits the foreground, whether a media stream to be sent exists currently can be detected, and if the media stream to be sent does not exist currently, the switching from the second connection mode to the first connection mode can be immediately performed. Based on the implementation manner, the scene that the user exits from the application interface of the target application and stops playing the audio and video by using the target application can be identified, and the first connection mode is cut in time under the scene, so that the power consumption of the equipment is saved.
In parallel with the implementation manners of the steps 407 to 410, after the bluetooth module controls the bluetooth chip to exit the first connection mode and enter the second connection mode, the bluetooth control method provided by the embodiment of the application further includes:
411, the bluetooth module detects whether there is a media stream to be transmitted. If there is no media stream to be transmitted, step 412 is performed; otherwise, execution continues with step 411.
412, the bluetooth module starts a target timer.
413, the bluetooth module detects whether a media stream to be transmitted is generated within the timing duration of the target timer. If there is no media stream to be transmitted, step 414 is performed; otherwise, execution continues with step 411.
In this implementation, the state of the media stream may be detected, and after the media stream to be sent is detected and the duration of such state reaches the preset duration threshold, the switching from the second connection mode to the first connection mode may be performed. The value of the preset duration threshold can be flexibly set based on scene requirements. Based on the implementation manner, a scene that the user does not exit the application interface of the target application but stops playing the audio and video by using the target application can be identified, and the first connection mode is cut in time under the scene, so that the power consumption of the equipment is saved.
In another embodiment of the present application, an electronic device may be provided. It will be appreciated that the electronic device, in order to achieve the above-described functions, includes corresponding hardware and/or software modules that perform the respective functions. The steps of the examples described in connection with the embodiments disclosed herein may be embodied in hardware or a combination of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Those skilled in the art can implement the described functionality using different approaches for each particular application in conjunction with the embodiments.
The present embodiment may divide functional units of the electronic device according to the above-described method example, for example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated in one processing unit. The integrated units described above may be implemented in hardware. It should be noted that, in this embodiment, the division of the units is schematic, only one logic function is divided, and another division manner may be implemented in practice.
In the case of dividing the respective functional units with the respective functions, fig. 7 shows a schematic diagram of one possible composition of the first electronic device involved in the above-described embodiment, and as shown in fig. 7, the electronic device 600 may include: a detection unit 601 and an execution unit 602. Wherein:
the detecting unit 601 is configured to monitor a foreground application switching condition in a first connection mode.
The execution unit 602 is configured to enter the second connection mode after detecting that the foreground application is switched to the target application. The data transmission frequency between the first electronic device and the first Bluetooth device in the second connection mode is higher than that in the first connection mode.
In one possible implementation manner, the detection unit 601 is specifically configured to receive, in the first connection mode, a first notification message sent by the listening module.
In one possible implementation, the first notification message is used to indicate that the foreground application after the handover is the target application.
In one possible implementation, the first notification message is used to indicate first identification information of the foreground application after the handover.
In a possible implementation manner, the executing unit 602 is specifically configured to identify the foreground application after the switching according to the first identification information; and determining the switched foreground application as a target application according to the identification result.
In a possible implementation manner, the execution unit 602 is specifically configured to obtain a first configuration file, where the first configuration file stores second identification information of at least one target application in advance; and comparing the second identification information with the first identification information.
In a possible implementation manner, the execution unit 602 is further configured to determine that there is no media stream to be sent within a preset duration; the first connection mode is re-entered.
In a possible implementation manner, the execution unit 602 is specifically configured to detect that there is no media stream to be sent, and start a target timer; and determining that the media stream to be sent does not exist in the timing duration of the target timer.
In one possible implementation, the execution unit 602 is specifically configured to detect a media stream to be sent in response to the target application exiting the foreground; determining that no media stream to be transmitted exists currently; the first connection mode is re-entered.
In a possible implementation manner, the execution unit 602 is specifically configured to send a first indication message to a bluetooth chip of the first electronic device, where the first indication message is used for the bluetooth chip to enter the second connection mode; and sending a second indication message to the Bluetooth chip, wherein the second indication message is used for enabling the Bluetooth chip to enter the first connection mode.
In the above technical solution, the electronic device may detect a switching condition of the foreground application in a state of being in a first connection mode with the bluetooth device, and exit the first connection mode and enter a second connection mode after the foreground application is switched to the target application. Through the technical scheme, the user can switch to the second connection mode in time before starting to play the audio and video, so that the data transmission efficiency between the electronic equipment and the Bluetooth equipment is improved, and the situation that the Bluetooth equipment side can play the delay is prevented.
It should be understood that the electronic device herein is embodied in the form of functional units. The term "unit" herein may be implemented in software and/or hardware, without specific limitation. For example, a "unit" may be a software program, a hardware circuit or a combination of both that implements the functions described above. The hardware circuitry may include application specific integrated circuits (application specific integrated circuit, ASICs), electronic circuits, processors (e.g., shared, proprietary, or group processors, etc.) and memory for executing one or more software or firmware programs, merged logic circuits, and/or other suitable components that support the described functions.
The application also provides an electronic device, which comprises a storage medium and a central processing unit, wherein the storage medium can be a nonvolatile storage medium, a computer executable program is stored in the storage medium, and the central processing unit is connected with the nonvolatile storage medium and executes the computer executable program to realize the Bluetooth control method.
The application also provides a computer readable storage medium having instructions stored therein which, when executed on a computer, cause the computer to perform the steps of the bluetooth control method of the application.
The application also provides a computer program product comprising instructions which, when run on a computer or on any of the at least one processor, cause the computer to perform the steps of the bluetooth control method of the application.
The application also provides a chip which comprises a processor and a data interface, wherein the processor reads the instructions stored in the memory through the data interface so as to execute the corresponding operations and/or processes executed by the Bluetooth control method.
Optionally, the chip further comprises a memory, the memory is connected with the processor through a circuit or a wire, and the processor is used for reading and executing the computer program in the memory. Further optionally, the chip further comprises a communication interface, and the processor is connected to the communication interface. The communication interface is used for receiving data and/or information to be processed, and the processor acquires the data and/or information from the communication interface and processes the data and/or information. The communication interface may be an input-output interface.
The memory may be read-only memory (ROM), other types of static storage devices that can store static information and instructions, random access memory (random access memory, RAM) or other types of dynamic storage devices that can store information and instructions, electrically erasable programmable read-only memory (electrically erasable programmable read-only memory, EEPROM), compact disc read-only memory (compact disc read-only memory) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media, or any other magnetic storage device that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, etc.
In the embodiment of the application, "and/or" describes the association relation of the association objects, which means that three relations can exist, for example, a and/or B, and can mean that a exists alone, a exists together with B, and B exists alone. Wherein A, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of the following" and the like means any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or plural.
Those of ordinary skill in the art will appreciate that the various elements and algorithm steps described in the embodiments disclosed herein can be implemented as a combination of electronic hardware, computer software, and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In several embodiments provided by the present application, any of the functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely exemplary embodiments of the present application, and any person skilled in the art may easily conceive of changes or substitutions within the technical scope of the present application, which should be covered by the present application. The protection scope of the present application shall be subject to the protection scope of the claims.

Claims (13)

1. A bluetooth control method, characterized by being applied to a bluetooth module of a first electronic device, where the first electronic device and the first bluetooth device are in a bluetooth connection state, the method comprising:
in a first connection mode, monitoring a foreground application switching condition;
detecting that a foreground application is switched to a target application and the target application does not generate a media stream to be sent yet, and entering a second connection mode;
and the data transmission frequency between the first electronic equipment and the first Bluetooth equipment in the second connection mode is higher than that in the first connection mode.
2. The method according to claim 1, wherein in the first connection mode, monitoring a foreground application switching condition comprises:
and in the first connection mode, receiving a first notification message sent by the monitoring module.
3. The method of claim 2, wherein the first notification message is used to indicate that the switched foreground application is the target application.
4. The method of claim 2, wherein the first notification message is used to indicate first identification information of a foreground application after handover.
5. The method of claim 4, wherein detecting that the foreground application is switched to the target application comprises:
identifying the switched foreground application according to the first identification information;
and determining the switched foreground application as a target application according to the identification result.
6. The method of claim 5, wherein the identifying the switched foreground application according to the first identification information comprises:
acquiring a first configuration file, wherein second identification information of at least one target application is pre-stored in the first configuration file;
and comparing the second identification information with the first identification information.
7. The method of claim 1, wherein after entering the second connection mode, the method further comprises:
determining that media streams to be sent do not exist in a preset duration;
and re-entering the first connection mode.
8. The method of claim 7, wherein determining that there is no media stream to be transmitted for a preset duration comprises:
Detecting that no media stream to be sent exists, and starting a target timer;
and determining that the media stream to be sent does not exist in the timing duration of the target timer.
9. The method of claim 1, wherein after entering the second connection mode, the method further comprises:
detecting a media stream to be sent in response to the target application exiting the foreground;
determining that the media stream to be sent does not exist currently;
and re-entering the first connection mode.
10. The method according to claim 7 or 9, wherein said entering a second connection mode comprises:
a first indication message is sent to a Bluetooth chip of the first electronic device, wherein the first indication message is used for enabling the Bluetooth chip to enter a second connection mode;
the re-entering the first connection mode includes: and sending a second indication message to the Bluetooth chip, wherein the second indication message is used for enabling the Bluetooth chip to enter the first connection mode.
11. An electronic device comprising a memory for storing program instructions and a processor for executing the program instructions, wherein the program instructions, when executed by the processor, trigger the electronic device to perform the method of any of the preceding claims 1-10.
12. A chip comprising a processor and a data interface, the processor reading instructions stored on a memory via the data interface, performing the method of any of the preceding claims 1-10.
13. A storage medium having stored therein program instructions which, when run on an electronic device, cause the electronic device to perform the method of any of claims 1-10.
CN202310678121.0A 2023-06-09 2023-06-09 Bluetooth control method and device Active CN116419359B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310678121.0A CN116419359B (en) 2023-06-09 2023-06-09 Bluetooth control method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310678121.0A CN116419359B (en) 2023-06-09 2023-06-09 Bluetooth control method and device

Publications (2)

Publication Number Publication Date
CN116419359A CN116419359A (en) 2023-07-11
CN116419359B true CN116419359B (en) 2023-10-31

Family

ID=87059685

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310678121.0A Active CN116419359B (en) 2023-06-09 2023-06-09 Bluetooth control method and device

Country Status (1)

Country Link
CN (1) CN116419359B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3745813A1 (en) * 2019-05-31 2020-12-02 Tap Sound System Method for operating a bluetooth device
CN113099428A (en) * 2021-03-02 2021-07-09 北京小米移动软件有限公司 Audio information transmission method, audio information transmission device, and storage medium
CN113553025A (en) * 2021-09-18 2021-10-26 深圳市外星人创新电子有限公司 Control method and system of Bluetooth headset based on game mode
CN115882893A (en) * 2021-09-26 2023-03-31 荣耀终端有限公司 Wireless communication mode switching method and electronic equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20230171649A1 (en) * 2021-11-30 2023-06-01 Cypress Semiconductor Corporation Adaptive wireless connections in multi-mode devices

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3745813A1 (en) * 2019-05-31 2020-12-02 Tap Sound System Method for operating a bluetooth device
CN113099428A (en) * 2021-03-02 2021-07-09 北京小米移动软件有限公司 Audio information transmission method, audio information transmission device, and storage medium
CN113553025A (en) * 2021-09-18 2021-10-26 深圳市外星人创新电子有限公司 Control method and system of Bluetooth headset based on game mode
CN115882893A (en) * 2021-09-26 2023-03-31 荣耀终端有限公司 Wireless communication mode switching method and electronic equipment

Also Published As

Publication number Publication date
CN116419359A (en) 2023-07-11

Similar Documents

Publication Publication Date Title
CN108965306B (en) Call processing method and mobile terminal
CN109151212B (en) Equipment control method and device and electronic equipment
CN108228358B (en) Method, device, mobile terminal and storage medium for correcting vertical synchronization signal
JP7361890B2 (en) Call methods, call devices, call systems, servers and computer programs
US11430447B2 (en) Voice activation based on user recognition
CN109257732B (en) Equipment control method and device and electronic equipment
CN111277697B (en) Audio processing method and device, storage medium and electronic equipment
CN113840269B (en) Multimedia data transmission method and device, electronic equipment and storage medium
CN108563468B (en) Bluetooth sound box data processing method and device and Bluetooth sound box
CN116419359B (en) Bluetooth control method and device
CN113810890A (en) Device loop-back method, device, electronic device and storage medium
EP3057377B1 (en) Network device, terminal device and voice service control method
CN110225213B (en) Recognition method of voice call scene and audio policy server
US20230156112A1 (en) Function conflict processing method and apparatus, electronic device, and readable storage medium
CN115022766B (en) Audio data playing method and equipment
CN112702146A (en) Data processing method and device
CN111081283A (en) Music playing method and device, storage medium and terminal equipment
CN112954760B (en) Bluetooth equipment connection method and device and electronic equipment
CN115460665A (en) Network switching method and device
US11678391B2 (en) Communication methods and electronic devices
JP2004094577A (en) Information terminal equipment
CN113271385A (en) Call forwarding method
CN116056051B (en) Bluetooth connection control method, system and equipment
CN112866964A (en) Wireless earphone assembly
CN112866965A (en) Intelligent glasses

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
GR01 Patent grant
GR01 Patent grant