CN115729357A - Key control method, key control device and computer readable storage medium - Google Patents
Key control method, key control device and computer readable storage medium Download PDFInfo
- Publication number
- CN115729357A CN115729357A CN202111013782.9A CN202111013782A CN115729357A CN 115729357 A CN115729357 A CN 115729357A CN 202111013782 A CN202111013782 A CN 202111013782A CN 115729357 A CN115729357 A CN 115729357A
- Authority
- CN
- China
- Prior art keywords
- key
- function
- signal
- event
- lifting
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/02—Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]
Landscapes
- Input From Keyboards Or The Like (AREA)
Abstract
The invention discloses a key control method, a key control device and a computer readable storage medium, wherein the control method comprises the following steps: responding to the received lifting signal of the target key, and acquiring the interval time between the received pressing signal and the received lifting signal of the target key; acquiring a key function corresponding to the interval time; and distributing a press-down event and a lift-up event corresponding to the key function to trigger the operation of the key function. In the invention, the corresponding key functions can be obtained according to the interval time, thereby realizing the multiplexing of the same key. And after receiving the lifting signal of the target key, the invention distributes the pressing event and the lifting event corresponding to the key function to trigger the operation of the key function, on one hand, the invention can ensure that a plurality of key pressing events are not distributed in the process of triggering the function once, thereby saving the resources of the system. On the other hand, the distributed press-down event is also ensured to be matched with the corresponding lift-up event, and the stability of the system is improved.
Description
Technical Field
The present invention relates to the field of electronic control technologies, and in particular, to a method and an apparatus for controlling a key, and a computer-readable storage medium.
Background
In the prior art, in order to save physical space, different key functions can be triggered by a long press or a short press for the same physical button, wherein the long press and the short press both trigger a press (DWON) event and a lift (UP) event of the corresponding function respectively by a press operation and a lift operation of the key.
When the method is specifically applied to a scene of controlling a vehicle, after a press-DOWN action of a user (no matter long press or short press) is recognized, a vehicle machine distributes a short press-DOWN event (MODE _ KEY _ DOWN) of a short press corresponding to a function, and waits for a short press-UP event (MODE _ KEY _ UP) corresponding to the short press-DOWN event to end the process, but when the press-DOWN duration of the user exceeds a preset time, the vehicle machine system distributes another long press-DOWN event (VOICE _ KEY _ DOWN) corresponding to a long press function, at the moment, if the user lifts UP a button, the vehicle machine distributes a long press-UP event (VOICE _ KEY _ UP), the function corresponding to the long press KEY is triggered, but in the process of triggering the long press of the corresponding function by the vehicle machine, the short press-DOWN event of the system is always in the process.
For example, a "MODE switch" button (MODE) on the steering wheel switches the media source played in short time, and wakes up the voice assistant function in long time.
The user prepares to execute the operation of waking up the voice assistant according to MODE, and the execution sequence is as follows:
1. press MODE button.
At this time, the in-vehicle system distributes a MODE _ KEY _ DOWN event once.
2. Within one second after the MODE key is pressed.
At this time, the vehicle system distributes a VOICE _ KEY _ DOWN event again.
3. The MODE key is raised.
At this time, the car machine system distributes a VOICE _ KEY _ UP event.
And the vehicle-mounted machine system finishes long-press key event distribution.
As can be seen from the above, the system has executed one more MODE _ KEY _ DOWN event, which is an invalid event, and there is no MODE _ KEY _ UP event ending.
In the prior art, when the function corresponding to the long-press key is started, a short-press event needs to be started, which wastes system resources on one hand, and on the other hand, the instability of the car machine system may be caused because no corresponding short-press lift event is matched.
Disclosure of Invention
Embodiments of the present invention provide a key control method, a key control apparatus, and a computer-readable storage medium, so as to overcome a problem that in a process of multiplexing a same key in the prior art, on one hand, system resources are wasted, and on the other hand, a defect that a system may be unstable is overcome.
The invention solves the technical problems through the following technical scheme:
the invention provides a control method of a key, which comprises the following steps:
responding to a received lifting signal of a target key, and acquiring the interval time between the receiving of a pressing signal of the target key and the receiving of the lifting signal;
acquiring a key function corresponding to the interval time;
and distributing a pressing event and a lifting event corresponding to the key function to trigger the operation of the key function.
The invention also provides a key control device, which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor realizes the key control method when executing the computer program.
The present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of controlling a key as described above.
The positive progress effects of the invention are as follows: in the invention, after the target key is determined to be lifted in response to the received lifting signal of the target key, the corresponding key function can be obtained according to the interval time between the pressing signal of the target key and the receiving of the lifting signal, thereby realizing the multiplexing of the same key. And after receiving the lifting signal of the target key, the invention distributes the pressing events and the lifting events corresponding to the key functions to trigger the operation of the corresponding key functions, on one hand, the invention can ensure that a plurality of key pressing events are not distributed in the process of one-time function triggering, thereby saving the resources of the system, on the other hand, the invention can also ensure that the distributed pressing events are matched with the corresponding lifting events, thereby improving the stability of the system.
Drawings
Fig. 1 is a flowchart of a key control method in embodiment 1 of the present invention.
FIG. 2 is a flow chart of a specific implementation of step 101 in example 1.
Fig. 3 is a flowchart of a method for controlling a key in a specific scenario in embodiment 1.
Fig. 4 is a flowchart of a key control method in another specific scenario in embodiment 1.
Fig. 5 is a schematic block diagram of a key control device in embodiment 2 of the present invention.
Detailed Description
The invention is further illustrated by the following examples, which are not intended to limit the invention thereto.
Example 1
The present embodiment provides a method for controlling a key, as shown in fig. 1, the method includes the following steps:
Specifically, the specific lifting signal and the specific pressing signal can be selected according to actual conditions, for example, for a touch key, the touch signal is used as the pressing signal and the lifting signal; for another example, for the pressing type key, the pressure signal is used as the pressing signal and the lifting signal.
It should be understood that the above is only an example of the types of the lift-off signal and the push-down signal, and should not be a limitation to the present embodiment.
In a preferred embodiment, as shown in fig. 2, step 101 specifically includes the following steps:
and step 1013, acquiring the timing time of the timer and taking the timing time as the interval time.
In the embodiment, for the same key, the timer is started when the pressing signal is received, and the timer is closed when the lifting signal is received, so that the interval time between the pressing and the lifting of the target key can be accurately acquired by a simple timer timing mode.
And 102, acquiring a key function corresponding to the interval time.
In this embodiment, a corresponding relationship between the interval time and the key function is preset, and in step 102, the corresponding key function may be matched from the preset corresponding relationship according to the obtained interval time.
It should be understood that, in the present embodiment, which key functions are specifically included, and which key function is specifically matched with which interval or which interval, may be selected according to actual requirements.
In a specific embodiment, the key function includes at least one of a sound source switching function, a voice assistant starting function, a window opening and closing function, a system testing function and a system restarting function. In other embodiments, other key functions may be included, which is not limited in this embodiment.
In this embodiment, for the same key, different key functions can be obtained according to different time intervals, so that the function multiplexing of the same key is realized.
And 103, distributing a pressing event and a lifting event corresponding to the key function to trigger the key function to run.
In this embodiment, after receiving the lifting signal of the target key, the pressing event and the lifting event of the key function corresponding to the interval time are distributed to trigger the operation of the corresponding key function, so that on one hand, it is ensured that a plurality of key pressing events are not distributed in the process of one function triggering, thereby saving the resources of the system, and on the other hand, it is also ensured that the distributed pressing events are matched with the corresponding lifting events, thereby improving the stability of the system.
In a preferred embodiment, step 103 specifically includes the following steps:
distributing a pressing event corresponding to the key function;
after a preset time, a lift-up event corresponding to the key function is automatically distributed to trigger the operation of the key function.
In this embodiment, the lift-up event may be automatically distributed after a preset time elapses after the distribution of the press-down event, so that the operation of the corresponding key function may be triggered, and the lift-up event may be automatically distributed without other operations on the key, thereby further enhancing the stability of the system while ensuring the execution efficiency of the key function.
In a preferred embodiment, the control method further comprises the steps of:
and if the uplifting signal of the target key is not received within a preset time range after the pressing signal of the target key is received, generating key fault information.
In a specific embodiment, the control method is applied to a scenario of vehicle function control, but it should be understood that in other embodiments, the control method may also be applied to other scenarios, and the embodiment is not limited thereto.
In a specific embodiment, the target key is a physical key disposed on the vehicle, but it should be understood that in other embodiments, the target key is also a physical key, a virtual key, etc., disposed on other devices, and the embodiment is not limited thereto.
For a better understanding of the present embodiment, the following describes the present embodiment through two specific scenarios:
scene one:
assuming that the target key is specifically a "MODE switching" key (i.e., a MODE key) of the vehicle, in this scenario, multiplexing of two vehicle functions needs to be implemented, and when the interval time is less than 1s (second), the corresponding key function is a short-press function, and may specifically be a wake-up voice assistant function; when the interval time is longer than 1s, the corresponding key function is a long-press function, and may be a mode switching function specifically.
As shown in fig. 3, step 101 is executed first, a press signal is received when the MODE KEY is pressed, so as to start a timer, if the timer still does not receive a lift signal of the MODE KEY at the end of timing 1s, step 102 is executed to acquire the corresponding KEY function as a wake-UP VOICE assistant function, step 103 is executed again, a press event (VOICE _ KEY _ DOWN) corresponding to the VOICE assistant function is distributed, and a lift event (VOICE _ KEY _ UP) corresponding to the wake-UP VOICE assistant function is automatically distributed after 100ms (milliseconds), so as to trigger the wake-UP VOICE assistant function.
In step 101, if the timer receives a MODE KEY UP signal within 1s of time, step 102 is executed to obtain the corresponding KEY function as the sound source switching function, and then step 103 is executed to automatically distribute a DOWN event (MODE _ KEY _ DOWN) corresponding to the sound source switching function and a UP event (MODE _ KEY _ UP) corresponding to the sound source switching function after 100ms, thereby triggering the voice switching function of the vehicle.
Scene two:
assuming that the target key is specifically a MODE switching key (i.e., a MODE key) of the vehicle, in this scenario, multiplexing of at least four vehicle functions needs to be implemented, and when the interval time is less than 1s, the corresponding key function is a function of a MODE key in a conventional vehicle, i.e., a function of switching a sound source; when the interval time is greater than or equal to 1s and less than 2s, the corresponding key function is the function of a VOICE key in the traditional vehicle, namely the function of waking up a VOICE assistant; when the interval time is greater than or equal to 2s and less than 3s, the corresponding key function is the function of a WINDOW key in a traditional vehicle, namely the function of opening a vehicle WINDOW; when the interval time is greater than or equal to X seconds and less than X +1 seconds, the corresponding key function is a function of a REBOOT key in a conventional vehicle, that is, a function of restarting the vehicle machine, it should be understood that X in this embodiment may select a specific value according to an actual requirement, for example, X is 4 in a specific implementation, and in this embodiment, more key functions of the vehicle may also be extended according to the actual requirement.
As shown in fig. 4, step 101 is first executed, a MODE key is pressed, a press signal is received, a timer is started, a MODE key is lifted, a lift signal is received, and an interval N is calculated. Then, step 102 is executed, and when N is smaller than 1, the corresponding key function is a sound source switching function; when N is more than or equal to 1 and less than 2, the corresponding key function is a function of waking up the voice assistant; when N is more than or equal to 2 and less than 3, the corresponding key function is a window opening function; and when the N is more than or equal to the X and less than the X +1, the corresponding key function is a vehicle restarting machine function. Then, step 103 is executed to trigger the corresponding function to run.
In step 102, if N exceeds 3X seconds and the key-up signal is not received, it is determined that the key is possibly damaged, the timer is turned off, and a prompt signal may be further sent to prompt a relevant person to perform processing.
Example 2
The present embodiment provides a key control apparatus, which may be represented in a form of a computing device (for example, may be a server device), and includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the method for controlling keys in embodiment 1.
Fig. 5 shows a schematic diagram of a hardware structure of the embodiment, and as shown in fig. 5, the electronic device 9 specifically includes:
at least one processor 91, at least one memory 92, and a bus 93 for connecting the different system components (including the processor 91 and the memory 92), wherein:
the bus 93 includes a data bus, an address bus, and a control bus.
The processor 91 executes various functional applications and data processing, such as a control method of a key in embodiment 1 of the present invention, by running a computer program stored in the memory 92.
The electronic device 9 may further communicate with one or more external devices 94 (e.g., a keyboard, a pointing device, etc.). Such communication may be through an input/output (I/O) interface 95. Also, the electronic device 9 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via the network adapter 96. The network adapter 96 communicates with the other modules of the electronic device 9 via the bus 93. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 9, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, etc.
It should be noted that although in the above detailed description several units/modules or sub-units/modules of the electronic device are mentioned, such a division is merely exemplary and not mandatory. Indeed, the features and functionality of two or more of the units/modules described above may be embodied in one unit/module, according to embodiments of the application. Conversely, the features and functions of one unit/module described above may be further divided into embodiments by a plurality of units/modules.
Example 6
The present embodiment provides a computer-readable storage medium on which a computer program is stored, the program implementing the control method of keys in embodiment 1 when executed by a processor.
More specific examples, among others, that the readable storage medium may employ may include, but are not limited to: a portable disk, a hard disk, random access memory, read only memory, erasable programmable read only memory, optical storage device, magnetic storage device, or any suitable combination of the foregoing.
In a possible implementation manner, the present invention can also be implemented in the form of a program product, which includes program code for causing a terminal device to execute a control method for implementing the keys in embodiment 1 when the program product runs on the terminal device.
Where program code for carrying out the invention is written in any combination of one or more programming languages, the program code may be executed entirely on the user device, partly on the user device, as a stand-alone software package, partly on the user device and partly on a remote device or entirely on the remote device.
While specific embodiments of the invention have been described above, it will be appreciated by those skilled in the art that this is by way of example only, and that the scope of the invention is defined by the appended claims. Various changes and modifications to these embodiments may be made by those skilled in the art without departing from the spirit and scope of the invention, and these changes and modifications are within the scope of the invention.
Claims (9)
1. A control method of a key is characterized by comprising the following steps:
responding to a received lifting signal of a target key, and acquiring the interval time between the receipt of the pressing signal of the target key and the receipt of the lifting signal;
acquiring a key function corresponding to the interval time;
and distributing a pressing event and a lifting event corresponding to the key function to trigger the operation of the key function.
2. The method for controlling the key-press according to claim 1, wherein said obtaining the time interval between receiving the pressing signal of the target key and receiving the lifting signal in response to receiving the lifting signal of the target key comprises the steps of: starting a timer in response to receiving a pressing signal of the target key;
turning off the timer in response to receiving the lift signal of the target key;
and acquiring the timing time of the timer and taking the timing time as interval time.
3. The method for controlling a key set according to claim 1, wherein the key functions include at least one of a sound source switching function, a voice assistant starting function, a window opening and closing function, a system testing function and a system restarting function.
4. The method of controlling a key set according to claim 1, said method further comprising:
and if the lifting signal of the target key is not received within a preset time range after the pressing signal of the target key is received, generating key fault information.
5. The method for controlling a key according to claim 1, wherein the step of distributing the press-down event and the lift-up event corresponding to the key function to trigger the operation of the key function specifically comprises the steps of:
distributing a pressing event corresponding to the key function;
and after a preset time, automatically distributing a lifting event corresponding to the key function to trigger the operation of the key function.
6. The control method of the key set according to claim 1, which is applied to the scene of vehicle function control.
7. The key control method according to any one of claims 1 to 6, wherein the target key is a physical key provided in a vehicle.
8. A key control device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of controlling the key of any one of claims 1 to 7 when executing the computer program.
9. A computer-readable storage medium on which a computer program is stored, the computer program, when being executed by a processor, implementing a method of controlling a key according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111013782.9A CN115729357A (en) | 2021-08-31 | 2021-08-31 | Key control method, key control device and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111013782.9A CN115729357A (en) | 2021-08-31 | 2021-08-31 | Key control method, key control device and computer readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115729357A true CN115729357A (en) | 2023-03-03 |
Family
ID=85291917
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111013782.9A Pending CN115729357A (en) | 2021-08-31 | 2021-08-31 | Key control method, key control device and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115729357A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116974786A (en) * | 2023-07-27 | 2023-10-31 | 无锡车联天下信息技术有限公司 | Method for distributing side control key event of vehicle-mounted system |
-
2021
- 2021-08-31 CN CN202111013782.9A patent/CN115729357A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116974786A (en) * | 2023-07-27 | 2023-10-31 | 无锡车联天下信息技术有限公司 | Method for distributing side control key event of vehicle-mounted system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10579857B2 (en) | Terminal control method and device based on fingerprint recognition key, and terminal | |
CN102103406B (en) | The network event process that operating system is irrelevant | |
USRE43716E1 (en) | Method of fast switching control for different operation systems operated in computer | |
US7502919B2 (en) | Method for selecting local or remote keyboard control in legacy USB mode within predetermined time | |
CN1763714A (en) | Multifunction computer power button and method for controlling computer power switch | |
CN108132735B (en) | Terminal and application control method | |
CN105912241A (en) | Method and device for man-machine interaction, and terminal | |
JP2021105725A (en) | Noise reduction method, device, electronic apparatus, and recording medium based on on-vehicle multiple sound range | |
CN115729357A (en) | Key control method, key control device and computer readable storage medium | |
CN110989820A (en) | Method and device for controlling power consumption of processor, processor and electronic device | |
CN1801831A (en) | Method for increasing handset starting response speed | |
WO2018098901A1 (en) | Processing method and device for terminal service | |
CN112463226A (en) | Starting control method, system, equipment and storage medium of server | |
CN109547563B (en) | Message push processing method and device, storage medium and server | |
JPH0689121A (en) | Information processor facilitating change of using environment | |
CN108717349B (en) | Terminal bright screen control method and device, terminal and storage medium | |
CN101303653B (en) | Method for judging whether performing repeat starting up for computer system or not as well as computer system thereof | |
JPH09128277A (en) | File management system for plural os-mounted system | |
CN113535021B (en) | Method, apparatus, medium, and program product for transmitting session message | |
CN110647235B (en) | Data processing method and device based on terminal equipment and terminal equipment | |
US6282664B1 (en) | Method and apparatus for switching an electronic system between an operating mode and stand-by mode | |
CN111552906B (en) | Method and equipment for responding to page access request in reading application | |
WO2023142764A1 (en) | Wake-up method and apparatus for operating system, electronic device, and storage medium | |
CN115686329A (en) | Key adhesion processing method, device, medium and equipment in weak network environment | |
TW552519B (en) | Boot-on-now computer system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |