Bluetooth headset connection control method, device, electronic device and storage medium

By collecting positioning data and Bluetooth signal strength to determine the wearer's status, it automatically disconnects the Bluetooth headset and switches to the speaker for playback, which solves the problem of low intelligence in the existing Bluetooth headset switching method and improves the user experience and information reminder efficiency.

CN114900786BActive Publication Date: 2024-10-11EARDA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210398705.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-15
Publication Date
2024-10-11
Estimated Expiration
2042-04-15

AI Technical Summary

Technical Problem

The existing Bluetooth headset switching method is less intelligent, resulting in a reduced user experience and users easily missing important information.

Method used

When the Bluetooth headset is connected to the terminal device, positioning data is collected to determine whether the wearer is running, and the target distance is calculated based on the Bluetooth signal strength to determine whether the headset is being worn. If the headset is not being worn, a disconnect message is sent and the terminal device stops connecting. and switches audio playback to speakers.

Benefits of technology

Intelligent switching between Bluetooth headset and speaker playback is realized to avoid missing important information and improve the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114900786B_ABST
    Figure CN114900786B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method, device, electronic device and storage medium for controlling the connection of a Bluetooth headset. The method includes: when the Bluetooth headset is connected to a terminal device, multiple positioning data of the terminal device are collected according to a preset period, and whether the wearer of the Bluetooth headset is in a running state is determined according to the multiple positioning data. If so, the target distance between the Bluetooth headset and the terminal device is calculated by the Bluetooth signal strength, and whether the Bluetooth headset is in a non-wearing state is determined according to the multiple target distances. When the Bluetooth headset is in a non-wearing state, a disconnection message is sent to the terminal device, and the terminal device switches the audio playback channel to speaker playback when receiving the disconnection message. The wearing state of the Bluetooth headset is monitored by positioning data and target distance, and when the Bluetooth headset is in a non-wearing state, the terminal device is notified to switch the playback mode to avoid missing information sent by other terminals, thereby achieving the effect of intelligently disconnecting the Bluetooth headset.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of Bluetooth communication technology, and in particular to a Bluetooth headset connection control method, device, electronic device and storage medium. Background Art

[0002] With the rapid development and promotion of electronic products such as smart phones and smart wearable devices, Bluetooth headsets used in conjunction with such electronic products have also been favored by more and more users. Especially for many users who run frequently, using headphones to listen to music or receive guidance audio from sports apps while running has become an indispensable part of running.

[0003] Bluetooth technology is a wireless communication technology that can achieve wireless connection between two devices within a certain distance. Users usually take off their headphones after running, but often forget that the Bluetooth headphones are still connected to the mobile phone. The sound of the mobile phone is still transmitted through the Bluetooth headphones, which causes missed calls and important messages.

[0004] In the prior art, after a mobile terminal is connected to a Bluetooth headset, a button operation is required to put the headset into a sleep state in order to save power or switch the headset. However, users usually do not focus on switching the connection state of the Bluetooth headset according to usage. Therefore, the existing Bluetooth headset switching method has a low degree of intelligence, resulting in a decreased user experience of the Bluetooth headset. Summary of the invention

[0005] The embodiments of the present invention provide a Bluetooth headset switching method, device, electronic device and storage medium to solve the problem that the existing Bluetooth headset switching method has a low intelligence level and leads to a decreased Bluetooth headset usage experience.

[0006] In a first aspect, an embodiment of the present invention provides a Bluetooth headset connection control method, comprising:

[0007] When the Bluetooth headset is connected to the terminal device, multiple positioning data of the terminal device are collected according to a preset period;

[0008] Determining whether the wearer of the Bluetooth headset is in a running state according to the plurality of positioning data;

[0009] If yes, calculate the target distance between the Bluetooth headset and the terminal device according to the Bluetooth signal strength;

[0010] Determining whether the Bluetooth headset is in a non-wearing state according to the multiple target distances;

[0011] If so, a disconnection message is sent to the terminal device. When the terminal device receives the disconnection message, it stops connecting to the Bluetooth headset and switches the audio playback channel to speaker playback.

[0012] Optionally, judging whether the wearer of the Bluetooth headset is in a running state according to the positioning data includes:

[0013] Determining whether the terminal device is in a mobile state by using multiple positioning data;

[0014] If so, it is determined that the wearer is in a running state.

[0015] Optionally, judging whether the Bluetooth headset is in a non-wearing state according to the multiple target distances includes:

[0016] Whenever a target distance is calculated, the target distance is added to the head of a sliding window of a preset length, and a first average of a plurality of target distances in the sliding window is calculated;

[0017] Calculate the absolute value of the difference between the first mean and the second mean, where the second mean is the mean calculated when the target distance is last added to the head of the sliding window;

[0018] Determine whether the absolute value is greater than a preset mean;

[0019] If so, it is determined that the Bluetooth headset is in a non-wearing state.

[0020] Optionally, when it is determined that the absolute value is greater than a preset value, the method further includes:

[0021] When the terminal device runs a preset application, determining whether the preset application plays a preset voice;

[0022] If so, it is determined that the Bluetooth headset is in a non-wearing state.

