Infrared remote control method, electronic device, storage medium, and program product

WO2026188875A1PCT designated stage Publication Date: 2026-09-17HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/139433
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-03-10
Filing Date
2025-12-02
Publication Date
2026-09-17

Smart Images

  • Figure CN2025139433_17092026_PF_FP_ABST
    Figure CN2025139433_17092026_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide an infrared remote control method, an electronic device, a storage medium, and a program product, applied to the technical field of electronics. The method comprises: receiving a first operation of a user on a remote control application, the first operation being used for triggering infrared remote control; in response to the first operation, sending first configuration information to a TOF camera, the first configuration information being used for configuring the TOF camera to be in an infrared mode; and when the TOF camera is in the infrared mode, transmitting an infrared signal by means of the TOF camera, the infrared signal being used for performing infrared remote control on a controlled device. Therefore, in the embodiments of the present application, the TOF camera originally installed in an electronic device can be used to transmit an infrared signal outward to achieve infrared remote control. In this way, an infrared remote control transmitter arranged at the top of the electronic device can be removed, and there is no need to form a hole on a middle frame at the top of the electronic device, thereby saving the internal space of the electronic device and reducing the cost of the electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Infrared remote control methods, electronic devices, storage media and software products

[0001] This application claims priority to Chinese patent application filed on March 10, 2025, with application number 202510285105.4 and entitled "Infrared remote control method, electronic device, storage medium and program product", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of electronic technology, and in particular to an infrared remote control method, electronic device, storage medium, and program product. Background Technology

[0003] With the continuous development of electronic technology, electronic devices such as mobile phones or tablets can support infrared remote control functions, enabling users to remotely control controlled devices such as TVs, set-top boxes, air conditioners, lights, and refrigerators through their electronic devices.

[0004] In order to enable infrared remote control of electronic devices, an infrared remote control transmitter needs to be installed on the top of the electronic device, and an opening needs to be made in the middle frame of the top of the electronic device so that the infrared light emitting diode (LED) in the infrared remote control transmitter can emit infrared signals to the outside, thereby enabling infrared remote control of the controlled device.

[0005] However, this method takes up space inside electronic devices and increases the cost of the devices. Summary of the Invention

[0006] This application provides an infrared remote control method, electronic device, storage medium, and program product. The infrared remote control function is achieved through a time-of-flight (TOF) camera in the electronic device, which can save internal space of the electronic device and reduce the cost of the electronic device.

[0007] In a first aspect, embodiments of this application propose an infrared remote control method applied to an electronic device, the electronic device including a remote control application and a Time-of-Flight (TOF) camera. The method includes: the electronic device receiving a first operation from a user on the remote control application; the first operation triggering infrared remote control; the electronic device responding to the first operation sending first configuration information to the TOF camera; the first configuration information configuring the TOF camera in infrared mode; and, when the TOF camera is in infrared mode, the electronic device emitting an infrared signal through the TOF camera; the infrared signal being used for infrared remote control of the controlled device.

[0008] Thus, in the infrared remote control scenario, the TOF camera originally installed in the electronic device can be used to emit infrared signals to achieve infrared remote control. This eliminates the need for the infrared remote control transmitter installed on the top of the electronic device and also eliminates the need to open a hole in the middle frame of the top of the electronic device, thereby saving internal space and reducing the cost of the electronic device.

[0009] In one possible implementation, the electronic device transmits infrared signals via a Time-of-Flight (TOF) camera, including: the electronic device converting the infrared remote control code corresponding to the first operation into a Serial Peripheral Interface (SPI) signal; and the electronic device controlling the TOF camera to transmit infrared signals based on the SPI signal. This allows the TOF camera to transmit infrared signals based on the SPI signal, thereby achieving precise remote control of the controlled device.

[0010] In one possible implementation, the electronic device includes an application layer, an application framework layer, a hardware abstraction layer, and a kernel layer. The application layer includes a remote control application and an infrared remote control software development kit (SDK). The application framework layer includes a first infrared manager and a camera service. The hardware abstraction layer includes a camera hardware abstraction module, and the kernel layer includes a camera driver. In response to a first operation, the electronic device sends first configuration information to the TOF camera, including: the remote control application, in response to the first operation, obtains the infrared remote control code corresponding to the first operation from the infrared remote control SDK; the remote control application sends the infrared remote control code to the first infrared manager; after receiving the infrared remote control code, the first infrared manager, through the first infrared manager, the camera service, the camera hardware abstraction module, and the camera driver, powers on the TOF camera and sends the first configuration information to the TOF camera. This provides an implementation method for powering on a TOF camera and sending first configuration information to the TOF camera.

[0011] In one possible implementation, the TOF camera is powered on and first configuration information is sent to it via a first infrared manager, a camera service, a camera hardware abstraction module, and a camera driver. This includes: sending a first instruction to the camera service via the first infrared manager; the first instruction instructing the TOF camera to be powered on and configured in infrared mode; the camera service, based on the first instruction, calling a first function in the camera hardware abstraction module; and the camera hardware abstraction module, through the first function, controlling the camera driver to trigger the power-on operation of the TOF camera and to send the first configuration information to the TOF camera. Thus, by customizing the camera hardware abstraction module in the hardware abstraction layer, the power-on and initialization operations of the TOF camera are implemented during the execution of the first function, thereby configuring the TOF camera in infrared mode.

[0012] In one possible implementation, a first instruction is sent to the camera service via a first infrared manager, including: the first infrared manager querying the identification information of a TOF camera in the electronic device that supports infrared remote control functionality; the first infrared manager sending the first instruction to the camera service; and the first instruction including the identification information. Thus, in this embodiment of the application, the first infrared manager in the application framework layer can be used to open a TOF camera that supports infrared remote control functionality.

[0013] In one possible implementation, the hardware abstraction layer further includes an infrared hardware abstraction module, and the camera hardware abstraction module includes an infrared service. A first instruction is sent to the camera service via a first infrared manager, including: the first infrared manager sending an infrared remote control code to the infrared hardware abstraction module; the infrared hardware abstraction module querying whether the electronic device supports infrared remote control functionality; if the electronic device supports infrared remote control functionality, the infrared hardware abstraction module sending a second instruction to the infrared service; the second instruction instructing the TOF camera to be powered on and configured in infrared mode; based on the second instruction, the infrared service querying the identification information of the TOF camera in the electronic device that supports infrared remote control functionality; and the infrared service sending the first instruction to the camera service; the first instruction includes the identification information. Thus, this embodiment of the application adds an infrared service to the camera hardware abstraction module in the hardware abstraction layer and opens the TOF camera that supports infrared remote control functionality through the VNDK interface between the infrared service and the camera service.

[0014] In one possible implementation, the hardware abstraction layer further includes a configuration module. The camera hardware abstraction module, through a first function, controls the camera driver to trigger a power-on operation on the TOF camera and to send first configuration information to the TOF camera. This includes: the camera hardware abstraction module sequentially calling a second and a third function within itself through the first function; the camera hardware abstraction module sending a third instruction to the camera driver through the second function; the third instruction instructing the TOF camera to be powered on; the camera driver triggering a power-on operation on the TOF camera based on the third instruction; after the TOF camera is powered on, the camera hardware abstraction module obtaining the first configuration information from the configuration module through the third function; the camera hardware abstraction module sending the first configuration information to the camera driver; and the camera driver sending the first configuration information to the TOF camera. Thus, by powering on the TOF camera and then sending the first configuration information to it, the specific processing flow for the TOF camera to enter infrared mode can be precisely controlled.

[0015] In one possible implementation, the first instruction includes identification information of the TOF camera supporting infrared remote control functionality. The camera hardware abstraction module obtains first configuration information from the configuration module through a third function, including: the camera hardware abstraction module obtains the first configuration information corresponding to the identification information from the configuration module through the third function. This allows for precise acquisition of the first configuration information.

[0016] In one possible implementation, the image output mode of the TOF camera has a higher priority than the infrared mode. The method further includes: when the TOF camera is in infrared mode, if the camera service receives an image output request for the TOF camera, the camera service triggers a second operation for the TOF camera; the second operation is to exit infrared mode and enter image output mode; when the TOF camera is in image output mode, if the camera service receives an infrared remote control request for the TOF camera, the camera service controls the TOF camera to remain in image output mode. Thus, by adding priority judgment logic to the camera service in the application framework layer, when both acquiring TOF images and performing infrared remote control require the same TOF camera, the camera service can choose to execute one function based on the priority judgment logic, thereby resolving the TOF camera call conflict problem.

[0017] In one possible implementation, the infrared mode of the TOF camera has a higher priority than the image output mode. The method further includes: when the TOF camera is in image output mode, if the camera service receives an infrared remote control request for the TOF camera, the camera service triggers a third operation for the TOF camera; the third operation is to exit image output mode and enter infrared mode; when the TOF camera is in infrared mode, if the camera service receives an image output request for the TOF camera, the camera service controls the TOF camera to remain in infrared mode. Thus, by adding priority judgment logic to the camera service in the application framework layer, when both acquiring TOF images and performing infrared remote control require the same TOF camera, the camera service can choose to execute one function based on the priority judgment logic, thereby resolving the TOF camera call conflict problem.

[0018] In one possible implementation, the electronic device includes an application layer, an application framework layer, a hardware abstraction layer, and a kernel layer. The application layer includes a remote control application and an infrared remote control SDK. The application framework layer includes a first infrared manager. The hardware abstraction layer includes an infrared hardware abstraction module. The kernel layer includes a device node, a second infrared manager, and a first infrared driver. In response to a first operation, the electronic device sends first configuration information to the TOF camera, including: the remote control application, in response to the first operation, obtains the infrared remote control code corresponding to the first operation from the infrared remote control SDK; the remote control application sends the infrared remote control code to the first infrared manager; the first infrared manager sends the infrared remote control code to the infrared hardware abstraction module; after the infrared hardware abstraction module receives the infrared remote control code, it powers on the TOF camera and sends the first configuration information to the TOF camera through the infrared hardware abstraction module, the device node, the second infrared manager, and the first infrared driver. This provides another implementation for powering on the TOF camera and sending the first configuration information to the TOF camera.

[0019] In one possible implementation, the TOF camera is powered on and first configuration information is sent to it via an infrared hardware abstraction module, a device node, a second infrared manager, and a first infrared driver. This includes: the infrared hardware abstraction module querying whether the electronic device supports infrared remote control functionality; if the electronic device supports infrared remote control functionality, the infrared hardware abstraction module sending a fourth instruction to the device node; the fourth instruction instructing the TOF camera to be powered on and configured in infrared mode; the device node, based on the fourth instruction, sequentially calling the fourth and fifth functions in the second infrared manager; the second infrared manager, through the fourth function, controlling the first infrared driver to trigger the power-on operation of the TOF camera; and after the TOF camera is powered on, the second infrared manager, through the fifth function, controlling the first infrared driver to send the first configuration information to the TOF camera. Thus, this embodiment of the application can add a device node in the kernel layer to enable interaction between the infrared hardware abstraction module and the kernel layer, thereby activating the TOF camera that supports infrared remote control functionality.

[0020] In one possible implementation, the second infrared manager controls the first infrared driver to trigger a power-on operation on the TOF camera via a fourth function. This includes: the second infrared manager calling a sixth function in the first infrared driver via the fourth function; and the first infrared driver triggering a power-on operation on the TOF camera via the sixth function. Correspondingly, the second infrared manager controls the first infrared driver to send first configuration information to the TOF camera via a fifth function. This includes: the second infrared manager calling a seventh function in the first infrared driver via the fifth function; and the first infrared driver sending the first configuration information to the TOF camera via the seventh function. Thus, by powering on the TOF camera and then sending the first configuration information to it, the specific processing flow for the TOF camera to enter infrared mode can be precisely controlled.

[0021] In one possible implementation, the application framework layer also includes a camera service, the hardware abstraction layer includes a camera hardware abstraction module, and the kernel layer includes a camera driver. The method further includes: when the TOF camera is in infrared mode, if the camera service receives an image output request for the TOF camera, the camera service calls a first function in the camera hardware abstraction module; the camera hardware abstraction module, through the first function, calls an eighth function in the camera driver; the camera driver, through the eighth function, notifies a ninth function in the second infrared manager; the second infrared manager, through the ninth function, controls the first infrared driver to trigger a second operation for the TOF camera; the second operation is to exit infrared mode and enter image output mode. This resolves the TOF camera call conflict issue.

[0022] In one possible implementation, the TOF camera includes a TOF sensor and a driver chip. Sending first configuration information to the TOF camera includes: the electronic device sending the first configuration information to the TOF sensor; the TOF sensor sending the first configuration information to the driver chip to configure the driver chip in infrared mode. This allows the driver chip in the TOF sensor to be configured in infrared mode.

