Communication method and device of wired earphone, control unit and medium

By analyzing and updating audio command information in the control unit of wired headphones, the problem of incompatibility between the communication protocol between traditional wired headphones and type_c interface hosts is solved, and the synchronization and compatibility of audio data formats is achieved, and the application scenarios are broadened.

CN119031047APending Publication Date: 2024-11-26ZHEJIANG GEOFORCECHIP TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411135372.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

There is a communication protocol incompatible between the traditional lightning interface wired headphone products and the type_c interface host products, and it cannot adapt to audio transmission in different data formats.

Method used

By obtaining downlink data packets sent by the terminal device in the control unit of the wired headset, analyzing the command format information, updating the audio command information to switch the audio data format, synchronizing the audio data format, ensuring the audio data format between the wired headset and the terminal device Unified and supports compatibility of different audio data formats.

Benefits of technology

It realizes the unity of audio data formats between wired headphones and terminal devices, ensures compatibility of different audio data formats, and broadens the application scenarios of wired headphones.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119031047A_ABST
    Figure CN119031047A_ABST
Patent Text Reader

Abstract

The invention provides a communication method and device of a wired earphone, a control unit and a medium, and relates to the technical field of communication. The method comprises the following steps: acquiring a current downlink data packet from terminal equipment received by the earphone interface; acquiring command format information of the current downlink data packet obtained based on analysis of a previous downlink data packet; according to the command format information, analyzing the current downlink data packet to obtain a current analysis result, the current analysis result comprising target audio command information; and updating the pre-stored latest audio command information into the target audio command information to indicate the switching of the audio data format. The application can be compatible with audio transmission of various data formats.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a communication method, device, control unit and medium for a wired headset. Background Art

[0002] Traditional wired headphone products with lightning interface can be adapted to host products with lightning interface, such as mobile phones, tablets, etc., to realize functions such as recording, playback, and key control.

[0003] With the development of communication technology, host products with type_c interface are gradually becoming popular. In order to adapt host products with type_c interface and wired headphone products with lightning interface, C to L adapter products are needed for conversion.

[0004] However, there is a communication protocol incompatibility issue between traditional lightning wired headset products and host products with type_c interface, and they cannot adapt to audio transmission in different data formats. Summary of the invention

[0005] The purpose of the present application is to provide a communication method, device, control unit and medium for wired headphones to address the deficiencies in the above-mentioned prior art, so as to be compatible with audio transmission in multiple data formats.

[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0007] In a first aspect, an embodiment of the present application provides a communication method of a wired headset, which is applied to a control unit of a wired headset, wherein the wired headset also includes a headset interface, and the method includes:

[0008] Obtaining a current downlink data packet received by the headphone interface from the terminal device;

[0009] Acquire command format information of the current downlink data packet obtained by parsing the previous downlink data packet;

[0010] Parsing the current downlink data packet according to the command format information to obtain a current parsing result, wherein the current parsing result includes: target audio command information;

[0011] The pre-stored latest audio command information is updated as the target audio command information to indicate the switching of the audio data format.

[0012] Optionally, parsing the current downlink data packet according to the command format information to obtain a current parsing result includes:

[0013] According to the command format information, the format area, command area and data area of ​​the current downlink data packet are parsed to obtain the data packet format information of the next downlink data packet, the target audio command information and the downlink audio data; the current parsing result includes: the data packet format information of the next downlink data packet, the target audio command information and the downlink audio data.

[0014] Optionally, the method further comprises:

[0015] If the downlink audio data is not empty, and the target audio command information includes downlink audio command information, the downlink audio data is parsed according to the downlink audio command information and then audio playback is performed.

[0016] Optionally, the updating of the pre-stored latest audio command information to the target audio command information to indicate the switching of the audio data format includes:

[0017] If the target audio command information includes: target downlink audio command information, updating the latest downlink audio command information to the target downlink audio command information to indicate the switching of the downlink audio data format;

[0018] The method further comprises:

[0019] Calculating the downlink command format information of the next downlink data packet according to the data packet format information of the next downlink data packet and the latest downlink audio command information;

[0020] The downlink command format information is stored to parse the next downlink data packet.

[0021] Optionally, the calculating the downlink command format information of the next downlink data packet according to the data packet format information of the next downlink data packet and the latest downlink audio command information includes:

[0022] Determining a command area end position according to a downlink data length of the next downlink data packet;

[0023] If the downlink data length of the next downlink data packet is less than the first length threshold, determining the starting position of the command area to be the first preset position;

[0024] Calculating the total amount of downlink audio data according to the downlink data length of the next downlink data packet and the number of downlink commands;

[0025] If the downlink data length of the next downlink data packet is greater than or equal to the first length threshold, and the downlink audio sampling rate and the total amount of the downlink audio data meet the first condition, determining the starting position of the command area according to the downlink bit width;

[0026] If the downlink data length of the next downlink data packet is greater than or equal to the first length threshold, and the downlink audio sampling rate and the total number of downlink audio data meet the second condition, the downlink bit width is the first bit width, and the starting position of the command area is determined to be the second preset position;

[0027] The downlink command format information includes: the command area start position and the command area end position.

[0028] Optionally, the updating of the pre-stored latest audio command information to the target audio command information includes:

[0029] If the target audio command information further includes: target uplink audio command information, updating the latest uplink audio command information to the target uplink audio command information to indicate the switching of the uplink audio data format;

[0030] The method further comprises:

[0031] Calculating uplink command format information according to the data packet format information of the next downlink data packet and the latest uplink audio command information;

[0032] The uplink command format information is stored.

[0033] Optionally, the calculating the uplink command format information according to the data packet format information of the next downlink data packet and the latest uplink audio command information includes:

[0034] If the uplink data length of the next downlink data packet is less than the second length threshold, determining the length of the command area according to the data length of the next downlink data packet;

[0035] If the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is the third sampling rate, and the uplink bit width is the second bit width, determining that the command area length is the first length;

[0036] If the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is the third sampling rate, and the uplink bit width is the third bit width, determining that the command area length is the second length;

[0037] If the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is the fourth sampling rate, and the uplink bit width is the fourth bit width, determining that the command area length is the third length;

[0038] The uplink command format information includes: the length of the command area.

[0039] Optionally, the method further comprises:

[0040] Processing the collected uplink audio data according to the target uplink audio command information and the uplink command format information to generate an uplink audio data packet;

[0041] The uplink audio data packet is sent to the terminal device through the headphone interface.

[0042] Optionally, the method further comprises:

[0043] Processing the collected uplink non-audio data according to the uplink command format information to generate an uplink non-audio data packet;

[0044] The uplink non-audio data packet is sent to the terminal device through the headphone interface.

[0045] In a second aspect, an embodiment of the present application further provides a communication device for a wired headset, which is applied to a control unit of a wired headset, wherein the wired headset further includes a headset interface, and the device includes:

[0046] An acquisition module, used for acquiring a current downlink data packet received by the headphone interface from a terminal device;

[0047] The acquisition module is further used to acquire command format information of the current downlink data packet obtained by parsing the previous downlink data packet;

[0048] A parsing module, used for parsing the current downlink data packet according to the command format information to obtain a current parsing result, wherein the current parsing result includes: target audio command information;

[0049] The updating module is used to update the pre-stored latest audio command information to the target audio command information to indicate the switching of the audio data format.

[0050] Optionally, the parsing module is specifically used to parse the format area, command area and data area of ​​the current downlink data packet according to the command format information to obtain the data packet format information of the next downlink data packet, the target audio command information and the downlink audio data; the current parsing result includes: the data packet format information of the next downlink data packet, the target audio command information and the downlink audio data.

[0051] Optionally, the parsing module is further used to parse the downlink audio data and then play the audio according to the downlink audio command information if the downlink audio data is not empty and the target audio command information includes: downlink audio command information.

[0052] Optionally, the updating module is specifically configured to update the latest downlink audio command information to the target downlink audio command information to indicate the switching of the downlink audio data format if the target audio command information includes: target downlink audio command information;

[0053] The parsing module is further used to calculate the downlink command format information of the next downlink data packet according to the data packet format information of the next downlink data packet and the latest downlink audio command information; and store the downlink command format information to parse the next downlink data packet.

[0054] Optionally, the parsing module is further used to determine the end position of the command area according to the downlink data length of the next downlink data packet; if the downlink data length of the next downlink data packet is less than a first length threshold, determine the starting position of the command area as a first preset position; calculate the total number of downlink audio data according to the downlink data length of the next downlink data packet and the number of downlink commands; if the downlink data length of the next downlink data packet is greater than or equal to the first length threshold, and the downlink audio sampling rate and the total number of downlink audio data meet a first condition, determine the starting position of the command area according to the downlink bit width; if the downlink data length of the next downlink data packet is greater than or equal to the first length threshold, and the downlink audio sampling rate and the total number of downlink audio data meet a second condition, the downlink bit width is the first bit width, and determine the starting position of the command area as the second preset position; the downlink command format information includes: the starting position of the command area and the end position of the command area.

[0055] Optionally, the updating module is specifically configured to update the latest uplink audio command information to the target uplink audio command information to indicate the switching of the uplink audio data format if the target audio command information further includes: target uplink audio command information;

[0056] The analysis module is further used to calculate the uplink command format information according to the data packet format information of the next downlink data packet and the latest uplink audio command information; and store the uplink command format information.

[0057] Optionally, the parsing module is also used to determine the command area length according to the data length of the next downlink data packet if the uplink data length of the next downlink data packet is less than a second length threshold; if the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is a third sampling rate, and the uplink bit width is a second bit width, determine the command area length to be the first length; if the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is a third sampling rate, and the uplink bit width is a third bit width, determine the command area length to be the second length; if the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is a fourth sampling rate, and the uplink bit width is a fourth bit width, determine the command area length to be the third length; the uplink command format information includes: the command area length.

[0058] Optionally, the device also includes: a generation module, used to process the collected uplink audio data according to the target uplink audio command information and the uplink command format information to generate an uplink audio data packet; and send the uplink audio data packet to the terminal device through the headphone interface.

[0059] Optionally, the generation module is further used to process the collected uplink non-audio data according to the uplink command format information to generate an uplink non-audio data packet; and send the uplink non-audio data packet to the terminal device through the headphone interface.

[0060] In the third aspect, an embodiment of the present application also provides a control unit, comprising: a processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, and when the control unit is running, the processor communicates with the storage medium through the bus, and the processor executes the program instructions to perform the steps of the communication method of the wired headset as described in any one of the first aspects.

[0061] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the communication method for a wired headset as described in any one of the first aspects are executed.

[0062] The beneficial effects of this application are:

[0063] The communication method, device, control unit and medium of the wired headset provided in the present application parse the current downlink data packet based on the command format information of the current downlink data packet parsed from the previous downlink data packet, obtain the target audio command information, and update the pre-stored latest audio command information to the target audio command information, so that the wired headset switches the audio data format. In this case, based on the switching of the audio data format of the terminal device, the audio data format of the wired headset is synchronously switched, which can ensure the uniformity of the audio data format between the wired headset and the terminal device, and even if the audio data formats are different, the target audio command information can be parsed through the command format information to achieve compatibility with different audio data formats. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0065] Figure 1 An architecture diagram of a communication system provided in an embodiment of the present application;

[0066] Figure 2 Schematic diagram of the process of the communication method of the wired headset provided in the embodiment of the present application Figure 1 ;

[0067] Figure 3 A schematic diagram of the data format provided in the embodiment of the present application;

[0068] Figure 4 A schematic diagram of a process for switching downlink audio command information provided in an embodiment of the present application;

[0069] Figure 5 Schematic diagram of the process of the communication method of the wired headset provided in the embodiment of the present application Figure 2 ;

[0070] Figure 6 A schematic diagram of a process for switching downlink formats provided in an embodiment of the present application;

[0071] Figure 7 Schematic diagram of the process of the communication method of the wired headset provided in the embodiment of the present application Figure 3 ;

[0072] Figure 8 A schematic diagram of the process of uplink format switching provided in an embodiment of the present application;

