Mode switching method and device, equipment and storage medium

By sending control instructions to device drivers using key drivers in terminal devices, and directly controlling the opening or closing of the target device functions, the problem of the underlying device not being turned off during mode switching in the prior art is solved, and a more accurate, fast and safe mode switching effect is achieved.

CN119728848APending Publication Date: 2025-03-28GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311260812.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-26
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In the prior art, when the terminal device switches mode, the underlying device may not be turned off, resulting in the application function that does not match the working state of the underlying device, affecting the effect of mode switching.

Method used

By responding to the trigger operation of the target key, the key driver is used to send control instructions to the device driver of the target device, and the target device function is directly controlled to enable or close the target device function to ensure the accuracy of mode switching.

Benefits of technology

The accuracy and security of terminal device mode switching is achieved, avoiding the problem that the underlying device still works when the application function is turned off, and improving the speed and directness of mode switching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728848A_ABST
    Figure CN119728848A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a mode switching method and device, equipment and a storage medium, and the method comprises the steps: responding to a triggering operation for a target key, transmitting a control instruction to a device driver of a target device corresponding to a target equipment function through a key driver of the target key, and enabling the triggering operation to be used for switching a working mode of terminal equipment; the control instruction is executed through the device driver, the target device function is controlled to be in a target state corresponding to the control instruction, and the target state comprises an on state or an off state. The mode switching of the terminal equipment can be realized more accurately, quickly and safely.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to communication control technology, and relate to but are not limited to a mode switching method and apparatus, device, and storage medium. Background Art

[0002] When using a terminal device such as a mobile phone, a user usually needs to turn on or off a certain mode of the terminal device, such as a photo taking mode, a recording mode, etc.

[0003] In the prior art, in the process of turning these modes on or off, the user usually switches the mode through the corresponding mode switching controls, and the mode switching controls usually only turn off the corresponding application functions, and the underlying devices are not necessarily turned off.

[0004] This means that when the application function is turned off, some underlying devices can still work, resulting in a situation where the working states of the corresponding underlying devices do not match when the application function is turned on or off, resulting in poor mode switching effect. Summary of the invention

[0005] In view of this, the mode switching method, apparatus, device, and storage medium provided in the embodiments of the present application can more accurately, quickly, and safely implement the mode switching of the terminal device. The mode switching method, apparatus, device, and storage medium provided in the embodiments of the present application are implemented as follows:

[0006] The mode switching method provided in an embodiment of the present application is applied to a terminal device, and the method includes:

[0007] In response to a trigger operation on a target key, a control instruction is sent to a device driver of a target device corresponding to a target device function through a key driver of the target key, wherein the trigger operation is used to switch an operating mode of the terminal device;

[0008] The control instruction is executed by the device driver to control the target device function to be in a target state corresponding to the control instruction, and the target state includes an on state or an off state.

[0009] An embodiment of the present application provides a mode switching device, which is applied to a terminal device, and includes: a response module and an execution module;

[0010] A response module, configured to respond to a trigger operation on a target key, and to send a control instruction to a device driver of a target device corresponding to a target device function through a key driver of the target key, wherein the trigger operation is used to switch an operating mode of the terminal device;

[0011] The execution module is used to execute the control instruction through the device driver to control the target device function to be in a target state corresponding to the control instruction, and the target state includes an on state or an off state.

[0012] The computer device provided in the embodiment of the present application includes a memory and a processor. The memory stores a computer program that can be run on the processor. When the processor executes the program, the method of the embodiment of the present application is implemented.

[0013] The computer-readable storage medium provided in the embodiment of the present application has a computer program stored thereon, and when the computer program is executed by a processor, the method provided in the embodiment of the present application is implemented.

[0014] The mode switching method, apparatus, device, and storage medium provided in the embodiments of the present application can respond to a trigger operation on a target button, and send a control instruction to a device driver of a target device corresponding to a target device function through a key driver of the target button, wherein the trigger operation is used to switch the working mode of the terminal device; the device driver executes the control instruction to control the target device function to be in a target state corresponding to the control instruction, wherein the target state includes an on state or a off state. Among them, by sending a control instruction to a device driver of a target device corresponding to a target device function through a key driver, the state of the target device can be controlled more quickly and directly, that is, the switching of the on state or the off state of the target device can be realized more quickly and directly, and by controlling the state of the target device, the accuracy of the control can also be guaranteed, and further, the mode switching of the terminal device can be realized more accurately, quickly, and safely. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.

[0016] Figure 1 A schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application;

[0017] Figure 2 A schematic diagram of the software architecture of a terminal device provided in an embodiment of the present application;

[0018] Figure 3 A schematic diagram of a flow chart of a mode switching method provided in an embodiment of the present application;

