A kind of control method of computer events and device
Technical field
The present invention relates to the user interaction techniques field, more specifically, relate to a kind of control method and device of computer events.
Background technology
Along with the development of technology, it is abundant that people live, and mobile media has become the requisite instrument of people.Traditional people and computer interactive are by mouse and these common tools of keyboard.The mobile devices such as mobile phone, panel computer have become popular consumer goods now, and mobile device has been penetrated in people's work and life.We are in computing machine in a lot of pages, if page turning is clicked page-turning button by keyboard input command or mouse and realized.The form of this page turning is traditional page turning form.
Gravity sensor generally is applied in mobile phone, panel computer.Gravity sensor is the gravity of object or accelerated motion signal to be converted to the inductor of electric signal, is mainly used in pitch angle, inertial force, impact and vibrates isoparametric measurement.Most gravity sensors are the principle work according to piezoelectric effect.Piezoelectric effect refers to, is added in external force on crystal for the heteropolar crystal that does not have symcenter, thinks except making crystal generation deformation, also will change the polarized state of crystal because of this deformation, set up electric field at crystals.This phenomenon that makes medium that polarization occur due to mechanical force is called direct piezo electric effect.General acceleration induction device is exactly this characteristic of crystal modification that causes due to acceleration of having utilized its inside.Because distortion can produce voltage, as long as calculate relation between the acceleration that voltage and power produces, just can degree of will speed up signal be converted into voltage signal and export.The mobile device of implantation gravity sensor is by analyzing the voltage signal data of gravity sensor output, with regard to the motion state of energy perception mobile device.
The mobile device of implanting gravity sensor can be used in game, and the function of mobile device operation system is used etc.For example, utilize gravity sensor to make game, utilize gravity sensor to realize some action of mobile device etc.These application can increase the practicality of mobile device and recreational, for the user brings abundanter operating experience and enjoyment.But present this application also only can realize in mobile device, can not pass through computer realization.
Summary of the invention
Purpose of the present invention overcomes the deficiencies in the prior art exactly, and a kind of control method and device of gravity sensor computer events that computer events is operated that can be by mobile device is provided.Can realize the operation of computer events by gravity sensor, enrich user's experience, also open up the another kind of application mode of gravity sensor.
In order to achieve the above object, adopt following technical scheme:
A kind of control device of computer events comprises communication module, is used for setting up the gravity sensor event and is connected communication with computer events and connects; Interactive module is for the interactive command of setting computer events corresponding to gravity sensor event; Trapping module is used for catching the gravity sensor event; Trigger module is used for computer events corresponding to computing machine response gravity sensor event.
Further, described communication module comprises the debugging bridge of being located at computing machine, and it is used to specify the port of the mobile device that is connected with computing machine, and is redirected this port to the PORT COM of computing machine, sets up computing machine and is connected with the communication of mobile device.
Further, described trapping module comprises measuring unit, be used for to measure a plane transverse axis take gravity sensor place mobile device as X-axis, and vertical pivot is Y-axis, and vertical normal is the movement velocity of three axles of Z axis; Computing unit be used for to calculate the root of quadratic sum of the movement velocity of X-axis, Y-axis, Z axis; Whether judging unit is used for judging described root greater than default threshold speed, if, the gravity sensor Event triggered.
Further, described interactive command comprises the page page turning of the computer software corresponding with the gravity sensor event.
Further, the page of described computer software comprises an above subpage frame, and described subpage frame comprises word or pictorial information, and described information is extracted from default information database at random.
A kind of control method of computer events comprises the following steps:
Set the interactive command of computer events corresponding to gravity sensor event;
Setting up the gravity sensor event is connected communication and connects with computer events;
Catch the gravity sensor event;
The corresponding computer events of computing machine response gravity sensor event.
Further, the interactive command of computer events corresponding to described setting gravity sensor event comprises the page page turn over operation of setting computer software corresponding to gravity sensor event.
Further, the page of described computer software comprises an above subpage frame, and described subpage frame comprises word or pictorial information, and described information is extracted from default information database at random.
Further, the described gravity sensor event of setting up is connected communication and is connected and to comprise the following steps with computer events: the PORT COM of specifying the mobile device that is connected with computing machine by the debugging bridge, and be redirected this port to the PORT COM of computing machine, set up computing machine and be connected with the communication of mobile device.
Further, the described gravity sensor event of catching comprises the following steps:
Take a plane transverse axis of gravity sensor place mobile device as X-axis, vertical pivot is Y-axis, and vertical normal is that Z axis is set up three-dimensional coordinate, measures respectively mobile device in the movement velocity of X-axis, Y-axis, Z axis;
The root of the quadratic sum of the movement velocity of calculating X-axis, Y-axis, Z axis;
Whether judge described root greater than default threshold speed, if, the gravity sensor Event triggered.
Compared with prior art, beneficial effect of the present invention is:
The present invention realizes the gravity sensor control computing machine of mobile device or the operation of computer software appointment by setting up the annexation of mobile device and computing machine.Get around tradition and realized the operation of computing machine or computer software required movement by mouse or keyboard or touch-screen, increased the practicality of mobile device and recreational, for the user brings abundanter operating experience and enjoyment.
Description of drawings
Fig. 1 is computer events control device structural representation of the present invention;
Fig. 2 is that the page of a computer software is connected the schematic diagram of controlling with mobile device;
Fig. 3 is the flow chart of steps of computer events control method of the present invention.
Diagram: 1-communication module; 2-interactive module; 3-trapping module; 31-measuring unit; 32-computing unit;
33-judging unit; 4-trigger module; 5-page; 51-subpage frame; 6-mobile device; 7-main frame;
8-display screen.
Embodiment
Describe the present invention in detail below in conjunction with accompanying drawing and specific implementation method, be used for explaining the present invention in schematic enforcement of the present invention and explanation, but not as a limitation of the invention.
See also Fig. 1, it is the control device of the computer events of the present embodiment, comprises communication module 1, interactive module 2, trapping module 3 and trigger module 4.Described communication module 1 comprises the debugging bridge (ADB) of being located at computing machine, and it is used to specify the port of the mobile device that is connected with computing machine, and is redirected this port to the PORT COM of computing machine, sets up computing machine and is connected with the communication of mobile device.The English full name of " ADB " is " Android Debug Bridge ", is an inner instrument of Android SDK (Software Development Kit) (Android SDK), can direct control management Android simulator or real Android equipment with this instrument.SDK(Software Development Kit, i.e. SDK (Software Development Kit)).Can debug the Android program by DDMS in Eclipse by ADB, actual is exactly the program debugging instrument.But Eclipse is an open source code, based on the regarded as output controlling platform of Java.The working method of ADB is more special, and mode that adopt to monitor the ports such as Socket TCP5554 allows IDE and Qemu communication, and under default situations, ADB can the relevant network port of daemon, so the ADB process will be moved automatically when moving Eclipse.The Daemon program is called again finger daemon, usually at system's backstage long-play, can't be mutual with the foreground owing to there is no control terminal, and the Daemon program is generally used as system service.By the ADB instrument, can management equipment or the state of mobile phone simulator, can also carry out a lot of mobile phone operations, as mounting software, system upgrade, operation shell-command etc.Letter and putting into words in fact, ADB connects Android equipment and the bridge that PC holds, and can allow the user on computers mobile phone comprehensively be operated.
By the ADB instrument, the port redirection of appointment mobile device is assigned to a PORT COM of computing machine.The order of using is as follows: " adb.exe-s HT23PRX04987-5554 forward tcp:HT23PRX04987-55544939 " wherein adb.exe is the Android debugging bridge that the Android kit carries, and is used for and the Android devices communicating.The title that " HT23PRX04987-5554 " refers to mobile device with and port, namely mobile device HT23PRX04987's passes through port 5554 and computer communication." 4939 " are the PORT COM of computing machine.By the designated communication port, realize that mobile device is connected communication and connects with computing machine.Set up after communication connects, by ADB instrument start-up trapping module 3, instruction type is as follows: adb.exe-s[mobile device name] the bag name of shell amstartservice-n[APK]/[run function of corresponding A PK program].Be exemplified below: adb.exe-sHT23PRX04987 shell am startservice – n " com.ijinshan.ShouJiKong.AndroidDaemon/.DaemonService ".After starting trapping module 3, trapping module 3 is measured the movement velocity of mobile device by measuring unit 31.Wherein take a plane transverse axis of gravity sensor place mobile device as X-axis, vertical pivot is Y-axis, and the vertical normal on this plane is that Z axis is set up coordinate axis.Described plane is plane, display screen place.The movement velocity of three axles of measuring by existing measuring method.After measuring the movement velocity of three axles, calculate the root of quadratic sum of the movement velocity of X-axis, Y-axis, Z axis by computing unit 32.After calculating root, whether judge described root greater than default threshold speed by judging unit 33, if trigger the gravity sensor event by communication module 1 notification triggers module 4.Simultaneously, interactive module 2 computer events that the gravity sensor event is corresponding sends to trigger module, triggers this computer events by computing machine.Described computer events includes but not limited to the page page turn over operation of computer software.
See also Fig. 2, it is that the page of a computer software is connected the schematic diagram of controlling with mobile device.Mobile device 6 is connected with display screen 8 by main frame 7.The page 5 of described computer software comprises several subpage frames 51, and the content that each subpage frame 51 is showed is different.When mobile device shakes, trapping module is caught when triggering the gravity sensor event, and trigger pip is sent to computing machine, and the page 5 that computing machine is corresponding skips to the new page, several subpage frames have been comprised in new page, the content random display of each subpage frame.Subpage frame comprises word or pictorial information, and these information obtain from information database at random.These subpage frames comprise introduction and the link of application software.The user just can realize the page turning of the page by shaking mobile device, is different from traditional mouse click or keyboard and clicks.Described computer events includes but not limited to the page turning of the page.
See also Fig. 3, it is the control method of computer events of the present invention, and it comprises the following steps:
S10: the interactive command of setting computer events corresponding to gravity sensor event.
Particularly, by setting the corresponding relation of gravity sensor event and computer events, by gravity sensor Event triggered computer events.Utilize the former trigger condition of the gravity sensor event replacement computer events of mobile device, realize that the gravity sensor event is to the control of computer events.For example, a computer software, it has a plurality of pages, and the page turning sign of clicking the page by mouse triggers the page turning action.Set gravity sensor event and mouse and click the corresponding relation of the page turning sign of the page, use the gravity sensor event to substitute the order that mouse is clicked the page turning sign of the page.With after computing machine is connected, trigger the page turning action of computer software when mobile device by the gravity sensor sense events.
S20: set up the gravity sensor event and be connected communication with computer events and connect.
Particularly, by the ADB instrument, the port redirection of appointment mobile device is assigned to a PORT COM of computing machine.The order of using is as follows: " adb.exe-s HT23PRX04987-5554 forward tcp:HT23PRX04987-55544939 " wherein adb.exe is the Android debugging bridge that the Android kit carries, and is used for and the Android devices communicating.The title that " HT23PRX04987-5554 " refers to mobile device with and port, namely mobile device HT23PRX04987's passes through port 5554 and computer communication." 4939 " are the PORT COM of computing machine.By the designated communication port, realize that mobile device is connected communication and connects with computing machine.After realizing mobile device and computer communication being connected, start the action of catching the gravity sensor event.Use instruction type as follows by the ADB instrument: adb.exe-s[mobile device name] the bag name of shell am startservice-n[APK]/[run function of corresponding A PK program], can start the gravity sensor event of catching.
S30: catch the gravity sensor event.
Particularly, the described gravity sensor event of catching comprises the following steps:
S301: take a plane transverse axis of gravity sensor place mobile device as X-axis, vertical pivot is Y-axis, and vertical normal is that Z axis is set up three-dimensional coordinate, measures respectively mobile device in the movement velocity of X-axis, Y-axis, Z axis.
Described plane is plane, display screen place.The movement velocity of measuring X-axis, Y-axis, Z axis can realize by existing technology.
S302: the root of the quadratic sum of the movement velocity of calculating X-axis, Y-axis, Z axis.
After the movement velocity that obtains three axles, the root of the quadratic sum of the movement velocity of calculating three axles.Square sum of each axle movement velocity is opened radical sign more just can obtain described root.
S303: whether judge described root greater than default threshold speed, if, the gravity sensor Event triggered.
Set a threshold speed, if less than this threshold value, the gravity sensor event does not trigger, if greater than this threshold speed, and gravity sensor Event triggered.
S40: computer events corresponding to computing machine response gravity sensor event.
Particularly, after capturing the gravity sensor event, computer events corresponding to computing machine response gravity sensor event.Described computer events includes but not limited to the page turn over operation of the page of computer software.Also comprise the operations such as preservation, sectional drawing.Preferably, the page of described computer software comprises an above subpage frame, and described subpage frame comprises word or pictorial information, and described information is extracted from default information database at random.Substitute by the gravity sensor event action that mouse is clicked the page turning sign, realize page turn over operation, thereby increased the interest of mobile device, avoided clicking the mouse or fatigue that operation keyboard brings.The action triggers page turn over operation of mobile device is shaken in utilization, for the user brings abundanter operating experience and enjoyment.
The above technical scheme that the embodiment of the present invention is provided is described in detail, used specific case herein principle and the embodiment of the embodiment of the present invention are set forth, the explanation of above embodiment is only applicable to help to understand the principle of the embodiment of the present invention; Simultaneously, for one of ordinary skill in the art, according to the embodiment of the present invention, all will change on embodiment and range of application, in sum, this description should not be construed as limitation of the present invention.