[0023] In one possible implementation, the electronic device includes an application layer, an application framework layer, a hardware abstraction layer, and a kernel layer. The application layer includes a remote control application, the application framework layer includes a first infrared manager, the hardware abstraction layer includes an infrared hardware abstraction module, and the kernel layer includes a second infrared driver and an SPI driver. The electronic device converts the infrared remote control code corresponding to the first operation into an SPI signal, including: the remote control application sending the infrared remote control code to the first infrared manager; the first infrared manager sending the infrared remote control code to the infrared hardware abstraction module; the infrared hardware abstraction module sending the infrared remote control code to the second infrared driver; and the second infrared driver converting the infrared remote control code into an SPI signal. Correspondingly, the electronic device controls the TOF camera to emit infrared signals based on the SPI signal, including: the second infrared driver sending the SPI signal to the SPI driver; the SPI driver sending the SPI signal to the TOF camera; and the TOF camera emitting infrared signals based on the SPI signal. This allows the TOF camera to emit infrared signals based on the SPI signal, achieving precise remote control of the controlled device.

[0024] In one possible implementation, the TOF camera includes a driver chip and a transmitter. The SPI driver sends SPI signals to the TOF camera, including sending the SPI signal to the driver chip. Correspondingly, the TOF camera transmits infrared signals based on the SPI signals, including the driver chip controlling the transmitter to transmit infrared signals based on the SPI signals. Thus, a driver chip in infrared mode can be used to control the transmitter to transmit infrared signals.

[0025] Secondly, embodiments of this application propose an electronic device, including a memory and a processor. The memory is used to store a computer program, and the processor is used to call the computer program to execute the above-described infrared remote control method.

[0026] Thirdly, embodiments of this application propose a computer-readable storage medium storing a computer program or instructions, which, when executed, implements the aforementioned infrared remote control method.

[0027] Fourthly, embodiments of this application propose a computer program product, including a computer program that, when run, causes the computer to execute the aforementioned infrared remote control method.

[0028] The possible implementations of aspects two through four have similar effects to those of aspect one and the possible designs of aspect one, and will not be elaborated upon here. Attached Figure Description

[0029] Figure 1 is a schematic diagram of the application scenario of the infrared remote control method provided in the embodiment of this application;

[0030] Figure 2 is a schematic diagram of the arrangement of multiple cameras on an electronic device according to an embodiment of this application;

[0031] Figure 3 is a schematic diagram of the TOF camera emitting infrared light according to an embodiment of this application;

[0032] Figure 4 is a schematic diagram of the hardware system structure of the electronic device provided in the embodiment of this application;

[0033] Figure 5 is a schematic diagram of the software system structure of the electronic device provided in the embodiment of this application;

[0034] Figure 6 is a schematic diagram of the structure of the TOF camera provided in an embodiment of this application;

[0035] Figure 7 is a schematic diagram of the interaction of software modules involved in the first infrared remote control method provided in the embodiments of this application;

[0036] Figure 8 is a flowchart illustrating the first infrared remote control method provided in the embodiments of this application;

[0037] Figure 9 is a schematic diagram of the interaction of software modules involved in the second infrared remote control method provided in the embodiments of this application;

[0038] Figure 10 is a flowchart illustrating the second infrared remote control method provided in the embodiments of this application;

[0039] Figure 11 is a schematic diagram of the interaction of software modules involved in the third infrared remote control method provided in the embodiments of this application;

[0040] Figure 12 is a flowchart illustrating the third infrared remote control method provided in the embodiments of this application;

[0041] Figure 13 is a flowchart of an infrared remote control method provided in an embodiment of this application;

[0042] Figure 14 is a schematic diagram of an infrared remote control device provided in an embodiment of this application;

[0043] Figure 15 is a schematic diagram of the structure of a chip provided in an embodiment of this application. Detailed Implementation

[0044] To facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with essentially the same function and purpose. For example, "first chip" and "second chip" are used only to distinguish different chips and do not limit their order. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" do not necessarily imply that they are different.

[0045] It should be noted that, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0046] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0047] To make users' lives more convenient, some electronic devices such as mobile phones or tablets can support infrared remote control functions, allowing users to remotely control controlled devices such as TVs, set-top boxes, air conditioners, lights, and refrigerators using infrared.

[0048] Taking a mobile phone as the electronic device and a television as the controlled device as an example, in some scenarios, as shown in Figure 1, while using the television 200, the user can perform relevant operations on the mobile phone 100, causing the mobile phone 100 to emit infrared signals. After receiving the infrared signals emitted by the mobile phone 100, the television 200 parses the working instructions included in the infrared signals to execute the remote control response operation corresponding to the working instructions, thereby realizing infrared remote control of the television 200 through the mobile phone 100.

[0049] For example, a user can perform a first remote control operation on mobile phone 100, causing mobile phone 100 to emit an infrared signal containing a power-on command. Upon receiving this infrared signal, television 200 can then power on. Alternatively, a user can perform a second remote control operation on mobile phone 100, causing mobile phone 100 to emit an infrared signal containing a power-off command. Upon receiving this infrared signal, television 200 can then power off. Or, a user can perform a third remote control operation on mobile phone 100, causing mobile phone 100 to emit an infrared signal containing a volume adjustment command. Upon receiving this infrared signal, television 200 can then adjust the volume.

[0050] It is understood that the embodiments of this application can be applied to any scenario of infrared remote control. The electronic device can be a mobile phone, tablet computer, or personal computer, etc. The controlled device refers to any device capable of receiving infrared signals and performing the functions corresponding to those signals. For example, the controlled device can include, but is not limited to, home appliances such as televisions, set-top boxes, air conditioners, lamps, and refrigerators. Figure 1 illustrates this using a mobile phone 100 as the electronic device and a television 200 as the controlled device.

[0051] In some related technologies, to achieve infrared remote control functionality for electronic devices, an infrared remote control transmitter needs to be installed on the top of the electronic device, with an opening in the top frame. The infrared remote control transmitter can include an infrared LED and an optical structure, with the optical structure having high infrared transmittance. In this way, the infrared signal emitted by the infrared LED passes through the optical structure and can be emitted outwards from the opening in the top frame of the electronic device, thereby enabling infrared remote control of the controlled device.

[0052] However, integrating infrared remote control functionality into electronic devices using the above method requires an additional infrared remote control transmitter and an opening in the top frame of the electronic device. This occupies internal space and increases the cost of the electronic device.

[0053] Some electronic devices can be equipped with TOF cameras. Figure 2 is a schematic diagram of the arrangement of multiple cameras on an electronic device according to an embodiment of this application. Taking a mobile phone as an example, as shown in Figure 2, a front-facing camera can be set on the front of the mobile phone 100. The front-facing camera may include a TOF camera 101 and a red-green-blue (RGB) camera 102.

[0054] The TOF camera 101 can be used in scenarios such as face authentication, eye tracking, and intelligent perception. The RGB camera 102 is used to capture images under visible light.

[0055] Facial authentication refers to using a TOF camera to capture facial images, performing facial recognition based on the facial images, and executing tasks such as unlocking or making payments based on the results of facial recognition.

[0056] Eye tracking refers to using a Time-of-Flight (TOF) camera to capture images of a user's eyes, identifying the coordinates of the eye's gaze point based on these images, and then determining the user's intention to perform actions automatically. For example, when a user receives a notification such as an SMS or push notification while using an electronic device, a TOF camera can capture images of the user's eyes, identify the coordinates of the eye's gaze point, determine whether the user is looking at a banner notification area, and calculate the gaze duration. If it is determined that the user is looking at the banner notification area and the gaze duration exceeds a threshold, the system can then perform corresponding actions such as expanding, collapsing, exiting, or entering the application within the banner notification area.

[0057] Intelligent sensing refers to various sensing services provided to users, such as air gesture service, intelligent code recognition service, gaze-based screen-on service, and gaze-based ringtone reduction service. Air gesture service uses a TOF camera to recognize user gestures and responds according to preset strategies to achieve human-computer interaction. For example, after recognizing a user's air-grabbing gesture, the electronic device can take a screenshot; when recognizing a user's air-swipe up / down gesture, it can swipe the currently displayed user interface. Intelligent code recognition service, when the electronic device is in a screen-on, unlocked state, detects the user flipping the phone, uses the electronic device's TOF camera to capture an image, and recognizes the QR code in the image to display the application interface corresponding to the QR code. The gaze-based screen-on service, when the electronic device is on, will not turn off the screen if the TOF camera detects the user looking at the device, until the user stops looking. The gaze-based ringtone reduction service, when the electronic device is on, will automatically lower the ringtone volume when the user receives an incoming call if the TOF camera detects the user looking at the device.

[0058] As shown in Figure 2, the TOF camera 101 may include a TOF sensor 1011 (i.e., TOF sensor), a transmitter 1012, a receiver 1013, and a driver IC (i.e., driver IC, not shown in Figure 2), etc.

[0059] The emitting device 1012 can be used to emit infrared light. The receiving device 1013 can be used to receive infrared light reflected back from the object being photographed.

[0060] When using a TOF camera 101 to acquire TOF images, the TOF camera 101 can receive second configuration information sent by the processor. This second configuration information is used to configure the TOF camera 101 in image output mode. Specifically, the second configuration information may include first configuration sub-information and second configuration sub-information. The first configuration sub-information is the configuration information of the TOF sensor 1011 in image output mode, and the second configuration sub-information is the configuration information of the driver chip in image output mode.

[0061] In this way, after receiving the second configuration information sent by the processor, the TOF sensor 1011 in the TOF camera 101 can be configured based on the first configuration sub-information in the second configuration information. The TOF sensor 1011 can also send the second configuration sub-information in the second configuration information to the driver chip, enabling the driver chip to configure itself based on the second configuration sub-information, thereby configuring the TOF camera 101 in image output mode. When the TOF camera 101 is in image output mode, the driver chip can drive the emitting device 1012 to emit infrared light outwards. The TOF sensor 1011 can also calculate the time difference or phase difference between the infrared light emitted and reflected back to the TOF camera 101, thereby calculating the distance between the TOF camera 101 and the object being photographed, and generating a TOF image.

[0062] The emitting device 1012 can be an LED, a laser diode (LD), a vertical cavity surface emitter laser (VCSEL), or an edge emitting laser (EEL), etc. The receiving device 1013 can be a photodiode (PD), etc. This application embodiment does not limit the specific types of the emitting device 1012 and the receiving device 1013.

[0063] Figure 3 is a schematic diagram of the TOF camera emitting infrared light according to an embodiment of this application. As shown in Figure 3, a TOF camera can be set on the front of the mobile phone 100 to emit infrared light outward.

[0064] Since the center wavelength of the infrared signal used in infrared remote control is 940nm, and the center wavelength of the infrared light emitted by the TOF camera is also 940nm.

[0065] Based on this, this application provides an infrared remote control method. The method involves receiving a first operation from a user on a remote control application, which triggers infrared remote control. In response to the first operation, first configuration information is sent to a Time-of-Flight (TOF) camera to configure it to infrared mode. When the TOF camera is in infrared mode, it emits an infrared signal to remotely control the controlled device. Therefore, in infrared remote control scenarios, this application can utilize the TOF camera already installed in the electronic device to emit infrared signals, thus eliminating the need for an infrared remote control transmitter on the top of the electronic device and eliminating the need for an opening in the top frame, thereby saving internal space and reducing the cost of the electronic device.

[0066] In some embodiments, the TOF camera can be a front-facing TOF camera, meaning that the TOF camera is located on the front of the electronic device.

[0067] Because the optical power of the transmitting device used by the front-facing TOF camera is higher than the optical power of the infrared LED in the infrared remote control transmitter located on the top of the electronic device, and the optical power of the transmitting device used by the front-facing TOF camera is also higher than the optical power of the transmitting device used by the rear-facing TOF camera, in an indoor environment, using the front-facing TOF camera to emit infrared signals for infrared remote control ensures that the emission angle range of the infrared remote control meets the requirements. Therefore, the embodiments of this application can reuse the front-facing TOF camera in the electronic device. When the front-facing TOF camera is needed for image output, it can be used to acquire TOF images. In infrared remote control scenarios, the front-facing TOF camera can replace the infrared remote control transmitter located on the top of the electronic device, emitting infrared signals to achieve infrared remote control.

[0068] In other embodiments, the TOF camera can be a rear-mounted TOF camera, meaning that the TOF camera is located on the back of the electronic device.

[0069] Therefore, the embodiments of this application can also reuse the rear TOF camera in the electronic device. When the rear TOF camera is required to output images, it can be used to acquire TOF images. In the case of infrared remote control, the rear TOF camera can replace the infrared remote control transmitter set on the top of the electronic device and emit infrared signals to achieve infrared remote control.

[0070] It is understandable that the front of an electronic device refers to the side where the display screen is located, while the back of an electronic device refers to the side where the casing is located, and the front and back of an electronic device are positioned opposite each other.

[0071] In the embodiments of this application, the TOF camera can be an indirect time of flight (iTOF) camera or a direct time of flight (dTOF) camera.

[0072] In some examples, the front-facing TOF camera can be an iTOF camera, which can be used in scenarios such as face authentication, eye tracking, and intelligent perception. The rear-facing TOF camera can be a dTOF camera, which can assist in taking photos, such as enabling focusing during image capture.

[0073] The infrared remote control method provided in this application can be applied to electronic devices equipped with TOF cameras. These electronic devices can be mobile phones, tablets, wearable devices, in-vehicle devices, augmented reality (AR) devices, virtual reality (VR) devices, laptops, personal computers (PCs), netbooks, personal digital assistants (PDAs), etc. This application does not limit the specific technology or form of the electronic device used.

[0074] To better understand the embodiments of this application, the structure of the electronic device of the embodiments of this application is described below.

[0075] Figure 4 is a schematic diagram of the hardware system structure of the electronic device provided in the embodiment of this application. The electronic device 400 may include a processor 410, an external memory interface 420, an internal memory 421, a universal serial bus (USB) interface 430, a charging management module 440, a power management module 441, a battery 442, antenna 1, antenna 2, a mobile communication module 450, a wireless communication module 460, an audio module 470, a speaker 470A, a receiver 470B, a microphone 470C, a headphone jack 470D, a sensor module 480, buttons 490, a motor 491, an indicator 492, a camera 493, a display screen 494, and a subscriber identification module (SIM) card interface 495, etc.

[0076] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 400. In other embodiments of this application, the electronic device 400 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0077] Processor 410 may include one or more processing units, such as: a system-on-chip (SOC), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU), etc. The different processing units may be independent devices or integrated into one or more processors.

[0078] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0079] The processor 410 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 410 is a cache memory. This memory can store instructions or data that the processor 410 has just used or that are used repeatedly. If the processor 410 needs to use the instruction or data again, it can retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 410, and thus improves the efficiency of the system.

[0080] The charging management module 440 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 440 receives charging input from the wired charger via a USB interface 430. In some wireless charging embodiments, the charging management module 440 receives wireless charging input via the wireless charging coil of the electronic device 400. While charging the battery 442, the charging management module 440 can also supply power to the electronic device via the power management module 441.

[0081] The power management module 441 is used to connect the battery 442, the charging management module 440, and the processor 410. The power management module 441 receives input from the battery 442 and / or the charging management module 440 to power the processor 410, internal memory 421, display screen 494, camera 493, and wireless communication module 460, etc.

[0082] The wireless communication function of electronic device 400 can be implemented through antenna 1, antenna 2, mobile communication module 450, wireless communication module 460, modem processor, and baseband processor.

[0083] Antennas 1 and 2 are used to transmit and receive electromagnetic wave signals. Mobile communication module 450 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for use in electronic device 400. Wireless communication module 460 can provide wireless communication solutions, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies, for use in electronic device 400.

[0084] In some embodiments, antenna 1 of electronic device 400 is coupled to mobile communication module 450, and antenna 2 is coupled to wireless communication module 460, enabling electronic device 400 to communicate with networks and other devices via wireless communication technology.

[0085] Electronic device 400 implements display functions through a GPU, a display screen 494, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 494 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 410 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0086] The display screen 494 is used to display images, display videos, and receive swipe operations, etc. The display screen 494 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 400 may include one or more display screens 494.

[0087] Electronic device 400 can perform shooting functions through ISP, camera 493, video codec, GPU, display 494 and application processor.

[0088] The ISP (Image Signal Processor) is used to process data fed back from the camera 493. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's image sensor. The light signal is converted into an electrical signal, and the image sensor transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimizations on image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be integrated into the camera 493.

[0089] Camera 493 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, electronic device 400 may include one or more cameras 493. Camera 493 may include a Time-of-Flight (TOF) camera.

[0090] The external storage interface 420 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 400. The external memory card communicates with the processor 410 through the external storage interface 420 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.

[0091] Internal memory 421 can be used to store executable program code, including instructions. Internal memory 421 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.). The data storage area may store data created during the use of electronic device 400 (such as audio data, phonebook, etc.). Furthermore, internal memory 421 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 410 executes various functional applications and data processing of electronic device 400 by running instructions stored in internal memory 421 and / or instructions stored in memory located within the processor.

[0092] Electronic device 400 can implement audio functions such as music playback and recording through audio module 470, speaker 470A, receiver 470B, microphone 470C, headphone jack 470D, and application processor.

[0093] Buttons 490 include a power button, volume buttons, etc. Electronic device 400 can receive button input and generate key signal inputs related to user settings and function control. Motor 491 can generate vibration alerts. Motor 491 can be used for incoming call vibration alerts or for touch vibration feedback. Indicator 492 can be an indicator light, used to indicate charging status, battery level changes, messages, missed calls, notifications, etc. SIM card interface 495 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 495 to achieve contact and separation with electronic device 400.

[0094] The software system of electronic device 400 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture, etc. This application embodiment uses the layered architecture Android system as an example to illustrate the software structure of electronic device 400.

[0095] Figure 5 is a schematic diagram of the software system structure of the electronic device provided in an embodiment of this application. The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom: the application layer, the application framework layer (FWK), the Android runtime and system libraries, the hardware abstraction layer (HAL), and the kernel layer.

[0096] The application layer can include a series of application packages. As shown in Figure 5, the application packages can include applications such as telephone, camera, remote control applications, and infrared remote control SDK.

[0097] Remote control applications, also known as smart remote control applications or infrared remote control applications, allow users to control their electronic devices via infrared by operating these applications.

[0098] The infrared remote control SDK is used to store the infrared remote control codes corresponding to the multiple remote control controls included in each controlled device. Taking a television as an example, the infrared remote control SDK can store the infrared remote control codes corresponding to the television's power control, volume up control, and volume down control. Taking an air conditioner as an example, the infrared remote control SDK can store the infrared remote control codes corresponding to the air conditioner's on / off control, heating control, cooling control, and operating mode control. The infrared remote control code can be a string of binary code.

[0099] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes a set of predefined functions.

[0100] As shown in Figure 5, the application framework layer may include a window manager, content provider, resource manager, view system, notification manager, camera service, and first consumer IR manager, etc.

[0101] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.

[0102] Content providers store and retrieve data, making that data accessible to applications. This data can include videos, images, audio, phone calls made and received, browsing history and bookmarks, phone books, etc.

[0103] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.

[0104] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.

[0105] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.

[0106] Camera services can be used to control processes related to camera or remote control applications. For example, a camera service can enable communication between a camera application and the camera hardware abstraction module, or it can participate in processes related to infrared remote control scenarios.

[0107] The first infrared manager is used to receive infrared remote control codes sent by the remote control application.

[0108] The Android runtime consists of core libraries and a virtual machine. The Android runtime is responsible for scheduling and managing the Android system.

[0109] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.

[0110] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0111] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.

[0112] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.

[0113] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG2, H.262, MP3, AAC, AMR, JPG, and PNG.

[0114] 3D graphics processing libraries are used to implement 3D graphics drawing, image rendering, compositing, and layer processing. 2D graphics engines are drawing engines for 2D graphics.

[0115] The Hardware Abstraction Layer (HAL) is a layer of abstraction that sits between the kernel layer and the Android runtime. The HAL can be a wrapper around hardware drivers in the kernel layer, providing a calling interface for the application framework layer.

[0116] In this embodiment of the application, the hardware abstraction layer may include a camera hardware abstraction module (camera HAL) and an infrared hardware abstraction module (consumer IR HAL).

[0117] The kernel layer is the layer between hardware and software. The kernel layer includes at least the camera kernel driver, the second infrared driver (IR driver), the SPI driver, and the display driver.

[0118] In some embodiments, the camera driver is used to control the operation of the TOF camera. The second infrared driver is used to receive the infrared remote control code sent by the infrared hardware abstraction module and convert the infrared remote control code into an SPI signal; the second infrared driver is also used to send the SPI signal to the SPI driver. The SPI driver is used to send the SPI signal to the driver chip in the TOF camera, so that the driver chip controls the transmitting device in the TOF camera to emit infrared signals based on the SPI signal. The display driver is used to control the display screen to display images.

[0119] The hardware layer may include a TOF camera and a display screen. The TOF camera may include a TOF sensor, a transmitting device, and a driving chip. In this embodiment, the TOF camera may be a front-facing TOF camera or a rear-facing TOF camera.

[0120] It should be noted that although the embodiments of this application are described using the Android system, the principle of the infrared remote control method is also applicable to electronic devices with operating systems such as iOS or Windows.

[0121] The technical solution of this application and how it solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be implemented independently or in combination with each other. The same or similar concepts or processes may not be described again in some embodiments.

[0122] For example, Figure 6 is a schematic diagram of the structure of a TOF camera provided in an embodiment of this application. As shown in Figure 6, the TOF camera may include a TOF sensor 1011, a transmitting device 1012, a receiving device 1013, and a driving chip 1014, etc.

[0123] The TOF sensor 1011 is connected to the processor 410 via an inter-integrated circuit (I2C) bus, the TOF sensor 1011 is connected to the driver chip 1014 via an SPI bus, and the processor 410 is connected to the general-purpose input / output (GPIO) pins of the driver chip 1014 via an SPI bus.

[0124] As shown in Figure 6, the power supply pin of the driver chip 1014 is connected to the first terminal of the transmitter 1012, the ground pin of the driver chip 1014 is connected to the second terminal of the transmitter 1012, and the ground pin of the driver chip 1014 is also connected to the ground terminal GND. The driver chip 1014 can supply power to the transmitter 1012, thereby enabling the transmitter 1012 to emit infrared signals.

[0125] In one example, the transmitting device 1012 is a VCSEL. The power supply pin of the driver chip 1014 is connected to the anode of the VCSEL, and the ground pin of the driver chip 1014 is connected to the cathode of the VCSEL.

[0126] As shown in Figure 6, the driver chip 1014 is connected to the first terminal of the receiver 1013 and the first terminal of the resistor R, respectively. The second terminal of the receiver 1013 is connected to the power supply terminal VDD, and the second terminal of the resistor R is connected to the ground terminal GND.

[0127] In one example, the receiving device 1013 is a PD. The driver chip 1014 is connected to the anode of the PD, and the cathode of the PD is connected to the power supply terminal VDD.

[0128] When using the TOF camera 101 to acquire TOF images, the processor 410 can send second configuration information to the TOF sensor 1011 via the I2C bus. This second configuration information may include first configuration sub-information and second configuration sub-information. The first configuration sub-information is the configuration information of the TOF sensor 1011 in image output mode, and the second configuration sub-information is the configuration information of the driver chip 1014 in image output mode. The TOF sensor 1011 can be configured based on the first configuration sub-information, and it can also send the second configuration sub-information to the driver chip 1014 via the SPI bus, allowing the driver chip 1014 to configure itself based on the second configuration sub-information, thereby configuring the TOF camera 101 in image output mode.

[0129] When the TOF camera 101 is in image output mode, the driving chip 1014 can drive the emitting device 1012 to emit infrared light. The receiving device 1013 can be used to receive the infrared light reflected back from the subject. The TOF sensor 1011 can calculate the time difference or phase difference between the infrared light emitted and reflected back to the receiving device 1013, thereby calculating the distance between the TOF camera 101 and the subject to generate a TOF image.

[0130] When using the TOF camera 101 for infrared remote control, the processor 410 can send the first configuration information to the TOF sensor 1011 via the I2C bus. The TOF sensor 1011 can send the first configuration information to the driver chip 1014 via the SPI bus to configure the driver chip 1014 into infrared mode.

[0131] When the driver chip 1014 is in infrared mode, the processor 410 can write SPI signals to the GPIO pins of the driver chip 1014 via the SPI bus, enabling the driver chip 1014 to control the transmitter 1012 to emit infrared signals based on the SPI signals. After receiving the infrared signals emitted by the transmitter 1012, the controlled device parses the working instructions included in the infrared signals to execute the remote control response operations corresponding to the working instructions, thereby enabling infrared remote control of the controlled device through the electronic device.

[0132] It should be understood that the SPI bus is a high-speed serial bus that includes a chip select (CS) line, a serial clock (SCK) line, a master output / slave input (MOSI) line, and a master input / slave output (MISO) line. The CS line is the chip select signal, controlled by the master device, used to select which slave device to communicate with. The SCK line is the clock signal, provided by the master device for synchronizing data transmission. The MOSI line is the signal line for the master device to send data to the slave device, and the MISO line is the signal line for the slave device to send data to the master device.