[0019] Figure 4 Another schematic diagram of a flow chart of a mode switching method provided in an embodiment of the present application;

[0020] Figure 5 Another schematic diagram of a flow chart of a mode switching method provided in an embodiment of the present application;

[0021] Figure 6 Another schematic diagram of a flow chart of a mode switching method provided in an embodiment of the present application;

[0022] Figure 7 Another schematic diagram of a flow chart of a mode switching method provided in an embodiment of the present application;

[0023] Figure 8 A schematic diagram of the structure of a mode switching device provided in an embodiment of the present application;

[0024] Fig. 9 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the specific technical solution of the present application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application.

[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0027] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0028] It should be pointed out that the terms "first\second\third" involved in the embodiments of the present application are used to distinguish similar or different objects, and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.

[0029] In the prior art, in the process of turning on or off the mode of a terminal device, the user usually switches the mode through a corresponding mode switching control, and the mode switching control usually only turns off the corresponding application function, and the underlying device is not necessarily turned off.

[0030] For example, you can exit the camera mode by turning off the camera mode control, making the terminal device unable to take photos. However, this solution may not turn off the camera, but only turn off the specific function of taking photos from the framework layer of the terminal device. This may lead to some malware directly calling the camera that is not turned off through special means, thereby realizing the transmission of photo data, which may lead to data leakage, etc.

[0031] Therefore, when the technical means in the prior art are adopted, there is a situation where when a certain function is turned off, the working state of the underlying device corresponding to the function does not match, resulting in poor effect of mode switching, that is, the mode switching of the terminal device cannot be accurately implemented according to the user's operation.

[0032] In view of this, a mode switching solution is proposed in an embodiment of the present application. The hardware structure corresponding to the mode switching method is explained in detail below.

[0033] Figure 1 For a hardware structure diagram of the terminal device provided in the embodiment of the present application, please refer to Figure 1 The terminal device includes: a processor 110, a memory 120, an input unit 130 and a function unit 140.

[0034] The processor 110 is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device. By running or executing software programs and / or modules stored in the memory 120, and calling data stored in the memory 120, the processor 110 performs various functions of the terminal device and processes data, thereby monitoring the terminal device as a whole. Optionally, the processor 110 may include one or more processing units; optionally, the processor 110 may integrate an application processor, which mainly processes operating devices, user interfaces, and application programs, etc. Of course, other processors may also be included, which are not listed here one by one.

[0035] The memory 120 can be used to store software programs and modules. The processor 110 executes various functional applications and data processing of the terminal device by running the software programs and modules stored in the memory 120. The memory 120 mainly includes a program storage area and a data storage area, wherein the program storage area can store operating devices, at least one application required for a function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the terminal device (such as audio data, a phone book, etc.), etc. In addition, the memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0036] The input unit 130 can be a physical button, such as a push button, a rotary button, etc., and there is no specific limitation here. The corresponding physical button form can be selected based on actual needs. The physical button can respond to the user's trigger to achieve mode switching. For example, the user can turn on or off certain functional units by triggering the physical button.

[0037] The functional unit 140 can be any type of functional device, for example: a speaker, a display screen, a receiver, a microphone, a flashlight, a camera, a near field communication device and other types of devices, which are not specifically limited here, and the corresponding functional unit settings can be selected according to actual needs. The user can control the opening or closing of the functional unit 140 through the input unit 130. Among them, each functional unit 140 can correspond to one or more input units 130, and accordingly, each input unit 130 can also correspond to one or more functional units, which are not specifically limited here. In the process of realizing the control of any functional unit 140, the opening or closing of the functional unit can be realized through one or more input units 130.

[0038] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the terminal device. In other embodiments of the present application, the terminal device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0039] The following explains the software architecture corresponding to this mode switching method.

[0040] Figure 2 For a schematic diagram of the software architecture of the terminal device provided in the embodiment of the present application, please refer to Figure 2It should be noted that the terminal device can be, for example, a mobile phone, a tablet computer, a laptop computer, a PDA, a mobile internet device (MID), a wearable device, a virtual reality (VR) device, an augmented reality (AR) device, a smart screen, an artificial intelligence (AI) speaker, a headset, a terminal in industrial control, a terminal in self-driving, a terminal in remote medical surgery, a terminal in smart grid, a terminal in transportation safety, a terminal in smart city, a terminal in smart home, a personal digital assistant (PDA), and other terminal devices with physical buttons, and the embodiments of the present application are not limited to this.

[0041] The terminal device may include: a driver layer 210 , a framework layer 220 and an application layer 230 .

[0042] Among them, the driving layer 210 can have a driving function, which may include button driving and device driving. The button driving can, for example, be a driving achieved by triggering a physical button on the terminal device; the device driving can, for example, be a driving performed by triggering the opening or closing of each functional unit.