[0073] Fig. 9A schematic diagram of the structure of a communication device for a wired headset provided in an embodiment of the present application;

[0074] Fig.10 A schematic diagram of a control unit provided in an embodiment of the present application. DETAILED DESCRIPTION

[0075] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments.

[0076] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0077] In the description of the present application, it should be noted that if the terms "upper", "lower", etc. appear, the orientation or position relationship indicated is based on the orientation or position relationship shown in the drawings, or is the orientation or position relationship in which the product of the application is usually placed when used. It is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application.

[0078] In addition, the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0079] It should be noted that, in the absence of conflict, the features in the embodiments of the present application may be combined with each other.

[0080] In the communication processing solution used by traditional lightning wired headset products, the audio data packet consists of a command area and an audio data area, which can only adapt to a sampling rate of 48kHZ and a downstream bit width of 24bit. The upstream bit width is 16bit, the length of the audio data packet and the format of the audio data are fixed, and it cannot support a variety of sampling rate and bit width combinations, and is therefore not compatible with audio transmission in different data formats.

[0081] Based on this, the present application intends to provide a communication method, device, control unit and medium for wired headphones, which first sends a downlink data packet to the wired headphones through the terminal device, and parses the downlink data packet to obtain command format information, so that when a new downlink data packet is received, the audio command information can be parsed from the new downlink data packet according to the command format information, so that the wired headphones can switch the audio data format, thereby being compatible with audio transmission of different data formats.

[0082] Figure 1 The architecture diagram of the communication system provided in the embodiment of the present application is as follows: Figure 1 As shown, the communication system includes: a terminal device and a wired headset chip, wherein the terminal device is a host product, and the wired headset chip includes: a control unit (Microcontroller Unit, MCU), a receiving module, a sending module, and a headset interface.

[0083] If the audio transmission interface of the terminal device and the headphone interface of the wired headset are the same type of interface, the two can be connected directly. If the audio transmission interface of the terminal device and the headphone interface of the wired headset are different types of interfaces, they need to be connected through an adapter.

[0084] The specific implementation of the communication method of the wired headset applied to the control unit of the wired headset is described below in conjunction with the embodiments.

[0085] Figure 2 Schematic diagram of the process of the communication method of the wired headset provided in the embodiment of the present application Figure 1 ,like Figure 2 As shown, the method may include:

[0086] S101: Acquire the current downlink data packet received by the headphone interface from the terminal device.

[0087] In this embodiment, the terminal device is directly connected to the headphone interface, or is connected to the headphone interface through an adapter. After the terminal device is connected to the headphone interface, it starts to send downlink data packets to the control unit of the wired headset. Each downlink data packet is used to indicate the data packet format information of the next downlink data packet. Each downlink data packet includes: a fixed number of data packets. The data packet format information of the next downlink data packet needs to be split and stored in a fixed number of format areas to be sent with the data packets. Therefore, the format areas in the fixed number of data packets constitute a complete downlink data packet.

[0088] In some embodiments, at least part of the data packets of the current downlink data packet include command information, and the terminal device distributes a command in the command areas of multiple data packets, that is, the command area of ​​a data packet includes a part of the complete command.

[0089] S102: Acquire command format information of a current downlink data packet obtained by parsing a previous downlink data packet.

[0090] For example, Figure 3 A schematic diagram of the data format provided in the embodiment of the present application, such as Figure 3 As shown, in the downlink data packet sent by the terminal device to the wired headset, each data packet consists of a format area, a command area and a data area. The format area of ​​fixed data constitutes a complete downlink data packet. The previous downlink data packet carries the data packet format information of the current downlink data packet. By parsing the format area of ​​each data packet in the previous downlink data packet, the data packet format information of the current downlink data packet can be determined.

[0091] The data packet format information includes at least: the length information of each data packet and the command quantity information. Among them, when the terminal device does not send a command or audio data to the wired headset, the command area and the data area are default values, and the length information is the length of the format area. When the terminal device starts to send a command to the wired headset, the length information is the length of the format area and the command area. When the terminal device starts to send audio to the wired headset, the length information is the length of the format area, the command area, and the data area.

[0092] When receiving the previous downlink data packet, the control unit parses the length information and command quantity information of each data packet of the current downlink data packet from the format area of ​​the multiple data packets of the previous downlink data packet, and determines the command format information of the current downlink data packet based on the length information and command quantity information of each data packet. The command format information indicates the position of the command area in each data packet of the current downlink data packet.

[0093] In some embodiments, the length information of each data packet is downlink length information, the command quantity information is downlink command quantity information, and the command format information determined by the control unit according to the downlink length information and the downlink command quantity information is the downlink command format information.

[0094] In some embodiments, after determining the command format information of the current downlink data packet based on the previous downlink data packet, the control unit stores the command format information of the current downlink data packet in a register so that after receiving the current downlink data packet, the current downlink data packet can be parsed according to the command format information.

[0095] S103: Parse the current downlink data packet according to the command format information to obtain a current parsing result, which includes: target audio command information.

[0096] In this embodiment, after receiving the current downlink data packet, the control unit parses the current downlink data packet according to the command format information of the current downlink data packet parsed from the previous downlink data packet, determines the position of the command area in each data packet of the current downlink data packet, and parses the command areas of multiple data packets according to the positions of the command area in each data packet of the current downlink data packet to obtain target audio command information, which includes: audio sampling rate and bit width.

[0097] S104: Update the pre-stored latest audio command information as the target audio command information to indicate the switching of the audio data format.

[0098] In this embodiment, the audio command information of the wired headset is stored in the register of the wired headset. In order to ensure the correct parsing of the audio data between the wired headset and the terminal device, the audio command information stored in the register of the wired headset is the latest audio command information. If the target audio command information is parsed from the current downlink data packet, it is determined that the terminal device has switched the audio format. The terminal device will then use the switched audio format to transmit audio data. Therefore, the control unit will update the latest audio command information stored in the register to the target audio command information. The control unit needs to switch the audio command information of the wired headset to the target audio command information so that the wired headset switches the audio data format.

