Summary of the invention
The technical problem that the present invention will solve is; Above-mentioned defective to prior art; A kind of method of answering and hanging up the telephone and mobile phone based on mobile phone is provided; Provide the user to realize the function of answering and hanging up the telephone, particularly make things convenient for the user at dead of night or answer under the adverse circumstances and hang up the telephone through whipping.
The technical scheme that technical solution problem of the present invention is adopted is following:
A kind of method of answering and hanging up the telephone based on mobile phone wherein, comprises step:
Start software detection module when A, mobile phone receive incoming call, by predetermined detection method detection of handset whether whipping is arranged through the acceleration transducer that is arranged on the mobile phone;
B, when software detection module in first preset time, detect the whipping operation that mobile phone has appointment, then get into corresponding talking state;
C, when mobile phone gets into conversation, software detection module is in the second preset time section, whether detection of handset has the whipping operation once more, has the whipping operation then to get into the state of hanging up the telephone when detecting mobile phone once more.
Described method, wherein, said predetermined detection method specifically comprises:
The acceleration that the acceleration transducer induction mobile phone whipping that is provided with in A1, the mobile phone produces;
A2, degree of will speed up sensor sensing to accekeration carry out resolution of vectors according to the 3 D stereo coordinate, resolve into three vector values;
The size of A3, three vector values of comparison and predetermined value is if the absolute value that wherein a vector value is arranged then is defined as the mobile phone whipping once greater than the acceleration predetermined value.
Described method; Wherein, said detection method also comprises: every separated scheduled time is got accekeration continuously N time, and carries out resolution of vectors according to the 3 D stereo coordinate; If any one absolute value in the vector value of each resolution of vectors then is defined as whipping one time greater than the acceleration predetermined value.
Described method, wherein, the said scheduled time is 20ms, and said N equals 5, and said acceleration predetermined value is 1.3g.
Described method, wherein, said step B also comprises:
B1, when software detection module in first preset time, do not detect the whipping operation that mobile phone has appointment, then whether detection of handset receives calls through the mode beyond the whipping operation;
If B2 detects mobile phone and adopts and to receive calls through the mode beyond the whipping operation then get into talking state, whether whipping is arranged otherwise continue detection of handset.
Described method, wherein, said step B1 specifically comprises:
B11, a sign of definition F1, and when mobile phone power-on, the said software module of unlatching, initially put 0 to sign F1;
B12, in first preset time, when mobile phone receives calls through the mode beyond the whipping operation F1 is put 1;
B13, when software detection module in first preset time, do not detect the whipping operation that mobile phone has appointment, then regularly detect the value of sign F1, when detecting sign F1 and be 1, then being judged as mobile phone is to receive calls through the mode beyond the whipping operation.
Described method, wherein, said step C specifically comprises:
C1, when software detection module in second preset time, do not detect the whipping operation that mobile phone has appointment once more, then whether detection of handset hangs up the telephone through the mode beyond the whipping operation;
If C2 detects mobile phone and adopts and to hang up the telephone through the mode beyond the whipping operation then gets into the state of hanging up the telephone, otherwise whether the continuation detection of handset has whipping.
Described method, wherein, said step C1 specifically comprises:
C11, a sign of definition F2, and when mobile phone power-on, the said software module of unlatching, initially put 0 to sign F2;
C12, in second preset time, when mobile phone is hung up the telephone through the mode beyond the whipping operation F2 is put 1;
C13, when software detection module in second preset time, do not detect the whipping operation that mobile phone has appointment, then regularly detect the value of sign F2, when detecting sign F2 and be 1, then being judged as mobile phone is to hang up the telephone through the mode beyond the whipping operation.
A kind of mobile phone comprises a CPU and the acceleration transducer that is used to respond to the mobile phone whipping, wherein,
Said acceleration transducer links to each other with said CPU through the I2C bus;
Be provided with software detection module in the said CPU, be used for when mobile phone receives incoming call, by predetermined detection method detection of handset whether whipping being arranged through the acceleration transducer sense that is arranged on the mobile phone;
When in first preset time, detect the whipping operation that mobile phone has appointment, then get into corresponding talking state;
When getting into conversation, in the second preset time section, whether detection of handset has the whipping operation once more, has the whipping operation then to get into the state of hanging up the telephone when detecting mobile phone once more.
Described mobile phone, wherein, said software detection module further comprises:
The whipping detecting unit, the acceleration transducer that is used for being provided with through mobile phone is responded to the accekeration that the mobile phone whipping produces, and this accekeration is carried out resolution of vectors according to the 3 D stereo coordinate, resolves into three vector values; And the size of these three vector values and predetermined value relatively, if the absolute value that wherein a vector value is arranged then is defined as the mobile phone whipping once greater than the acceleration predetermined value;
The telephone receiving control unit is used for when in first preset time, detects the whipping operation that mobile phone has appointment, then gets into corresponding talking state; When in first preset time, do not detect the whipping operation that mobile phone has appointment, then whether detection of handset receives calls through the mode beyond the whipping operation; If detecting mobile phone adopts and to receive calls through the mode beyond the whipping operation then get into talking state;
Phone is hung up control unit, is used for when mobile phone gets into conversation, and in the second preset time section, whether detection of handset has the whipping operation once more, has the whipping operation then to get into the state of hanging up the telephone when detecting mobile phone once more; When software detection module in second preset time; Not detecting mobile phone has the whipping operation of appointment once more; Then whether detection of handset hangs up the telephone through the mode beyond the whipping operation; Adopt and to hang up the telephone through the mode beyond the whipping operation then gets into the state of hanging up the telephone if detect mobile phone, otherwise whether the continuation detection of handset there is whipping.
Method of answering and hanging up the telephone and mobile phone based on mobile phone provided by the present invention, because the acceleration that adopts the acceleration transducer induction mobile phone whipping of embedded in mobile phone to produce, and through in mobile phone CPU, software detection module being set; The whipping of detection of handset and judge whether mobile phone adopts other modes to answer or hang up the telephone; The mode of answering or hanging up the telephone with whipping is provided, and practicality is stronger, is specially adapted under the environment of light inclement condition; The user saves the worry of searching the button that receives calls; And the software detection module that is provided with realizes that through software software development is comparatively simple, and workload is little.
Embodiment
For making the object of the invention, technical scheme and advantage clearer, clear and definite, below develop simultaneously embodiment to further explain of the present invention with reference to accompanying drawing.Should be appreciated that specific embodiment described herein only in order to explanation the present invention, and be not used in qualification the present invention.
The embodiment of the invention provides a kind of method of answering and hanging up the telephone based on mobile phone, and is as shown in Figure 1, mainly may further comprise the steps:
Start software detection module when step S110, mobile phone receive incoming call, by predetermined detection method detection of handset whether whipping is arranged through the acceleration transducer that is arranged on the mobile phone.
Wherein, said predetermined detection method specifically comprises:
The acceleration that the acceleration transducer induction mobile phone whipping that is provided with in A1, the mobile phone produces;
A2, degree of will speed up sensor sensing to accekeration carry out resolution of vectors according to the 3 D stereo coordinate, resolve into three vector values;
The size of A3, three vector values of comparison and predetermined value is if the absolute value that wherein a vector value is arranged then is defined as the mobile phone whipping once greater than the acceleration predetermined value.
Wherein, Because the accekeration A of the mobile phone whipping that acceleration transducer is sensed is a vector; So it is carried out resolution of vectors according to the 3 D stereo coordinate system; As shown in Figure 2, degree of will speed up value A is decomposed into (XA, YA; ZA); Accekeration after the software test module will be decomposed and acceleration predetermined value 1.3g compare, when | XA|, | YA|, | just be defined as the mobile phone whipping once when having one to satisfy in three values of ZA|, wherein greater than 1.3g; | XA|, | YA|, | ZA| is respectively the absolute value that decomposes back three accekerations, g=9.8m/s
.
Consider mainly as predetermined value that for choosing 1.3g it is too small to cause misoperation easily, excessive then can be insensitive, the amplitude of mobile phone whipping must more just can be detected whipping, is unfavorable for that the user uses.
Preferably, when CPU obtains the acceleration that the mobile phone whipping of acceleration transducer induction produces, in order to prevent sensor error; Get many group accekerations and acceleration predetermined value in the given time and compare, be specially: every separated 20ms reads once (XA, YA; ZA); Read 5 times continuously, if each value all satisfies | XA|>1.3g or | YA|>1.3g or | ZA|>1.3g, then can be judged as a whipping of mobile phone.
Step S120, when software detection module in first preset time, detect the whipping operation that mobile phone has appointment, then get into corresponding talking state.
Preferably, said step S120 specifically comprises: B1, when software detection module in first preset time, do not detect the whipping operation that mobile phone has appointment, then whether detection of handset receives calls through the mode beyond the whipping operation; If B2 detects mobile phone and adopts and to receive calls through the mode beyond the whipping operation then get into talking state, whether whipping is arranged otherwise continue detection of handset.
The detection of whether adopting the method beyond the whipping operation to receive calls to mobile phone mainly realizes through following method:
At first, define a sign F1, and when mobile phone power-on, the said software module of unlatching, initially put 0 to sign F1; In first preset time, when mobile phone receives calls through the mode beyond the whipping operation F1 is put 1; If work as software detection module in first preset time, do not detect the whipping operation that mobile phone has appointment, then regularly detect the value of sign F1, when detection sign F1 was 1, then being judged as mobile phone was to receive calls through the mode beyond the whipping operation.This detection method that whether adopts the mode beyond the whipping to receive calls to mobile phone mainly realizes through software, and is simple and workload is little, implements and convenient.
For example; User's mobile phone receives after the incoming call, and the software detection module in the mobile phone CPU just starts, and begins the whipping situation of mobile phone is detected; CPU is every to obtain 5 groups of accekeration A continuously at a distance from 20ms; Whether the detection method judges according to the preceding text whipping has the whipping mobile phone, if detect that mobile phone has whipping then mobile phone is directly connected phone, otherwise whether the software detection module detection of handset adopts the mode beyond the whipping operation to receive calls; Such as traditional key-press is answered or touch-screen receives calls, and software detection module continues the whipping situation of detection of handset when not detecting mode that the user selects other and receive calls.
Step S130, when mobile phone gets into conversation, software detection module is in the second preset time section, whether detection of handset has the whipping operation once more, has the whipping operation then to get into the state of hanging up the telephone when detecting mobile phone once more.
Preferably, said step S130 specifically comprises: C1, when software detection module in second preset time, do not detect the whipping operation that mobile phone has appointment once more, then whether detection of handset hangs up the telephone through the mode beyond the whipping operation; If C2 detects mobile phone and adopts and to hang up the telephone through the mode beyond the whipping operation then gets into the state of hanging up the telephone, otherwise whether the continuation detection of handset has whipping.
Detection method when whether adopting detection that the mode beyond the whipping operation hangs up the telephone and receiving calls for mobile phone is identical, concrete realization as follows:
At first, define a sign F2, and when mobile phone power-on, the said software module of unlatching, initially put 0 to sign F2; In second preset time, when mobile phone is hung up the telephone through the mode beyond the whipping operation F2 is put 1; When software detection module in second preset time, do not detect the whipping operation that mobile phone has appointment, then regularly detect the value of sign F2, when detecting sign F2 and be 1, then being judged as mobile phone is to hang up the telephone through the mode beyond the whipping operation.
For example; In the user's communication process; CPU is every to obtain 5 groups of accekeration A continuously at a distance from 20ms; And whether the whipping mobile phone is arranged according to the detection method judges of preceding text whipping, if then hang up the telephone and close software test module of the present invention, otherwise whether the software detection module detection of handset adopts the mode beyond the whipping operation to hang up the telephone; Such as traditional key-press is hung up or touch-screen is hung up the telephone, and software detection module continues the whipping situation of detection of handset when not detecting mode that the user selects other and hang up the telephone.
A preferred embodiment is as shown in Figure 3, and when mobile phone received incoming call, software detection module of the present invention was opened.Then get into step 303, every obtain 5 groups at a distance from 20ms (whether XA, YA ZA), have the whipping mobile phone according to the detection method judges of preceding text whipping, if then get into conversation; If otherwise checked whether the user adopts other modes to receive calls, if would then get into conversation, if otherwise get into step 303.In the user's communication process, shown in step 306, every obtain 5 groups of accekeration A continuously at a distance from 20ms, according to the detection method judges of preceding text whipping whether the whipping mobile phone is arranged, if then hang up the telephone and close software module of the present invention; If otherwise checked whether the user adopts other modes to hang up the telephone, if would then close software module of the present invention, if otherwise get into step 306.
The method of answering and hanging up the telephone based on the foregoing description based on mobile phone; The present invention also provides a kind of mobile phone; Comprise a CPU41 and the acceleration transducer that links to each other with CPU41 43; As shown in Figure 4, acceleration transducer 43 links to each other with said CPU41 through the I2C bus, and is used to respond to the acceleration that the mobile phone whipping produces.
Be provided with software detection module 42 in the CPU41, be used for when mobile phone receives incoming call, by predetermined detection method detection of handset whether whipping being arranged through the acceleration transducer 43 that is arranged on the mobile phone,
Concrete detection method is: when in first preset time, detect the whipping operation that mobile phone has appointment, then get into corresponding talking state;
When getting into conversation, in the second preset time section, whether detection of handset has the whipping operation once more, has the whipping operation then to get into the state of hanging up the telephone when detecting mobile phone once more.
Wherein, software detection module 42 specifically also comprises: whipping detecting unit 421, telephone receiving control unit 422 and phone are hung up control unit 423.
Whipping detecting unit 421, the acceleration transducer 43 that is used for being provided with through mobile phone is responded to the accekeration that the mobile phone whippings produce, and this accekeration is carried out resolution of vectors according to the 3 D stereo coordinate, resolves into three vector values; And the size of these three vector values and predetermined value relatively, if the absolute value that wherein a vector value is arranged then is defined as the mobile phone whipping once greater than the acceleration predetermined value; Specifically as stated.
Telephone receiving control unit 422 is used for when in first preset time, detects the whipping operation that mobile phone has appointment, then gets into corresponding talking state; When in first preset time, do not detect the whipping operation that mobile phone has appointment, then whether detection of handset receives calls through the mode beyond the whipping operation; If detecting mobile phone adopts and to receive calls through the mode beyond the whipping operation then get into talking state; Specifically as stated.
Phone is hung up control unit 423, is used for when mobile phone gets into conversation, and in the second preset time section, whether detection of handset has the whipping operation once more, has the whipping operation then to get into the state of hanging up the telephone when detecting mobile phone once more; When software detection module in second preset time; Not detecting mobile phone has the whipping operation of appointment once more; Then whether detection of handset hangs up the telephone through the mode beyond the whipping operation; Adopt and to hang up the telephone through the mode beyond the whipping operation then gets into the state of hanging up the telephone if detect mobile phone, otherwise whether the continuation detection of handset there is whipping, specifically as stated.
The mobile phone of the embodiment of the invention in the specific implementation; The acceleration that utilizes acceleration transducer induction mobile phone whipping to produce; CPU reads the accekeration A of the mobile phone whipping that acceleration transducer senses through the I2C bus; And carry out resolution of vectors by coordinate system, the software test module in the CPU is handled the accekeration after decomposing, and judges the mode of answering or hanging up the telephone according to result.
Wherein, accekeration A obtain and processing and follow-up to answer and the judgement of the mode of hanging up the telephone such as above-mentioned method in said, do not giving unnecessary details at this.
In embodiments of the present invention; The whipping direction of mobile phone is restriction not, because the acceleration that acceleration transducer is sensed is a vector value, itself has directivity; Appearance whipping mobile phone whatsoever; All can produce a vector acceleration, and this vector acceleration carries out resolution of vectors according to the 3 D stereo coordinate, the result of decomposition is to the not influence of judgement of mobile phone whipping.
A kind of method of answering and hanging up the telephone and mobile phone provided by the invention based on mobile phone; Acceleration transducer through establishing in the mobile phone is responded to the acceleration that the mobile phone whipping produces, and through software detection module is set in CPU, the whipping situation of mobile phone is judged; And then reached the effect of answering and hanging up the telephone with whipping; Practical, be specially adapted to again save and search the trouble of answering and hang up button under the environment of light inclement condition; And the software test module realizes through software, and is simple and reduced workload.
Should be understood that application of the present invention is not limited to above-mentioned giving an example, concerning those of ordinary skills, can improve or conversion that all these improvement and conversion all should belong to the protection range of accompanying claims of the present invention according to above-mentioned explanation.