CN108092741A - Communication means, terminal and communication equipment based on audio interface - Google Patents

Communication means, terminal and communication equipment based on audio interface Download PDF

Info

Publication number
CN108092741A
CN108092741A CN201711324382.3A CN201711324382A CN108092741A CN 108092741 A CN108092741 A CN 108092741A CN 201711324382 A CN201711324382 A CN 201711324382A CN 108092741 A CN108092741 A CN 108092741A
Authority
CN
China
Prior art keywords
frequency
mentioned
duration
data
audio interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201711324382.3A
Other languages
Chinese (zh)
Other versions
CN108092741B (en
Inventor
钟伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Hetai Intelligent Home Appliance Controller Co ltd
Original Assignee
Shenzhen Het Data Resources and Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Het Data Resources and Cloud Technology Co Ltd filed Critical Shenzhen Het Data Resources and Cloud Technology Co Ltd
Priority to CN201711324382.3A priority Critical patent/CN108092741B/en
Publication of CN108092741A publication Critical patent/CN108092741A/en
Application granted granted Critical
Publication of CN108092741B publication Critical patent/CN108092741B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0009Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the channel coding
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03KPULSE TECHNIQUE
    • H03K21/00Details of pulse counters or frequency dividers
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03KPULSE TECHNIQUE
    • H03K4/00Generating pulses having essentially a finite slope or stepped portions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R3/00Circuits for transducers, loudspeakers or microphones

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Physics & Mathematics (AREA)
  • Acoustics & Sound (AREA)
  • Quality & Reliability (AREA)
  • Human Computer Interaction (AREA)
  • Telephone Function (AREA)

Abstract

The embodiment of the invention discloses a kind of communication means based on audio interface, terminal and communication equipment, wherein method includes:The first data are obtained, first data are to treat the binary data sent to terminal;Generate the corresponding square wave of first data;Each 1 in first data correspond to N number of high level when a length of first duration square wave, each 0 in first data correspond to M high level when a length of second duration square wave;Wherein, the high level when a length of first duration square wave frequency for first frequency, the high level when a length of second duration the frequency of square wave be second frequency;The first frequency and the second frequency are not less than 500 hertz and no more than 6000 hertz;The corresponding square wave of first data is sent to the terminal by audio interface.The success rate to communicate between target device and terminal by audio interface can be improved, solves the problems, such as that audio interface compatibility is poor.

Description

Communication means, terminal and communication equipment based on audio interface
Technical field
The present invention relates to electronic technology field more particularly to the communication means based on audio interface, terminal and communication equipment.
Background technology
At present, almost everyone has a smart mobile phone, this mobile phone may be iPhone, i.e. iPhone also may be used Can be Android mobile phone, i.e. Android phone.Either any smart mobile phone all corresponds to a powerful exploitation in fact Platform has attracted numerous software application development persons, and often these softwares need the cooperation of hardware adaptor.IPhone mobile phones It is its unique data-interface and earphone interface to be supplied to extraneous interface, and Android phone can generally provide USB interface And earphone interface.Therefore, interface most general actually on mobile phone is earphone interface rather than various data-interfaces.
Earphone interface has 4 signal wires, is L channel, right channel, ground connection and microphone respectively, and L channel and right channel are used In driving earphone, so being exactly to export for mobile phone;Microphone is acquisition voice signal, so being defeated for its direction of mobile phone Enter.Therefore earphone interface, the requirement of the two-way communication of mobile phone and hardware adaptor can be met.Earphone interface communication equipment at present, greatly It is all encoded using Synchronization and Binary Frequency Shift Keying, i.e. 2FSK codings.
In the scheme using Synchronization, low level to high level saltus step expression " 1 ", high level is to low level Saltus step represents " 0 ".Coding is using start bit+data bit+odd even effect position+stop position.Equipment end is decoded using timer capture, Mobile phone terminal I/O mouthfuls of decodings of bottom.In this scheme, mobile phone decoding is complicated, because Synchronization " 1 " and the frequency of " 0 " Rate is identical, it is necessary to operate the input/output interface of bottom.In addition, different Android phones may differ to the impedance of signal Sample so causes equipment to issue the signal gross distortion of mobile phone or even part signal loss by microphone.Therefore, this side Case so that the compatibility of Android phone is poor.In the scheme using 2FSK codings, represented with continuous multiple first frequencies " 1 " represents " 0 " that coding is using start bit+data bit+odd even effect position+stop position with continuous multiple second frequencies.Equipment End and mobile phone terminal are decoded using Fast Fourier Transform (FFT) (FFT).In this scheme, the FFT transform requirement speed of service is fast, right The operation clock request of system is high, and 8 common microcontrollers can not run, and so equipment cost be caused to increase.In addition, this side Case only supports a few money Android phones, and compatibility is poor.
The problem of above-mentioned technical proposal is high there are communication failure rate, and compatibility is poor.
The content of the invention
The embodiment of the present invention provides a kind of communication means based on audio interface, can solve audio interface communication failure rate The problem of height, compatibility is poor, and reduce cost.
In a first aspect, an embodiment of the present invention provides a kind of communication means based on audio interface, this method includes:
The first data are obtained, first data are to treat the binary data sent to terminal;
Generate the corresponding square wave of first data;Each 1 in first data correspond to N number of high level when it is a length of The square wave of first duration, each 0 in first data correspond to M high level when a length of second duration square wave;Wherein, The high level when a length of first duration square wave frequency for first frequency, when a length of second duration of the high level The frequency of square wave is second frequency;The first frequency and the second frequency are not less than 500 hertz and no more than 6000 hertz Hereby;
The corresponding square wave of first data is sent to the terminal by audio interface.
Second aspect, another embodiment of the present invention provide a kind of communication means based on audio interface, and this method includes:
By audio interface reception come the echo signal of self terminal;
Determine the corresponding Q duration of Q high level that the echo signal includes, when R in the Q duration is a length of First duration, a length of second duration at W, the duration of the high level of the square wave of a length of first frequency when described first, described The duration of the high level of the square wave of a length of second frequency when two, the first frequency are K times of the second frequency, and the K is not Less than 2;The first frequency and the second frequency are not less than 500 hertz and no more than 6000 hertz;
The corresponding binary data of the echo signal is determined according to the Q duration, it is every in the binary data A 1 correspond to N number of high level when a length of first duration square wave, each 0 in the binary data correspond to it is M high electric The square wave of a length of second duration when flat.
The third aspect, another embodiment of the present invention provide a kind of communication means based on audio interface, and this method includes:
The second data are obtained, second data are to treat the binary data sent to target device, second data Start bit, data bit, cyclic redundancy check position, parity bit and the corresponding binary coding of stop bits are included successively;
The corresponding echo signal of second data is generated by signal generator, each 1 pair in second data Answer the sine wave or cosine wave that N number of continuous frequency is first frequency, each 0 in second data correspond to M it is continuous Frequency is the sine wave or cosine wave of second frequency, and the echo signal includes the corresponding sine wave of second data or cosine Ripple, the first frequency are K times of the second frequency, and the K is not less than 2, and N number of continuous frequency is first frequency The duration of sine wave or cosine wave is less than 4 milliseconds, and the first frequency and the second frequency are not less than 500 hertz and little In 6000 hertz;
The echo signal is sent to the target device by audio interface.
Fourth aspect, another embodiment of the present invention provide a kind of communication means based on audio interface, and this method includes:
The echo signal of target device transmission is received by audio interface, the echo signal is sampled, obtains G Sampled data;
The number of the sampled data of current desired acquisition is determined according to data list after F, to obtain F sampled data, institute F sampled data is stated as the data in the G sampled data, the data list includes H numerical value, and the H numerical value is The number of sampled data to be chosen;
Fast Fourier Transform (FFT) FFT is carried out to the F sampled data, obtains result of calculation, the result of calculation includes The information of the corresponding frequency of the F sampled data, the F sampled data correspond to first frequency or second frequency;
If the corresponding frequency of the F sampled data is the first frequency, it is determined that the F sampled data is corresponding Binary numeral is 1;Otherwise, it determines the corresponding binary numeral of the F sampled data is 0.
5th aspect, an embodiment of the present invention provides a kind of communication equipment, which includes performing above-mentioned first party The unit of the method for face and/or above-mentioned second aspect.
6th aspect, an embodiment of the present invention provides a kind of terminal, which includes performing above-mentioned third party The unit of the method for face and/or above-mentioned fourth aspect.
7th aspect, an embodiment of the present invention provides another communication equipments, are set including processor, input equipment, output Standby and memory, the processor, input equipment, output equipment and memory are connected with each other, wherein, the memory is used to deposit Storage support terminal perform the above method computer program, the computer program include program instruction, the processor by with Put the method that described program is called to instruct, performs above-mentioned first aspect and/or above-mentioned second aspect.
Eighth aspect, an embodiment of the present invention provides another terminal, including processor, input equipment, output equipment and Memory, the processor, input equipment, output equipment and memory are connected with each other, wherein, the memory is for storage branch The computer program that terminal performs the above method is held, the computer program includes program instruction, and the processor is configured to use In calling described program instruction, the method for performing the above-mentioned third aspect and/or above-mentioned fourth aspect.
9th aspect, an embodiment of the present invention provides a kind of computer readable storage medium, the computer storage media Computer program is stored with, the computer program includes program instruction, and described program instruction makes institute when being executed by a processor Processor is stated to perform described in above-mentioned first aspect, above-mentioned second aspect, the above-mentioned third aspect and above-mentioned any one of fourth aspect Method.
In the embodiment of the present invention, N number of high level when a length of first duration square wave represent binary numeral 1, it is M high electric The square wave of a length of second duration represents binary numeral 0 when flat, by reasonably setting the first duration and the second duration relation And size, the success rate to communicate between target device and terminal by audio interface can be improved, and solves terminal The problem of audio interface compatibility is poor.
Description of the drawings
Technical solution in order to illustrate the embodiments of the present invention more clearly, below will be to needed in embodiment description Attached drawing is briefly described, it should be apparent that, the accompanying drawings in the following description is some embodiments of the present invention, general for this field For logical technical staff, without creative efforts, other attached drawings are can also be obtained according to these attached drawings.
Fig. 1 is a kind of schematic flow diagram of communication means based on audio interface provided in an embodiment of the present invention;
Fig. 2 is a kind of schematic diagram of square-wave signal provided in an embodiment of the present invention;
Fig. 3 is a kind of schematic diagram of process circuit provided in an embodiment of the present invention;
Fig. 4 is that the embodiment of the present invention provides a kind of schematic flow diagram of square-wave signal generation method;
Fig. 5 A are a kind of schematic diagrames for square-wave signal that another embodiment of the present invention provides;
Fig. 5 B are a kind of schematic diagrames for square-wave signal that another embodiment of the present invention provides;
Fig. 6 is the schematic flow diagram for the communication means based on audio interface that another embodiment of the present invention provides;
Fig. 7 is that the embodiment of the present invention provides a kind of schematic flow diagram of coding/decoding method;
Fig. 8 is the schematic flow diagram for the communication means based on audio interface that another embodiment of the present invention provides;
Fig. 9 is that the embodiment of the present invention provides a kind of schematic flow diagram for the method for generating echo signal;
Figure 10 is the schematic flow diagram for the communication means based on audio interface that another embodiment of the present invention provides;
Figure 11 is that another embodiment of the present invention provides a kind of schematic flow diagram of coding/decoding method;
Figure 12 is a kind of schematic block diagram of communication equipment provided in an embodiment of the present invention;
Figure 13 is a kind of schematic block diagram for communication equipment that another embodiment of the present invention provides;
Figure 14 is a kind of schematic block diagram of terminal provided in an embodiment of the present invention;
Figure 15 is a kind of terminal schematic block diagram that another embodiment of the present invention provides;
Figure 16 is a kind of terminal schematic block diagram that another embodiment of the present invention provides;
Figure 17 is a kind of schematic block diagram for communication equipment that another embodiment of the present invention provides.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is part of the embodiment of the present invention, instead of all the embodiments.Based on this hair Embodiment in bright, the every other implementation that those of ordinary skill in the art are obtained without making creative work Example, belongs to the scope of protection of the invention.
It should be appreciated that ought use in this specification and in the appended claims, term " comprising " and "comprising" instruction Described feature, entirety, step, operation, the presence of element and/or component, but it is not precluded from one or more of the other feature, whole Body, step, operation, element, component and/or its presence or addition gathered.
It is also understood that the term used in this description of the invention is merely for the sake of the mesh for describing specific embodiment And be not intended to limit the present invention.As description of the invention and it is used in the attached claims, unless on Other situations are hereafter clearly indicated, otherwise " one " of singulative, "one" and "the" are intended to include plural form.
It will be further appreciated that the term "and/or" used in description of the invention and the appended claims is Refer to any combinations and all possible combinations of one or more of the associated item listed, and including these combinations.
As used in this specification and in the appended claims, term " if " can be according to context quilt Be construed to " when ... " or " once " or " in response to determining " or " in response to detecting ".Similarly, phrase " if it is determined that " or " if detecting [described condition or event] " can be interpreted to mean according to context " once it is determined that " or " in response to true It is fixed " or " once detecting [described condition or event] " or " in response to detecting [described condition or event] ".
Referring to Fig. 1, it is that the embodiment of the present invention provides a kind of schematic flow diagram of the communication means based on audio interface, such as schemes Shown in 1, this method may include:
101st, the first data are obtained, above-mentioned first data are to treat the binary data sent to terminal;
Target device obtains the first data.Above-mentioned target device is such as microcontroller of the equipment comprising microcontroller, and can be with It is communicated by audio interface with terminal such as mobile phone.Above-mentioned terminal can be mobile phone, tablet computer, personal digital assistant and Other equipment that can be communicated by audio interface with target device.Audio interface refers to audio input output interface, can Output and input audio signal, such as earphone interface.Above-mentioned the first data of acquisition can obtain above-mentioned target device to treat to above-mentioned After the target data that terminal is sent, above-mentioned target data is converted into binary data, i.e., above-mentioned first data.
Above-mentioned first data can include start bit, data bit, cyclic redundancy check position, parity bit and knot successively The corresponding binary coding in beam position.Above-mentioned start bit can be fixed several, and comprising 1 and 0, such as:1010.Above-mentioned data bit Multiple bytes can be occupied, each byte corresponds to 8 bits.Above-mentioned cyclic redundancy check position is followed for above-mentioned data bit is corresponding Ring redundancy check code can occupy 1 byte.Above-mentioned odd even effect position corresponds to for start bit+data bit+cyclic redundancy check position Odd even effect position, a bit can be occupied.If 1 number that start bit+data bit+cyclic redundancy check position is included is If even number, parity check bit 0;Otherwise, parity check bit 1.Above-mentioned stop bits can be fixed several, and such as 0101. Comprising cyclic redundancy check position in above-mentioned first data, the correct of data bit may further ensure that.
102nd, the corresponding square wave of above-mentioned first data is generated;Each 1 in above-mentioned first data correspond to N number of high level when The square wave of a length of first duration, each 0 in above-mentioned first data correspond to M high level when a length of second duration square wave; Wherein, above-mentioned high level when a length of first duration square wave frequency for first frequency, above-mentioned high level when a length of second The frequency of the square wave of duration is second frequency;Above-mentioned first frequency and above-mentioned second frequency not less than 500 hertz and are not more than 6000 hertz;
Each square wave can correspond to a high level and a low level, and the duration of high level can with low level duration With identical.The duration that the corresponding signal of each binary numeral occupies in above-mentioned first data can be equal.For example, two into The duration of 0 and 1 corresponding signal of numerical value processed is 3 milliseconds.The corresponding square wave of above-mentioned above-mentioned first data of generation can be successively Generate the square-wave signal corresponding to the binary numeral that above-mentioned first data include.For example, the first data are 101000110101, target device can generate 101000110101 corresponding square-wave signals from left to right successively.Citing comes again Say, first frequency f1 is 2000HZ, and second frequency f2 is 1000HZ, a length of (1000000/f1)/2 when first) (us), i.e., 250us, a length of (1000000/f2)/2 when second) (us), i.e. 500us, binary numeral 1 correspond to 6 high level when it is a length of The square wave of first duration, binary numeral 0 correspond to 3 high level when a length of second duration square wave, the height electricity of each square wave It is flat equal with low level duration, and high level is before low level.It is appreciated that above-mentioned first frequency and above-mentioned first duration Corresponding, above-mentioned second frequency is corresponding with above-mentioned second duration.
It is assumed that the duration T of the corresponding signal of a binary numeral is 3000us, first frequency f1 is 2000HZ, and second frequently Rate f2 is 1000HZ, then T*f1 first party wave table shows binary numeral 1, and T*f2 second party wave table shows binary numeral 0, the When a length of (1000000/f1)/2 of the high level of one square wave) (us), i.e. 250us, the high level of the second square wave when it is a length of (1000000/f2)/2) (us), i.e. 500us.As shown in Fig. 2, being 101 corresponding square wave of binary coding in figure, included in figure Two kinds of square waves, a kind of square wave for first frequency occupy shorter for example left first square wave of number of square wave of duration, another kind is the The square wave of two frequencies occupies longer square wave the 7th square wave of for example left number of duration, it can be seen that the side of 6 continuous first frequencies Wave table shows that the square wave of the continuous second frequency of binary numeral 1,3 represents binary numeral 0.
In practical applications, target device carries out timing using timer, in each timing cycle output respective frequencies Square wave.It is assumed that timing cycle is 3000us, target device is 1 in the binary numeral that current timing cycle is sent, then exports two The square wave of 1 corresponding frequency of binary value;After the timing length of timer reaches 3000us, export needed for next timing cycle The corresponding frequency of binary numeral of transmission.
103rd, the corresponding square wave of above-mentioned first data is sent to above-mentioned terminal by audio interface.
Above-mentioned target device is communicated with above-mentioned terminal by audio interface.In practical applications, above-mentioned target device It can be attached with above-mentioned terminal by data cable, the audio interface of one end linking objective equipment of the data cable, the other end Connect the audio interface of terminal.
In the embodiment of the present invention, N number of high level when a length of first duration square wave represent binary numeral 1, it is M high electric The square wave of a length of second duration represents binary numeral 0 when flat, by reasonably setting the first duration and the second duration relation And size, the success rate to communicate between target device and terminal by audio interface can be improved, and solves terminal The problem of audio interface compatibility is poor.
In an optional implementation manner, the summation of N number of above-mentioned first duration and the summation phase of M above-mentioned second durations It is less than 2 milliseconds Deng, N number of above-mentioned first duration;Above-mentioned first frequency is K times of above-mentioned second frequency, and above-mentioned K is not less than 2;It is above-mentioned First frequency and above-mentioned second frequency are not less than 1000 hertz and no more than 4000 hertz, above by audio interface to above-mentioned Terminal, which sends the corresponding square wave of above-mentioned first data, to be included:
After rectification and enhanced processing is carried out to the corresponding square wave of above-mentioned first data, by above-mentioned audio interface to above-mentioned Terminal output treated the corresponding square wave of above-mentioned first data.
Above-mentioned K can be 2,3,4 etc..Above-mentioned first frequency and above-mentioned second frequency not less than 1000 hertz and are not more than 4000 hertz can ensure that target device is correct, rapidly encode.Above-mentioned first frequency can be the integral multiple of above-mentioned second frequency, Such as 2 times.It can so cause the efficiency of encoding and decoding and accuracy higher.In the embodiment of the present invention, the square wave of upper frequency can be with One in corresponding binary numeral 0 and 1, another is corresponding with the square wave of lower frequency.In the embodiment of the present invention, N is limited A above-mentioned first duration is less than 2 milliseconds, it is ensured that the speed of the generation square wave of target device, and then ensure transmission speed Rate.Above-mentioned N and above-mentioned M are all higher than 2.The square wave received due to terminal may lose 1 to 2, it is therefore desirable to ensure every The corresponding square wave number of a binary numeral is all higher than 2.
Rectification is carried out to the corresponding square wave of above-mentioned first data and enhanced processing can be to the square wave of signal generator generation It is further processed, in order to which terminal is correctly received.As shown in figure 3, the input terminal of signal generator 301 and process circuit 302 3021 are connected, and the output terminal 3022 of process circuit 302 connects audio interface 303, and process circuit 302 generates signal generator Square wave carries out rectification and amplification, and is output to audio interface.
In the embodiment of the present invention, by the relation, size and binary numeral pair that set first frequency and second frequency The duration for the signal answered can improve the efficiency and accuracy of target device coding.
Optionally, the corresponding square wave of above-mentioned first data of above-mentioned generation includes:
After the timing length of timer reaches target duration, the counts of counter add one, above-mentioned first duration pair E counts are answered, above-mentioned second duration corresponds to F counts;
In the case where the binary numeral for determining current desired transmission is 1, judging the counts of above-mentioned counter is It is no to be less than E;If so, above-mentioned audio interface output high level, otherwise, judges whether the counts of above-mentioned counter are equal to E; If so, above-mentioned audio interface output low level, otherwise, judges whether the counts of above-mentioned counter divide exactly 2*E;If so, Then above-mentioned audio interface output high level, otherwise, judges whether the counts of above-mentioned counter divide exactly 2*E after subtracting E;If It is, then above-mentioned audio interface output low level otherwise, to judge whether the counts of above-mentioned counter are equal to 2N*E;On if so, The counts clearing of counter and above-mentioned audio interface output low level are stated, otherwise, the counts of above-mentioned counter add one;
In the case where the binary numeral for determining current desired transmission is 0, judging the counts of above-mentioned counter is It is no to be less than F;If so, above-mentioned audio interface output high level, otherwise, judges whether the counts of above-mentioned counter are equal to F; If so, above-mentioned audio interface output low level, otherwise, judges whether the counts of above-mentioned counter divide exactly 2*F;If so, Then above-mentioned audio interface output high level, otherwise, judges whether the counts of above-mentioned counter divide exactly 2*F after subtracting F;If It is, then above-mentioned audio interface output low level otherwise, to judge whether the counts of above-mentioned counter are equal to 2M*F;On if so, The counts clearing of counter and above-mentioned audio interface output low level are stated, otherwise, the counts of above-mentioned counter add one.
Above-mentioned target duration can be 2000us, 2500us, 3000us etc..It is above-mentioned timer reach target duration after, After the counts of counter add the timing duration that one can be above-mentioned timer to reach above-mentioned target duration, the counting of counter Number adds one, and the timing duration of above-mentioned timer is reset, and re-starts timing.It is appreciated that above-mentioned counter is every above-mentioned mesh Mark duration counts add one.
It is that the embodiment of the present invention provides a kind of schematic flow diagram of square-wave signal generation method referring to Fig. 4, as shown in figure 4, This method may include:
401st, the timing duration of timer reaches target duration;
402nd, counts add one;
Whether the binary numeral for the 403rd, judging to send is 1;
If so, 404 are performed, if it is not, performing 414.
404th, judge whether the counts of above-mentioned counter are less than E;
If so, 405 are performed, if it is not, performing 406.Wherein, E is the corresponding counting number of the first duration.A length of when first The duration of the high level of the square wave of one frequency.One binary numeral corresponds to the square wave of N number of first frequency.
405th, high level is exported;
406th, judge whether the counts of above-mentioned counter are equal to E;
If so, 407 are performed, if it is not, performing 408.
407th, low level is exported;
408th, judge whether the counts of above-mentioned counter divide exactly 2*E;
If so, 409 are performed, if it is not, performing 410.
409th, high level is exported;
410th, judge whether the counts of above-mentioned counter divide exactly 2*E after subtracting E;
If so, 411 are performed, if it is not, performing 412.
411st, low level is exported;
412nd, judge whether the counts of above-mentioned counter are equal to 2N*E;
If so, 413 are performed, if it is not, performing 401.
413rd, the counts of above-mentioned counter are reset and above-mentioned audio interface exports low level;
414th, judge whether the counts of above-mentioned counter are less than F;
If so, 415 are performed, if it is not, performing 416.Wherein, F is the corresponding counting number of the second duration.A length of when second The duration of the high level of the square wave of two frequencies.One binary numeral corresponds to the square wave of M second frequency.
415th, high level is exported;
416th, judge whether the counts of above-mentioned counter are equal to F;
If so, 417 are performed, if it is not, performing 418.
417th, low level is exported;
418th, judge whether the counts of above-mentioned counter divide exactly 2*F;
If so, 419 are performed, if it is not, performing 420.
419th, high level is exported;
420th, judge whether the counts of above-mentioned counter divide exactly 2*F after subtracting F;
If so, 421 are performed, if it is not, performing 422.
421st, low level is exported;
422nd, judge whether the counts of above-mentioned counter are equal to 2M*F;
If so, 423 are performed, if it is not, performing 401.
423rd, the counts of above-mentioned counter are reset and above-mentioned audio interface exports low level.
For example, the duration of T=3200uS, f1=2500HZ, f2=1250HZ, position " 1 " and " 0 " corresponding square wave is equal For T, as shown in Figure 5A, binary numeral 1 corresponds to the square wave of 8 f1 frequencies, and binary numeral 0 corresponds to the square wave of 4 f2 frequencies. It is assumed that a length of 50us during target, the high level of the square wave of a f1 frequency corresponds to 4 counts;As shown in Figure 5 B, count secondary When number is less than 4, high level is exported;When counts are equal to 4, low level is exported;Counts be equal to 8,16,24,32,40,48, When 56, high level is exported, i.e., when counts can be divided exactly by 8, exports high level;Counts be equal to 12,20,28,36,44, 52nd, 60 when, export low level, i.e. counts subtract 4, when can be divided exactly by 8, output low level;When counts are equal to 64, position " 1 " output is completed.When counts are not 4 multiple, the level of output remains unchanged.Similarly, the corresponding side of carry-out bit " 0 " The step of ripple, is similar with position " 1 ".
In the embodiment of the present invention, the corresponding signal of the first data can be quickly and accurately generated.
Referring to Fig. 6, it is that the embodiment of the present invention provides a kind of schematic flow diagram of the communication means based on audio interface, such as schemes Shown in 6, this method may include:
601st, by audio interface reception come the echo signal of self terminal;
As shown in Fig. 2, the echo signal that target device receives is square-wave signal.It is multiple continuous in above-mentioned echo signal The square wave of first frequency corresponds to binary numeral 1, and the square wave of multiple continuous second frequencies corresponds to binary numeral 0.Citing comes It says, T=3000uS, f1=2000HZ, f2=1000HZ, the duration of position " 1 " and position " 0 " corresponding square wave is T, i.e. binary system The duration of 1 and 0 corresponding signal of numerical value is T, and binary numeral 1 corresponds to the number of the square wave of f1 frequencies as f1*T, i.e., 6 A, binary numeral 0 corresponds to the number of the square wave of f2 frequencies as f2*T, i.e., 3.
602nd, the corresponding Q duration of Q high level that above-mentioned echo signal includes is determined, during R in above-mentioned Q duration A length of first duration, a length of second duration at W, the duration of the high level of the square wave of a length of first frequency when above-mentioned first, on State the duration of the high level of the square wave of a length of second frequency when second;Above-mentioned first frequency and above-mentioned second frequency are not less than 500 hertz and no more than 6000 hertz;
The above-mentioned corresponding Q duration of Q high level for determining that above-mentioned echo signal includes can be determined by timer The duration of the corresponding Q high level of echo signal.In the embodiment of the present invention, target device can determine target in several ways The duration of the corresponding high level of signal, and stored, the present invention implements to be not construed as limiting.Above-mentioned R and above-mentioned W sums are equal to Above-mentioned Q.For example, echo signal includes 64 high level correspond to 64 durations, wherein, a length of first duration at 24, A length of second duration at 40.
603rd, the corresponding binary data of above-mentioned echo signal is determined according to above-mentioned Q duration, in above-mentioned binary data Each 1 correspond to N number of high level when a length of above-mentioned first duration square wave, each 0 in above-mentioned binary data corresponds to M High level when a length of above-mentioned second duration square wave.
As shown in Fig. 2, binary numeral 1 corresponds to the square wave of 6 f1 frequencies, binary numeral 0 corresponds to the side of 3 f2 frequencies Ripple;A length of first duration during the high level of the square wave of one f1 frequency, a length of second during the high level of the square wave of a f2 frequency Duration.It is above-mentioned to determine that the corresponding binary data of above-mentioned echo signal be to determine N number of continuous according to above-mentioned Q duration One duration corresponds to a binary numeral 1, determines that the corresponding binary numeral of continuous second durations of M is 0.The present invention In embodiment, above-mentioned first frequency and above-mentioned second frequency are not less than 500 hertz and no more than 6000 hertz, it is ensured that mesh It the decoding speed of marking device and is correctly decoded.It is assumed that 1 represents the first duration, 0 represents the second duration, and binary numeral 1 corresponds to 6 A first duration, binary numeral 0 correspond to 3 the second durations, and 18 durations that echo signal includes can be expressed as 111111000000111111, then the corresponding binary data of echo signal is 1001.
In the embodiment of the present invention, the duration according to the corresponding high level of echo signal determines the corresponding number of the echo signal According to realization is simple, and decoding speed is fast.
In an optional implementation manner, it is above-mentioned according to above-mentioned Q duration determine above-mentioned echo signal corresponding two into Data processed include:
Judge whether the l-th duration in above-mentioned Q duration is less than time threshold;
If so, corresponding first count value of above-mentioned first frequency adds one, otherwise, corresponding second meter of above-mentioned second frequency Numerical value adds one;
When in above-mentioned l-th a length of above-mentioned first during the L-1 in a length of above-mentioned second duration and above-mentioned Q duration In the case of length, judge above-mentioned first count value whether not less than N-2 and less than N;If so, before determining above-mentioned l-th duration The nearest corresponding binary numeral of above-mentioned first count value duration is 1, and above-mentioned binary numeral 1 is stored corresponding solution In code data, above-mentioned first count value is reset, and above-mentioned second count value is added one;If it is not, judge above-mentioned first count value Whether N is more than or equal to;If so, above-mentioned first count value duration nearest before determining above-mentioned l-th duration corresponds to The first count value divided by N number of binary numeral 1 are stated, above-mentioned first count value divided by N number of binary numeral 1 are stored corresponding In decoding data, above-mentioned first count value is reset, and above-mentioned second count value is added one;
When in above-mentioned l-th a length of above-mentioned second during the L-1 in a length of above-mentioned first duration and above-mentioned Q duration In the case of length, judge above-mentioned second count value whether not less than M-2 and less than M;If so, before determining above-mentioned l-th duration The nearest corresponding binary numeral of above-mentioned second count value duration is 0, and above-mentioned binary numeral 0 is stored corresponding solution In code data, above-mentioned second count value is reset, and above-mentioned first count value is added one;If it is not, judge above-mentioned second count value Whether M is more than or equal to;If so, above-mentioned second count value duration nearest before determining above-mentioned l-th duration corresponds to The second count value divided by M binary numeral 0 are stated, above-mentioned second count value divided by M binary numeral 0 are stored corresponding In decoding data, above-mentioned second count value is reset, and above-mentioned first count value is added one.
Above-mentioned time threshold can be more than above-mentioned first duration and less than the threshold value of above-mentioned second duration, when above-mentioned first It is long to be less than above-mentioned second duration.Above-mentioned time threshold can be pre-set or by the first duration and the second duration Definite.Optionally, after above-mentioned first duration of above-mentioned second duration more than 1.5 times is determined, above-mentioned time threshold can be set It is set to 1.5 times of above-mentioned first duration.
Fig. 7 embodiment of the present invention provides a kind of schematic flow diagram of coding/decoding method, as shown in fig. 7, this method may include:
701st, the corresponding W high level duration of echo signal is determined by timer, and is recorded, obtain target note Record;
Above-mentioned target record is the record of the corresponding W high level duration of above-mentioned echo signal.
702nd, judge whether objective count value R is W;
Above-mentioned objective count value R is the number of current processed high level duration.If so, 703 are performed, if it is not, performing 718。
703rd, judge whether the R high level duration in above-mentioned target record is less than time threshold;
If so, 704 are performed, if it is not, performing 711.
704th, the first count value is added one, judges above-mentioned first count value whether not less than N-2 and less than N;
N number of continuous first duration corresponds to a binary numeral in above-mentioned target record.Above-mentioned first count value is the The corresponding count value of one duration.If so, 705 are performed, if it is not, performing 708.
705th, the number for determining binary numeral 1 is 1;
706th, by the corresponding decoding data of 1 deposit;
707th, above-mentioned first count value is reset, the second count value is added one, above-mentioned R is added one;
Above-mentioned second count value is the corresponding count value of the second duration.M continuous second durations in above-mentioned target record A corresponding binary numeral.
708th, judge whether above-mentioned first count value is greater than or equal to N;
If so, 709 are performed, if it is not, performing 710.
709th, the number for determining binary numeral 1 is above-mentioned first count value divided by N;
710th, determine decoding error, decode again;
711st, above-mentioned second count value is added one, judges above-mentioned second count value whether not less than M-2 and less than M;
If so, 712 are performed, if it is not, performing 715.
712nd, the number for determining binary numeral 0 is 1;
713rd, by the corresponding decoding data of 0 deposit;
714th, above-mentioned second count value is reset, and the first count value adds one, above-mentioned R is added one;
715th, judge whether above-mentioned second count value is greater than or equal to M;
If so, 716 are performed, if it is not, performing 717.
716th, the number for determining binary numeral 0 is above-mentioned second count value divided by M;
717th, determine decoding error, decode again;
718th, decoding terminates.
The embodiment of the present invention is by obtaining the record of the corresponding high level duration of echo signal, the note according to high level duration Record is decoded, and realizes that simply, decoding is accurate.
In an optional implementation manner, above-mentioned first frequency is K times of above-mentioned second frequency, and above-mentioned K is not less than 2, Above-mentioned first frequency and above-mentioned second frequency are not less than 1000 hertz and no more than 4000 hertz, when above-mentioned judgement is Q above-mentioned Whether the l-th duration in length is less than before time threshold, and the above method further includes:
Above-mentioned second duration divided by above-mentioned first duration obtain target multiple, when above-mentioned second duration is more than above-mentioned first It is long;
It is the result being multiplied no more than above-mentioned first duration with above-mentioned target multiple to set above-mentioned time threshold.
For example, target device statistics second when 1.5 times of a length of first duration, then time threshold is arranged to 1.5 The first duration again.It is appreciated that in the embodiment of the present invention, time threshold can be set adaptively, in order to correctly connect Receive different types of signal.For example, when target device receives the first signal, time threshold is 2 milliseconds;Target device receives During secondary signal, time threshold is 3 milliseconds.
Target device of the embodiment of the present invention is by being set adaptively time threshold, it is ensured that target device correctly solves The signal that the different terminal of code is sent improves the compatibility of target device.
It is that the embodiment of the present invention provides a kind of schematic flow diagram of coding method, as shown in figure 8, this method can referring to Fig. 8 Including:
801st, the second data are obtained, above-mentioned second data are to treat the binary data sent to target device, above-mentioned second Data are compiled successively comprising start bit, data bit, cyclic redundancy check position, parity bit and the corresponding binary system of stop bits Code;
802nd, the corresponding echo signal of above-mentioned second data is generated by signal generator, it is each in above-mentioned second data 1 corresponds to the sine wave or cosine wave that N number of continuous frequency is first frequency, each 0 in above-mentioned second data correspond to M it is continuous Frequency be second frequency sine wave or cosine wave, above-mentioned echo signal include the corresponding sine wave or remaining of above-mentioned second data String ripple, above-mentioned first frequency are K times of above-mentioned second frequency, and above-mentioned K is not less than 2, and above-mentioned N number of continuous frequency is first frequency Sine wave or the duration of cosine wave be less than 4 milliseconds, above-mentioned first frequency and above-mentioned second frequency are not less than 500 hertz and not More than 6000 hertz;
For example, first frequency is 2 times of second frequency, and the sine wave of 6 continuous first frequencies represents binary system The sine wave of the continuous second frequency of numerical value 1,3 represents binary numeral 0.Above-mentioned N number of continuous frequency is first frequency The duration of sine wave or cosine wave is equal for the sine wave of second frequency or the duration of cosine wave with above-mentioned M continuous frequencies. It is appreciated that the duration of the corresponding signal of each binary numeral is equal.In the embodiment of the present invention, N number of continuous frequency is limited For first frequency sine wave or cosine wave duration be less than 4 milliseconds and limit above-mentioned first frequency and above-mentioned second frequency it is equal Not less than 500 hertz and no more than 6000 hertz, it is ensured that terminal generates the speed of echo signal, and ensures coding Correctly.
803rd, above-mentioned echo signal is sent to above-mentioned target device by audio interface.
Binary numeral in second data is decoded as the sine wave or remaining of different frequency and number by the embodiment of the present invention String ripple, and generate corresponding echo signal and sent to terminal, realize that simply code efficiency is higher.
In an optional implementation manner, above-mentioned N number of continuous frequency is the sine wave or cosine wave of first frequency Duration and above-mentioned M continuous frequencies are equal for the sine wave of second frequency or the duration of cosine wave, above-mentioned first frequency and upper Second frequency is stated not less than 1000 hertz and no more than 4000 hertz, is sent above by audio interface to above-mentioned target device Above-mentioned echo signal includes:
It is defeated to above-mentioned target device by above-mentioned audio interface after rectification and enhanced processing is carried out to above-mentioned echo signal The above-mentioned echo signal that goes out that treated.
Above-mentioned first frequency and above-mentioned second frequency are the frequency ranges determined by a large amount of statistics, by above-mentioned first Frequency and above-mentioned second frequency are limited to 1000 hertz to 4000 hertz of scope, can take into account code efficiency, coding accuracy rate, And ensure that the relatively low target device of decoding speed can decode exactly.Rectification and enhanced processing are carried out to above-mentioned echo signal, Echo signal can be further processed, improve the probability that target device is correctly decoded.
It is that the embodiment of the present invention provides a kind of schematic flow diagram for the method for generating echo signal, such as Fig. 9 institutes referring to Fig. 9 Show, this method may include:
901st, the sine wave of the sine wave of sinusoidal signal generator generation first frequency and second frequency;
902nd, judge whether currently transmitted binary numeral is 1;
If so, 903 are performed, if it is not, performing 904.
903rd, the sine wave of N number of first frequency is continuously transmitted;
904th, the sine wave of M second frequency is continuously transmitted.
Binary numeral in second data is decoded as the sine wave or remaining of different frequency and number by the embodiment of the present invention String ripple, and generate corresponding echo signal and sent to target device, realize that simply code efficiency is higher.
It is accurate can to take into account code efficiency, coding by limiting the scope of first frequency and second frequency for the embodiment of the present invention True rate, and ensure that the relatively low target device of decoding speed can decode exactly.
It is that another embodiment of the present invention provides a kind of schematic flow diagram of coding method referring to Figure 10, it as shown in Figure 10, should Method may include:
1001st, the echo signal of target device transmission is received by audio interface, above-mentioned echo signal is sampled, is obtained To G sampled data;
Above-mentioned echo signal is square-wave signal.The echo signal that terminal receives according to coding as shown in Fig. 2, provide, number Can be Y=4+8*X+8+1+1 according to middle position " 1 " and " 0 " sum, wherein, first four are start bit, are data behind start bit , it is cyclic redundancy check position behind data bit, is parity check bit behind cyclic redundancy check position, last position is end Position, and the duration of every is all T.Terminal sample frequency could be provided as:F=44100 (HZ), then acquisition T durations data need The number wanted:Z=T/ (1000000/44100), because T<=4000, so Z<=176.4, therefore 256 points of (deficiencies can be selected Benefit 0) FFT transform decoding, according to the amplitude versus frequency characte of FFT, corresponding frequency values (F/256) the * Q of maximum Q points are in 256 points Current frequency, the corresponding point Q_f1=f1/ (F/256) of position " 1 " frequency f1, the corresponding point Q_f2=f2/ (F/ of position " 0 " frequency f2 256).A caching f_buff [Z*Y*2] is opened up in terminal, sampled data is stored in and is cached.Optionally, hits is being got It can be by the way that threshold value be set to filter useless data after.
1002nd, the number of the sampled data of current desired acquisition is determined according to data list after F, to obtain F hits According to above-mentioned F sampled data is the data in above-mentioned G sampled data, and above-mentioned data list includes H numerical value, above-mentioned H number It is worth for the number of sampled data to be chosen;
Above-mentioned F sampled data is the data needed for FFT of progress.For example, FFT is carried out using 256 points, then Obtain 256 sampled datas.The numerical value of foremost is to be calculated using formula Z=T/ (1000000/f) in above-mentioned data list Sampled data number, wherein, T is the corresponding duration of a binary numeral, is ascended the throne " 1 " or position " 0 " corresponding duration, f For sample frequency.Data in data list are to be no more than with value of the Z heights without departing from 20, the number K of list member 40。
1003rd, Fast Fourier Transform (FFT) FFT is carried out to above-mentioned F sampled data, obtains result of calculation, above-mentioned result of calculation The information of the corresponding frequency of above-mentioned F sampled data is included, above-mentioned F sampled data corresponds to first frequency or second frequency;
The initial position of useful data is found in the buffer.G data is taken to carry out FFT transform since initial position, by Q =Q_f1 or Q=Q_f1 ± 1 solve position " 1 ", solve position " 0 " by Q=Q_f2 or Q=Q_f2 ± 1, Xun Huan takes multiple data to carry out FFT solves all positions " 1 " and " 0 ".
Since the impedance of the microphone of different terminals is different, in gathered data, fraction data may be lost, are caused The initial position of sampled data is different.In order to be compatible with most of terminal, the number of sampled data cannot fix.The embodiment of the present invention In, a preset data list Z_buff [K] in terminal, the numerical value of each list member and the number F of sampled data width up and down Degree comes foremost no more than 20, F, and list member number K is no more than 40.During decoding, cycle the value from list and assign G, then All positions " 1 " and " 0 " are solved, judges whether odd even effect position is correct, correctly then decoding terminates, incorrect, continues cycling through.
The 1004th, if the corresponding frequency of above-mentioned F sampled data is above-mentioned first frequency, it is determined that above-mentioned F sampled data Corresponding binary numeral is 1;Otherwise, it determines the corresponding binary numeral of above-mentioned F sampled data is 0.
The corresponding frequency of above-mentioned F sampled data can be first frequency pair in above-mentioned result of calculation for above-mentioned first frequency The point or the value of the consecutive points of the corresponding point of an above-mentioned frequency answered are maximum.The corresponding frequency of above-mentioned F sampled data is above-mentioned the Two frequencies can be the value of the consecutive points of the corresponding point of second frequency or the corresponding point of above-mentioned two frequency in above-mentioned result of calculation most Greatly.
In the embodiment of the present invention, terminal adjusts the number of the sampled data needed for FFT decodings as needed, realizes simply, It is compatible preferable.
In an optional implementation manner, if the corresponding frequency of above-mentioned F sampled data is above-mentioned first frequency, It is 1 then to determine the corresponding binary numeral of above-mentioned F sampled data;Otherwise, it determines the corresponding binary system of above-mentioned F sampled data After numerical value is 0, the above method further includes:
After determining to complete decoding, odd-even check is carried out to obtained target code, above-mentioned target code includes successively Beginning position, data bit, cyclic redundancy check position, parity bit and the corresponding coding of stop bits;
In the case where determining above-mentioned target code mistake according to the result of odd-even check, obtained from above-mentioned data list Desired value, above-mentioned desired value is located in above-mentioned data list and the number of the sampled data with obtaining recently is adjacent;
A binary numeral is determined according to above-mentioned desired value sampled data.
Numerical value in above-mentioned data list has certain order.For example, data list include 10 numerical value, i.e., 256 To 265, terminal can obtain this 10 numerical value successively, when the target code decoding error obtained using 257 sampled datas, 258 sampled datas are obtained to be decoded.
In the embodiment of the present invention, after decoding error, the number of the sampled data of adjustment FFT institutes foundation decodes again, can To improve decoded accuracy rate.
In an optional implementation manner, above-mentioned first frequency is K times of above-mentioned second frequency, and above-mentioned K is not less than 2, Above-mentioned N number of continuous frequency is less than 4 milliseconds for the sine wave of first frequency or the duration of cosine wave, above-mentioned first frequency and above-mentioned Second frequency is not less than 500 hertz and no more than 6000 hertz.
Optionally, above-mentioned first frequency and above-mentioned second frequency are not less than 1000 hertz and no more than 4000 hertz.
It is accurate can to take into account decoding efficiency, decoding by limiting the scope of first frequency and second frequency for the embodiment of the present invention True rate.
It is that another embodiment of the present invention provides a kind of schematic flow diagram of coding/decoding method referring to Figure 11, it as shown in figure 11, should Method may include:
1101st, echo signal is sampled, obtains G sampled data;
1102nd, above-mentioned G sampled data is stored;
1103rd, value is put from the first place of data list, is assigned to Z;
1104th, judge whether K value in data list was taken;
If it is not, 1105 are performed, if so, performing 1110.K value in above-mentioned data list is sampled data to be chosen Number.
1105th, Z sampled data is obtained, carries out FFT, the corresponding Q points of determining maximum;Judge whether to take Y sampling Data;
If so, 1111 are performed, if it is not, performing 1106.Above-mentioned Y is the corresponding binary numeral of above-mentioned G sampled data Number.
1106th, judge whether Q is equal to Q_f1 or Q_f1 ± 1;
Q_f1 be the corresponding point of first frequency, i.e. Q_f1=f1/ (F/256).F is sample frequency, and f1 is first frequency. 256 be the number of the sampled point of FFT.If so, 1107 are performed, if it is not, performing 1108.
1107th, position " 1 " is solved, is stored in decoding data;
1108th, judge whether Q is equal to Q_f2 or Q_f2 ± 1;
Q_f2 be the corresponding point of second frequency, i.e. Q_f2=f2/ (F/256).F is sample frequency, and f2 is second frequency. 256 be the number of the sampled point of FFT.If so, 1109 are performed, if it is not, performing 1110.
1109th, position " 0 " is solved, is stored in decoding data;
1110th, determine decoding error, decode again;
1111st, judge whether even-odd check is correct;
If so, perform 1112;If it is not, perform 1103.
1112nd, determine that decoding is correct, terminate decoding.
In the embodiment of the present invention, terminal adjusts the number of the sampled data needed for FFT decodings as needed, realizes simply, It is compatible preferable.
The embodiment of the present invention also provides a kind of communication equipment, which is used to perform any one of foregoing above-mentioned side Method.Specifically, referring to Figure 12, which includes:
Acquiring unit 1201, for obtaining the first data, above-mentioned first data are to treat the binary data sent to terminal;
Generation unit 1202, for generating the corresponding square wave of above-mentioned first data;Each 1 in above-mentioned first data corresponds to N number of high level when a length of first duration square wave, each 0 in above-mentioned first data correspond to M high level when a length of the The square wave of two durations;Wherein, above-mentioned high level when a length of first duration square wave frequency for first frequency, above-mentioned high level When a length of second duration square wave frequency be second frequency;Above-mentioned first frequency and above-mentioned second frequency are not less than 500 Hertz and no more than 6000 hertz;
Transmitting element 1203 sends the corresponding square wave of above-mentioned first data for passing through audio interface to above-mentioned terminal.
Concrete methods of realizing is identical with the method in Fig. 1, is not described herein in detail.
Optionally, the summation of the summation of N number of above-mentioned first duration and M above-mentioned second durations is equal, when N number of above-mentioned first It is long to be less than 2 milliseconds;Above-mentioned first frequency is K times of above-mentioned second frequency, and above-mentioned K is not less than 2;Above-mentioned first frequency and above-mentioned Two frequencies are not less than 1000 hertz and no more than 4000 hertz, and as shown in figure 12, above-mentioned communication equipment further includes:Processing unit 1204, for carrying out rectification and enhanced processing to the corresponding square wave of above-mentioned first data;
Above-mentioned transmitting element 1203, specifically for treated above-mentioned the to the output of above-mentioned terminal by above-mentioned audio interface The corresponding square wave of one data.
In the embodiment of the present invention, by the relation, size and binary numeral pair that set first frequency and second frequency The duration for the signal answered can improve the efficiency and accuracy of target device coding.
Optionally, above-mentioned generation unit 1202, specifically for after timer reaches target duration, the counting of counter is secondary Number plus one, above-mentioned first duration corresponds to E counts, and above-mentioned second duration corresponds to F counts;Definite current desired In the case that the binary numeral of transmission is 1, judge whether the counts of above-mentioned counter are less than E;If so, above-mentioned audio Interface exports high level, otherwise, judges whether the counts of above-mentioned counter are equal to E;If so, above-mentioned audio interface output Otherwise low level, judges whether the counts of above-mentioned counter divide exactly 2*E;If so, above-mentioned audio interface exports low electricity It is flat, otherwise, judge whether the counts of above-mentioned counter divide exactly 2*E after subtracting E;If so, above-mentioned audio interface output is high Otherwise level, judges whether the counts of above-mentioned counter are equal to 2N*E;If so, the counts of above-mentioned counter are reset And above-mentioned audio interface output low level, otherwise, the counts of above-mentioned counter add one;Determining the two of current desired transmission In the case that binary value is 0, judge whether the counts of above-mentioned counter are less than F;If so, input/output audio connects Otherwise mouth output high level, judges whether the counts of above-mentioned counter are equal to F;If so, above-mentioned audio interface output is low Otherwise level, judges whether the counts of above-mentioned counter divide exactly 2*F;If so, above-mentioned audio interface output low level, Otherwise, judge whether the counts of above-mentioned counter divide exactly 2*F after subtracting F;If so, the above-mentioned high electricity of audio interface output It is flat, otherwise, judge whether the counts of above-mentioned counter are equal to 2M*F;If so, above-mentioned counter counts reset and Above-mentioned audio interface exports low level, and otherwise, the counts of above-mentioned counter add one.
In the embodiment of the present invention, the corresponding signal of the first data can be quickly and accurately generated.
The embodiment of the present invention also provides another communication equipment, which is used to perform any one of foregoing above-mentioned side Method.Specifically, referring to Figure 13, which includes:
Receiving unit 1301, for receiving the echo signal come self terminal by audio interface;
Determination unit 1302, for determining the corresponding Q duration of Q high level that above-mentioned echo signal includes, above-mentioned Q A length of first duration during R in duration, a length of second duration at W, the height of the square wave of a length of first frequency when above-mentioned first The duration of level, the duration of the high level of the square wave of a length of second frequency when above-mentioned second;Above-mentioned first frequency and above-mentioned second Frequency is not less than 500 hertz and no more than 6000 hertz;According to above-mentioned Q duration determine above-mentioned echo signal corresponding two into Data processed, each 1 in above-mentioned binary data correspond to N number of high level when a length of above-mentioned first duration square wave, above-mentioned two Each 0 in binary data correspond to M high level when a length of above-mentioned second duration square wave.
Concrete methods of realizing is identical with the method in Fig. 6, is not described herein in detail.
Optionally, above-mentioned determination unit 1302, specifically for judging whether the l-th duration in above-mentioned Q duration is less than Time threshold;If so, corresponding first count value of above-mentioned first frequency adds one, and otherwise, above-mentioned second frequency corresponding second Count value adds one;In above-mentioned l-th a length of above-mentioned during the L-1 in a length of above-mentioned second duration and above-mentioned Q duration In the case of one duration, judge above-mentioned first count value whether not less than N-2 and less than N;If so, determine above-mentioned l-th duration The before nearest corresponding binary numeral of above-mentioned first count value duration is 1, and above-mentioned binary numeral 1 is stored correspondence Decoding data in, above-mentioned first count value is reset, and above-mentioned second count value is added one;If it is not, judge above-mentioned first meter Whether numerical value is more than or equal to N;If so, above-mentioned first count value duration pair nearest before determining above-mentioned l-th duration Above-mentioned first count value divided by N number of binary numeral 1 are answered, above-mentioned first count value divided by N number of binary numeral 1 are stored pair In the decoding data answered, above-mentioned first count value is reset, and above-mentioned second count value is added one;It is a length of in above-mentioned l-th During the L-1 in above-mentioned first duration and above-mentioned Q duration in the case of a length of above-mentioned second duration, above-mentioned second meter is judged Whether numerical value is not less than M-2 and less than M;If so, above-mentioned second count value duration nearest before determining above-mentioned l-th duration Corresponding binary numeral is 0, above-mentioned binary numeral 0 is stored in corresponding decoding data, by above-mentioned second count value It resets, and above-mentioned first count value is added one;If it is not, judging whether above-mentioned second count value is more than or equal to M;If so, really Nearest above-mentioned second count value duration corresponds to above-mentioned second count value divided by M binary system before fixed above-mentioned l-th duration Numerical value 0 stores above-mentioned second count value divided by M binary numeral 0 in corresponding decoding data, and above-mentioned second is counted Value is reset, and above-mentioned first count value is added one.
The embodiment of the present invention is by obtaining the record of the corresponding high level duration of echo signal, the note according to high level duration Record is decoded, and realizes that simply, decoding is accurate.
Optionally, above-mentioned first frequency is K times of above-mentioned second frequency, and above-mentioned K is not less than 2, above-mentioned first frequency and upper Second frequency is stated not less than 1000 hertz and no more than 4000 hertz, above-mentioned communication equipment further includes:
Arithmetic element 1303, for obtaining target multiple using above-mentioned second duration divided by above-mentioned first duration, above-mentioned Two durations are more than above-mentioned first duration;
Setting unit 1304 is no more than above-mentioned first duration and above-mentioned target multiple phase for setting above-mentioned time threshold The result multiplied.
Target device of the embodiment of the present invention is by being set adaptively time threshold, it is ensured that target device correctly solves The signal that the different terminal of code is sent improves the compatibility of target device.
The embodiment of the present invention also provides a kind of terminal, which is used to perform any one of foregoing above-mentioned method.Specifically, It is a kind of schematic block diagram of terminal provided in an embodiment of the present invention referring to Figure 14.The terminal of the present embodiment includes:Acquiring unit 1401, for obtaining the second data, above-mentioned second data are to treat the binary data sent to target device, above-mentioned second data Start bit, data bit, cyclic redundancy check position, parity bit and the corresponding binary coding of stop bits are included successively;
Generation unit 1402 generates the corresponding echo signal of above-mentioned second data for passing through signal generator, and above-mentioned Each 1 in two data corresponds to the sine wave or cosine wave that N number of continuous frequency is first frequency, every in above-mentioned second data A 0 corresponds to the sine wave or cosine wave that M continuous frequencies are second frequency, and above-mentioned echo signal includes above-mentioned second data pair The sine wave or cosine wave answered, above-mentioned first frequency are K times of above-mentioned second frequency, and above-mentioned K is above-mentioned N number of continuous not less than 2 Frequency is less than 4 milliseconds for the sine wave of first frequency or the duration of cosine wave, and above-mentioned first frequency and above-mentioned second frequency are not Less than 500 hertz and no more than 6000 hertz;
Transmitting element 1403 sends above-mentioned echo signal for passing through audio interface to above-mentioned target device.
Concrete methods of realizing is identical with the method in Fig. 8, is not described herein in detail.
Optionally, above-mentioned N number of continuous frequency is a continuous for the sine wave of first frequency or the duration of cosine wave and above-mentioned M Frequency for second frequency sine wave or cosine wave duration it is equal, above-mentioned first frequency and above-mentioned second frequency are not less than 1000 hertz and no more than 4000 hertz, above-mentioned terminal further includes:
Processing unit 1404, for carrying out rectification and enhanced processing to above-mentioned echo signal;
Above-mentioned transmitting element 1403, specifically for by above-mentioned audio interface to the output of above-mentioned target device on treated State echo signal.
It is accurate can to take into account code efficiency, coding by limiting the scope of first frequency and second frequency for the embodiment of the present invention True rate, and ensure that the relatively low target device of decoding speed can decode exactly.
The embodiment of the present invention also provides another terminal, which is used to perform any one of foregoing above-mentioned method.Specifically Ground is a kind of schematic block diagram of terminal provided in an embodiment of the present invention referring to Figure 15.The terminal of the present embodiment includes:
Receiving unit 1501, for receiving the echo signal of target device transmission by audio interface;
Sampling unit 1502 for being sampled to above-mentioned echo signal, obtains G sampled data;
Determination unit 1503 after the number of the sampled data of current desired acquisition is determined according to data list as F, obtains F sampled data is taken, above-mentioned F sampled data is the data in above-mentioned G sampled data, and above-mentioned data list includes H number Value, above-mentioned H numerical value is the number of sampled data to be chosen;
Converter unit 1504 for carrying out Fast Fourier Transform (FFT) FFT to above-mentioned F sampled data, obtains result of calculation, Above-mentioned result of calculation includes the information of the corresponding frequency of above-mentioned F sampled data, above-mentioned F sampled data correspond to first frequency or Second frequency;
Above-mentioned determination unit 1503, if being additionally operable to the corresponding frequency of above-mentioned F sampled data as above-mentioned first frequency, really It is 1 to determine the corresponding binary numeral of above-mentioned F sampled data;Otherwise, it determines the corresponding binary numeral of above-mentioned F sampled data For 0.
Concrete methods of realizing is identical with the method in Figure 10, is not described herein in detail.
Optionally, above-mentioned determination unit 1503 is additionally operable to after determining to complete decoding, obtained target code is carried out strange Even parity check, above-mentioned target code include start bit, data bit, cyclic redundancy check position, parity bit and stop bits successively Corresponding coding;In the case where determining above-mentioned target code mistake according to the result of odd-even check, from above-mentioned data list Desired value is obtained, above-mentioned desired value is located in above-mentioned data list and the number of the sampled data with obtaining recently is adjacent;Foundation Above-mentioned desired value sampled data determines a binary numeral.
In the embodiment of the present invention, after decoding error, the number of the sampled data of adjustment FFT institutes foundation decodes again, can To improve decoded accuracy rate.
Optionally, above-mentioned first frequency is K times of above-mentioned second frequency, and above-mentioned K is not less than 2, above-mentioned N number of continuous frequency It is less than 4 milliseconds for the sine wave of first frequency or the duration of cosine wave, above-mentioned first frequency and above-mentioned second frequency are not less than 500 hertz and no more than 6000 hertz.
It is accurate can to take into account decoding efficiency, decoding by limiting the scope of first frequency and second frequency for the embodiment of the present invention True rate.
It is a kind of terminal schematic block diagram that another embodiment of the present invention provides referring to Figure 16.The present embodiment as depicted In terminal can include:One or more processors 1601;One or more input equipments 1602, one or more output are set Standby 1603 and memory 1604.Above-mentioned processor 1601, input equipment 1602, output equipment 1603 and memory 1604 are by total Line 1605 connects.For memory 1604 for storing computer program, above computer program includes program instruction, processor 1601 For performing the program instruction of the storage of memory 1604.Wherein, processor 1601 is arranged to that above procedure instruction is called to hold Row:The second data are obtained, above-mentioned second data are to treat the binary data sent to target device, and above-mentioned second data are wrapped successively Containing start bit, data bit, cyclic redundancy check position, parity bit and the corresponding binary coding of stop bits;Pass through signal Generator generates the corresponding echo signal of above-mentioned second data, and each 1 in above-mentioned second data corresponds to N number of continuous frequency and is The sine wave or cosine wave of first frequency, each 0 in above-mentioned second data corresponds to M continuous frequencies as second frequency just String ripple or cosine wave, above-mentioned echo signal includes the corresponding sine wave of above-mentioned second data or cosine wave, above-mentioned first frequency are K times of above-mentioned second frequency, above-mentioned K are not less than 2, and above-mentioned N number of continuous frequency is the sine wave or cosine wave of first frequency Duration is less than 4 milliseconds, and above-mentioned first frequency and above-mentioned second frequency are not less than 500 hertz and no more than 6000 hertz;Pass through Audio interface sends above-mentioned echo signal to above-mentioned target device.
Alternatively, processor 1601 is arranged to that above procedure instruction is called to perform:Target is received by audio interface to set The echo signal that preparation is sent samples above-mentioned echo signal, obtains G sampled data;It is determined currently according to data list After the number of the sampled data of required acquisition is F, F sampled data is obtained, above-mentioned F sampled data is above-mentioned G hits Data in, above-mentioned data list include H numerical value, and above-mentioned H numerical value is the number of sampled data to be chosen;To above-mentioned F sampled data carries out Fast Fourier Transform (FFT) FFT, obtains result of calculation, and above-mentioned result of calculation includes above-mentioned F sampled data The information of corresponding frequency, above-mentioned F sampled data correspond to first frequency or second frequency;If above-mentioned F sampled data corresponds to Frequency be above-mentioned first frequency, it is determined that the corresponding binary numeral of above-mentioned F sampled data is 1;Otherwise, it determines above-mentioned F The corresponding binary numeral of a sampled data is 0.
It should be appreciated that in embodiments of the present invention, alleged processor 1601 can be central processing unit (Central Processing Unit, CPU), which can also be other general processors, digital signal processor (Digital Signal Processor, DSP), application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic Device, discrete gate or transistor logic, discrete hardware components etc..General processor can be microprocessor or this at It can also be any conventional processor etc. to manage device.
Input equipment 1602 can include Trackpad, fingerprint collecting sensor (for gathering the finger print information of user and referring to The directional information of line), microphone etc., output equipment 1603 can include display (LCD etc.), loud speaker etc..
The memory 1604 can include read-only memory and random access memory, and provide instruction to processor 1601 And data.The a part of of memory 1604 can also include nonvolatile RAM.For example, memory 1604 may be used also With the information of storage device type.
In the specific implementation, processor 1601, input equipment 1602, output equipment 1603 described in the embodiment of the present invention It is real also to can perform the present invention for the described realization method of the communication means based on audio interface that executable previous embodiment provides The realization method of the described terminal of example is applied, details are not described herein.
It is a kind of communication equipment schematic block diagram that another embodiment of the present invention provides referring to Figure 17.This reality as depicted Applying the communication equipment in example can include:One or more processors 1701;One or more input equipments 1702, one or more A output equipment 1703 and memory 1704.Above-mentioned processor 1701, input equipment 1702, output equipment 1703 and memory 1704 are connected by bus 1705.For memory 1704 for storing computer program, above computer program includes program instruction, Processor 1701 is used to perform the program instruction of the storage of memory 1704.Processor 1701 can be microprocessor.Wherein, handle Device 1701 is arranged to that above procedure instruction is called to perform:The first data are obtained, above-mentioned first data are to treat to send to terminal Binary data;Generate the corresponding square wave of above-mentioned first data;Each 1 in above-mentioned first data corresponds to N number of high level The square wave of the first durations of Shi Changwei, each 0 in above-mentioned first data correspond to M high level when a length of second duration side Ripple;Wherein, above-mentioned high level when a length of first duration square wave frequency for first frequency, above-mentioned high level when a length of the The frequency of the square wave of two durations is second frequency;Above-mentioned first frequency and above-mentioned second frequency are not less than 500 hertz and little In 6000 hertz;The corresponding square wave of above-mentioned first data is sent to above-mentioned terminal by audio interface.
Alternatively, above-mentioned processor 1701 is arranged to that above procedure instruction is called to perform:By audio interface reception come The echo signal of self terminal;The corresponding Q duration of Q high level that above-mentioned echo signal includes is determined, in above-mentioned Q duration A length of first duration at R, a length of second duration at W, when above-mentioned first the high level of the square wave of a length of first frequency when It is long, the duration of the high level of the square wave of a length of second frequency when above-mentioned second;Above-mentioned first frequency and above-mentioned second frequency are not Less than 500 hertz and no more than 6000 hertz;The corresponding binary data of above-mentioned echo signal is determined according to above-mentioned Q duration, Each 1 in above-mentioned binary data correspond to N number of high level when a length of above-mentioned first duration square wave, above-mentioned binary data In each 0 correspond to M high level when a length of above-mentioned second duration square wave.
A kind of computer readable storage medium, above computer readable storage medium are provided in another embodiment of the invention Matter is stored with computer program, and above computer program includes program instruction, and above procedure instruction is realized when being executed by processor: The first data are obtained, above-mentioned first data are to treat the binary data sent to terminal;Generate the corresponding side of above-mentioned first data Ripple;Each 1 in above-mentioned first data correspond to N number of high level when a length of first duration square wave, in above-mentioned first data Each 0 correspond to M high level when a length of second duration square wave;Wherein, above-mentioned high level when a length of first duration side The frequency of ripple be first frequency, above-mentioned high level when a length of second duration square wave frequency be second frequency;Above-mentioned first Frequency and above-mentioned second frequency are not less than 500 hertz and no more than 6000 hertz;It is sent by audio interface to above-mentioned terminal The corresponding square wave of above-mentioned first data.Alternatively, above procedure instruction is realized when being executed by processor:By audio interface reception come The echo signal of self terminal;The corresponding Q duration of Q high level that above-mentioned echo signal includes is determined, in above-mentioned Q duration A length of first duration at R, a length of second duration at W, when above-mentioned first the high level of the square wave of a length of first frequency when It is long, the duration of the high level of the square wave of a length of second frequency when above-mentioned second;Above-mentioned first frequency and above-mentioned second frequency are not Less than 500 hertz and no more than 6000 hertz;The corresponding binary data of above-mentioned echo signal is determined according to above-mentioned Q duration, Each 1 in above-mentioned binary data correspond to N number of high level when a length of above-mentioned first duration square wave, above-mentioned binary data In each 0 correspond to M high level when a length of above-mentioned second duration square wave.
Alternatively, above procedure instruction is realized when being executed by processor:The second data are obtained, above-mentioned second data are to treat to mesh The binary data that marking device is sent, above-mentioned second data are successively comprising start bit, data bit, cyclic redundancy check position, odd even Check bit and the corresponding binary coding of stop bits;The corresponding target of above-mentioned second data is generated by signal generator to believe Number, each 1 in above-mentioned second data corresponds to the sine wave or cosine wave that N number of continuous frequency is first frequency, and above-mentioned second Each 0 in data corresponds to the sine wave or cosine wave that M continuous frequencies are second frequency, and above-mentioned echo signal includes above-mentioned The corresponding sine wave of second data or cosine wave, above-mentioned first frequency are K times of above-mentioned second frequency, and above-mentioned K is not less than 2, on The duration for stating sine wave that N number of continuous frequency is first frequency or cosine wave is less than 4 milliseconds, above-mentioned first frequency and above-mentioned the Two frequencies are not less than 500 hertz and no more than 6000 hertz;Above-mentioned target is sent to above-mentioned target device by audio interface Signal.
Alternatively, above procedure instruction is realized when being executed by processor:The mesh of target device transmission is received by audio interface Signal is marked, above-mentioned echo signal is sampled, obtains G sampled data;Current desired acquisition is determined according to data list After the number of sampled data is F, F sampled data is obtained, above-mentioned F sampled data is the data in above-mentioned G sampled data, Above-mentioned data list includes H numerical value, and above-mentioned H numerical value is the number of sampled data to be chosen;To above-mentioned F sampled data Fast Fourier Transform (FFT) FFT is carried out, obtains result of calculation, above-mentioned result of calculation includes the corresponding frequency of above-mentioned F sampled data Information, above-mentioned F sampled data correspond to first frequency or second frequency;If the corresponding frequency of above-mentioned F sampled data is upper State first frequency, it is determined that the corresponding binary numeral of above-mentioned F sampled data is 1;Otherwise, it determines above-mentioned F sampled data Corresponding binary numeral is 0.
Above computer readable storage medium storing program for executing can be the inside of the above-mentioned terminal of foregoing any embodiment or communication equipment Storage unit, such as the hard disk or memory of terminal or communication equipment.Above computer readable storage medium storing program for executing can also be above-mentioned end End or the External memory equipment of communication equipment, such as the plug-in type hard disk being equipped in above-mentioned terminal, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) etc..Further, Above computer readable storage medium storing program for executing can also both include the internal storage unit of above-mentioned terminal or including External memory equipment.On Computer readable storage medium is stated for storing above computer program and other programs and data needed for above-mentioned terminal.On Computer readable storage medium is stated to can be also used for temporarily storing the data that has exported or will export.
Those of ordinary skill in the art may realize that each exemplary lists described with reference to the embodiments described herein Member and algorithm steps can be realized with the combination of electronic hardware, computer software or the two, in order to clearly demonstrate hardware With the interchangeability of software, each exemplary composition and step are generally described according to function in the above description.This A little functions are performed actually with hardware or software mode, specific application and design constraint depending on technical solution.Specially Industry technical staff can realize described function to each specific application using distinct methods, but this realization is not It is considered as beyond the scope of this invention.
It is apparent to those skilled in the art that for convenience of description and succinctly, the end of foregoing description End and the specific work process of unit, may be referred to the corresponding process in preceding method embodiment, details are not described herein.
In several embodiments provided herein, it should be understood that disclosed terminal and method can pass through it Its mode is realized.For example, the apparatus embodiments described above are merely exemplary, for example, the division of said units, only Only a kind of division of logic function can have other dividing mode in actual implementation, such as multiple units or component can be tied It closes or is desirably integrated into another system or some features can be ignored or does not perform.In addition, shown or discussed phase Coupling, direct-coupling or communication connection between mutually can be INDIRECT COUPLING or the communication by some interfaces, device or unit Connection or electricity, the connection of mechanical or other forms.
The above-mentioned unit illustrated as separating component may or may not be physically separate, be shown as unit The component shown may or may not be physical location, you can be located at a place or can also be distributed to multiple In network element.Some or all of unit therein can be selected to realize the embodiment of the present invention according to the actual needs Purpose.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also It is that unit is individually physically present or two or more units integrate in a unit.It is above-mentioned integrated The form that hardware had both may be employed in unit is realized, can also be realized in the form of SFU software functional unit.
If above-mentioned integrated unit is realized in the form of SFU software functional unit and is independent production marketing or use When, it can be stored in a computer read/write memory medium.Based on such understanding, technical scheme is substantially The part to contribute in other words to the prior art or all or part of the technical solution can be in the form of software products It embodies, which is stored in a storage medium, is used including some instructions so that a computer Equipment (can be personal computer, server or the network equipment etc.) performs the complete of each embodiment above method of the present invention Portion or part steps.And foregoing storage medium includes:USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CD etc. are various can store journey The medium of sequence code.
The above description is merely a specific embodiment, but protection scope of the present invention is not limited thereto, any Those familiar with the art in the technical scope disclosed by the present invention, can readily occur in various equivalent modifications or replace It changes, these modifications or substitutions should be covered by the protection scope of the present invention.Therefore, protection scope of the present invention should be with right It is required that protection domain subject to.

