A kind of method that mouse function is realized on mobile phone
Technical field
The present invention relates to mouse with mobile telephone set shape technical field, more particularly to a kind of method that mouse function is realized on mobile phone.
Background technology
For computer user, a kind of indispensable input equipment during mouse, when mouse or with similar functions
During touch pad failure, the operation of user can be had a strong impact on, especially carry out real time remote call or exchange when, may therefore band
Carry out some unnecessary losses.
And many users do not like and sat up straight by computer desk, especially exist when being watched film using computer or being listened song
In the case that it is cold, user typically likes computer being connected with large-sized display screen, and shifting sits on comfortable place viewing,
At this moment people has a certain distance from computer, and mouse is inconvenient to be placed on side, and existing implementation method can be by mouse
Function combines on mobile terminals to substitute traditional mouse.
But in the prior art, some equipment of original mouse are often added on mobile phone(Such as button, roller and
Optics etc.)To realize mouse function, the increase of above-mentioned component inevitably results in the thickness increase of mobile phone, influence mobile phone
Aesthetic feeling, and usually user also takes less than above-mentioned functions when using mobile phone.
Chinese patent(CN200962609Y)A kind of mobile phone with mouse wheel is disclosed, the mobile phone includes multiple mouses
Wheel, mouse wheel connection rotary shaft.In above-mentioned patent, multiple rotor blocks have been installed on the mobile phone used as mouse additional, therefore lead
The thickness increase of mobile phone is caused, feel when may influence the aesthetic feeling of mobile phone and normally use.
Chinese patent(CN2769988Y)A kind of computer mouse mobile telephone is disclosed, the mobile phone includes optics Cursor sensing list
First, some key components and mouse interface circuit.Above-mentioned multiple components in mobile phone also result in the thickness increase of mobile phone,
And the shortcoming in terms of mobile phone aesthetic feeling and usage comfort.
The content of the invention
The defect according to present in prior art, now provides a kind of technical side for the method that mouse function is realized on mobile phone
Case, is specifically included:
A kind of method that mouse function is realized on mobile phone, it is adaptable to touch smart mobile phone, the smart mobile phone bag
Include microcontroller, gyroscope, timer, memory, touch-screen, volume button and rear camera;The work of the smart mobile phone
Making state includes handset mode and mouse mode;Wherein, a control unit is used as using the microcontroller;Using the top
Spiral shell instrument is used as a positioning element;One timing piece is used as using the timer;Deposited using the memory as one
Store up part;One key component is used as using the touch-screen;
The control unit includes judge module and modular converter;The judge module connect respectively the touch-screen and
The memory unit;The modular converter passes through the electronic equipment outside a communication interface connection;The timing piece connection
The touch-screen;The positioning element connects the memory unit and the judge module respectively;
The judge module is used to carry out realizing that the correlated judgment during mouse function acts and generates corresponding mouse
Actuating signal;The judge module sends the mouse action signal to the modular converter;The modular converter is according to pre-
If method, the mouse action signal is carried out after code conversion sending to the outside electronics by the communication interface
Equipment;
The positioning element is used for the displacement data that the smart mobile phone is caught according to default flow, and by the displacement
Data are sent to the judge module;The key component is used for the keypress function for realizing mouse;The timing piece is used for area
Divide the single-click operation and double click operation of user.
Also include switching part in the smart mobile phone, the switching part respectively with the key component and institute
State positioning element connection;The switching part switches for user between the handset mode and the mouse mode.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, the default method includes:
Step 1, the working condition of the smart mobile phone is switched to mouse mode by user;
Step 2, the gyroscope gathers the displacement data of the smart mobile phone for the first time;The gyroscope is by the displacement
Data definition is displacement data A, and the displacement data A is sent into first memory space of the memory unit into guarantor
Deposit;
Step 3, by default time interval t1, the gyroscope gathers the displacement data of the smart mobile phone again,
And the displacement data is defined as displacement data B;The gyroscope sends the displacement data B to the judge module;
Step 4, the judge module transfers the displacement data A in first memory space, and by the displacement
The data A and displacement data B is contrasted;If the displacement data B and the displacement data A are unequal, the judge module
The deformation trace of the smart mobile phone is obtained according to the displacement data A and the displacement data B;The judge module will be described
Displacement data B is stored in first memory space;The judge module is by institute's shift number in first memory space
Removed according to A, and the displacement data B is defined as displacement data A;
Step 5, the judge module produces corresponding mouse action signal according to the deformation trace;The judge module
The mouse action signal is sent to the modular converter;
Step 6, the modular converter is according to the connected mode of the smart mobile phone and the outside electronic equipment, according to
Corresponding communication Protocol Conversion is into corresponding packet;The modular converter is sent the packet by the communication interface
Into the outside electronic equipment;
Step 7, repeating said steps 3 are to the step 6, until the working condition of the smart mobile phone be switched to it is described
Handset mode.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, in the step 4, the judge module is transferred
The displacement data A in first memory space, and the displacement data A and displacement data B is contrasted;If described
Displacement data B is equal with the displacement data A, then the judge module judges that the smart mobile phone is in floating state, described
Smart mobile phone does not produce the deformation trace.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, the time interval t1For 200ms.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, the displacement data is three number of axle evidences;It is described
The Z axis coordinate of three number of axle evidences is 0;The coordinate of three number of axle evidence only changes in X-axis and/or Y-axis.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, the resolution ratio of the touch-screen is m*n;It is described
M represents the Horizontal number of pixels of the touch-screen;The n represents the Vertical number of pixels of the touch-screen;The touch-screen is provided with
XOY axles;The XOY axles are using pixel as unit coordinate;Straight line of the touch-screen using X-axis coordinate as m/2 is that center line is divided
For left half screen and right half screen;The X-axis coordinate range of the left half screen is 0-m/2, and the X-axis coordinate range of the left half screen includes m/
2;The X-axis coordinate range of the right half screen is m/2-m, and the X-axis coordinate range of the right half screen does not include m/2;
Included using the touch-screen as the method for the key component:
Step a, the working condition of the smart mobile phone is switched to the mouse mode;
Step b, user clicks on the touch-screen;The judge module judges the type of the clicking operation of user;If
User clicks on the left half screen of the touch-screen, then what the judge module judged user's progress is to left mouse button
Clicking operation;
Step c, the judge module produces corresponding mouse action signal according to judged result;The judge module will
The mouse action signal is sent to the modular converter;
Step d, the modular converter according to the connected mode of the smart mobile phone and the outside electronic equipment, according to
Corresponding communication Protocol Conversion is into corresponding packet;The modular converter is sent the packet by the communication interface
Into the outside electronic equipment.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, in the step b, if user's click is described
The right half screen of touch-screen, then what the judge module judged user's progress is the clicking operation to right mouse button.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, the resolution ratio of the touch-screen is 480*800.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, in the step b, user clicks on described touch
When touching screen, the timing piece starts timing;When by default time interval t2When, user does not again tap on the touch
Screen, then what the judge module judged user's progress is single-click operation.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, when by the default time interval t2
When, user again taps on the touch-screen, then what the judge module judged user's progress is double click operation.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, the default time interval t2For 200 μ s.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, using the rear camera as described fixed
Position part;The photo of shooting is sent into the memory unit preservation by the rear camera by the way of being continuously shot;
The rear camera preserves the mode of the photo and covers previous photo preservation for latter photo;The rear camera
Gathering the method for the deformation trace of the smart mobile phone includes:
Step A, the working condition of the smart mobile phone is switched to the mouse mode;
Step B, the rear camera is continuously taken pictures;The judge module chooses the specific pixel on the photo shot
Point;The judge module judges the specific pixel point in the latter photo and the spy in the previous photo
Whether fixation vegetarian refreshments occurs change in location;If generation change in location, the judge module judges that position occurs for the smart mobile phone
Move;
Step C, the judge module records the change in location, and produces corresponding mouse action signal;It is described to judge
Module sends the mouse action signal to the modular converter;
Step D, the modular converter according to the connected mode of the smart mobile phone and the outside electronic equipment, according to
Corresponding communication Protocol Conversion is into corresponding packet;The modular converter is sent the packet by the communication interface
Into the outside electronic equipment;
Step E, repeating said steps B are to the step D, until the working condition of the smart mobile phone is switched to
The handset mode.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, in the step C, if specific pixel point
Change in location does not occur, then the judge module judges that the smart mobile phone is not subjected to displacement.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, pixel centered on the specific pixel point.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, the volume button includes volume and increases button
And volume-down keys;Using the volume button as a rotor block, the rotor block connects the judgement respectively
Module and the switching part;The rotor block is used for the roller function for realizing mouse;Institute is used as using the volume button
Stating the method for rotor block includes:
The working condition of the smart mobile phone is switched to the mouse mode;
User presses the volume increase button, and what the judge module judged user's progress is that roller is grasped upwards
Make;The judge module produces corresponding mouse action signal and sent to the modular converter;The modular converter is according to institute
Smart mobile phone is stated and the connected mode of the outside electronic equipment, according to corresponding communication Protocol Conversion into corresponding data
Bag;The modular converter is sent the packet into the outside electronic equipment by the communication interface;
User presses the volume-down keys, and what the judge module judged user's progress is that roller is grasped downwards
Make;The judge module produces corresponding mouse action signal and sent to the modular converter;The modular converter is according to institute
Smart mobile phone is stated and the connected mode of the outside electronic equipment, according to corresponding communication Protocol Conversion into corresponding data
Bag;The modular converter is sent the packet into the outside electronic equipment by the communication interface.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, a roller portion is used as using the touch-screen
Part, the rotor block connects the judge module and the switching part respectively;The rotor block is used to realize mouse
Roller function;Included using the touch-screen as the method for the rotor block:
The working condition of the smart mobile phone is switched to the mouse mode;
User's upward sliding on the touch-screen, what the judge module judged user's progress is that roller is grasped upwards
Make;The judge module produces corresponding mouse action signal and sent to the modular converter;The modular converter is according to institute
Smart mobile phone is stated and the connected mode of the outside electronic equipment, according to corresponding communication Protocol Conversion into corresponding data
Bag;The modular converter is sent the packet into the outside electronic equipment by the communication interface;
User's slide downward on the touch-screen, what the judge module judged user's progress is that roller is grasped downwards
Make;The judge module produces corresponding mouse action signal and sent to the modular converter;The modular converter is according to institute
Smart mobile phone is stated and the connected mode of the outside electronic equipment, according to corresponding communication Protocol Conversion into corresponding data
Bag;The modular converter is sent the packet into the outside electronic equipment by the communication interface.
It is preferred that, the method that mouse function should be realized on mobile phone, wherein, the communication interface is blue tooth interface or USB
Interface.
The beneficial effect of above-mentioned technical proposal is:Mouse function is incorporated on mobile phone, unnecessary device accessory is not added with,
Convenient use person operates mouse at any time, and the overall aesthetic feeling of mobile phone is not destroyed yet and comfort is used, is easy to user usually to manipulate
Electronic equipment.
Brief description of the drawings
Fig. 1 is the structural representation for the mobile phone that mouse function is realized in embodiments of the invention;
Fig. 2 is the schematic flow sheet of mobile phone displacement seizure in embodiments of the invention;
Fig. 3 is the implementation method schematic flow sheet of mobile phone analog mouse right and left key in embodiments of the invention.
Embodiment
The invention will be further described with specific embodiment below in conjunction with the accompanying drawings, but not as limiting to the invention.
As shown in figure 1, in an embodiment of the present invention, when realizing mouse function using mobile phone, the inside of mobile phone is specifically tied
Structure mainly includes:
One control unit, control unit is located at interior of mobile phone, in an embodiment of the present invention, using the micro-control of mobile phone in itself
Device processed is used as the control unit for realizing mouse function;Control unit can carry out realizing that the correlated judgment during mouse function is moved
Make, and to user input mouse coherent signal encode after send to outside electronic equipment.
Include judge module and modular converter inside control unit, judge module is responsible for realizing the phase during mouse function
Judgement is closed to act and generate corresponding mouse action signal;Modular converter is responsible for above-mentioned mouse action signal carrying out code conversion
Send afterwards to outside electronic equipment.Judge module connects modular converter.
One positioning element, positioning element is located at interior of mobile phone, in an embodiment of the present invention, using current smart mobile phone certainly
The gyroscope that body has completes the function of positioning element.Gyroscope can be used for the displacement data of monitoring mobile phone.The present invention's
In embodiment, the gyroscope of mobile phone can gather three-shaft displacement data(XYZ axles), but in actual applications, realize mouse function
The displacement data of required collection only changes in X-axis and Y-axis.Therefore, in embodiments of the invention, what gyroscope was gathered
Displacement data is Z=0, the data only changed in X-axis and Y-axis).
Key component, key component is physically located in mobile phone surface, in an embodiment of the present invention, using smart mobile phone in itself
The touch-screen having completes the keypress function of mouse.The touch-screen of mobile phone is divided into left and right two parts, left half of touch-screen
As the left button of mouse, right half of touch-screen as mouse right button.
Rotor block, rotor block is physically located in mobile phone surface, in an embodiment of the present invention, can use smart mobile phone
The touch-screen itself having completes the function of rotor block, it would however also be possible to employ the volume button that smart mobile phone has in itself come
Into the function of rotor block.
When realizing rotor block function using touch-screen, it is possible to use on the touchscreen whether controller detection user
Slide is carried out, and detects the direction of slide:If upward sliding, then the behaviour of rotor block upwards is accordingly transformed to
Make;If slide downward, then respective change is the operation of rotor block downwards.
When realizing rotor block function using volume button, it is possible to use the volume increase key that smart mobile phone has in itself
Reduce key to simulate the operation of rotor block up or down with volume.
One memory unit, memory unit is located at interior of mobile phone, in an embodiment of the present invention, is had using smart mobile phone itself
Some memory units complete the function of memory unit.Memory unit is used for the displacement data for preserving gyroscope collection.
The modular converter that judge module in control unit is connected in touch-screen and memory unit, control unit respectively passes through
One communication interface(The communication interface can be blue tooth interface or USB interface)Computer equipment outside connection, flat board is set
It is standby or other can apply the electronic equipment of mouse;Gyroscope connects the judge module of memory unit and control unit respectively.
One switching part, switching part is located at interior of mobile phone, and switching part is connected with gyroscope;Switching part supplies user
The current operating state of switch mobile phone between handset mode and mouse mode;In an embodiment of the present invention, it can use soft
The method of part control completes above-mentioned handoff functionality.User can be by specific embedded software in handset mode and mouse mode
Between switch mobile phone working condition, also can be in the electronic equipment outside mobile phone is connected by communication interface using in specific
Put software automatic start mouse mode.Switching part is connected with the judge module in controller.
One shooting part, shooting part is located at mobile phone surface, and is connected respectively with memory unit and judge module, connects simultaneously
Connect switching part;In an embodiment of the present invention, the rear camera that can be in itself carried using mobile phone completes institute in the application
The function for the shooting part stated.The rear camera is equally used for providing displacement data when mobile phone realizes mouse function.The position
Moving data is used for the displacement data that secondary gyroscope is provided, so that the running orbit of mouse is more accurate.Rear camera connects respectively
Connect judge module and memory unit.
One timing piece, the timing piece is connected with touch-screen, the click carried out on the touchscreen for distinguishing consumer
Operation is single-click operation or double click operation.
As shown in Fig. 2 when realizing mouse function using mobile phone, the most important is the displacement number of mouse movement to be caught
According to, and analyze on the track that displacement data produces mouse movement, the electronic equipment that the track is reflected in outside.Wherein specific stream
Journey includes:
Step 1, the working condition of mobile phone is switched to mouse mode;
Step 2, gyroscope collection displacement data, and the displacement data is labeled as displacement data A for the first time;Gyroscope will
In displacement data A deposit memory units;
Step 3, every time interval t1(In an embodiment of the present invention, time interval t1Give tacit consent to for cell phone system
200ms), the displacement data of a gyroscope mobile phone of collection;The displacement data is labeled as displacement data B by gyroscope, and by position
Data B is moved to send to the judge module of controller;
Step 4, judge module transfers the displacement data A in memory unit, and compares displacement data A and displacement data B;If
Displacement data B is equal with displacement data A, then judge module judges now to operate as mouse-over;If displacement data B and displacement number
Unequal according to A, then judge module judges that now user deposits displacement data B in mobile mouse, now judge module
Store up in part, displacement data B covers former displacement data A as new displacement data A;Judge module is recorded from displacement simultaneously
The track that the mouse of data A position to displacement data B position is moved;
Step 5, judge module produces corresponding mouse action signal and sent to modulus of conversion according to above-mentioned judged result
Block;
Step 6, modular converter, will according to corresponding consensus standard according to the connected mode of mobile phone and outside electronic equipment
Mouse action signal is converted to corresponding packet and sent to the electronic equipment of the outside;
Step 7, repeat step 3- steps 6, untill the working condition of mobile phone is switched to handset mode.
In another embodiment of the present invention, displacement of the above-mentioned gyroscope to mouse can be substituted using shooting part
Track is acquired:
One shooting part, positioned at mobile phone surface, and is connected with memory unit and judge module respectively, while connecting switching part
Part;In an embodiment of the present invention, the rear camera that can be in itself carried using mobile phone completes the function of above-mentioned shooting part.
The rear camera is equally used for providing displacement data when mobile phone realizes mouse function.Rear camera distinguishes connection judgment mould
Block and memory unit.
When positioning the deformation trace of mouse by rear camera, its flow is similar to using gyroscope positioning:
The working condition of mobile phone is switched to mouse mode;
Rear camera collection displacement data method be specially:Rear camera is by automatically continuously taking pictures, by photo
Data are stored in memory unit;Rear camera preserves the mode of photo and covers previous photo for latter photo;Judge
Module selects specific one pixel in photo(In an embodiment of the present invention, pixel centered on the pixel), and
Compare the situation of specific pixel point in front and rear two photos;If in front and rear two photos, the position of specific pixel point is not sent out
Changing, then now mouse is in floating state for judge module judgement;If the position hair of specific pixel point in front and rear two photos
Change is given birth to, then judge module judges that now mouse there occurs displacement;Judge module produces corresponding according to above-mentioned judged result
Mouse action signal is simultaneously sent to modular converter;Modular converter according to the connected mode of mobile phone and outside electronic equipment, according to
Mouse action signal is converted to corresponding packet and sent to the electronic equipment of the outside by corresponding consensus standard.
In an embodiment of the present invention, it would however also be possible to employ above-mentioned gyroscope and rear camera and the method deposited is to mouse
Deformation trace is acquired;The collection result of above two implementation method should be consistent in theory, and allow generation one
Determine the error in scope.
As shown in figure 3, in an embodiment of the present invention, the left and right press key function of mouse is realized using the touch-screen of mobile phone
When, by taking the touch-screen of 480*800 resolution ratio as an example, the unit coordinate that the touch-screen is provided with XOY axles, XOY axles, which corresponds to, to be touched
Touch the resolution ratio of screen;Touch-screen provided with XOY axles is divided into left screen region and right screen region.Mouse is realized on the touch-screen of mobile phone
The idiographic flow of target right and left key function includes:
Step a, user carries out clicking operation on the touchscreen;The judge module of control unit judges that user clicks on position
The coordinate put:
If the X-axis coordinate of click location falls in 0-240(Including 240)In interval, Y-axis coordinate falls in 0-800 is interval, then
Judge that the click location is located at the left screen region of touch-screen, what user was carried out is the clicking operation of left button;
If the X-axis coordinate of click location falls in 240-480(Do not include 240)In interval, Y-axis coordinate falls interval in 0-800
It is interior, then judge that click location is located at the right screen region of touch-screen, what user was carried out is the clicking operation of right button;
Step b, judge module generates corresponding mouse action signal according to above-mentioned judged result and sent to modular converter;
Step c, modular converter, will according to corresponding consensus standard according to the connected mode of mobile phone and outside electronic equipment
Mouse action signal is converted to corresponding packet and sent to the electronic equipment of the outside.
When user's first time point touching screen, the timing piece being connected with touch-screen starts timing, works as timing time
Reach time interval t2When, user does not still carry out second of clicking operation, then judge user's progress is to click behaviour
Make;Conversely, judge user's progress is double click operation.In an embodiment of the present invention, time interval t2For 200 μ s.Sentence
Disconnected module generates corresponding mouse action signal according to above-mentioned judged result and sent to modular converter;Modular converter is according to mobile phone
With the connected mode of outside electronic equipment, mouse action signal is converted into corresponding packet according to corresponding consensus standard
And send to the electronic equipment of the outside.
Preferred embodiments of the present invention are the foregoing is only, embodiments of the present invention and protection model is not thereby limited
Enclose, to those skilled in the art, should can appreciate that made by all utilization description of the invention and diagramatic content
Scheme obtained by equivalent substitution and obvious change, should be included in protection scope of the present invention.