[0023] Optionally, judging whether the Bluetooth headset is in a non-wearing state according to the multiple target distances further includes:

[0024] Clustering the multiple target distances currently calculated to obtain multiple cluster centers;

[0025] Determine whether a new cluster center appears;

[0026] If so, it is determined that the Bluetooth headset is in a non-wearing state.

[0027] Optionally, judging whether the Bluetooth headset is in a non-wearing state according to the multiple target distances further includes:

[0028] Fitting a distance curve including a plurality of curve segments by taking the time of each preset period as the abscissa and the target distance calculated within the preset period as the ordinate;

[0029] Inputting the target distance curve into a pre-trained usage status recognition model to obtain the probability that the Bluetooth headset is in a non-wearing state within the time period corresponding to each curve segment;

[0030] When any of the probabilities is greater than a preset probability threshold, it is determined that the Bluetooth headset is in a non-wearing state.

[0031] Optionally, the usage status recognition model is trained in the following manner:

[0032] When the wearer wears the Bluetooth headset while running, multiple sampling distances from the Bluetooth headset to the terminal device are collected according to a preset period, and the multiple sampling distances include the distances between the Bluetooth headset and the terminal device when the Bluetooth headset is in a wearing state and a non-wearing state;

[0033] A sampling curve including a plurality of sample curve segments is generated by using a plurality of the sampling distances and the sampling time of the target distance, wherein the sample curve segments are marked with labels indicating the use status of the Bluetooth headset;

[0034] Inputting the sampling curve into the initialized usage status recognition model to obtain the probability that each of the sample curve segments belongs to the non-wearing state;

[0035] The usage status recognition model is adjusted by using the probability and the label until convergence to obtain a trained usage status recognition model.

[0036] In a second aspect, an embodiment of the present invention further provides a Bluetooth headset connection control device, comprising:

[0037] A positioning data collection module, used to collect multiple positioning data of the terminal device according to a preset period when the Bluetooth headset is connected to the terminal device;

[0038] A running state determination module, used for determining whether the wearer of the Bluetooth headset is in a running state according to the plurality of positioning data;

[0039] A target distance calculation module, used to calculate the target distance between the Bluetooth headset and the terminal device according to the Bluetooth signal strength when the wearer of the Bluetooth headset is in a running state;

[0040] A usage status judgment module is used to judge whether the Bluetooth headset is in a non-wearing state according to the multiple target distances;

[0041] A signal sending module is used to send a disconnection message to the terminal device when the Bluetooth headset is not worn. When the terminal device receives the disconnection message, it stops connecting with the Bluetooth headset and switches the audio playback channel to speaker playback.

[0042] Optionally, the running state judgment module includes:

[0043] A mobile state judgment submodule, used to judge whether the terminal device is in a mobile state through a plurality of positioning data;

[0044] The running state determination submodule is used to determine that the wearer is in a running state if the terminal device is in a moving state.

[0045] Optionally, a status judgment module is used, including:

[0046] A first mean value calculation submodule, configured to add the target distance to the head of a sliding window of a preset length each time a target distance is calculated, and calculate a first mean value of a plurality of the target distances in the sliding window;

[0047] an absolute value calculation submodule, configured to calculate an absolute value of a difference between a first mean and a second mean, wherein the second mean is a mean calculated when the target distance is last added to the head of the sliding window;

[0048] An absolute value judgment submodule is used to judge whether the absolute value is greater than a preset mean value;

[0049] The use state determination submodule is used to determine that the Bluetooth headset is in a non-wearing state when the absolute value is greater than a preset average value.

[0050] Optionally, the use state determination submodule further includes:

[0051] A preset voice judgment unit, used to judge whether the preset application plays a preset voice when the terminal device runs the preset application;

[0052] The use state determination unit is used to determine that the Bluetooth headset is in a non-wearing state if the preset application plays a preset voice.

[0053] Optionally, the use status judgment module further includes:

[0054] A clustering submodule, used for clustering the multiple target distances currently calculated to obtain multiple cluster centers;

[0055] The cluster center judgment submodule is used to judge whether a new cluster center appears;

[0056] The non-wearing state determination submodule is used to determine that the Bluetooth headset is in a non-wearing state if a new cluster center appears.

[0057] Optionally, the use status judgment module further includes:

[0058] A distance curve fitting submodule, used for fitting a distance curve including a plurality of curve segments by taking the time of each preset period as the abscissa and the target distance calculated within the preset period as the ordinate;

[0059] A probability calculation submodule, used for inputting the target distance curve into a pre-trained usage status recognition model to obtain the probability that the Bluetooth headset is in a non-wearing state within the time period corresponding to each curve segment;

[0060] When any of the probabilities is greater than a preset probability threshold, determining that the Bluetooth headset is in a non-wearing state;

[0061] Optionally, the usage status recognition model is trained by the following modules:

[0062] A sampling distance acquisition module is used to collect multiple sampling distances from the Bluetooth headset to the terminal device according to a preset period when the wearer wears the Bluetooth headset for running, and the multiple sampling distances include the distances between the Bluetooth headset and the terminal device when the Bluetooth headset is in a wearing state and a non-wearing state;

