CN112291683B - TWS earphone control method and device - Google Patents

TWS earphone control method and device Download PDF

Info

Publication number
CN112291683B
CN112291683B CN202011107582.5A CN202011107582A CN112291683B CN 112291683 B CN112291683 B CN 112291683B CN 202011107582 A CN202011107582 A CN 202011107582A CN 112291683 B CN112291683 B CN 112291683B
Authority
CN
China
Prior art keywords
earphone
headset
rate
terminal
period
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
CN202011107582.5A
Other languages
Chinese (zh)
Other versions
CN112291683A (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.)
Guangzhou Ankai Microelectronics Co ltd
Original Assignee
Guangzhou Ankai Microelectronics 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 Guangzhou Ankai Microelectronics Co ltd filed Critical Guangzhou Ankai Microelectronics Co ltd
Priority to CN202011107582.5A priority Critical patent/CN112291683B/en
Publication of CN112291683A publication Critical patent/CN112291683A/en
Application granted granted Critical
Publication of CN112291683B publication Critical patent/CN112291683B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R3/00Circuits for transducers, loudspeakers or microphones
    • H04R3/12Circuits for transducers, loudspeakers or microphones for distributing signals to two or more loudspeakers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R29/00Monitoring arrangements; Testing arrangements
    • H04R29/001Monitoring arrangements; Testing arrangements for loudspeakers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R2420/00Details of connection covered by H04R, not provided for in its groups
    • H04R2420/05Detection of connection of loudspeakers or headphones to amplifiers

Abstract

The application discloses a control method and a device of a TWS earphone, wherein the TWS earphone comprises a main earphone and an auxiliary earphone, a communication link is established between the main earphone and a terminal, and an interception link is established between the auxiliary earphone and the terminal, the method comprises the following steps: the method comprises the steps of obtaining a first number of data packets sent by a terminal to a first earphone in a current time period, and obtaining a second number of data packets sent by the first earphone to a second earphone in the current time period, wherein the first earphone is set as a main earphone in the current time period, and the second earphone is set as an auxiliary earphone in the current time period. And acquiring the short-time packet complementing rate of the first earphone in the current time period according to the first quantity and the second quantity. And detecting a difference value between the short-time packet supplementing rate and the average packet supplementing rate, switching the first earphone into an auxiliary earphone and switching the second earphone into a main earphone when the difference value exceeds a preset value, wherein the average packet supplementing rate is determined according to the number of data packets sent to the auxiliary earphone by the main earphone in the monitoring period and the number of data packets received by the main earphone to the terminal in the monitoring period.

Description

