Event listening processing method and device, electronic equipment and storage medium
By employing a two-level linked list mechanism and an asynchronous processing library in smart devices, and sharing hardware and software layer event listeners, the problem of excessive resource consumption is solved, and device performance and event processing efficiency are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ESWIN COMPUTING TECH CO LTD
- Filing Date
- 2022-10-19
- Publication Date
- 2026-07-03
Smart Images

Figure CN115658430B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an event monitoring and processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] In the Internet of Things (IoT) field, an increasing number of smart home devices and wearable devices are combining front-end and embedded technologies to achieve their functions. To enable intelligent judgment, smart devices need event listening capabilities to determine the user's current actions in real time. Event listening refers to sending a corresponding event object to the appropriate event listener when a certain event occurs. The event listener then processes the event object according to the internally encapsulated event information. Therefore, implementing an event-triggered listening mechanism at both the software and hardware layers is crucial.
[0003] In existing technologies, such as the open-source project Espruino, separate listening mechanisms are designed for hardware-level triggering and software-level triggering, which consume a lot of resources and reduce the performance of smart devices. Summary of the Invention
[0004] To address the aforementioned issues, this application provides an event monitoring and processing method, apparatus, electronic device, and storage medium.
[0005] At least one embodiment of this application provides an event listening and processing method, including:
[0006] Upon detecting a triggering event, determine the first event name of the triggering event, wherein the triggering event includes a hardware-layer triggering event or a software-layer triggering event;
[0007] Based on the first event name, query the target event related information corresponding to the first event name in the secondary linked list. The secondary linked list includes: multiple event names of the hardware layer triggered events and event related information corresponding to each event name, as well as multiple event names of the software layer triggered events and event related information corresponding to each event name.
[0008] The relevant information of the target event is processed asynchronously.
[0009] According to at least one embodiment of the event listening processing method provided in this application, determining the first event name of the triggering event includes:
[0010] In the case where the triggering event includes a hardware-layer triggering event, a flag bit in the callback function is obtained, wherein the callback function is a function received by the event listener in the event triggering case, and the flag bit is a signal used to characterize the hardware-layer triggering event;
[0011] The name of the first event corresponding to the flag bit is determined based on the asynchronous processing library.
[0012] According to at least one embodiment of the event listening processing method provided in this application, determining the first event name that triggers the event includes:
[0013] In the case where the triggering event includes a software layer triggering event, the type of the event interface is determined, and the event interface includes: an event lookup interface and an event removal interface;
[0014] Based on the type of the event interface, determine the parameters related to the first event;
[0015] Based on the parameters related to the first event, the name of the first event that was triggered is determined.
[0016] According to at least one embodiment of the event listening processing method provided in this application, when the event interface includes an event lookup interface, the first event-related parameters include the event type being looked up;
[0017] When the event interface includes an event removal interface, the first event-related parameters include: the type of event to be removed or a combination of the event type and the removal callback function.
[0018] According to at least one embodiment of the event listening processing method provided in this application, when the first event-related parameters only include the removed event type, the target event-related information includes all callback functions corresponding to the first event name and the singly linked list in the secondary linked list.
[0019] According to at least one embodiment of the event listening processing method provided in this application, when the first event-related parameters include the event type to be removed and the removal callback function, the target event-related information includes the data node corresponding to the removal callback function on the secondary linked list.
[0020] According to at least one embodiment of the event listening and processing method provided in this application, the event interface further includes: an event adding interface, which is used to add an event to the secondary linked list in the initial state;
[0021] When the event interface includes an event addition interface, the first event-related parameters include: the type of event to be added, the event callback function to be added, and the parameters of the event callback function to be added.
[0022] At least one embodiment of this application also provides an event listening and processing apparatus, including:
[0023] The first determining module is used to determine the first event name of the triggering event when a triggering event is detected, wherein the triggering event includes a hardware layer triggering event or a software layer triggering event;
[0024] The second determining module is used to query the target event related information corresponding to the first event name in a secondary linked list based on the first event name. The secondary linked list includes: multiple event names of the hardware layer triggered events and event related information corresponding to each event name, and multiple event names of the software layer triggered events and event related information corresponding to each event name.
[0025] The processing module is used to asynchronously process the target event-related information.
[0026] At least one embodiment of this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the event listening and processing method as described above.
[0027] At least one embodiment of this application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the event listening and processing method as described above.
[0028] The event listening and processing method, apparatus, electronic device, and storage medium provided in this application share a single event listening mechanism for both hardware-layer and software-layer triggered events. After an event is triggered, a secondary linked list is used to efficiently search for the corresponding event and related information of the target event, and the related information of the target event is processed asynchronously. This saves resources, increases the available resources of the smart device, and improves the performance of the smart device. At the same time, by efficiently searching for and processing events asynchronously, the execution efficiency of events is improved, further enhancing the performance of the smart device. Attached Figure Description
[0029] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0030] Figure 1 This is one of the flowcharts illustrating the event listening and processing method provided in at least one embodiment of this application;
[0031] Figure 2 This is a schematic diagram of the structure of a secondary linked list provided in at least one embodiment of this application;
[0032] Figure 3 This is a second schematic flowchart of an event listening and processing method provided in at least one embodiment of this application;
[0033] Figure 4 This is the third flowchart of the event listening and processing method provided in at least one embodiment of this application;
[0034] Figure 5 This is a schematic diagram of the structure of an event listening and processing device provided in at least one embodiment of this application;
[0035] Figure 6 This is a schematic diagram of the structure of an electronic device provided in at least one embodiment of this application. Detailed Implementation
[0036] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0037] To address the problem in existing technologies where separate listening mechanisms are designed for hardware-layer and software-layer triggering, consuming significant resources and leading to performance degradation in smart devices, this application provides an event listening and processing method. Figure 1 This is a flowchart illustrating at least one embodiment of the event listening and processing method provided in this application, such as... Figure 1 As shown, the method includes:
[0038] Step 110: Upon detecting a triggering event, determine the first event name of the triggering event, wherein the triggering event includes a hardware layer triggering event or a software layer triggering event;
[0039] Step 120: Based on the first event name, query the target event related information corresponding to the first event name in the secondary linked list. The secondary linked list includes: multiple event names of the hardware layer triggered events and event related information corresponding to each event name, and multiple event names of the software layer triggered events and event related information corresponding to each event name.
[0040] Step 130: Asynchronously process the relevant information of the target event.
[0041] Specifically, some technical solutions design separate event listening mechanisms for hardware-level and software-level monitoring, which consumes resources within the smart device and affects its performance, especially for resource-constrained small and medium-sized devices. Therefore, in at least one embodiment of this application, a shared event listening mechanism is designed for hardware-level and software-level triggered events. Hardware-level and software-level events are categorized and stored in a secondary linked list, enabling efficient retrieval or removal of the event after it is triggered, and execution of the event's callback function. Furthermore, since existing technologies process events sequentially, the long processing time of one event often affects the execution efficiency of subsequent events. Therefore, in at least one embodiment of this application, asynchronous processing of found events improves event execution efficiency.
[0042] Optionally, the above events can be processed asynchronously using the libuv asynchronous processing library. That is, the found events and their corresponding target event information are input into the non-blocking I / O model. Within the non-blocking I / O model, time-consuming events are added to the thread pool for execution. After execution, they are added to the main event processing thread to avoid blocking the main thread and greatly improve the efficiency of event processing.
[0043] Optionally, Figure 2 This is a schematic diagram of the structure of a secondary linked list provided in at least one embodiment of this application, such as... Figure 2 As shown, the above two-level linked list includes multiple head nodes, data nodes corresponding to each head node, a first pointer, and a second pointer. A single head node, its corresponding data node, and its second pointer constitute a singly linked list. The head node represents the type of event, such as... Figure 2 The events A, B, and C shown, taking the screen as the event source, can be triggered by a screen swipe, and the corresponding event type is a swipe event. Therefore, event A can be a swipe event. The first pointer is used to move from the previous head node to the next head node, as shown below. Figure 2 The pointers shown exist between events A and B, and between events B and C. The second pointer is used to point from the head node to the corresponding data node, or, within the same singly linked list, from one data node to the next. The data nodes store the name of the second event and related information about the target event corresponding to that name. Figure 2 The multiple data nodes shown, arranged side-by-side with event A, can store the name of the second event of event A, the callback function corresponding to event A, and relevant parameters of the JavaScript engine. The secondary linked list categorizes and stores events according to their type, further narrowing the search scope. Furthermore, the structured design of the secondary linked list improves the efficiency of adding, searching, and removing events.
[0044] In addition, the secondary linked list includes a memory allocation function. Before an event is added, the memory required for the event can be determined and added to the memory allocation function. When adding an event, the secondary linked list can dynamically allocate memory for the event according to the memory allocation function. Compared with the existing solution of storing events in a fixed-size array, the use of a secondary linked list saves more device resources.
[0045] Optionally, when searching for an event, the aforementioned secondary linked list can find a singly linked list with the same event type as the first event name by traversing the head node. Then, through the data nodes in the singly linked list, the name of the second event matching the first event name can be further determined, and the relevant information of the target event corresponding to that event can be obtained. When traversing the head node, traversal can be performed from the starting position, from the ending position, or from the middle of the secondary linked list; this application does not impose any restrictions on this.
[0046] Optionally, determining the first event name that triggers the event includes:
[0047] In the case where the triggering event includes a hardware-layer triggering event, a flag bit in the callback function is obtained, wherein the callback function is a function received by the event listener in the event triggering case, and the flag bit is a signal used to characterize the hardware-layer triggering event;
[0048] The name of the first event corresponding to the flag bit is determined based on the asynchronous processing library.
[0049] Specifically, Figure 3 This is a second schematic flowchart of an event listening and processing method provided in at least one embodiment of this application, as shown below. Figure 3 As shown, during hardware initialization, callback functions are set for interrupt events. When an interrupt event is triggered at the hardware layer, a flag for the corresponding event is set in the callback function. In the event listener, the asynchronous processing library uses the libuv event loop to detect the flag, enabling the use of global variables across different threads and facilitating communication between them. After detecting the flag, the name of the first event corresponding to the flag is further determined so that the corresponding event can be found and executed in the secondary linked list based on this first event name.
[0050] Optionally, determining the first event name that triggers the event includes:
[0051] In the case where the triggering event includes a software layer triggering event, the type of the event interface is determined, and the event interface includes: an event lookup interface and an event removal interface;
[0052] Based on the type of the event interface, determine the parameters related to the first event;
[0053] Based on the parameters related to the first event, the name of the first event that was triggered is determined.
[0054] Specifically, after a software layer event is triggered, an event object is created and passed as a parameter to the event interface. Therefore, before determining the name of the first event, the event interface must be determined first, and then the first event-related parameters contained in the event interface must be determined. The name of the first event to be triggered is then determined based on the first event-related parameters.
[0055] Optionally, if the event interface includes an event lookup interface, the first event-related parameters include the event type being looked up;
[0056] When the event interface includes an event removal interface, the first event-related parameters include: the type of event to be removed or a combination of the event type and the removal callback function.
[0057] Specifically, Figure 4 This is the third flowchart of the event listening and processing method provided in at least one embodiment of this application, as shown below. Figure 4 As shown, the event lookup interface is `emitWatch()`. This interface can include the event type to be searched. A secondary linked list is used to find the event corresponding to the searched event type, and the corresponding callback function is executed. The event removal interface is `removeWatch()`. This interface can include only the event type to be removed, or both the event type and the removal callback function. The secondary linked list is used to find the event corresponding to the removed event type, and the corresponding callback function is executed.
[0058] Optionally, if the first event-related parameters only include the removed event type, the target event-related information includes all callback functions corresponding to the first event name and the singly linked list in the secondary linked list.
[0059] Specifically, if the first event-related parameters in the removeWatch() interface only include the event type to be removed, it means that all callback functions related to the first event name and the singly linked list corresponding to the first event name need to be removed. The corresponding event can be found through the secondary linked list, and all callback functions and the corresponding singly linked list corresponding to the event can be deleted to update the secondary linked list.
[0060] Optionally, if the first event-related parameters include the event type to be removed and the removal callback function, the target event-related information includes the node data corresponding to the removal callback function on the secondary linked list.
[0061] Specifically, if the first event-related parameters in the removeWatch() interface include the event type to be removed and the removal callback function, it means that the data node corresponding to the removal callback function in the singly linked list corresponding to the event needs to be removed. The corresponding event and its singly linked list can be found through the secondary linked list. The data node corresponding to the removal callback function in the singly linked list can be found and deleted to update the singly linked list and the secondary linked list.
[0062] Optionally, the event interface further includes an event adding interface, which is used to add events to the secondary linked list in the initial state;
[0063] When the event interface includes an event addition interface, the first event-related parameters include: the type of event to be added, the event callback function to be added, and the parameters of the event callback function to be added.
[0064] Specifically, such as Figure 4 As shown, the event addition interface is setWatch(). This interface includes the event type to be added, the event callback function to be added, and the parameters of the event callback function to be added. When registering an event listener for an event source, by determining the three parameters of the event addition interface setWatch(), the corresponding event can be added to the secondary linked list. The event type to be added can be used as the head node, and the event callback function and the parameters of the event callback function can be used as the data nodes corresponding to the head node.
[0065] Optionally, the above-mentioned event interface can be encapsulated by a JS engine. The JS engine is used to parse the JS language and convert it into machine language that the computer can recognize. The core event handling logic is written in C language. Compared with the existing technology that uses JS language to write the core event handling logic, the higher running efficiency of C language improves the running speed of the embodiments of this application, thereby further improving the event execution efficiency.
[0066] The event listening and processing method provided in this application shares a single event listening mechanism between hardware-layer and software-layer triggered events. After an event is triggered, a secondary linked list is used to efficiently search for the corresponding event and related target event information. The target event information is then processed asynchronously. This saves resources, increases the available resources of the smart device, and improves its performance. Furthermore, the efficient event retrieval and asynchronous processing enhance the execution efficiency of the event, further improving the smart device's performance. In addition, the secondary linked list allows for on-demand event storage, further improving smart device performance by saving resources.
[0067] The event listening and processing apparatus provided in this application is described below. The event listening and processing apparatus described below can be referred to in correspondence with the event listening and processing method described above.
[0068] Figure 5 This is a schematic diagram of the structure of an event listening and processing device provided in at least one embodiment of this application, such as... Figure 5 As shown, the event monitoring and processing device 500 includes: a first determining module 501, a second determining module 502, and a processing module 503, wherein:
[0069] The first determining module 501 is used to determine the first event name of the triggering event when a triggering event is detected, wherein the triggering event includes a hardware layer triggering event or a software layer triggering event.
[0070] The second determining module 502 is used to query the target event related information corresponding to the first event name in a secondary linked list based on the first event name. The secondary linked list includes: multiple event names of the hardware layer triggered events and event related information corresponding to each event name, and multiple event names of the software layer triggered events and event related information corresponding to each event name.
[0071] The processing module 503 is used to asynchronously process the target event-related information.
[0072] The event monitoring and processing device provided in this application shares a single event monitoring mechanism between hardware-layer and software-layer triggered events. After an event is triggered, a secondary linked list efficiently searches for the corresponding event and related target event information, and asynchronously processes the target event information. This saves resources, increases the available resources of the smart device, and improves its performance. Furthermore, the efficient event lookup and asynchronous processing enhance event execution efficiency, further improving the smart device's performance. In addition, the secondary linked list allows for on-demand event storage, further conserving resources and increasing smart device performance.
[0073] Optionally, the first determining module 501 is specifically used for:
[0074] In the case where the triggering event includes a hardware layer triggering event, a flag bit in the callback function is obtained, wherein the callback function is a function received when the event is triggered, and the flag bit is a signal used to characterize the hardware layer triggering event;
[0075] The name of the first event corresponding to the flag bit is determined based on the asynchronous processing library.
[0076] Optionally, the first determining module 501 is specifically used for:
[0077] In the case where the triggering event includes a software layer triggering event, the type of the event interface is determined, and the event interface includes: an event lookup interface and an event removal interface;
[0078] Based on the type of the event interface, determine the parameters related to the first event;
[0079] Based on the parameters related to the first event, the name of the first event that was triggered is determined.
[0080] Optionally, the first determining module 501 is specifically used for:
[0081] When the event interface includes an event lookup interface, the first event-related parameters include the type of event being looked up;
[0082] When the event interface includes an event removal interface, the first event-related parameters include: the type of event to be removed or a combination of the event type and the removal callback function.
[0083] Optionally, the first determining module 501 is specifically used for:
[0084] The event interface further includes an event addition interface, which is used to add events to the secondary linked list in the initial state.
[0085] When the event interface includes an event addition interface, the first event-related parameters include: the type of event to be added, the event callback function to be added, and the parameters of the event callback function to be added.
[0086] Optionally, the second determining module 502 is specifically used for:
[0087] If the first event-related parameters only include the removed event type, the target event-related information includes all callback functions corresponding to the first event name and the singly linked list in the secondary linked list.
[0088] Optionally, the second determining module 502 is specifically used for:
[0089] When the first event-related parameters include the event type to be removed and the removal callback function, the target event-related information includes the data node corresponding to the removal callback function on the secondary linked list.
[0090] Figure 6 This is a schematic diagram of the structure of an electronic device provided in at least one embodiment of this application, such as... Figure 6As shown, the electronic device may include: a processor 610, a communications interface 620, a memory 630, and a communication bus 640, wherein the processor 610, the communications interface 620, and the memory 630 communicate with each other via the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute an event listening and processing method, which includes:
[0091] Upon detecting a triggering event, determine the first event name of the triggering event, wherein the triggering event includes a hardware-layer triggering event or a software-layer triggering event;
[0092] Based on the first event name, query the target event related information corresponding to the first event name in the secondary linked list. The secondary linked list includes: multiple event names of the hardware layer triggered events and event related information corresponding to each event name, as well as multiple event names of the software layer triggered events and event related information corresponding to each event name.
[0093] The relevant information of the target event is processed asynchronously.
[0094] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0095] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the event listening and processing method provided by the above methods, the method including:
[0096] Upon detecting a triggering event, determine the first event name of the triggering event, wherein the triggering event includes a hardware-layer triggering event or a software-layer triggering event;
[0097] Based on the first event name, query the target event related information corresponding to the first event name in the secondary linked list. The secondary linked list includes: multiple event names of the hardware layer triggered events and event related information corresponding to each event name, as well as multiple event names of the software layer triggered events and event related information corresponding to each event name.
[0098] The relevant information of the target event is processed asynchronously.
[0099] Furthermore, this application also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the event listening and processing methods provided by the methods described above, the method comprising:
[0100] Upon detecting a triggering event, determine the first event name of the triggering event, wherein the triggering event includes a hardware-layer triggering event or a software-layer triggering event;
[0101] Based on the first event name, query the target event related information corresponding to the first event name in the secondary linked list. The secondary linked list includes: multiple event names of the hardware layer triggered events and event related information corresponding to each event name, as well as multiple event names of the software layer triggered events and event related information corresponding to each event name.
[0102] The relevant information of the target event is processed asynchronously.
[0103] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0104] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0105] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. An event listening processing method, characterized by, include: Upon detecting a triggering event, determine the first event name of the triggering event, wherein the triggering event includes a hardware-layer triggering event or a software-layer triggering event; Based on the first event name, query the target event related information corresponding to the first event name in the secondary linked list. The secondary linked list includes: multiple event names of the hardware layer triggered events and event related information corresponding to each event name, as well as multiple event names of the software layer triggered events and event related information corresponding to each event name. The relevant information of the target event is processed asynchronously; The determination of the first event name of the triggering event includes: In the case where the triggering event includes a hardware-layer triggering event, a flag bit in the callback function is obtained, wherein the callback function is a function received when the event is triggered, and the flag bit is a signal used to characterize the hardware-layer triggering event; the name of the first event corresponding to the flag bit is determined based on the asynchronous processing library; In the case where the triggering event includes a software-layer triggering event, the type of the event interface is determined, the event interface including: an event lookup interface and an event removal interface; based on the type of the event interface, first event-related parameters are determined; based on the first event-related parameters, the name of the triggered first event is determined.
2. The event listening and processing method according to claim 1, characterized in that, When the event interface includes an event lookup interface, the first event-related parameters include the type of event being looked up; When the event interface includes an event removal interface, the first event-related parameters include: the type of event to be removed or a combination of the event type and the removal callback function.
3. The event monitoring and processing method according to claim 1 or 2, characterized in that, If the first event-related parameters only include the removed event type, the target event-related information includes all callback functions corresponding to the first event name and the singly linked list in the secondary linked list.
4. The event listening and processing method according to claim 1 or 2, characterized in that, When the first event-related parameters include the event type to be removed and the removal callback function, the target event-related information includes the data node corresponding to the removal callback function on the secondary linked list.
5. The event listening and processing method according to claim 1 or 2, characterized in that, The event interface further includes an event addition interface, which is used to add events to the secondary linked list in the initial state. When the event interface includes an event addition interface, the first event-related parameters include: the type of event to be added, the event callback function to be added, and the parameters of the event callback function to be added.
6. An event monitoring and processing device, characterized in that, include: The first determining module is used to determine the first event name of the triggering event when a triggering event is detected, wherein the triggering event includes a hardware layer triggering event or a software layer triggering event; The second determining module is used to query the target event related information corresponding to the first event name in a secondary linked list based on the first event name. The secondary linked list includes: multiple event names of the hardware layer triggered events and event related information corresponding to each event name, and multiple event names of the software layer triggered events and event related information corresponding to each event name. The processing module is used to asynchronously process the target event-related information; The first determining module is specifically configured to: when the triggering event includes a hardware-layer triggering event, obtain a flag bit in a callback function, wherein the callback function is a function received when the event is triggered, and the flag bit is a signal used to characterize the hardware-layer triggering event; determine the first event name corresponding to the flag bit based on an asynchronous processing library; when the triggering event includes a software-layer triggering event, determine the type of the event interface, wherein the event interface includes an event lookup interface and an event removal interface; determine first event-related parameters based on the type of the event interface; and determine the triggered first event name based on the first event-related parameters.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the event listening and processing method as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the event listening and processing method as described in any one of claims 1 to 5.