[0099] In some embodiments, the scenario of audio data format switching may be: switching of audio playback mode in a terminal device, such as switching of sound quality, or a change of the terminal device to which the wired headset is connected.

[0100] The communication method for wired headphones provided in the above embodiment parses the current downlink data packet based on the command format information of the current downlink data packet parsed from the previous downlink data packet to obtain the target audio command information, and updates the pre-stored latest audio command information to the target audio command information, so that the wired headphones switch the audio data format. In this case, based on the switching of the audio data format of the terminal device, the audio data format of the wired headphones is synchronously switched, which can ensure the uniformity of the audio data format between the wired headphones and the terminal device, and even if the audio data formats are different, the target audio command information can be parsed through the command format information to achieve compatibility with different audio data formats.

[0101] In a possible implementation, the process of parsing the current downlink data packet according to the command format information in S103 to obtain the current parsing result may include:

[0102] According to the command format information, the format area, command area and data area of ​​the current downlink data packet are parsed to obtain the data packet format information, target audio command information and downlink audio data of the next downlink data packet; the current parsing result includes: the data packet format information, target audio command information and downlink audio data of the next downlink data packet.

[0103] In this embodiment, each data packet of the current downlink data packet consists of a format area, a command area and a data area, wherein the format area in a fixed number of data packets constitutes a complete downlink data packet, the command data in the command area of ​​some data packets constitutes complete command data, and the data area of ​​each data packet contains a frame of audio data.

[0104] In the process of receiving data packets, the position of the command area in each data packet is determined according to the command format information, thereby determining that the format area is before the command area and the audio area is after the command area. Each time a data packet is received, a frame of downlink audio data is extracted from the audio area of ​​each data packet.

[0105] After receiving each data packet having command data in the command area, the command data is taken out from the command area of ​​each data packet having command data through the command interrupt function, and the taken out command data is parsed through the command parsing function to obtain the target audio command information.

[0106] After receiving a fixed number of data packets, the broadcast format data is taken out from the format area of ​​the fixed number of data packets through the broadcast interrupt function, and the taken out broadcast format data is parsed through the broadcast parsing function to obtain the data packet format information of the next downlink data packet.

[0107] The communication method for wired headphones provided in the above embodiment can determine the command area that changes adaptively according to the command format information when the audio data format switches, so that the data packet format information of the next downlink data packet can be parsed from the format area, the target audio command information can be parsed from the command area, and the downlink audio data can be parsed from the audio area, thereby achieving compatibility with audio transmission protocols in different scenarios.

[0108] In a possible implementation, the method may further include:

[0109] If the downlink audio data is not empty, and the target audio command information includes: downlink audio command information, the downlink audio data is parsed according to the downlink audio command information and then the audio is played.

[0110] In this embodiment, if the audio area of ​​each data packet of the current downlink data packet is not empty, that is, the audio area carries downlink audio data, the downlink audio data is the audio data sent by the terminal device to the wired headset and needs to be played through the earpiece of the wired headset.

[0111] If the target audio command information includes downlink audio command information, the downlink audio data may be parsed according to the downlink audio command information and played through the receiver of the wired headset.

[0112] For example, the downlink audio command information may include: a downlink sampling rate and a downlink bit width. The control unit may decode the downlink audio data according to the downlink sampling rate and the downlink bit width and then play the data through the earpiece of the wired headset.

[0113] In a possible implementation, the process of updating the pre-stored latest audio command information as the target audio command information in S104 to indicate the switching of the audio data format may include:

[0114] If the target audio command information includes: target downlink audio command information, the latest downlink audio command information is updated to the target downlink audio command information to indicate the switching of the downlink audio data format.

[0115] In this embodiment, if the control unit parses the target downlink audio command information from the command area of ​​multiple data packets of the current downlink data packet, the latest downlink audio command information is updated as the target downlink audio command information in the register, and the downlink audio command flag position is set to 1.

[0116] Afterwards, the downlink audio command flag is judged. If the downlink audio command flag is 1, the target downlink audio command information is taken out from the register, the downlink audio command information of the wired headset is switched to the target downlink audio command information, and the target downlink audio command information is used to parse the downlink audio data received subsequently; if the downlink audio command flag is 0, it means that the terminal device has not switched the audio data format, and the current downlink audio command information is still used to parse the downlink audio data received subsequently.

[0117] For example, Figure 4 A schematic diagram of a flow chart of downlink audio command information switching provided in an embodiment of the present application, such as Figure 4 As shown, the terminal device sends the current downlink data packet, determines the command area from the current downlink data packet, and after the complete command area is received, obtains the small packet command from the command area through the command interrupt function mkb_rcv, parses the small packet command through the command parsing function mkb_cmd_analyse, determines the downlink sampling rate SampleRateCfg_Down and the downlink bit width MIX_SIZE, records the information and sets the flag.

[0118] In the main function While(1):samplerate_switch, the flag Flag_SampCfg_Down of the downstream sampling rate is judged. If Flag_SampCfg_Down is 1, the downstream sampling rate SampleRateCfg_Down is switched. If Flag_SampCfg_Down is 0, the downstream sampling rate SampleRateCfg_Down is not switched. If Flag_MIX_SIZE is 1, the downstream bit width MIX_SIZE is switched. If Flag_MIX_SIZE is 0, the downstream bit width MIX_SIZE is not switched.

[0119] For example, the downlink sampling rate SampleRateCfg_Down may be 44.1 kHz or 48 kHz, and the downlink bit width MIX-SIZE may be 8 bits, 16 bits, or 24 bits.

[0120] In one possible implementation, Figure 5 Schematic diagram of the process of the communication method of the wired headset provided in the embodiment of the present application Figure 2 ,like Figure 5 As shown, the method may also include:

[0121] S201: Calculate downlink command format information of the next downlink data packet according to the data packet format information of the next downlink data packet and the latest downlink audio command information.

[0122] S202: Store the downlink command format information to parse the next downlink data packet.

[0123] In this embodiment, since the terminal device switches the downlink audio data format through the current downlink data packet indication, in order to ensure that the control unit can parse the audio data after the format switching from the next downlink data packet, it is necessary to determine the downlink command format information in the next downlink data packet.

