CN105975090A - Control method, device and mobile terminal for reporting event by proximity sensor - Google Patents
Control method, device and mobile terminal for reporting event by proximity sensor Download PDFInfo
- Publication number
- CN105975090A CN105975090A CN201610454111.9A CN201610454111A CN105975090A CN 105975090 A CN105975090 A CN 105975090A CN 201610454111 A CN201610454111 A CN 201610454111A CN 105975090 A CN105975090 A CN 105975090A
- Authority
- CN
- China
- Prior art keywords
- event information
- event
- proximity sensor
- mobile terminal
- preset time
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M1/00—Substation equipment, e.g. for use by subscribers
- H04M1/72—Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
- H04M1/724—User interfaces specially adapted for cordless or mobile telephones
- H04M1/72403—User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M1/00—Substation equipment, e.g. for use by subscribers
- H04M1/72—Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
- H04M1/724—User interfaces specially adapted for cordless or mobile telephones
- H04M1/72448—User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions
- H04M1/72454—User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions according to context-related or environment-related conditions
Landscapes
- Engineering & Computer Science (AREA)
- Human Computer Interaction (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Environmental & Geological Engineering (AREA)
- Telephone Function (AREA)
Abstract
Description
技术领域technical field
本发明涉及移动终端技术领域,尤其涉及一种接近传感器上报事件的控制方法、装置和移动终端。The present invention relates to the technical field of mobile terminals, in particular to a method and device for controlling events reported by a proximity sensor and a mobile terminal.
背景技术Background technique
随着移动通信技术的成熟与发展,移动终端例如手机的功能越来越多,人们通过手机不仅可以进行通话、发短信等,还可以进行支付、存储个人隐私信息等,因此,手机已成为人们日常生活不可或缺的一部分。With the maturity and development of mobile communication technology, mobile terminals such as mobile phones have more and more functions. People can not only make calls and send text messages through mobile phones, but also make payments and store personal privacy information. Therefore, mobile phones have become people's An integral part of everyday life.
目前,为了防止用户误操作移动终端,或者移动终端处于亮屏状态导致的耗电,接近传感器已大量应用于移动终端的各个应用程序中,例如,通话过程中,当手机靠近耳边时,根据接近传感器接收到的经反射的红外光强度来控制移动终端熄屏,当手机远离耳边时,根据接近传感器接收到的经反射的红外光强度来控制移动终端的屏幕点亮,以减少通话过程中对移动终端的误触发。再例如,在移动终端中使用指纹控制的过程中,根据接近传感器中所接收到的信息来控制指纹传感器的工作状态。具体地,在通过接近传感器判断出移动终端处于物体接近状态时,控制指纹传感器处于休眠状态。在通过接近传感器判断出移动终端处于物体远离状态时,控制指纹传感器处于工作状态。At present, in order to prevent the user from operating the mobile terminal by mistake, or the power consumption caused by the mobile terminal being in the bright state, the proximity sensor has been widely used in various applications of the mobile terminal. For example, during a call, when the mobile phone is close to the ear, according to The intensity of the reflected infrared light received by the proximity sensor is used to control the mobile terminal to turn off the screen. When the mobile phone is far away from the ear, the screen of the mobile terminal is controlled to light up according to the intensity of the reflected infrared light received by the proximity sensor to reduce the call process. False triggering of mobile terminals. For another example, in the process of using fingerprint control in the mobile terminal, the working state of the fingerprint sensor is controlled according to the information received in the proximity sensor. Specifically, when it is determined by the proximity sensor that the mobile terminal is in the state of approaching the object, the fingerprint sensor is controlled to be in the dormant state. When it is judged by the proximity sensor that the mobile terminal is in the state of moving away from the object, the fingerprint sensor is controlled to be in the working state.
移动终端的操作系统对使用接近传感器的状态进行控制,控制过程包括状态上报,状态接受,状态处理,界面切换,通话等等。控制过程较为复杂,并且由于移动终端中使用接近传感器中应用程序的不断增多,系统需要处理的事件越来越多,系统容易出现状态漏识别的问题,比如,移动终端中的驱动层上报了接近传感器的接近状态,然而移动终端中的上层并没有收到,由此,使得移动终端中不能根据接近传感器的接近状态进行后续处理。The operating system of the mobile terminal controls the status of the proximity sensor, and the control process includes status reporting, status acceptance, status processing, interface switching, calling, and so on. The control process is more complicated, and due to the increasing number of applications in the proximity sensor used in the mobile terminal, the system needs to handle more and more events, and the system is prone to the problem of state leakage identification. For example, the driver layer in the mobile terminal reports the proximity sensor However, the upper layer in the mobile terminal has not received the proximity status of the sensor, so that subsequent processing cannot be performed in the mobile terminal according to the proximity status of the proximity sensor.
发明内容Contents of the invention
本发明的目的旨在至少在一定程度上解决上述的技术问题之一。The object of the present invention is to solve one of the above-mentioned technical problems at least to a certain extent.
为此,本发明的第一个目的在于提出一种接近传感器上报事件的控制方法,该方法在判断出在第一预设时间内未接收到接近传感器上报的事件信息时,控制接近传感器在第二预设时间内再次上报事件信息,使得移动终端能够及时获取到接近传感器上报的事件信息,从而避免了移动终端遗漏接近传感器上报的事件信息而未能及时调整移动终端的状态的情况的发生。For this reason, the first purpose of the present invention is to propose a method for controlling an event reported by a proximity sensor. When the method determines that the event information reported by the proximity sensor is not received within the first preset time, the proximity sensor is controlled to 2. Report the event information again within the preset time, so that the mobile terminal can obtain the event information reported by the proximity sensor in time, thereby avoiding the situation that the mobile terminal misses the event information reported by the proximity sensor and fails to adjust the state of the mobile terminal in time.
本发明的第二个目的在于提出一种接近传感器上报事件的控制装置。The second object of the present invention is to provide a control device for reporting an event by a proximity sensor.
本发明的第三个目的在于提出一种移动终端。The third object of the present invention is to provide a mobile terminal.
本发明的第四个目的在于提出一种移动终端。A fourth object of the present invention is to provide a mobile terminal.
为了实现上述目的,本发明第一方面实施例的接近传感器上报事件的控制方法,包括:在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到所述接近传感器上报的事件信息;若判断出在第一预设时间内未接收到接近传感器上报的事件信息,则控制所述接近传感器在第二预设时间内再次上报事件信息。In order to achieve the above object, the method for controlling an event reported by a proximity sensor according to the embodiment of the first aspect of the present invention includes: when the current application program uses the proximity sensor, judging whether the event reported by the proximity sensor is received within the first preset time information; if it is determined that the event information reported by the proximity sensor is not received within the first preset time, the proximity sensor is controlled to report the event information again within the second preset time.
根据本发明实施例的接近传感器上报事件的控制方法,在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到接近传感器上报的事件信息,并在判断出在第一预设时间内未接收到接近传感器上报的事件信息时,控制接近传感器在第二预设时间内再次上报事件信息。由此,使得移动终端能够及时获取到接近传感器上报的事件信息,从而避免了移动终端遗漏接近传感器上报的事件信息而未能及时调整移动终端的状态的情况的发生,进而使得移动终端可根据及时上报的事件信息对移动终端进行调整,使得移动终端更加智能化,提高了用户对移动终端的用户体验度。According to the method for controlling an event reported by a proximity sensor in an embodiment of the present invention, when the current application program uses the proximity sensor, it is judged whether the event information reported by the proximity sensor is received within the first preset time, and when it is determined that the event information reported by the proximity sensor is within the first preset time When the event information reported by the proximity sensor is not received within the time, the proximity sensor is controlled to report the event information again within a second preset time. Thus, the mobile terminal can obtain the event information reported by the proximity sensor in time, thereby avoiding the occurrence of the situation that the mobile terminal misses the event information reported by the proximity sensor and fails to adjust the state of the mobile terminal in time, and then enables the mobile terminal to be timely. The reported event information adjusts the mobile terminal, making the mobile terminal more intelligent, and improving the user experience of the user on the mobile terminal.
根据本发明的一个实施例,在所述控制所述接近传感器在第二预设时间内再次上报事件信息之后,所述方法还包括:According to an embodiment of the present invention, after controlling the proximity sensor to report event information again within a second preset time, the method further includes:
根据所述接近传感器再次上报的事件信息控制移动终端执行对应地操作。The mobile terminal is controlled to perform corresponding operations according to the event information reported again by the proximity sensor.
根据本发明的一个实施例,在所述根据所述接近传感器再次上报的事件信息控制移动终端执行对应地操作之前,所述方法还包括:According to an embodiment of the present invention, before controlling the mobile terminal to perform corresponding operations according to the event information reported again by the proximity sensor, the method further includes:
判断在所述第二预设时间内是否接收到所述接近传感器再次上报的事件信息;judging whether the event information reported again by the proximity sensor is received within the second preset time;
若判断出第二预设时间内接收到所述接近传感器再次上报的事件信息,则执行所述根据所述接近传感器再次上报的事件信息控制移动终端执行对应地操作步骤。If it is determined that the event information re-reported by the proximity sensor is received within the second preset time, the corresponding operation steps of controlling the mobile terminal according to the event information re-reported by the proximity sensor are executed.
根据本发明的一个实施例,所述方法还包括:According to an embodiment of the present invention, the method also includes:
若判断出第二预设时间内未接收到所述接近传感器再次上报的事件信息,则将所述接近传感器的事件信息设置为预设事件,并控制所述移动终端根据所述预设事件执行对应地操作。If it is judged that the event information reported again by the proximity sensor is not received within the second preset time, the event information of the proximity sensor is set as a preset event, and the mobile terminal is controlled to execute according to the preset event. Operate accordingly.
根据本发明的一个实施例,所述事件信息包括接近事件和远离事件,所述控制所述接近传感器在第二预设时间内再次上报事件信息,包括:According to an embodiment of the present invention, the event information includes a proximity event and a distance event, and the controlling the proximity sensor to report the event information again within a second preset time includes:
获取所述接近传感器接收到的当前接近值;Obtain the current proximity value received by the proximity sensor;
判断所述当前接近值是否大于预设阈值;judging whether the current proximity value is greater than a preset threshold;
若判断出所述当前接近值大于预设阈值,则确定所述移动终端处于物体接近状态,并控制所述接近传感器在所述第二预设时间内上报所述接近事件;If it is determined that the current proximity value is greater than a preset threshold, then determining that the mobile terminal is in an object proximity state, and controlling the proximity sensor to report the proximity event within the second preset time;
若判断出所述当前接近值不大于预设阈值,则确定所述移动终端处于物体远离状态,并控制所述接近传感器在所述第二预设时间内上报所述远离事件。If it is determined that the current proximity value is not greater than the preset threshold, then it is determined that the mobile terminal is in a state of moving away from the object, and the proximity sensor is controlled to report the moving away event within the second preset time.
为了实现上述目的,本发明第二方面实施例的接近传感器上报事件的控制装置,包括:第一判断模块,用于在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到所述接近传感器上报的事件信息;控制模块,用于在判断出在第一预设时间内未接收到接近传感器上报的事件信息时,控制所述接近传感器在第二预设时间内再次上报事件信息。In order to achieve the above object, the control device for the proximity sensor reporting event in the second aspect of the present invention includes: a first judging module, used to judge whether the proximity sensor is received within the first preset time when the current application program uses the proximity sensor The event information reported by the proximity sensor; a control module configured to control the proximity sensor to report the event again within the second preset time when it is determined that the event information reported by the proximity sensor has not been received within the first preset time information.
根据本发明实施例的接近传感器上报事件的控制装置,在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到接近传感器上报的事件信息,并在判断出在第一预设时间内未接收到接近传感器上报的事件信息时,控制接近传感器在第二预设时间内再次上报事件信息。由此,使得移动终端能够及时获取到接近传感器上报的事件信息,从而避免了移动终端遗漏接近传感器上报的事件信息而未能及时调整移动终端的状态的情况的发生,进而使得移动终端可根据及时上报的事件信息对移动终端进行调整,使得移动终端更加智能化,提高了用户对移动终端的用户体验度。According to the control device of the proximity sensor reporting event in the embodiment of the present invention, when the current application program uses the proximity sensor, it is judged whether the event information reported by the proximity sensor is received within the first preset time, and when it is judged that the event information reported by the proximity sensor is within the first preset time When the event information reported by the proximity sensor is not received within the time, the proximity sensor is controlled to report the event information again within a second preset time. Thus, the mobile terminal can obtain the event information reported by the proximity sensor in time, thereby avoiding the occurrence of the situation that the mobile terminal misses the event information reported by the proximity sensor and fails to adjust the state of the mobile terminal in time, and then enables the mobile terminal to be timely. The reported event information adjusts the mobile terminal, making the mobile terminal more intelligent, and improving the user experience of the user on the mobile terminal.
根据本发明的一个实施例,所述装置还包括:According to an embodiment of the present invention, the device also includes:
第一处理模块,用于在所述控制模块控制所述接近传感器在第二预设时间内再次上报事件信息之后根据所述接近传感器再次上报的事件信息控制移动终端执行对应地操作。The first processing module is configured to control the mobile terminal to perform corresponding operations according to the event information reported again by the proximity sensor after the control module controls the proximity sensor to report event information again within a second preset time.
根据本发明的一个实施例,所述装置还包括:According to an embodiment of the present invention, the device also includes:
第二判断模块,用于判断在所述第二预设时间内是否接收到所述接近传感器再次上报的事件信息;A second judging module, configured to judge whether the event information reported again by the proximity sensor is received within the second preset time;
其中,所述第一处理模块,还用于在判断出在第二预设时间内接收到所述接近传感器再次上报的事件信息时,根据所述接近传感器再次上报的事件信息控制移动终端执行对应地操作。Wherein, the first processing module is further configured to, when it is determined that the event information reported again by the proximity sensor is received within the second preset time, control the mobile terminal to perform corresponding actions according to the event information reported again by the proximity sensor. to operate.
根据本发明的一个实施例,所述装置还包括:According to an embodiment of the present invention, the device also includes:
第二处理模块,用于判断出第二预设时间内未接收到所述接近传感器再次上报的事件信息时,将所述接近传感器的事件信息设置为预设事件,并控制所述移动终端根据所述预设事件执行对应地操作。The second processing module is configured to determine that the event information reported again by the proximity sensor is not received within the second preset time, set the event information of the proximity sensor as a preset event, and control the mobile terminal according to the The preset events perform corresponding operations.
根据本发明的一个实施例,所述事件信息包括接近事件和远离事件,所述控制模块,具体用于:According to an embodiment of the present invention, the event information includes an approach event and a distance event, and the control module is specifically configured to:
获取所述接近传感器接收到的当前接近值,并判断所述当前接近值是否大于预设阈值,若判断出所述当前接近值大于预设阈值,则确定所述移动终端处于物体接近状态,并控制所述接近传感器在所述第二预设时间内上报所述接近事件,若判断出所述当前接近值不大于预设阈值,则确定所述移动终端处于物体远离状态,并控制所述接近传感器在所述第二预设时间内上报所述远离事件。Acquiring the current proximity value received by the proximity sensor, and judging whether the current proximity value is greater than a preset threshold, if it is determined that the current proximity value is greater than the preset threshold, then determining that the mobile terminal is in an object proximity state, and controlling the proximity sensor to report the proximity event within the second preset time, and if it is determined that the current proximity value is not greater than a preset threshold, then determining that the mobile terminal is in a state away from the object, and controlling the proximity The sensor reports the away event within the second preset time.
为了实现上述目的,本发明第三方面实施例的移动终端,包括本发明第二方面实施例的接近传感器上报事件的控制装置。In order to achieve the above object, the mobile terminal according to the embodiment of the third aspect of the present invention includes the device for controlling an event reported by a proximity sensor according to the embodiment of the second aspect of the present invention.
根据本发明实施例的移动终端,在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到接近传感器上报的事件信息,并在判断出在第一预设时间内未接收到接近传感器上报的事件信息时,控制接近传感器在第二预设时间内再次上报事件信息。由此,使得移动终端能够及时获取到接近传感器上报的事件信息,从而避免了移动终端遗漏接近传感器上报的事件信息而未能及时调整移动终端的状态的情况的发生,进而使得移动终端可根据及时上报的事件信息对移动终端进行调整,使得移动终端更加智能化,提高了用户对移动终端的用户体验度。According to the mobile terminal of the embodiment of the present invention, when the current application program uses the proximity sensor, it is judged whether the event information reported by the proximity sensor is received within the first preset time, and when it is judged that the event information reported by the proximity sensor is not received within the first preset time When approaching the event information reported by the sensor, the proximity sensor is controlled to report the event information again within a second preset time. Thus, the mobile terminal can obtain the event information reported by the proximity sensor in time, thereby avoiding the occurrence of the situation that the mobile terminal misses the event information reported by the proximity sensor and fails to adjust the state of the mobile terminal in time, and then enables the mobile terminal to be timely. The reported event information adjusts the mobile terminal, making the mobile terminal more intelligent, and improving the user experience of the user on the mobile terminal.
为了实现上述目的,本发明第四方面实施例的移动终端,所述移动终端包括壳体、处理器、存储器、电路板和电源电路,其中,所述电路板安置在所述壳体围成的空间内部,所述处理器和所述存储器设置在所述电路板上;所述电源电路,用于为所述移动终端的各个电路或器件供电;所述存储器用于存储可执行程序代码;所述处理器通过读取所述存储器中存储的可执行程序代码来运行与所述可执行程序代码对应的程序,以用于执行以下步骤:在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到接近传感器上报的事件信息;若判断出在第一预设时间内未接收到接近传感器上报的事件信息,则控制接近传感器在第二预设时间内再次上报事件信息。In order to achieve the above object, the mobile terminal according to the fourth aspect of the present invention includes a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is placed in the enclosure surrounded by the housing. Inside the space, the processor and the memory are arranged on the circuit board; the power supply circuit is used to supply power to each circuit or device of the mobile terminal; the memory is used to store executable program codes; The processor executes the program corresponding to the executable program code by reading the executable program code stored in the memory, so as to perform the following steps: when the current application program uses the proximity sensor, determine the Whether the event information reported by the proximity sensor is received within the set time; if it is determined that the event information reported by the proximity sensor is not received within the first preset time, the proximity sensor is controlled to report the event information again within the second preset time.
根据本发明实施例的移动终端,在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到接近传感器上报的事件信息,并在判断出在第一预设时间内未接收到接近传感器上报的事件信息时,控制接近传感器在第二预设时间内再次上报事件信息。由此,使得移动终端能够及时获取到接近传感器上报的事件信息,从而避免了移动终端遗漏接近传感器上报的事件信息而未能及时调整移动终端的状态的情况的发生,进而使得移动终端可根据及时上报的事件信息对移动终端进行调整,使得移动终端更加智能化,提高了用户对移动终端的用户体验度。According to the mobile terminal of the embodiment of the present invention, when the current application program uses the proximity sensor, it is judged whether the event information reported by the proximity sensor is received within the first preset time, and when it is judged that the event information reported by the proximity sensor is not received within the first preset time When approaching the event information reported by the sensor, the proximity sensor is controlled to report the event information again within a second preset time. Thus, the mobile terminal can obtain the event information reported by the proximity sensor in time, thereby avoiding the occurrence of the situation that the mobile terminal misses the event information reported by the proximity sensor and fails to adjust the state of the mobile terminal in time, and then enables the mobile terminal to be timely. The reported event information adjusts the mobile terminal, making the mobile terminal more intelligent, and improving the user experience of the user on the mobile terminal.
本发明附加的方面和优点将在下面的描述中部分给出,部分将从下面的描述中变得明显,或通过本发明的实践了解到。Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
附图说明Description of drawings
本发明上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中,The above and/or additional aspects and advantages of the present invention will become apparent and easy to understand from the following description of the embodiments in conjunction with the accompanying drawings, wherein,
图1是根据本发明一个实施例的接近传感器上报事件的控制方法的流程图。Fig. 1 is a flowchart of a method for controlling an event reported by a proximity sensor according to an embodiment of the present invention.
图2是根据本发明另一个实施例的接近传感器上报事件的控制方法的流程图。Fig. 2 is a flowchart of a method for controlling an event reported by a proximity sensor according to another embodiment of the present invention.
图3是根据本发明又一个具体实施例的接近传感器上报事件的控制方法的流程图。Fig. 3 is a flowchart of a method for controlling an event reported by a proximity sensor according to yet another specific embodiment of the present invention.
图4是根据本发明一个实施例的接近传感器上报事件的控制装置的结构示意图。Fig. 4 is a schematic structural diagram of a control device for reporting an event by a proximity sensor according to an embodiment of the present invention.
图5是根据本发明另一个实施例的接近传感器上报事件的控制装置的结构示意图。Fig. 5 is a schematic structural diagram of a control device for reporting an event by a proximity sensor according to another embodiment of the present invention.
附图标记:Reference signs:
第一判断模块110、控制模块120、第一处理模块130、第二判断模块140和第二处理模块150。The first judgment module 110 , the control module 120 , the first processing module 130 , the second judgment module 140 and the second processing module 150 .
具体实施方式detailed description
下面详细描述本发明的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,旨在用于解释本发明,而不能理解为对本发明的限制。Embodiments of the present invention are described in detail below, examples of which are shown in the drawings, wherein the same or similar reference numerals designate the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the figures are exemplary and are intended to explain the present invention and should not be construed as limiting the present invention.
下面参考附图描述本发明实施例的接近传感器上报事件的控制方法、装置和移动终端。The method, device and mobile terminal for controlling an event reported by a proximity sensor according to embodiments of the present invention will be described below with reference to the accompanying drawings.
图1是根据本发明一个实施例的接近传感器上报事件的控制方法的流程图。其中,需要说明的是,该实施例的接近传感器上报事件的控制方法应用于移动终端中,该移动终端可以例如是智能手机、平板电脑等具有各种操作的硬件设备。Fig. 1 is a flowchart of a method for controlling an event reported by a proximity sensor according to an embodiment of the present invention. Wherein, it should be noted that the method for controlling an event reported by a proximity sensor in this embodiment is applied to a mobile terminal, and the mobile terminal may be, for example, a smart phone, a tablet computer, and other hardware devices with various operations.
如图1所示,该接近传感器上报事件的控制方法包括以下步骤:As shown in Figure 1, the control method for reporting an event by the proximity sensor includes the following steps:
S11,在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到接近传感器上报的事件信息。S11, when the current application program uses the proximity sensor, determine whether the event information reported by the proximity sensor is received within a first preset time.
其中,事件信息可以包括但不限于接近事件和远离事件。Wherein, the event information may include, but not limited to, an approach event and a distance event.
其中,第一预设时间是移动终端中预先设置的,例如,第一预设时间为200ms,在当前应用程序使用接近传感器时,如果移动终端中预先设置在当前应用程序使用接近传感器时,接近传感器在200ms内需要上报事件信息,在后续当前应用程序中使用接近传感器时,可判断在200ms内是否接收到接近传感器上报的事件信息。Wherein, the first preset time is preset in the mobile terminal. For example, the first preset time is 200ms. When the current application program uses the proximity sensor, if the mobile terminal is preset when the current application program uses the proximity sensor, the proximity The sensor needs to report event information within 200ms. When the proximity sensor is used in the subsequent current application program, it can be judged whether the event information reported by the proximity sensor is received within 200ms.
其中,需要理解的是,当前应用程序为移动终端中在使用时需要应用到接近传感器的程序,例如,当前应用程序可以为控制通话的程序、控制移动终端自动背光的程序或者通过接近传感器对指纹传感器进行控制的程序等。Among them, it should be understood that the current application program is a program that needs to be applied to the proximity sensor during use in the mobile terminal. For example, the current application program can be a program that controls calls, a program that controls the automatic backlight of the mobile terminal, or a program that uses the proximity sensor to detect fingerprints. Programs for sensor control, etc.
S12,若判断出在第一预设时间内未接收到接近传感器上报的事件信息,则控制接近传感器在第二预设时间内再次上报事件信息。S12. If it is determined that the event information reported by the proximity sensor is not received within the first preset time, control the proximity sensor to report the event information again within the second preset time.
具体地,在判断出当前应用程序的应用层在第一预设时间内未接收到接近传感器上报的事件信息时,可向驱动层发送再次发送指令,然后,驱动层接收到再次发送之后,根据第二预设时间对定时器进行定时,并获取接近传感器接收到的当前接近值,判断当前接近值是否大于预设阈值,若判断出当前接近值大于预设阈值,则确定移动终端处于物体接近状态,并控制接近传感器在第二预设时间内上报接近事件。Specifically, when it is judged that the application layer of the current application program has not received the event information reported by the proximity sensor within the first preset time, it can send a resend instruction to the driver layer, and then, after the driver layer receives the resend instruction, according to The second preset time is used to time the timer, and obtain the current proximity value received by the proximity sensor, and judge whether the current proximity value is greater than the preset threshold. state, and control the proximity sensor to report the proximity event within a second preset time.
另外,若判断出当前接近值不大于预设阈值,则确定移动终端处于物体远离状态,并控制接近传感器在第二预设时间内上报远离事件。In addition, if it is judged that the current proximity value is not greater than the preset threshold, then it is determined that the mobile terminal is in the state of moving away from the object, and the proximity sensor is controlled to report the moving away event within a second preset time.
其中,第二预设时间是移动终端中预先设置的,例如,第二预设时间为200ms,在接收到再次发送接近传感器的事件信息的发送指令时,可将定时器中的时间设置为200ms。Wherein, the second preset time is preset in the mobile terminal, for example, the second preset time is 200ms, and when receiving the sending instruction to send the event information of the proximity sensor again, the time in the timer can be set to 200ms .
其中,预设阈值是移动终端中预先设置的,预设阈值的大小可以为900-1000,例如,预设阈值为1000。Wherein, the preset threshold is preset in the mobile terminal, and the preset threshold may be 900-1000, for example, the preset threshold is 1000.
例如,预设阈值为1000,在通话过程中,在监控到智能手机的驱动层发送接近传感器的事件信息,而智能手机的应用层在第一预设时间未接收到上报的接近传感器的事件信息时,智能手机的应用层可向驱动层发送再次发送指令,驱动层在接收到再次发送指令后,可根据第二预设时间设置定时器,并检测接近传感器中的当前红外线强度,假设当前红外线强度值为1050,通过比较可确定当前红外线强度值大于预设阈值,此时,可确定智能手机处于物体接近状态,其中,物体接近状态与接近事件对应,在确定出接近传感器中的事件信息为接近事件后,驱动层向应用层再次发送接近传感器的事件信息。For example, the preset threshold is 1000. During the call, the driver layer of the smart phone is monitored to send the event information of the proximity sensor, but the application layer of the smart phone does not receive the reported event information of the proximity sensor within the first preset time. , the application layer of the smart phone can send a resend instruction to the driver layer, and the driver layer can set the timer according to the second preset time after receiving the resend instruction, and detect the current infrared intensity in the proximity sensor. Assuming that the current infrared The intensity value is 1050. By comparison, it can be determined that the current infrared intensity value is greater than the preset threshold. At this time, it can be determined that the smartphone is in the object approach state, wherein the object approach state corresponds to the approach event, and the event information in the proximity sensor is determined to be After the proximity event, the driver layer sends the event information of the proximity sensor to the application layer again.
在本发明的一个实施例中,如图2所示,在步骤S12之后,还可以包括S13。In an embodiment of the present invention, as shown in FIG. 2 , after step S12, S13 may also be included.
S13,根据接近传感器再次上报的事件信息控制移动终端执行对应地操作。S13. Control the mobile terminal to perform corresponding operations according to the event information reported again by the proximity sensor.
其中,需要理解的是,事件信息不同,移动终端所执行地操作不同。事件信息与所执行的操作之间的对应关系是移动终端根据当前应用程序的功能需求预先设置的。Wherein, it should be understood that different event information means different operations performed by the mobile terminal. The corresponding relationship between event information and executed operations is preset by the mobile terminal according to the functional requirements of the current application program.
例如,在通话过程中,若监控到接近传感器应该上报事件信息,而未接收到接收接近传感器上报的事件信息时,移动终端可向驱动层发送再次发送指令,驱动层将再次检测接近传感器当前所产生的事件信息,并再次上报接近传感器的事件信息,如果移动终端再次接收到接近传感器上报的事件信息为接近事件,则控制移动终端屏幕熄屏,由此,可减少通话过程中对移动终端的误操作和降低屏幕的电量消耗。如果移动终端接收再次接收到接近传感器上报的事件信息为远离事件,则控制移动终端点亮屏幕。For example, during a call, if it monitors that the proximity sensor should report event information, but does not receive the event information reported by the proximity sensor, the mobile terminal can send a resend instruction to the driver layer, and the driver layer will detect again the current location of the proximity sensor. Generated event information, and report the event information of the proximity sensor again, if the mobile terminal receives the event information reported by the proximity sensor again as a proximity event, then control the screen of the mobile terminal to turn off the screen, thereby reducing the impact on the mobile terminal during the call. Misuse and reduce screen power consumption. If the mobile terminal receives the event information reported by the proximity sensor again as a far away event, the mobile terminal is controlled to turn on the screen.
再例如,在通过接近传感器对指纹传感器的工作状态进行控制的过程中,若监控到接近传感器应该上报事件信息,而未接收到接收接近传感器上报的事件信息时,移动终端可向驱动层发送再次发送指令,驱动层将再次检测接近传感器当前所产生的事件信息,并再次上报接近传感器的事件信息,如果移动终端再次接收到接近传感器上报的事件信息为接近事件,则控制移动终端中的指纹传感处于休眠状态,由此,可避免将移动终端放在裤子口袋中而引起的指纹识别造成的电池消耗。如果移动终端接收再次接收到接近传感器上报的事件信息为远离事件,则控制移动终端中的指纹传感处于工作状态。For another example, in the process of controlling the working state of the fingerprint sensor through the proximity sensor, if it is monitored that the proximity sensor should report event information, but the event information reported by the proximity sensor is not received, the mobile terminal can send another message to the driver layer. Send the instruction, the driver layer will detect the event information currently generated by the proximity sensor again, and report the event information of the proximity sensor again, if the mobile terminal receives the event information reported by the proximity sensor again as a proximity event, then control the fingerprint transmission in the mobile terminal The sensor is in a dormant state, thereby avoiding battery consumption caused by fingerprint recognition caused by putting the mobile terminal in a trouser pocket. If the mobile terminal receives the event information reported by the proximity sensor again as a far away event, control the fingerprint sensor in the mobile terminal to be in a working state.
其中,需要理解的是,在接近传感器被当前应用程序使用一段时间后,在监控到接近传感器的事件状态发生改变后,可将接近传感器的事件状态发生改变的信息进行上报,如果监控到应用层未接收到接近传感器的事件状态发生改变的信息,则控制接近传感器再次发送事件状态发生改变的信息,移动终端根据再次接收到的事件状态发生改变的信息控制移动终端执行对应的操作。Among them, it should be understood that after the proximity sensor is used by the current application for a period of time, after monitoring the event state of the proximity sensor has changed, the information about the change of the event state of the proximity sensor can be reported. If the application layer is monitored If the event state change information of the proximity sensor is not received, the proximity sensor is controlled to send the event state change information again, and the mobile terminal controls the mobile terminal to perform corresponding operations according to the received event state change information again.
也就是说,在移动终端根据接近传感器上报的事件信息执行对应操作后,如果监控到接近传感器中的事件信息未发生改变,则控制接近传感器不再上报事件信息,在监控到接近传感器中的事件信息发生改变后,例如,由接近事件变为远离事件,或者由远离事件变为接近事件,控制接近传感器上报事件变化信息,如果应用层接收到接近传感器上报的事件变化信息,则根据变化后的事件信息控制移动终端执行对应操作。That is to say, after the mobile terminal performs corresponding operations according to the event information reported by the proximity sensor, if it monitors that the event information in the proximity sensor has not changed, the proximity sensor is controlled to no longer report the event information, and the event information in the proximity sensor is monitored. After the information changes, for example, from a close event to a far away event, or from a far away event to a close event, control the proximity sensor to report the event change information. If the application layer receives the event change information reported by the proximity sensor, then according to the changed The event information controls the mobile terminal to perform corresponding operations.
例如,在通话过程中,在用户把手机放在耳朵进行通话时,移动终端熄屏,在监控到用户将手机从耳朵拿下来的过程中,接近传感器的状态由物体接近状态变为物体远离状态,此时,控制接近传感器上报事件变化信息,如果监控到驱动层上报了事件变化信息,而监控到应用层未接收到事件变化信息,则控制移动终端根据事件变化信息及时调整所执行地操作。For example, during a call, when the user puts the mobile phone on the ear to make a call, the screen of the mobile terminal turns off, and when the monitoring detects that the user takes the mobile phone off the ear, the state of the proximity sensor changes from the object-approaching state to the object-away state , at this time, the proximity sensor is controlled to report the event change information, and if it is monitored that the driver layer reports the event change information, but the application layer does not receive the event change information, then the mobile terminal is controlled to adjust the executed operations in time according to the event change information.
综上可以看出,该实施例在监控到应该接收到接近传感器上报的事件信息,而未接收到接近传感器上报的事件信息时,控制接近传感器再次上报事件信息,使得移动终端能够及时获取到接近传感器上报的事件信息,从而避免了移动终端遗漏接近传感器上报的事件信息而未能及时调整移动终端的状态的情况的发生。In summary, it can be seen that in this embodiment, when it is monitored that the event information reported by the proximity sensor should be received, but the event information reported by the proximity sensor is not received, the proximity sensor is controlled to report the event information again, so that the mobile terminal can obtain the proximity sensor in time. The event information reported by the sensor avoids the situation that the mobile terminal misses the event information reported by the proximity sensor and fails to adjust the state of the mobile terminal in time.
根据本发明实施例的接近传感器上报事件的控制方法,在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到接近传感器上报的事件信息,并在判断出在第一预设时间内未接收到接近传感器上报的事件信息时,控制接近传感器在第二预设时间内再次上报事件信息。由此,使得移动终端能够及时获取到接近传感器上报的事件信息,从而避免了移动终端遗漏接近传感器上报的事件信息而未能及时调整移动终端的状态的情况的发生,进而使得移动终端可根据及时上报的事件信息对移动终端进行调整,使得移动终端更加智能化,提高了用户对移动终端的用户体验度。According to the method for controlling an event reported by a proximity sensor in an embodiment of the present invention, when the current application program uses the proximity sensor, it is judged whether the event information reported by the proximity sensor is received within the first preset time, and when it is determined that the event information reported by the proximity sensor is within the first preset time When the event information reported by the proximity sensor is not received within the time, the proximity sensor is controlled to report the event information again within a second preset time. Thus, the mobile terminal can obtain the event information reported by the proximity sensor in time, thereby avoiding the occurrence of the situation that the mobile terminal misses the event information reported by the proximity sensor and fails to adjust the state of the mobile terminal in time, and then enables the mobile terminal to be timely. The reported event information adjusts the mobile terminal, making the mobile terminal more intelligent, and improving the user experience of the user on the mobile terminal.
图3是根据本发明又一个实施例的接近传感器上报事件的控制方法的流程图。其中,需要说明的是,该实施例的接近传感器上报事件的控制方法应用于移动终端中,该移动终端可以例如是智能手机、平板电脑等具有各种操作的硬件设备。Fig. 3 is a flow chart of a method for controlling an event reported by a proximity sensor according to yet another embodiment of the present invention. Wherein, it should be noted that the method for controlling an event reported by a proximity sensor in this embodiment is applied to a mobile terminal, and the mobile terminal may be, for example, a smart phone, a tablet computer, and other hardware devices with various operations.
如图3所示,该接近传感器上报事件的控制方法包括以下步骤:As shown in Figure 3, the control method for reporting an event by the proximity sensor includes the following steps:
S31,在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到接近传感器上报的事件信息。S31. When the current application program uses the proximity sensor, determine whether the event information reported by the proximity sensor is received within a first preset time.
其中,事件信息可以包括但不限于接近事件和远离事件。Wherein, the event information may include, but not limited to, an approach event and a distance event.
其中,第一预设时间是移动终端中预先设置的,例如,第一预设时间为200ms,在当前应用程序使用接近传感器时,如果移动终端中预先设置在当前应用程序使用接近传感器时,接近传感器在200ms内需要上报事件信息,在后续当前应用程序中使用接近传感器时,可判断在200ms内是否接收到接近传感器上报的事件信息。Wherein, the first preset time is preset in the mobile terminal. For example, the first preset time is 200ms. When the current application program uses the proximity sensor, if the mobile terminal is preset when the current application program uses the proximity sensor, the proximity The sensor needs to report event information within 200ms. When the proximity sensor is used in the subsequent current application program, it can be judged whether the event information reported by the proximity sensor is received within 200ms.
其中,需要理解的是,当前应用程序为移动终端中在使用时需要应用到接近传感器的程序,例如,当前应用程序可以为控制通话的程序、控制移动终端自动背光的程序或者通过接近传感器对指纹传感器进行控制的程序等。Among them, it should be understood that the current application program is a program that needs to be applied to the proximity sensor during use in the mobile terminal. For example, the current application program can be a program that controls calls, a program that controls the automatic backlight of the mobile terminal, or a program that uses the proximity sensor to detect fingerprints. Programs for sensor control, etc.
S32,若判断出在第一预设时间内未接收到接近传感器上报的事件信息,则控制接近传感器在第二预设时间内再次上报事件信息。S32. If it is determined that the event information reported by the proximity sensor is not received within the first preset time, control the proximity sensor to report the event information again within the second preset time.
具体地,在判断出当前应用程序的应用层在第一预设时间内未接收到接近传感器上报的事件信息时,可向驱动层发送再次发送指令,然后,驱动层接收到再次发送之后,根据第二预设时间对定时器进行定时,并获取接近传感器接收到的当前接近值,判断当前接近值是否大于预设阈值,若判断出当前接近值大于预设阈值,则确定移动终端处于物体接近状态,并控制接近传感器在第二预设时间内上报接近事件。Specifically, when it is judged that the application layer of the current application program has not received the event information reported by the proximity sensor within the first preset time, it can send a resend instruction to the driver layer, and then, after the driver layer receives the resend instruction, according to The second preset time is used to time the timer, and obtain the current proximity value received by the proximity sensor, and judge whether the current proximity value is greater than the preset threshold. state, and control the proximity sensor to report the proximity event within a second preset time.
另外,若判断出当前接近值不大于预设阈值,则确定移动终端处于物体远离状态,并控制接近传感器在第二预设时间内上报远离事件。In addition, if it is judged that the current proximity value is not greater than the preset threshold, then it is determined that the mobile terminal is in the state of moving away from the object, and the proximity sensor is controlled to report the moving away event within a second preset time.
其中,第二预设时间是移动终端中预先设置的,例如,第二预设时间为200ms,在接收到再次发送接近传感器的事件信息的发送指令时,可将定时器中的时间设置为200ms。Wherein, the second preset time is preset in the mobile terminal, for example, the second preset time is 200ms, and when receiving the sending instruction to send the event information of the proximity sensor again, the time in the timer can be set to 200ms .
其中,预设阈值是移动终端中预先设置的,预设阈值的大小可以为900-1000,例如,预设阈值为1000。Wherein, the preset threshold is preset in the mobile terminal, and the preset threshold may be 900-1000, for example, the preset threshold is 1000.
例如,预设阈值为1000,在通话过程中,在监控到智能手机的驱动层发送接近传感器的事件信息,而智能手机的应用层在第一预设时间未接收到上报的接近传感器的事件信息时,智能手机的应用层可向驱动层发送再次发送指令,驱动层在接收到再次发送指令后,可根据第二预设时间设置定时器,并检测接近传感器中的当前红外线强度,假设当前红外线强度值为1050,通过比较可确定当前红外线强度值大于预设阈值,此时,可确定智能手机处于物体接近状态,其中,物体接近状态与接近事件对应,在确定出接近传感器中的事件信息为接近事件后,驱动层向应用层再次发送接近传感器的事件信息。For example, the preset threshold is 1000. During the call, the driver layer of the smart phone is monitored to send the event information of the proximity sensor, but the application layer of the smart phone does not receive the reported event information of the proximity sensor within the first preset time. , the application layer of the smart phone can send a resend instruction to the driver layer, and the driver layer can set the timer according to the second preset time after receiving the resend instruction, and detect the current infrared intensity in the proximity sensor. Assuming that the current infrared The intensity value is 1050. By comparison, it can be determined that the current infrared intensity value is greater than the preset threshold. At this time, it can be determined that the smartphone is in the object approach state, wherein the object approach state corresponds to the approach event, and the event information in the proximity sensor is determined to be After the proximity event, the driver layer sends the event information of the proximity sensor to the application layer again.
S33,判断在第二预设时间内是否接收到接近传感器再次上报的事件信息。S33, judging whether the event information reported again by the proximity sensor is received within the second preset time.
S34,若判断出第二预设时间内接收到接近传感器再次上报的事件信息,则根据接近传感器再次上报的事件信息控制移动终端执行对应地操作。S34. If it is determined that the event information reported again by the proximity sensor is received within the second preset time, control the mobile terminal to perform a corresponding operation according to the event information reported again by the proximity sensor.
其中,需要理解的是,事件信息不同,移动终端所执行地操作不同。事件信息与所执行的操作之间的对应关系是移动终端根据当前应用程序的功能需求预先设置的。Wherein, it should be understood that different event information means different operations performed by the mobile terminal. The corresponding relationship between event information and executed operations is preset by the mobile terminal according to the functional requirements of the current application program.
例如,在通话过程中,若监控到接近传感器应该上报事件信息,而未接收到接收接近传感器上报的事件信息时,移动终端可向驱动层发送再次发送指令,驱动层将再次检测接近传感器当前所产生的事件信息,并再次上报接近传感器的事件信息,如果移动终端再次接收到接近传感器上报的事件信息为接近事件,则控制移动终端屏幕熄屏,由此,可减少通话过程中对移动终端的误操作和降低屏幕的电量消耗。如果移动终端接收再次接收到接近传感器上报的事件信息为远离事件,则控制移动终端点亮屏幕。For example, during a call, if it monitors that the proximity sensor should report event information, but does not receive the event information reported by the proximity sensor, the mobile terminal can send a resend instruction to the driver layer, and the driver layer will detect again the current location of the proximity sensor. Generated event information, and report the event information of the proximity sensor again, if the mobile terminal receives the event information reported by the proximity sensor again as a proximity event, then control the screen of the mobile terminal to turn off the screen, thereby reducing the impact on the mobile terminal during the call. Misuse and reduce screen power consumption. If the mobile terminal receives the event information reported by the proximity sensor again as a far away event, the mobile terminal is controlled to turn on the screen.
再例如,在通过接近传感器对指纹传感器的工作状态进行控制的过程中,若监控到接近传感器应该上报事件信息,而未接收到接收接近传感器上报的事件信息时,移动终端可向驱动层发送再次发送指令,驱动层将再次检测接近传感器当前所产生的事件信息,并再次上报接近传感器的事件信息,如果移动终端再次接收到接近传感器上报的事件信息为接近事件,则控制移动终端中的指纹传感处于休眠状态,由此,可避免将移动终端放在裤子口袋中而引起的指纹识别造成的电池消耗。如果移动终端接收再次接收到接近传感器上报的事件信息为远离事件,则控制移动终端中的指纹传感处于工作状态。For another example, in the process of controlling the working state of the fingerprint sensor through the proximity sensor, if it is monitored that the proximity sensor should report event information, but the event information reported by the proximity sensor is not received, the mobile terminal can send another message to the driver layer. Send the instruction, the driver layer will detect the event information currently generated by the proximity sensor again, and report the event information of the proximity sensor again, if the mobile terminal receives the event information reported by the proximity sensor again as a proximity event, then control the fingerprint transmission in the mobile terminal The sensor is in a dormant state, thereby avoiding battery consumption caused by fingerprint recognition caused by putting the mobile terminal in a trouser pocket. If the mobile terminal receives the event information reported by the proximity sensor again as a far away event, control the fingerprint sensor in the mobile terminal to be in a working state.
S35,若判断出第二预设时间内未接收到接近传感器再次上报的事件信息,则将接近传感器的事件信息设置为预设事件,并控制移动终端根据预设事件执行对应地操作。S35. If it is determined that the event information reported again by the proximity sensor is not received within the second preset time, set the event information of the proximity sensor as a preset event, and control the mobile terminal to perform corresponding operations according to the preset event.
其中,预设事件是根据当前应用程序所需要的功能预先设置的事件,例如,在通话过程中,可将预设事件设置为远离事件。再例如,在通过接近传感器的事件信息控制指纹传感器的过程中,可将预设事件设置为远离事件。Wherein, the preset event is an event preset according to the functions required by the current application program, for example, during a call, the preset event may be set as a remote event. For another example, in the process of controlling the fingerprint sensor through the event information of the proximity sensor, the preset event may be set as the far away event.
在本发明的一个实施例中,在接近传感器被当前应用程序使用一段时间后,在监控到接近传感器的事件状态发生改变后,可将接近传感器的事件状态发生改变的信息进行上报,如果监控到应用层未接收到接近传感器的事件状态发生改变的信息,则控制接近传感器再次发送事件状态发生改变的信息,移动终端根据再次接收到的事件状态发生改变的信息控制移动终端执行对应的操作。In one embodiment of the present invention, after the proximity sensor is used by the current application program for a period of time, after monitoring that the event state of the proximity sensor has changed, the information that the event state of the proximity sensor has changed can be reported. The application layer does not receive the information that the event state of the proximity sensor has changed, and then controls the proximity sensor to send the information of the event state change again, and the mobile terminal controls the mobile terminal to perform corresponding operations according to the received event state change information again.
也就是说,在移动终端根据接近传感器上报的事件信息执行对应操作后,如果监控到接近传感器中的事件信息未发生改变,则控制接近传感器不再上报事件信息,在监控到接近传感器中的事件信息发生改变后,例如,由接近事件变为远离事件,或者由远离事件变为接近事件,控制接近传感器上报事件变化信息,如果应用层接收到接近传感器上报的事件变化信息,则根据变化后的事件信息控制移动终端执行对应地操作。That is to say, after the mobile terminal performs corresponding operations according to the event information reported by the proximity sensor, if it monitors that the event information in the proximity sensor has not changed, the proximity sensor is controlled to no longer report the event information, and the event information in the proximity sensor is monitored. After the information changes, for example, from a close event to a far away event, or from a far away event to a close event, control the proximity sensor to report the event change information. If the application layer receives the event change information reported by the proximity sensor, then according to the changed The event information controls the mobile terminal to perform corresponding operations.
例如,在通话过程中,在用户把手机放在耳朵进行通话时,移动终端熄屏,在监控到用户将手机从耳朵拿下来的过程中,接近传感器的状态由物体接近状态变为物体远离状态,此时,控制接近传感器上报事件变化信息,如果监控到驱动层上报了事件变化信息,而监控到应用层未接收到事件变化信息,则控制移动终端根据事件变化信息及时调整所执行地操作。For example, during a call, when the user puts the mobile phone on the ear to make a call, the screen of the mobile terminal turns off, and when the monitoring detects that the user takes the mobile phone off the ear, the state of the proximity sensor changes from the object-approaching state to the object-away state , at this time, the proximity sensor is controlled to report the event change information, and if it is monitored that the driver layer reports the event change information, but the application layer does not receive the event change information, then the mobile terminal is controlled to adjust the executed operations in time according to the event change information.
根据本发明实施例的接近传感器上报事件的控制方法,在判断出在第一预设时间内未接收到接近传感器上报的事件信息,判断在第二预设时间内是否接收到近传感器再次上报的事件信息,并在接收到近传感器再次上报的事件信息时,控制移动终端根据接近传感器再次上报的事件信息执行对应地操作,以及在未接收到近传感器再次上报的事件信息时,将移动终端的接近传感器的事件信息设置为预设事件,并控制移动终端根据预设事件执行对应操作。由此,使得移动终端及时获取到接近传感器上报的事件信息,并根据事件信息控制移动终端及时进行操作调整,使得移动终端更加智能化,提高了用户对移动终端的用户体验度。According to the method for controlling an event reported by a proximity sensor in an embodiment of the present invention, after judging that the event information reported by the proximity sensor has not been received within the first preset time, it is judged whether the event information reported by the proximity sensor is received again within the second preset time event information, and when the event information reported again by the proximity sensor is received, the mobile terminal is controlled to perform corresponding operations according to the event information reported again by the proximity sensor, and when the event information reported again by the proximity sensor is not received, the mobile terminal is The event information of the proximity sensor is set as a preset event, and the mobile terminal is controlled to perform corresponding operations according to the preset event. Thus, the mobile terminal can obtain the event information reported by the proximity sensor in time, and control the mobile terminal to perform operation adjustment in time according to the event information, making the mobile terminal more intelligent and improving the user experience of the mobile terminal.
为了实现上述实施例,本发明还提出了一种本发明实施例的接近传感器上报事件的控制装置。In order to realize the above embodiments, the present invention also proposes a control device for reporting an event by a proximity sensor according to an embodiment of the present invention.
图4是根据本发明一个实施例的本发明实施例的接近传感器上报事件的控制装置的结构示意图。Fig. 4 is a schematic structural diagram of a control device for reporting an event by a proximity sensor according to an embodiment of the present invention.
如图4所示,该本发明实施例的接近传感器上报事件的控制装置可以包括第一判断模块110和控制模块120,其中:As shown in FIG. 4 , the control device for the proximity sensor reporting event in this embodiment of the present invention may include a first judging module 110 and a control module 120, wherein:
第一判断模块110用于在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到接近传感器上报的事件信息。The first judging module 110 is used for judging whether the event information reported by the proximity sensor is received within the first preset time when the current application program uses the proximity sensor.
其中,事件信息可以包括但不限于接近事件和远离事件。Wherein, the event information may include, but not limited to, an approach event and a distance event.
其中,第一预设时间是移动终端中预先设置的,例如,第一预设时间为200ms,在当前应用程序使用接近传感器时,如果移动终端中预先设置在当前应用程序使用接近传感器时,接近传感器在200ms内需要上报事件信息,在后续当前应用程序中使用接近传感器时,可判断在200ms内是否接收到接近传感器上报的事件信息。Wherein, the first preset time is preset in the mobile terminal. For example, the first preset time is 200ms. When the current application program uses the proximity sensor, if the mobile terminal is preset when the current application program uses the proximity sensor, the proximity The sensor needs to report event information within 200ms. When the proximity sensor is used in the subsequent current application program, it can be judged whether the event information reported by the proximity sensor is received within 200ms.
控制模块120用于在判断出在第一预设时间内未接收到接近传感器上报的事件信息时,控制接近传感器在第二预设时间内再次上报事件信息。The control module 120 is configured to control the proximity sensor to report the event information again within the second preset time when it is determined that the event information reported by the proximity sensor is not received within the first preset time.
其中,第二预设时间是移动终端中预先设置的,例如,第二预设时间为200ms,在接收到再次发送接近传感器的事件信息的发送指令时,可将定时器中的时间设置为200ms。Wherein, the second preset time is preset in the mobile terminal, for example, the second preset time is 200ms, and when receiving the sending instruction to send the event information of the proximity sensor again, the time in the timer can be set to 200ms .
其中,预设阈值是移动终端中预先设置的,预设阈值的大小可以为900-1000,例如,预设阈值为1000。Wherein, the preset threshold is preset in the mobile terminal, and the preset threshold may be 900-1000, for example, the preset threshold is 1000.
例如,预设阈值为1000,在通话过程中,在监控到智能手机的驱动层发送接近传感器的事件信息,而智能手机的应用层在第一预设时间未接收到上报的接近传感器的事件信息时,智能手机的应用层可向驱动层发送再次发送指令,驱动层在接收到再次发送指令后,可根据第二预设时间设置定时器,并检测接近传感器中的当前红外线强度,假设当前红外线强度值为1050,通过比较可确定当前红外线强度值大于预设阈值,此时,可确定智能手机处于物体接近状态,其中,物体接近状态与接近事件对应,在确定出接近传感器中的事件信息为接近事件后,驱动层向应用层再次发送接近传感器的事件信息。For example, the preset threshold is 1000. During the call, the driver layer of the smart phone is monitored to send the event information of the proximity sensor, but the application layer of the smart phone does not receive the reported event information of the proximity sensor within the first preset time. , the application layer of the smart phone can send a resend instruction to the driver layer, and the driver layer can set the timer according to the second preset time after receiving the resend instruction, and detect the current infrared intensity in the proximity sensor. Assuming that the current infrared The intensity value is 1050. By comparison, it can be determined that the current infrared intensity value is greater than the preset threshold. At this time, it can be determined that the smartphone is in the object approach state, wherein the object approach state corresponds to the approach event, and the event information in the proximity sensor is determined to be After the proximity event, the driver layer sends the event information of the proximity sensor to the application layer again.
具体而言,控制模块120具体用于:获取接近传感器接收到的当前接近值,并判断当前接近值是否大于预设阈值,若判断出当前接近值大于预设阈值,则确定移动终端处于物体接近状态,并控制接近传感器在第二预设时间内上报接近事件,若判断出当前接近值不大于预设阈值,则确定移动终端处于物体远离状态,并控制接近传感器在第二预设时间内上报远离事件。Specifically, the control module 120 is specifically used to: obtain the current proximity value received by the proximity sensor, and determine whether the current proximity value is greater than a preset threshold; state, and control the proximity sensor to report the proximity event within the second preset time, if it is judged that the current proximity value is not greater than the preset threshold value, then determine that the mobile terminal is in the object away state, and control the proximity sensor to report the proximity event within the second preset time Stay away from events.
需要说明的是,前述对接近传感器上报事件的控制方法实施例的解释说明也适用于该实施例的接近传感器上报事件的控制装置,其实现原理类似,此处不再赘述。It should be noted that the foregoing explanations on the embodiment of the method for controlling a proximity sensor reporting an event are also applicable to the device for controlling a proximity sensor reporting an event in this embodiment, and its implementation principles are similar, so details are not repeated here.
根据本发明实施例的接近传感器上报事件的控制装置,在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到接近传感器上报的事件信息,并在判断出在第一预设时间内未接收到接近传感器上报的事件信息时,控制接近传感器在第二预设时间内再次上报事件信息。由此,使得移动终端能够及时获取到接近传感器上报的事件信息,从而避免了移动终端遗漏接近传感器上报的事件信息而未能及时调整移动终端的状态的情况的发生,进而使得移动终端可根据及时上报的事件信息对移动终端进行调整,使得移动终端更加智能化,提高了用户对移动终端的用户体验度。According to the control device of the proximity sensor reporting event in the embodiment of the present invention, when the current application program uses the proximity sensor, it is judged whether the event information reported by the proximity sensor is received within the first preset time, and when it is judged that the event information reported by the proximity sensor is within the first preset time When the event information reported by the proximity sensor is not received within the time, the proximity sensor is controlled to report the event information again within a second preset time. Thus, the mobile terminal can obtain the event information reported by the proximity sensor in time, thereby avoiding the occurrence of the situation that the mobile terminal misses the event information reported by the proximity sensor and fails to adjust the state of the mobile terminal in time, and then enables the mobile terminal to be timely. The reported event information adjusts the mobile terminal, making the mobile terminal more intelligent, and improving the user experience of the user on the mobile terminal.
图5是根据本发明一个实施例的本发明实施例的接近传感器上报事件的控制装置的结构示意图,该实施例在前述图4所示实施例的基础上,如图5所示,上述装置还可以包括第一处理模块130,其中:Fig. 5 is a schematic structural diagram of a control device for reporting an event by a proximity sensor according to an embodiment of the present invention. This embodiment is based on the embodiment shown in Fig. 4, as shown in Fig. 5 , the above-mentioned device also A first processing module 130 may be included, wherein:
第一处理模块130用于在控制模块120控制接近传感器在第二预设时间内再次上报事件信息之后,根据接近传感器再次上报的事件信息控制移动终端执行对应地操作。The first processing module 130 is configured to control the mobile terminal to perform corresponding operations according to the event information reported again by the proximity sensor after the control module 120 controls the proximity sensor to report the event information again within a second preset time.
在本发明的一个实施例中,如图5所示,上述装置还可以包括第二判断模块140,其中:In an embodiment of the present invention, as shown in FIG. 5, the above-mentioned device may further include a second judging module 140, wherein:
第二判断模块140用于判断在第二预设时间内是否接收到接近传感器再次上报的事件信息。The second judging module 140 is used for judging whether the event information reported again by the proximity sensor is received within the second preset time.
其中,第一处理模块130还用于在判断出在第二预设时间内接收到接近传感器再次上报的事件信息时,根据接近传感器再次上报的事件信息控制移动终端执行对应地操作。Wherein, the first processing module 130 is further configured to control the mobile terminal to perform corresponding operations according to the event information reported again by the proximity sensor when it is determined that the event information reported again by the proximity sensor is received within the second preset time.
在本发明的一个实施例中,如图5所示,该装置还可以包括第二处理模块150,该第二处理模块150用于判断出第二预设时间内未接收到接近传感器再次上报的事件信息时,将接近传感器的事件信息设置为预设事件,并控制移动终端根据预设事件执行对应地操作。In one embodiment of the present invention, as shown in FIG. 5 , the device may further include a second processing module 150, which is used to determine that no proximity sensor report is received again within the second preset time. When receiving event information, set the event information of the proximity sensor as a preset event, and control the mobile terminal to perform corresponding operations according to the preset event.
根据本发明实施例的接近传感器上报事件的控制装置,在判断出在第一预设时间内未接收到接近传感器上报的事件信息,判断在第二预设时间内是否接收到近传感器再次上报的事件信息,并在接收到近传感器再次上报的事件信息时,控制移动终端根据接近传感器再次上报的事件信息执行对应地操作,以及在未接收到近传感器再次上报的事件信息时,将移动终端的接近传感器的事件信息设置为预设事件,并控制移动终端根据预设事件执行对应操作。由此,使得移动终端及时获取到接近传感器上报的事件信息,并根据事件信息控制移动终端及时进行操作调整,使得移动终端更加智能化,提高了用户对移动终端的用户体验度。According to the control device for reporting an event by a proximity sensor in an embodiment of the present invention, after judging that the event information reported by the proximity sensor has not been received within the first preset time, it is judged whether the event information reported by the proximity sensor is received again within the second preset time event information, and when the event information reported again by the proximity sensor is received, the mobile terminal is controlled to perform corresponding operations according to the event information reported again by the proximity sensor, and when the event information reported again by the proximity sensor is not received, the mobile terminal is The event information of the proximity sensor is set as a preset event, and the mobile terminal is controlled to perform corresponding operations according to the preset event. Thus, the mobile terminal can obtain the event information reported by the proximity sensor in time, and control the mobile terminal to perform operation adjustment in time according to the event information, making the mobile terminal more intelligent and improving the user experience of the mobile terminal.
为了实现上述实施例,本发明还提出一种移动终端。In order to realize the above embodiments, the present invention also proposes a mobile terminal.
一种移动终端,包括本发明第二方面实施例的接近传感器上报事件的控制装置。A mobile terminal includes the device for controlling an event reported by a proximity sensor according to the embodiment of the second aspect of the present invention.
根据本发明实施例的移动终端,在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到接近传感器上报的事件信息,并在判断出在第一预设时间内未接收到接近传感器上报的事件信息时,控制接近传感器在第二预设时间内再次上报事件信息。由此,使得移动终端能够及时获取到接近传感器上报的事件信息,从而避免了移动终端遗漏接近传感器上报的事件信息而未能及时调整移动终端的状态的情况的发生,进而使得移动终端可根据及时上报的事件信息对移动终端进行调整,使得移动终端更加智能化,提高了用户对移动终端的用户体验度。According to the mobile terminal of the embodiment of the present invention, when the current application program uses the proximity sensor, it is judged whether the event information reported by the proximity sensor is received within the first preset time, and when it is judged that the event information reported by the proximity sensor is not received within the first preset time When approaching the event information reported by the sensor, the proximity sensor is controlled to report the event information again within a second preset time. Thus, the mobile terminal can obtain the event information reported by the proximity sensor in time, thereby avoiding the occurrence of the situation that the mobile terminal misses the event information reported by the proximity sensor and fails to adjust the state of the mobile terminal in time, and then enables the mobile terminal to be timely. The reported event information adjusts the mobile terminal, making the mobile terminal more intelligent, and improving the user experience of the user on the mobile terminal.
为了实现上述实施例,本发明还提出一种移动终端,该移动终端包括壳体、处理器、存储器、电路板和电源电路,其中,电路板安置在壳体围成的空间内部,处理器和存储器设置在电路板上;电源电路,用于为移动终端的各个电路或器件供电;存储器用于存储可执行程序代码;处理器通过读取存储器中存储的可执行程序代码来运行与可执行程序代码对应的程序,以用于执行以下步骤:In order to realize the above embodiments, the present invention also proposes a mobile terminal, which includes a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is placed inside the space enclosed by the housing, and the processor and The memory is set on the circuit board; the power supply circuit is used to supply power to various circuits or devices of the mobile terminal; the memory is used to store executable program code; the processor runs and executes the program by reading the executable program code stored in the memory A program corresponding to the code to perform the following steps:
S11',在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到接近传感器上报的事件信息。S11', when the current application program uses the proximity sensor, determine whether the event information reported by the proximity sensor is received within the first preset time.
其中,事件信息可以包括但不限于接近事件和远离事件。Wherein, the event information may include, but not limited to, an approach event and a distance event.
其中,第一预设时间是移动终端中预先设置的,例如,第一预设时间为200ms,在当前应用程序使用接近传感器时,如果移动终端中预先设置在当前应用程序使用接近传感器时,接近传感器在200ms内需要上报事件信息,在后续当前应用程序中使用接近传感器时,可判断在200ms内是否接收到接近传感器上报的事件信息。Wherein, the first preset time is preset in the mobile terminal. For example, the first preset time is 200ms. When the current application program uses the proximity sensor, if the mobile terminal is preset when the current application program uses the proximity sensor, the proximity The sensor needs to report event information within 200ms. When the proximity sensor is used in the subsequent current application program, it can be judged whether the event information reported by the proximity sensor is received within 200ms.
其中,需要理解的是,当前应用程序为移动终端中在使用时需要应用到接近传感器的程序,例如,当前应用程序可以为控制通话的程序、控制移动终端自动背光的程序或者通过接近传感器对指纹传感器进行控制的程序等。Among them, it should be understood that the current application program is a program that needs to be applied to the proximity sensor during use in the mobile terminal. For example, the current application program can be a program that controls calls, a program that controls the automatic backlight of the mobile terminal, or a program that uses the proximity sensor to detect fingerprints. Programs for sensor control, etc.
S12',若判断出在第一预设时间内未接收到接近传感器上报的事件信息,则控制接近传感器在第二预设时间内再次上报事件信息。S12', if it is determined that the event information reported by the proximity sensor is not received within the first preset time, control the proximity sensor to report the event information again within the second preset time.
具体地,在判断出当前应用程序的应用层在第一预设时间内未接收到接近传感器上报的事件信息时,可向驱动层发送再次发送指令,然后,驱动层接收到再次发送之后,根据第二预设时间对定时器进行定时,并获取接近传感器接收到的当前接近值,判断当前接近值是否大于预设阈值,若判断出当前接近值大于预设阈值,则确定移动终端处于物体接近状态,并控制接近传感器在第二预设时间内上报接近事件。Specifically, when it is judged that the application layer of the current application program has not received the event information reported by the proximity sensor within the first preset time, it can send a resend instruction to the driver layer, and then, after the driver layer receives the resend instruction, according to The second preset time is used to time the timer, and obtain the current proximity value received by the proximity sensor, and judge whether the current proximity value is greater than the preset threshold. state, and control the proximity sensor to report the proximity event within a second preset time.
另外,若判断出当前接近值不大于预设阈值,则确定移动终端处于物体远离状态,并控制接近传感器在第二预设时间内上报远离事件。In addition, if it is judged that the current proximity value is not greater than the preset threshold, then it is determined that the mobile terminal is in the state of moving away from the object, and the proximity sensor is controlled to report the moving away event within a second preset time.
其中,第二预设时间是移动终端中预先设置的,例如,第二预设时间为200ms,在接收到再次发送接近传感器的事件信息的发送指令时,可将定时器中的时间设置为200ms。Wherein, the second preset time is preset in the mobile terminal, for example, the second preset time is 200ms, and when receiving the sending instruction to send the event information of the proximity sensor again, the time in the timer can be set to 200ms .
其中,预设阈值是移动终端中预先设置的,预设阈值的大小可以为900-1000,例如,预设阈值为1000。Wherein, the preset threshold is preset in the mobile terminal, and the preset threshold may be 900-1000, for example, the preset threshold is 1000.
例如,预设阈值为1000,在通话过程中,在监控到智能手机的驱动层发送接近传感器的事件信息,而智能手机的应用层在第一预设时间未接收到上报的接近传感器的事件信息时,智能手机的应用层可向驱动层发送再次发送指令,驱动层在接收到再次发送指令后,可根据第二预设时间设置定时器,并检测接近传感器中的当前红外线强度,假设当前红外线强度值为1050,通过比较可确定当前红外线强度值大于预设阈值,此时,可确定智能手机处于物体接近状态,其中,物体接近状态与接近事件对应,在确定出接近传感器中的事件信息为接近事件后,驱动层向应用层再次发送接近传感器的事件信息。For example, the preset threshold is 1000. During the call, the driver layer of the smart phone is monitored to send the event information of the proximity sensor, but the application layer of the smart phone does not receive the reported event information of the proximity sensor within the first preset time. , the application layer of the smart phone can send a resend instruction to the driver layer, and the driver layer can set the timer according to the second preset time after receiving the resend instruction, and detect the current infrared intensity in the proximity sensor. Assuming that the current infrared The intensity value is 1050. By comparison, it can be determined that the current infrared intensity value is greater than the preset threshold. At this time, it can be determined that the smartphone is in the object approach state, wherein the object approach state corresponds to the approach event, and the event information in the proximity sensor is determined to be After the proximity event, the driver layer sends the event information of the proximity sensor to the application layer again.
在本发明的一个实施例中,该处理器还可以包括步骤S13'。In an embodiment of the present invention, the processor may further include step S13'.
S13',根据接近传感器再次上报的事件信息控制移动终端执行对应地操作。S13', controlling the mobile terminal to perform corresponding operations according to the event information reported again by the proximity sensor.
其中,需要理解的是,事件信息不同,移动终端所执行地操作不同。事件信息与所执行的操作之间的对应关系是移动终端根据当前应用程序的功能需求预先设置的。Wherein, it should be understood that different event information means different operations performed by the mobile terminal. The corresponding relationship between event information and executed operations is preset by the mobile terminal according to the functional requirements of the current application program.
例如,在通话过程中,若监控到接近传感器应该上报事件信息,而未接收到接收接近传感器上报的事件信息时,移动终端可向驱动层发送再次发送指令,驱动层将再次检测接近传感器当前所产生的事件信息,并再次上报接近传感器的事件信息,如果移动终端再次接收到接近传感器上报的事件信息为接近事件,则控制移动终端屏幕熄屏,由此,可减少通话过程中对移动终端的误操作和降低屏幕的电量消耗。如果移动终端接收再次接收到接近传感器上报的事件信息为远离事件,则控制移动终端点亮屏幕。For example, during a call, if it monitors that the proximity sensor should report event information, but does not receive the event information reported by the proximity sensor, the mobile terminal can send a resend instruction to the driver layer, and the driver layer will detect again the current location of the proximity sensor. Generated event information, and report the event information of the proximity sensor again, if the mobile terminal receives the event information reported by the proximity sensor again as a proximity event, then control the screen of the mobile terminal to turn off the screen, thereby reducing the impact on the mobile terminal during the call. Misuse and reduce screen power consumption. If the mobile terminal receives the event information reported by the proximity sensor again as a far away event, the mobile terminal is controlled to turn on the screen.
再例如,在通过接近传感器对指纹传感器的工作状态进行控制的过程中,若监控到接近传感器应该上报事件信息,而未接收到接收接近传感器上报的事件信息时,移动终端可向驱动层发送再次发送指令,驱动层将再次检测接近传感器当前所产生的事件信息,并再次上报接近传感器的事件信息,如果移动终端再次接收到接近传感器上报的事件信息为接近事件,则控制移动终端中的指纹传感处于休眠状态,由此,可避免将移动终端放在裤子口袋中而引起的指纹识别造成的电池消耗。如果移动终端接收再次接收到接近传感器上报的事件信息为远离事件,则控制移动终端中的指纹传感处于工作状态。For another example, in the process of controlling the working state of the fingerprint sensor through the proximity sensor, if it is monitored that the proximity sensor should report event information, but the event information reported by the proximity sensor is not received, the mobile terminal can send another message to the driver layer. Send the instruction, the driver layer will detect the event information currently generated by the proximity sensor again, and report the event information of the proximity sensor again, if the mobile terminal receives the event information reported by the proximity sensor again as a proximity event, then control the fingerprint transmission in the mobile terminal The sensor is in a dormant state, thereby avoiding battery consumption caused by fingerprint recognition caused by putting the mobile terminal in a trouser pocket. If the mobile terminal receives the event information reported by the proximity sensor again as a far away event, control the fingerprint sensor in the mobile terminal to be in a working state.
其中,需要理解的是,在接近传感器被当前应用程序使用一段时间后,在监控到接近传感器的事件状态发生改变后,可将接近传感器的事件状态发生改变的信息进行上报,如果监控到应用层未接收到接近传感器的事件状态发生改变的信息,则控制接近传感器再次发送事件状态发生改变的信息,移动终端根据再次接收到的事件状态发生改变的信息控制移动终端执行对应的操作。Among them, it should be understood that after the proximity sensor is used by the current application for a period of time, after monitoring the event state of the proximity sensor has changed, the information about the change of the event state of the proximity sensor can be reported. If the application layer is monitored If the event state change information of the proximity sensor is not received, the proximity sensor is controlled to send the event state change information again, and the mobile terminal controls the mobile terminal to perform corresponding operations according to the received event state change information again.
也就是说,在移动终端根据接近传感器上报的事件信息执行对应操作后,如果监控到接近传感器中的事件信息未发生改变,则控制接近传感器不再上报事件信息,在监控到接近传感器中的事件信息发生改变后,例如,由接近事件变为远离事件,或者由远离事件变为接近事件,控制接近传感器上报事件变化信息,如果应用层接收到接近传感器上报的事件变化信息,则根据变化后的事件信息控制移动终端执行对应操作。That is to say, after the mobile terminal performs corresponding operations according to the event information reported by the proximity sensor, if it monitors that the event information in the proximity sensor has not changed, the proximity sensor is controlled to no longer report the event information, and the event information in the proximity sensor is monitored. After the information changes, for example, from a close event to a far away event, or from a far away event to a close event, control the proximity sensor to report the event change information. If the application layer receives the event change information reported by the proximity sensor, then according to the changed The event information controls the mobile terminal to perform corresponding operations.
例如,在通话过程中,在用户把手机放在耳朵进行通话时,移动终端熄屏,在监控到用户将手机从耳朵拿下来的过程中,接近传感器的状态由物体接近状态变为物体远离状态,此时,控制接近传感器上报事件变化信息,如果监控到驱动层上报了事件变化信息,而监控到应用层未接收到事件变化信息,则控制移动终端根据事件变化信息及时调整所执行地操作。For example, during a call, when the user puts the mobile phone on the ear to make a call, the screen of the mobile terminal turns off, and when the monitoring detects that the user takes the mobile phone off the ear, the state of the proximity sensor changes from the object-approaching state to the object-away state , at this time, the proximity sensor is controlled to report the event change information, and if it is monitored that the driver layer reports the event change information, but the application layer does not receive the event change information, then the mobile terminal is controlled to adjust the executed operations in time according to the event change information.
综上可以看出,该实施例在监控到应该接收到接近传感器上报的事件信息,而未接收到接近传感器上报的事件信息时,控制接近传感器再次上报事件信息,使得移动终端能够及时获取到接近传感器上报的事件信息,从而避免了移动终端遗漏接近传感器上报的事件信息而未能及时调整移动终端的状态的情况的发生。In summary, it can be seen that in this embodiment, when it is monitored that the event information reported by the proximity sensor should be received, but the event information reported by the proximity sensor is not received, the proximity sensor is controlled to report the event information again, so that the mobile terminal can obtain the proximity sensor in time. The event information reported by the sensor avoids the situation that the mobile terminal misses the event information reported by the proximity sensor and fails to adjust the state of the mobile terminal in time.
根据本发明实施例的移动终端,在当前应用程序使用接近传感器时,判断在第一预设时间内是否接收到接近传感器上报的事件信息,并在判断出在第一预设时间内未接收到接近传感器上报的事件信息时,控制接近传感器在第二预设时间内再次上报事件信息。由此,使得移动终端能够及时获取到接近传感器上报的事件信息,从而避免了移动终端遗漏接近传感器上报的事件信息而未能及时调整移动终端的状态的情况的发生,进而使得移动终端可根据及时上报的事件信息对移动终端进行调整,使得移动终端更加智能化,提高了用户对移动终端的用户体验度。According to the mobile terminal of the embodiment of the present invention, when the current application program uses the proximity sensor, it is judged whether the event information reported by the proximity sensor is received within the first preset time, and when it is judged that the event information reported by the proximity sensor is not received within the first preset time When approaching the event information reported by the sensor, the proximity sensor is controlled to report the event information again within a second preset time. Thus, the mobile terminal can obtain the event information reported by the proximity sensor in time, thereby avoiding the occurrence of the situation that the mobile terminal misses the event information reported by the proximity sensor and fails to adjust the state of the mobile terminal in time, and then enables the mobile terminal to be timely. The reported event information adjusts the mobile terminal, making the mobile terminal more intelligent, and improving the user experience of the user on the mobile terminal.
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本发明的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。In the description of this specification, descriptions referring to the terms "one embodiment", "some embodiments", "example", "specific examples", or "some examples" mean that specific features described in connection with the embodiment or example , structure, material or characteristic is included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the described specific features, structures, materials or characteristics may be combined in any suitable manner in any one or more embodiments or examples. In addition, those skilled in the art can combine and combine different embodiments or examples and features of different embodiments or examples described in this specification without conflicting with each other.
此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。在本发明的描述中,“多个”的含义是至少两个,例如两个,三个等,除非另有明确具体的限定。In addition, the terms "first" and "second" are used for descriptive purposes only, and cannot be interpreted as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include at least one of these features. In the description of the present invention, "plurality" means at least two, such as two, three, etc., unless otherwise specifically defined.
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本发明的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本发明的实施例所属技术领域的技术人员所理解。Any process or method descriptions in flowcharts or otherwise described herein may be understood to represent modules, segments or portions of code comprising one or more executable instructions for implementing specific logical functions or steps of the process , and the scope of preferred embodiments of the invention includes alternative implementations in which functions may be performed out of the order shown or discussed, including substantially concurrently or in reverse order depending on the functions involved, which shall It is understood by those skilled in the art to which the embodiments of the present invention pertain.
在流程图中表示或在此以其他方式描述的逻辑和/或步骤,例如,可以被认为是用于实现逻辑功能的可执行指令的定序列表,可以具体实现在任何计算机可读介质中,以供指令执行系统、装置或设备(如基于计算机的系统、包括处理器的系统或其他可以从指令执行系统、装置或设备取指令并执行指令的系统)使用,或结合这些指令执行系统、装置或设备而使用。就本说明书而言,"计算机可读介质"可以是任何可以包含、存储、通信、传播或传输程序以供指令执行系统、装置或设备或结合这些指令执行系统、装置或设备而使用的装置。计算机可读介质的更具体的示例(非穷尽性列表)包括以下:具有一个或多个布线的电连接部(电子装置),便携式计算机盘盒(磁装置),随机存取存储器(RAM),只读存储器(ROM),可擦除可编辑只读存储器(EPROM或闪速存储器),光纤装置,以及便携式光盘只读存储器(CDROM)。另外,计算机可读介质甚至可以是可在其上打印所述程序的纸或其他合适的介质,因为可以例如通过对纸或其他介质进行光学扫描,接着进行编辑、解译或必要时以其他合适方式进行处理来以电子方式获得所述程序,然后将其存储在计算机存储器中。The logic and/or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium, For use with instruction execution systems, devices, or devices (such as computer-based systems, systems including processors, or other systems that can fetch instructions from instruction execution systems, devices, or devices and execute instructions), or in conjunction with these instruction execution systems, devices or equipment for use. For the purposes of this specification, a "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use in or in conjunction with an instruction execution system, device, or device. More specific examples (non-exhaustive list) of computer-readable media include the following: electrical connection with one or more wires (electronic device), portable computer disk case (magnetic device), random access memory (RAM), Read Only Memory (ROM), Erasable and Editable Read Only Memory (EPROM or Flash Memory), Fiber Optic Devices, and Portable Compact Disc Read Only Memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program can be printed, since the program can be read, for example, by optically scanning the paper or other medium, followed by editing, interpretation or other suitable processing if necessary. processing to obtain the program electronically and store it in computer memory.
应当理解,本发明的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。It should be understood that various parts of the present invention can be realized by hardware, software, firmware or their combination. In the embodiments described above, various steps or methods may be implemented by software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one or combination of the following techniques known in the art: Discrete logic circuits, ASICs with suitable combinational logic gates, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.
本技术领域的普通技术人员可以理解实现上述实施例方法携带的全部或部分步骤是可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,该程序在执行时,包括方法实施例的步骤之一或其组合。Those of ordinary skill in the art can understand that all or part of the steps carried by the methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. During execution, one or a combination of the steps of the method embodiments is included.
此外,在本发明各个实施例中的各功能单元可以集成在一个处理模块中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing module, each unit may exist separately physically, or two or more units may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software function modules. If the integrated modules are realized in the form of software function modules and sold or used as independent products, they can also be stored in a computer-readable storage medium.
上述提到的存储介质可以是只读存储器,磁盘或光盘等。尽管上面已经示出和描述了本发明的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本发明的限制,本领域的普通技术人员在本发明的范围内可以对上述实施例进行变化、修改、替换和变型。The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, and the like. Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limiting the present invention, those skilled in the art can make the above-mentioned The embodiments are subject to changes, modifications, substitutions and variations.
Claims (12)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610454111.9A CN105975090A (en) | 2016-06-21 | 2016-06-21 | Control method, device and mobile terminal for reporting event by proximity sensor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610454111.9A CN105975090A (en) | 2016-06-21 | 2016-06-21 | Control method, device and mobile terminal for reporting event by proximity sensor |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105975090A true CN105975090A (en) | 2016-09-28 |
Family
ID=57021426
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610454111.9A Pending CN105975090A (en) | 2016-06-21 | 2016-06-21 | Control method, device and mobile terminal for reporting event by proximity sensor |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105975090A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106713572A (en) * | 2016-12-27 | 2017-05-24 | 广东欧珀移动通信有限公司 | Data reporting control method, device and terminal |
CN106776092A (en) * | 2016-12-06 | 2017-05-31 | 广东欧珀移动通信有限公司 | A kind of condition detection method of proximity transducer, device and terminal |
CN107504994A (en) * | 2017-08-08 | 2017-12-22 | 广东欧珀移动通信有限公司 | Calibration method, device, mobile terminal and readable storage medium for proximity sensor |
CN110233936A (en) * | 2019-07-04 | 2019-09-13 | Oppo广东移动通信有限公司 | Proximity state acquisition method, proximity state acquisition device, computer device, and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020167488A1 (en) * | 2000-07-17 | 2002-11-14 | Hinckley Kenneth P. | Mobile phone operation based upon context sensing |
CN102665008A (en) * | 2012-05-08 | 2012-09-12 | 广东欧珀移动通信有限公司 | Detecting algorithm for infrared proximity sensor of touch screen mobile phone |
CN102778947A (en) * | 2008-06-10 | 2012-11-14 | 联发科技股份有限公司 | Electronic device and method for contactlessly controlling electronic device |
CN102917124A (en) * | 2012-09-27 | 2013-02-06 | 东莞宇龙通信科技有限公司 | Method and mobile terminal for dynamically adjusting distance sensor threshold |
CN105453002A (en) * | 2013-07-31 | 2016-03-30 | 苹果公司 | Touch controller architecture |
CN105630232A (en) * | 2014-11-26 | 2016-06-01 | 阿尔卑斯电气株式会社 | Input device, and control method and program therefor |
-
2016
- 2016-06-21 CN CN201610454111.9A patent/CN105975090A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020167488A1 (en) * | 2000-07-17 | 2002-11-14 | Hinckley Kenneth P. | Mobile phone operation based upon context sensing |
CN102778947A (en) * | 2008-06-10 | 2012-11-14 | 联发科技股份有限公司 | Electronic device and method for contactlessly controlling electronic device |
CN102665008A (en) * | 2012-05-08 | 2012-09-12 | 广东欧珀移动通信有限公司 | Detecting algorithm for infrared proximity sensor of touch screen mobile phone |
CN102917124A (en) * | 2012-09-27 | 2013-02-06 | 东莞宇龙通信科技有限公司 | Method and mobile terminal for dynamically adjusting distance sensor threshold |
CN105453002A (en) * | 2013-07-31 | 2016-03-30 | 苹果公司 | Touch controller architecture |
CN105630232A (en) * | 2014-11-26 | 2016-06-01 | 阿尔卑斯电气株式会社 | Input device, and control method and program therefor |
Non-Patent Citations (2)
Title |
---|
孙光宇: "《Android物联网开发从入门到实战》", 31 July 2015 * |
陈以农: "《计算机科学导论 基于机器人的实践方法》", 31 August 2013 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106776092A (en) * | 2016-12-06 | 2017-05-31 | 广东欧珀移动通信有限公司 | A kind of condition detection method of proximity transducer, device and terminal |
CN106713572A (en) * | 2016-12-27 | 2017-05-24 | 广东欧珀移动通信有限公司 | Data reporting control method, device and terminal |
CN106713572B (en) * | 2016-12-27 | 2019-12-06 | Oppo广东移动通信有限公司 | Data reporting control method, device and terminal |
CN107504994A (en) * | 2017-08-08 | 2017-12-22 | 广东欧珀移动通信有限公司 | Calibration method, device, mobile terminal and readable storage medium for proximity sensor |
CN110233936A (en) * | 2019-07-04 | 2019-09-13 | Oppo广东移动通信有限公司 | Proximity state acquisition method, proximity state acquisition device, computer device, and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106340925B (en) | A charging control method, device and terminal | |
CN103500002B (en) | The method of application program management, device and terminal unit | |
CN103401991B (en) | A kind of method and apparatus that the communication event of terminal unit is pointed out | |
CN104871393B (en) | User equipment lamp light control method, device and user terminal | |
CN108896911A (en) | Charging abnormity detection method and device for electronic equipment | |
CN105681557B (en) | A method, apparatus and computer-readable storage medium for controlling an infrared proximity sensor | |
US20130194172A1 (en) | Disabling automatic display shutoff function using face detection | |
CN103686963A (en) | Method, device, equipment and system for controlling wireless network to be switched on/off | |
US20150119116A1 (en) | Battery, and method, device, and system for battery protection | |
CN104301504A (en) | Message viewing method and device and mobile terminal | |
CN105975090A (en) | Control method, device and mobile terminal for reporting event by proximity sensor | |
CN108616653A (en) | Information processing method, device, mobile terminal and computer readable storage medium | |
CN103823626A (en) | Method and device for regulating display contents and electronic equipment | |
CN103593049A (en) | Method, device and terminal device for processing reminding message | |
CN103631580A (en) | Method and device for generating theme icon | |
CN110912574B (en) | SIM card detection method, device, storage medium and terminal | |
CN109511139A (en) | WIFI control method, apparatus, mobile device, and computer-readable storage medium | |
CN107528958B (en) | Method for controlling mobile terminal, device, readable storage medium storing program for executing and mobile terminal | |
CN106020447A (en) | Method and system for adjusting proximity sensor parameters of touch electronic equipment | |
CN105467880A (en) | Method and apparatus for controlling intelligent socket work state | |
CN112542867B (en) | Mobile terminal power supply control method and device, terminal equipment and storage medium | |
CN110209415A (en) | Firmware method for refreshing, device and storage medium | |
CN106255146B (en) | A kind of electricity-saving control method of terminal, device and terminal | |
CN107526522A (en) | Blank screen gesture identification method and device, and mobile terminal, storage medium | |
CN107819938A (en) | Footmark collocation method, device, mobile terminal and server |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160928 |