TWS earphone control method and device
Technical Field
The present application relates to the field of portable listening devices, and in particular, to a method and an apparatus for controlling a TWS headset.
Background
The TWS (true Wireless stereo) earphone is a mode that a Bluetooth channel between intelligent equipment and a main earphone and a Bluetooth channel between the main earphone and an auxiliary earphone are established, then the auxiliary earphone only monitors data of the intelligent equipment, no confirmation mechanism exists between the auxiliary earphone and the intelligent equipment, and only a stable link is formed between the auxiliary earphone and the main earphone, so that power balance and bandwidth requirements of the main earphone and the auxiliary earphone are considered. However, since the smart device only establishes a stable communication link with the primary headset and the secondary headset only establishes a monitoring link with the smart device, nonresistive factors such as environmental interference may cause the signals received by the secondary headset to be lost. Therefore, in the prior art, the main earphone is adopted to supplement the packet for the auxiliary earphone in real time so as to ensure that the auxiliary earphone receives the complete signal. However, when the prior art is adopted to supplement the packet in real time, it is found that when the intelligent device and the auxiliary earphone are blocked or have a long distance, the packet loss rate of the auxiliary earphone is high. At this moment, the signal packets which need to be given to the auxiliary earphone by the main earphone will be increased, and the bandwidth between the main earphone and the auxiliary earphone and the intelligent equipment is occupied too much in serious cases, so that the problems of unsmooth audio playing and delay are caused, and the transmitting power consumption of the main earphone can be increased.
Disclosure of Invention
The present application aims to solve at least one of the technical problems in the prior art, and provides a method and an apparatus for controlling a TWS headset, so as to reduce an average packet complementing rate of an auxiliary headset and improve stability of signal reception of a monitored link.
The embodiment of the application provides a control method of a TWS earphone, wherein the TWS earphone comprises a main earphone and a secondary earphone, the main earphone is used for establishing a communication link with a terminal, the secondary earphone is used for establishing a monitoring link with the terminal, and the method comprises the following steps:
the method comprises the steps of obtaining a first number of data packets sent by a terminal to a first earphone in a current time period, and obtaining a second number of data packets sent by the first earphone to a second earphone in the current time period, wherein the first earphone is set as a main earphone in the current time period, and the second earphone is set as an auxiliary earphone in the current time period.
And acquiring the short-time packet complementing rate of the first earphone in the current time period according to the first quantity and the second quantity.
And detecting a difference value between the short-time packet supplementing rate and the average packet supplementing rate, switching the first earphone into an auxiliary earphone and switching the second earphone into a main earphone when the difference value exceeds a preset value, wherein the average packet supplementing rate is determined according to the number of data packets sent to the auxiliary earphone by the main earphone in the monitoring period and the number of data packets received by the main earphone to the terminal in the monitoring period.
Further, the switching the first earphone to the auxiliary earphone and the second earphone to the main earphone includes:
the method comprises the steps of detecting the communication state of a first earphone and a second earphone in real time, initiating a first switching instruction to the first earphone when detecting that the first earphone is communicated with the second earphone, sending a second switching instruction to the second earphone through the first earphone after switching a link between the first earphone and a terminal into an interception link according to the first switching instruction, and switching the link between the second earphone and the terminal into a communication link according to the second switching instruction.
Further, detecting the communication state of the first earphone and the second earphone in real time includes:
and generating an event trigger mark, and detecting the communication state of the first earphone and the second earphone according to the event trigger mark.
Further, after the switching the link between the second earphone and the terminal to the communication link according to the second switching instruction, the method further includes:
the event trigger flag is deleted.
Further, before obtaining the first number of data packets sent by the terminal to the first headset in the current time period, the method further includes:
and acquiring a second packet complementing rate of the first earphone in the first initial period, wherein the first earphone is set as the main earphone in the first initial period, the second packet complementing rate is obtained according to the number of data packets sent to the second earphone by the first earphone in the first initial period and the number of data packets received by the terminal by the first earphone in the first initial period, and the second earphone is set as the auxiliary earphone in the first initial period.
And after the second packet complementing rate is obtained, switching the first earphone to the auxiliary earphone in the second initial period, switching the second earphone to the main earphone in the second initial period, and obtaining a third packet complementing rate of the second earphone in the second initial period, wherein the third packet complementing rate is obtained according to the number of data packets sent to the first earphone by the second earphone in the second initial period and the number of data packets received by the terminal by the second earphone in the second initial period.
And comparing the second packet supplementing rate with the third packet supplementing rate, and setting the first earphone as the main earphone when the second packet supplementing rate is not greater than the third packet supplementing rate.
Further, the first initial period and the second initial period have the same duration.
Further, in the embodiment of the present application, the method further includes:
and when the difference value is less than or equal to the preset value, keeping the current states of the first earphone and the second earphone.
Further, the monitoring time period is a global time length from an initial time when the terminal sends the data packet to the main earphone to a current time, and the global time length is an integral multiple of the time length of the current time period.
Further, in an embodiment of the present application, there is provided a control apparatus for a TWS headset including a primary headset having a communication link established with a terminal and a secondary headset having a listening link established with the terminal, including:
the acquiring module is used for acquiring a first number of data packets sent by the terminal to the first earphone in the current time period and acquiring a second number of data packets sent by the first earphone to the second earphone in the current time period, wherein the first earphone is set as a main earphone in the current time period, and the second earphone is set as an auxiliary earphone in the current time period.
And the processing module is used for acquiring the short-time packet supplementing rate of the first earphone in the current time period according to the first quantity and the second quantity.
And the switching module is used for detecting the difference value between the short-time packet supplementing rate and the average packet supplementing rate, switching the first earphone into the auxiliary earphone and switching the second earphone into the main earphone when the difference value exceeds a preset value, wherein the average packet supplementing rate is determined according to the number of data packets sent to the auxiliary earphone by the main earphone in the monitoring period and the number of data packets received by the main earphone to the terminal in the monitoring period.
Further, an embodiment of the present application provides a communication system, which includes a terminal device and the TWS headset according to the above embodiment.
Further, an embodiment of the present application provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor when executing the program implementing the control method of the TWS headset as described in the above embodiments.
Further, the present application provides a computer-readable storage medium storing computer-executable instructions for causing a computer to execute the control method of the TWS headset according to the above embodiment.
Compared with the prior art, the embodiment obtains the short-time packet supplementing rate of the current time period through the data packet quantity sent by the terminal to the first earphone and the data packet quantity sent by the first earphone to the second earphone, and then compares the difference value between the short-time packet supplementing rate and the average packet supplementing rate with the preset value, and switches the main earphone and the auxiliary earphone when the difference value is larger than the preset value, so that the main earphone and the auxiliary earphone are switched in time when the quality of the monitoring link is poor, the average packet supplementing rate of the auxiliary earphone is reduced, and the stability of receiving the monitoring link signal is improved.
In the embodiment, the link is switched to the monitoring link by sending the switching instruction to the first earphone, and then the link is switched to the communication link by sending the switching instruction to the second earphone, so that the packet sending of the terminal can be ensured not to be lost, and the problem of delay or blockage of the playing can not be caused.
The embodiment detects the communication state of the first earphone and the second earphone by generating the event trigger mark and deletes the event trigger mark after the switching of the main earphone and the auxiliary earphone, so that the detection of the communication state is more accurate and the switching efficiency of the main earphone and the auxiliary earphone is higher.
In the embodiment, before the short-time packet supplementing rate is obtained, the primary and secondary earphones are set and the packet supplementing rates in two consecutive initial periods are obtained, and the packet supplementing rates in the two initial periods are compared to determine the setting of the primary and secondary earphones in the initial periods, so that the low packet supplementing rate of the primary earphone set in the initial role setting stage is ensured, and the situation that the primary and secondary earphones are in a state with a high packet supplementing rate after the initial role setting stage is finished, the short-time packet supplementing rate monitored in the subsequent monitoring stage cannot exceed the average packet supplementing rate, and further the primary and secondary switching events cannot be triggered, so that the whole playing period is in a high packet supplementing rate state.
Drawings
The present application is further described with reference to the following figures and examples;
fig. 1 is a schematic diagram of a TWS headset.
Fig. 2 is a flowchart illustrating a control method of a TWS headset according to an embodiment.
Fig. 3 is a diagram illustrating the switching of the primary and secondary earpieces during a monitoring period in one embodiment.
Fig. 4 is a flowchart illustrating a control method of a TWS headset according to another embodiment.
Fig. 5 is a schematic interaction diagram of the terminal and the primary and secondary earphones before and after a switching process of the primary and secondary earphones in one embodiment.
Fig. 6 is a flowchart illustrating a control method of a TWS headset according to another embodiment.
Fig. 7 is a diagram illustrating initialization of the primary and secondary earpieces in one embodiment.
Fig. 8 is a schematic diagram of packet repair rate and interception effect in the prior art and the present application.
Fig. 9 is a schematic structural diagram of a control device of a TWS headset according to an embodiment.
Fig. 10 is a schematic structural diagram of a control device of a TWS headset according to another embodiment.
Detailed Description
Reference will now be made in detail to the present embodiments of the present application, preferred embodiments of which are illustrated in the accompanying drawings, which are for the purpose of visually supplementing the description with figures and detailed description, so as to enable a person skilled in the art to visually and visually understand each and every feature and technical solution of the present application, but not to limit the scope of the present application.
The TWS headset is a hand-free headset in which a TWS (True Wireless Stereo) technology is applied, and left and right earphones are respectively provided with independent bluetooth so that the earphones have left and right sound channels which are separated in a real sense. The TWS earphone is a mode that a Bluetooth channel between the intelligent device and the main earphone and a Bluetooth channel between the main earphone and the auxiliary earphone are established, then the auxiliary earphone only monitors data of the intelligent device, no confirmation mechanism exists between the auxiliary earphone and the intelligent device, and only the auxiliary earphone is stably linked with the main earphone, so that power consumption balance and bandwidth requirements of the main earphone and the auxiliary earphone are considered. However, since the smart device only establishes a stable communication link with the primary headset and the secondary headset only establishes a monitoring link with the smart device, nonresistive factors such as environmental interference may cause the signals received by the secondary headset to be lost.
Therefore, in the prior art, the main earphone is adopted to supplement the packet for the auxiliary earphone in real time so as to ensure that the auxiliary earphone receives the complete signal. However, when the prior art is adopted to supplement the packet in real time, it is found that when the intelligent device and the auxiliary earphone are blocked or have a long distance, the packet loss rate of the auxiliary earphone is high. At this moment, the signal packets which need to be given to the auxiliary earphone by the main earphone will be increased, and the bandwidth between the main earphone and the auxiliary earphone and the intelligent equipment is occupied too much in serious cases, so that the problems of unsmooth audio playing and delay are caused, and the transmitting power consumption of the main earphone can be increased. In order to solve the above technical problem, embodiments of the present application provide a method and an apparatus for controlling a TWS headset.
Hereinafter, the TWS headset control method provided in the embodiments of the present application will be described and explained in detail through several specific embodiments.
As shown in fig. 1, in the embodiment of the present application, the terminal may be a mobile phone, a notebook computer, a tablet computer, and the like. The TWS headset and the terminal are communicated through Bluetooth, and control components are arranged in the TWS headset and the terminal and used for executing the control method, and the control components can be Bluetooth chips or microcontrollers.
In one embodiment, as shown in fig. 2, a method of controlling a TWS headset is provided. The present embodiment is mainly illustrated with the method applied to the control part in the TWS headset.
Referring to fig. 2, the TWS headset includes a primary headset establishing a communication link with the terminal and a secondary headset establishing a listening link with the terminal, and the control method of the TWS headset specifically includes the following steps:
s11, acquiring a first number of data packets sent by the terminal to the first earphone in the current time period, and acquiring a second number of data packets sent by the first earphone to the second earphone in the current time period, wherein the first earphone is set as the primary earphone in the current time period, and the second earphone is set as the secondary earphone in the current time period.
In this embodiment, since the first earphone is set as the primary earphone and the second earphone is set as the secondary earphone in the current time period, the link between the first earphone and the terminal is a communication link and the link between the second earphone and the terminal is a listening link.
And S12, acquiring the short-time packet complementing rate of the first earphone in the current time period according to the first quantity and the second quantity.
In one embodiment, the short-term packet-filling rate is equal to the second number/the first number.
And S13, detecting the difference value between the short-time packet supplementing rate and the average packet supplementing rate, switching the first earphone to the auxiliary earphone when the difference value exceeds a preset value, and switching the second earphone to the main earphone, wherein the average packet supplementing rate is determined according to the number of data packets sent to the auxiliary earphone by the main earphone in the monitoring period and the number of data packets received by the main earphone to the terminal in the monitoring period.
In one embodiment, the monitoring period is a global time length from a starting time when the terminal sends the data packet to the main earphone to a current time, and the global time length is an integral multiple of the time length of the current time period.
In this embodiment, the monitoring period and the initial role setting stage are seamlessly connected, that is, the monitoring period starts at the next time after the initial role setting stage is finished.
In this embodiment, the average packet complementing rate is equal to the number of packets sent by the master earphone to the slave earphone during the monitoring period/the number of packets received by the master earphone to the terminal during the monitoring period.
In this embodiment, the method further includes:
and when the difference value is less than or equal to the preset value, keeping the current states of the first earphone and the second earphone.
In this embodiment, when switching between the primary and secondary earphones, the difference between the short-time packet-complementing rate and the average packet-complementing rate needs to be detected first. For this difference, there are two cases, namely, the short-time padding rate is greater than the average padding rate, and the short-time padding rate is less than the average padding rate. And when the short-time packet supplementing rate is smaller than the average packet supplementing rate, the main earphone and the auxiliary earphone are not switched. And when the short-time packet supplementing rate is greater than the average packet supplementing rate, comparing the difference value with a preset value, and when the difference value is less than the preset value, not switching the main earphone and the auxiliary earphone. And when the difference value is larger than the preset value, the main earphone and the auxiliary earphone are switched.
In the present embodiment, the case of the short-time padding rate for a plurality of periods is shown in fig. 3. The duration of each period is set to 10 seconds, for a total of five periods, so the global duration of the monitoring period is 50 seconds, and the preset value is set to 10%.
In the actual music playing process, namely the process of sending data by the intelligent equipment, the monitoring time interval continuously extends along with the playing time length, and the short-time packet supplementing rate in the 10-second time interval is compared with the global packet supplementing rate at the moment every 10 seconds to judge whether the switching of the main earphone and the auxiliary earphone is needed. Therefore, in the embodiment of the present application, the global duration of the monitoring period is not limited to 50 seconds as shown in fig. 3.
As shown in fig. 3, the short-time packet supplementing rates of the first 4 periods, that is, the first 4 periods with a duration of 10 seconds, all belong to the case of not switching between the primary and secondary earphones, that is, the short-time packet supplementing rate of a partial period in the first 4 periods is less than or equal to the average packet supplementing rate, and the difference between the short-time packet supplementing rate of the partial period and the average packet supplementing rate is less than 10%.
The difference value between the short-time packet complementing rate and the average packet complementing rate in the 5 th time interval is larger than 10%, and the switching of the main earphone and the auxiliary earphone is initiated in the time interval.
In another embodiment, as shown in fig. 4, a method of controlling a TWS headset is provided. The present embodiment is mainly illustrated with the method applied to the control part in the TWS headset.
Referring to fig. 4, the TWS headset includes a primary headset establishing a communication link with the terminal and a secondary headset establishing a listening link with the terminal, and the control method of the TWS headset specifically includes the following steps:
s21, acquiring a first number of data packets sent by the terminal to the first earphone in the current time period, and acquiring a second number of data packets sent by the first earphone to the second earphone in the current time period, wherein the first earphone is set as the primary earphone in the current time period, and the second earphone is set as the secondary earphone in the current time period.
And S22, acquiring the short-time packet complementing rate of the first earphone in the current time period according to the first quantity and the second quantity.
In one embodiment, the short-term packet-filling rate is equal to the second number/the first number.
And S23, detecting a difference value between the short-time packet supplementing rate and the average packet supplementing rate, detecting the communication state of the first earphone and the second earphone in real time when the difference value exceeds a preset value, initiating a first switching instruction to the first earphone when the first earphone and the second earphone are detected to communicate, switching the link between the first earphone and the terminal into an interception link according to the first switching instruction, and sending a second switching instruction to the second earphone through the first earphone so as to switch the link between the second earphone and the terminal into a communication link according to the second switching instruction. The average packet supplementing rate is determined according to the number of data packets sent to the auxiliary earphone by the main earphone in the monitoring period and the number of data packets received by the main earphone to the terminal in the monitoring period.
In one embodiment, detecting the communication status of the first earphone and the second earphone in real time comprises:
and generating an event trigger mark, and detecting the communication state of the first earphone and the second earphone according to the event trigger mark.
After the switching the link between the second earphone and the terminal to the communication link according to the second switching instruction, the method further includes:
the event trigger flag is deleted.
In this embodiment, as shown in fig. 5, the link between the first earphone of the main earphone and the terminal is a communication link, the link between the second earphone of the auxiliary earphone and the terminal is a listening link, and the link between the first earphone of the main earphone and the second earphone of the auxiliary earphone is a main-auxiliary link. In each time interval, after the terminal sends a data packet to the first earphone of the main earphone through the communication link and the second earphone of the auxiliary earphone intercepts the data packet sent by the terminal through the interception link, the first earphone of the main earphone is switched to the main and auxiliary links from the communication link, and the data packet which is not intercepted by the second earphone of the auxiliary earphone is sent to the second earphone of the auxiliary earphone. That is, in each period, a communication link (listening link) bandwidth period and a primary-secondary link bandwidth period are divided. And after the first earphone of the main earphone receives the data packet sent by the terminal in each time period, the ACK is replied through the communication link, and the data sent is confirmed to be received without errors. As shown in fig. 5, in the 2 nd period, when it is detected that the difference between the short-time packet complementing rate of the first earphone of the master earphone and the average packet complementing rate is greater than the preset value, an event trigger flag mode _ switch is generated to be 1, and when it is detected that the event trigger flag mode _ switch is 1, the bandwidth period condition is detected. As shown in fig. 5, in the 2 nd period, when the first earphone of the master earphone is switched from the communication link to the master-slave link, the control unit sends a first switching instruction to the first earphone to turn off the sending function of the communication link between the first earphone and the terminal according to the first switching instruction, so as to switch to the listening link, and then sends a second switching instruction to the second earphone through the master-slave link by the first earphone to turn on the sending function of the listening link between the second earphone and the terminal according to the second switching instruction, so as to switch to the communication link, and the second earphone replies ACK to the first earphone through the master-slave link. And after the first earphone receives the ACK, deleting the event trigger mark mode _ switch which is 0 to complete the switching of the main earphone and the auxiliary earphone, wherein the main earphone is the second earphone and the auxiliary earphone is the first earphone.
In yet another embodiment, as shown in fig. 6, a control method of a TWS headset is provided. The present embodiment is mainly illustrated by the application of the method to the control part of a TWS headset badge.
Referring to fig. 6, the TWS headset includes a primary headset that establishes a communication link with the terminal, and a secondary headset that establishes a listening link with the terminal, and the control method of the TWS headset specifically includes the following steps:
s31, obtaining a second packet complementing rate of the first earphone in the first initial time period, where the first earphone is set as the primary earphone in the first initial time period, the second packet complementing rate is obtained according to the number of packets sent by the first earphone to the second earphone in the first initial time period, and the number of packets received by the first earphone from the terminal in the first initial time period, and the second earphone is set as the secondary earphone in the first initial time period.
In one embodiment, the second packet complementing rate is equal to the number of data packets sent by the first headset to the second headset in the first initial period/the number of data packets received by the first headset to the terminal in the first initial period.
And S32, after the second packet complementing rate is obtained, switching the first earphone to the auxiliary earphone in the second initial period, switching the second earphone to the main earphone in the second initial period, and obtaining a third packet complementing rate of the second earphone in the second initial period, wherein the third packet complementing rate is obtained according to the number of data packets sent to the first earphone by the second earphone in the second initial period and the number of data packets received by the terminal by the second earphone in the second initial period.
In one embodiment, the third packet complementing rate is equal to the number of data packets sent by the second headset to the first headset in the second initial period/the number of data packets received by the second headset to the terminal in the second initial period.
In one embodiment, the first initial period and the second initial period have the same duration, that is, the second packet complementing rate and the third packet complementing rate have the same time, so that the primary and secondary handover decisions based on the magnitude relationship between the second packet complementing rate and the third packet complementing rate are more accurate.
And S33, comparing the second packet complementing rate with the third packet complementing rate, and setting the first earphone as the main earphone when the second packet complementing rate is not greater than the third packet complementing rate.
S34, acquiring a first number of data packets sent by the terminal to the first earphone in the current time period, and acquiring a second number of data packets sent by the first earphone to the second earphone in the current time period, wherein the first earphone is set as the primary earphone in the current time period, and the second earphone is set as the secondary earphone in the current time period.
And S35, acquiring the short-time packet complementing rate of the first earphone in the current time period according to the first quantity and the second quantity.
And S36, detecting the difference value between the short-time packet supplementing rate and the average packet supplementing rate, switching the first earphone to the auxiliary earphone when the difference value exceeds a preset value, and switching the second earphone to the main earphone, wherein the average packet supplementing rate is determined according to the number of data packets sent to the auxiliary earphone by the main earphone in the monitoring period and the number of data packets received by the main earphone to the terminal in the monitoring period.
In the present embodiment, as shown in fig. 7, the process a is the steps S31 to S33 in the above embodiment, and the process B is the steps S34 to S36 in the above embodiment. In procedure a, the first initial period and the second initial period are both T0-15 in duration. And acquiring a second packet complementing rate in the first initial period, and switching the main earphone and the auxiliary earphone after the first initial period is finished. And acquiring a third packet complementing rate in a second initial period, and determining whether to carry out primary and secondary switching according to the magnitude relation between the second packet complementing rate and the third packet complementing rate after the second initial period is finished.
In this embodiment, since the short-time packet complementing rate in the first time period in the test time period is the average packet complementing rate at the current time, by increasing the initial settings of the primary and secondary earphones, it can be better ensured that the bandwidth occupied by the primary and secondary links is effectively reduced and the power consumption of the primary earphones is reduced before the next primary and secondary switching is performed.
The first initial time interval and the second initial time interval are collectively referred to as an initial role setting phase. In the initial role setting stage of this embodiment, the primary and secondary earphones are set first, the packet supplementing rates in two consecutive initial periods are obtained, and the packet supplementing rates in the two initial periods are compared to determine the setting of the primary and secondary earphones in the initial state, so that it is ensured that the packet supplementing rate of the primary earphone set in the initial role setting stage is low, and it is avoided that the primary and secondary earphones are in a state with a high packet supplementing rate after the initial role setting stage is ended, which results in that the short-time packet supplementing rate monitored in the following monitoring stage cannot exceed the average packet supplementing rate, and further, a primary and secondary switching event cannot be triggered, so that the whole playing period is in a state with a high packet supplementing rate.
In this embodiment, at least one major-minor switch and at most two switches are required in the initial role setting stage. Performing primary and secondary switching unconditionally in the initial role setting stage, comparing the packet supplementing rates before and after switching, and if the packet supplementing rate after switching is lower, indicating that the switching is right and the secondary primary and secondary switching is not needed; if the packet complementing rate after switching becomes high, switching back again is needed.
As shown in fig. 8, by detecting the change of the packet complementing rate in real time, it can be seen that compared with the existing TWS headset communication situation, the average packet complementing rate is maintained at a lower level by using the control method of the TWS headset in the embodiment of the present application, which can reduce the data load of the primary and secondary links, reduce the bandwidth of the primary and secondary links, and reduce the power consumption of the primary headset.
In one embodiment, as shown in fig. 9, there is provided a control apparatus of a TWS headset including a primary headset having a communication link established with a terminal and a secondary headset having a listening link established with the terminal, including:
the obtaining module 101 is configured to obtain a first number of data packets sent by a terminal to a first earphone in a current time period, and obtain a second number of data packets sent by the first earphone to a second earphone in the current time period, where the first earphone is set as a primary earphone in the current time period, and the second earphone is set as a secondary earphone in the current time period.
And the processing module 102 is configured to obtain a short-time packet complementing rate of the first earphone in the current time period according to the first number and the second number.
And the switching module 103 is configured to detect a difference between the short-time packet supplementing rate and the average packet supplementing rate, switch the first earphone to the secondary earphone and switch the second earphone to the primary earphone when the difference exceeds a preset value, where the average packet supplementing rate is determined according to the number of data packets sent to the secondary earphone by the primary earphone in the monitoring period and the number of data packets received by the terminal by the primary earphone in the monitoring period.
In an embodiment, the switching module 103 is further configured to: detecting a difference value between the short-time packet supplementing rate and the average packet supplementing rate, detecting the communication state of the first earphone and the second earphone in real time when the difference value exceeds a preset value, initiating a first switching instruction to the first earphone when the first earphone and the second earphone are detected to be communicated, and sending a second switching instruction to the second earphone through the first earphone after a link between the first earphone and the terminal is switched to an interception link according to the first switching instruction so as to switch a link between the second earphone and the terminal to a communication link according to the second switching instruction. The average packet supplementing rate is determined according to the number of data packets sent to the auxiliary earphone by the main earphone in the monitoring period and the number of data packets received by the main earphone to the terminal in the monitoring period.
In an embodiment, the switching module 103 is further configured to: and generating an event trigger mark, detecting the communication state of the first earphone and the second earphone according to the event trigger mark, and deleting the event trigger mark after switching the link between the second earphone and the terminal into a communication link according to a second switching instruction.
In another embodiment, as shown in fig. 10, there is provided a control apparatus of a TWS headset including a primary headset having a communication link established with a terminal and a secondary headset having a listening link established with the terminal, including:
an initial module 201, configured to obtain a second packet complementing rate of the first earphone in the first initial period, where the first earphone is set as the primary earphone in the first initial period, the second packet complementing rate is obtained according to the number of data packets sent by the first earphone to the second earphone in the first initial period, and the number of data packets received by the first earphone from the terminal in the first initial period, and the second earphone is set as the secondary earphone in the first initial period. And after the second packet complementing rate is obtained, switching the first earphone to the auxiliary earphone in the second initial period, switching the second earphone to the main earphone in the second initial period, and obtaining a third packet complementing rate of the second earphone in the second initial period, wherein the third packet complementing rate is obtained according to the number of data packets sent to the first earphone by the second earphone in the second initial period and the number of data packets received by the terminal by the second earphone in the second initial period. And comparing the second packet supplementing rate with the third packet supplementing rate, and setting the first earphone as the main earphone when the second packet supplementing rate is not greater than the third packet supplementing rate.
The obtaining module 202 is configured to obtain a first number of data packets sent by the terminal to the first earphone in a current time period, and obtain a second number of data packets sent by the first earphone to the second earphone in the current time period, where the first earphone is set as a primary earphone in the current time period, and the second earphone is set as a secondary earphone in the current time period.
And the processing module 203 is configured to obtain the short-time packet complementing rate of the first earphone in the current time period according to the first number and the second number.
And the switching module 204 is configured to detect a difference between the short-time packet supplementing rate and the average packet supplementing rate, switch the first earphone to the secondary earphone and switch the second earphone to the primary earphone when the difference exceeds a preset value, where the average packet supplementing rate is determined according to the number of data packets sent to the secondary earphone by the primary earphone in the monitoring period and the number of data packets received by the terminal by the primary earphone in the monitoring period.
In one embodiment, a communication system is provided comprising a terminal device, a TWS headset and a control means for the TWS headset as described in the above embodiments.
Further, an embodiment of the present application provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor when executing the program implementing the control method of the TWS headset as described in the above embodiments.
Further, the present application provides a computer-readable storage medium storing computer-executable instructions for causing a computer to execute the control method of the TWS headset according to the above embodiment.
The foregoing is a preferred embodiment of the present application, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present application, and these modifications and decorations are also regarded as the protection scope of the present application.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.