[0124] Specifically, based on the data packet format information of the next downlink data packet parsed from the format area of ​​the current downlink data packet, the length information and command quantity information of each data packet in the next downlink data packet are determined; based on the length information, command quantity information, and the latest downlink audio command information of each data packet in the next downlink data packet, the downlink command format information of the next downlink data packet can be determined; the downlink command format information indicates the position of the command area in each data packet of the next downlink data packet.

[0125] In some embodiments, based on the latest downlink audio command information, the length of the audio sent each time by the terminal device can be determined; based on the length information of each data packet and the length of the audio sent each time, the length of the command area in each data packet can be determined; based on the command area length and command quantity information of each data packet, the number of commands in the command area of ​​each data packet can be determined, thereby determining the position of the command area in each data packet.

[0126] Among them, if the current downlink data packet contains the target downlink audio command information, the latest downlink audio command information is the target downlink audio command information; if the current downlink data packet does not contain the target downlink audio command information, the latest downlink audio command information is the downlink audio command information in the most recent downlink data packet that contains the downlink audio command information.

[0127] After determining the command format information of the next downlink data packet according to the current downlink data packet, the control unit stores the command format information of the next downlink data packet in the register, so that after receiving the next downlink data packet, the next downlink data packet can be parsed according to the command format information.

[0128] The communication method for wired headphones provided in the above embodiment can calculate the downlink command format information of the next downlink data packet based on the parsed data packet format information of the next downlink data packet and the latest downlink audio command information, so that after the audio data format of the terminal device is switched, the wired headphones can also parse the audio data after the format switching, thereby ensuring normal audio playback and achieving compatibility of different format switching between the terminal device and the wired headphones.

[0129] In a possible implementation, the process of calculating the downlink command format information of the next downlink data packet in S201 according to the data packet format information of the next downlink data packet and the latest downlink audio command information may include:

[0130] According to the downlink data length of the next downlink data packet, the end position of the command area is determined; if the downlink data length of the next downlink data packet is less than the first length threshold, the starting position of the command area is determined to be the first preset position; according to the downlink data length of the next downlink data packet and the number of downlink commands, the total number of downlink audio data is calculated; if the downlink data length of the next downlink data packet is greater than or equal to the first length threshold, and the downlink audio sampling rate and the total number of downlink audio data meet the first condition, the starting position of the command area is determined according to the downlink bit width; if the downlink data length of the next downlink data packet is greater than or equal to the first length threshold, and the downlink audio sampling rate and the total number of downlink audio data meet the second condition, the downlink bit width is the first bit width, and the starting position of the command area is determined to be the second preset position; the downlink command format information includes: the starting position of the command area and the end position of the command area.

[0131] In this embodiment, the length information of the next downlink data packet carried by the current downlink data packet includes the downlink data length, and the command quantity information includes the downlink command quantity.

[0132] For example, Figure 6 A schematic diagram of a downlink format switching process provided in an embodiment of the present application, such as Figure 6 As shown, the terminal device sends multiple data packets in sequence. After receiving a fixed number of data packets, the control unit performs interrupt processing through the format interrupt function broad_cast to avoid confusion between the current downlink data packet and the next downlink data packet causing parsing errors. The current downlink data packet is parsed through the format parsing function broad_irq_handler to determine the downlink data length MKB_RX_BYTE and the number of downlink commands Rx_FD_Byte of the next downlink data packet.

[0133] It is determined whether the downlink data length MKB_RX_BYTE of the next downlink data packet is less than a first length threshold, where the first length threshold may be 12, for example.

[0134] If the downlink data length MKB_RX_BYTE of the next downlink data packet is less than the first length threshold, it is determined that the next downlink data packet is a downlink data packet in a non-audio format, that is, the data area of ​​the next downlink data packet does not contain audio data, and the non-audio format processing flow is executed. The starting position of the command area is determined to be the first preset position, which may be 0x02, for example. The end position of the command area is calculated according to the downlink data length MKB_RX_BYTE of the next downlink data packet, which may be MKB_RX_BYTE-1. The starting position and the end position of the command area are stored in the register.

[0135] If the downlink data length MKB_RX_BYTE of the next downlink data packet is greater than or equal to the first length threshold, it is determined that the next downlink data packet is a downlink data packet in audio format, that is, the data area of ​​the next downlink data packet contains audio data, and the downlink audio processing flow is executed. According to the downlink data length MKB_RX_BYTE of the next downlink data packet and the fixed number n of data packets in each downlink data packet, the total amount of data of the next downlink data packet is calculated, and according to the total amount of data of the next downlink data packet and the number of downlink commands Rx_FD_Byte, the total amount of downlink audio data is calculated. For example, the calculation formula for the total amount of downlink audio data can be: (MKB_RX_BYTE-2)*n-Rx_FD_Byte.

[0136] Determine whether the downstream audio sampling rate and the total number of downstream volume data meet the first condition. The first condition is the first sampling rate, for example 48k, because the downstream audio sampling rate may be the audio sampling rate sent by the previous downstream data packet, and the total number of downstream audio data is the latest data calculated based on the current downstream data packet. The total number of downstream audio data can also be expressed as the audio sampling rate. If the downstream audio sampling rate is consistent with the audio sampling rate represented by the total number of downstream audio data, and both meet the first sampling rate, the starting position of the command area is calculated according to the downstream bit width. For example, the calculation formula for the starting position of the command area can be expressed as: 0x02+MIX_SIZE*2. The end position of the command area is calculated according to the downlink data length MKB_RX_BYTE of the next downstream data packet.

[0137] If the downstream audio sampling rate and the total number of downstream volume data do not meet the first condition, but meet the second condition, the second condition is the second sampling rate, for example 44.1k, determine whether the downstream bit width is the first bit width, if the downstream bit width is the first bit width, for example 24bit, then determine that the starting position of the command area is the second preset position, the second preset position can be 0x07, for example, the command area end position is calculated according to the downlink data length MKB_RX_BYTE of the next downlink data packet.

[0138] If the downstream audio sampling rate and the total number of downstream volume data meet the second condition, and the downstream bit width is the second bit width, such as 16 bits, other methods can be configured to determine the start position and end position of the command area.