Claims (16)

1. a kind of communication means based on audio interface, which is characterized in that including:
The first data are obtained, first data are to treat the binary data sent to terminal;
Generate the corresponding square wave of first data;Each 1 in first data correspond to N number of high level when a length of first The square wave of duration, each 0 in first data correspond to M high level when a length of second duration square wave;Wherein, it is described High level when a length of first duration square wave frequency for first frequency, the high level when a length of second duration square wave Frequency be second frequency;The first frequency and the second frequency are not less than 500 hertz and no more than 6000 hertz;
The corresponding square wave of first data is sent to the terminal by audio interface.
2. according to the method described in claim 1, it is characterized in that, when the summation of N number of first duration is with M described second Long summation is equal, and N number of first duration is less than 2 milliseconds;The first frequency is K times of the second frequency, and the K is not Less than 2;The first frequency and the second frequency are described to pass through audio not less than 1000 hertz and no more than 4000 hertz Interface sends the corresponding square wave of first data to the terminal to be included:
After rectification and enhanced processing is carried out to the corresponding square wave of first data, by the audio interface to the terminal Output treated the corresponding square wave of first data.
3. method according to claim 1 or 2, which is characterized in that described to generate the corresponding square wave bag of first data It includes:
After timer reaches target duration, the counts of counter add one, and first duration corresponds to E counts, Second duration corresponds to F counts;
In the case where the binary numeral for determining current desired transmission is 1, judge whether the counts of the counter are small In E;If so, the audio interface output high level, otherwise, judges whether the counts of the counter are equal to E;If It is that then the audio interface output low level, otherwise, judges whether the counts of the counter divide exactly 2*E;If so, The audio interface exports low level, otherwise, judges whether the counts of the counter divide exactly 2*E after subtracting E;If so, Otherwise the then audio interface output low level, judges whether the counts of the counter are equal to 2N*E;It is if so, described The counts of counter are reset and audio interface output low level, and otherwise, the counts of the counter add one;
In the case where the binary numeral for determining current desired transmission is 0, judge whether the counts of the counter are small In F;If so, the audio interface output high level, otherwise, judges whether the counts of the counter are equal to F;If It is that then the audio interface output low level, otherwise, judges whether the counts of the counter divide exactly 2*F;If so, The audio interface exports high level, otherwise, judges whether the counts of the counter divide exactly 2*F after subtracting F;If so, Otherwise the then audio interface output low level, judges whether the counts of the counter are equal to 2M*F;It is if so, described The counts of counter are reset and audio interface output low level, and otherwise, the counts of the counter add one.
4. a kind of communication means based on audio interface, which is characterized in that including:
By audio interface reception come the echo signal of self terminal;
The corresponding Q duration of Q high level that the echo signal includes is determined, a length of first during R in the Q duration Duration, a length of second duration at W, the duration of the high level of the square wave of a length of first frequency when described first, when described second The duration of the high level of the square wave of a length of second frequency;The first frequency and the second frequency not less than 500 hertz and No more than 6000 hertz;
The corresponding binary data of the echo signal is determined according to the Q duration, each 1 pair in the binary data Answer N number of high level when a length of first duration square wave, each 0 in the binary data corresponds to M high level The square wave of second duration described in Shi Changwei.
5. according to the method described in claim 4, it is characterized in that, described determine the echo signal according to the Q duration Corresponding binary data includes:
Judge whether the l-th duration in the Q duration is less than time threshold;
If so, corresponding first count value of the first frequency adds one, otherwise, corresponding second count value of the second frequency Add one;
A length of first duration during the L-1 in a length of second duration and the Q duration in the l-th In the case of, judge first count value whether not less than N-2 and less than N;It is if so, nearest before determining the l-th duration The corresponding binary numeral of the first count value duration for 1, the binary numeral 1 is stored into corresponding solution yardage In, first count value is reset, and second count value is added one;If it is not, whether judge first count value More than or equal to N;If so, nearest the first count value duration corresponds to described the before determining the l-th duration First count value divided by N number of binary numeral 1 are stored corresponding decoding by one count value divided by N number of binary numeral 1 In data, first count value is reset, and second count value is added one;
A length of second duration during the L-1 in a length of first duration and the Q duration in the l-th In the case of, judge second count value whether not less than M-2 and less than M;It is if so, nearest before determining the l-th duration The corresponding binary numeral of the second count value duration for 0, the binary numeral 0 is stored into corresponding solution yardage In, second count value is reset, and first count value is added one;If it is not, whether judge second count value More than or equal to M;If so, nearest the second count value duration corresponds to described the before determining the l-th duration Second count value divided by M binary numeral 0 are stored corresponding decoding by two count values divided by M binary numeral 0 In data, second count value is reset, and first count value is added one.
It is 6. described according to the method described in claim 5, it is characterized in that, the first frequency is K times of the second frequency K is not less than 2, and the first frequency and the second frequency are not less than 1000 hertz and no more than 4000 hertz, the judgement Whether the l-th duration in the Q duration is less than before time threshold, and the method further includes:
Second duration divided by first duration obtain target multiple, and second duration is more than first duration;
It is the result being multiplied no more than first duration with the target multiple to set the time threshold.
7. a kind of communication means based on audio interface, which is characterized in that including:
The second data are obtained, second data are to treat the binary data sent to target device, and second data are successively Include start bit, data bit, cyclic redundancy check position, parity bit and the corresponding binary coding of stop bits;
The corresponding echo signal of second data is generated by signal generator, each 1 in second data corresponds to N number of Continuous frequency is the sine wave or cosine wave of first frequency, and each continuous frequencies of 0 correspondence M in second data are The sine wave or cosine wave of second frequency, the echo signal include the corresponding sine wave of second data or cosine wave, institute K times that first frequency is the second frequency is stated, the K is not less than 2, and N number of continuous frequency is the sine of first frequency The duration of ripple or cosine wave is less than 4 milliseconds, and the first frequency and the second frequency not less than 500 hertz and are not more than 6000 hertz;
The echo signal is sent to the target device by audio interface.
8. the method according to the description of claim 7 is characterized in that N number of continuous frequency is the sine wave of first frequency Or the duration of cosine wave and the M continuous frequencies are equal for the sine wave of second frequency or the duration of cosine wave, described the One frequency and the second frequency not less than 1000 hertz and no more than 4000 hertz, it is described by audio interface to the mesh Marking device, which sends the echo signal, to be included:
After rectification and enhanced processing is carried out to the echo signal, by the audio interface at the target device output The echo signal after reason.
9. a kind of communication means based on audio interface, which is characterized in that including:
The echo signal of target device transmission is received by audio interface, the echo signal is sampled, obtains G sampling Data;
The number of the sampled data of current desired acquisition is determined according to data list after F, to obtain F sampled data, the F is a Sampled data is the data in the G sampled data, and the data list includes H numerical value, and the H numerical value is to wait to choose Sampled data number;
Fast Fourier Transform (FFT) FFT is carried out to the F sampled data, obtains result of calculation, the result of calculation includes the F The information of the corresponding frequency of a sampled data, the F sampled data correspond to first frequency or second frequency;
If the corresponding frequency of the F sampled data is the first frequency, it is determined that the F sampled data corresponding two into Numerical value processed is 1;Otherwise, it determines the corresponding binary numeral of the F sampled data is 0.
10. if according to the method described in claim 9, it is characterized in that, the corresponding frequency of the F sampled data is institute State first frequency, it is determined that the corresponding binary numeral of the F sampled data is 1;Otherwise, it determines the F sampled data After corresponding binary numeral is 0, the method further includes:
After determining to complete decoding, carry out odd-even check to obtained target code, the target code successively comprising start bit, Data bit, cyclic redundancy check position, parity bit and the corresponding coding of stop bits;
In the case where determining the target code mistake according to the result of odd-even check, target is obtained from the data list Value, the desired value is located in the data list and the number of the sampled data with obtaining recently is adjacent;
A binary numeral is determined according to the desired value sampled data.
11. the method according to claim 9 or 10, which is characterized in that the first frequency is the K of the second frequency Times, the K is not less than 2, and N number of continuous frequency is less than 4 milliseconds for the sine wave of first frequency or the duration of cosine wave, institute First frequency and the second frequency are stated not less than 500 hertz and no more than 6000 hertz.
12. a kind of communication equipment, which is characterized in that including being used to perform the side as described in claim 1-6 any claims The unit of method.
13. a kind of terminal, which is characterized in that including being used for performing the method as described in claim 7-11 any claims Unit.
14. a kind of communication equipment, which is characterized in that including processor, input equipment, output equipment and memory, the processing Device, input equipment, output equipment and memory are connected with each other, wherein, the memory is used to store computer program, the meter Calculation machine program includes program instruction, and the processor is arranged to call described program instruction, performs claim 1-6 such as and appoint Method described in one.
15. a kind of terminal, which is characterized in that the processor, defeated including processor, input equipment, output equipment and memory Enter equipment, output equipment and memory to be connected with each other, wherein, the memory is used to store computer program, the computer Program includes program instruction, and the processor is arranged to call described program instruction, perform as claim 7-11 is any Method described in.
16. a kind of computer readable storage medium, which is characterized in that the computer storage media is stored with computer program, The computer program includes program instruction, and described program instruction makes the processor perform such as right when being executed by a processor It is required that 1-11 any one of them methods.
CN201711324382.3A 2017-12-12 2017-12-12 Communication method, terminal and communication equipment based on audio interface Active CN108092741B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711324382.3A CN108092741B (en) 2017-12-12 2017-12-12 Communication method, terminal and communication equipment based on audio interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711324382.3A CN108092741B (en) 2017-12-12 2017-12-12 Communication method, terminal and communication equipment based on audio interface