[0133] Therefore, the embodiments of this application can reuse the TOF camera 101 in the electronic device, enabling one TOF camera 101 to perform two functions: supporting services related to acquiring TOF images and supporting infrared remote control functions. When the TOF camera 101 is required to output images, it can be used to acquire TOF images; in infrared remote control scenarios, the TOF camera 101 can replace the infrared remote control transmitter located on the top of the electronic device, emitting infrared signals to achieve infrared remote control. This eliminates the need for the infrared remote control transmitter located on the top of the electronic device and also eliminates the need for openings in the top frame of the electronic device. Infrared remote control functions can be achieved through the TOF camera 101 within the electronic device, thereby saving internal space and reducing the cost of the electronic device.

[0134] For example, Figure 7 is a schematic diagram of the interaction of software modules involved in the first infrared remote control method provided in this application embodiment. This infrared remote control method can be applied to electronic devices. As shown in Figure 7, the electronic device may include an application layer, an application framework layer, a hardware abstraction layer, a kernel layer, and a hardware layer.

[0135] The application layer includes a remote control application and an infrared remote control SDK. The application framework layer includes a first infrared manager and camera services. The hardware abstraction layer includes a camera hardware abstraction module, an infrared hardware abstraction module, and a configuration module. The kernel layer includes a camera driver, a second infrared driver, and an SPI driver. The hardware layer includes a TOF camera, which may include a TOF sensor, a driver chip, and a transmitting device.

[0136] As shown in Figure 7, the remote control application can interact with both the infrared remote control SDK and the first infrared manager. When the remote control application receives a first operation to trigger infrared remote control, it responds to the first operation by retrieving the infrared remote control code corresponding to the first operation from the infrared remote control SDK, and then sends the infrared remote control code to the first infrared manager.

[0137] The first infrared manager is used to query the identification information of TOF cameras in electronic devices that support infrared remote control functionality. As shown in Figure 7, the first infrared manager can interact with the camera service. Therefore, after querying the identification information of TOF cameras in electronic devices that support infrared remote control functionality, the first infrared manager can send a first instruction to the camera service. The first instruction includes the identification information of the TOF camera that supports infrared remote control functionality, and the first instruction is used to instruct the TOF camera to be powered on and configured to infrared mode.

[0138] As shown in Figure 7, the camera service can interact with the camera hardware abstraction module. The camera hardware abstraction module can include functions such as `open camera`, `close camera`, `acquire sensor`, `initialize sensor`, and `release sensor`. The `open camera` function turns on the TOF camera; the `acquire sensor` function powers on the TOF camera; the `initialize sensor` function initializes the TOF camera, configuring it to infrared mode; the `close camera` function turns off the TOF camera; and the `release sensor` function powers off the TOF camera.

[0139] Furthermore, the camera hardware abstraction module can interact with both the configuration module and the camera driver. The configuration module (i.e., the sensor driver.xml module) stores configuration information for each camera in the electronic device. For example, the configuration module may include the first configuration information for a TOF camera that supports infrared remote control functionality.

[0140] Thus, after receiving the first instruction from the first infrared manager, the camera service can call the `open camera` function in the camera hardware abstraction module based on the first instruction. When executing the `open camera` function, the camera hardware abstraction module can sequentially call the `acquire sensor` function and the `initialize sensor` function within the camera hardware abstraction module.

[0141] When the camera hardware abstraction module executes the `acquire sensor` function, it can send a third instruction to the camera driver; this third instruction is used to instruct the Time-of-Flight (TOF) camera to be powered on. In this way, the camera driver can trigger the power-on operation of the TOF camera based on the third instruction.

[0142] After the TOF camera is powered on, the camera hardware abstraction module can execute the `initialize sensor` function, thereby obtaining the first configuration information corresponding to the identification information from the configuration module. This first configuration information is used to configure the TOF camera to infrared mode. Then, the camera hardware abstraction module can package the first configuration information into data and send it to the camera driver.

[0143] As shown in Figure 7, the camera driver can interact with the TOF camera. Therefore, after receiving the first configuration information sent by the camera hardware abstraction module, the camera driver can send the first configuration information to the TOF camera to configure the TOF camera in infrared mode.

[0144] A TOF camera can include a TOF sensor, a driver chip, and a transmitter. Therefore, the camera driver actually sends the first configuration information to the TOF sensor via the I2C bus, and the TOF sensor then sends the first configuration information to the driver chip via the SPI bus, thereby configuring the driver chip in the TOF camera to infrared mode.

[0145] After configuring the driver chip in the TOF camera to infrared mode, the camera hardware abstraction module can return a first message to the camera service. The first message indicates that the driver chip in the TOF camera has been configured to infrared mode; the camera service then returns the first message to the first infrared manager.

[0146] In one example, after the camera hardware abstraction module sends the first configuration information to the camera driver, it can return the first message to the camera service.

[0147] As shown in Figure 7, the first infrared manager can interact with the infrared hardware abstraction module, which in turn can interact with the second infrared driver. The second infrared driver can interact with the SPI driver, which in turn can interact with the TOF camera. Therefore, after receiving the first message returned by the camera service, the first infrared manager can send the infrared remote control code to the infrared hardware abstraction module, which then sends the infrared remote control code to the second infrared driver.

[0148] After receiving the infrared remote control code from the infrared hardware abstraction module, the second infrared driver converts the code into an SPI signal. Then, the second infrared driver sends the SPI signal to the SPI driver, which in turn sends the SPI signal to the TOF camera. This allows the TOF camera to emit infrared signals based on the SPI signal for infrared remote control of the controlled device.

[0149] A TOF camera can include a TOF sensor, a driver chip, and a transmitter. Therefore, SPI driving essentially uses the MOSI signal line in the SPI bus to write the SPI signal into the GPIO pin of the driver chip, enabling the driver chip to control the transmitter to emit infrared signals based on the SPI signal for infrared remote control of the controlled device.

[0150] In some embodiments, as shown in FIG7, the hardware layer may include a metal oxide semiconductor field effect transistor (MOS transistor) switch and an infrared LED in addition to a TOF camera.

[0151] Therefore, after receiving the SPI signal from the second infrared driver, the SPI driver not only sends the SPI signal to the TOF camera, enabling the TOF camera to emit infrared signals based on the SPI signal, but also sends the SPI signal to the MOSFET switch, allowing the MOSFET switch to turn on or off according to the SPI signal, thereby controlling the infrared LED to emit infrared signals. In this way, the embodiments of this application can use both the TOF camera and the infrared LED to emit infrared signals for infrared remote control of the controlled device, thereby further improving the emission angle range of infrared remote control, and even achieving 360° omnidirectional infrared remote control.

[0152] In other embodiments, the hardware layer may also include a TOF camera, but excluding MOSFET switches and infrared LEDs; that is, only the TOF camera emits infrared signals for infrared remote control of the controlled device. This eliminates the need for an infrared remote control transmitter located on the top of the electronic device and also eliminates the need for openings in the top frame of the electronic device, thereby saving internal space and reducing the cost of the electronic device.

[0153] To facilitate understanding, the infrared remote control method corresponding to Figure 7 will be described in detail below with reference to Figure 8. In Figure 8, for ease of description, the open camera function in the camera hardware abstraction module can be referred to as the first function, the acquire sensor function in the camera hardware abstraction module can be referred to as the second function, and the initialize sensor function in the camera hardware abstraction module can be referred to as the third function.

[0154] For example, Figure 8 is a flowchart illustrating a first infrared remote control method provided in an embodiment of this application. This method can be applied to an electronic device, which may include a remote control application, an infrared remote control SDK, a first infrared manager, a camera service, a camera hardware abstraction module, a configuration module, a camera driver, an infrared hardware abstraction module, a second infrared driver, an SPI driver, and a TOF camera. Specifically, the method may include the following steps:

[0155] S801, the remote control application receives the user's first operation; the first operation is used to trigger infrared remote control.

[0156] In infrared remote control scenarios, if a user wants to use the TOF camera in an electronic device to emit infrared signals for remote control, the user can open the remote control application by clicking the application icon installed on the electronic device. After opening the remote control application, the electronic device will display the application interface, which shows multiple remote control controls for the controlled device. The user can click the corresponding remote control control to trigger the first operation for infrared remote control.

[0157] Alternatively, users can trigger the remote control controls in the remote control app via voice, causing the app to receive the first operation to activate the infrared remote control. For example, a user can directly speak a voice command into the electronic device, such as "Please turn down the TV volume," to trigger the volume-down control for the TV included in the remote control app.

[0158] S802, the remote control application responds to the first operation by obtaining the infrared remote control code corresponding to the first operation from the infrared remote control SDK.

[0159] The infrared remote control SDK stores the infrared remote control codes corresponding to multiple remote control controls included in each controlled device. The remote control application can retrieve the infrared remote control code corresponding to the first operation from the infrared remote control SDK.

[0160] S803, the remote control application sends the infrared remote control code to the first infrared manager.

[0161] S804, after the first infrared manager receives the infrared remote control code, the first infrared manager queries the identification information of the TOF camera in the electronic device that supports infrared remote control function.

[0162] After receiving the infrared remote control code, the first infrared manager can query the capabilities reported by each camera, thereby finding the identification information (i.e., TOF camera ID) of the TOF camera in the electronic device that supports infrared remote control function.

[0163] S805, the first infrared manager sends a first instruction to the camera service; the first instruction includes identification information of the TOF camera that supports infrared remote control function, and the first instruction is used to instruct the TOF camera to be powered on and to configure the TOF camera to infrared mode.

[0164] After the first infrared manager queries the identification information of the TOF camera that supports infrared remote control function in the electronic device, the first infrared manager can send a first instruction to the camera service. The first instruction includes the identification information of the TOF camera that supports infrared remote control function.

[0165] In another possible implementation, the first instruction may also include gear information of the driver chip, which is used to instruct the driver chip to output the working current corresponding to the gear information to the transmitting device, thereby controlling the transmitting device to operate with the current value corresponding to the working current in order to emit infrared signals.

[0166] The operating current is positively correlated with the optical power of the transmitting device. The higher the operating current, the higher the optical power of the transmitting device; conversely, the lower the operating current, the lower the optical power of the transmitting device.

[0167] Thus, based on the steps S804 and S805 above, the first instruction is sent to the camera service through the first infrared manager.

[0168] S806, the camera service calls the first function in the camera hardware abstraction module based on the first instruction.

[0169] The first function is the open camera function, which is used to open the TOF camera.

[0170] In S807, the camera hardware abstraction module calls the second and third functions in the camera hardware abstraction module sequentially through the first function.

[0171] The second function is the `acquire sensor` function, which powers on the TOF camera. The third function is the `initialize sensor` function, which initializes the TOF camera, configuring it to infrared mode.

[0172] In this way, when the camera hardware abstraction module executes the open camera function, it can call the acquire sensor function and the initialize sensor function in the camera hardware abstraction module in sequence.

[0173] S808, the camera hardware abstraction module sends a third instruction to the camera driver through a second function; the third instruction is used to instruct the TOF camera to be powered on.

[0174] In this way, when the camera hardware abstraction module executes the acquire sensor function, it can send a third instruction to the camera driver.

[0175] S809, the camera driver is based on a third instruction to trigger the power-on operation of the TOF camera.

[0176] After the TOF camera is powered on, the camera hardware abstraction module obtains the first configuration information corresponding to the identification information from the configuration module through the third function. The first configuration information is used to configure the TOF camera to infrared mode.

[0177] After the TOF camera is powered on, the camera hardware abstraction module can execute the initialize sensor function, thereby obtaining the first configuration information corresponding to the identification information from the configuration module.

[0178] This allows the camera hardware abstraction module to obtain the first configuration information from the configuration module through the third function.

[0179] S811, the camera hardware abstraction module sends the first configuration information to the camera driver.

[0180] S812, the camera driver sends the first configuration information to the TOF camera to configure the TOF camera in infrared mode.

[0181] A TOF camera can include a TOF sensor, a driver chip, and a transmitter. Therefore, the camera driver essentially sends initial configuration information to the TOF sensor, which then sends the initial configuration information to the driver chip to configure the driver chip for infrared mode.

[0182] Thus, based on the steps S807 to S812 above, the camera hardware abstraction module controls the camera driver to trigger the power-on operation of the TOF camera through the first function, and controls the camera driver to send the first configuration information to the TOF camera.

[0183] In summary, based on the steps S804 to S812 above, after the first infrared manager receives the infrared remote control code, it powers on the TOF camera and sends the first configuration information to the TOF camera through the first infrared manager, camera service, camera hardware abstraction module and camera driver.

[0184] When the TOF camera is in infrared mode, the first infrared manager sends the infrared remote control code to the infrared hardware abstraction module.

[0185] After configuring the driver chip in the TOF camera to infrared mode, the camera hardware abstraction module can return a first message to the camera service, indicating that the driver chip in the TOF camera has been configured to infrared mode. The camera service then returns the first message to the first infrared manager. Upon receiving the first message from the camera service, the first infrared manager can then send an infrared remote control code to the infrared hardware abstraction module.

