Disclosure of Invention
The technical problem to be solved by the present invention is to provide a two-way communication method between a TWS headset and a charging box, which can realize two-way communication between the TWS headset and the charging box, effectively improve the UI interaction degree between the TWS headset and the charging box, and effectively improve the accuracy of interaction data.
In order to solve the technical problems, the technical scheme of the invention is as follows:
the two-way communication method of the TWS earphone and the charging box comprises the TWS earphone and the charging box, three terminals used for external connection are arranged on the charging box, three pins matched with the three terminals are arranged in the TWS earphone, the three terminals are a Vcharge end, a COM end and a GND end respectively, and the two-way communication method comprises the following steps:
1) three pins of the TWS earphone are respectively connected with three corresponding terminals in the charging box;
2) the TWS headset/charging box sends a communication code to the charging box/TWS headset;
3) the charging box/TWS earphone analyzes the communication code and sends a reply code to the TWS earphone/charging box after the communication code is effectively read;
4) the TWS earphone/charging box judges whether a reply code is received within a specified time, if so, the TWS earphone/charging box judges that the communication code is effectively read, and then communication is ended; if not, the TWS earphone/charging box judges that the charging box/TWS earphone does not receive the communication code, and then the next step is carried out;
5) the TWS earphone/charging box judges whether the number of times of continuously sending the communication codes to the charging box/TWS earphone is more than three times, if yes, the communication is finished, and if not, the step 2) is returned;
the TWS earphone sends a communication code to the charging box through the COM end, and the charging box sends the communication code to the TWS earphone through the Vcharge end.
Preferably, the communication code includes a boot code for prompting the TWS headset/charging box to receive communication information, a data code which is a code of specific communication contents recognizable by the TWS headset/charging box, a check code for displaying a transmission source of the communication code, and an end code for prompting the TWS headset/charging box that the communication code has ended.
Preferably, the Vcharge terminal and the COM terminal are high by default.
Preferably, the bootstrap code is composed of a low level of several units of time.
Preferably, the check code includes a first check code and a second check code, the transmission source of the communication code including the first check code is the charging box, and the transmission source of the communication code including the second check code is the TWS headset.
Preferably, the first check code is composed of a high level per unit time and a low level per unit time, and the second check code is composed of a high level per unit time and a low level per unit time.
As a preferred scheme, the data code is formed by combining four check codes.
As a preferred scheme, the TWS headset and the charging box are further provided with a storage module, the storage module stores a data code definition table, and the TWS headset/charging box selects corresponding data codes from the data code definition table according to specific conditions.
Preferably, the end code is composed of a high level per unit time or several high levels per unit time.
Preferably, the reply code is composed of a low level of several units of time.
The invention has the beneficial effects that: the two-way communication between the TWS earphone and the charging box can be realized by the two-way communication method of the TWS earphone and the charging box, and the UI interaction degree between the TWS earphone and the charging box is effectively improved; because the TWS earphone sends the communication code to the charging box through the COM end, and the charging box sends the communication code to the TWS earphone through the Vcharge end, the data transmission direction is not easy to be confused, and the accuracy of interactive data is effectively improved; the setting of the guide code and the end code can facilitate the reading of the communication code, and effectively improve the probability of successful reading of the communication code; the setting of the check code can further avoid the occurrence of the phenomenon of confusion generated in the data transmission direction, and can further improve the accuracy of the interactive data.
Detailed Description
The structural and operational principles of the present invention are explained in further detail below with reference to the accompanying drawings.
As shown in fig. 1, a two-way communication method for a TWS headset and a charging box includes the TWS headset and the charging box, three terminals for external connection are arranged on the charging box, three pins respectively adapted to the three terminals are arranged in the TWS headset, and the three terminals are a Vcharge terminal, a COM terminal and a GND terminal, respectively, and the two-way communication method includes the following steps:
1) three pins of the TWS earphone are respectively connected with three corresponding terminals in the charging box;
2) the TWS headset/charging box sends a communication code to the charging box/TWS headset;
3) the charging box/TWS earphone analyzes the communication code and sends a reply code to the TWS earphone/charging box after the communication code is effectively read;
4) the TWS earphone/charging box judges whether a reply code is received within a specified time, if so, the TWS earphone/charging box judges that the communication code is effectively read, and then communication is ended; if not, the TWS earphone/charging box judges that the charging box/TWS earphone does not receive the communication code, and then the next step is carried out;
5) the TWS earphone/charging box judges whether the number of times of continuously sending the communication codes to the charging box/TWS earphone is more than three times, if yes, the communication is finished, and if not, the step 2) is returned;
the TWS earphone sends a communication code to the charging box through the COM end, and the charging box sends the communication code to the TWS earphone through the Vcharge end.
Preferably, the communication code includes a boot code for prompting the TWS headset/charging box to receive communication information, a data code which is a code of specific communication contents recognizable by the TWS headset/charging box, a check code for displaying a transmission source of the communication code, and an end code for prompting the TWS headset/charging box that the communication code has ended.
Preferably, the Vcharge terminal and the COM terminal are high by default.
Preferably, the pilot code is composed of a low level of 50 ms.
Preferably, the check code includes a first check code and a second check code, the transmission source of the communication code including the first check code is the charging box, and the transmission source of the communication code including the second check code is the TWS headset.
As shown in fig. 2, the first check code is composed of a high level of 10ms and a low level of 10ms, and is labeled "0".
As shown in fig. 3, the second check code is composed of a 10ms high level and a 20ms low level, and is labeled as "1".
As a preferred scheme, the data code is formed by combining four check codes.
As a preferred scheme, the TWS headset and the charging box are further provided with a storage module, the storage module stores a data code definition table, and the TWS headset/charging box selects corresponding data codes from the data code definition table according to specific conditions.
Preferably, the end code is composed of a high level of 10 ms.
Preferably, the reply code is composed of a low level of 30 ms.
Example 1
The charging box sends the charging box open information to the TWS headset
1) The charging box sends a communication code to the TWS earphone through a Vcharge end;
2) the TWS earphone analyzes the communication codes and sends reply codes to the charging box through the COM end after the communication codes are effectively read;
3) the charging box judges whether the reply code is received within 350ms, if so, the charging box judges that the communication code is effectively read, and then communication is ended; if not, the charging box judges that the TWS earphone does not receive the communication code, and then the next step is carried out;
4) and the charging box judges whether the number of times of continuously sending the communication codes to the TWS earphone is more than three times, if so, the communication is ended, and if not, the step 2) is returned.
The communication code comprises a guide code, a data code, a check code and an end code. As shown in fig. 4, in this embodiment, the boot code is at a low level of 50ms, the data code is composed of four "0" s, i.e., "0000", which represents that the charging box is opened, the calibration code is at "0", which represents that the present communication code is at a high level of 10ms and sent from the charging box to the TWS headset; and after the TWS earphone deciphers the communication code, a reply code is sent to the charging box through the COM terminal, and the reply code is at a low level of 30 ms.
Example 2
The charging box sends the charging box off information to the TWS headset
1) The charging box sends a communication code to the TWS earphone through a Vcharge end;
2) the TWS earphone analyzes the communication codes and sends reply codes to the charging box through the COM end after the communication codes are effectively read;
3) the charging box judges whether the reply code is received within 350ms, if so, the charging box judges that the communication code is effectively read, and then communication is ended; if not, the charging box judges that the TWS earphone does not receive the communication code, and then the next step is carried out;
4) and the charging box judges whether the number of times of continuously sending the communication codes to the TWS earphone is more than three times, if so, the communication is ended, and if not, the step 2) is returned.
The communication code comprises a guide code, a data code, a check code and an end code. As shown in fig. 5, in the present embodiment, the preamble is at a low level of 50ms, the data code is composed of three "0" s and one "1", i.e., "0001", which represents that the charging box is closed, the calibration code is "0", which represents that the present communication code is at a high level of 10ms and is sent from the charging box to the TWS headset; and after the TWS earphone deciphers the communication code, a reply code is sent to the charging box through the COM terminal, and the reply code is at a low level of 30 ms.
Example 3
The user double clicks the reset button on the earphone box, and the charging box sends information of entering the pairing mode to the TWS earphone
1) The charging box sends a communication code to the TWS earphone through a Vcharge end;
2) the TWS earphone analyzes the communication codes and sends reply codes to the charging box through the COM end after the communication codes are effectively read;
3) the charging box judges whether the reply code is received within 350ms, if so, the charging box judges that the communication code is effectively read, and then communication is ended; if not, the charging box judges that the TWS earphone does not receive the communication code, and then the next step is carried out;
4) and the charging box judges whether the number of times of continuously sending the communication codes to the TWS earphone is more than three times, if so, the communication is ended, and if not, the step 2) is returned.
The communication code comprises a guide code, a data code, a check code and an end code. As shown in fig. 6, in this embodiment, the preamble is a low level of 50ms, the data code is composed of three "0" s and one "1", that is, "0010", which represents that the TWS headset enters the pairing mode, the check code is "0", which represents that the communication code is a high level sent from the charging box to the TWS headset, and the end code is 10 ms; and after the TWS earphone deciphers the communication code, a reply code is sent to the charging box through the COM terminal, and the reply code is at a low level of 30 ms.
Example 4
The TWS headset sends information that the pairing mode has been entered to the charging box
1) The TWS earphone sends a communication code to the charging box through the COM end;
3) the charging box analyzes the communication code and sends a reply code to the TWS earphone through a Vcharge end after the communication code is effectively read;
4) the TWS earphone judges whether the reply code is received within 350ms, if so, the TWS earphone judges that the communication code is effectively decoded, and then communication is ended; if not, the TWS earphone judges that the charging box does not receive the communication code, and then the next step is carried out;
5) and the TWS earphone judges whether the number of times of continuously sending the communication codes to the charging box is more than three times, if so, the communication is ended, and if not, the step 2) is returned.
The communication code comprises a guide code, a data code, a check code and an end code. As shown in fig. 7, in this embodiment, the preamble code is a low level of 50ms, the data code is composed of four "0" s, i.e., "0000", which represents that the pairing mode is entered, the check code is "1", which represents that the communication code is a high level of 10ms and sent to the charging box by the TWS headset; and after the charging box interprets the communication code, a reply code is sent to the TWS earphone through the Vcharge end, and the reply code is at a low level of 30 ms.
Example 5
The charging box sends the electric quantity information in the charging box to the TWS earphone, and the TWS earphone sends the electric quantity information to the VG equipment
1) The charging box sends a communication code to the TWS earphone through a Vcharge end;
2) the TWS earphone analyzes the communication codes and sends reply codes to the charging box through the COM end after the communication codes are effectively read;
3) the charging box judges whether the reply code is received within 350ms, if so, the charging box judges that the communication code is effectively read, and then communication is ended; if not, the charging box judges that the TWS earphone does not receive the communication code, and then the next step is carried out;
4) and the charging box judges whether the number of times of continuously sending the communication codes to the TWS earphone is more than three times, if so, the communication is ended, and if not, the step 2) is returned.
The communication code comprises a guide code, a data code, a check code and an end code. As shown in fig. 8, 9, 10 and 11, in this embodiment, the bootstrap code is a low level of 50ms, the data code is "0101", which represents that the electric quantity in the charging box has four lattices, the data code is "0110", which represents that the electric quantity in the charging box has three lattices, the data code is "0111", which represents that the electric quantity in the charging box has two lattices, the data code is "1000", which represents that the electric quantity in the charging box has one lattice, the calibration code is "0", which represents that the communication code is a high level sent from the charging box to the TWS headset, and the end code is a high level of 10 ms; and after the TWS earphone deciphers the communication code, a reply code is sent to the charging box through the COM terminal, and the reply code is at a low level of 30 ms.
The invention has the beneficial effects that: the two-way communication between the TWS earphone and the charging box can be realized by the two-way communication method of the TWS earphone and the charging box, and the UI interaction degree between the TWS earphone and the charging box is effectively improved; because the TWS earphone sends the communication code to the charging box through the COM end, and the charging box sends the communication code to the TWS earphone through the Vcharge end, the data transmission direction is not easy to be confused, and the accuracy of interactive data is effectively improved; the setting of the guide code and the end code can facilitate the reading of the communication code, and effectively improve the probability of successful reading of the communication code; the setting of the check code can further avoid the occurrence of the phenomenon of confusion generated in the data transmission direction, and can further improve the accuracy of the interactive data.
The above description is only a preferred embodiment of the present invention, and all the minor modifications, equivalent changes and modifications made to the above embodiment according to the technical solution of the present invention are within the scope of the technical solution of the present invention.