Application lifecycle callback function calling method, apparatus, device and terminal
Patent Information
- Application Number
- CN202411197765.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2044-08-29
AI Technical Summary
[0004]本发明提供了一种应用生命周期回调函数调用方法、装置、设备及终端,以解决资源受限设备中调用回调函数时可能会导致的资源不足的问题
[0020]本发明实施例的技术方案,在嵌入式操作系统中监测到目标应用的生命周期触发事件的情况下,确定所述生命周期触发事件对应的回调函数调用标识;基于所述目标应用的应用注册表中回调函数表的回调函数标记,从所述回调函数表中获取所述回调函数调用标识对应的回调函数索引;基于所述回调函数索引调用所述生命周期触发事件对应的回调函数,基于此,本发明通过在应用注册表中设置回调函数表,并基于回调函数表中的回调函数标记,确定回调函数索引,从而实现对相应回调函数的回调,无需在内存中记录回调函数的地址,解决了回调函数调用过程中,对于内存占用的问题,解决资源受限设备中调用回调函数时可能会导致的资源不足的问题。
Smart Images

Figure CN119088481B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of application lifecycle management technology, and in particular to an application lifecycle callback function invocation method, apparatus, device and terminal. Background Technology
[0002] Application lifecycle management refers to the different stages when external entities interact with on-chip applications. Typically, embedded operating systems need to call different lifecycle definitions of the application as needed.
[0003] For applications developed in different programming languages, the way the operating system invokes them at different stages of the application's lifecycle varies greatly. For example, in a C application on a personal computer, when a function callback method is registered, the address of the callback function is recorded in memory. When the system makes a call, it directly calls the callback function at that address through the function pointer. This method consumes a lot of memory. On devices with severely limited memory resources, this callback method can lead to insufficient device memory resources, seriously affecting the performance of resource-constrained devices. Summary of the Invention
[0004] This invention provides a method, apparatus, device, and terminal for calling application lifecycle callback functions to solve the problem of insufficient resources that may occur when calling callback functions in resource-constrained devices.
[0005] According to one aspect of the present invention, an application lifecycle callback function invocation method is provided, the method comprising:
[0006] When a lifecycle trigger event of a target application is detected in an embedded operating system, the callback function call identifier corresponding to the lifecycle trigger event is determined.
[0007] Based on the callback function tag in the callback function table of the application registry of the target application, obtain the callback function index corresponding to the callback function call identifier from the callback function table;
[0008] The callback function is invoked based on the callback function index, which is the callback function corresponding to the lifecycle trigger event.
[0009] According to another aspect of the present invention, an application lifecycle callback function invocation apparatus is provided, the apparatus comprising:
[0010] The determination module is used to determine the callback function call identifier corresponding to the lifecycle triggering event when the lifecycle triggering event of the target application is detected in the embedded operating system;
[0011] The acquisition module is used to obtain the callback function index corresponding to the callback function call identifier from the callback function table in the application registry of the target application based on the callback function tag.
[0012] The calling module is used to call the callback function corresponding to the lifecycle triggering event based on the callback function index.
[0013] According to another aspect of the present invention, a restricted device is provided, wherein an embedded operating system is installed on the restricted device, and a runtime environment is executed in the embedded operating system, the restricted device comprising:
[0014] At least one processor; and
[0015] A memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to execute the application lifecycle callback function invocation method according to any embodiment of the present invention.
[0017] According to another aspect of the present invention, a terminal is provided, including the restricted device.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the application lifecycle callback function invocation method described in any embodiment of the present invention.
[0019] According to another aspect of the present invention, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, implements the application lifecycle callback function invocation method described in any embodiment of the present invention.
[0020] The technical solution of this invention, when a lifecycle trigger event of a target application is detected in an embedded operating system, determines the callback function call identifier corresponding to the lifecycle trigger event; based on the callback function tag in the callback function table in the application registry of the target application, obtains the callback function index corresponding to the callback function call identifier from the callback function table; and calls the callback function corresponding to the lifecycle trigger event based on the callback function index. Based on this, the invention achieves callback of the corresponding callback function by setting a callback function table in the application registry and determining the callback function index based on the callback function tag in the callback function table, without needing to record the address of the callback function in memory. This solves the memory usage problem during callback function calls and addresses the potential resource shortage problem when calling callback functions in resource-constrained devices.
[0021] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 A flowchart of an application lifecycle callback function invocation method is provided for Embodiment 1 of the present invention;
[0024] Figure 2 A schematic diagram of the byte structure of a callback function marker provided in Embodiment 1 of this application;
[0025] Figure 3 A schematic diagram of the structure of byte bits in a callback function marker provided in Embodiment 1 of this application;
[0026] Figure 4 A schematic diagram of the index relationship of the callback function table provided in Embodiment 1 of this application;
[0027] Figure 5 This is a schematic diagram of the structure of an application lifecycle callback function invocation device provided in Embodiment 2 of the present invention;
[0028] Figure 6 This is a schematic diagram of the structure of the restricted device provided in Embodiment 3 of the present invention. Detailed Implementation
[0029] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0031] Example 1
[0032] Figure 1 This invention provides a flowchart of an application lifecycle callback function invocation method according to Embodiment 1. This embodiment is applicable to embedded systems. For different application scenarios, this method can be executed by an application lifecycle callback function invocation device. This device can be implemented in hardware and / or software and can be configured in resource-constrained embedded devices. Figure 1 As shown, the method includes:
[0033] Step 101: If the lifecycle triggering event of the target application is detected in the embedded operating system, determine the callback function call identifier corresponding to the lifecycle triggering event.
[0034] In this step, the target application refers to any application that is not installed on the embedded operating system or has been installed on the embedded operating system. The lifecycle triggering event monitored in this step can be any of the following events:
[0035] Successfully selected target application, deactivated target application from the current runtime environment, obtained APDU command of target application from communication interface, deleted target application from system registry, successfully selected target application when multiple selection is supported, deselected target application when multiple selection is supported, request authorization when target application is server application, received personalized data of target application, received personalized data of target application and need to return expected data.
[0036] Correspondingly, the lifecycle behaviors may include: application installation, application selection, application deselection, application command processing, application uninstallation, server authorization check, personalized data reception, and personalized data reception feedback.
[0037] Among them, the lifecycle behavior of application selection may involve the following triggering events: successful selection of target application, and successful selection of target application when multiple selection is supported.
[0038] The events that may trigger the deselection of an application include: deactivating the target application from the current runtime environment, and deselecting the target application if it supports multiple selections.
[0039] The triggering events that may be involved in application command processing can be obtaining APDU commands from the target application through the communication interface.
[0040] Application uninstallation may involve events that trigger the removal of the target application from the system registry.
[0041] The server-side authorization check may be triggered by events that require authorization when the target application is a server application.
[0042] The triggering events that may be involved in receiving personalized data can be the receipt of personalized data from the target application.
[0043] The triggering events that may be involved in receiving personalized data feedback can be the receipt of personalized data from the target application and the need to return the expected data.
[0044] Furthermore, the lifecycle of a target application typically begins with the application installation command, the registration interface, and application registration, and ends with the call to the application uninstallation interface and the deletion of the application. In this embodiment, to manage the application lifecycle, the application can implement an application interface to call back function prototypes. Each of the aforementioned lifecycle triggering events corresponds to a callback function, and the prototypes of these callback functions will be described in detail in subsequent embodiments, and will not be repeated here.
[0045] It should be noted that the callback function call identifier is used to uniquely identify the callback function. It can usually be the name of the callback function. Each callback function corresponding to the above-mentioned triggering event should have a unique identifier for use when calling it.
[0046] In addition, before this step, for system security, it can be determined whether the current running environment is a system running environment. Specifically, when it is detected that the embedded operating system is executing any virtual machine bytecode function call operation, it is determined whether the function to be called by the current virtual machine bytecode function call operation is a pre-agreed callback function; if so, it is determined whether the current running environment is a system running environment; if it is a system running environment, it is determined whether the target application's lifecycle trigger event has been detected; if it is not a system running environment, the call to the required function is stopped.
[0047] This process ensures that callback functions can only be legally called by the system, and should not be called by the application itself or by other applications through shared methods, thereby improving the security of the code's runtime environment.
[0048] Step 102: Based on the callback function tag in the callback function table of the target application's application registry, obtain the callback function index corresponding to the callback function call identifier from the callback function table.
[0049] In this step, the callback function table is set in the application registry. The creation of this callback function table can be completed during the installation of the target application. Specifically, when the target application is installed in the embedded system, a callback function tag is created in the callback function table based on the callback function registration parameters of the target function; the callback function table is created based on the callback function tag and the callback function registration parameters, and the callback function table is added to the application registry of the target application.
[0050] The callback function registration parameters are mainly the parameters carried in the installation package of the target application. Unlike other application registration processes, in this embodiment, the callback function registration parameters involved in the registration process include not only the common parameters required for application registration, but also the callback function registration identifier and the callback function index corresponding to the callback function registration identifier.
[0051] It should be noted that the callback function registration identifier can also be a function name, which can be the same as or different from the aforementioned callback function call identifier. However, if there is a difference, the mapping relationship between the callback function registration identifier and the callback function call identifier needs to be indicated so that the callback function can be successfully registered during the application installation process.
[0052] In addition, the callback function index is mainly used to index the corresponding callback function when a callback occurs later, thereby managing the lifecycle of the application.
[0053] In this embodiment, the callback function flag is used to indicate the callback functions involved in the installed application. Specifically, the presence or absence of the callback function corresponding to each bit can be indicated by the setting of each bit in the callback function flag.
[0054] That is, each bit in the callback function marker corresponds to a callback function. For any bit, if the callback function corresponding to that bit exists in the application, then that bit is the first target value.
[0055] Specifically, a callback function marker can be created first; then the callback function registration identifier can be extracted from the callback function registration parameters, and the corresponding callback function can be determined based on the callback function registration identifier. If so, the target position of the callback function marker is set as the first target value, and the target position is the byte position in the callback function marker that is pre-determined for the callback function corresponding to the callback function registration identifier.
[0056] Since the callback function registration identifier is usually a function name, and the callback functions pre-defined in the system usually also have a function name, for any extracted callback function registration identifier, it can be determined whether the callback function registration identifier exists in the function names of a series of pre-defined callback functions. If it exists, the callback function corresponding to the callback function registration identifier is determined to be a pre-defined callback function.
[0057] The correspondence between each bit in the callback function tag and the callback function can be pre-defined, or it can be mapped to the bit by the function name. For example, function name A corresponds to the first bit in the callback function tag, function name B corresponds to the second bit in the callback function tag, and so on.
[0058] In a specific example, the callback function flag can consist of 4 bytes; see the documentation for details. Figure 2 , Figure 2 This is a schematic diagram of the byte structure of a callback function marker provided in Embodiment 1 of this application.
[0059] like Figure 2 As shown, the callback function marker consists of four bytes: byte 1, byte 2, byte 3, and byte 4.
[0060] Each byte contains 8 bits; see details below. Figure 3 , Figure 3 This is a schematic diagram of the byte structure in a callback function marker provided in Embodiment 1 of this application. This embodiment involves nine callback functions: a selection callback function, a deselection callback function, an application processing callback function, an application uninstallation callback function, a multi-selection callback function, a multi-selection deselection callback function, a server-side authorization check callback function, a personalized callback function, and a personalized extended callback function, corresponding sequentially to… Figure 3 The bytes are b1 of byte 1, b2 of byte 1, b3 of byte 1, b4 of byte 1, b5 of byte 1, b6 of byte 1, b7 of byte 1, b8 of byte 1, and b1 of byte 2.
[0061] In this embodiment, the bit corresponding to the extracted callback function, i.e. the target position, is set to the first target value, which can be "1". The bits corresponding to other callback functions that are not involved can be set to the second target value "0".
[0062] in addition, Figure 3 The other bits of these four bytes shown can all be set to the second target value "0", which can be called reserved values. These bits are reserved bits and can be used for further development of callback functions or other functions.
[0063] It should be noted that, Figure 3 The structures of bytes 3 and 4 are not shown, but each of them contains 8 bits, and each bit is a reserved bit.
[0064] Additionally, if the callback function corresponding to the extracted callback function registration identifier is not a pre-defined callback function, the installation of the target application should be stopped directly and an error should be reported.
[0065] After this process, the callback function registration can be considered complete. To ensure the application can run normally, a minimum set check of callback functions is performed based on the callback function table after the callback function registration is complete. If the check passes, the steps of creating a callback function table based on the callback function flag and callback function registration parameters are executed, and the callback function table is added to the application registry of the target application. If the check fails, the installation of the target application is stopped and an error is reported.
[0066] The callback function minimum set check includes a minimum set definition check and a minimum set conformance check. Therefore, when performing the callback function minimum set check based on the callback function table, a minimum set definition check is performed first to obtain the first check result; then a minimum set conformance check is performed to obtain the second check result. If both the first and second check results pass, the callback function minimum set check passes; otherwise, it fails.
[0067] Specifically, the callback function minimum set check based on the callback function table is mainly based on the check of the callback function tags in the callback function table. Since the callback function tags record all the callback functions involved in the target application, the callback function minimum set check can be completed based on this information.
[0068] During the minimum set definition check, it can be determined whether there are all callback functions in any preset minimum callback function set in the callback function table; if they exist, the first check result is determined to be passed; otherwise, the first check result is determined to be failed.
[0069] The preset minimum callback function set includes a first minimum callback function set and a second minimum callback function set; the first minimum callback function set includes a selection callback function, a deselection callback function, and an application processing callback function; the second minimum callback function set includes a multi-selection callback function, a multi-selection deselection callback function, and an application processing callback function.
[0070] Specifically, in this embodiment, the callback functions involved in the target application can be determined based on the callback function markers in the callback function table of the target application. Specifically, all bits set to the first target value can be determined first, and then the callback functions corresponding to the bits of the first target value can be determined based on the mapping relationship between the bits and the callback functions, which are the callback functions involved in the target application.
[0071] Then determine whether the callback function involved contains the first minimum callback function set or the second minimum callback function set. If it contains one of them, then the first check result is determined to be passed.
[0072] The minimum set compliance check checks whether the registered minimum callback function set of applications in the same module as the target application is consistent with that of the target application. Specifically, it retrieves the registered minimum callback function set of registered applications in the same module as the target application; then it determines whether the registered minimum callback function set is the same as the minimum function set contained in the callback function table; if they are the same, the second check is considered passed; otherwise, the second check is considered failed.
[0073] It should be noted that in this embodiment, it is sufficient to find a set of registered minimum callback functions that is in the same module as the target application. This set of registered minimum callback functions refers to the set of minimum callback functions of the registered application.
[0074] In addition, in order to improve the efficiency of minimum set compliance check, this embodiment can first determine whether there is an installed application in the same module as the target application among the applications currently active in the working logical channel.
[0075] If it exists, obtain the minimum set of registered callback functions for the installed application and determine whether the minimum set of registered callback functions is the same as the minimum set of functions contained in the callback function table; if they are the same, determine that the second check result is passed; otherwise, determine that the second check result is failed.
[0076] If there is no installed application in the same module as the target application among the applications currently active in the working logical channel, then execute the step of obtaining the minimum set of registered callback functions of the registered applications in the same module as the target application.
[0077] After the above process, a callback function table can be created. Specifically, the number of bytes in the callback function table whose callback function flag is set to the first target value is obtained, and storage space is allocated for the callback function table based on the number of bytes. Based on the callback function index, callback function flag, and the order of bytes in the callback function flag set to the first target value extracted from the callback function registration parameters, the callback function table is created in the storage space. The index address of the callback function table is stored in the application registry of the target application.
[0078] The method of obtaining the number of bytes in the callback function table that are set to the first target value is mainly to obtain the number of callback functions involved in the target application. In this embodiment, storage space is only allocated for the callback functions involved. Compared with the existing method that requires allocating space for all pre-agreed callback functions, the method of this embodiment is more space-saving.
[0079] In a specific example, since the callback function table includes callback function tags and the aforementioned number of callback functions (e.g., n) entries, the allocated storage space should be able to accommodate both sets of content. The callback function tag is 4 bytes with a fixed size, and each callback function occupies 2 bytes. Therefore, the total size of the allocated storage space is 4 + 2n.
[0080] In addition, this embodiment can establish corresponding table entries according to the order of the bits set to the first target value in the callback function flag. Each table entry corresponds to the callback function index of the corresponding callback function, thereby storing the callback function index in the target table position of the corresponding table entry in the callback function table to obtain the callback function table.
[0081] When storing the index address of the callback function table in the storage space into the application registry, you can first determine whether the target application has already created the callback function table registry entry; if it has been created, store the index address of the callback function table into the callback function table registry entry; if it has not been created, store the index address of the callback function table into the temporary data storage space.
[0082] After the registry information in the target application is added, check if the temporary data storage space contains the index address of the callback function table; if it does, add the index address of the callback function table to the callback function table registry key in the target application.
[0083] It should be noted that the index of the callback function table can be used to access the aforementioned storage space, thus locating the callback function table. Furthermore, since the application installation process varies from application to application—for example, some applications add a callback function table registry entry from the beginning, while others do not—for applications that haven't added a callback function registry entry, the index address can be stored in a temporary data storage space. Then, after the target application's registry information is added, the index address of the callback function table from the temporary data storage space can be added to the callback function table registry entry.
[0084] It should be noted that the application registry and the callback function table pointed to by the application registry are both stored in non-volatile storage to facilitate access to the application registry and the callback function table from non-volatile storage.
[0085] Based on the above process of creating the callback function table, the callback functions for the target application have been registered. For details, please refer to [link / reference needed]. Figure 4 , Figure 4 This is a schematic diagram of the index relationship of the callback function table provided in Embodiment 1 of this application.
[0086] like Figure 4 As shown, in the registry structure of Application 1, there is a registry entry for callback functions. This callback function registry entry stores an index to the callback function table, allowing the callback function table to be accessed from the storage space. Figure 4 The callback function table shown stores callback function tags and indices of the callback functions involved in application 1. In this example, application 1 involves all the pre-agreed callback functions mentioned in this embodiment.
[0087] Based on this indexing relationship, this step can index the corresponding callback function table from the registry of the target application. Then, based on the mapping relationship between the callback function and the bits in the callback function tag, the bit corresponding to the callback function call identifier is determined, along with the order of all bits set to the first target value in the callback function tag. This allows us to find the entry in the callback function table that corresponds to this order. The callback function index stored in this entry is the index of the callback function corresponding to the aforementioned callback function call identifier.
[0088] Step 103: Call the callback function corresponding to the lifecycle trigger event based on the callback function index.
[0089] In this step, after obtaining the index of the callback function, the callback function can be called based on that index.
[0090] In addition, in this embodiment, for the selection callback function, for any logical channel, the selection callback function of any application is called to determine that application is the active application on the logical channel. Before this, the applications already active in any logical channel need to be deselected.
[0091] In addition to the explicitly selected applications mentioned above, this embodiment may also include implicitly selected applications. Specifically, if any application uses a target instruction to open any logical channel, the application is determined to be the implicitly selected application of the logical channel. It should be noted that the target instruction can be any pre-defined instruction among the instructions capable of opening logical channels.
[0092] When the embedded operating system receives a command to enable any logical channel, it determines whether there is an implicitly selected application in the logical channel; if so, it identifies the implicitly selected application as the active application on the logical channel.
[0093] In this embodiment, when a lifecycle trigger event of the target application is detected in the embedded operating system, the callback function call identifier corresponding to the lifecycle trigger event is determined. Based on the callback function tag in the callback function table of the target application's application registry, the callback function index corresponding to the callback function call identifier is obtained from the callback function table. The callback function corresponding to the lifecycle trigger event is called based on the callback function index. Based on this, the present invention achieves the callback of the corresponding callback function by setting a callback function table in the application registry and determining the callback function index based on the callback function tag in the callback function table. This eliminates the need to record the address of the callback function in memory, solving the memory usage problem during the callback function call process and resolving the potential resource shortage problem when calling callback functions in resource-constrained devices.
[0094] Example 2
[0095] Figure 5 This is a schematic diagram of an application lifecycle callback function invocation device provided in Embodiment 2 of the present invention. Figure 4 As shown, the device includes:
[0096] The determination module 501 is used to determine the callback function call identifier corresponding to the lifecycle trigger event when the lifecycle trigger event of the target application is detected in the embedded operating system;
[0097] The acquisition module 502 is used to obtain the callback function index corresponding to the callback function call identifier from the callback function table in the application registry of the target application based on the callback function tag;
[0098] Call module 503 to invoke the callback function corresponding to the lifecycle trigger event based on the callback function index.
[0099] The application lifecycle callback function invocation device provided in this embodiment of the invention can execute the application lifecycle callback function invocation method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0100] Example 3
[0101] Figure 6 This is a schematic diagram of a limited device provided for Embodiment 3 of the present invention. The limited device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. An embedded operating system is installed on the limited device, in which a runtime environment is executed. The limited device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0102] like Figure 6 As shown, the restricted device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the restricted device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0103] Multiple components in the restricted device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, optical disk, etc.; and a communication unit 19, such as a network card, modem, wireless transceiver, etc. The communication unit 19 allows the restricted device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0104] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 executes the various methods and processes described above, such as application lifecycle callback function invocation methods.
[0105] In some embodiments, the application lifecycle callback function invocation method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the restricted device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the application lifecycle callback function invocation method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the application lifecycle callback function invocation method by any other suitable means (e.g., by means of firmware).
[0106] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0107] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0108] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0109] To provide interaction with a user, the systems and techniques described herein can be implemented on a restricted device having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the restricted device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0110] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0111] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0112] Example 4
[0113] This embodiment provides a terminal, including the restricted device provided in the aforementioned embodiment three.
[0114] Example 5
[0115] This embodiment provides a computer-readable storage medium storing computer instructions, which are used to cause a processor to execute and implement the application lifecycle callback function invocation method provided in any embodiment of this application.
[0116] Example 6
[0117] This embodiment provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the application lifecycle callback function invocation method provided in any embodiment of this application.
[0118] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0119] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for invoking an application lifecycle callback function, characterized in that, The method includes: If a lifecycle trigger event of a target application is detected in the embedded operating system, the callback function call identifier corresponding to the lifecycle trigger event is determined; the target application is any application that is not installed on the embedded operating system or has been installed on the embedded operating system. Based on the callback function markers in the callback function table of the target application's application registry, the callback function index corresponding to the callback function call identifier is obtained from the callback function table. The callback function table is created when the target application is installed, specifically including: when the target application is installed in the embedded operating system, creating callback function markers in the callback function table based on the callback function registration parameters of the target application; creating a callback function table based on the callback function markers and the callback function registration parameters, and adding the callback function table to the application registry of the target application; the callback function markers are used to indicate the callback functions involved in the installed application, and each bit in the callback function marker corresponds to a callback function, so that the existence of the callback function corresponding to each bit is indicated by the setting of each bit in the callback function marker; the callback function registration parameters include the callback function index corresponding to the callback function call identifier. The callback function is invoked based on the callback function index, which is the callback function corresponding to the lifecycle trigger event.
2. The method according to claim 1, characterized in that, The method further includes: Once the callback function registration is complete, a minimum set check of callback functions is performed based on the callback function table; If the check result is passed, the steps of creating a callback function table based on the callback function flag and the callback function registration parameters, and adding the callback function table to the application registry of the target application are executed. If the check fails, stop the installation of the target application and report an error.
3. The method according to claim 2, characterized in that, The minimum set check of the callback function includes a minimum set definition check and a minimum set conformity check; The check for the minimum set of callback functions based on the callback function table includes: A minimum set definition check is performed based on the callback function table to obtain the first check result; Based on the callback function table, a minimum set compliance check is performed to obtain the second check result; If both the first and second checks pass, the callback function's minimum set check passes; otherwise, it fails.
4. The method according to claim 1, characterized in that, The step of creating a callback function table based on the callback function tag and the callback function registration parameters, and adding the callback function table to the application registry of the target application, includes: Obtain the number of bytes in the callback function table where the callback function flag is set to the first target value, and allocate storage space for the callback function table based on the number of bytes. Based on the callback function index extracted from the callback function registration parameters, the callback function flag, and the byte order of the callback function flag set to the first target value, a callback function table is created in the storage space; The index address of the callback function table is stored in the application registry of the target application.
5. The method according to claim 4, characterized in that, The process of creating a callback function table in the storage space based on the callback function index extracted from the callback function registration parameters, the callback function flag, and the byte order of the callback function flag set to the first target value includes: Create a callback function table in the storage space; According to the byte order in the callback function flag that is set to the first target value, the corresponding callback function index is stored in the callback function table; The callback function index is stored in the target table location of the callback function table.
6. The method according to claim 1, characterized in that, The method further includes: When the embedded operating system is detected to be executing any virtual machine bytecode function call, it is determined whether the function to be called by the current virtual machine bytecode function call is a pre-agreed callback function. If so, determine whether the current running environment is the system running environment; If it is a system runtime environment, determine whether the target application's lifecycle trigger event has been detected; if it is not a system runtime environment, stop calling the required function.
7. An application lifecycle callback function invocation device, characterized in that, The device includes: The determination module is used to determine the callback function call identifier corresponding to the lifecycle triggering event when the lifecycle triggering event of the target application is detected in the embedded operating system; The acquisition module is used to obtain the callback function index corresponding to the callback function call identifier from the callback function table in the application registry of the target application based on the callback function tag. The callback function table is created when the target application is installed, specifically including: when the target application is installed in the embedded operating system, creating the callback function tag in the callback function table based on the callback function registration parameters of the target application; creating the callback function table based on the callback function tag and the callback function registration parameters, and adding the callback function table to the application registry of the target application; the callback function tag is used to indicate the callback functions involved in the installed application, and each bit in the callback function tag corresponds to a callback function, so that the existence of the callback function corresponding to each bit is indicated by the setting of each bit in the callback function tag; the callback function registration parameters include the callback function index corresponding to the callback function call identifier. The calling module is used to call the callback function corresponding to the lifecycle triggering event based on the callback function index.
8. A restricted device, characterized in that, The restricted device is equipped with an embedded operating system, which executes a runtime environment. The restricted device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to execute the application lifecycle callback function invocation method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the application lifecycle callback function invocation method as described in any one of claims 1-6.
Citation Information
Patent Citations
Control infrastructure
CN107210931A
MODBUS communication method and device based on data list structural body
CN116366391A