Publications (2)

Publication Number Publication Date
CN108092741A true CN108092741A (en) 2018-05-29
CN108092741B CN108092741B (en) 2021-03-19

Family

ID=62174894

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711324382.3A Active CN108092741B (en) 2017-12-12 2017-12-12 Communication method, terminal and communication equipment based on audio interface

Country Status (1)

Country Link
CN (1) CN108092741B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109412757A (en) * 2018-12-07 2019-03-01 上海爱信诺航芯电子科技有限公司 A kind of amendment Miller self-adaptive decoding method and device
CN112910603A (en) * 2021-01-20 2021-06-04 宁波方太厨具有限公司 Digital data coding method
CN113722264A (en) * 2021-08-24 2021-11-30 深圳市京泉华智能电气有限公司 Communication method between single-chip microcomputers

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102739320A (en) * 2012-06-16 2012-10-17 天地融科技股份有限公司 Method, system and device for transmitting audio data and electronic signature tool
US20120307157A1 (en) * 2011-05-31 2012-12-06 Funai Electric Co., Ltd. Audio/video device and audio/video system comprising same
CN102820790A (en) * 2011-06-08 2012-12-12 波音公司 High yield AC-AC power converter and method therefor
CN103220428A (en) * 2013-04-17 2013-07-24 南京三宝科技股份有限公司 Audio signal data communication method for cell phone
CN104301521A (en) * 2014-09-17 2015-01-21 浙江铭众生物医学创业投资有限公司 Modulation mode and communication circuit based on mobile phone audio interface and communication method of communication circuit based on mobile phone audio interface
CN107359962A (en) * 2016-11-24 2017-11-17 天地融科技股份有限公司 Data receiver method and device
CN107359964A (en) * 2016-11-24 2017-11-17 天地融科技股份有限公司 Data transmission method for uplink and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120307157A1 (en) * 2011-05-31 2012-12-06 Funai Electric Co., Ltd. Audio/video device and audio/video system comprising same
CN102820790A (en) * 2011-06-08 2012-12-12 波音公司 High yield AC-AC power converter and method therefor
CN102739320A (en) * 2012-06-16 2012-10-17 天地融科技股份有限公司 Method, system and device for transmitting audio data and electronic signature tool
CN103220428A (en) * 2013-04-17 2013-07-24 南京三宝科技股份有限公司 Audio signal data communication method for cell phone
CN104301521A (en) * 2014-09-17 2015-01-21 浙江铭众生物医学创业投资有限公司 Modulation mode and communication circuit based on mobile phone audio interface and communication method of communication circuit based on mobile phone audio interface
CN107359962A (en) * 2016-11-24 2017-11-17 天地融科技股份有限公司 Data receiver method and device
CN107359964A (en) * 2016-11-24 2017-11-17 天地融科技股份有限公司 Data transmission method for uplink and device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109412757A (en) * 2018-12-07 2019-03-01 上海爱信诺航芯电子科技有限公司 A kind of amendment Miller self-adaptive decoding method and device
CN109412757B (en) * 2018-12-07 2021-01-22 上海爱信诺航芯电子科技有限公司 Modified Miller self-adaptive decoding method and device
CN112910603A (en) * 2021-01-20 2021-06-04 宁波方太厨具有限公司 Digital data coding method
CN113722264A (en) * 2021-08-24 2021-11-30 深圳市京泉华智能电气有限公司 Communication method between single-chip microcomputers
CN113722264B (en) * 2021-08-24 2024-03-15 深圳市京泉华智能电气有限公司 Communication method between singlechips