[0139] In some embodiments, for a downlink data packet with a downlink sampling rate of 44.1k and a downlink bit width of 24 bits, the formats of the command area and the data area are not fixed formats, and the offset address mapping table of the downlink data packet with a downlink sampling rate of 44.1k and a downlink bit width of 24 bits can be loaded to determine the actual command area starting address and command area ending address based on the determined fixed command area starting position, command area ending position and the offset address mapping table.

[0140] The communication method for wired headphones provided in the above embodiment determines the format information of the downlink command area according to different downlink sampling rates and different bit widths. When the data format is switched, the audio data after the format switching can also be parsed, thereby ensuring normal audio playback. It can be compatible with audio data formats with multiple downlink sampling rates and downlink bit widths, broadening the application scenarios of wired headphones.

[0141] In a possible implementation, the process of updating the pre-stored latest audio command information as the target audio command information in S104 may include:

[0142] If the target audio command information further includes: target uplink audio command information, the latest uplink audio command information is updated to the target uplink audio command information to indicate the switching of the uplink audio data format.

[0143] In this embodiment, if the control unit parses the target uplink audio command information from the command areas of the multiple data packets of the current downlink data packet, the latest uplink audio command information is updated as the target uplink audio command information in the register.

[0144] Afterwards, when recording is performed through the wired headset, the wired headset encodes the uplink audio data according to the target uplink audio command information and then sends it to the terminal device.

[0145] In one possible implementation, Figure 7 Schematic diagram of the process of the communication method of the wired headset provided in the embodiment of the present application Figure 3 ,like Figure 7 As shown, the method may also include:

[0146] S301: Calculate uplink command format information according to the data packet format information of the next downlink data packet and the latest uplink audio command information.

[0147] S302: Store uplink command format information.

[0148] In this embodiment, since the terminal device switches the uplink audio data format through the current downlink data packet instruction, in order to ensure that the audio data subsequently sent by the wired headset to the terminal device can be correctly parsed by the terminal device, it is necessary to determine the uplink command format information.

[0149] Specifically, based on the data packet format information of the next downlink data packet parsed from the format area of ​​the current downlink data packet, the length information and command quantity information of each data packet in the next downlink data packet are determined; based on the length information, command quantity information of each data packet in the next downlink data packet, and the latest uplink audio command information, the uplink command format information can be determined, and the uplink command format information indicates the position of the command area in the uplink data packet.

[0150] In some embodiments, based on the latest uplink audio command information, the length of the audio sent each time by the terminal device can be determined, based on the length information of each data packet and the length of the audio sent each time, the length of the command area in each data packet can be determined, and based on the command area length and command quantity information of each data packet, the number of commands in the command area of ​​each data packet can be determined, thereby determining the position of the command area in each data packet.

[0151] Among them, if the current downlink data packet contains the target uplink audio command information, the latest uplink audio command information is the target uplink audio command information; if the current downlink data packet does not contain the target uplink audio command information, the latest uplink audio command information is the uplink audio command information in the most recent downlink data packet containing the uplink audio command information.

[0152] After determining the uplink command format information according to the current downlink data packet, the control unit stores the uplink command format information in a register so as to encode the audio data when sending the audio data to the terminal device.

[0153] The communication method for wired headphones provided in the above embodiment can calculate the uplink and downlink command format information based on the parsed data packet format information of the next downlink data packet and the latest uplink audio command information, so that after the audio data format of the terminal device is switched, the wired headphones can send the audio data after the format is switched, thereby ensuring that the terminal device can receive the audio data normally, and achieving compatibility of different format switching between the terminal device and the wired headphones.

[0154] In a possible implementation, the process of calculating the uplink command format information according to the data packet format information of the next downlink data packet and the latest uplink audio command information in S301 may include:

[0155] If the uplink data length of the next downlink data packet is less than the second length threshold, the command area length is determined according to the data length of the next downlink data packet; if the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is the third sampling rate, and the uplink bit width is the second bit width, the command area length is determined to be the first length; if the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is the third sampling rate, and the uplink bit width is the third bit width, the command area length is determined to be the second length; if the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is the fourth sampling rate, and the uplink bit width is the fourth bit width, the command area length is determined to be the third length; the uplink command format information includes: command area length.

[0156] In this embodiment, the length information carried by the current downlink data packet includes the uplink data length, and the command quantity information includes the uplink command quantity.

[0157] For example, Figure 8 A schematic diagram of the process of uplink format switching provided in an embodiment of the present application, such as Figure 8 As shown, the terminal device sends multiple data packets in sequence. After receiving a fixed number of data packets, the control unit performs interrupt processing through the format interrupt function broad_cast to avoid confusion between the current downlink data packet and the next downlink data packet causing parsing errors. The current downlink data packet is parsed through the format parsing function broad_irq_handler to determine the uplink data length MKB_TX_BYTE and the number of uplink commands Tx_FD_Byte.

[0158] It is determined whether the uplink data length MKB_TX_BYTE is less than a second length threshold, where the second length threshold may be 9, for example.

[0159] If the uplink data length MKB_TX_BYTE is less than the second length threshold, it is determined to execute the non-audio format processing flow, and the command area length is calculated according to the uplink data length MKB_TX_BYTE. The command area length can be MKB_RX_BYTE-1, and the command area length is stored in the register.

[0160] If the uplink data length MKB_TX_BYTE is greater than or equal to the second length threshold, determine to execute the audio format processing flow, calculate the total amount of data according to the uplink data length MKB_TX_BYTE and the fixed number n of data packets in each downlink data packet, and calculate the total amount of uplink audio data according to the total amount of data and the uplink command number Tx_FD_Byte. For example, the calculation formula for the total amount of uplink audio data can be: (MKB_TX_BYTE-1)*n-Tx_FD_Byte.