[0063] A sampling curve generating module, used to generate a sampling curve including a plurality of sample curve segments by using a plurality of the sampling distances and the sampling time of the target distance, wherein the sample curve segments are marked with labels indicating the use status of the Bluetooth headset;

[0064] A probability acquisition module, used for inputting the sampling curve into the initialized usage status recognition model to obtain the probability that each of the sample curve segments belongs to the non-wearing state;

[0065] The model adjustment module is used to adjust the usage status recognition model through the probability and the label until convergence, so as to obtain a trained usage status recognition model.

[0066] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0067] one or more processors;

[0068] a memory for storing one or more computer programs,

[0069] When the one or more computer programs are executed by the one or more processors, the one or more processors implement the Bluetooth headset connection control method as described in the first aspect.

[0070] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the Bluetooth headset connection control method as described in the first aspect is implemented.

[0071] The embodiment of the present invention provides a method for controlling the connection of a Bluetooth headset. When the Bluetooth headset is connected to a terminal device, multiple positioning data of the terminal device are collected according to a preset period. It is determined whether the wearer of the Bluetooth headset is in a running state based on the multiple positioning data. When the wearer is in a running state, the target distance between the Bluetooth headset and the terminal device is calculated by the Bluetooth signal strength. It is determined whether the Bluetooth headset is in a non-wearing state based on the multiple target distances. When the Bluetooth headset is in a non-wearing state, a disconnection message is sent to the terminal device. When the terminal device receives the disconnection message, it stops connecting with the Bluetooth headset and switches the audio playback channel to speaker playback. The positioning data and target distance are used to monitor whether the Bluetooth headset is in a wearing state after the wearer is in a running state. When the Bluetooth headset is in a non-wearing state, the terminal device is notified to disconnect from the Bluetooth headset and switch to speaker playback mode, so as to avoid missing information sent by other terminals, thereby realizing intelligent switching between Bluetooth headset playback and speaker playback. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] Figure 1 A flowchart of a Bluetooth headset connection control method provided in Embodiment 1 of the present invention;

[0073] Figure 2 A flowchart of a Bluetooth headset connection control method provided in Embodiment 2 of the present invention;

[0074] Figure 3 This is a schematic diagram of a sliding window provided by Embodiment 2 of the present invention;

[0075] Figure 4 A distance curve graph during running provided by the second embodiment of the present invention;

[0076] Figure 5 A schematic diagram of the structure of a Bluetooth headset connection control device provided in Embodiment 3 of the present invention;

[0077] Figure 6 A schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0078] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0079] Embodiment 1

[0080] Figure 1 This is a flow chart of a Bluetooth headset connection control method provided in Embodiment 1 of the present invention. This embodiment can be applied to automatically disconnecting a Bluetooth headset from a terminal device when a user finishes running. The method can be executed by a Bluetooth headset connection control device. The Bluetooth headset connection control device can be implemented by software and / or hardware and can be configured in a Bluetooth headset. The Bluetooth headset connection control method specifically includes the following steps:

[0081] S101. When the Bluetooth headset is connected to a terminal device, multiple positioning data of the terminal device are collected according to a preset period.

[0082] The terminal device can be a mobile phone or other smart sports device, etc. The terminal device can be installed with a running-related sports APP, which is used to provide the wearer with music and broadcasts suitable for running, and to guide the wearer of the Bluetooth headset to run, adjust breathing and posture according to the guidance voice. When running, the terminal device is carried by the wearer, the Bluetooth headset is connected to the terminal device via Bluetooth, and the sports APP in the terminal device sends audio to the Bluetooth headset through the terminal device.

[0083] The terminal device of this embodiment has a positioning function, for example, the terminal device is usually provided with a GPS system. The positioning data is the position data monitored by the GPS system. The preset period is the period for collecting the positioning data, which can be a shorter time length, for example, 10 seconds.

[0084] S102: Determine whether the wearer of the Bluetooth headset is in a running state according to the multiple positioning data.

[0085] For runners, they generally do not make reciprocating movements in a short period of time. In this embodiment, the main consideration is that the positioning data of the wearer within a preset period is constantly changing. When the wearer of the Bluetooth headset is in a running state, his position within the preset period is usually constantly changing. Therefore, it is possible to determine whether the terminal device is in a moving state through multiple positioning data. If so, it is determined that the wearer is in a running state and S103 is executed. Otherwise, it continues to monitor whether the wearer is in a running state.

[0086] Specifically, to determine whether the terminal device is in a moving state through multiple positioning data, the displacement corresponding to the positioning data of two adjacent sampling times can be calculated first. If the displacement is not 0, it can be determined that the wearer is in a moving state.

[0087] In addition, an acceleration sensor may be provided on the terminal device or the Bluetooth headset, and the acceleration data collected by the acceleration sensor may be combined to determine whether the wearer is in a moving state.

[0088] S103: Calculate the target distance between the Bluetooth headset and the terminal device according to the Bluetooth signal strength.