Also Published As

Publication number Publication date
CN108092741B (en) 2021-03-19

Similar Documents

Publication Publication Date Title
CN102394724B (en) Highly-reliable data transmission method and device based on dual tone multiple frequency sound waves
CN108092741A (en) Communication means, terminal and communication equipment based on audio interface
CN105976830B (en) Audio-frequency signal coding and coding/decoding method, audio-frequency signal coding and decoding apparatus
CN103294447B (en) A kind of method and apparatus generating random number
KR20190032368A (en) Data transmission / reception method and data transmission system via sound wave
CN104796888A (en) Method for connecting WI-FI network by intelligent hardware terminal based on sound waves and system for realizing same
CN102881290A (en) Data embedding system
CN103023580A (en) Method for achieving data transmission through voice
JP2013098666A5 (en)
CN105120528B (en) A kind of equipment room carries out the method, apparatus and system of configurability setting
CN111865952B (en) Data processing method, data processing device, storage medium and electronic equipment
CN104464752A (en) Sound feedback detection method and device
CN204633784U (en) A kind of data transmission device
CN110364170A (en) Voice transmission method, device, computer installation and storage medium
CN105551497B (en) Coding method, coding/decoding method, encoding apparatus and decoding apparatus
CN109524004A (en) The voice interaction device and system of a kind of method of parallel transmission that realizing MCVF multichannel voice frequency and data, circumscribed
KR20180036741A (en) Data transmission method and apparatus, data reception method and apparatus
CN109065017B (en) Voice data generation method and related device
EP2908312A1 (en) Self-adaptive intelligent voice device and method
CN107316652B (en) Side-tone elimination method and device
US20140101054A1 (en) System and method of transmitting data over a voice channel
CN202931336U (en) System for realizing data transmission through voice and data transmission and receiving terminals
US9503200B2 (en) Communication system and transfer method thereof
CN105099571B (en) A kind of audio communication method
CN109981184A (en) Red packet receiving/transmission method, device and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder

Address after: 518000 Guangdong science and technology innovation and Research Institute, Shenzhen, Shenzhen, Nanshan District No. 6, science and technology innovation and Research Institute, Shenzhen, D 10, 1004, 10

Patentee after: Shenzhen Hetai intelligent home appliance controller Co.,Ltd.

Address before: 518000 Guangdong science and technology innovation and Research Institute, Shenzhen, Shenzhen, Nanshan District No. 6, science and technology innovation and Research Institute, Shenzhen, D 10, 1004, 10

Patentee before: SHENZHEN H&T DATA RESOURCES AND CLOUD TECHNOLOGY Ltd.

CP01 Change in the name or title of a patent holder