[0043] For example, a physical button may be triggered by a user to realize button driving, and a corresponding functional unit may be turned off by triggering a device driver.

[0044] The framework layer 220 may include various services and abstract layers. For example, a key driver may correspond to a key abstract layer and a mode switching service, and a device driver may correspond to a device abstract layer and a device service. In the actual implementation process, the key abstract layer may be triggered by the key driver, and then the mode switching service monitors the key abstract layer, and the corresponding settings are made to the switches in the device service based on the monitoring results. After the settings are completed, the device driver may be triggered based on the device abstract layer.

[0045] The application layer 230 may specifically include multiple application software, such as mobile phone application software APP, etc., which are not specifically limited here. The use status or the on / off status of each function in the application may be specifically displayed based on the information fed back by the framework layer 220 to the application layer.

[0046] It should be noted that the software structure framework of the above-mentioned terminal device is only an example. For example, the operating system of the terminal device is Android system. Of course, the terminal device can also use other operating systems, such as Linux operating system, Hongmeng operating system, or IOS operating system, etc. In different operating systems, the software structure framework may change, but as long as the functions implemented by each functional module are similar to the modules in the embodiment of the present application, the handwriting display method provided in the embodiment of the present application can also be implemented, and it should not be understood as a limitation on the software structure framework.

[0047] The following explains the implementation process of the mode switching method provided in the embodiment of the present application based on the hardware structure and software architecture of the above-mentioned terminal device.

[0048] Figure 3 For a flow chart of the mode switching method provided in the embodiment of the present application, please refer to Figure 3 , the method comprising:

[0049] S310: In response to a trigger operation on a target key, a control instruction is sent to a device driver of a target device corresponding to a target device function through a key driver of the target key.

[0050] The trigger operation is used to switch the working mode of the terminal device.

[0051] It should be noted that the execution subject of the method is the above-mentioned terminal device, and the target button can be Figure 1 The input unit shown in, for example, can be a physical button set on a mobile phone, such as a power button, a volume button, etc., and is not specifically limited here.

[0052] Key driver is Figure 2 The key driver in the driver layer of the terminal device in the target device function can be one of the multiple functions that the terminal device can realize, such as: photo function, broadcasting function, screen recording function, flashlight function and other types of functions. There is no specific limitation here. The above enumeration is only a feasible example. Different functions can correspond to different target devices. For example, the target device corresponding to the photo function can be a camera, and the target device corresponding to the broadcasting function can be a speaker, etc. It can be any one or more functional units in the hardware structure of the terminal device. The device driver corresponding to the target device is Figure 2 Device driver within the driver layer of the mid-terminal device.

[0053] That is, the terminal device can respond to the user's triggering operation on the target key, thereby controlling the key driver of the target key to send a control instruction to the device driver of the target device corresponding to the function of the target device.

[0054] For example, if the terminal device is a mobile phone, when implementing the process of closing the camera function, the specific steps are as follows:

[0055] In response to the user's triggering operation on the camera function off button, the mobile phone can send a control instruction to the device driver of the camera corresponding to the camera function through the button driver of the camera function off button. The control instruction can specifically be a data packet.

[0056] S320: Executing the control instruction through the device driver to control the target device function to be in a target state corresponding to the control instruction.

[0057] The target state includes an on state or a off state.

[0058] Optionally, after receiving the control instruction, the device driver may execute the control instruction, so that the target device function is in a target state corresponding to the control instruction.

[0059] Among them, the control instruction may include an open instruction or a close instruction. Accordingly, in the process of executing the control instruction, the target device function can be turned on or off. For example, the open instruction can correspond to the open state; the close instruction can correspond to the close state.

[0060] For example, if the terminal device is a mobile phone, when the camera function is turned off and the control instruction is a turn-off instruction, the specific steps are as follows:

[0061] After receiving the shutdown instruction, the device driver of the camera can execute the shutdown instruction, thereby turning off the camera function.

[0062] That is to say, the solution provided in the embodiment of the present application can directly control the device driver through key driving, thereby avoiding the situation where only the target device function is turned off without turning off the underlying device.

[0063] In the mode switching method provided in the embodiment of the present application, in response to a trigger operation on a target button, a control instruction can be sent to a device driver of a target device corresponding to a target device function through a button driver of the target button, and the trigger operation is used to switch the working mode of the terminal device; the control instruction is executed through the device driver to control the target device function to be in a target state corresponding to the control instruction, and the target state includes an on state or a off state. Among them, by sending a control instruction to a device driver of a target device corresponding to a target device function through a button driver, the state of the target device can be controlled more quickly and directly, that is, the switching of the on state or the off state of the target device can be realized more quickly and directly, and by controlling the state of the target device, the accuracy of the control can also be guaranteed, and further, the mode switching of the terminal device can be realized more accurately, quickly and safely.