[0161] Determine whether the uplink audio sampling rate and the audio sampling rate represented by the total amount of uplink volume data are consistent, both are the third sampling rate, for example, 48 bits, the uplink bit width is the second bit width, for example, 16 bits, and determine that the command area length is the first length, for example, 0x06; if the uplink audio sampling rate and the audio sampling rate represented by the total amount of uplink volume data are consistent, both are the third sampling rate, for example, 48 bits, the uplink bit width is the third bit width, for example, 24 bits, determine that the command area length is the second length, for example, 0x05.

[0162] If the uplink audio sampling rate and the audio sampling rate represented by the total amount of uplink volume data are consistent, both are the fourth sampling rate, for example 44.1 bits, the uplink bit width is the fourth bit width, for example 24 bits, and the command area length is determined to be the third length, for example 0x06; if the uplink audio sampling rate and the audio sampling rate represented by the total amount of uplink volume data are consistent, both are the fourth sampling rate, for example 44.1 bits, the uplink bit width is the fifth bit width, for example 16 bits, and the command area length is determined to be the third length, then other methods may be configured to determine the command area length.

[0163] In a possible implementation, the method may further include:

[0164] The collected uplink audio data is processed according to the target uplink audio command information and the uplink command format information to generate an uplink audio data packet; and the uplink audio data packet is sent to the terminal device through the headphone interface.

[0165] In this embodiment, the uplink data packet may include a command area and a data area. When the user records through a wired headset, the control unit collects the uplink audio data, determines the amount of uplink audio data that can be sent each time according to the uplink sampling rate and the bit width, determines the starting position of the data area according to the length of the uplink command area, edits the uplink audio data in the data area, generates an uplink audio data packet, and sends the uplink audio data packet to the terminal device through the headphone interface. After receiving the uplink audio data packet, the terminal device parses the uplink audio data packet according to the target uplink audio command information.

[0166] In another possible implementation, the method may further include:

[0167] According to the uplink command format information, the collected uplink non-audio data is processed to generate an uplink non-audio data packet; and the uplink non-audio data packet is sent to the terminal device through the headphone interface.

[0168] In this embodiment, the uplink data packet may include a command area and a data area. When the user performs key control through a wired headset, the control unit collects the uplink command data, splits the uplink command data into multiple lines according to the length of the uplink command area, edits the uplink non-audio data in multiple command areas, generates an uplink non-audio data packet, and sends the uplink non-audio data packet to the terminal device through the headphone interface. After the terminal device receives the uplink non-audio data packet, it parses the uplink non-audio data packet, determines the key control command, and controls the terminal device to execute the corresponding command according to the key control command.

[0169] The communication method for wired headphones provided in the above embodiment determines the format information of the uplink command area according to different uplink sampling rates and uplink bit widths to achieve uplink format switching. When the data format is switched, the switched format can be used for data encoding, thereby ensuring that the terminal device can parse the encoded data. It can be compatible with audio data formats with multiple uplink sampling rates and uplink bit widths, thereby broadening the application scenarios of wired headphones.

[0170] On the basis of the above method embodiment, the embodiment of the present application further provides a communication device for a wired headset, which is applied to a control unit of a wired headset, and the wired headset also includes a headset interface. Fig. 9 A schematic diagram of the structure of a communication device for a wired headset provided in an embodiment of the present application, such as Fig. 9 As shown, the device may include:

[0171] The acquisition module 401 is used to acquire the current downlink data packet received by the earphone interface from the terminal device;

[0172] The acquisition module 401 is further used to acquire the command format information of the current downlink data packet obtained by parsing the previous downlink data packet;

[0173] The parsing module 402 is used to parse the current downlink data packet according to the command format information to obtain the current parsing result, which includes: target audio command information;

[0174] The updating module 403 is used to update the pre-stored latest audio command information to the target audio command information to indicate the switching of the audio data format.

[0175] Optionally, the parsing module 402 is specifically used to parse the format area, command area and data area of ​​the current downlink data packet according to the command format information to obtain the data packet format information, target audio command information and downlink audio data of the next downlink data packet; the current parsing result includes: the data packet format information, target audio command information and downlink audio data of the next downlink data packet.

[0176] Optionally, the parsing module 402 is further configured to, if the downlink audio data is not empty and the target audio command information includes downlink audio command information, parse the downlink audio data according to the downlink audio command information and then perform audio playback.

[0177] Optionally, the updating module 403 is specifically configured to update the latest downlink audio command information to the target downlink audio command information to indicate the switching of the downlink audio data format if the target audio command information includes: target downlink audio command information;

[0178] The parsing module 402 is further used to calculate the downlink command format information of the next downlink data packet according to the data packet format information of the next downlink data packet and the latest downlink audio command information; and store the downlink command format information to parse the next downlink data packet.

[0179] Optionally, the parsing module 402 is further used to determine the end position of the command area according to the downlink data length of the next downlink data packet; if the downlink data length of the next downlink data packet is less than the first length threshold, determine the starting position of the command area as the first preset position; calculate the total number of downlink audio data according to the downlink data length of the next downlink data packet and the number of downlink commands; if the downlink data length of the next downlink data packet is greater than or equal to the first length threshold, and the downlink audio sampling rate and the total number of downlink audio data meet the first condition, determine the starting position of the command area according to the downlink bit width; if the downlink data length of the next downlink data packet is greater than or equal to the first length threshold, and the downlink audio sampling rate and the total number of downlink audio data meet the second condition, the downlink bit width is the first bit width, and determine the starting position of the command area as the second preset position; the downlink command format information includes: the starting position of the command area and the end position of the command area.

[0180] Optionally, the updating module 403 is specifically configured to update the latest uplink audio command information to the target uplink audio command information to indicate the switching of the uplink audio data format if the target audio command information further includes: target uplink audio command information;

[0181] The parsing module 402 is further configured to calculate uplink command format information according to the data packet format information of the next downlink data packet and the latest uplink audio command information; and store the uplink command format information.

[0182] Optionally, the parsing module 402 is also used to determine the command area length according to the data length of the next downlink data packet if the uplink data length of the next downlink data packet is less than the second length threshold; if the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is the third sampling rate, and the uplink bit width is the second bit width, determine the command area length to be the first length; if the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is the third sampling rate, and the uplink bit width is the third bit width, determine the command area length to be the second length; if the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is the fourth sampling rate, and the uplink bit width is the fourth bit width, determine the command area length to be the third length; the uplink command format information includes: command area length.

[0183] Optionally, the device also includes: a generation module, used to process the collected uplink audio data according to the target uplink audio command information and the uplink command format information to generate an uplink audio data packet; and send the uplink audio data packet to the terminal device through the headphone interface.

[0184] Optionally, the generating module is further used to process the collected uplink non-audio data according to the uplink command format information to generate an uplink non-audio data packet; and send the uplink non-audio data packet to the terminal device through the headphone interface.

[0185] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0186] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASICs), or one or more microprocessors, or one or more field programmable gate arrays (FPGAs). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0187] Fig.10 A schematic diagram of a control unit provided in an embodiment of the present application, such as Fig.10As shown, the control unit 500 may include: a processor 501, a storage medium 502 and a bus, the storage medium 502 stores program instructions executable by the processor 501, when the control unit 500 is running, the processor 501 and the storage medium 502 communicate through the bus, and the processor 501 executes the program instructions to execute the above method embodiment. The specific implementation method and technical effect are similar and will not be repeated here.

[0188] Optionally, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above method embodiment is executed.

[0189] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0190] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple 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.

[0191] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0192] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

[0193] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A communication method for a wired headset, characterized in that: A control unit applied to a wired headset, wherein the wired headset also includes a headset interface, and the method includes: Obtaining a current downlink data packet received by the headphone interface from the terminal device; Acquire command format information of the current downlink data packet obtained by parsing the previous downlink data packet; Parsing the current downlink data packet according to the command format information to obtain a current parsing result, wherein the current parsing result includes: target audio command information; The pre-stored latest audio command information is updated as the target audio command information to indicate the switching of the audio data format.

2. The method according to claim 1, characterized in that The step of parsing the current downlink data packet according to the command format information to obtain a current parsing result includes: According to the command format information, the format area, command area and data area of ​​the current downlink data packet are parsed to obtain the data packet format information of the next downlink data packet, the target audio command information and the downlink audio data; the current parsing result includes: the data packet format information of the next downlink data packet, the target audio command information and the downlink audio data.

3. The method according to claim 2, characterized in that The method further comprises: If the downlink audio data is not empty, and the target audio command information includes downlink audio command information, the downlink audio data is parsed according to the downlink audio command information and then audio playback is performed.

4. The method according to claim 2, characterized in that The updating of the pre-stored latest audio command information to the target audio command information to indicate the switching of the audio data format includes: If the target audio command information includes: target downlink audio command information, updating the latest downlink audio command information to the target downlink audio command information to indicate the switching of the downlink audio data format; The method further comprises: Calculating the downlink command format information of the next downlink data packet according to the data packet format information of the next downlink data packet and the latest downlink audio command information; The downlink command format information is stored to parse the next downlink data packet.

5. The method according to claim 4, characterized in that The step of calculating the downlink command format information of the next downlink data packet according to the data packet format information of the next downlink data packet and the latest downlink audio command information comprises: Determining a command area end position according to a downlink data length of the next downlink data packet; If the downlink data length of the next downlink data packet is less than the first length threshold, determining the starting position of the command area to be the first preset position; Calculating the total amount of downlink audio data according to the downlink data length of the next downlink data packet and the number of downlink commands; If the downlink data length of the next downlink data packet is greater than or equal to the first length threshold, and the downlink audio sampling rate and the total amount of the downlink audio data meet the first condition, determining the starting position of the command area according to the downlink bit width; If the downlink data length of the next downlink data packet is greater than or equal to the first length threshold, and the downlink audio sampling rate and the total number of downlink audio data meet the second condition, the downlink bit width is the first bit width, and the starting position of the command area is determined to be the second preset position; The downlink command format information includes: the command area start position and the command area end position.

6. The method according to claim 2, characterized in that The updating of the pre-stored latest audio command information to the target audio command information to indicate the switching of the audio data format includes: If the target audio command information further includes: target uplink audio command information, updating the latest uplink audio command information to the target uplink audio command information to indicate the switching of the uplink audio data format; The method further comprises: Calculating uplink command format information according to the data packet format information of the next downlink data packet and the latest uplink audio command information; The uplink command format information is stored.

7. The method according to claim 6, characterized in that The calculating the uplink command format information according to the data packet format information of the next downlink data packet and the latest uplink audio command information comprises: If the uplink data length of the next downlink data packet is less than the second length threshold, determining the length of the command area according to the data length of the next downlink data packet; If the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is the third sampling rate, and the uplink bit width is the second bit width, determining that the command area length is the first length; If the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is the third sampling rate, and the uplink bit width is the third bit width, determining that the command area length is the second length; If the uplink data length of the next downlink data packet is greater than or equal to the second length threshold, and the uplink audio sampling rate is the fourth sampling rate, and the uplink bit width is the fourth bit width, determining that the command area length is the third length; The uplink command format information includes: the length of the command area.

8. The method according to claim 6, characterized in that The method further comprises: Processing the collected uplink audio data according to the target uplink audio command information and the uplink command format information to generate an uplink audio data packet; The uplink audio data packet is sent to the terminal device through the headphone interface.

9. The method according to claim 6, characterized in that The method further comprises: Processing the collected uplink non-audio data according to the uplink command format information to generate an uplink non-audio data packet; The uplink non-audio data packet is sent to the terminal device through the headphone interface.

10. A communication device for a wired headset, characterized in that: A control unit applied to a wired headset, wherein the wired headset also includes a headset interface, and the device includes: An acquisition module, used for acquiring a current downlink data packet received by the headphone interface from a terminal device; The acquisition module is further used to acquire command format information of the current downlink data packet obtained by parsing the previous downlink data packet; A parsing module, used for parsing the current downlink data packet according to the command format information to obtain a current parsing result, wherein the current parsing result includes: target audio command information; The updating module is used to update the pre-stored latest audio command information to the target audio command information to indicate the switching of the audio data format.

11. A control unit, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, and when the control unit is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to perform the steps of the communication method for the wired headset as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the communication method of the wired headset according to any one of claims 1 to 9 are executed.