CN116390067A - Earphone reconnection method and device, storage medium and electronic equipment - Google Patents

Earphone reconnection method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN116390067A
CN116390067A CN202111607084.1A CN202111607084A CN116390067A CN 116390067 A CN116390067 A CN 116390067A CN 202111607084 A CN202111607084 A CN 202111607084A CN 116390067 A CN116390067 A CN 116390067A
Authority
CN
China
Prior art keywords
earphone
reconnection
state
disconnection
detected
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111607084.1A
Other languages
Chinese (zh)
Inventor
刘绍斌
朱燕霙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202111607084.1A priority Critical patent/CN116390067A/en
Publication of CN116390067A publication Critical patent/CN116390067A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B5/00Near-field transmission systems, e.g. inductive or capacitive transmission systems
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/18Management of setup rejection or failure
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Physics & Mathematics (AREA)
  • Acoustics & Sound (AREA)
  • Headphones And Earphones (AREA)
  • Telephone Function (AREA)

Abstract

The application discloses a method, a device, a storage medium and electronic equipment for connecting back headphones, wherein the method comprises the following steps: if the reconnection triggering operation of the earphone is detected, starting to perform reconnection operation processing on the earphone; detecting whether disconnection triggering operation of the earphone exists in a preset time period from the starting of the reconnection operation of the earphone to the reconnection of the earphone; and in a preset time period from the start of the reconnection operation processing of the earphone to the disconnection triggering operation of the earphone, if the disconnection triggering operation of the earphone is detected, terminating the reconnection operation processing. By adopting the embodiment of the application, the time for connecting back the earphone is shortened, the connection back caused by the false touch of the user is avoided, and the accuracy of connecting back the earphone is improved.

Description

