CN-122018841-A - Device control method and device, electronic device and computer program product
Abstract
The application provides a device control method and device, electronic equipment and a computer program product, which can more accurately identify whether an external object approaches or is far away from the electronic equipment, and effectively improve the control accuracy of the screen state of the electronic equipment. The method comprises the steps of obtaining a first detection result determined by an ultrasonic sensor, obtaining a second detection result determined by an infrared light proximity sensor, obtaining gesture data collected by a gesture sensor, obtaining a target detection result based on at least one of the first detection result, the second detection result and the gesture data, wherein the target detection result is used for indicating whether an external object approaches or is far away from the electronic equipment, and controlling a screen state of the electronic equipment according to the target detection result, wherein the screen state comprises a screen-off state or a screen-on state.
Inventors
- LIN RUIBO
Assignees
- 成都欧珀通信科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20241112
Claims (11)
- 1. A device control method, characterized by being applied to an electronic device including an infrared light proximity sensor, an ultrasonic sensor, and an attitude sensor, the method comprising: acquiring a first detection result determined by the ultrasonic sensor, acquiring a second detection result determined by the infrared light proximity sensor, and acquiring gesture data acquired by the gesture sensor; obtaining a target detection result based on at least one of the first detection result, the second detection result and the gesture data, wherein the target detection result is used for indicating whether an external object approaches or is far away from the electronic equipment; And controlling the screen state of the electronic equipment according to the target detection result, wherein the screen state comprises a screen-off state or a screen-on state.
- 2. The method of claim 1, wherein the acquiring the first detection result determined by the ultrasonic sensor and the second detection result determined by the infrared light proximity sensor, acquiring the gesture data acquired by the gesture sensor, comprises: acquiring the first detection result determined by the ultrasonic sensor and the second detection result determined by the infrared light proximity sensor under the condition that the electronic equipment is in a call mode, and acquiring the gesture data acquired by the gesture sensor; and controlling the screen state of the electronic equipment according to the target detection result, wherein the method comprises the following steps: and controlling a screen state of the electronic device to be the off-screen state in the case that the target detection result indicates that an external object is close to the electronic device, and/or, And controlling the screen state of the electronic equipment to be the bright screen state under the condition that the target detection result indicates that an external object is far away from the electronic equipment.
- 3. The method of claim 1, wherein the obtaining the target detection result based on at least one of the first detection result, the second detection result, and the gesture data comprises: in the case that the first detection result is the same as the second detection result, determining the target detection result as the first detection result or the second detection result, or And obtaining the target detection result based on the first detection result, the second detection result and the gesture data under the condition that the first detection result is determined to be different from the second detection result.
- 4. A method according to claim 3, wherein said determining that the first test result is different from the second test result comprises: The first detection result indicates that the external object is far away from the electronic equipment, and the second detection result indicates that the external object is close to the electronic equipment, or The first detection result indicates that an external object is close to the electronic equipment, and the second detection result indicates that the external object is far away from the electronic equipment.
- 5. The method of claim 4, wherein, in the case where the first detection result is determined to be different from the second detection result, obtaining the target detection result based on the first detection result, the second detection result, and the posture data, comprises: And if the electronic equipment is identified to be in a receiving posture according to the posture data under the condition that the first detection result indicates that the external object is close to the electronic equipment and the second detection result indicates that the external object is far away from the electronic equipment, determining that the target detection result is that the external object is close to the electronic equipment, and/or, And under the condition that the first detection result indicates that the external object is close to the electronic equipment and the second detection result indicates that the external object is far away from the electronic equipment, if the electronic equipment is not in the answering posture according to the posture data, determining that the target detection result is that the external object is far away from the electronic equipment.
- 6. The method of claim 1, wherein the obtaining the target detection result based on at least one of the first detection result, the second detection result, and the gesture data comprises: and determining that the target detection result is the indication that the external object is close to the electronic equipment under the condition that the second detection result indicates that the external object is close to the electronic equipment.
- 7. The method of claim 1, wherein the ultrasonic sensor comprises an ultrasonic transmitting unit and an ultrasonic receiving unit, the ultrasonic transmitting unit comprises an earpiece, the ultrasonic receiving unit comprises a microphone, the first detection result comprises distance information, and the obtaining the first detection result determined by the ultrasonic sensor comprises: Transmitting an ultrasonic signal through the earpiece; receiving a reflected signal of the ultrasonic signal through the microphone; Acquiring the distance information according to the transmission time between the ultrasonic signal and the reflected signal; The method comprises the steps that when the distance information is smaller than a first distance threshold, the first detection result indicates that an external object approaches the electronic equipment, or when the distance information is larger than or equal to a second distance threshold, the first detection result indicates that the external object is far away from the electronic equipment, and the second distance threshold is larger than or equal to the first distance threshold.
- 8. The method of claim 1, wherein the acquiring the first detection result determined by the ultrasonic sensor and the second detection result determined by the infrared light proximity sensor, acquiring the gesture data acquired by the gesture sensor, comprises: Acquiring a first detection result determined by the ultrasonic sensor and a second detection result determined by the infrared light proximity sensor through a proximity detection virtual sensor, and acquiring gesture data acquired by the gesture sensor; the obtaining a target detection result based on at least one of the first detection result, the second detection result, and the gesture data includes: And obtaining the target detection result based on the first detection result, the second detection result and the gesture data through the proximity detection virtual sensor.
- 9. A device control apparatus, characterized by being applied to an electronic device including an infrared light proximity sensor, an ultrasonic sensor, and an attitude sensor, comprising: the acquisition module is used for acquiring a first detection result determined by the ultrasonic sensor, acquiring a second detection result determined by the infrared light proximity sensor and acquiring gesture data acquired by the gesture sensor; The electronic equipment comprises a first detection result, a second detection result and gesture data, a processing module, a screen state control module and a control module, wherein the first detection result, the second detection result and the gesture data are used for obtaining a target detection result, the target detection result is used for indicating whether an external object approaches to or is far away from the electronic equipment, and the screen state of the electronic equipment is controlled according to the target detection result, and the screen state comprises a screen-off state or a screen-on state.
- 10. An electronic device comprising a processor and a memory for storing code instructions, the processor for executing the code instructions to perform the method of any one of claims 1 to 8.
- 11. A computer program product comprising computer program code for causing a computer to carry out the method according to any one of claims 1 to 8 when said computer program code is run on the computer.
Description
Device control method and device, electronic device and computer program product Technical Field The present application relates to the field of terminal devices, and in particular, to a device control method and apparatus, an electronic device, and a computer program product. Background With the development of science and technology, and the innovation of the form and the function innovation of the electronic equipment, the electronic equipment is more various and has more abundant functions. In the market at present, touch screen type electronic equipment has very high duty ratio and is favored by more and more users. In the process of using the touch screen type electronic equipment, the electronic equipment can control the screen state according to the distance relation with an external object. Therefore, how to accurately identify the distance between the external object and the electronic device, so as to accurately control the screen state of the electronic device, is a problem to be solved. Disclosure of Invention The application provides a device control method and device, electronic equipment and a computer program product, which can more accurately identify whether an external object approaches or is far away from the electronic equipment, and effectively improve the control accuracy of the screen state of the electronic equipment. According to a first aspect, an electronic device is provided, the electronic device comprises an infrared light proximity sensor, an ultrasonic sensor and an attitude sensor, the method comprises the steps of obtaining a first detection result determined by the ultrasonic sensor, obtaining a second detection result determined by the infrared light proximity sensor, obtaining attitude data collected by the attitude sensor, obtaining a target detection result based on at least one of the first detection result, the second detection result and the attitude data, wherein the target detection result is used for indicating whether an external object is close to or far from the electronic device, and controlling a screen state of the electronic device according to the target detection result, wherein the screen state comprises a screen-off state or a screen-on state. In the application, the electronic equipment can obtain the target detection result based on at least one of the first detection result, the second detection result and the gesture data, wherein the target detection result is used for indicating whether an external object approaches or is far away from the electronic equipment, and the screen state of the electronic equipment is controlled to be in a screen-off state or a screen-on state according to the target detection result. The first detection result is determined through the ultrasonic sensor, the second detection result is determined through the infrared light proximity sensor, and the gesture data are collected through the gesture sensor, so that the electronic device can synthesize the first detection result corresponding to the infrared light proximity sensor, the second detection result corresponding to the ultrasonic sensor and the gesture data collected by the gesture sensor, whether an external object is close to or far away from the electronic device can be more accurately identified, and accurate control of the screen state of the electronic device is realized. In a second aspect, a device control apparatus is provided, employing an electronic device including an infrared light proximity sensor, an ultrasonic sensor, and an attitude sensor, the device control apparatus including an acquisition module and a processing module. The electronic equipment comprises an acquisition module, a processing module, a target detection module and a control module, wherein the acquisition module is used for acquiring a first detection result determined by an ultrasonic sensor and acquiring a second detection result determined by an infrared light proximity sensor and acquiring gesture data acquired by a gesture sensor, the processing module is used for acquiring a target detection result based on at least one of the first detection result, the second detection result and the gesture data, the target detection result is used for indicating whether an external object approaches or is far away from the electronic equipment, and the screen state of the electronic equipment is controlled according to the target detection result and comprises a screen-off state or a screen-on state. In a third aspect, there is provided an electronic device comprising a processor coupled to a memory, operable to execute instructions in the memory to implement a method as in any one of the possible implementations of the first aspect. Optionally, the electronic device further comprises a memory. Optionally, the electronic device further comprises a communication interface, and the processor is coupled to the communication interface. In a fourth aspect, a processor is provided that inclu