[0089] The terminal device acts as the transmitter and the communication Bluetooth headset acts as the receiver. The Bluetooth signal strength between the transmitter and the receiver is inversely proportional to the distance between the two. That is, the closer the distance, the stronger the Bluetooth signal strength, and the farther the distance, the weaker the Bluetooth signal strength.

[0090] The formula for calculating the target distance d is:

[0091] d=10^((abs(rssi)-A) / (10*n))

[0092] Wherein, rssi is the Bluetooth signal strength, A is the signal strength when the transmitter and the receiver are 1 meter apart, n is the environmental attenuation factor, and abs(rssi) represents the absolute value of rssi.

[0093] In actual situations, the interference encountered during transmission is relatively large, so the RSSI value is generally less than 0. For example, the signal strength of a Bluetooth headset with an RSSI of -50dBm is stronger than that with an RSSI of -100dBm, and the corresponding target distance is closer.

[0094] In addition, the collection condition of the target distance may be: when each positioning data is collected, the target distance between the Bluetooth headset and the terminal device may be calculated according to the Bluetooth signal strength.

[0095] S104: Determine whether the Bluetooth headset is in a non-wearing state according to multiple target distances.

[0096] When the wearer wears the Bluetooth headset for running, the terminal device is usually placed in a waist bag, an arm bag or held in the hand. The distance between the Bluetooth headset and the terminal device is relatively fixed. If the wearer takes off the headset, the target distance changes significantly. Therefore, after calculating the target distance between the Bluetooth headset and the terminal device, it is possible to determine whether the Bluetooth headset is in a non-worn state based on multiple target distances. If so, execute S105; otherwise, continue to monitor whether the Bluetooth headset is in a non-worn state. Specifically, it is possible to determine whether the difference between adjacent target distances is within a preset difference range. If so, it is determined that the Bluetooth headset is in a non-worn state.

[0097] In addition, a bioimpedance sensor can be set on the Bluetooth headset, and the bioimpedance sensor is used to detect human body parameters, including at least one of the galvanic skin response index, bioresistance, heart rate and respiratory rate. By combining the target distance and human body parameters to determine whether the Bluetooth headset is in a non-wearing state, the Bluetooth headset can be detected more accurately when it is in a non-wearing state.

[0098] S105: Send a disconnect message to the terminal device.

[0099] When the Bluetooth headset is not in the worn state, it means that it is difficult for the wearer to hear the audio emitted by the Bluetooth headset. At this time, the Bluetooth headset is still connected to the terminal device. If other audio messages are received at this time, the user will not be able to know and miss the audio message, such as calls or text messages sent by family and friends. Therefore, the Bluetooth headset sends a disconnect message to the terminal device. When the terminal device receives the disconnect message, it stops connecting to the Bluetooth headset and switches the audio playback channel to speaker playback. When a message sent by other terminals is received, the user can be reminded to confirm through the speaker.

[0100] The embodiment of the present invention provides a method for controlling the connection of a Bluetooth headset. When the Bluetooth headset is connected to a terminal device, multiple positioning data of the terminal device are collected according to a preset period. It is determined whether the wearer of the Bluetooth headset is in a running state based on the multiple positioning data. When the wearer is in a running state, the target distance between the Bluetooth headset and the terminal device is calculated by the Bluetooth signal strength. It is determined whether the Bluetooth headset is in a non-wearing state based on the multiple target distances. When the Bluetooth headset is in a non-wearing state, a disconnection message is sent to the terminal device. When the terminal device receives the disconnection message, it stops connecting with the Bluetooth headset and switches the audio playback channel to speaker playback. The positioning data and target distance are used to monitor whether the Bluetooth headset is in a wearing state after the wearer is in a running state. When the Bluetooth headset is in a non-wearing state, the terminal device is notified to disconnect from the Bluetooth headset and switch to speaker playback mode, so as to avoid missing information sent by other terminals, thereby realizing intelligent switching between Bluetooth headset playback and speaker playback.

[0101] Embodiment 2

[0102] Figure 2 This is a flow chart of a Bluetooth headset connection control method provided in Embodiment 2 of the present invention. This embodiment is further optimized based on the above embodiment. The method specifically includes the following steps:

[0103] S201. When the Bluetooth headset is connected to a terminal device, multiple positioning data of the terminal device are collected according to a preset period.

[0104] S202: Determine whether the wearer of the Bluetooth headset is running according to the plurality of positioning data. If yes, execute S203.

[0105] S203: Calculate the target distance between the Bluetooth headset and the terminal device according to the Bluetooth signal strength.

[0106] Since S201-S203 are the same as those in the first embodiment, reference may be made to the description of a part of the embodiment, and no further details are given here.

[0107] S204: Whenever a target distance is calculated, the target distance is added to the head of a sliding window of a preset length, and a first average of multiple target distances in the sliding window is calculated.