Claims (10)

1. A method of controlling a TWS headset including a primary headset having a communication link established with a terminal and a secondary headset having a listening link established with the terminal, comprising:
acquiring a first number of data packets sent by the terminal to a first earphone in a current time period, and acquiring a second number of data packets sent by the first earphone to a second earphone in the current time period, wherein the first earphone is set as the primary earphone in the current time period, and the second earphone is set as the secondary earphone in the current time period;
acquiring the short-time packet complementing rate of the first earphone in the current time period according to the first quantity and the second quantity;
and detecting a difference value between the short-time packet supplementing rate and the average packet supplementing rate, and switching the first earphone into the auxiliary earphone and switching the second earphone into the main earphone when the difference value exceeds a preset value, wherein the average packet supplementing rate is determined according to the number of data packets sent to the auxiliary earphone by the main earphone in a monitoring period and the number of data packets received by the main earphone at the terminal in the monitoring period, and the monitoring period is the global time from the initial time when the terminal sends the data packets to the main earphone to the current time.
2. The method of controlling a TWS headset of claim 1, wherein the switching the first headset to the secondary headset and the second headset to the primary headset comprises:
detecting the communication state of the first earphone and the second earphone in real time, and when detecting that the first earphone is communicated with the second earphone, initiating a first switching instruction to the first earphone so as to switch the link between the first earphone and the terminal to the interception link according to the first switching instruction, and then sending a second switching instruction to the second earphone through the first earphone so as to switch the link between the second earphone and the terminal to the communication link according to the second switching instruction.
3. The method of controlling a TWS headset of claim 2, wherein detecting the communication status of the first headset and the second headset in real time comprises:
and generating an event trigger mark, and detecting the communication state of the first earphone and the second earphone according to the event trigger mark.
4. The method of controlling a TWS headset of claim 3, further comprising, after the switching the link between the second headset and the terminal to the communication link according to the second switching instruction:
deleting the event trigger flag.
5. The method of claim 1, wherein before obtaining the first number of packets sent by the terminal to the first headset in the current time period, the method further comprises:
acquiring a second packet complementing rate of the first earphone in a first initial period, wherein the first earphone is set as the primary earphone in the first initial period, the second packet complementing rate is obtained according to the number of data packets sent to the second earphone by the first earphone in the first initial period and the number of data packets received by the terminal by the first earphone in the first initial period, and the second earphone is set as the secondary earphone in the first initial period;
after the second packet complementing rate is obtained, switching the first earphone to the secondary earphone in a second initial period, switching the second earphone to the primary earphone in the second initial period, and obtaining a third packet complementing rate of the second earphone in the second initial period, wherein the third packet complementing rate is obtained according to the number of data packets sent to the first earphone by the second earphone in the second initial period and the number of data packets received by the second earphone from the terminal in the second initial period;
and comparing the second packet complementing rate with the third packet complementing rate, and setting the first earphone as the main earphone when the second packet complementing rate is not greater than the third packet complementing rate.
6. The method of claim 5, wherein the first initial period is the same duration as the second initial period.
7. The method of controlling a TWS headset of claim 1, further comprising:
and when the difference value is smaller than or equal to the preset value, keeping the current states of the first earphone and the second earphone.
8. The method of any of claims 1-7, wherein the monitoring period is a global duration from a starting time when the terminal sends a packet to the primary earpiece to a current time, and the global duration is an integer multiple of a duration of the current period.
9. A control apparatus of a TWS headset including a primary headset having a communication link established with a terminal, and a secondary headset having a listening link established with the terminal, comprising:
an obtaining module, configured to obtain a first number of data packets sent by the terminal to a first headset in a current time period, and obtain a second number of data packets sent by the first headset to a second headset in the current time period, where the first headset is set as the primary headset in the current time period, and the second headset is set as the secondary headset in the current time period;
the processing module is used for acquiring the short-time packet supplementing rate of the first earphone in the current time period according to the first quantity and the second quantity;
and the switching module is used for detecting the difference value between the short-time packet supplementing rate and the average packet supplementing rate, switching the first earphone into the auxiliary earphone and switching the second earphone into the main earphone when the difference value exceeds a preset value, wherein the average packet supplementing rate is determined according to the number of data packets sent to the auxiliary earphone by the main earphone in a monitoring period and the number of data packets received by the terminal by the main earphone in the monitoring period, and the monitoring period is the global time from the initial time when the terminal sends the data packets to the main earphone to the current time.
10. An electronic device, a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the control method of a TWS headset according to any of claims 1 to 8 when executing the program.
CN202011107582.5A 2020-10-15 2020-10-15 TWS earphone control method and device Active CN112291683B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011107582.5A CN112291683B (en) 2020-10-15 2020-10-15 TWS earphone control method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011107582.5A CN112291683B (en) 2020-10-15 2020-10-15 TWS earphone control method and device