[0064] The following explains the implementation process of sending instructions and adjusting the target state in the mode switching method provided in the embodiment of the present application.

[0065] Figure 4 For another flow chart of the mode switching method provided in the embodiment of the present application, please refer to Figure 4 , sending a control instruction to a device driver of a target device corresponding to a target device function through a key driver of a target key, including:

[0066] S410: calling a function function of a device driver of a target device through a key driver of a target key, generating a control instruction including the function function, and then sending the control instruction to the device driver of the target device.

[0067] Among them, the functional function includes an opening function or a closing function.

[0068] Optionally, the key driver may call a function in the device driver, wherein the device driver may keep the function open during operation, thereby implementing the calling of the key driver.

[0069] It should be noted that the function function can be a function pre-configured in the device driver, and the function calling interface can be exposed so that the key driver can call the function function. The function function can include an on function or a off function, wherein executing the on function can turn on the target device, and correspondingly, executing the off function can turn off the target device.

[0070] In actual implementation, the device driver can be selected to execute the function alone or the device driver and the device abstraction layer can be selected to execute the function together according to actual needs, and no specific limitation is made here.

[0071] Optionally, in the process of executing a function call, the key driver of the target key can call the function function of the device driver of the target device, and then generate a corresponding control instruction. The control instruction may include relevant instructions for the device driver to execute the function function. Based on the received control instruction, the device driver can execute the function function, thereby controlling the target device to be in an on or off state.

[0072] The device driver executes the control instruction to control the target device function to the target state corresponding to the control instruction, including:

[0073] S420: Controlling the target device to be turned on or off by executing the operation corresponding to the function through the device driver, so that the target device function is in a target state.

[0074] It should be noted that when the device driver executes a functional function, it can perform operations corresponding to the functional function. For example, for an open function, it can perform operations such as powering the corresponding circuit; for a close function, it can perform operations such as powering off the corresponding circuit or clearing storage. No specific restrictions are made here.

[0075] After the device driver performs the corresponding operation, it can control the target device to be turned on or off.

[0076] It should be noted that if the target device function corresponds to a target device, the target state corresponding to the target device function can be determined based on the on or off state of the target device; accordingly, if the target device function corresponds to multiple target devices, the target state corresponding to the target device function can be comprehensively determined based on the on or off state of all the target devices.

[0077] For example, for the recording function, a camera and a microphone are required, which are two different target devices. If the recording function needs to be turned off, the device driver corresponding to the camera needs to be controlled to execute the operation corresponding to the closing function, and the device driver corresponding to the microphone needs to be controlled to execute the operation corresponding to the closing function. When the camera and the microphone are turned off, it can be determined that the recording function is in the off state.

[0078] In the mode switching method provided in the embodiment of the present application, the function function of the device driver of the target device can be called by the key driver of the target key, and after generating the control instruction including the function function, the control instruction is sent to the device driver of the target device; the device driver executes the operation corresponding to the function function to control the target device to be turned on or off, so that the function of the target device is in the target state. Among them, the method of calling the function function by the key driver and the device driver executing the function function can realize the control of the target device more accurately, quickly and directly, and accordingly, the mode switching of the terminal device can be realized more accurately, quickly and safely.

[0079] Optionally, before calling the function function of the device driver of the target device through the key driver of the target key and generating a control instruction including the function function, the method further includes: controlling the function function corresponding to the device driver to be in a callable state.

[0080] It should be noted that, in actual use, the corresponding function can be in a callable state by controlling the device drive. The callable function can be determined based on the current working state of the target device.

[0081] For example, when the target device corresponding to the device driver is in the off state, the corresponding on function can be controlled to be in a callable state; when the target device corresponding to the device driver is in the on state, the corresponding off function can be controlled to be in a callable state. Thus, the function call can be realized more quickly, and the function can be executed more quickly.

[0082] In the process of implementing a function in a callable state, the function can be made callable by exposing the corresponding interface. For example, when controlling the camera to turn off, the device driver corresponding to the camera can be made to expose the corresponding interface, so that the camera's shutdown function can be made callable.

[0083] In the mode switching method provided in the embodiment of the present application, the function function of the device driver of the target device can be called by the key driver of the target key, and before the control instruction including the function function is generated, the function function corresponding to the device driver is controlled to be in a callable state. By putting the function function in a callable state, the key driver can call the function function more quickly, directly and accurately, thereby improving the accuracy and efficiency of the device driver in executing the function function, and further, the function switching of the terminal device can be realized more quickly and accurately.