Earphone reconnection method and device, storage medium and electronic equipment
Technical Field
The application relates to the technical field of computers, in particular to a method and a device for connecting back headphones, a storage medium and electronic equipment.
Background
In the present life, in order to avoid disturbing others by the external sound when the intelligent device is used in public places, the earphone is convenient to use and does not disturb others. With the development of wireless communication technology, bluetooth technology is also widely used to realize wireless connection between two devices within a certain distance, so that bluetooth headphones are also widely used in daily life and work because of being free of wire and easy to carry.
Disclosure of Invention
The embodiment of the application provides a method, a device, a storage medium and electronic equipment for connecting back headphones, which shortens the time for connecting back headphones, avoids the connection back caused by error touch of a user and improves the accuracy of connecting back headphones.
In a first aspect, an embodiment of the present application provides an earphone reconnection method, where the method includes:
if the reconnection triggering operation of the earphone is detected, starting to perform reconnection operation processing on the earphone;
detecting whether disconnection triggering operation of the earphone exists in a preset time period from the starting of the reconnection operation of the earphone to the reconnection of the earphone;
and in a preset time period from the start of the reconnection operation processing of the earphone to the disconnection triggering operation of the earphone, if the disconnection triggering operation of the earphone is detected, terminating the reconnection operation processing.
In a second aspect, an embodiment of the present application provides an earphone connecting device, where the device includes:
the reconnection module is used for starting to perform reconnection operation processing on the earphone if the reconnection triggering operation on the earphone is detected;
the first detection module is used for detecting whether disconnection triggering operation of the earphone exists or not in a preset time period between the starting of the reconnection operation of the earphone and the reconnection of the earphone;
And the disconnection module is used for terminating the reconnection operation processing if the disconnection triggering operation of the earphone is detected to exist within a preset time period between the starting of the reconnection operation processing of the earphone and the reconnection of the earphone.
In a third aspect, embodiments of the present application provide a computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the method steps of the first aspect described above.
In a fourth aspect, embodiments of the present application provide an electronic device, which may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method steps of the first aspect described above.
The technical scheme provided by some embodiments of the present application has the beneficial effects that at least includes:
in the embodiment of the application, by detecting the state of the earphone, if the reconnection triggering operation of the earphone is detected, the reconnection operation processing of the earphone is started, whether the disconnection triggering operation of the earphone exists or not is detected within a certain preset time period from the starting of the reconnection operation processing of the earphone to the reconnection of the earphone, and if the disconnection triggering operation of the earphone exists, the reconnection operation processing of the earphone is terminated. In the process of carrying out the reconnection operation processing on the earphone, whether disconnection triggering operation occurs is detected in a preset time period, and the reconnection operation processing and the disconnection detection processing in the preset time period are executed in parallel, so that the reconnection time of the earphone is shortened, reconnection caused by error touch of a user is avoided, and the accuracy of reconnection of the earphone is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a system architecture diagram of an earphone reconnection method according to an embodiment of the present application;
fig. 2 is a schematic flow chart of an earphone reconnection method according to an embodiment of the present application;
fig. 3 is an exemplary schematic diagram of a change in state of a cervical bluetooth headset according to an embodiment of the present application;
fig. 4 is an exemplary schematic diagram of a state change of a wireless bluetooth headset according to an embodiment of the present application;
fig. 5 is a schematic flow chart of an earphone reconnection method according to an embodiment of the present application;
fig. 6 is an exemplary schematic diagram of processing logic for a headset callback operation according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an earphone connecting device according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
In the following description, the terms "first," "second," and "first," are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. The following description provides various embodiments of the present application, and various embodiments may be substituted or combined, so that the present application is also intended to encompass all possible combinations of the same and/or different embodiments described. Thus, if one embodiment includes feature A, B, C and another embodiment includes feature B, D, then the present application should also be considered to include embodiments that include one or more of all other possible combinations including A, B, C, D, although such an embodiment may not be explicitly recited in the following.
The following description provides examples and does not limit the scope, applicability, or examples set forth in the claims. Changes may be made in the function and arrangement of elements described without departing from the scope of the application. Various examples may omit, replace, or add various procedures or components as appropriate. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Furthermore, features described with respect to some examples may be combined into other examples.
With the development of wireless communication technology, bluetooth technology is also widely used to realize wireless connection between two devices within a certain distance, so that bluetooth headphones are also widely used in daily life and work because of being free of wire and easy to carry. Currently, for wireless headphones, a hall sensor and a magnet are generally used to detect whether a user needs to perform a reconnection operation of the headphone, for example, a neck hanging type headphone, and the operations of reconnection or disconnection and the like can be performed according to the open or closed state of the headphone; for example, the Bluetooth headset can be placed in a charging box, a Hall sensor is arranged in the charging box, and when a user opens the charging box cover, the Bluetooth headset is triggered to be connected with a terminal which is connected. In the actual operation process of the user, there may be a false triggering condition, for example, the user likes to play the earphone, and unintentionally pulls the earphone open, which may cause a connection, but does not meet the wish of the user.
Therefore, when in actual use, anti-shake processing is needed to be added in the processing of the Hall sensor, namely whether the disconnected triggering operation of the earphone exists or not is detected in a preset time period, and the problem of false triggering caused by shake is avoided.
The inventor finds through analysis that the current reconnection scheme needs to initiate a reconnection process after the anti-shake period is ended in the period of anti-shake treatment, so that the time from the start of pulling to the completion of reconnection is longer, and the anti-shake elimination is not complete enough due to the operation mode of shortening the anti-shake time, and the false triggering probability is increased.
Based on this, the embodiment of the application provides a method for reconnecting an earphone, by detecting the state of the earphone, if the reconnection triggering operation of the earphone is detected, starting to perform reconnection operation processing on the earphone, detecting whether the disconnection triggering operation of the earphone exists in a preset time period between the starting of the reconnection operation processing of the earphone and the reconnection of the earphone, and if the disconnection triggering operation of the earphone exists, stopping the reconnection operation processing of the earphone. In the process of carrying out the reconnection operation processing on the earphone, whether the disconnection triggering operation occurs is detected in a preset time period, if the disconnection triggering operation on the earphone is detected, the reconnection operation processing of the earphone is stopped, the reconnection time of the earphone is shortened, the reconnection caused by the false touch of a user is avoided, and the accuracy of the reconnection of the earphone is improved.
Referring to fig. 1, a schematic diagram of a system architecture of an earphone reconnection method provided in an embodiment of the present application includes a terminal device and an earphone, where a bluetooth thread is provided on the terminal device, and the terminal device may include, but is not limited to, a smart phone, an intelligent interaction tablet, a personal computer, a desktop computer, a tablet computer, a palm computer, a laptop computer, a computer integrated machine, a vehicle-mounted multimedia, etc.; headphones may include, but are not limited to, a neck-mounted bluetooth headset, a wireless bluetooth headset, and the like. The inside of the further earphone is constructed by a Bluetooth module, a Hall sensor, a main control chip, a battery, a loudspeaker, a resistor, a capacitor and the like.
The method comprises the steps that a user controls the state of the earphone, when the earphone receives a back connection triggering operation of the user on the earphone, the earphone starts to search nearby Bluetooth-opened terminal equipment through Bluetooth, the terminal equipment which is built in connection is screened in the searched terminal equipment, communication connection is built between the terminal equipment which is built in connection with the screened terminal equipment, the terminal equipment searches nearby terminal equipment through Bluetooth, meanwhile, the terminal equipment searches nearby Bluetooth through Bluetooth, and a wireless communication channel between the earphone and the terminal equipment is built through Bluetooth. The connection between the earphone and the terminal device may be through bluetooth connection, or may be other wireless connection modes, which are not limited herein.
The reconnection means that the first electronic device is attempting to perform a reconnection operation with the previously paired and connected second electronic device by paging. In the embodiment of the application, the first electronic device is an earphone, and the second electronic device is a terminal device.
That is, the connection back means that the first electronic device transmits a page packet to the second electronic device to request to establish a communication connection with the second electronic device, the page is generally called a connection (page), and the operation of connecting/activating the second electronic device is called a page. The page refers to an address of a second electronic device to be connected in a first electronic device (main device) initiating connection, and can be directly connected. For example, when the first electronic device receives the reconnection instruction, it can determine that the first electronic device needs to be reconnected, and then a bluetooth connection record can be obtained, and in the bluetooth connection record, an address of a second electronic device that is reconnected to the first electronic device can be determined according to multiple conditions, and a communication connection is established with the second electronic device, so that reconnection of the first electronic device and the second electronic device is realized. The second electronic device that the first electronic device determines to connect back in the bluetooth connection record may be determined according to the connection time, may be determined according to the number of connections, may be determined according to the total duration of connection, and the like, which is not limited herein. The connection instruction received by the first electronic device may be through voice control, through touching a control key of the first electronic device, or the like, for example, when the first electronic device controls a switch of the first electronic device through a key, and when a triggering operation of the key of the first electronic device is detected, the connection of the first electronic device is triggered; when the first electronic equipment is controlled by a magnetic field such as a Hall sensor, the change of the electromagnetic field in the first electronic equipment is detected, namely the reconnection of the first electronic equipment is triggered; when the first electronic device is switched on and off by voice recognition, a voice command for switching on the first electronic device is detected, that is, a reconnection or the like of the first electronic device is triggered, and the reconnection command for the first electronic device is not limited.
The switch of the earphone is controlled by adopting the Hall switch in the earphone, the switch of the earphone can be controlled by changing the magnetic flux of the Hall switch, when the Hall switch is pulled open, the magnetic flux of the Hall switch is reduced, the earphone is opened, the earphone can be connected with terminal equipment, and interaction with the terminal equipment is realized after the connection; when the Hall switch is closed, the magnetic flux of the Hall switch is increased, so that the earphone is closed, and the communication between the earphone and the terminal equipment is blocked. Therefore, the switch of the earphone is controlled through the Hall switch, so that the traditional key switch mode is broken through, better service is provided for a user, and the tone quality of the earphone can be improved.
Based on the system architecture shown in fig. 1, the following describes in detail the method for connecting back the earphone provided in the embodiment of the present application with reference to fig. 2 to 6.
Referring to fig. 2, a flowchart of a method for connecting back an earphone is provided in an embodiment of the present application. As shown in fig. 2, the earphone reconnection method may include the following steps:
s101, if the reconnection triggering operation of the earphone is detected, starting to perform reconnection operation processing on the earphone.
In one embodiment, the state of the earphone is detected, and when the back connection triggering operation of the earphone is detected, the main control chip immediately starts back connection operation processing on the earphone when receiving the back connection triggering operation of the earphone.
The method for determining that the earphone is in the back connection triggering state may include, but is not limited to, detecting whether the earphone is in an on state by a hall sensor in the earphone, detecting whether the earphone is in a high power consumption state, and the like.
The loopback operation processing may include, but is not limited to, searching for pairing times for paired devices in a paired list, establishing a connection based on pairing times, and so forth. For example, when a user's reconnection triggering operation is detected, immediately searching for a nearby device, searching for a paired device in the searched nearby device list, and reconnecting with a terminal device having the nearest connection establishment time in the paired device.
As shown in fig. 3, when the wireless bluetooth headset is changed from the closed state to the open state and the user is detected to open the cover of the wireless bluetooth headset, the wireless bluetooth headset is triggered to be in the reconnection triggering state.
As shown in fig. 4, the suction type cervical bluetooth headset is changed from the closed state to the open state, and when the user is detected to open the headset head of the suction type cervical bluetooth headset, the operation of connecting back the suction type cervical bluetooth headset is triggered, and the suction type cervical bluetooth headset is in the connection triggering state.
S102, detecting whether disconnection triggering operation of the earphone exists or not in a preset time period from the start of the disconnection operation processing of the earphone to the disconnection of the earphone.
In one embodiment, when the reconnection triggering operation of the earphone is detected, immediately starting to perform reconnection operation processing on the earphone, setting a preset time period between the starting of the reconnection operation processing and the reconnection of the earphone, detecting the state of the earphone in the preset time period, and judging whether the disconnection triggering operation exists.
The preset time period can be set at any time between the start of the reconnection operation processing of the earphone and the reconnection of the earphone, the duration of the preset time period can be any time between the start of the reconnection operation of the earphone and the reconnection of the earphone, for example, the preset time period can be the shortest time interval from the realization of the reconnection triggering operation to the disconnection triggering operation of the earphone by a user, and the specific time is not limited in the application; and the starting time of the preset time period is any time point between the starting of the reconnection operation processing of the earphone and the reconnection of the earphone. It will be appreciated that, to save the time for the loopback and improve the accuracy of the loopback, the start point of the preset time period may be preferably set to the point in time when the processing of the loopback operation starts, that is, the point in time when the loopback triggering operation is detected.
Optionally, when the main control chip receives the back connection triggering operation of the earphone, the bluetooth thread is controlled to create a timer and immediately start timing.
It will be appreciated that if a timer is created, the starting point of the preset time period, that is, the time point when the timer starts, indicates that the preset time period ends when the timer starts. According to experience statistics, the experience duration of the preset time period is about 20-30 milliseconds, and the detection of whether the disconnection triggering operation of the earphone occurs in the time can be completed. For example, the timing duration of the timer may include, but is not limited to, 20 milliseconds, 25 milliseconds, 30 milliseconds, and so forth.
S103, in a preset time period from the start of the reconnection operation processing of the earphone to the reconnection of the earphone, if the disconnection triggering operation of the earphone is detected, terminating the reconnection operation processing.
In one embodiment, a preset time period is set between the start of the reconnection operation processing and the reconnection of the earphone, whether the disconnection triggering operation occurs is detected in the preset time period, and if the disconnection triggering operation exists on the earphone, the reconnection triggering operation on the earphone is terminated.
It can be appreciated that the bluetooth headset may send a reconnection request to the terminal device based on the bluetooth protocol to perform reconnection with the terminal device, and if it is detected that the bluetooth protocol is connected, determine that reconnection is successful. The connection may be implemented based on a classical Bluetooth protocol (e.g., a version of Bluetooth 4.0, etc. protocol formulated by Bluetooth SIG of the Bluetooth technical association), may be implemented based on a Bluetooth low energy (Bluetooth Low Energy, BLE) protocol (e.g., a version of Bluetooth 5.0, etc.), or may be implemented based on an LE Audio related Bluetooth protocol. The present invention is not limited thereto, and may vary with the development of the bluetooth protocol; or an asynchronous link (asynchronous connection oriented link, ACL) connection is established between the terminal equipment and the earphone, and the successful reconnection is judged. The method for judging success of the reconnection is not limited in this application.
The method for judging that the earphone receives the disconnection triggering operation may correspond to the method for judging that the earphone is in the disconnection triggering operation, and may include, but not limited to, detecting whether the earphone head is in a fitting state, detecting whether the earphone box is in a closed box state, and the like through a hall sensor.
The disconnect trigger operation may include, but is not limited to, jitter that occurs by the user when triggering a back-connect. The jitter refers to the situation that at least one disconnection triggering operation and at least one reconnection triggering operation occur within a preset time period, for example, the reconnection triggering operation of the earphone is triggered by a key on the earphone, if the preset time period is 1 second, the reconnection triggering operation of the earphone is detected, and if the earphone receives two triggering operations of a user within 1 second, in the detected triggering operations, the rest operations are jitter occurring within the preset time period except for the first triggering operation of the reconnection triggering operation of the earphone. And for example, the back connection triggering operation of the earphone and the disconnection triggering operation of the closed neck hanging earphone are controlled by pulling the neck hanging earphone, so that the user can pull the earphone open and close the earphone within 1 second, and the user can be judged to be in false triggering, namely the shaking operation, and the final back connection triggering operation is needed. The purpose of detecting whether the loopback triggering operation shakes is to avoid generating multiple loopback triggering operations to the earphone in a short time, and executing subsequent corresponding actions after each time of receiving the loopback triggering operation, so as to increase the power consumption of the earphone.
In the embodiment of the application, by detecting the state of the earphone, if the reconnection triggering operation of the earphone is detected, the reconnection operation processing of the earphone is started, whether the disconnection triggering operation of the earphone exists or not is detected in a preset time period from the starting of the reconnection operation processing of the earphone to the reconnection of the earphone, and if the disconnection triggering operation of the earphone exists, the reconnection operation processing of the earphone is terminated. In the process of carrying out the reconnection operation processing on the earphone, whether the disconnection triggering operation occurs is detected in a preset time period, if the disconnection triggering operation on the earphone is detected, the reconnection operation processing of the earphone is stopped, the reconnection time of the earphone is shortened, the reconnection caused by the false touch of a user is avoided, and the accuracy of the reconnection of the earphone is improved.
Referring to fig. 5, a flowchart of a method for connecting back an earphone is provided in an embodiment of the present application. As shown in fig. 5, the earphone reconnection method may include the following steps:
s201, if the back connection triggering operation of the earphone is detected, the Bluetooth thread is controlled to create a state flag bit, wherein the state flag bit is used for indicating the back connection processing state of the earphone.
The terminal device connected back to the earphone may include, but is not limited to, a terminal device connected to the earphone before the back connection is performed and having the nearest time; connection priority can be set for the connected terminal equipment, and the terminal equipment with higher priority performs the reconnection operation preferentially.
In one embodiment, the state of the earphone is detected, if the user performs the reconnection triggering operation on the earphone, the main control chip receives the reconnection triggering operation on the earphone and controls the bluetooth thread to create a state flag bit for representing the reconnection processing state of the earphone, so as to control the reconnection state of the earphone by changing the state of the state flag bit. The STATUS flag bit may be represented, for example, as connect_status. The representation of the status flag bit in the embodiment of the present application is not limited to the representation method of the status flag bit, and other representation methods are also possible. Methods of determining whether a back-connect trigger operation to the headset is generated may include, but are not limited to, detecting whether the headset is on via a hall sensor, detecting whether the headset is in a high power state, and so forth.
As shown in fig. 3, the earphone box of the wireless bluetooth earphone is changed from the closed state to the open state, and when it is detected that the user opens the earphone box of the wireless bluetooth earphone, the operation of reconnecting the wireless bluetooth earphone is triggered, and at this time, the wireless bluetooth earphone is in the reconnecting triggering state.
As shown in fig. 4, the suction type cervical bluetooth headset is changed from the closed state to the open state, and when the user is detected to open the headset head of the suction type cervical bluetooth headset, the operation of connecting back the suction type cervical bluetooth headset is triggered, and the suction type cervical bluetooth headset is in the connection triggering state.
It can be understood that, as shown in fig. 4, the initial state bit of the adsorption type neck hanging bluetooth headset is in an unconnected state, the headset is closed, when the headset of the adsorption type neck hanging bluetooth headset is detected to be pulled open by a user, namely, a back connection triggering operation is generated on the adsorption type neck hanging bluetooth headset, at the moment, the back connection triggering operation on the headset is received by the main control chip of the adsorption type neck hanging bluetooth headset, the message is sent to the bluetooth thread, and after the message is received by the bluetooth thread, a state flag bit is created.
Optionally, after receiving the message triggered by the loopback, the bluetooth thread may further create an initialization flag bit, where the initialization flag bit is used to indicate a state of the hall sensor in the headset. The states of the hall sensor include an on state and an off state of the switch. Taking a TWS (real wireless Bluetooth) earphone as an example, the TWS earphone is provided with a chargeable charging box, a magnet and other elements capable of generating a magnetic field are arranged at the edge of a box cover of the earphone box, a Hall switch is arranged at the edge of a box body of the earphone box, the position of the Hall switch is opposite to that of the magnet on the box cover in a closed state of the earphone box, when the earphone box is in the closed state, the magnet is close to the Hall switch, the Hall switch can output a low potential voltage (low level) or a closed signal, when the earphone box is in an open state, the magnet is far away from the Hall switch, and the Hall switch outputs a high potential voltage (high level) or an open signal. When the main control chip inside the earphone determines that the charging box is opened through detecting the changed voltage value, the earphone circuit is started and connected with the Bluetooth of the electronic equipment. When the charging box works normally, the state of the Hall switch is monitored in real time, the Hall switch outputs a high potential voltage (high level) or an open signal, the state information of the earphone box is judged to be in an open box state, a reconnection command is generated, and the reconnection command can control the Bluetooth earphone to be connected with terminal equipment originally connected through Bluetooth.
The initialization flag bit is set to a first value beginning at the creation of the initialization flag bit. The first value of the initialization flag bit is used for indicating that the hall sensor in the earphone is in an open state, and when the hall sensor switch outputs a high potential voltage (high level) or an on signal, the earphone box state information is judged to be in an open state, and a Bluetooth thread can be prompted to enter a reconnection state to send a reconnection request/instruction to the terminal equipment. The initialization flag bit may be denoted as open_init_status at this time. The representation of the initialization flag bit in the embodiment of the present application is not limited to the representation method of the initialization flag bit, and other representation methods are also possible. The initialization flag bit is assigned an OPEN value at the time of creation, denoted open_init_status=open, or a first value of the initialization flag bit is set to another value indicating that the hall sensor is in an on state, for example, the first value of the initialization flag bit may be set to 1, denoted open_init_status=1.
S202, detecting whether disconnection triggering operation of the earphone exists or not in a preset time period from the start of the disconnection operation processing of the earphone to the disconnection success of the earphone.
In one embodiment, when the reconnection triggering operation of the earphone is detected, immediately starting to perform reconnection operation processing on the earphone, and detecting the state of the earphone in a preset time period from the start of the reconnection operation processing to the reconnection of the earphone, so as to judge whether the disconnection triggering operation exists.
It can be understood that in the preset time period, whether the earphone is continuously subjected to the reconnection operation is controlled according to the value of the status flag bit by detecting whether the disconnection triggering operation occurs to change the value of the status flag bit.
And S203, if the disconnection triggering operation of the earphone is detected in the preset time period, setting the state flag bit into a first state to interrupt the processing of the reconnection operation and control the Bluetooth thread to restore to the state before reconnection, wherein the first state is that the earphone is in a reconnection termination state.
In one embodiment, when a reconnection triggering operation of the earphone is detected, immediately starting to perform reconnection operation processing on the earphone, and if the disconnection triggering operation of the earphone is detected to exist in a preset time period, setting a state flag bit to be in a first state of a reconnection termination state of the earphone so as to interrupt the reconnection operation processing of the earphone, controlling a Bluetooth thread to restore to a state before reconnection, reducing power consumption of the earphone, and when the earphone is in a standby state, waiting for the reconnection triggering operation again.
The processing of the reconnection operation of the headphones is already performed before the disconnection triggering operation of the headphones is detected, so that the processing of the reconnection operation of the headphones needs to be interrupted to reduce the power consumption of the headphones when the disconnection triggering operation of the headphones is detected.
It will be appreciated that no assignment is made when the bluetooth thread creates a status flag. The setting of the status flag bit to the first state in which the earphone is in the reconnection termination state may be that a value representing the status flag bit is set to a preset value. For example, in the above step S201, the STATUS flag bit is denoted as connect_status, the STATUS flag bit is denoted as the first STATUS, the STATUS flag bit may be assigned as 0, the status_status=0, or the status_status=undo, and so on.
The disconnection triggering operation of the wireless Bluetooth headset is the inverse process shown in fig. 3, namely, the headset box of the wireless Bluetooth headset is changed from an open state to a closed state, and when the fact that the headset box of the wireless Bluetooth headset is closed by a user is detected, the disconnection stopping operation of the wireless Bluetooth headset is triggered, and the wireless Bluetooth headset is in the disconnection stopping state.
The disconnection triggering operation of the adsorption type neck bluetooth headset is the reverse process shown in fig. 4, namely, the headset of the adsorption type neck bluetooth headset is changed from a pulled-out state to a closed state, and when the fact that the headset of the adsorption type neck bluetooth headset is closed by a user is detected, the disconnection stopping operation of the adsorption type neck bluetooth headset is triggered, and the adsorption type neck bluetooth headset is in the disconnection stopping state.
It can be understood that, before the earphone is subjected to the reconnection operation processing and the earphone is subjected to the reconnection work, if the disconnection triggering operation on the earphone is detected before the preset time period is finished, the Bluetooth thread is controlled to be restored to the state before the reconnection so as to reduce the power consumption of the earphone.
S204, if the fact that the disconnection triggering operation of the earphone does not exist is detected within the preset time period, the state zone bit is set to be in a second state, the processing of the reconnection operation of the earphone is continued, and the second state is that the earphone is in the reconnection state.
In one embodiment, the state of the earphone is continuously detected from the beginning of the reconnection operation processing of the earphone, if no disconnection triggering operation of the earphone is detected in a preset time period, the current reconnection triggering operation of the earphone is determined to be the triggering operation generated by the true intention of the user, the state flag bit is set to be in a second state of the earphone in the reconnection state, and the reconnection operation processing of the earphone is continued until the earphone is in the reconnection work. The second state of the STATUS flag bit may be represented as connect_status=1, or the second state of the STATUS flag bit may be represented as any value where the STATUS flag bit is at a high level, e.g., doing, represented as connect_status=doing.
At this time, because the disconnection triggering operation of the earphone is not detected in the preset time period, it is indicated that the reconnection triggering operation is a real intention of the user, so that the reconnection of the earphone and the terminal device is required to be performed, that is, the second state indicates that the earphone is in the reconnection state, and the reconnection operation can be continuously performed until the reconnection is successful. The terminal device that is connected back to the headset may include, but is not limited to, the terminal device that was connected to the headset prior to the connection being made and was the most recent. The in-loop status of the headset may include, but is not limited to, searching for paired devices in the searched nearby device categories, screening the paired devices for a device to establish a connection with, and the like.
S205, after the preset time period is finished and before the earphone is connected back to work, if the disconnected triggering operation on the earphone is detected, the state flag bit is set to be a first state bit, the Bluetooth thread is controlled to be restored to a state before the connection, and the first state bit is that the earphone is in a connection-back termination state.
In one embodiment, from sending a reconnection triggering operation to the earphone, detecting the state of the earphone continuously, in a preset time period, detecting whether the disconnection triggering operation to the earphone is detected, continuously detecting the state of the earphone after the preset time period is finished and before the earphone is connected back to work, determining whether the disconnection triggering operation exists in the current reconnection process of the earphone, setting the state flag bit to be a first state of the earphone in a reconnection termination state when the disconnection triggering operation to the earphone is detected, and controlling the Bluetooth thread to restore to the state before the reconnection.
Wherein the first state of the status flag bit may be a level indicating a pull-down status flag bit or a value of a clear status flag bit or a value of a modify status flag bit, etc. For example, pulling the STATUS flag bit low is assigning the STATUS flag bit to 0, denoted as connect_status=0, or clearing the STATUS flag bit, denoted as Clear connect_status; or a modification STATUS flag bit, as may be connect_status=undo.
It may be appreciated that, after the preset period of time is finished and before the earphone is connected back to work, the assignment of the flag bit generated by the disconnection triggering operation and the assignment of the flag bit generated by the disconnection triggering operation in the preset period of time may be different, although the meaning of the assignment representation is that the connection is terminated, the former may be, for example, connect_status=2, and the latter may be, for example, connect_status=0; of course, in view of convenience of checking the status bits, the same assignment may be the same for both states, which is not limited in the embodiment of the present application.
Optionally, in another embodiment of the present application, after a preset period of time between when the earphone starts the process of the reconnection operation and when the earphone is connected back to work ends, if there is a disconnection triggering operation on the earphone, the value of the initialization flag bit is set to a second value, where the second value of the initialization flag bit indicates that the hall sensor switch may output a low potential voltage (low level) or an off signal. It will be appreciated that the initialization flag bit may be assigned as close, denoted open_init_status=close, and the initialization flag bit may be assigned as 0, denoted open_init_status=0.
It can be appreciated that the change of the threshold information of the initialization flag bit can represent the change of the state of the hall sensor by the value of the initialization flag bit representing the state of the hall sensor. For example, the state of the hall sensor comprises an on state and an off state of a switch, the hall switch outputs a high potential voltage (high level) or an on signal, the state information of the earphone box is judged to be the open box state, the earphone generates a reconnection command, and the reconnection command can control the Bluetooth earphone to be connected with a terminal device which is originally connected through Bluetooth, so that judgment of starting and stopping the earphone reconnection can be realized. After the earphone starts the reconnection operation processing and ends in a preset time period between the earphone reconnection success, when the disconnection triggering operation of the earphone is detected, the value of the initialization flag bit is set to a second value, at this time, the hall switch can be judged to output a low potential voltage (low level) or a closed signal, and the reconnection processing operation can be terminated.
After the preset time period is finished, before the earphone is subjected to the reconnection operation processing and the earphone is subjected to the reconnection work, if the disconnection triggering operation of the earphone is detected, the disconnection termination information is sent to the Bluetooth thread, and the Bluetooth thread adjusts the status flag bit from the status bit indicating that the earphone is in the reconnection state to the status bit indicating that the earphone is in the reconnection state so as to terminate the reconnection operation processing of the earphone, so that the earphone is restored to the unconnected state, the power consumption of the earphone is reduced, and the earphone is in the standby state at the moment and waits for the reconnection triggering operation again.
Before the disconnection triggering operation of the earphone is detected, the earphone is in a reconnection state, which is equivalent to high power consumption, so that when the disconnection triggering operation of the earphone is detected, the reconnection state of the earphone needs to be controlled to be terminated by adjusting the state of the flag bit state flag bit, so that the power consumption of the earphone is reduced.
It can be appreciated that in another embodiment of the present application, if the disconnection triggering operation of the earphone is not detected before the earphone is subjected to the reconnection operation processing and before the earphone is reconnected to work, the reconnection operation processing is continuously performed on the earphone until the earphone is reconnected to work.
Optionally, in another embodiment of the present application, after the preset period of time is over and before the earphone is connected back to work, if there is a disconnection triggering operation on the earphone, the processing of the connection operation is continuously executed until the earphone is connected back to work; and after the earphone is connected back to work, performing disconnection operation on the earphone.
It can be understood that when the reconnection triggering operation of the earphone is detected, and no disconnection triggering operation of the earphone is detected in the preset time period, the current reconnection triggering operation of the earphone is actually intended by the user, after the preset time period is finished, no matter whether the disconnection triggering operation of the earphone exists, the reconnection operation processing is continuously performed on the earphone until the earphone is in a successful state, if the disconnection triggering operation of the earphone exists after the preset time period and before the disconnection triggering operation of the earphone is in a successful state, the earphone needs to be disconnected after the disconnection of the earphone is in a successful state, so that the earphone is restored to a standby state before the disconnection, the power consumption of the earphone is reduced, and the reconnection triggering operation is waited for again. In the process, after the preset time period is finished and before the reconnection becomes successful, even if the disconnection triggering operation is received, the reconnection needs to be continued until the reconnection becomes successful in order to respond to the reconnection triggering operation, and the disconnection is performed after the reconnection is successful in order to respond to the disconnection triggering operation, so that the disconnection triggering operation is matched with the triggering operation of a user.
S206, after the earphone is subjected to the reconnection operation processing and is subjected to the reconnection work, if the disconnection triggering operation of the earphone is detected, the disconnection operation processing is performed on the earphone.
In one embodiment, in the processing of the reconnection operation of the earphone, no disconnection triggering operation of the earphone is detected, that is, the earphone is successfully connected with the terminal device for reconnection, after the connection is successful, the state of the earphone is continuously detected, if the disconnection triggering operation of the earphone is detected, the connection between the earphone and the terminal device is disconnected, so that the earphone is restored to an unconnected state, the power consumption of the earphone is reduced, and the reconnection triggering operation of the earphone is waited for again.
When the earphone is connected back to work, the user can be prompted. For example, the user may be prompted by a prompt tone such as "ding-dong", or may be prompted by flashing a prompt light, etc., and the prompting manner is not specifically limited herein.
It will be appreciated that in the case of creating a timer, as shown in fig. 6, when a user's reconnection triggering operation on the headphones is detected, the timer is created and immediately started, and whether disconnection triggering operation on the headphones occurs during the processing of the reconnection operation on the headphones is detected within the time duration of the timer. If the disconnection triggering operation of the earphone is detected to occur within the time length of the timer, namely, the state of the earphone is changed, the state flag bit is set to be in a first state of a disconnection termination state of the earphone so as to interrupt the disconnection operation processing of the earphone; if the disconnection triggering operation of the earphone is not detected within the duration of the timer, namely, the state of the earphone is not changed, setting the state flag bit to be in a second state of the earphone in a reconnection state so as to continue to carry out reconnection operation processing on the earphone; when the earphone enters a reconnection state, continuously detecting the state of the earphone before reconnection becomes successful, if disconnection triggering operation of the earphone is detected before reconnection becomes successful, namely the state of the earphone is changed, setting a state flag bit to be in a first state of reconnection so as to terminate the reconnection operation processing of the earphone, or after the earphone enters a connection state, detecting the state of the earphone before reconnection, and if disconnection triggering operation of the earphone is detected, continuing to carry out reconnection on the earphone, and after the earphone is reconnection into the successful, disconnecting the terminal equipment from the earphone; if the disconnection triggering operation of the earphone is not detected before the disconnection success, namely the state of the earphone is not changed, the disconnection operation processing is continuously carried out on the earphone until the disconnection success is achieved; after the back connection becomes successful, the state of the earphone is kept to be detected, when the disconnection triggering operation of the earphone is detected, namely, the state of the earphone is changed, the disconnection operation is carried out on the earphone, so that the earphone is in an unconnected state, enters low power consumption, and waits for the back connection triggering operation again.
In the embodiment of the application, by detecting the state of the earphone in the process of performing the reconnection operation processing on the earphone, if the disconnection triggering operation on the earphone is detected within a preset time period, the initialization processing on the earphone is terminated, and if the disconnection triggering operation on the earphone is not detected within the preset time period, the reconnection operation processing on the earphone after the initialization is continued until the reconnection becomes successful; if the disconnection triggering operation of the earphone is detected after the preset time period is finished and before the disconnection is finished, the disconnection operation processing of the earphone is terminated; if the disconnection triggering operation of the earphone is detected after the disconnection triggering operation of the earphone is finished, the disconnection operation processing of the earphone is terminated, the state of the earphone is detected in real time in the earphone disconnection process, when the disconnection triggering operation of the earphone is detected, the disconnection of the earphone is immediately terminated by controlling the state of the change zone bit, the disconnection time of the earphone is shortened, the disconnection caused by the false touch of a user is avoided, and the accuracy of the disconnection of the earphone is improved.
The following describes in detail the earphone connecting device provided in the embodiment of the present application with reference to fig. 7. Note that, the present invention is not limited to the above-described embodiments. The earphone connecting device in fig. 7 is used for executing the method of the embodiment shown in fig. 2 to 6 of the present application, and for convenience of explanation, only the relevant parts of the embodiment of the present application are shown, and specific technical details are disclosed, and please refer to the method embodiment shown in fig. 2 to 6 of the present application.
Referring to fig. 7, a schematic structural diagram of an earphone connecting device is provided in the present application. As shown in fig. 7, the earphone connecting device 1 of the embodiment of the present application includes: a back connection module 11, a first detection module 12 and a blocking connection module 13.
The reconnection module 11 is configured to start performing reconnection operation on the earphone if a reconnection trigger operation on the earphone is detected;
the first detection module 12 is configured to detect whether a disconnection triggering operation for the earphone exists in a preset time period between when the earphone starts a reconnection operation process and when the earphone is connected back to work;
and the disconnection module 13 is used for terminating the reconnection operation processing if the disconnection triggering operation of the earphone is detected to exist within the preset time period between the starting of the reconnection operation processing of the earphone and the reconnection of the earphone.
Optionally, the feedback module 11 is specifically configured to:
if the back connection triggering operation of the earphone is detected, the Bluetooth thread is controlled to create a state flag bit, wherein the state flag bit is used for indicating the back connection processing state of the earphone.
Optionally, as shown in fig. 7, the earphone connecting device 1 further includes:
a timer creation module 14, configured to create a timer and start timing if a reconnection trigger operation to the earphone is detected;
And the judging module 15 is configured to determine that the preset time period is over if the timer finishes counting.
Optionally, the blocking module 13 is specifically configured to:
and in the preset time period, if the disconnection triggering operation of the earphone is detected, setting the state flag bit into a first state to control the Bluetooth thread to recover to a state before reconnection, wherein the first state is that the earphone is in a reconnection termination state.
Optionally, the blocking module 13 is specifically configured to:
and in the preset time period, if the fact that the disconnection triggering operation of the earphone does not exist is detected, setting the state zone bit to be in a second state, and continuing to carry out the reconnection operation processing on the earphone, wherein the second state is that the earphone is in a reconnection state.
Optionally, the blocking module 13 is specifically configured to:
and after the preset time period is finished and before the earphone is connected back to work, if the disconnection triggering operation of the earphone is detected, controlling the Bluetooth thread to recover to the state before connection.
The control of the bluetooth thread to restore to the state before the reconnection is specifically used for:
and setting the state flag bit into a first state, and controlling the Bluetooth thread to recover to a state before reconnection, wherein the first state is that the earphone is in a reconnection termination state.
Optionally, as shown in fig. 7, the earphone has a hall sensor, and the earphone connecting device 1 further includes:
the first setting module 16 is configured to control the bluetooth thread to create an initialization flag bit and set the initialization flag bit to a first value if a reconnection triggering operation on the headset is detected, where the initialization flag bit is used to represent a state of the hall sensor;
and the second setting module 17 is configured to set the initialization flag bit to a second value if it is detected that a disconnection triggering operation for the earphone exists after the preset period of time is over and before the earphone is connected back to work.
Optionally, as shown in fig. 7, the earphone connecting device 1 further includes:
the second detection module 18 is configured to, after the preset period of time is over and before the earphone is connected back to work, if there is a disconnection triggering operation on the earphone, continue to perform a connection operation process until the earphone is connected back to work;
and the Bluetooth control module 19 is used for performing disconnection operation processing on the earphone after the earphone is connected back to work.
Optionally, the blocking module 13 is specifically configured to:
and in a preset time period from the start of the processing of the reconnection operation of the earphone to the disconnection triggering operation of the earphone, if the disconnection triggering operation of the earphone is detected, sending reconnection termination information to the Bluetooth thread so as to enable the Bluetooth thread to recover to a state before reconnection.
Optionally, the blocking module 13 is specifically configured to:
after the earphone is subjected to the reconnection operation processing and the reconnection becomes successful, if the disconnection triggering operation of the earphone exists, the disconnection operation processing is performed on the earphone.
In the embodiment of the application, by detecting the state of the earphone in the process of performing the reconnection operation processing on the earphone, if the disconnection triggering operation on the earphone is detected within a preset time period, the initialization processing on the earphone is terminated, and if the disconnection triggering operation on the earphone is not detected within the preset time period, the reconnection operation processing on the earphone after the initialization is continued until the reconnection becomes successful; if the disconnection triggering operation of the earphone is detected after the preset time period is finished and before the disconnection is finished, the disconnection operation processing of the earphone is terminated; if the disconnection triggering operation of the earphone is detected after the disconnection triggering operation of the earphone is finished, the disconnection operation processing of the earphone is terminated, the state of the earphone is detected in real time in the earphone disconnection process, when the disconnection triggering operation of the earphone is detected, the disconnection of the earphone is immediately terminated by controlling the state of the change zone bit, the disconnection time of the earphone is shortened, the disconnection caused by the false touch of a user is avoided, and the accuracy of the disconnection of the earphone is improved.
The embodiment of the present application further provides a computer storage medium, where the computer storage medium may store a plurality of instructions, where the instructions are adapted to be loaded by a processor and execute the earphone reconnection method according to the embodiment shown in fig. 2 to fig. 6, and the specific execution process may refer to the specific description of the embodiment shown in fig. 2 to fig. 6, which is not repeated herein.
Referring to fig. 8, a schematic structural diagram of an electronic device is provided in an embodiment of the present application. As shown in fig. 8, the terminal device 1000 may include: at least one processor 1001, at least one network interface 1002, at least one input output interface 1003, at least one display unit 1004, at least one memory 1005, at least one communication bus 1006. Wherein the processor 1001 may include one or more processing cores. Processor 1001 utilizes various interfaces and lines to connect various portions of the overall electronic device 1000, and performs various functions of terminal 1000 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in memory 1005, and invoking data stored in memory 1005. The memory 1005 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may also optionally be at least one storage device located remotely from the processor 1001. The network interface 1002 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface, bluetooth interface), among others. The communication bus 1006 is used to enable connected communications between these components. The display unit 1004 may be a touch panel. As shown in fig. 8, an operating system, a network communication module, an input-output interface module, and a headset return program may be included in the memory 1005 as one type of storage medium.
In the electronic device 1000 shown in fig. 8, the input/output interface 1003 is mainly used to provide an interface for a user and an access device, and obtain data input by the user and the access device.
In one embodiment, the processor 1001 may be configured to invoke the headset callback program stored in the memory 1005, and specifically perform the following operations:
if the reconnection triggering operation of the earphone is detected, starting to perform reconnection operation processing on the earphone;
detecting whether disconnection triggering operation of the earphone exists in a preset time period from the starting of the reconnection operation of the earphone to the reconnection of the earphone;
and in a preset time period from the start of the reconnection operation processing of the earphone to the disconnection triggering operation of the earphone, if the disconnection triggering operation of the earphone is detected, terminating the reconnection operation processing.
In one embodiment, when the processor 1001 starts to perform the processing of the loopback operation on the earphone if the loopback triggering operation on the earphone is detected, the following operations are specifically performed:
if the back connection triggering operation of the earphone is detected, the Bluetooth thread is controlled to create a state flag bit, wherein the state flag bit is used for indicating the back connection processing state of the earphone.
In one embodiment, the processor 1001 may be configured to invoke the headset callback program stored in the memory 1005, and specifically perform the following operations:
if the back connection triggering operation of the earphone is detected, a timer is established and timing is started;
and if the timer finishes timing, determining that the preset time period finishes.
In one embodiment, the processor 1001, during a preset period between when the earphone starts the processing of the reconnection operation and when the disconnection triggering operation of the earphone is detected to exist, terminates the processing of the reconnection operation, specifically performs the following operations:
and in the preset time period, if the disconnection triggering operation of the earphone is detected, setting the state flag bit into a first state to interrupt the processing of the reconnection operation and control the Bluetooth thread to restore to the state before reconnection, wherein the first state is that the earphone is in a reconnection termination state.
In one embodiment, the processor 1001, during a preset period between when the earphone starts the processing of the reconnection operation and when the disconnection triggering operation of the earphone is detected to exist, terminates the processing of the reconnection operation, specifically performs the following operations:
And in the preset time period, if the fact that the disconnection triggering operation of the earphone does not exist is detected, setting the state zone bit to be in a second state, and continuing to carry out the reconnection operation processing on the earphone, wherein the second state is that the earphone is in a reconnection state.
In one embodiment, the processor 1001, during a preset period between when the earphone starts the processing of the reconnection operation and when the disconnection triggering operation of the earphone is detected to exist, terminates the processing of the reconnection operation, specifically performs the following operations:
and after the preset time period is finished and before the earphone is connected back to work, if the disconnection triggering operation of the earphone is detected, controlling the Bluetooth thread to recover to the state before connection.
In one embodiment, the processor 1001, when executing control of the bluetooth thread to resume to the state before the loop, specifically executes:
and setting the state flag bit into a first state, and controlling the Bluetooth thread to recover to a state before reconnection, wherein the first state is that the earphone is in a reconnection termination state.
In one embodiment, the headset has a hall sensor, and the processor 1001 may be configured to invoke the headset loop program stored in the memory 1005, and specifically perform the following operations:
If the back connection triggering operation of the earphone is detected, controlling a Bluetooth thread to create an initialization zone bit, and setting the initialization zone bit as a first value, wherein the initialization zone bit is used for representing the state of the Hall sensor;
and after the preset time period is finished and before the earphone is connected back to work, if the disconnection triggering operation of the earphone is detected, setting the initialization flag bit to a second value.
In one embodiment, the processor 1001 may be configured to invoke the headset callback program stored in the memory 1005, and specifically perform the following operations:
after the preset time period is finished and before the earphone is connected back to work, if the disconnected triggering operation of the earphone exists, continuing to execute the back connection operation processing until the earphone is connected back to work;
and after the earphone is connected back to work, performing disconnection operation on the earphone.
In one embodiment, the processor 1001, during a preset period of time between when the earphone performs the processing of the reconnection operation and when the disconnection triggering operation of the earphone is detected to exist, terminates the processing of the reconnection operation, specifically performs the following operations:
And in a preset time period from the start of the processing of the reconnection operation of the earphone to the disconnection triggering operation of the earphone, if the disconnection triggering operation of the earphone is detected, sending reconnection termination information to the Bluetooth thread so as to enable the Bluetooth thread to recover to a state before reconnection.
In one embodiment, the processor 1001 may be configured to invoke the headset callback program stored in the memory 1005, and specifically perform the following operations:
after the earphone is subjected to the reconnection operation processing and the reconnection becomes successful, if the disconnection triggering operation of the earphone exists, the disconnection operation processing is performed on the earphone.
In the embodiment of the application, by detecting the state of the earphone in the process of performing the reconnection operation processing on the earphone, if the disconnection triggering operation on the earphone is detected within a preset time period, the initialization processing on the earphone is terminated, and if the disconnection triggering operation on the earphone is not detected within the preset time period, the reconnection operation processing on the earphone after the initialization is continued until the reconnection becomes successful; if the disconnection triggering operation of the earphone is detected after the preset time period is finished and before the disconnection is finished, the disconnection operation processing of the earphone is terminated; if the disconnection triggering operation of the earphone is detected after the disconnection triggering operation of the earphone is finished, the disconnection operation processing of the earphone is terminated, the state of the earphone is detected in real time in the earphone disconnection process, when the disconnection triggering operation of the earphone is detected, the disconnection of the earphone is immediately terminated by controlling the state of the change zone bit, the disconnection time of the earphone is shortened, the disconnection caused by the false touch of a user is avoided, and the accuracy of the disconnection of the earphone is improved.
It will be clear to a person skilled in the art that the solution of the present application may be implemented by means of software and/or hardware. "Unit" and "module" in this specification refer to software and/or hardware capable of performing a particular function, either alone or in combination with other components, such as Field programmable gate arrays (Field-ProgrammaBLE Gate Array, FPGAs), integrated circuits (IntegratedCircuit, IC), and the like.
It should be noted that, for simplicity of description, the foregoing method embodiments are all expressed as a series of action combinations, but it should be understood by those skilled in the art that the present application is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required in the present application.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, such as the division of the units, merely a logical function division, and there may be additional manners of dividing the actual implementation, such as multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some service interface, device or unit indirect coupling or communication connection, electrical or otherwise.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a memory, including several instructions for causing an electronic device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned memory includes: a U-disk, a Read-only memory (ROM), a random access memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Those of ordinary skill in the art will appreciate that all or a portion of the steps in the various methods of the above embodiments may be performed by hardware associated with a program that is stored in a computer readable memory, which may include: flash disk, read-only memory (ROM), random-access memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The foregoing is merely exemplary embodiments of the present disclosure and is not intended to limit the scope of the present disclosure. That is, equivalent changes and modifications are contemplated by the teachings of this disclosure, which fall within the scope of the present disclosure. Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a scope and spirit of the disclosure being indicated by the claims.

Claims (14)

1. A method for earphone reconnection, the method comprising:
If the reconnection triggering operation of the earphone is detected, starting to perform reconnection operation processing on the earphone;
detecting whether disconnection triggering operation of the earphone exists in a preset time period from the starting of the reconnection operation of the earphone to the reconnection of the earphone;
and in a preset time period from the start of the reconnection operation processing of the earphone to the disconnection triggering operation of the earphone, if the disconnection triggering operation of the earphone is detected, terminating the reconnection operation processing.
2. The method of claim 1, wherein if the loopback triggering operation of the earphone is detected, starting to perform the loopback operation processing on the earphone, including:
if the back connection triggering operation of the earphone is detected, the Bluetooth thread is controlled to create a state flag bit, wherein the state flag bit is used for indicating the back connection processing state of the earphone.
3. The method according to claim 1, wherein the method further comprises:
if the back connection triggering operation of the earphone is detected, a timer is established and timing is started;
and if the timer finishes timing, determining that the preset time period finishes.
4. A method according to claim 2 or 3, wherein, in a preset period of time between when the earphone starts a reconnection operation process and when the earphone is connected back to work, if a disconnection triggering operation on the earphone is detected, terminating the reconnection operation process includes:
And in the preset time period, if the disconnection triggering operation of the earphone is detected, setting the state flag bit into a first state to control the Bluetooth thread to recover to a state before reconnection, wherein the first state is that the earphone is in a reconnection termination state.
5. A method according to any one of claims 1-3, wherein the method further comprises:
and in the preset time period, if the fact that the disconnection triggering operation of the earphone does not exist is detected, setting the state zone bit to be in a second state, and continuing to carry out the reconnection operation processing on the earphone, wherein the second state is that the earphone is in a reconnection state.
6. A method according to claim 2 or 3, characterized in that the method further comprises:
and after the preset time period is finished and before the earphone is connected back to work, if the disconnection triggering operation of the earphone is detected, controlling the Bluetooth thread to recover to the state before connection.
7. The method of claim 6, wherein controlling the bluetooth thread to resume the pre-loop state comprises:
and setting the state flag bit into a first state, and controlling the Bluetooth thread to recover to a state before reconnection, wherein the first state is that the earphone is in a reconnection termination state.
8. The method of claim 1, wherein the headset has a hall sensor, the method further comprising:
if the back connection triggering operation of the earphone is detected, controlling a Bluetooth thread to create an initialization zone bit, and setting the initialization zone bit as a first value, wherein the initialization zone bit is used for representing the state of the Hall sensor;
and after the preset time period is finished and before the earphone is connected back to work, if the disconnection triggering operation of the earphone is detected, setting the initialization flag bit to a second value.
9. A method according to any one of claims 1-3, wherein the method further comprises:
after the preset time period is finished and before the earphone is connected back to work, if the disconnected triggering operation of the earphone exists, continuing to execute the back connection operation processing until the earphone is connected back to work;
and after the earphone is connected back to work, performing disconnection operation on the earphone.
10. A method according to claim 1 or 3, wherein, in a preset period of time between when the earphone performs a reconnection operation process and when the earphone performs a reconnection work, if a disconnection triggering operation on the earphone is detected, terminating the reconnection operation process, including:
And in a preset time period from the start of the processing of the reconnection operation of the earphone to the disconnection triggering operation of the earphone, if the disconnection triggering operation of the earphone is detected, sending reconnection termination information to the Bluetooth thread so as to enable the Bluetooth thread to recover to a state before reconnection.
11. The method according to claim 1, wherein the method further comprises:
after the earphone is subjected to the reconnection operation processing and the reconnection becomes successful, if the disconnection triggering operation of the earphone exists, the disconnection operation processing is performed on the earphone.
12. An earphone connection device, the device comprising:
the reconnection module is used for starting to perform reconnection operation processing on the earphone if the reconnection triggering operation on the earphone is detected;
the first detection module is used for detecting whether disconnection triggering operation of the earphone exists or not in a preset time period between the starting of the reconnection operation of the earphone and the reconnection of the earphone;
and the disconnection module is used for terminating the reconnection operation processing if the disconnection triggering operation of the earphone is detected to exist within a preset time period between the starting of the reconnection operation processing of the earphone and the reconnection of the earphone.
13. A computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the method steps of any of claims 1-11.
14. An electronic device, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method steps of any of claims 1-11.
CN202111607084.1A 2021-12-23 2021-12-23 Earphone reconnection method and device, storage medium and electronic equipment Pending CN116390067A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111607084.1A CN116390067A (en) 2021-12-23 2021-12-23 Earphone reconnection method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111607084.1A CN116390067A (en) 2021-12-23 2021-12-23 Earphone reconnection method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN116390067A true CN116390067A (en) 2023-07-04