[0108] Figure 3 It shows the position relationship of the data in the sliding window at different times, such as Figure 3 As shown, the preset length of the sliding window is set to 8, the head position of the sliding window is the position of sequence number 1, 301 is the sliding window of the previous time, and 302 is the sliding window of the current time. Relative to sliding window 301, 302 newly adds the latest target distance (0.4) to the head position of the sliding window, and the data of sequence numbers 1-7 in the original 301 are shifted from sequence number 2 in sliding window 302. Since the amount of data in the sliding window remains unchanged, the target distance (0.5) of sequence number 8 in the original 301 is removed to obtain an updated sliding window, which reflects the transmission and update of the target distance by the sliding window. Of course, the amount of data in the sliding window in this embodiment can be determined according to the actual situation. For example, the preset length of the sliding window can also be 50, and this application does not limit this.

[0109] Calculate the mean of multiple target distances in the current sliding window as the first mean.

[0110] S205: Calculate the absolute value of the difference between the first mean and the second mean. The second mean is the mean calculated when the target distance is added to the head of the sliding window last time.

[0111] for Figure 3 For the sliding window 302 at the current time, the mean of the data included therein is the first mean, and the mean of the data included in the sliding window 301 is the second mean.

[0112] The absolute value of the difference between the first mean and the second mean is calculated, because the difference between the first mean and the second mean comes from the newly added target distance and the last target distance in the sliding window at the previous time.

[0113] When the wearer wears the headset for a continuous period of time, the Bluetooth headset is located at the wearer's ear, and the terminal device is generally in a fixed position such as the hand, waist bag, or arm bag. The target distance value between the Bluetooth headset and the terminal device is relatively stable. Even if a new target distance is added in the sliding window, the difference between the first mean and the second mean of multiple target distances in the sliding window is very small. If the wearer takes off the Bluetooth headset, he or she usually holds the headset in his or her hand or puts it in a waist bag, arm bag, or other position close to the terminal device, that is, when the Bluetooth headset is not worn, the value of the target distance is much different from that in the wearing state. Therefore, for the sliding window, if the data at the previous time is the target distance when the Bluetooth headset is worn, and the newly added data is the target distance when the Bluetooth headset is taken off, the difference between the current first mean and the second mean is large.

[0114] S206, determine whether the absolute value is greater than the preset mean value. If yes, execute S207, if not, continue to detect whether the absolute value is greater than the preset mean value.

[0115] S207: Determine whether the Bluetooth headset is in a non-wearing state.

[0116] The preset mean is used to measure the degree of differentiation between the first mean and the second mean. Further, it is used to determine whether the newly added target distance of the Bluetooth headset is different from the data in the previous state. Since the Bluetooth headset is originally in a wearing state, when the absolute value is greater than the preset mean, it means that the newly added target distance data in the latest sliding window is the data when the Bluetooth headset is in a non-wearing state.

[0117] In an example of this embodiment, when the absolute value is greater than a preset mean, it also includes: when the terminal device runs a preset application, determining whether the preset application plays a preset voice, and if so, determining that the Bluetooth headset is in a non-wearing state.

[0118] The terminal device may be provided with a preset application, such as a certain sports APP, which can provide the wearer with voice guidance to start running, adjust breathing and posture, etc. Usually, the user can select a running item on the sports APP and click to start the exercise, and then start running according to the prompts and guidance of the sports APP. The preset voice indicates that the running item of the sports APP has been completed. When the Bluetooth headset receives the preset voice, it can be judged that the user has finished running. In this example, when it is determined that the user takes off the Bluetooth headset, it is judged from the user's perspective that the running has ended, and when it is determined that the preset application sends a preset voice, it is judged from the perspective of the preset application that the running has stopped. Judging the user's exercise status from two perspectives can improve the accuracy of judging the user's exercise status.

[0119] S208: Send a disconnect message to the terminal device. When the terminal device receives the disconnect message, it stops connecting to the Bluetooth headset and switches the audio playback channel to speaker playback.

[0120] When the Bluetooth headset is not worn, it means that it is difficult for the wearer to hear the audio emitted by the Bluetooth headset. At this time, the Bluetooth headset is still connected to the terminal device. If other audio messages are received at this time, the user will not be able to know and miss the audio message. Therefore, the Bluetooth headset sends a disconnect message to the terminal device. When the terminal device receives the disconnect message, it stops connecting to the Bluetooth headset and switches the audio playback channel to speaker playback. When a message sent by other terminals is received, the user can be reminded to confirm through the speaker.

[0121] This embodiment updates the target distance between the Bluetooth headset and the terminal device through a sliding window to determine whether the latest target distance is the data when the wearer takes off the Bluetooth headset, so as to judge whether the Bluetooth headset is in a non-worn state, and send a disconnect message to the terminal device when the Bluetooth headset is in a non-worn state. It can detect that the wearer has taken off the headset at the first time and disconnect the connection between the terminal device and the Bluetooth headset in time.

[0122] In an optional embodiment of the present invention, determining whether the Bluetooth headset is in a non-wearing state based on multiple target distances also includes: clustering the multiple target distances currently calculated to obtain multiple cluster centers, and determining whether new cluster centers appear, and if so, determining that the Bluetooth headset is in a non-wearing state.