Publications (2)

Publication Number Publication Date
CN112291683A CN112291683A (en) 2021-01-29
CN112291683B true CN112291683B (en) 2022-03-18

Family

ID=74497299

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011107582.5A Active CN112291683B (en) 2020-10-15 2020-10-15 TWS earphone control method and device

Country Status (1)

Country Link
CN (1) CN112291683B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113242603B (en) * 2021-05-28 2022-08-16 广州安凯微电子股份有限公司 Dynamic allocation method for bandwidth period
CN113365257B (en) * 2021-06-04 2023-01-24 华勤技术股份有限公司 Master-slave earphone switching method and device, earphone and readable storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101960680B1 (en) * 2018-11-27 2019-03-21 박태수 Earphone charging case
CN109743654A (en) * 2019-01-29 2019-05-10 上海与德通讯技术有限公司 A kind of bluetooth headset major-minor ear switching method, device, equipment and medium
US10412481B1 (en) * 2019-01-30 2019-09-10 Bestechnic (Shanghai) Co., Ltd. Operation mode switch of wireless headphones
CN110995326A (en) * 2019-12-23 2020-04-10 无锡中感微电子股份有限公司 Communication method of wireless earphone, wireless earphone and wireless earplug
US10630421B1 (en) * 2018-09-25 2020-04-21 Amazon Technologies, Inc. Dynamic switching of data rates
CN111132110A (en) * 2019-12-26 2020-05-08 重庆物奇科技有限公司 Device master-slave role switching system and method for wireless communication
CN111200769A (en) * 2020-01-08 2020-05-26 昆山泰芯微电子有限公司 Communication method for Bluetooth headset device and Bluetooth headset device
CN111447603A (en) * 2020-06-18 2020-07-24 展讯通信(上海)有限公司 Data transmission method and device

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6311924B2 (en) * 2014-04-11 2018-04-18 ソニー株式会社 Peripheral device, host device, and processing method
WO2018111894A1 (en) * 2016-12-13 2018-06-21 Onvocal, Inc. Headset mode selection
CN106535081A (en) * 2016-12-20 2017-03-22 建荣半导体(深圳)有限公司 Bluetooth mode switching method and device, communication system and stereophonic audio transmission method
US10419853B2 (en) * 2018-02-21 2019-09-17 Apple Inc. Binaural audio capture using untethered wireless headset
CN111510810A (en) * 2018-07-02 2020-08-07 Oppo广东移动通信有限公司 Master-slave earphone switching control method and related product
WO2020107485A1 (en) * 2018-11-30 2020-06-04 华为技术有限公司 Bluetooth connection method and device
US11013062B2 (en) * 2019-01-31 2021-05-18 Qualcomm Incorporated Fast role switch between bluetooth true wireless stereo (TWS) earbuds
CN111436041B (en) * 2019-10-31 2022-11-18 珠海市杰理科技股份有限公司 Method and device for switching master and slave Bluetooth earphones, bluetooth earphones and system

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10630421B1 (en) * 2018-09-25 2020-04-21 Amazon Technologies, Inc. Dynamic switching of data rates
KR101960680B1 (en) * 2018-11-27 2019-03-21 박태수 Earphone charging case
CN109743654A (en) * 2019-01-29 2019-05-10 上海与德通讯技术有限公司 A kind of bluetooth headset major-minor ear switching method, device, equipment and medium
US10412481B1 (en) * 2019-01-30 2019-09-10 Bestechnic (Shanghai) Co., Ltd. Operation mode switch of wireless headphones
CN110995326A (en) * 2019-12-23 2020-04-10 无锡中感微电子股份有限公司 Communication method of wireless earphone, wireless earphone and wireless earplug
CN111132110A (en) * 2019-12-26 2020-05-08 重庆物奇科技有限公司 Device master-slave role switching system and method for wireless communication
CN111200769A (en) * 2020-01-08 2020-05-26 昆山泰芯微电子有限公司 Communication method for Bluetooth headset device and Bluetooth headset device
CN111447603A (en) * 2020-06-18 2020-07-24 展讯通信(上海)有限公司 Data transmission method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"TWS耳机的发展趋势";邢百灵;《科学技术创新》;20200725;全文 *
无限魅力无线享受 八款蓝牙耳机;清凉心;《网络与信息》;20061215(第12期);全文 *

