Realize method and the device of infrared remote control based on Android system
Technical field
The present invention relates to telecontrol engineering field, be specifically related to a kind of method that realizes infrared remote control based on Android system.
Background technology
Along with the variation day by day of handheld mobile device, the technology of recording of information/storage and transmission is further developed, and the mode of transmission is divided into two kinds haply, a kind of is mainly to utilize the transmission mediums such as cable (CABLE) for wire transmission, and these equipment are connected, realize the object of transmission and exchange message, as data line in handheld device etc., this transmission has reliable character, and weak point is to provide a special cable, and another kind of transmission mode is wireless transmission, such as common infrared remote control, mainly transmission and the exchange of the information of carrying out as transmission medium with infrared ray (IrDA), and because the host-host protocol in wireless transmission has higher reliability, the any handheld device that has this agreement can be carried out to wireless connections, thereby this kind of transmission mode has higher use value, apply in various electronic goods at wireless transmission method in recent years, as mobile phone/MP3 etc., as the patent No. disclosure of the invention that is 200610112398.3 a kind of mobile phone infrared remote nine-way control switch, and the patent No. disclosure of the invention that is 201110082317.0 a kind of method of realizing network download infrared remote control function by mobile phone, these patented technologies are and use infrared method to carry out transmission and the exchange of data.
Because in recent years popular Android system is that a kind of taking Linux as basic open source code operating system, Linux has not only optimized operation interface, the easy simplification of operation, has improved efficiency more, is an outstanding operating system nucleus.It is to be also mainly used in mobile device as portable in mobile phone, panel computer etc., and Android operating system is actually the one change to (SuSE) Linux OS and expands, its kernel is exactly the kernel of Linux substantially, and difference has been done larger improvement and enhancing for the principal feature of mobile phone and mobile device specially on user's space.
Because the kernel Linux Kernel of Linux is non real-time, that is can not realize real-time interruption processing capacity, the carrier wave of infrared protocol is all generally 38K people's frequency, namely the fastest interval needs 26 are delicate will carry out an interruption, Linux Kernel does not process so fast interruption comparatively speaking, so the mobile devices such as existing Android mobile phone can not be realized function of infrared remote control substantially.
Therefore, developing method and the device of realizing infrared remote control based on Android system is the technical barrier that those skilled in the art need to capture.
Summary of the invention
The technical problem to be solved in the present invention is to provide a kind of method that can realize function of infrared remote control on the equipment such as the mobile phone of use Android.
The present invention seeks to be achieved through the following technical solutions: a kind of method that realizes infrared remote control based on Android system, comprises the following steps:
The first step, detection judge whether Android system has carrier wave, and the register system time of carrier wave in low and high level storage under each state;
Second step, launch infrared carrier wave according to the result of the detection of storing in the first step.
Preferably, before the described first step, also comprise infrared signal demodulation and decoding step, infrared signal is simulated to by the external world and be converted to digital signal.
Preferably, wherein, the state of described system comprises:
Z1 state, system has carrier wave and in high level; Z2 state, system has carrier wave and in low level;
Z3 state, system carrierfree in high level; Z4 state, system carrierfree in low level.
Preferably, the described first step further comprises:
The 3rd step: Android system detects whether there is carrier wave, if any entering the 4th step, as nothing is carried out the 6th step;
The 4th step: whether Android system detects described carrier wave is high level, system, in Z1 state, records the duration of described high level and turns back to the first step in this way, if not being continues to carry out next step;
The 5th step: system enters Z2 state, judges whether described low level time is greater than 300us, if continued, records the described duration and eliminates system carrier mark; Otherwise the directly retrieval system first step.
The 6th step: whether Android system detects described carrier wave is high level, system, in Z3 state, records the duration of described high level and turns back to the first step, otherwise entering next step in this way;
The 7th step: system enters Z4 state, judges whether described low level time is greater than 30ms, the directly detection of ends with system in this way, otherwise record described low duration and return to the step first step.
Preferably, described second step specifically comprises:
Detect the carrier frequency that whether has 445K, carry out data transmission if any the infrared signal docking of launching 455K; Otherwise the infrared signal docking of transmitting 38K.
Another object of the present invention is to provide a kind of device of realizing the method for infrared remote control for realizing above-mentioned Android system.
A kind of Android of realization system realizes the device of the method for infrared remote control, comprise the infrared study module of accepting, infrared transmission module, the described infrared study module of accepting comprises: hardware demodulation circuit, decoder module and the first coding module, described hardware demodulation circuit is connected with decoder module, and described decoder module is connected with the first coding module;
Described infrared transmission module comprises: the second coding module, hardware radiating circuit, described the second coding module is connected with the first coding module and hardware radiating circuit.
Preferably, the Android of realization system of the present invention realizes the device of the method for infrared remote control, and described the first coding module comprises the first judge module and records memory module.
Preferably, the Android of realization system of the present invention realizes the device of the method for infrared remote control, and described the second coding module comprises the second judge module.
The present invention has following beneficial effect: method of the present invention does not adopt the mode of interruption, but employing fast query, add fuzzy diagnosis, solved non real-time this bottleneck problem of Linux Kernel, make system send the highest carrier wave that can reach 455K frequency.
Brief description of the drawings
For ease of explanation, the present invention is described in detail by following preferred embodiment and accompanying drawing.
Fig. 1 is the process flow diagram that the present invention carries out carrier detect;
Fig. 2 is the process flow diagram that the present invention carries out infrared emission;
Fig. 3 is the system architecture diagram that the present invention realizes;
Fig. 4 is the Organization Chart of the first coding module of the present invention.
Embodiment
Shown in Fig. 1-3, realization of the present invention realizes the device of the method for infrared remote control based on Android system, comprise the infrared study module 1 of accepting, infrared transmission module 2, the described infrared study module 1 of accepting comprises: hardware demodulation circuit 3, decoder module 4 and the first coding module 5, described hardware demodulation circuit 3 is connected with decoder module 4, and described decoder module 4 is connected with the first coding module 5; Described infrared transmission module 2 comprises: the second coding module 6, hardware radiating circuit 7, and described the second coding module 6 is connected with the first coding module 5 and hardware radiating circuit 7; Described the first coding module 5 comprises the first judge module 51 and records memory module 52; Described the second coding module 6 comprises the second judge module 61.
The present invention is realizing Android system and is realizing the step of the method for infrared remote control, comprise the following steps: the first step, 51 first judge modules detect to judge whether Android system has carrier wave, and by recording memory module 52 system recorder memories carrier wave time in low and high level under each state;
Before system first, by hardware demodulation circuit 3 and decoder module 4 by infrared signal demodulation and decoding step, infrared signal is simulated to by the external world and be converted to digital signal, wherein hardware demodulation circuit 3 is that basic circuit common, decoder module 4 is what realize by general software approach, all belong to prior art, do not repeating at this.
Wherein, the state of described system comprises:
Z1 state, system has carrier wave and in high level; Z2 state, system has carrier wave and in low level;
Z3 state, system carrierfree in high level; Z4 state, system carrierfree in low level.
Record memory module 52 register system time in low and high level under Z1, Z2, Z3, Z4 one of four states respectively.
Wherein the first step further comprises:
The 3rd step: the first inspection judge module 51 detects whether there is carrier wave, if any entering the 4th step, as nothing is carried out the 6th step;
The 4th step: whether the first inspection judge module 51 detects described carrier wave is high level, and system, in Z1 state, records memory module 52 and records and store the duration of described high level and turn back to first step, if not being continues to carry out next step in this way;
The 5th step: system enters Z2 state, the first inspection judge module 51 judges whether described low level time is greater than 300us, if it is records memory module 52 and records and store the described duration and eliminate system carrier mark; Otherwise directly retrieval system first step.
The 6th step: the first inspection judge module 51 detects to judge whether described carrier wave is high level, and system, in Z3 state, records memory module 52 and records and store the duration of described high level and turn back to first step, otherwise enter next step in this way;
The 7th step: system enters Z4 state, the first inspection judge module 51 judges whether described low level time is greater than 30ms, the directly detection of ends with system, records and stores described low duration and return to the first step otherwise record memory module 52 in this way.
And then the second judge module 61 detects the carrier frequency that judges whether 445K, carry out data transmission if any the infrared signal docking of launching 455K by hardware radiating circuit 6; Otherwise the infrared signal docking of launching 38K by hardware radiating circuit 6, same, this hardware radiating circuit 7 belongs to available circuit.
The embodiment of the above is preferred embodiments of the present invention, not limits specific embodiment of the invention scope with this, and scope of the present invention comprises and is not limited to this embodiment.The equivalence variation that all shapes according to the present invention, structure are done all comprises in protection scope of the present invention.