Realize the method and the device of infrared remote control based on the Android system
Technical field
The present invention relates to the telecontrol engineering field, be specifically related to a kind of method that realizes infrared remote control based on the 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 transmission manner is divided into two kinds haply; A kind of is wire transmission, mainly is to utilize cable transmission mediums such as (CABLE), and these equipment are connected; Realize the purpose of transmission and exchange message; Like data line in the handheld device etc., this transmission has reliable character, and weak point is to provide a special cable; And another kind of transmission mode is a wireless transmission; Such as common infrared remote control; Mainly be to carry out the transmission and the exchange of information as transmission medium, and, can any handheld device that have this agreement be carried out wireless connections because the host-host protocol in wireless transmission has higher reliability with infrared ray (IrDA); Thereby this kind transmission mode has higher use value; Applied in the various electronic goods at wireless transmission method in recent years, like mobile phone/MP3 etc., a kind of mobile phone infrared remote nine-way control switch that has been 200610112398.3 disclosure of the Invention like the patent No.; And the patent No. a kind of mobile phone that is 201110082317.0 disclosure of the Invention realizes the method for network download type function of infrared remote control, and these patented technologies are uses infrared method to carry out the transmission and the exchange of data.
Since in recent years popular Android system be a kind of be the open source code operating system on basis with Linux, Linux has not only optimized operation interface, the easy simplification of operation has improved efficient more, is an outstanding operating system nucleus.It mainly also is to use in like portable mobile devices such as mobile phone, panel computers; And Android operating system is actually a kind of change and expansion to (SuSE) Linux OS; Its kernel is exactly the kernel of Linux basically, and difference special principal feature to mobile phone and mobile device on user's space has been done bigger improvement and enhancing.
Because the kernel Linux Kernel of Linux is a non real-time; That is can not realize real-time Interrupt Process function; The carrier wave of infrared protocol generally all is 38K people's frequency; Just the fastest interval needs 26 are delicate will to come an interruption, and Linux Kernel can handle so fast interruption comparatively speaking, so mobile devices such as existing Android mobile phone can not be realized function of infrared remote control basically.
Therefore, method and the device developed based on Android system realization infrared remote control are the technical barriers that those skilled in the art need capture.
Summary of the invention
The technical matters that the present invention will solve provides a kind of method that can on the equipment such as mobile phone that use Android, realize function of infrared remote control.
The present invention seeks to realize through following technical scheme: a kind of method that realizes infrared remote control based on the Android system may further comprise the steps:
The first step, detection judge whether the Android system has carrier wave, and register system carrier wave under each state is in the time and the storage of high-low level;
Second step, launch infrared carrier wave according to the result of the detection of storing in the first step.
Preferably, before the said first step, also comprise infrared signal demodulation and decoding step, infrared signal is simulated in the external world converted into digital signal.
Preferably, wherein, the state of said system comprises:
The Z1 state, there is carrier wave in system and is in high level; The Z2 state, there is carrier wave in system and is in low level;
The Z3 state, system's carrierfree also is in high level; The Z4 state, system's carrierfree also is in low level.
Preferably, the said first step further comprises:
The 3rd step: whether the Android system detects has carrier wave, if any then getting into for the 4th step, does not then carry out for the 6th step as having;
The 4th step: whether the Android system detects said carrier wave is high level, and then system is in the Z1 state in this way, writes down the duration of said high level and turns back to the first step, as not being then to continue to carry out next step;
The 5th step: system gets into the Z2 state, whether judges said low level time greater than 300us, if continue then write down the said duration and eliminate the system carrier sign; Otherwise the direct retrieval system first step.
The 6th step: whether the Android system detects said carrier wave is high level, and then system is in the Z3 state in this way, writes down the duration of said high level and turns back to the first step, otherwise get into next step;
The 7th step: system gets into the Z4 state, whether judges said low level time greater than 30ms, the then directly detection of ends with system in this way, otherwise write down said low duration and return the step first step.
Preferably, said second step specifically comprises:
Detect the carrier frequency whether 445K is arranged, carry out data transmission if any the infrared signal butt joint of then launching 455K; Otherwise the infrared signal butt joint of emission 38K.
Another object of the present invention is to provide a kind of and be used to realize that above-mentioned Android system realizes the device of the method for infrared remote control.
A kind of Android system that realizes realizes the device of the method for infrared remote control; Comprise the infrared study module of accepting; Infrared transmission module; The said infrared study module of accepting comprises: hardware demodulation circuit, decoder module and first coding module, and said hardware demodulation circuit links to each other with decoder module, and said decoder module links to each other with first coding module;
Said infrared transmission module comprises: second coding module, hardware radiating circuit, said second coding module links to each other with first coding module and hardware radiating circuit.
Preferably, the device of realizing the method for Android system realization infrared remote control of the present invention, said first coding module comprises first judge module and recording storage module.
Preferably, the device of realizing the method for Android system realization infrared remote control of the present invention, said second coding module comprises 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, the system that makes sends the highest carrier wave that can reach the 455K frequency.
Description of drawings
In order to be easy to explanation, the present invention is done to describe in detail by following preferred embodiment and accompanying drawing.
Fig. 1 carries out the process flow diagram that carrier wave detects for the present invention;
Fig. 2 carries out the process flow diagram of infrared emission for the present invention;
The system architecture diagram that Fig. 3 realizes for the present invention;
Fig. 4 is the Organization Chart of 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 the Android system; Comprise the infrared study module 1 of accepting, infrared transmission module 2, the said infrared study module 1 of accepting comprises: hardware demodulation circuit 3, decoder module 4 and first coding module 5; Said hardware demodulation circuit 3 links to each other with decoder module 4, and said decoder module 4 links to each other with first coding module 5; Said infrared transmission module 2 comprises: second coding module 6, hardware radiating circuit 7, and said second coding module 6 links to each other with first coding module 5 and hardware radiating circuit 7; Said first coding module 5 comprises first judge module 51 and recording storage module 52; Said second coding module 6 comprises second judge module 61.
The present invention is realizing that the Android system realizes the step of the method for infrared remote control; May further comprise the steps: the first step, 51 first judge modules detect to judge whether the Android system has carrier wave, and are in the time of high-low level through recording storage module 52 system recorder memories carrier wave under each state;
In system before at first; Through hardware demodulation circuit 3 and decoder module 4 with infrared signal demodulation and decoding step; Infrared signal is simulated in the external world converted into digital signal; Wherein hardware demodulation circuit 3 all belongs to prior art for basic circuit common, decoder module 4 are to realize through general software approach, is not giving unnecessary details at this.
Wherein, the state of said system comprises:
The Z1 state, there is carrier wave in system and is in high level; The Z2 state, there is carrier wave in system and is in low level;
The Z3 state, system's carrierfree also is in high level; The Z4 state, system's carrierfree also is in low level.
Recording storage module 52 register system respectively is in time of high-low level under Z1, Z2, Z3, Z4 one of four states.
Wherein the first step further comprises:
The 3rd step: the first inspection judge module 51 detects whether carrier wave is arranged, and if any then getting into for the 4th step, does not then carry out for the 6th step as having;
The 4th step: the first inspection judge module 51 detects whether said carrier wave is high level, and then system is in the Z1 state in this way, and recording storage module 52 records are also stored the duration of said high level and turned back to first step, as not being then to continue to carry out next step;
The 5th step: system gets into the Z2 state, and whether the first inspection judge module 51 judges said low level time greater than 300us, if then recording storage module 52 writes down and stores the said duration and eliminate the system carrier sign; Otherwise direct retrieval system first step.
The 6th step: the first inspection judge module 51 detects to judge whether said carrier wave is high level, and then system is in the Z3 state in this way, and recording storage module 52 records are also stored the duration of said high level and turned back to first step, otherwise get into next step;
The 7th step: system gets into the Z4 state, and whether the first inspection judge module 51 judges said low level time greater than 30ms, the then directly detection of ends with system in this way, otherwise recording storage module 52 writes down and stores said low duration and return the first step.
And then second judge module 61 detects the carrier frequency that judges whether 445K, if any then carrying out data transmission through the infrared signal butt joint of hardware radiating circuit 6 emission 455K; Otherwise through the infrared signal butt joint of hardware radiating circuit 6 emission 38K, same, this hardware radiating circuit 7 belongs to available circuit.
The embodiment of the above is a preferred embodiments of the present invention, is not to limit practical implementation scope of the present invention with this, and scope of the present invention comprises and is not limited to this embodiment.All shapes according to the present invention, the equivalence variation that structure is done all comprise in protection scope of the present invention.