[0123] Clustering is to divide multiple target distances into different classes or clusters, so that the similarity of target distances in the same cluster is as large as possible, and the difference of target distances not in the same cluster is as large as possible. Therefore, when the Bluetooth headset is in the wearing state, the target distance between the Bluetooth headset and the terminal device is relatively stable. Even if new data is added, it is still within the range of the existing class or cluster, and no new cluster center will appear. When the Bluetooth headset is converted from the wearing state to the non-wearing state, the target distance between the Bluetooth headset and the terminal device is significantly different from the previously acquired target distance. When multiple target distances are clustered, new cluster centers will appear. If cluster analysis is adopted, the amount of data required is large, and the frequency of data collection can be relatively increased.

[0124] By clustering the target distance and judging whether a new cluster center appears, it is determined whether the user has taken off the Bluetooth headset. Due to the richness of the data, it can be accurately determined that the Bluetooth headset is in a non-wearing state when the user takes it off.

[0125] In an optional embodiment of the present invention, judging whether the Bluetooth headset is in a non-wearing state based on multiple target distances also includes: fitting a distance curve with the time of each preset period as the horizontal coordinate and the target distance calculated within the preset period as the vertical coordinate, and segmenting the distance curve to obtain multiple curve segments, and then inputting the distance curve into a pre-trained usage status recognition model to obtain the probability that the Bluetooth headset is in a non-wearing state within the time corresponding to each curve segment, and when any probability is greater than a preset probability threshold, it is determined that the Bluetooth headset is in a non-wearing state. For example, when the probability approaches 0, the Bluetooth headset is in a wearing state, and when the probability approaches 1, the Bluetooth headset is in a non-wearing state. The probability threshold can be set to 0.75, and when any probability is greater than 0.75, it can be determined that the Bluetooth headset is in a non-wearing state. Figure 4 As shown, the distance curve during running is shown, the horizontal axis is the preset period t, the vertical axis is the target distance d, the distance curve is divided into 4 curve segments, and the distance curve is input into the usage status recognition model, and the probabilities P of the 4 curve segments are obtained as 0.1, 0.2, 0.8 and 1 respectively. The curve segments with probabilities P of 0.1 and 0.2 correspond to the usage status of the Bluetooth headset as the wearing state, and the curve segments with probabilities P of 0.8 and 1 correspond to the usage status of the Bluetooth headset as the non-wearing state.

[0126] Specifically, the state recognition model can be trained in the following ways:

[0127] When the wearer is wearing the Bluetooth headset and running, multiple sampling distances from the Bluetooth headset to the terminal device are collected according to a preset period, and the multiple sampling distances include the distances between the Bluetooth headset and the terminal device when the Bluetooth headset is in a wearing state and a non-wearing state;

[0128] A sampling curve including a plurality of sample curve segments is generated by using a plurality of sampling distances and sampling times of the distances, and a label indicating the use status of the Bluetooth headset is marked on the sample curve segment;

[0129] The sampling curve is input into the initialized usage status recognition model to obtain the probability that each sample curve segment belongs to the non-wearing state;

[0130] The probability and label are used to calculate the loss rate, and then the gradient is calculated through the loss rate. The gradient is used to perform gradient descent on the model parameters, that is, the usage status recognition model is adjusted until convergence, and the sampling curve is returned to the step of inputting the initialized usage status recognition model until the loss rate is less than the preset threshold. The training is completed and a trained usage status recognition model is obtained.

[0131] Using a trained usage status recognition model to recognize the usage status of the Bluetooth headset can also improve the accuracy of recognizing that the Bluetooth headset is not in a wearing state.

[0132] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0133] Embodiment 3

[0134] Figure 5 This is a structural block diagram of a Bluetooth headset connection control device provided in Embodiment 3 of the present invention, which may specifically include the following modules:

[0135] The positioning data collection module 501 is used to collect multiple positioning data of the terminal device according to a preset period when the Bluetooth headset is connected to the terminal device;

[0136] A running state determination module 502 is used to determine whether the wearer of the Bluetooth headset is in a running state according to a plurality of positioning data;

[0137] A target distance calculation module 503 is used to calculate the target distance between the Bluetooth headset and the terminal device according to the Bluetooth signal strength when the wearer of the Bluetooth headset is in a running state;

[0138] A use status determination module 504 is used to determine whether the Bluetooth headset is in a non-wearing state according to multiple target distances;

[0139] The signal sending module 505 is used to send a disconnection message to the terminal device when the Bluetooth headset is not worn. When the terminal device receives the disconnection message, it stops connecting to the Bluetooth headset and switches the audio playback channel to speaker playback.

[0140] Optionally, the running state determination module 502 includes:

[0141] A mobile state judgment submodule is used to judge whether the terminal device is in a mobile state through multiple positioning data;

[0142] The running state determination submodule is used to determine that the wearer is in a running state if the terminal device is in a moving state.

[0143] Optionally, the use status determination module 504 includes:

[0144] A first mean value calculation submodule, configured to add the target distance to the head of a sliding window of a preset length each time a target distance is calculated, and calculate a first mean value of multiple target distances in the sliding window;

[0145] An absolute value calculation submodule, used to calculate the absolute value of the difference between the first mean and the second mean, where the second mean is the mean calculated when the target distance is added to the head of the sliding window last time;

[0146] The absolute value judgment submodule is used to judge whether the absolute value is greater than the preset mean;