[0186] The S814 infrared hardware abstraction module sends the infrared remote control code to the second infrared driver.

[0187] The S815, second infrared driver, converts the infrared remote control code into an SPI signal.

[0188] In some embodiments, the infrared remote control code can be a string of binary codes. The SPI signal converted from the infrared remote control code is actually a signal containing high and low levels, such as a square wave signal containing high and low levels.

[0189] For example, if the infrared remote control code is 101001, then within one time period of the SPI signal, a high level represents "1" and a low level represents "0".

[0190] Thus, based on the steps S813 to S815 above, the electronic device converts the infrared remote control code corresponding to the first operation into an SPI signal.

[0191] S816, the second infrared driver sends the SPI signal to the SPI driver.

[0192] The S817 SPI driver sends SPI signals to the TOF camera.

[0193] A TOF camera can include a TOF sensor, a driver chip, and a transmitter. Therefore, SPI driving essentially involves sending SPI signals to the driver chip.

[0194] The S818 TOF camera emits infrared signals based on SPI signals; these infrared signals are used for infrared remote control of the controlled device.

[0195] After receiving the SPI signal sent by the SPI driver, the driver chip can control the transmitting device to transmit infrared signals according to the encoding format corresponding to the infrared remote control code based on the SPI signal.

[0196] Thus, based on the steps S816 to S818 above, the electronic device controls the TOF camera to emit infrared signals based on the SPI signal.

[0197] Therefore, in this embodiment, the TOF camera supporting infrared remote control function can be opened through the first infrared manager in the application framework layer. Furthermore, the camera hardware abstraction module in the hardware abstraction layer needs to be customized to power on and initialize the TOF camera during the execution of the `open camera` function, thereby configuring the TOF camera to infrared mode.

[0198] In practical use, different functions of the same TOF camera cannot be enabled simultaneously. For example, it is not possible to use the same TOF camera to both acquire TOF images and perform infrared remote control at the same time. Therefore, for TOF cameras that support infrared remote control, there will be a conflict in the use of TOF cameras.

[0199] To resolve the conflict issue of calling TOF cameras, priority judgment logic can be added to the camera service in the application framework layer. This allows the camera service to select one function to execute based on the priority judgment logic when both TOF image acquisition and infrared remote control functions require the use of the same TOF camera.

[0200] In one scenario, the image output mode of the TOF camera has higher priority than its infrared mode. When the TOF camera is in image output mode, it acquires TOF images; when in infrared mode, it emits infrared signals for remote control. Therefore, if the camera service receives an image output request for the TOF camera while it is in infrared mode, it triggers a second operation: exiting infrared mode and entering image output mode. If the camera service receives an infrared remote control request for the TOF camera while it is in image output mode, it controls the TOF camera to remain in image output mode.

[0201] Specifically, the image output request for the TOF camera is used to request the TOF camera to acquire TOF images. The infrared remote control request for the TOF camera is used to request the TOF camera to emit infrared signals for infrared remote control.

[0202] When the camera service triggers the second operation for the TOF camera, it can be implemented through the following steps: The camera service can call the `close camera` function in the camera hardware abstraction module; when executing the `close camera` function, the camera hardware abstraction module can call the `release sensor` function; when executing the `release sensor` function, the camera hardware abstraction module can send a power-down command to the camera driver, causing the camera driver to trigger a power-down operation on the TOF camera based on the power-down command, thereby causing the driver chip in the TOF camera to exit infrared mode. Afterwards, the camera service will then trigger the operation of powering on the TOF camera and configuring the TOF camera to image output mode.

[0203] In another scenario, the infrared mode of the TOF camera has a higher priority than the image output mode. Therefore, when the TOF camera is in image output mode, if the camera service receives an infrared remote control request for the TOF camera, the camera service triggers a third operation for the TOF camera; the third operation is to exit the image output mode and enter the infrared mode. When the TOF camera is in infrared mode, if the camera service receives an image output request for the TOF camera, the camera service controls the TOF camera to remain in infrared mode.

[0204] When the camera service triggers a third operation for the TOF camera, it can be implemented through the following steps: The camera service can first trigger a power-down operation on the TOF camera, causing the driver chip in the TOF camera to exit the image output mode. Then, the camera service can call the `open camera` function in the camera hardware abstraction module. When executing the `open camera` function, the camera hardware abstraction module can sequentially call the `acquire sensor` and `initialize sensor` functions. When executing the `acquire sensor` function, the camera hardware abstraction module can send a third instruction to the camera driver, which instructs the TOF camera to be powered on. This allows the camera driver to trigger a power-on operation on the TOF camera based on the third instruction. After the TOF camera is powered on, the camera hardware abstraction module can execute the `initialize sensor` function, thereby obtaining the first configuration information from the configuration module. The camera hardware abstraction module can then send the first configuration information to the camera driver, which can then send the first configuration information to the TOF camera to configure the TOF camera in infrared mode.

[0205] For example, Figure 9 is a schematic diagram of the interaction of software modules involved in the second infrared remote control method provided in this application embodiment. This infrared remote control method can be applied to electronic devices. As shown in Figure 9, the electronic device may include an application layer, an application framework layer, a hardware abstraction layer, a kernel layer, and a hardware layer.

[0206] The application layer includes a remote control application and an infrared remote control SDK. The application framework layer includes a first infrared manager and camera services. The hardware abstraction layer includes a camera hardware abstraction module, an infrared hardware abstraction module, and a configuration module. The kernel layer includes a camera driver, a second infrared driver, and an SPI driver. The hardware layer includes a TOF camera, which may include a TOF sensor, a driver chip, and a transmitting device.

[0207] As shown in Figure 9, the remote control application can interact with both the infrared remote control SDK and the first infrared manager. When the remote control application receives a first operation to trigger infrared remote control, it responds to the first operation by retrieving the infrared remote control code corresponding to the first operation from the infrared remote control SDK, and then sends the infrared remote control code to the first infrared manager.

[0208] The first infrared manager can interact with the infrared hardware abstraction module. After receiving an infrared remote control code, the first infrared manager can send the infrared remote control code to the infrared hardware abstraction module.

[0209] As shown in Figure 9, the camera hardware abstraction module can include an infrared service, the `open camera` function, the `close camera` function, the `acquire sensor` function, the `initialize sensor` function, and the `release sensor` function. The infrared hardware abstraction module can interact with the infrared service within the camera hardware abstraction module, and the infrared service within the camera hardware abstraction module can interact with the camera service. For example, the infrared service and the camera service can transfer data through a vendor native development kit (VNDK) interface.

[0210] The infrared service is an Android interface definition language (AIDL) service that enables communication between different processes within an electronic device, such as between the camera hardware abstraction module and the infrared hardware abstraction module.

[0211] The infrared hardware abstraction module is used to query whether an electronic device supports infrared remote control functionality. As shown in Figure 9, if the electronic device supports infrared remote control functionality, the infrared hardware abstraction module sends a second command to the infrared service. This second command instructs the TOF camera to be powered on and configured in infrared mode. Based on the second command, the infrared service queries the identification information of the TOF camera in the electronic device that supports infrared remote control functionality.

[0212] After the infrared service finds the identification information of the TOF camera that supports infrared remote control function in the electronic device, the infrared service can send a first instruction to the camera service. The first instruction includes the identification information of the TOF camera that supports infrared remote control function, and the first instruction is used to instruct the TOF camera to be powered on and to be configured in infrared mode.

[0213] As shown in Figure 9, the camera service can interact with the camera hardware abstraction module (HIP), which in turn can interact with the configuration module and the camera driver. Thus, upon receiving the first instruction from the infrared service, the camera service can call the `open camera` function within the HIP. When executing the `open camera` function, the HIP can sequentially call the `acquire sensor` and `initialize sensor` functions within the HIP.

[0214] When the camera hardware abstraction module executes the `acquire sensor` function, it can send a third instruction to the camera driver; this third instruction is used to instruct the Time-of-Flight (TOF) camera to be powered on. In this way, the camera driver can trigger the power-on operation of the TOF camera based on the third instruction.

[0215] After the TOF camera is powered on, the camera hardware abstraction module can execute the `initialize sensor` function, thereby obtaining the first configuration information corresponding to the identification information from the configuration module. This first configuration information is used to configure the TOF camera to infrared mode. Then, the camera hardware abstraction module can package the first configuration information into data and send it to the camera driver.

[0216] As shown in Figure 9, the camera driver can interact with the TOF camera. Therefore, after receiving the first configuration information sent by the camera hardware abstraction module, the camera driver can send the first configuration information to the TOF camera to configure the TOF camera in infrared mode.

[0217] A TOF camera can include a TOF sensor, a driver chip, and a transmitter. Therefore, the camera driver actually sends the first configuration information to the TOF sensor via the I2C bus, and the TOF sensor then sends the first configuration information to the driver chip via the SPI bus, thereby configuring the driver chip in the TOF camera to infrared mode.

[0218] After configuring the driver chip in the TOF camera to infrared mode, the camera hardware abstraction module can return a first message to the camera service. The first message indicates that the driver chip in the TOF camera has been configured to infrared mode. The camera service then returns the first message to the infrared service in the camera hardware abstraction module, and the infrared service in the camera hardware abstraction module then returns the first message to the infrared hardware abstraction module.

[0219] In one example, after the camera hardware abstraction module sends the first configuration information to the camera driver, it can return the first message to the camera service.

[0220] As shown in Figure 9, the infrared hardware abstraction module can interact with the second infrared driver, which in turn can interact with the SPI driver, which in turn can interact with the TOF camera. Therefore, after receiving the first message returned by the infrared service from the camera hardware abstraction module, the infrared hardware abstraction module can send the infrared remote control code to the second infrared driver. The second infrared driver can then convert the infrared remote control code into an SPI signal. The second infrared driver can then send the SPI signal to the SPI driver, which in turn sends the SPI signal to the TOF camera, enabling the TOF camera to emit infrared signals based on the SPI signal for infrared remote control of the controlled device.

[0221] A TOF camera can include a TOF sensor, a driver chip, and a transmitter. Therefore, SPI driving essentially uses the MOSI signal line in the SPI bus to write the SPI signal into the GPIO pin of the driver chip, enabling the driver chip to control the transmitter to emit infrared signals based on the SPI signal for infrared remote control of the controlled device.

[0222] In some embodiments, as shown in FIG9, the hardware layer may include a MOS switch and an infrared LED in addition to a TOF camera.

[0223] Therefore, after receiving the SPI signal from the second infrared driver, the SPI driver not only sends the SPI signal to the TOF camera, enabling the TOF camera to emit infrared signals based on the SPI signal, but also sends the SPI signal to the MOSFET switch, allowing the MOSFET switch to turn on or off according to the SPI signal, thereby controlling the infrared LED to emit infrared signals. In this way, the embodiments of this application can use both the TOF camera and the infrared LED to emit infrared signals for infrared remote control of the controlled device, thereby further improving the emission angle range of infrared remote control, and even achieving 360° omnidirectional infrared remote control.

[0224] In other embodiments, the hardware layer may also include a TOF camera, but excluding MOSFET switches and infrared LEDs; that is, only the TOF camera emits infrared signals for infrared remote control of the controlled device. This eliminates the need for an infrared remote control transmitter located on the top of the electronic device and also eliminates the need for openings in the top frame of the electronic device, thereby saving internal space and reducing the cost of the electronic device.

[0225] To facilitate understanding, the infrared remote control method corresponding to Figure 9 will be described in detail below with reference to Figure 10. In Figure 10, for ease of description, the camera hardware abstraction module can be divided into an infrared service module and a camera control module. That is, the camera hardware abstraction module can include an infrared service module and a camera control module. The camera control module can include functions such as open camera, close camera, acquire sensor, initialize sensor, and release sensor. Among them, the open camera function in the camera hardware abstraction module can be referred to as the first function, the acquire sensor function in the camera hardware abstraction module as the second function, and the initialize sensor function in the camera hardware abstraction module as the third function.

[0226] For example, Figure 10 is a flowchart illustrating a second infrared remote control method provided in an embodiment of this application. This method can be applied to an electronic device, which may include a remote control application, an infrared remote control SDK, a first infrared manager, a camera service, a camera hardware abstraction module, a configuration module, a camera driver, an infrared hardware abstraction module, a second infrared driver, an SPI driver, and a TOF camera. The camera hardware abstraction module may include an infrared service and a camera control module. Specifically, this method may include the following steps:

[0227] S1001, the remote control application receives the user's first operation; the first operation is used to trigger infrared remote control.

[0228] S1002, the remote control application responds to the first operation by obtaining the infrared remote control code corresponding to the first operation from the infrared remote control SDK.

[0229] S1003, the remote control application sends the infrared remote control code to the first infrared manager.

[0230] It should be noted that the specific implementation methods of S1001 to S1003 can be referred to the specific implementation methods of S801 to S803 mentioned above. To avoid repetition, they will not be repeated here.