Also Published As

Publication number Publication date
CN112291683A (en) 2021-01-29

Similar Documents

Publication Publication Date Title
CN108718467B (en) Voice data transmission method, wireless headset and TWS headset
CN108696784B (en) Wireless earphone role switching method, wireless earphone and TWS earphone
CN111436041B (en) Method and device for switching master and slave Bluetooth earphones, bluetooth earphones and system
CN111200769B (en) Communication method for Bluetooth headset device and Bluetooth headset device
US11751283B2 (en) System and method for switching master and slave roles of devices for use in wireless communications
CN109391926B (en) Data processing method of wireless audio equipment and wireless audio equipment
US9066327B2 (en) Low energy wireless proximity pairing
US10609538B2 (en) Method and device for identifying bluetooth headset voice source
CN111435844B (en) Method, device, equipment and system for correcting audio data in dual-wireless Bluetooth communication
EP4184809A1 (en) Method for establishing classic bluetooth connection between dual-mode bluetooth devices, and dual-mode bluetooth device
WO2021135872A1 (en) Earphone control method, earphone box, earphone and storage medium
CN112291683B (en) TWS earphone control method and device
CN112055349B (en) Wireless communication method and Bluetooth device
CN111436042B (en) Bluetooth headset and dynamic master-slave switching method, device and system thereof
EP3820168B1 (en) Microphone hole blockage detection method and related product
CN112821963B (en) Method and device for reducing interference to loudspeaker and electronic equipment
CN110933738A (en) Mode switching method and system of wireless headset and TWS headset system
CN104539803A (en) Information processing method and electronic devices
EP3624356A1 (en) Wireless headset and signal transmission method for the same
CN111479186B (en) Audio playing method, equipment, bluetooth headset, system and storage medium
CN111277930B (en) Single-ear far detection method of multi-ear Bluetooth headset and Bluetooth headset
CN113365257B (en) Master-slave earphone switching method and device, earphone and readable storage medium
CN112104943B (en) Address transmission method, Bluetooth chip, Bluetooth headset and electronic equipment
CN107770880B (en) Wireless audio reproducing apparatus and control method and system thereof
CN114422919A (en) Master-slave switching method and device, TWS (two way communication system) headset and storage medium

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 510555 No. 107 Bowen Road, Huangpu District, Guangzhou, Guangdong

Applicant after: Guangzhou Ankai Microelectronics Co.,Ltd.

Address before: Unit 301, 302, 303, 3 / F, C1 area, 182 science Avenue, Science City, Guangzhou hi tech Industrial Development Zone, Guangzhou, Guangdong 510000

Applicant before: Guangzhou Ankai Microelectronics Co.,Ltd.

GR01 Patent grant
GR01 Patent grant