[0084] The following are different ways to implement the control of turning on or off the target device. One of the feasible ways is as follows: Figure 5 shown.

[0085] Figure 5 For another flow chart of the mode switching method provided in the embodiment of the present application, please refer to Figure 5 , controlling the target device to turn on or off by executing the operation corresponding to the function through the device driver, including: controlling the power of the target device to be closed or disconnected by executing the operation corresponding to the function through the device driver, wherein, if the function function is a closing function, the power of the target device is controlled to be disconnected; if the function function is an opening function, the power of the target device is controlled to be closed.

[0086] That is, before executing the function, the type of the function may be determined first, for example, by executing step S510: determining the type of the function.

[0087] Based on the different types of functional functions, different control methods can be adopted.

[0088] If the function function is a shutdown function, then execute step S520: control the target device to be powered off; if the function function is a startup function, then execute step S530: control the target device to be powered on.

[0089] It should be noted that the device driver can be connected to the power supply module that supplies power to each device through the software architecture. When the device driver executes the operation corresponding to the start function, it can send a power supply instruction to the power supply module that supplies power to the device, so that the power supply module supplies power to the target device, so that the target device can work normally; conversely, when the device driver executes the operation corresponding to the shutdown function, it can send a power-off instruction to the power supply module that supplies power to the device, so that the power supply module cuts off power to the target device, so that the target device cannot work normally due to lack of power.

[0090] For example, taking the photo function as an example, when the device driver of the camera executes the operation corresponding to the start function, the device driver can send a power start instruction to the power module that supplies power to the camera, so that the camera has a working voltage, and then the camera can be turned on, thereby turning on the photo function; when the device driver of the camera executes the operation corresponding to the close function, the device driver can send a power disconnect instruction to the power module that supplies power to the camera, so that the camera has no working voltage, and then the camera can be turned off, thereby turning off the photo function.

[0091] In the mode switching method provided in the embodiment of the present application, the operation corresponding to the function can be executed by the device driver to control the power of the target device to be turned on or off, wherein if the function function is a closing function, the power of the target device is controlled to be turned off; if the function function is an opening function, the power of the target device is controlled to be closed. When controlling a specific target device, the opening or closing of the target device can be more accurately achieved by turning the power on and off, thereby providing the accuracy of the terminal device mode switching.

[0092] Another implementation method for controlling the opening or closing of a target device is explained below. Figure 6 shown.

[0093] Figure 6 For another flow chart of the mode switching method provided in the embodiment of the present application, please refer to Figure 6, controlling the target device to be turned on or off by executing operations corresponding to the function through the device driver, including: controlling the state of the cache data of the target device by executing operations corresponding to the function through the device driver, wherein, if the function function is a closing function, the cache data of the target device is cleared; and if the function function is an opening function, the cache data of the target device is retained.

[0094] That is, before executing the function, the type of the function may be determined first, for example, by executing step S610: determining the type of the function.

[0095] Based on the different types of functional functions, different control methods can be adopted.

[0096] If the function function is a closing function, then execute step S620: clear the cache data of the target device; if the function function is an opening function, then execute step S630: retain the cache data of the target device.

[0097] It should be noted that the device driver can send cache clearing instructions to the cache of each device through the software architecture. When the device driver executes the operation corresponding to the opening function, it may not send a clearing instruction to the cache corresponding to the target device, so that the cache maintains the corresponding cache, so that the target device can work normally; conversely, when the device driver executes the operation corresponding to the closing function, it may send a clearing instruction to the cache corresponding to the target device, so that the cache clears the corresponding cache, so that the target device cannot work normally due to the lack of cache content.

[0098] For example, for the recording function, when the device driver of the microphone executes the operation corresponding to the opening function, the device driver will not send a clear instruction to the microphone's buffer, so that the microphone always maintains the corresponding cache data during the recording process, so that the microphone can transmit the recording normally, thereby turning on the recording function; when the device driver of the microphone executes the operation corresponding to the closing function, the device driver will send a clear instruction to the microphone's buffer, so that the cache data obtained by the microphone during the recording process is deleted, so that the microphone cannot transmit the recording normally, thereby turning off the recording function.

[0099] It should be noted that in the process of implementing cache clearing, in addition to sending a clear instruction to the cache to clear the cache, you can also use the method of cutting off the power to the cache to make the cache lose the current cache content, thereby achieving cache clearing. The specific method used can be set accordingly based on the type of cache, and is not limited to the above example.

[0100] In the mode switching method provided in the embodiment of the present application, the device driver can execute the operation corresponding to the function to control the state of the cache data of the target device, wherein if the function function is a shutdown function, the cache data of the target device is cleared; if the function function is an open function, the cache data of the target device is retained. When controlling a specific target device, the target device can be more accurately turned on or off by clearing the cache, thereby providing the accuracy of the terminal device mode switching.