[0147] The state determination submodule is used to determine that the Bluetooth headset is in a non-wearing state when the absolute value is greater than a preset average value.

[0148] Optionally, the use state determination submodule further includes:

[0149] A preset voice judgment unit, used to judge whether the preset application plays a preset voice when the terminal device runs the preset application;

[0150] The use state determination unit is used to determine that the Bluetooth headset is in a non-wearing state if a preset application plays a preset voice.

[0151] Optionally, the use status determination module 504 further includes:

[0152] The clustering submodule is used to cluster the multiple target distances currently calculated to obtain multiple cluster centers;

[0153] The cluster center judgment submodule is used to judge whether a new cluster center appears;

[0154] The non-wearing state determination submodule is used to determine that the Bluetooth headset is in a non-wearing state if a new cluster center appears.

[0155] Optionally, the use status determination module 504 further includes:

[0156] A distance curve fitting submodule, used for fitting a distance curve including a plurality of curve segments by taking the time of each preset period as the horizontal coordinate and the target distance calculated within the preset period as the vertical coordinate;

[0157] The probability calculation submodule is used to input the distance curve into the pre-trained usage status recognition model to obtain the probability that the Bluetooth headset is in a non-wearing state within the time corresponding to each curve segment;

[0158] When any probability is greater than a preset probability threshold, it is determined that the Bluetooth headset is in a non-wearing state;

[0159] Optionally, use the state recognition model trained with the following modules:

[0160] A sampling distance acquisition module is used to collect multiple sampling distances from the Bluetooth headset to the terminal device according to a preset period when the wearer is wearing the Bluetooth headset while running. The multiple sampling distances include the distances between the Bluetooth headset and the terminal device when the Bluetooth headset is in a wearing state and when the Bluetooth headset is not in a wearing state;

[0161] A sampling curve generating module, used to generate a sampling curve including a plurality of sample curve segments by using a plurality of sampling distances and sampling times of the distances, wherein the sample curve segments are marked with labels indicating the use status of the Bluetooth headset;

[0162] A probability acquisition module is used to input the sampling curve into the initialized usage status recognition model to obtain the probability that each sample curve segment belongs to the non-wearing state;

[0163] The model adjustment module is used to adjust the usage status recognition model through probability and label until convergence to obtain a trained usage status recognition model.

[0164] The Bluetooth headset connection control device provided in the embodiment of the present invention can execute the Bluetooth headset connection control method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0165] Embodiment 4

[0166] Reference Figure 6 , shows a schematic diagram of the structure of an electronic device in an example of the present invention. Figure 6 As shown, the electronic device may specifically include: a processor 601, a memory 602, a display screen 603 with a touch function, an input device 604, an output device 605, and a communication device 606. The number of processors 601 in the electronic device may be one or more. Figure 6 In the example, a processor 601 is used. The number of memories 602 in the electronic device may be one or more. Figure 6 A memory 602 is taken as an example. The processor 601, memory 602, display screen 603, input device 604, output device 605 and communication device 606 of the device can be connected through a bus or other means. Figure 6 The example of connecting through bus is taken in the following.

[0167] The memory 602 is a computer-readable storage medium that can be used to store software programs and computer executable programs. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating device and an application required for at least one function; the data storage area may store data created according to the use of the device, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 602 may further include a memory remotely arranged relative to the processor 601, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0168] The display screen 603 is a display screen 603 with a touch function, which can be a capacitive screen, an electromagnetic screen or an infrared screen. Generally speaking, the display screen 603 is used to display data according to the instructions of the processor 601, and is also used to receive touch operations acting on the display screen 603, and send corresponding signals to the processor 601 or other devices. Optionally, when the display screen 603 is an infrared screen, it also includes an infrared touch frame, which is arranged around the display screen 603, and can also be used to receive infrared signals and send the infrared signals to the processor 601 or other devices.

[0169] The communication device 606 is used to establish a communication connection with other devices, and may be a wired communication device and / or a wireless communication device.

[0170] The input device 604 can be used to receive input digital or character information, and generate key signal input related to user settings and function control of the device. The output device 605 can include audio equipment such as speakers. It should be noted that the specific composition of the input device 604 and the output device 605 can be set according to actual conditions.

[0171] The processor 601 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 602, that is, implements the above-mentioned Bluetooth headset connection control method.

[0172] Specifically, in the embodiment, when the processor 601 executes one or more programs stored in the memory 602, the Bluetooth headset connection control method provided by the embodiment of the present invention is specifically implemented.

[0173] Embodiment 5

[0174] Embodiment 5 of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the Bluetooth headset connection control method in any embodiment of the present invention can be implemented.

[0175] Of course, the storage medium containing computer executable instructions provided by an embodiment of the present invention is not limited to the method operations described above, and the computer executable instructions can also execute the Bluetooth headset connection control method provided by any embodiment of the present invention applied to a device.

[0176] It should be noted that, for the device, electronic device, and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0177] Through the above description of the implementation method, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute the Bluetooth headset connection control method described in each embodiment of the present invention.

