Background technology
Along with the develop rapidly of mobile terminal hardware technology, more and more novel, the new function that is full of intention is introduced into mobile phone terminal field, has strengthened the practicality of mobile phone and recreational, for user brings abundanter operating experience and enjoyment.
Gravity sensing function is exactly so a kind of new technology function.Realize gravity sensing function, first need in mobile phone terminal, implant gravity sensor, be called again acceleration transducer.Gravity sensor is the gravity of object or accelerated motion signal to be converted to the transducer of the signal of telecommunication, is mainly used in inclination angle, inertia force, impact and vibrates isoparametric measurement.Most acceleration transducers are to carry out work according to the principle of piezoelectric effect.Piezoelectric effect refers to, for the heteropolar crystal that does not have symmetrical centre, be added in the external force on crystal, except making crystal generation deformation, also the polarized state of crystal will be changed because of this deformation, at crystals, set up electric field, this phenomenon that makes medium that polarization occur due to mechanical force is called direct piezoelectric effect.General acceleration transducer is exactly this characteristic of crystal modification causing due to acceleration of having utilized its inside.Because this distortion can produce voltage, as long as calculate the relation between the acceleration that voltage and power produces, just can degree of will speed up signal change into voltage signal and export.The mobile phone terminal 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 phone terminal.
By implant gravity sensor in mobile phone terminal, for it has brought the function of a series of novelties, for example there is the following application scenarios:
Mobile phone turn-to-mute function.Cellphone subscriber often can be in a rush because of incoming call quarter-bell in session time, do not want to receive calls, but it is very tired owing to shyly hanging up the telephone, can be disturbed by making noise by the tinkle of bells, even can have influence on other people.In the case, turn-to-mute function just can allow the cellphone subscriber by the action of simple upset mobile phone, by the ring tone change of tune, be only quiet.
Mobile phone whipping switches picture or music.When cellphone subscriber listens to the music by player or pass through Photo Browser browsing pictures, may can't come round to the idea touch-screen or keyboard and just can easily realize the switching of picture and song.By the whipping function of gravity sensor, as long as simply mobile phone can be realized to this switching towards fixed-direction whipping.
Mobile phone horizontal/vertical screen automatically switches.When user uses mobile phone browsing pictures or PPT document, may need automatically to adjust screen orientation according to the length and width direction of picture or document, allow picture or document full frame optimization show.The horizontal/vertical screen automatic switching function of mobile phone can help user to realize above-mentioned functions.As long as by mobile phone clockwise or be rotated counterclockwise certain angle, screen orientation can corresponding switching and conveniently browse.
Conventionally, the horizontal/vertical screen automatic switching function of mobile phone is need in the application program of this automatic switching function, add corresponding gravity sensing function module at each, accepts and process gravity sensor to drive message or the event of sending.This method had both caused the redundancy of block code, had also increased system burden simultaneously.Because Windows Mobile operating system is a multiple task operating system, when the program of moving is more, corresponding concurrent scene is also a lot, and the application program of energy Rotation screen may interact, make system screen direction disorderly, be easy to produce the phenomenons such as flower screen or mobile phone be seemingly-dead.So many mobile phones support number of applications that horizontal/vertical screens automatically switch seldom, be conventionally restricted to one or two kind.
Summary of the invention
Technical problem to be solved by this invention is to provide a kind of method and mobile terminal thereof of application of weight inducing function, can make the application module quantity of application of weight inducing function in mobile terminal unrestricted.
In order to solve the problems of the technologies described above, the invention provides a kind of method of application of weight inducing function, comprising:
Mobile terminal loads a service software, by the gravity sensing event of this service software monitoring mobile terminal and/or the dependent event of application of weight induction, and support the application module of gravity sensing function and current operation to realize corresponding state switching according to the event control monitoring.
Further, the method specifically comprises:
Described service software obtains the current state of described application module, when monitoring the dependent event generation of described gravity sensing event and/or application of weight induction, if judge, described application module is provided with described gravity sensing function, described application module is switched to corresponding another state from described current state.
Further, described gravity sensing event is by the monitor signal output of gravity sensor; The dependent event of described application of weight induction refers to the windows exchange event of the application module relevant to horizontal/vertical screen handoff functionality;
The current state that described service software gets described application module is the screen orientation of described application module current window, when having monitored described gravity sensing event, occur, or monitored described windows exchange event and occurred, if judge, described application module is provided with described horizontal/vertical screen automatic switching function, described application module is rotated to the hand-held direction of user from the screen orientation of described current window.
Further,
When described service software has monitored described gravity sensing event generation, if judge, described application module does not arrange described horizontal/vertical screen automatic switching function, keeps the screen orientation of the described current window of described application module; Or, when described service software has monitored described application module windows exchange event generation, if judge, described application module does not arrange described horizontal/vertical screen automatic switching function, described application module is rotated to the direction that user manually arranges from the screen orientation of described current window.
Further, the method also comprises:
The interface that described mobile terminal provides described application module that the switch of gravity sensing function is set, and the switch value of the described gravity sensing function arranging is kept in registration table; Described service software reads the switch value in described registration table before the switching of carrying out described state, to know whether the application module of described current operation is provided with described gravity sensing function.
In order to solve the problems of the technologies described above, the invention provides a kind of mobile terminal of application of weight inducing function, comprise obtain/handover module of interconnective state and gravity sensing event monitoring module, wherein:
Obtain/handover module of state, for according to the event occurring indication of gravity sensing event monitoring module output, controls and supports the application module of gravity sensing function and current operation to realize corresponding state switching;
Gravity sensing event monitoring module, for after monitoring the gravity sensing event of mobile terminal and/or the dependent event of application of weight induction, indicates to obtain/handover module of state outgoing event.
Further, this mobile terminal also comprises that gravity sensing function arranges module; Wherein:
Gravity sensing function arranges module, for providing application module that the interface of the switch of gravity sensing function and application thereof is set;
Obtain/handover module of state obtains the current state of application module, after incoming event is indicated, if judgement application module is provided with gravity sensing function, application module is switched to corresponding another state from current state.
Further,
The current state of the application module that obtain/handover module of state obtains is the screen orientation of application module current window, the first screen orientation rotation indication according to the output of gravity sensing event monitoring module, rotates to the hand-held direction of user by application module from the screen orientation of current window;
Gravity sensing event monitoring module is when the monitor signal output by gravity sensor occurs to gravity sensing event, or the windows exchange event that monitors application module occurs, if judgement application module is provided with horizontal/vertical screen automatic switching function, to obtain/handover module of state, export the first screen orientation rotation indication.
Further,
Obtain/handover module of state, according to the second screen orientation rotation indication of gravity sensing event monitoring module output, rotates to from the screen orientation of described current window the direction that user manually arranges by application module;
Gravity sensing event monitoring module monitors when having window handover event to occur, if judgement application module does not arrange described horizontal/vertical screen automatic switching function, is exported the second screen orientation rotation indication to obtain/handover module of state.
Further,
Gravity sensing function arranges module, and the switch value of the gravity sensing function of setting is kept in registration table;
Obtain/handover module of state reads the switch value in this registration table before the switching of carrying out state, to know whether the application module of current operation is provided with gravity sensing function.
The method of application of weight inducing function of the present invention and mobile terminal thereof, with the technical scheme that was all added with corresponding functional module in the application module that respectively needs gravity sensing function in the past, compare, owing to using this gravity sensing function by a service routine integrated management and all application modules of gravity sensing function that need of control, therefore make the application module quantity of application of weight inducing function unrestricted, also avoided the redundancy of block code, and can not increase system burden simultaneously.
Particularly for the application module that need to use horizontal/vertical screen handoff functionality, can as in the past, not interact, therefore can avoid system screen direction disorderly and produce flower screen or the fault such as mobile phone is seemingly-dead, and can support as much as possible the application module that each need to this horizontal/vertical screen handoff functionality, mobile terminal can indiscriminately ad. as one wishes be used in user's hand, greatly increased thus user's experience.
Embodiment
Mobile terminal of the present invention and application of weight inducing function thereof are realized the method automatically switching, basic conception is, utilize a service software as management and the control centre of application of weight inducing function, the gravity sensing event of monitoring perception terminal in when start is loaded in mobile terminal, comes application module current operation and that be provided with application of weight inducing function in control terminal to realize the switching of corresponding state with this.
Below in conjunction with accompanying drawing and preferred embodiment, technical scheme of the present invention is at length set forth.The embodiment below exemplifying is only for description and interpretation the present invention, and do not form the restriction to technical solution of the present invention.
As shown in Figure 1, be the embodiment of the method flow chart of application of weight inducing function of the present invention.Application of weight inducing function of the present invention is realized the method for application function state auto-switching, any one that can be applied in mobile phone terminal, palmtop PC, personal digital assistant (PDA, Personal Digital Assistant), digital camera and MP4 under Windows Mobile operating system need to be used on the portable mobile termianl of screen.By usining, be applied in mobile phone terminal under Windows Mobile operating system as embodiment below, said method of the present invention is described in detail, the step of this embodiment is carried out after mobile phone terminal opening, comprising:
110: loading service program;
At present, nearly all Pocket PC developer be all create an executable file and by the shortcut of this document be put into Windows in StartUp, after system is restarted, just can start like this this program at running background.In view of the number of processes in Windows CE is restricted to 32, Microsoft has proposed a solution of this problem that limited process runs application: support that as different threads, operating in a DLL service routine in process solves operation number of processes restricted problem.In windows Mobile (WM) 6.0, service routine is embodied as Dll file.After the windows directory of the Dll file compiling access arrangement of service routine, at registration table, add corresponding information; After starting device, WM just can load corresponding Dll file according to arranging of registration table by services.exe process, thereby starts service routine.At this, service routine is all to exist as the thread of services.exe.
Service unit of the present invention is also realized by operation service program, and this service routine is loaded after start.
120: the current state of obtaining the application module of front stage operation;
The current state of the MP3 music playing module that for example foreground is being moved is the title of a song.Again for example, the current state of the communication incoming call module that foreground is being moved is bell sound and/or vibration, etc.
130: whether monitoring has the dependent event of gravity sensing event and/or application of weight induction to occur, and is to carry out the following step, otherwise return to step 130, proceeds monitoring;
At this, gravity sensing event is by the monitor signal output of mobile phone terminal perception gravity sensor.The dependent event of application of weight induction is for example switched relevant current window handover event to horizontal/vertical screen, etc.
140: to judging whether the application module of foreground motion supports gravity sensing function, is to carry out corresponding the following step, proceeds monitoring otherwise return to step 130;
In order to control better gravity sensing function, strengthen user and experience, the present invention is provided with respectively switch for the application module of each support gravity sensing, and it arranges interface as shown in Figure 2.Each application module is kept in registration table the switching information of gravity sensing function, service routine of the present invention before each switching, all go to read registration table in these switch values, the application module of only opening switch is just regarded as supporting gravity sensing function.And, when gravity sensing function is set, can carry out necessary calibration to this function.
150: the state of the application module of front stage operation is switched to another state, then returns to step 120 and carry out.
For example the state of the MP3 music playing module of front stage operation and support gravity sensing function is switched to the title of a song.Again for example, foreground is being moved and is being supported the state of the communication incoming call module of gravity sensing function is switched to quiet, etc.
By above method step, can find out, service unit of the present invention is after being loaded, by the Infinite Cyclic application module of monitor terminal front stage operation always, and reach the object automatically switching to being provided with the state of the application module of gravity sensing function according to the gravity sensing event monitoring.
Said method of the present invention is compared with the scheme of adding corresponding code in each needs the application module of application of weight inducing function in the past, obviously can greatly reduce the redundancy of block code, also reduced significantly system burden simultaneously, and neither can make the application of the gravity sensing function of each application module influence each other, also can not make the number of modules of application of weight inducing function restricted.
Below the application example automatically switching by mobile phone terminal gravity sensing horizontal/vertical screen again, represents in more detail to technical scheme of the present invention.The flow process of this application example as shown in Figure 3, is carried out after mobile phone terminal opening, comprises the steps:
210: loading service program;
At the service routine of this loading, be equivalent to the control centre of whole system screen orientation.
220: the screen orientation that obtains the application module window of front stage operation;
In order to control better gravity sensing horizontal/vertical screen automatic switching function, strengthen user and experience, the present invention supports application of gravity sensing horizontal/vertical screen automatic switchover for each can arrange respectively switch.Switching information will be kept in registration table, service routine of the present invention before each switching, all can go to read registration table in these switch values, only have and just remove to switch its screen orientation to opening the application module of switch.If all switches, all in closed condition, will cut out gravity sensor power supply, can save thus the power consumption of system.
In fact horizontal/vertical screen switching comprises two parts content: without the horizontal/vertical screen that switches action, switch and have the horizontal/vertical screen of switching action to switch, by opening two sub-threads, processing respectively them.
Wherein, without the horizontal/vertical screen that switches action, switch and mainly refer to: when the window of the application module switching from support horizontal/vertical screen returns to the window of the application module of not supporting that horizontal/vertical screen switches, screen orientation can change.To this, by the variation of current active program items in monitoring registration table, know that variation has occurred foreground window.When foreground window changes, if current window belongs to the application module of supporting that horizontal/vertical screen switches, screen rotation is arrived to the hand-held direction of user, otherwise the direction that screen rotation is manually arranged to system.Processing this sub-thread switching without the horizontal/vertical screen that switches action comprises the steps:
2301: whether monitor current foreground window and switch, be to carry out the following step, otherwise return to step 2301 step, carry out;
2401: judge whether this foreground window belongs to the application module of supporting that horizontal/vertical screen automatically switches, is to carry out the following step, otherwise execution step 2502;
2501: current window is rotated to be to the hand-held direction of user, return to step 220 and carry out;
2502: by current window rotate to be system setting party to, return to step 220 and carry out.
A feature of the present invention be exactly retained that Microsoft Windows Mobile operating system carries can screen orientation (be system setting party to) function be manually set by user.General gravity sensing horizontal/vertical screen automatic switchover scheme, in order not produce conflict, has all been canceled the manual setting that Microsoft carries (being system setting) function.And service routine of the present invention is considered this scene, allow them in the situation that not clashing, coexist.
For there being the horizontal/vertical screen that switches action to switch, by monitoring gravity sensing event (signal of exporting by gravity sensor), realize.When switching action, produce, gravity sensor can be exported corresponding signal, and mobile phone terminal is received after this gravity sensing event, judges whether current window belongs to the application module of supporting that horizontal/vertical screen switches, be screen rotation to be arrived to the hand-held direction of user, otherwise do not need to do any processing.So just realized the automatic switchover of the screen orientation under various scenes.Processing this has another sub-thread of the horizontal/vertical screen switching of switching action to comprise the steps:
2302: whether monitoring has gravity sensing event to occur, and is to carry out the following step, otherwise return to step 2302, continue monitoring;
2402: judge whether this foreground window belongs to the application module of supporting that horizontal/vertical screen automatically switches, is to carry out the following step, otherwise return to step 2302, carry out;
2503: current window is rotated to be to the hand-held direction of user, return to step 220 and carry out.
Service routine of the present invention shown in Fig. 3, after being loaded, is monitored the screen orientation with whole system by wireless circulating and multithreading always, reaches the object that horizontal/vertical screen automatically switches.This service routine is owing to only need to judging front stage operation window, and by this service routine unified management screen orientation, therefore solved well the problem of screen orientation disorder when the concurrent horizontal/vertical screen of each application module automatically switches.Therefore the present invention can indiscriminately ad. as one wishes increase the quantity of supporting horizontal/vertical screen switch application module and the fault of not worrying screen orientation disorder.Simultaneously this invent maximum feature be retained that Microsoft Windows Mobile operating system carries screen orientation function is manually set, user can be selected according to personal like more neatly, therefore there is very high practicality.
This example has also been introduced rotation prompt facility.When user does not open gravity sensing function and during rotating mobile, the driving of bottom gravity sensor can perceive this action and by the event upper strata of throwing to.If receive this event in the application module of supporting rotation, whether monitoring thread will eject prompting inquiry user needs to open gravity sensing horizontal/vertical screen handoff functionality.This function at any time reminding user is opened horizontal/vertical screen automatic rotation function, allows user's browsing information in the best way.
The present invention is according to said method embodiment, the mobile terminal embodiment of application of weight inducing function is also correspondingly proposed, its structure as shown in Figure 4, this mobile terminal 300 comprises that the gravity sensing function connecting successively arranges module 310, obtain/handover module of state 320 and gravity sensing event monitoring module 330, wherein:
Gravity sensing function arranges module 310, for the interface of each application module that application of weight inducing function is set is provided, and writes in terminal system registration table and preserves result is set;
What gravity sensing function arranged that module 310 provides arranges interface as shown in Figure 2.
Obtain/handover module of state 320, for obtaining the current state of the application module of terminal front stage operation, according to event occurring indication and the reading from registration table of 330 outputs of gravity sensing event monitoring module, result is set, if the application module of judgement front stage operation is provided with gravity sensing function and application thereof, this application module is switched to another state from current state; If the application module of judgement front stage operation does not arrange gravity sensing function and application thereof, keep the current state of this application module;
Gravity sensing event monitoring module 330, for after monitoring the dependent event of gravity sensing event and/or application of weight induction, indicates to obtain/handover module of state 320 outgoing events.
Gravity sensing event monitoring module 330 is by the monitor signal output gravity sensing event of gravity sensor.The dependent event of application of weight induction for example refers to switch relevant current window handover event to horizontal/vertical screen.
Obtain/handover module of state 320 for example obtains the current window screen orientation of the application module of terminal front stage operation, if judgement foreground window switches, at judgement current window, belong to and support after horizontal/vertical screen application module, the screen orientation of current window is switched to the hand-held direction of user, if judgement current window does not belong to, support after horizontal/vertical screen application module, current window is switched to system setting party to (be the manual setting party of user to); Or according to the result that arranges of the event occurring indication of gravity sensing event monitoring module 330 outputs and the application module that reads corresponding front stage operation from registration table, if the application module of judgement front stage operation is provided with the horizontal/vertical screen automatic switching function of application of weight induction, this application module is switched to the hand-held direction of user from the screen orientation of current window; If the application module of judgement front stage operation does not arrange horizontal/vertical screen automatic switching function, keep the screen orientation of this application module current window.
Certainly, the present invention also can have other numerous embodiments, as used under other platforms such as Android (mobile phone operating system of increasing income based on Linux platform of Google exploitation), QT (the cross-platform graphical user interface GUI framework based on C Plus Plus).In the situation that not deviating from spirit of the present invention and essence thereof, those of ordinary skill in the art are when making according to the present invention various corresponding changes and distortion, but these corresponding changes and distortion all should belong to the protection range of the appended claim of the present invention.