[0101] Another implementation method for controlling the opening or closing of a target device is explained below. Figure 7 shown.

[0102] Figure 7 For another flow chart of the mode switching method provided in the embodiment of the present application, please refer to Figure 7 , controlling the target device to be turned on or off by executing operations corresponding to the function through the device driver, including: controlling the content of the cache data of the target device by executing operations corresponding to the function through the device driver, wherein, if the function function is a closing function, the cache data of the target device is replaced with preset cache data; if the function function is an opening function, the cache data of the target device is kept unchanged.

[0103] That is, before executing the function, the type of the function may be determined first, for example, by executing step S710: determining the type of the function.

[0104] Based on the different types of functional functions, different control methods can be adopted.

[0105] If the function function is a closed function, step S720 is executed: replacing the cache data of the target device with the preset cache data; if the function function is an open function, step S730 is executed: keeping the cache data of the target device unchanged.

[0106] It should be noted that the device driver can send cache replacement instructions to the cache of each device through the software architecture. When the device driver executes the operation corresponding to the opening function, the replacement instruction may not be sent to the cache corresponding to the target device, so that the cache maintains the corresponding cache, so that the target device can work normally; conversely, when the device driver executes the operation corresponding to the closing function, the replacement instruction may be sent to the cache corresponding to the target device, so that the cache clears the current cache data and replaces it with the preset cache data, so that the target device cannot work normally because it can only transmit the preset cache data.

[0107] For example, taking the photo function as an example, when the device driver of the camera executes the operation corresponding to the start function, the device driver will not send a replacement instruction to the camera's buffer, so that the camera always maintains the corresponding cache data during the photo-taking process, so that the camera can transmit the captured image normally, thereby turning on the photo-taking function; when the device driver of the camera executes the operation corresponding to the close function, the device driver will send a replacement instruction to the camera's buffer, such as replacing it with a black screen or other preset pixel interface, so that the cache data obtained by the camera during the photo-taking process is replaced, so that the camera cannot transmit the captured data normally, thereby turning off the photo-taking function.

[0108] It should be noted that the preset cache data may be data pre-stored in a cache or other storage device that can communicate with the cache. After the cache receives a replacement instruction, the data obtained by the cache may be replaced with the preset cache data. For example, taking the cache data of a camera as an example, the preset cache data may be picture data such as a black screen or a white screen; taking the cache data of a microphone as an example, the preset cache data may be voice data such as a preset voice.

[0109] In the mode switching method provided in the embodiment of the present application, the operation corresponding to the function can be executed by the device driver to control the content of the cache data of the target device, wherein if the function function is a closing function, the cache data of the target device is replaced with the preset cache data; if the function function is an opening function, the cache data of the target device is kept unchanged. When controlling a specific target device, the target device can be more accurately turned on or off by replacing the cache, thereby providing the accuracy of the terminal device mode switching.

[0110] For a target device function with multiple target devices, the on or off method adopted by each target device when executing the function function can be set based on actual needs, and can be the same or different, and no specific limitation is made here.

[0111] For example, taking the recording function as an example, the corresponding target devices include a camera and a microphone, wherein, in the process of turning off the camera, the device driver of the camera can send a replacement instruction to the cache of the camera to replace the cache of the picture transmitted by the camera with a preset picture, so that the cache data obtained by the camera during the recording process is replaced; the device driver of the microphone can send a clear instruction to the cache of the microphone to delete the cache of the sound transmitted by the microphone, so that the cache data obtained by the microphone during the recording process is deleted, thereby turning off the recording function.

[0112] Optionally, the method further includes: in response to a trigger operation on a target key, sending a target trigger event to a target abstraction layer through a key driver of the target key, and triggering a software switch corresponding to a target device function to be in a target state through the target trigger event.

[0113] Can be combined Figure 2 In the software architecture of the terminal device, after the terminal device responds to the trigger operation for the target button, in addition to controlling the button driver to execute steps S310-S320, the button driver can also send a target trigger event to the corresponding target abstraction layer, wherein the target abstraction layer can be a button abstraction layer, and the target trigger event can be an event to turn on or off the function of the target device. The event can be monitored through the mode switching service, and the software switch corresponding to the target device function can be triggered to be in the target state through the target trigger event.

[0114] For example: If the function of the target device is mute, that is, turning off the speaker, then in response to the trigger operation on the target button, a mute trigger event can be sent to the button abstraction layer through the button driver of the target button, and the mute trigger event can trigger the software switch corresponding to the speaker to be in the off state.