[0178] It is worth noting that in the embodiment of the above-mentioned Bluetooth headset connection control device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0179] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A Bluetooth headset connection control method, It is characterized in that include: When the Bluetooth headset is connected to the terminal device, multiple positioning data of the terminal device are collected according to a preset period; Determining whether the wearer of the Bluetooth headset is in a running state according to the plurality of positioning data; If yes, calculate the target distance between the Bluetooth headset and the terminal device according to the Bluetooth signal strength; Determining whether the Bluetooth headset is in a non-wearing state according to the multiple target distances; If so, sending a disconnection message to the terminal device, and upon receiving the disconnection message, the terminal device stops connecting to the Bluetooth headset and switches the audio playback channel to speaker playback; The determining whether the Bluetooth headset is in a non-wearing state according to the multiple target distances includes: Whenever a target distance is calculated, the target distance is added to the head of a sliding window of a preset length, and a first average of a plurality of target distances in the sliding window is calculated; Calculate the absolute value of the difference between the first mean and the second mean, where the second mean is the mean calculated when the target distance is last added to the head of the sliding window; Determine whether the absolute value is greater than a preset mean; If so, it is determined that the Bluetooth headset is in a non-wearing state.

2. The method according to claim 1, It is characterized in that The determining, based on the plurality of positioning data, whether the wearer of the Bluetooth headset is in a running state comprises: Determining whether the terminal device is in a moving state by using a plurality of the positioning data; If so, it is determined that the wearer is in a running state.

3. The method according to claim 1, It is characterized in that When it is determined that the absolute value is greater than a preset value, the method further includes: When the terminal device runs a preset application, determining whether the preset application plays a preset voice; If so, it is determined that the Bluetooth headset is in a non-wearing state.

4. The method according to any one of claims 1 to 2, It is characterized in that The step of determining whether the Bluetooth headset is in a non-wearing state according to the plurality of target distances further includes: Clustering the multiple target distances currently calculated to obtain multiple cluster centers; Determine whether a new cluster center appears; If so, it is determined that the Bluetooth headset is in a non-wearing state.

5. The method according to any one of claims 1 to 2, It is characterized in that The step of determining whether the Bluetooth headset is in a non-wearing state according to the plurality of target distances further includes: Fitting a distance curve including a plurality of curve segments by taking the time of each preset period as the abscissa and the target distance calculated within the preset period as the ordinate; Inputting the target distance curve into a pre-trained usage status recognition model to obtain the probability that the Bluetooth headset is in a non-wearing state within the time period corresponding to each curve segment; When any of the probabilities is greater than a preset probability threshold, it is determined that the Bluetooth headset is in a non-wearing state.

6. The method according to claim 5, It is characterized in that The usage status recognition model is trained in the following way: When the wearer wears the Bluetooth headset while running, multiple sampling distances from the Bluetooth headset to the terminal device are collected according to a preset period, and the multiple sampling distances include the distances between the Bluetooth headset and the terminal device when the Bluetooth headset is in a wearing state and a non-wearing state; A sampling curve including a plurality of sample curve segments is generated by using a plurality of the sampling distances and the sampling time of the target distance, wherein the sample curve segments are marked with labels indicating the use status of the Bluetooth headset; Inputting the sampling curve into the initialized usage status recognition model to obtain the probability that each of the sample curve segments belongs to the non-wearing state; The usage status recognition model is adjusted by using the probability and the label until convergence to obtain a trained usage status recognition model.

7. A Bluetooth headset connection control device, It is characterized in that include: A positioning data collection module, used to collect multiple positioning data of the terminal device according to a preset period when the Bluetooth headset is connected to the terminal device; A running state determination module, used for determining whether the wearer of the Bluetooth headset is in a running state according to the plurality of positioning data; A target distance calculation module, used to calculate the target distance between the Bluetooth headset and the terminal device according to the Bluetooth signal strength when the wearer of the Bluetooth headset is in a running state; A usage status judgment module is used to judge whether the Bluetooth headset is in a non-wearing state according to the multiple target distances; A signal sending module, used for sending a disconnection message to the terminal device when the Bluetooth headset is not worn, and the terminal device stops connecting with the Bluetooth headset upon receiving the disconnection message, and switches the audio playback channel to speaker playback; The usage status judgment module includes: A first mean value calculation submodule, configured to add the target distance to the head of a sliding window of a preset length each time a target distance is calculated, and calculate a first mean value of multiple target distances in the sliding window; An absolute value calculation submodule, used to calculate the absolute value of the difference between the first mean and the second mean, where the second mean is the mean calculated when the target distance is added to the head of the sliding window last time; The absolute value judgment submodule is used to judge whether the absolute value is greater than the preset mean; The state determination submodule is used to determine that the Bluetooth headset is in a non-wearing state when the absolute value is greater than a preset average value.

8. An electronic device, It is characterized in that The electronic device comprises: one or more processors; a memory for storing one or more computer programs, When the one or more computer programs are executed by the one or more processors, the one or more processors implement the Bluetooth headset connection control method according to any one of claims 1 to 6.

9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the Bluetooth headset connection control method according to any one of claims 1 to 6 is implemented.