[0231] S1004 After receiving the infrared remote control code, the first infrared manager sends the infrared remote control code to the infrared hardware abstraction module.

[0232] S1005, the infrared hardware abstraction module queries whether the electronic device supports infrared remote control function.

[0233] S1006, when the electronic device supports infrared remote control function, the infrared hardware abstraction module sends a second instruction to the infrared service; the second instruction is used to instruct the TOF camera to be powered on and to configure the TOF camera to infrared mode.

[0234] S1007, the infrared service queries the identification information of a TOF camera that supports infrared remote control function in an electronic device based on the second instruction.

[0235] After receiving the second instruction, the infrared service can query the capabilities reported by each camera based on the second instruction, thereby querying the identification information of the TOF camera in the electronic device that supports infrared remote control function.

[0236] S1008, the infrared service sends a first instruction to the camera service; the first instruction includes identification information of the TOF camera that supports infrared remote control function, and the first instruction is used to instruct the TOF camera to be powered on and to configure the TOF camera to infrared mode.

[0237] Thus, based on the steps S1004 to S1008 above, the first instruction is sent to the camera service through the first infrared manager.

[0238] S1009, the camera service, based on the first instruction, calls the first function included in the camera control module in the camera hardware abstraction module.

[0239] S1010, the camera control module in the camera hardware abstraction module calls the second and third functions in the camera hardware abstraction module in sequence through the first function.

[0240] S1011, the camera control module in the camera hardware abstraction module, sends a third instruction to the camera driver through the second function; the third instruction is used to instruct the TOF camera to be powered on.

[0241] S1012, the camera driver triggers the power-on operation of the TOF camera based on a third instruction.

[0242] S1013 After the TOF camera is powered on, the camera control module in the camera hardware abstraction module obtains the first configuration information corresponding to the identification information from the configuration module through the third function. The first configuration information is used to configure the TOF camera to infrared mode.

[0243] S1014, the camera control module in the camera hardware abstraction module sends the first configuration information to the camera driver.

[0244] S1015, the camera driver sends the first configuration information to the TOF camera to configure the TOF camera in infrared mode.

[0245] Thus, based on the steps S1010 to S1015 above, the camera hardware abstraction module controls the camera driver to trigger the power-on operation of the TOF camera through the first function, and controls the camera driver to send the first configuration information to the TOF camera.

[0246] In summary, based on the steps S1004 to S1015 above, the TOF camera is powered on and the first configuration information is sent to the TOF camera through the first infrared manager, camera service, camera hardware abstraction module and camera driver.

[0247] It should be noted that the specific implementation methods of S1009 to S1015 can refer to the specific implementation methods of S806 to S812. To avoid repetition, they will not be described again here.

[0248] S1016: When the TOF camera is in infrared mode, the infrared hardware abstraction module sends the infrared remote control code to the second infrared driver.

[0249] S1017, the second infrared driver converts the infrared remote control code into an SPI signal.

[0250] Thus, based on the steps S1016 and S1017 above, the electronic device converts the infrared remote control code corresponding to the first operation into an SPI signal.

[0251] S1018, the second infrared driver sends the SPI signal to the SPI driver.

[0252] S1019, the SPI driver sends the SPI signal to the TOF camera.

[0253] The S1020 TOF camera emits infrared signals based on SPI signals; the infrared signals are used for infrared remote control of the controlled device.

[0254] Thus, based on the steps S1018 to S1020 above, the electronic device controls the TOF camera to emit infrared signals based on the SPI signal.

[0255] It should be noted that the specific implementation methods of S1017 to S1020 can refer to the specific implementation methods of S815 to S818. To avoid repetition, they will not be repeated here.

[0256] Therefore, this embodiment adds an infrared service to the camera hardware abstraction module in the hardware abstraction layer and opens a TOF camera that supports infrared remote control through the VNDK interface between the infrared service and the camera service. Furthermore, the camera hardware abstraction module in the hardware abstraction layer needs to be customized to power on and initialize the TOF camera during the execution of the `open camera` function, thereby configuring the TOF camera to infrared mode.

[0257] Furthermore, the TOF camera's driver chip can include registers for eye safety and registers for GPIO constant-high detection. When the driver chip exits infrared mode, the infrared service in the camera hardware abstraction module sends a read command to the camera driver sequentially through the camera service and camera control modules. Based on this read command, the camera driver can read the eye safety registers and the GPIO constant-high detection registers in the driver chip, and then send the read data back to the infrared service in the camera hardware abstraction module sequentially through the camera control module and camera service. This completes the feedback of eye safety results and GPIO constant-high detection results, a process primarily used in maintenance and testing scenarios.

[0258] Furthermore, the infrared remote control methods corresponding to Figures 9 and 10 can also have priority judgment logic added to the camera service in the application framework layer. This allows the camera service to select which function to execute based on the priority judgment logic when both acquiring TOF images and performing infrared remote control require the same TOF camera, thus resolving the TOF camera call conflict issue. The specific judgment logic can be found in the description of the infrared remote control methods corresponding to Figures 7 and 8 above; to avoid repetition, it will not be repeated here.

[0259] For example, Figure 11 is a schematic diagram of the interaction of software modules involved in the third infrared remote control method provided in this application embodiment. This infrared remote control method can be applied to electronic devices. As shown in Figure 11, the electronic device may include an application layer, an application framework layer, a hardware abstraction layer, a kernel layer, and a hardware layer.

[0260] The application layer includes a remote control application, an infrared remote control SDK, and a camera application. The application framework layer includes a first infrared manager and a camera service. The hardware abstraction layer includes a camera hardware abstraction module and an infrared hardware abstraction module. The kernel layer includes a camera driver, a device node ( / dev / camera_ir), a second infrared manager (camera IR manager), a first infrared driver (iTOF_IR_Driver), a second infrared driver, and an SPI driver. The device node effectively isolates the kernel layer from the hardware abstraction layer. The hardware layer includes a TOF camera, which may include a TOF sensor, a driver chip, and a transmitting device.

[0261] As shown in Figure 11, the remote control application can interact with both the infrared remote control SDK and the first infrared manager. When the remote control application receives a first operation to trigger infrared remote control, it responds to the first operation by retrieving the infrared remote control code corresponding to the first operation from the infrared remote control SDK, and then sends the infrared remote control code to the first infrared manager.

[0262] The first infrared manager can interact with the infrared hardware abstraction module. After receiving an infrared remote control code, the first infrared manager can send the infrared remote control code to the infrared hardware abstraction module.

[0263] As shown in Figure 11, the infrared hardware abstraction module can interact with the device node, the device node can interact with the second infrared manager, the second infrared manager can interact with the first infrared driver, and the first infrared driver can interact with the TOF camera.

[0264] The second infrared manager can include functions such as `on_open_camera_cb`, `on_close_camera_cb`, `configure_ir_mode`, `probe`, `open`, `close`, I2C read / write, `match_camera_ir`, and `check eyesafe`. The `on_open_camera_cb` function is a callback function used to trigger the TOF camera to enter image output mode, and the `on_close_camera_cb` function is a callback function used to trigger the TOF camera to exit image output mode. The `configure_ir_mode` function is used to configure the TOF camera to infrared mode. The `probe` function can be used for power-on detection. When the electronic device is powered on, the `probe` function can be executed, and during the execution of the `probe` function, the `match_camera_ir` function can be called to check if a TOF camera is currently present. The `open` function is used to open the TOF camera, and the `close` function is used to close the TOF camera. The I2C read / write functions are utility functions that encapsulate some I2C interfaces. In scenarios such as power-on and configuring the TOF camera to infrared mode, commands can be sent through these encapsulated I2C interfaces. Check EyeSafe is used to detect whether a TOF camera is in eye-safe mode.

[0265] Furthermore, the first infrared driver may include functions such as power_up, power_down, init setting, and read_err_flag. The power_up function is used to power on the TOF camera, the power_down function is used to power off the TOF camera, the init setting function is used to configure the TOF camera in infrared mode, and the read_err_flag function is used for human eye safety detection and GPIO constant high detection.

[0266] When using a Time-of-Flight (TOF) camera, because it emits infrared light, it's necessary to detect the optical power of the emitted infrared light for human eye safety. This involves checking whether the TOF camera is in eye-safe mode to prevent excessively high infrared light power from harming the eyes. In one scenario, after configuring the TOF camera to infrared mode, the `read_err_flag` function needs to be called to perform eye safety checks.

[0267] The GPIO constant-high detection is used to detect the duration for which the GPIO pin of the driver chip is high when the TOF camera is in infrared mode. If the duration for which the GPIO pin of the driver chip is high exceeds a threshold, it is determined that there is an abnormality in the TOF camera.

[0268] The infrared hardware abstraction module is used to query whether an electronic device supports infrared remote control functionality. As shown in Figure 11, if the electronic device supports infrared remote control functionality, the infrared hardware abstraction module can send a fourth command to the device node through the input / output control (ioctl) interface. This fourth command instructs the TOF camera to be powered on and configured to infrared mode. Based on this fourth command, the device node can sequentially call the `open` and `configure_ir_mode` functions in the second infrared manager.

[0269] In this way, when the second infrared manager executes the open function, it can call the power_up function in the first infrared driver. When the first infrared driver executes the power_up function, it can trigger the power-on operation of the TOF camera.

[0270] After the TOF camera is powered on, the second infrared manager can execute the `configure_ir_mode` function. When executing `configure_ir_mode`, the second infrared manager can call the `init setting` function in the first infrared driver. The `init setting` function contains the first configuration information; therefore, when the first infrared driver executes the `init setting` function, it can send this first configuration information to the TOF camera to configure it into infrared mode.

[0271] The TOF camera may include a TOF sensor, a driver chip, and a transmitting device. Therefore, the first infrared drive actually sends the first configuration information to the TOF sensor via the I2C bus, and the TOF sensor then sends the first configuration information to the driver chip via the SPI bus, thereby configuring the driver chip in the TOF camera to infrared mode.

[0272] After configuring the driver chip in the TOF camera to infrared mode, the device node can return a second message to the infrared hardware abstraction module, which indicates that the driver chip in the TOF camera has been configured to infrared mode.

[0273] As shown in Figure 11, the infrared hardware abstraction module can interact with the second infrared driver, which in turn can interact with the SPI driver, which in turn can interact with the TOF camera. Therefore, after receiving the second message from the device node, the infrared hardware abstraction module can send the infrared remote control code to the second infrared driver. The second infrared driver can then convert the infrared remote control code into an SPI signal. The second infrared driver can then send the SPI signal to the SPI driver, which in turn sends the SPI signal to the TOF camera, enabling the TOF camera to emit infrared signals based on the SPI signal for infrared remote control of the controlled device.

[0274] A TOF camera can include a TOF sensor, a driver chip, and a transmitter. Therefore, SPI driving essentially uses the MOSI signal line in the SPI bus to write the SPI signal into the GPIO pin of the driver chip, enabling the driver chip to control the transmitter to emit infrared signals based on the SPI signal for infrared remote control of the controlled device.

[0275] In some embodiments, as shown in FIG11, the hardware layer may include a MOSFET switch and an infrared LED in addition to a TOF camera.

[0276] Therefore, after receiving the SPI signal from the second infrared driver, the SPI driver not only sends the SPI signal to the TOF camera, enabling the TOF camera to emit infrared signals based on the SPI signal, but also sends the SPI signal to the MOSFET switch, allowing the MOSFET switch to turn on or off according to the SPI signal, thereby controlling the infrared LED to emit infrared signals. In this way, the embodiments of this application can use both the TOF camera and the infrared LED to emit infrared signals for infrared remote control of the controlled device, thereby further improving the emission angle range of infrared remote control, and even achieving 360° omnidirectional infrared remote control.

[0277] In other embodiments, the hardware layer may also include a TOF camera, but excluding MOSFET switches and infrared LEDs; that is, only the TOF camera emits infrared signals for infrared remote control of the controlled device. This eliminates the need for an infrared remote control transmitter located on the top of the electronic device and also eliminates the need for openings in the top frame of the electronic device, thereby saving internal space and reducing the cost of the electronic device.

[0278] To facilitate understanding, the infrared remote control method corresponding to Figure 11 will be described in detail below with reference to Figure 12. In Figure 12, for ease of description, the open function in the second infrared manager can be referred to as the fourth function, the configure_ir_mode function in the second infrared manager as the fifth function, the power_up function in the first infrared driver as the sixth function, and the init setting function in the first infrared driver as the seventh function.

[0279] For example, Figure 12 is a flowchart illustrating a third infrared remote control method provided in an embodiment of this application. This method can be applied to an electronic device, which may include a remote control application, an infrared remote control SDK, a first infrared manager, an infrared hardware abstraction module, a device node, a second infrared manager, a first infrared driver, a second infrared driver, an SPI driver, and a TOF camera. Specifically, the method may include the following steps:

[0280] S1201, the remote control application receives the user's first operation; the first operation is used to trigger the infrared remote control.

[0281] S1202, the remote control application responds to the first operation by obtaining the infrared remote control code corresponding to the first operation from the infrared remote control SDK.

[0282] S1203, the remote control application sends the infrared remote control code to the first infrared manager.

[0283] It should be noted that the specific implementation methods of S1201 to S1203 can refer to the specific implementation methods of S801 to S803 mentioned above. To avoid repetition, they will not be repeated here.

[0284] S1204, the first infrared manager sends the infrared remote control code to the infrared hardware abstraction module.

[0285] S1205 After receiving the infrared remote control code, the infrared hardware abstraction module queries whether the electronic device supports infrared remote control function.

[0286] S1206, when the electronic device supports infrared remote control function, the infrared hardware abstraction module sends a fourth instruction to the device node; the fourth instruction is used to instruct the TOF camera to be powered on and to configure the TOF camera to infrared mode.

[0287] S1207, the device node, based on the fourth instruction, sequentially calls the fourth and fifth functions in the second infrared manager.

[0288] The fourth function is the `open` function in the second infrared manager, which is used to open the TOF camera. The fifth function is the `configure_ir_mode` function in the second infrared manager, which is used to configure the TOF camera to infrared mode.

[0289] In this way, the device node can sequentially call the open function and configure_ir_mode function in the second infrared manager based on the fourth instruction.

[0290] S1208, the second infrared manager calls the sixth function in the first infrared driver through the fourth function.

[0291] S1209, the first infrared driver triggers the power-on operation of the TOF camera through the sixth function.

[0292] The sixth function is the `power_up` function in the first infrared driver, which is used to power on the TOF camera. When the second infrared manager executes the `open` function, it can call the `power_up` function in the first infrared driver. When the first infrared driver executes the `power_up` function, it can trigger the power-on operation of the TOF camera.

[0293] Thus, based on the steps S1208 and S1209 above, the second infrared manager controls the first infrared driver to power on the TOF camera through the fourth function.

[0294] S1210, after the TOF camera is powered on, the second infrared manager calls the seventh function in the first infrared driver through the fifth function.

[0295] S1211, the first infrared driver sends the first configuration information to the TOF camera through the seventh function to configure the TOF camera in infrared mode.

[0296] Among them, the seventh function is the init setting function in the first infrared driver, which is used to configure the TOF camera to infrared mode.

[0297] After the TOF camera is powered on, the second infrared manager can execute the `configure_ir_mode` function. When executing `configure_ir_mode`, the second infrared manager can call the `init setting` function in the first infrared driver. The `init setting` function contains the first configuration information; therefore, when the first infrared driver executes the `init setting` function, it can send this first configuration information to the TOF camera to configure it into infrared mode.

[0298] Thus, based on the steps S1210 and S1211 above, the second infrared manager controls the first infrared driver to send the first configuration information to the TOF camera through the fifth function.

[0299] In summary, based on the steps S1205 to S1211 above, the TOF camera is powered on and the first configuration information is sent to the TOF camera through the infrared hardware abstraction module, device node, second infrared manager and first infrared driver.

[0300] S1212, when the TOF camera is in infrared mode, the infrared hardware abstraction module sends the infrared remote control code to the second infrared driver.

[0301] S1213, the second infrared driver converts the infrared remote control code into an SPI signal.

[0302] Thus, based on the steps S1212 and S1213 above, the electronic device converts the infrared remote control code corresponding to the first operation into an SPI signal.

[0303] S1214, the second infrared driver sends the SPI signal to the SPI driver.

[0304] S1215, the SPI driver sends the SPI signal to the TOF camera.

[0305] The S1216 TOF camera emits infrared signals based on SPI signals; the infrared signals are used for infrared remote control of the controlled device.

[0306] Thus, based on the steps S1214 to S1216 above, the electronic device controls the TOF camera to emit infrared signals based on the SPI signal.

[0307] It should be noted that the specific implementation methods of S1213 to S1216 above can refer to the specific implementation methods of S815 to S818 above. To avoid repetition, they will not be repeated here.

[0308] Therefore, in this embodiment, a separate character device driver can be added to the kernel layer. This involves adding a device node to the kernel layer, registering the I2C bus, and implementing the `open`, `close`, and `configure_ir_mode` operations in the `ioctl` interface. Furthermore, the infrared hardware abstraction module implements the `open` and `close` function entry points to interact with the kernel layer.

[0309] It should be noted that the infrared remote control methods corresponding to Figures 11 and 12 are applicable to scenarios where the electronic device has only one TOF camera that can both support TOF image acquisition and infrared remote control functionality. This eliminates the need to query the identification information of the TOF camera supporting infrared remote control functionality in the electronic device during the above process.

[0310] In practical use, different functions of the same TOF camera cannot be enabled simultaneously. For example, it is not possible to use the same TOF camera to both acquire TOF images and perform infrared remote control at the same time. Therefore, for TOF cameras that support infrared remote control, there will be a conflict in the use of TOF cameras.

[0311] To resolve call conflicts from TOF cameras, a second infrared manager can register open and close callback functions with the camera driver for conflict and priority management. In this case, the output mode of the TOF camera has higher priority than the infrared mode. Specifically, the second infrared manager registers the open and close callback functions `on_open_camera_cb` and `on_close_camera_cb` with the camera driver.

[0312] As shown in Figure 11, when the TOF camera is in infrared mode, if the camera service receives an image output request for the TOF camera (for example, the camera application sends an image output request for the TOF camera to the camera service), the camera service calls the first function in the camera hardware abstraction module; the camera hardware abstraction module calls the eighth function in the camera driver through the first function; the camera driver notifies the ninth function in the second infrared manager through the eighth function; the second infrared manager controls the first infrared driver to trigger a second operation for the TOF camera through the ninth function; the second operation is to exit infrared mode and enter image output mode.

[0313] The camera hardware abstraction module can include the `open camera` function and the `close camera` function. The `open camera` function is used to open the TOF camera, and the `close camera` function is used to close the TOF camera. The first function is the `open camera` function in the camera hardware abstraction module.

[0314] Furthermore, the camera driver can include the CAM_ACQUIRE_DEV and CAM_RELEASE_DEV functions. The CAM_ACQUIRE_DEV function is used to detect when the TOF camera needs to be configured to output mode, enabling the TOF camera to acquire TOF images. The CAM_RELEASE_DEV function is used to detect when the TOF camera needs to be deactivated from output mode.

[0315] The eighth function can be the CAM_ACQUIRE_DEV function in the camera driver, and the ninth function can be the on_open_camera_cb function in the second infrared manager.

[0316] Thus, when the TOF camera is in infrared mode, if it is necessary to use the TOF camera to acquire TOF images, the camera application can send an image output request for the TOF camera to the camera service. After the camera service receives the image output request for the TOF camera, the camera service calls the open camera function in the camera hardware abstraction module.

[0317] When the camera hardware abstraction module executes the `open camera` function, it can call the `CAM_ACQUIRE_DEV` function in the camera driver. Then, the `CAM_ACQUIRE_DEV` function in the camera driver notifies the `on_open_camera_cb` function in the second infrared manager.

[0318] When the second infrared manager executes the `on_open_camera_cb` function, it can call the `close` function within itself. When the second infrared manager executes the `close` function, it can call the `power_down` function in the first infrared driver. When the first infrared driver executes the `power_down` function, it can trigger a power-down operation on the TOF camera, causing the driver chip in the TOF camera to exit infrared mode. Afterwards, the TOF camera is powered on again and configured into image output mode.

[0319] In summary, when the TOF camera is in infrared mode, if TOF image acquisition is required, the above method can be used to exit infrared mode for the driver chip in the TOF camera, followed by powering on the TOF camera and configuring it to image output mode. Afterwards, if the TOF image acquisition process ends (e.g., the user exits the camera application), the camera service can call the `close camera` function in the camera hardware abstraction module. When the camera hardware abstraction module executes the `close camera` function, it can call the `CAM_RELEASE_DEV` function in the camera driver. Then, through the `CAM_RELEASE_DEV` function in the camera driver, the `on_close_camera_cb` function in the second infrared manager is notified. When the second infrared manager executes the `on_close_camera_cb` function, it can trigger a power-down operation on the TOF camera, causing the driver chip in the TOF camera to exit image output mode. Then, following the above description of the second infrared manager and the first infrared driver, the operation of powering on the TOF camera and configuring it to infrared mode is triggered.

[0320] For example, Figure 13 is a flowchart of an infrared remote control method provided in an embodiment of this application. This infrared remote control method is applied to an electronic device that can remotely control applications and TOF cameras. The method may specifically include the following steps:

[0321] S1301, the electronic device receives a first operation from the user on the remote control application; the first operation is used to trigger infrared remote control.

[0322] S1302, the electronic device responds to the first operation by sending first configuration information to the TOF camera; the first configuration information is used to configure the TOF camera to infrared mode.

[0323] In the first implementation, the specific implementation process of S802 to S812 described above can be referred to, so that the electronic device responds to the first operation and sends the first configuration information to the TOF camera.

[0324] In the second implementation, the specific implementation process of S1002 to S1015 above can be referred to, so that the electronic device responds to the first operation and sends the first configuration information to the TOF camera.

[0325] In the third implementation, the specific implementation process of S1202 to S1211 above can be referred to, so that the electronic device responds to the first operation and sends the first configuration information to the TOF camera.

[0326] S1303: When the TOF camera is in infrared mode, the electronic device emits an infrared signal through the TOF camera; the infrared signal is used for infrared remote control of the controlled device.

[0327] Optionally, the electronic device can transmit infrared signals via the TOF camera in the following way: the electronic device converts the infrared remote control code corresponding to the first operation into an SPI signal; the electronic device controls the TOF camera to transmit infrared signals based on the SPI signal.

[0328] In the first implementation, the specific implementation process of S813 to S818 described above can be referred to, so that the electronic device emits infrared signals through the TOF camera.

[0329] In the second implementation, the specific implementation process of S1016 to S1020 above can be referred to, so that the electronic device emits infrared signals through the TOF camera.

[0330] In the third implementation method, the specific implementation process of S1212 to S1216 above can be referred to, so that the electronic device emits infrared signals through the TOF camera.

[0331] Therefore, in the infrared remote control scenario, the embodiments of this application can use the TOF camera originally installed in the electronic device to emit infrared signals to achieve infrared remote control. In this way, the infrared remote control transmitter installed on the top of the electronic device can be removed, and there is no need to open a hole in the middle frame of the top of the electronic device, thereby saving internal space of the electronic device and reducing the cost of the electronic device.

[0332] The infrared remote control method provided in the embodiments of this application has been described above with reference to Figures 6 to 13. The apparatus for performing the above method provided in the embodiments of this application is described below. As shown in Figure 14, Figure 14 is a schematic structural diagram of an infrared remote control device provided in an embodiment of this application. This infrared remote control device may be an electronic device as described in the embodiments of this application, or a chip or chip system within an electronic device.

[0333] As shown in Figure 14, the infrared remote control device 1400 includes a processing unit 1401. The processing unit 1401 is used to support the infrared remote control device 1400 in performing the above-described processing steps.

[0334] Specifically, the processing unit 1401 is used to receive a first operation from the user on the remote control application; the first operation is used to trigger infrared remote control. The processing unit 1401 is also used to, in response to the first operation, send first configuration information to the TOF camera; the first configuration information is used to configure the TOF camera to infrared mode. The processing unit 1401 is also used to, when the TOF camera is in infrared mode, to emit an infrared signal through the TOF camera; the infrared signal is used for infrared remote control of the controlled device.

[0335] In one possible implementation, the infrared remote control device 1400 further includes a storage unit 1402. The storage unit 1402 and the processing unit 1401 are connected via a circuit. The storage unit 1402 may include one or more memories, which can be devices in one or more devices or circuits used to store programs or data. The storage unit 1402 can exist independently and be connected to the processing unit 1401 via a communication bus. Alternatively, the storage unit 1402 can be integrated with the processing unit 1401.

[0336] Storage unit 1402 may store computer-executable instructions for methods in an electronic device, so that processing unit 1401 executes the methods in the above embodiments. Storage unit 1402 may be a register, cache, or random access memory (RAM), etc., and storage unit 1402 may be integrated with processing unit 1401. Storage unit 1402 may be read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions, and storage unit 1402 may be independent of processing unit 1401.

[0337] Figure 15 is a schematic diagram of the structure of a chip provided in an embodiment of this application. As shown in Figure 15, the chip 1500 includes one or more processors 1501, communication lines 1502 and communication interfaces 1503. Optionally, the chip 1500 also includes a memory 1504.

[0338] In some implementations, memory 1504 stores elements such as executable modules or data structures, or subsets thereof, or extended sets thereof.