[0115] The terminal device can display the software status result through a display screen or a display light or other prompting device. For example, the current volume is displayed on the mobile phone screen. Since the speaker is turned off, the current volume is 0.

[0116] It should be noted that different target buttons can be configured for different target device functions. For example, multiple physical buttons can be set to correspond to mute / unmute, take a photo / stop taking a photo, record / stop recording, record a video / stop recording, etc.

[0117] The specific setting method can be set according to the specific structure of the terminal device, and is not limited here. For example, a corresponding target button can be set for each type of target device function, or multiple functions can be controlled based on the same target button.

[0118] If multiple functions are controlled based on the same target button, the specific target device function corresponding to the target button at the current moment can be pre-configured; or, the target button has multiple triggering modes, and different triggering modes can correspond to different target device functions. For example, if the target button is a rotation button, then when the target button is rotated to different angles, the corresponding target device function may also be different; if the target button is a press button, then based on the number of presses within a period of time, it can correspond to different target device functions, such as: pressing once within a certain period of time corresponds to recording off, pressing twice within a certain period of time corresponds to photo taking off, etc.

[0119] Based on the foregoing embodiments, an embodiment of the present application provides a mode switching device, which includes the modules included and the units included in the modules, and can be implemented by a processor; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA), etc.

[0120] Figure 8 For a schematic diagram of the structure of the mode switching device provided in the embodiment of the present application, please refer to Figure 8 , the device is applied to a terminal device, and the device includes: a response module 810, an execution module 820;

[0121] A response module 810, configured to respond to a trigger operation on a target button and send a control instruction to a device driver of a target device corresponding to a target device function through a key driver of the target button, wherein the trigger operation is used to switch an operating mode of the terminal device;

[0122] The execution module 820 is used to execute the control instruction through the device driver to control the target device function to be in a target state corresponding to the control instruction, and the target state includes an on state or an off state.

[0123] Optionally, the response module 810 is specifically used to call the function function of the device driver of the target device through the key driver of the target key, and after generating a control instruction including the function function, send the control instruction to the device driver of the target device, where the function function includes an on function or a off function; the execution module 820 is specifically used to execute the operation corresponding to the function function through the device driver, control the target device to be turned on or off, so that the function of the target device is in a target state.

[0124] Optionally, the execution module 820 is further used to control the function corresponding to the device driver to be in a callable state.

[0125] Optionally, the execution module 820 is specifically used to control the power of the target device to be turned on or off by executing the operation corresponding to the function function through the device driver, wherein, if the function function is a closing function, the power of the target device is controlled to be turned off; if the function function is an opening function, the power of the target device is controlled to be turned on.

[0126] Optionally, the execution module 820 is specifically used to control the state of the cache data of the target device by executing the operation corresponding to the function function through the device driver, wherein, if the function function is a closed function, the cache data of the target device is cleared; if the function function is an open function, the cache data of the target device is retained.

[0127] Optionally, the execution module 820 is specifically used to control the content of the cache data of the target device by executing the operation corresponding to the function function through the device driver, wherein, if the function function is a closed function, the cache data of the target device is replaced with preset cache data; if the function function is an open function, the cache data of the target device is kept unchanged.

[0128] Optionally, the response module 810 is also used to respond to the trigger operation on the target key, send a target trigger event to the target abstraction layer through the key driver of the target key, and trigger the software switch corresponding to the target device function to be in the target state through the target trigger event.

[0129] In the mode switching device provided in the embodiment of the present application, in response to a trigger operation on a target button, a control instruction can be sent to a device driver of a target device corresponding to a target device function through a key driver of the target button, and the trigger operation is used to switch the working mode of the terminal device; the control instruction is executed through the device driver to control the target device function to be in a target state corresponding to the control instruction, and the target state includes an on state or a off state. Among them, by sending a control instruction to a device driver of a target device corresponding to a target device function through a key driver, the state of the target device can be controlled more quickly and directly, that is, the switching of the on state or the off state of the target device can be realized more quickly and directly, and by controlling the state of the target device, the accuracy of the control can also be guaranteed, and further, the mode switching of the terminal device can be realized more accurately, quickly and safely.

[0130] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.

[0131] It should be noted that in the embodiments of this application Figure 8 The division of modules in the mode switching device shown is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit. It may also be implemented in the form of a combination of software and hardware.

[0132] It should be noted that in the embodiment of the present application, if the above method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium, including several instructions to enable an electronic device to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific combination of hardware and software.

[0133] Fig. 9 For a schematic diagram of the structure of the computing device provided in the embodiment of the present application, please refer to Fig. 9 , an embodiment of the present application provides a computer device, which may be the above-mentioned terminal device, and its internal structure diagram may be as shown in Fig. 9 As shown. The computer device includes a processor 920, a memory and a network interface 940 connected via a system bus 910. Among them, the processor 920 of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium 931 and an internal memory 932. The non-volatile storage medium 931 stores an operating system, a computer program and a database. The internal memory 932 provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface 940 of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor 920, the above method is implemented.