Family

ID=86960194

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111607084.1A Pending CN116390067A (en) 2021-12-23 2021-12-23 Earphone reconnection method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN116390067A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117956546A (en) * 2024-03-27 2024-04-30 荣耀终端有限公司 Device reconnection method, electronic device, storage medium and chip

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117956546A (en) * 2024-03-27 2024-04-30 荣耀终端有限公司 Device reconnection method, electronic device, storage medium and chip

Similar Documents

Publication Publication Date Title
JP6902084B2 (en) Changing the behavior of companion communication devices based on the state of the wearable device
JP6982641B2 (en) Role exchange between unconnected wireless connected devices
EP3468068B1 (en) Method for establishing classic bluetooth connection between dual-mode bluetooth devices, and dual-mode bluetooth device
US11243595B2 (en) Method and apparatus for reducing continuous-wakeup delay of bluetooth loudspeaker, and bluetooth loudspeaker
EP3920507A1 (en) Wireless audio output devices
CN110933738B (en) Mode switching method and system of wireless earphone and TWS earphone system
CN106445448A (en) Audio device control method and system of terminal and mobile terminal
WO2013026311A1 (en) Method and device for application program operation, mobile terminal
JP6707124B2 (en) Method, system and apparatus for handling a system call during a voice call
EP4027670A1 (en) Bluetooth data transmission method and apparatus, terminal and storage medium
CN105848037A (en) Headset and terminal device controlling method
US11445285B2 (en) Interactive control method and device of an earphone case, earphone case and storage medium
CN114040373A (en) Audio service processing method and device, electronic equipment and storage medium
CN104243685A (en) Callback options via wireless device
CN116390067A (en) Earphone reconnection method and device, storage medium and electronic equipment
CN102811274A (en) Mobile phone and control method thereof
US10111207B2 (en) Network device, terminal device, and voice service control method
CN112291683B (en) TWS earphone control method and device
JP2019185771A (en) Method, device for processing data of bluetooth speaker, and bluetooth speaker
CN111988693B (en) Earphone control method and system based on earphone charging box and readable storage medium
WO2023061076A1 (en) Bluetooth connection method and apparatus, earphone, and storage medium
CN116528202A (en) Connection control method, device, electronic equipment and storage medium
CN111328061A (en) Audio resource control method, vehicle-mounted terminal and system
CN105072485A (en) Time delay control method and device
CN115905092A (en) Communication system, communication method, communication device, 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