[0339] The methods described in the embodiments of this application can be applied to, or implemented by, processor 1501. Processor 1501 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above methods can be completed by integrated logic circuits in the hardware of processor 1501 or by instructions in software form. Processor 1501 may be a general-purpose processor (e.g., a microprocessor or conventional processor), a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates, transistor logic devices, or discrete hardware components. Processor 1501 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application.

[0340] The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can be located in mature storage media in the art, such as random access memory, read-only memory, programmable read-only memory, or electrically erasable programmable read-only memory (EEPROM). This storage medium is located in memory 1504, and processor 1501 reads information from memory 1504 and, in conjunction with its hardware, completes the steps of the above method.

[0341] The processor 1501, memory 1504 and communication interface 1503 can communicate with each other via communication line 1502.

[0342] In the above embodiments, the instructions stored in the memory for execution by the processor can be implemented in the form of a computer program product. This computer program product can be pre-written into the memory, or it can be downloaded and installed into the memory as software.

[0343] This application also provides a computer program product comprising one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. For example, available media may include magnetic media (e.g., floppy disks, hard disks, or magnetic tapes), optical media (e.g., digital versatile discs (DVDs)), or semiconductor media (e.g., solid-state disks (SSDs)).

[0344] This application provides an electronic device, which includes a processor and a memory. The memory stores a computer program, and the processor invokes the computer program to execute the infrared remote control method described above.

[0345] This application provides a chip. The chip includes a processor, which is used to call a computer program in memory to execute the technical solutions in the above embodiments. Its implementation principle and technical effects are similar to those in the related embodiments described above, and will not be repeated here.

[0346] This application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program or instructions. When the computer program or instructions are executed by a processor, they implement the methods described above. The methods described in the above embodiments can be implemented wholly or partially by software, hardware, firmware, or any combination thereof. If implemented in software, the functionality can be stored as one or more instructions or code on or transmitted over the computer-readable medium. The computer-readable medium can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium accessible by a computer.

[0347] As one possible design, computer-readable media may include compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM, or other optical disc storage; computer-readable media may include disk storage or other disk storage devices. Furthermore, any connecting cable may also be appropriately referred to as computer-readable media. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of media. As used herein, disks and optical discs include optical discs (CD), laser discs, optical discs, DVDs, floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers. Combinations of the above should also be included within the scope of computer-readable media.

[0348] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more blocks of the flowchart illustrations and / or one or more blocks of the block diagrams.

[0349] The above specific embodiments further illustrate the purpose, technical solution and beneficial effects of this application. It should be understood that the above are only specific embodiments of this application and are not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of this application should be included within the scope of protection of this application.

Claims

1. An infrared remote control method, characterized by, The method is applied to an electronic device including a remote control application and a TOF camera, and the method includes: The electronic device receives a first operation of the remote control application; the first operation is used to trigger infrared remote control; The electronic device sends first configuration information to the TOF camera in response to the first operation; the first configuration information is used to configure the TOF camera into an infrared mode; In a case where the TOF camera is in the infrared mode, the electronic device emits an infrared signal through the TOF camera; the infrared signal is used to perform infrared remote control on a controlled device.

2. The method of claim 1, wherein, The electronic device emits an infrared signal through the TOF camera, including: The electronic device converts an infrared remote control code corresponding to the first operation into an SPI signal; The electronic device controls the TOF camera to emit the infrared signal based on the SPI signal.

3. The method of claim 1, wherein, The electronic device includes an application layer, an application program framework layer, a hardware abstraction layer, and a kernel layer; the application layer includes the remote control application and an infrared remote control SDK; the application program framework layer includes a first infrared manager and a camera service; the hardware abstraction layer includes a camera hardware abstraction module; and the kernel layer includes a camera driver; the electronic device sends first configuration information to the TOF camera in response to the first operation, including: The remote control application acquires an infrared remote control code corresponding to the first operation from the infrared remote control SDK in response to the first operation; The remote control application sends the infrared remote control code to the first infrared manager; After the first infrared manager receives the infrared remote control code, the TOF camera is powered on and the first configuration information is sent to the TOF camera through the first infrared manager, the camera service, the camera hardware abstraction module, and the camera driver.

4. The method of claim 3, wherein, The TOF camera is powered on and the first configuration information is sent to the TOF camera through the first infrared manager, the camera service, the camera hardware abstraction module, and the camera driver, including: The first infrared manager sends a first instruction to the camera service; the first instruction is used to instruct to power on the TOF camera and configure the TOF camera into the infrared mode; The camera service invokes a first function in the camera hardware abstraction module based on the first instruction; The camera hardware abstraction module controls the camera driver to trigger a power-on operation of the TOF camera and controls the camera driver to send the first configuration information to the TOF camera through the first function.

5. The method of claim 4, wherein, The first infrared manager queries identification information of a TOF camera supporting infrared remote control function in the electronic device; The first infrared manager sends the first instruction to the camera service; the first instruction includes the identification information. ​ 6. The method of claim 4, wherein, The hardware abstraction layer further comprises an infrared hardware abstraction module, and the camera hardware abstraction module comprises an infrared service; the sending of the first instruction from the first infrared manager to the camera service comprises: The first infrared manager sends the infrared remote control code to the infrared hardware abstraction module; The infrared hardware abstraction module queries whether the electronic device supports the infrared remote control function; In a case where the electronic device supports the infrared remote control function, the infrared hardware abstraction module sends a second instruction to the infrared service; the second instruction is used to instruct power-on of the TOF camera and configuration of the TOF camera into the infrared mode; The infrared service queries identification information of the TOF camera supporting the infrared remote control function in the electronic device based on the second instruction; The infrared service sends the first instruction to the camera service; the first instruction comprises the identification information.

7. The method of claim 4, wherein, The hardware abstraction layer further comprises a configuration module; the camera hardware abstraction module controls the camera driver to trigger the power-on operation of the TOF camera and the camera driver to send the first configuration information to the TOF camera through the first function, comprising: The camera hardware abstraction module sequentially calls a second function and a third function in the camera hardware abstraction module through the first function; The camera hardware abstraction module sends a third instruction to the camera driver through the second function; the third instruction is used to instruct power-on of the TOF camera; The camera driver triggers the power-on operation of the TOF camera based on the third instruction; After the TOF camera is powered on, the camera hardware abstraction module acquires the first configuration information from the configuration module through the third function; The camera hardware abstraction module sends the first configuration information to the camera driver; The camera driver sends the first configuration information to the TOF camera.

8. The method of claim 7, wherein, The first instruction comprises identification information of the TOF camera supporting the infrared remote control function; the camera hardware abstraction module acquires the first configuration information from the configuration module through the third function, comprising: The camera hardware abstraction module acquires the first configuration information corresponding to the identification information from the configuration module through the third function.

9. The method of claim 3, wherein, The priority of the image output mode of the TOF camera is higher than the priority of the infrared mode of the TOF camera; the method further comprises: In a case where the TOF camera is in the infrared mode, if the camera service receives an image output request for the TOF camera, the camera service triggers a second operation for the TOF camera; the second operation is an operation of exiting the infrared mode and entering the image output mode; In a case where the TOF camera is in the image output mode, if the camera service receives an infrared remote control request for the TOF camera, the camera service controls the TOF camera to remain unchanged in the image output mode.

10. The method of claim 3, wherein, The priority of the infrared mode of the TOF camera is higher than the priority of the out-of-picture mode of the TOF camera; the method further comprises: In a case where the TOF camera is in the out-of-picture mode, if the camera service receives an infrared remote control request for the TOF camera, the camera service triggers a third operation for the TOF camera; the third operation is an operation of exiting the out-of-picture mode and entering the infrared mode; In a case where the TOF camera is in the infrared mode, if the camera service receives an out-of-picture request for the TOF camera, the camera service controls the TOF camera to remain in the infrared mode unchanged.

11. The method of claim 1, wherein, The electronic device comprises an application layer, an application framework layer, a hardware abstraction layer and a kernel layer, the application layer comprises the remote control application and an infrared remote control SDK, the application framework layer comprises a first infrared manager, the hardware abstraction layer comprises an infrared hardware abstraction module, and the kernel layer comprises a device node, a second infrared manager and a first infrared driver; the electronic device, in response to the first operation, sends first configuration information to the TOF camera, comprising: The remote control application, in response to the first operation, acquires an infrared remote control code corresponding to the first operation from the infrared remote control SDK; The remote control application sends the infrared remote control code to the first infrared manager; The first infrared manager sends the infrared remote control code to the infrared hardware abstraction module; After the infrared hardware abstraction module receives the infrared remote control code, the TOF camera is powered on and the first configuration information is sent to the TOF camera through the infrared hardware abstraction module, the device node, the second infrared manager and the first infrared driver.

12. The method of claim 11, wherein, The powering on of the TOF camera and the sending of the first configuration information to the TOF camera through the infrared hardware abstraction module, the device node, the second infrared manager and the first infrared driver comprise: The infrared hardware abstraction module queries whether the electronic device supports an infrared remote control function; In a case where the electronic device supports the infrared remote control function, the infrared hardware abstraction module sends a fourth instruction to the device node; the fourth instruction is used to instruct the powering on of the TOF camera and the configuration of the TOF camera into the infrared mode; The device node, based on the fourth instruction, successively invokes a fourth function and a fifth function in the second infrared manager; The second infrared manager, through the fourth function, controls the first infrared driver to trigger the powering on operation of the TOF camera; After the TOF camera is powered on, the second infrared manager, through the fifth function, controls the first infrared driver to send the first configuration information to the TOF camera.

13. The method of claim 12, wherein, The second infrared manager, through the fourth function, controls the first infrared driver to trigger the powering on operation of the TOF camera, comprising: The second infrared manager invokes a sixth function in the first infrared driver through the fourth function; The first infrared driver triggers a power-on operation of the TOF camera through the sixth function; Correspondingly, the second infrared manager controls the first infrared driver to send the first configuration information to the TOF camera through the fifth function, including: The second infrared manager invokes a seventh function in the first infrared driver through the fifth function; The first infrared driver sends the first configuration information to the TOF camera through the seventh function.

14. The method of claim 11, wherein, The application framework layer further includes a camera service, the hardware abstraction layer further includes a camera hardware abstraction module, and the kernel layer further includes a camera driver; the method further includes: If the camera service receives an image output request for the TOF camera when the TOF camera is in the infrared mode, the camera service invokes a first function in the camera hardware abstraction module; The camera hardware abstraction module invokes an eighth function in the camera driver through the first function; The camera driver notifies a ninth function in the second infrared manager through the eighth function; The second infrared manager controls the first infrared driver to trigger a second operation on the TOF camera through the ninth function; the second operation is an operation of exiting the infrared mode and entering an image output mode.

15. The method according to any one of claims 1 to 14, characterized in that, The TOF camera includes a TOF sensor and a driving chip; the sending of the first configuration information to the TOF camera includes: The electronic device sends the first configuration information to the TOF sensor; The TOF sensor sends the first configuration information to the driving chip to configure the driving chip in the infrared mode.

16. The method of claim 2, wherein, The electronic device includes an application layer, an application framework layer, a hardware abstraction layer, and a kernel layer; the application layer includes the remote control application, the application framework layer includes a first infrared manager, the hardware abstraction layer includes an infrared hardware abstraction module, and the kernel layer includes a second infrared driver and an SPI driver; the electronic device converts an infrared remote control code corresponding to the first operation into an SPI signal, including: The remote control application sends the infrared remote control code to the first infrared manager; The first infrared manager sends the infrared remote control code to the infrared hardware abstraction module; The infrared hardware abstraction module sends the infrared remote control code to the second infrared driver; The second infrared driver converts the infrared remote control code into the SPI signal; Correspondingly, the electronic device controls the TOF camera to emit the infrared signal based on the SPI signal, including: The second infrared driver sends the SPI signal to the SPI driver; The SPI driver sends the SPI signal to the TOF camera; The TOF camera emits the infrared signal based on the SPI signal.

17. The method of claim 16, wherein, The TOF camera includes a driving chip and an emitter device; The SPI driver sends the SPI signal to the TOF camera, comprising: The SPI driver sends the SPI signal to the driving chip; Correspondingly, the TOF camera emits the infrared signal based on the SPI signal, comprising: The driving chip controls the emitter to emit the infrared signal based on the SPI signal.

18. An electronic device, comprising: The computer readable storage medium stores a computer program or instructions, when the computer program or instructions are run, the infrared remote control method in any one of claims 1 to 17 is realized.

19. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program or instructions, when the computer program or instructions are run, the infrared remote control method in any one of claims 1 to 17 is realized.

20. A computer program product, characterised in that, The computer readable storage medium stores a computer program or instructions, when the computer program or instructions are run, the infrared remote control method in any one of claims 1 to 17 is realized.