[0134] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the method provided in the above embodiment are implemented.

[0135] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the steps of the method provided in the above method embodiment.

[0136] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0137] In one embodiment, the mode switching device provided in the present application can be implemented in the form of a computer program. The computer program can be Fig. 9 The computer device shown in the figure is run. The memory of the computer device can store various program modules constituting the above-mentioned device. The computer program composed of various program modules enables the processor to execute the steps in the method of each embodiment of the present application described in this specification.

[0138] It should be noted here that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium, storage medium and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.

[0139] It should be understood that "one embodiment" or "an embodiment" or "some embodiments" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in one embodiment" or "in some embodiments" appearing throughout the specification may not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The above-mentioned sequence numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments. The above description of each embodiment tends to emphasize the differences between the various embodiments, and the same or similar aspects can be referenced to each other. For the sake of brevity, this article will not repeat them.

[0140] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, object A and / or object B can represent three situations: object A exists alone, object A and object B exist at the same time, and object B exists alone.

[0141] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0142] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as: multiple modules or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or modules can be electrical, mechanical or other forms.

[0143] The modules described above as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules; they may be located in one place or distributed on multiple network units; some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0144] In addition, all functional modules in the embodiments of the present application may be integrated into one processing unit, or each module may be a separate unit, or two or more modules may be integrated into one unit; the above-mentioned integrated modules may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0145] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.

[0146] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling an electronic device to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0147] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0148] The features disclosed in several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0149] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0150] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A mode switching method, characterized in that: The method is applied to a terminal device, and the method comprises: In response to a trigger operation on a target key, sending a control instruction to a device driver of a target device corresponding to a target device function through a key driver of the target key, wherein the trigger operation is used to switch an operating mode of the terminal device; The control instruction is executed by the device driver to control the target device function to be in a target state corresponding to the control instruction, and the target state includes an on state or an off state.

2. The mode switching method according to claim 1, characterized in that: The sending of a control instruction to a device driver of a target device corresponding to a target device function through a key driver of the target key includes: Calling a function function of a device driver of the target device through a key driver of the target key, generating a control instruction including the function function, and sending the control instruction to the device driver of the target device, wherein the function function includes an on function or a off function; The step of executing the control instruction by the device driver to control the target device function to be in a target state corresponding to the control instruction includes: The device driver executes the operation corresponding to the functional function, and controls the target device to be turned on or off, so that the target device function is in the target state.

3. The mode switching method according to claim 2, characterized in that: Before calling the function function of the device driver of the target device through the key driver of the target key and generating a control instruction including the function function, the method further includes: Control the function corresponding to the device driver to be in a callable state.

4. The mode switching method according to claim 2, characterized in that: The step of executing the operation corresponding to the function through the device driver to control the target device to be turned on or off includes: The operation corresponding to the function function is executed by the device driver to control the power of the target device to be turned on or off. If the function function is a closing function, the power of the target device is controlled to be turned off; if the function function is an opening function, the power of the target device is controlled to be turned on.

5. The mode switching method according to claim 2, characterized in that: The step of executing the operation corresponding to the function through the device driver to control the target device to be turned on or off includes: The device driver executes the operation corresponding to the function function to control the state of the cache data of the target device, wherein if the function function is a closed function, the cache data of the target device is cleared; if the function function is an open function, the cache data of the target device is retained.

6. The device mode switching method according to claim 2, characterized in that: The step of executing the operation corresponding to the function through the device driver to control the target device to be turned on or off includes: The operation corresponding to the function function is executed by the device driver to control the content of the cache data of the target device, wherein if the function function is a closed function, the cache data of the target device is replaced with preset cache data; if the function function is an open function, the cache data of the target device is kept unchanged.

7. The mode switching method according to any one of claims 1 to 6, characterized in that: The method further comprises: In response to a trigger operation on a target key, a target trigger event is sent to a target abstraction layer through a key driver of the target key, and a software switch corresponding to a function of the target device is triggered to be in the target state through the target trigger event.

8. A mode switching device, characterized in that: The device is applied to a terminal device, and comprises: a response module and an execution module; The response module is used to respond to a trigger operation on a target button and send a control instruction to a device driver of a target device corresponding to a target device function through a key driver of the target button, wherein the trigger operation is used to switch an operating mode of the terminal device; The execution module is used to execute the control instruction through the device driver to control the target device function to be in a target state corresponding to the control instruction, and the target state includes an on state or an off state.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, wherein: When the processor executes the program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.