Application life cycle callback function calling method, device, equipment and terminal
By determining callback function identifiers and indices in a callback function table, the method addresses memory consumption issues in resource-constrained devices, enhancing device performance through optimized memory usage.
Patent Information
- Application Number
- CN202411197765.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-08-29
AI Technical Summary
Existing methods for calling application lifecycle callback functions in resource-constrained devices consume excessive memory, leading to insufficient device resources and performance issues.
A method and device that determine a callback function call identifier and index based on a callback function table, allowing the callback function to be called without recording its address in memory, thereby optimizing memory usage.
This approach reduces memory occupation and resource constraints in devices by efficiently managing callback functions, ensuring adequate resource availability.
Smart Images

Figure CN119088481A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of application lifecycle management, and in particular to a method, device, equipment and terminal for calling an application lifecycle callback function. Background Art
[0002] The management of application lifecycle refers to the different stages when external entities interact with on-chip applications. Usually, in embedded operating systems, different lifecycles defined by applications need to be called as needed.
[0003] For applications developed in different programming languages, there are huge differences in the way the operating system calls the different life cycles of the application. For example, when an application developed in C language on a personal computer registers a function callback method, the address of the callback function will be recorded in the memory. When the system calls, the callback function at the address is directly called through the function pointer. This method consumes a lot of memory. In devices with severely limited memory resources, this callback method will cause insufficient device memory resources, seriously affecting the performance of resource-constrained devices. Summary of the invention
[0004] The present invention provides a method, apparatus, device and terminal for calling an application lifecycle callback function, so as to solve the problem of insufficient resources that may be caused when calling a callback function in a resource-constrained device.
[0005] According to one aspect of the present invention, a method for calling an application lifecycle callback function is provided, the method comprising:
[0006] When a life cycle triggering event of a target application is detected in the embedded operating system, a callback function call identifier corresponding to the life cycle triggering event is determined;
[0007] Based on the callback function tag of the callback function table in the application registration table of the target application, obtaining the callback function index corresponding to the callback function call identifier from the callback function table;
[0008] The callback function corresponding to the life cycle triggering event is called based on the callback function index.
[0009] According to another aspect of the present invention, a device for calling an application lifecycle callback function is provided, the device comprising:
[0010] A determination module, configured to determine a callback function call identifier corresponding to a life cycle triggering event of a target application when the life cycle triggering event is detected in the embedded operating system;
[0011] An acquisition module, configured to acquire a callback function index corresponding to the callback function call identifier from the callback function table based on a callback function tag in the callback function table in the application registration table of the target application;
[0012] A calling module is used to call the callback function corresponding to the life cycle 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, a runtime environment is executed in the embedded operating system, and the restricted device comprises:
[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 executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the application lifecycle callback function calling method described in any embodiment of the present invention.
[0017] According to another aspect of the present invention, a terminal is provided, comprising the restricted device.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the application lifecycle callback function calling method described in any embodiment of the present invention when executed.
[0019] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the application lifecycle callback function calling method described in any embodiment of the present invention is implemented.
[0020] The technical solution of the embodiment of the present invention is to determine the callback function call identifier corresponding to the life cycle trigger event when the life cycle trigger event of the target application is monitored in the embedded operating system; obtain the callback function index corresponding to the callback function call identifier from the callback function table based on the callback function mark of the callback function table in the application registration table of the target application; and call the callback function corresponding to the life cycle trigger event based on the callback function index. Based on this, the present invention sets a callback function table in the application registration table, and determines the callback function index based on the callback function mark in the callback function table, thereby realizing the callback of the corresponding callback function, without recording the address of the callback function in the memory, solving the problem of memory occupation in the callback function calling process, and solving the problem of insufficient resources that may be caused when calling the callback function in resource-constrained devices.
[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 A flowchart of a method for calling an application lifecycle callback function is provided for the first embodiment of the present invention;
[0024] Figure 2 A schematic diagram of a byte structure of a callback function mark provided in Example 1 of the present application;
[0025] Figure 3 A schematic diagram of the structure of bytes in a callback function tag provided in Example 1 of the present application;
[0026] Figure 4 A schematic diagram of the index relationship of the callback function table provided in Example 1 of the present application;
[0027] Figure 5 A schematic diagram of the structure of an application life cycle callback function calling device provided in Embodiment 2 of the present invention;
[0028] Figure 6 This is a schematic diagram of the structure of a restricted device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work 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 and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] Embodiment 1
[0032] Figure 1 A flowchart of a method for calling an application lifecycle callback function is provided for the first embodiment of the present invention. This embodiment can be applied to embedded systems. For application situations, the method can be executed by an application lifecycle callback function calling device. The application lifecycle callback function calling device can be implemented in the form of hardware and / or software. The application lifecycle callback function calling device can be configured in an embedded device with limited resources. Figure 1 As shown, the method includes:
[0033] Step 101: When a lifecycle triggering event of a target application is detected in an embedded operating system, a callback function call identifier corresponding to the lifecycle triggering event is determined.
[0034] In this step, the target application refers to any application that is not installed in the embedded operating system or has been installed in the embedded operating system. The life cycle trigger event monitored in this step can be any of the following events:
[0035] The target application is selected successfully, the target application is deactivated from the current running environment, the APDU command of the target application is obtained from the communication interface, the target application is deleted from the system registry, the target application is selected successfully when it supports multiple selections, the target application is deselected when it supports multiple selections, authorization is applied when the target application is a server application, the personalized data of the target application is received, and the personalized data of the target application is received and the expected data needs to be returned.
[0036] Correspondingly, the life cycle behavior 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 application selection life cycle behavior may involve the following triggering events: successful selection of the target application, and successful selection of the target application when it supports multiple selections.
[0038] The triggering events that may be involved in application deselection include: deactivating the target application from the current running environment, and deselecting the target application when it supports multiple selections.
[0039] The triggering event that may be involved in the application command processing may be obtaining an APDU command of the target application from the communication interface.
[0040] The triggering event that may be involved in application uninstallation may be deleting the target application from the system registry.
[0041] The triggering event that may be involved in the server-side authorization check may be applying for authorization when the target application is a server-side application.
[0042] The triggering event that may be involved in the reception of personalized data may be the reception of the target application personalized data.
[0043] The triggering event that may be involved in the personalized data reception feedback may be receiving the personalized data of the target application and returning the expected data.
[0044] In addition, the life cycle of the target application usually starts with the application installation command, the registration interface and the registration application, and ends with the call of the application uninstallation interface and the deletion of the application. In this embodiment, in order to manage the application life cycle, the application can implement the application interface to call back the function prototype, wherein each of the aforementioned life cycle triggering events corresponds to a callback function, and the prototype of the callback function will be specifically introduced in the 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, and can usually be the name of the callback function. Each callback function corresponding to the above triggering event should have a unique identifier for use when calling.
[0046] In addition, before this step, for the sake of system security, it can be determined whether the current operating environment is a system operating environment. Specifically, when the embedded operating system is monitored to execute any virtual machine bytecode function call operation, it is determined whether the function required 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 operating environment is a system operating environment; if it is a system operating environment, it is determined whether a life cycle trigger event of the target application is monitored; if it is a non-system operating environment, the call to the function to be called is stopped.
[0047] This process ensures that the callback function can only be called legally 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 operating environment.
[0048] Step 102: Based on the callback function tag of the callback function table in the application registration table of the target application, 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 the callback function table can be completed when the target application is installed. Specifically, when the target application is installed in the embedded system, the callback function tag in the callback function table is created 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] Among them, the callback function registration parameters are mainly the parameters carried in the installation package of the target application. Different from 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 consistent with the aforementioned callback function call identifier, or different from the aforementioned callback function call identifier. However, if there is a difference, it is necessary to indicate the mapping relationship between the callback function registration identifier and the callback function call identifier to facilitate the successful registration of the callback function during the application installation process.
[0052] In addition, the callback function index is mainly used for later callbacks to index the corresponding callback function and implement the life cycle management of the application.
[0053] In this embodiment, the callback function mark is used to indicate the callback function involved in the installed application. Specifically, the setting of each bit in the callback function mark can be used to indicate whether the callback function corresponding to each bit exists.
[0054] That is, each bit in the callback function tag corresponds to a callback function, and for any bit, if the callback function corresponding to the bit exists in the application, the bit is set as the first target value.
[0055] Specifically, a callback function tag can be created first; then the callback function registration identifier can be extracted from the callback function registration parameters, and based on the callback function registration identifier, it can be determined whether the corresponding callback function is a pre-agreed callback function; if so, the target position of the callback function tag is set to the first target value, and the target position is the byte position in the callback function tag that is pre-determined to be the corresponding callback function setting for the callback function registration identifier.
[0056] Among them, since the callback function registration identifier is usually a function name, and the callback function pre-agreed in the system usually also has a function name, therefore, 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-agreed callback functions. If so, it is determined that the callback function corresponding to the callback function registration identifier is the pre-agreed callback function.
[0057] The correspondence between each bit in the callback function tag and the callback function can be pre-set, and can also be corresponded to the bits through 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 tag can consist of 4 bytes. For details, please refer to Figure 2 , Figure 2 A schematic diagram of the byte structure of a callback function mark provided in Example 1 of the present application.
[0059] like Figure 2 As shown, 4 bytes are arranged in the callback function tag: byte 1, byte 2, byte 3, and byte 4.
[0060] Each byte contains 8 bits. Figure 3 , Figure 3 A structural diagram of bytes in a callback function tag provided in Example 1 of the present application. This embodiment involves 9 callback functions, namely, selection callback function, deselection callback function, application processing callback function, application uninstallation callback function, multiple selection callback function, multiple selection deselection callback function, server authorization check callback function, personalization callback function, and personalization extension callback function, corresponding to Figure 3 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, that is, the target position, can be set to the first target value, which can be "1", and the bits corresponding to other callback functions not involved can be set to the second target value "0".
[0062] in addition, Figure 3 The other bits of the 4 bytes shown can all be set to the second target value "0", which can be called reserved values. These bits are reserved bits for use in the subsequent further development of callback functions or other functions.
[0063] It should be noted that Figure 3 The structures of Byte 3 and Byte 4 are not shown, and they also each contain 8 bits, each of which is a reserved bit.
[0064] In addition, if the callback function corresponding to the extracted callback function registration identifier is not a pre-determined callback function, the installation of the target application is directly stopped and an error is reported.
[0065] After this process, it can be determined that the callback function registration is complete. In order to ensure the normal operation of the application, when the callback function registration is completed, a minimum set of callback functions is checked based on the callback function table; if the check result is passed, 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; if the check result is failed, the installation of the target application is stopped and an error is reported.
[0066] Among them, the callback function minimum set check includes the minimum set definition check and the minimum set compliance check. Then, when performing the callback function minimum set check based on the callback function table, the minimum set definition check can be performed based on the callback function table to obtain the first check result; the minimum set compliance check can be performed based on the callback function table to obtain the second check result; if both the first check result and the second check result are passed, the callback function minimum set check is passed, otherwise it is not passed.
[0067] Specifically, the callback function minimum set check based on the callback function table is mainly based on the callback function tag in the callback function table. Since the callback function tag records all callback functions involved in the target application, the callback function minimum set check can be completed based on this information.
[0068] When performing the minimum set definition check, it can be determined whether all callback functions in any preset minimum callback function set exist in the callback function table; if so, 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 multiple selection callback function, a multiple selection deselection callback function, and an application processing callback function.
[0070] Specifically, this embodiment can determine the callback function involved in the target application based on the callback function mark in the callback function table of the target application. Specifically, all bits set to the first target value can be determined first, and then based on the mapping relationship between the bit and the callback function, the callback function corresponding to the bit of the first target value can be determined, that is, the callback function involved in the target application.
[0071] Then, it is determined whether the callback function involved includes the first minimum callback function set or the second minimum callback function set. If one of them is included, it is determined that the first check result is passed.
[0072] As for the minimum set conformance check, it is to check whether the registered minimum callback function set in the same module as the target application is consistent with the target application. Specifically, the registered minimum callback function set of the registered application in the same module as the target application can be obtained; then it is determined whether the registered minimum callback function set is the same as the minimum function set included in the callback function table; if they are the same, the second check result is determined to be passed, otherwise, the second check result is determined to be failed.
[0073] It should be noted that, in this embodiment, it is sufficient to find a registered minimum callback function set in the same module as the target application, and the registered minimum callback function set refers to the minimum callback function set of the registered application.
[0074] In addition, in order to improve the efficiency of the minimum set compliance check, this embodiment may first determine whether there is an installed application in the same module as the target application among the applications activated in the logical channel currently in the working state;
[0075] If it exists, obtain the registered minimum callback function set of the installed application, and determine whether the registered minimum callback function set is the same as the minimum function set included 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 activated in the currently working logical channel, the step of obtaining the registered minimum callback function set of the registered applications in the same module as the target application is performed.
[0077] After the above process, a callback function table can be created. Specifically, the number of byte bits in the callback function table in which the callback function tag is set to the first target value is obtained, and storage space is allocated for the callback function table based on the number of byte bits; based on the callback function index extracted from the callback function registration parameters, the callback function tag, and the byte bit sequence set to the first target value in the callback function tag, a callback function table is created in the storage space; and the index address of the callback function table is stored in the application registration table of the target application.
[0078] Among them, obtaining the number of bytes in the callback function table whose callback function mark is set to the first target value is mainly for obtaining the number of callback functions involved in the target application. This embodiment only allocates storage space for the callback functions involved. Compared with the existing need to allocate space for all pre-agreed callback functions, the method of this embodiment saves more space.
[0079] In a specific example, since the callback function table includes the callback function tag and the number of the aforementioned callback functions (for example, n), the storage space opened should be able to meet the storage of these two groups of contents. The callback function tag is 4 bytes and has a fixed size. Each callback function occupies 2 bytes, so the total size of the storage space opened is 4+2n.
[0080] In addition, this embodiment can establish corresponding table entries in the order of the bits set to the first target value in the callback function tag, each table entry corresponds to the callback function index of the corresponding callback function, and the callback function index is stored 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 in the application registry, you can first determine whether the target application has created the callback function table registry entry; if it has been created, store the index address of the callback function table in the callback function table registry entry; if it has not been created, store the index address of the callback function table in the temporary data storage space.
[0082] After the registry information in the target application is added, check whether the index address of the callback function table exists in the temporary data storage space; if it exists, add the index address of the callback function table to the callback function table registry item in the target application.
[0083] It should be noted that the index of the callback function table can be indexed to the storage space opened up above, so as to find the callback function table. In addition, since the application installation process varies depending on the application, for example, some applications add the callback function table registry entry in the registry from the beginning, while some do not have this process. Therefore, for applications that do not add the callback function registry entry, the index address can be stored in the temporary data storage space, so that after the registry information of the target application is added, the index address of the callback function table in 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 the non-volatile storage, so that the application registry and the callback function table can be accessed from the non-volatile storage.
[0085] Based on the creation process of the callback function table above, the callback function of the target application has been registered. For details, please refer to Figure 4 , Figure 4 A schematic diagram of the index relationship of the callback function table provided in Example 1 of the present application.
[0086] like Figure 4 As shown, in the registry structure of application 1, there is a registry entry of the callback function, and the index of the callback function table is stored in the callback function registry entry, so that the callback function table can be indexed from the storage space. Figure 4 The callback function table shown stores callback function tags and indexes of callback functions involved in the application 1. The application 1 example involves all pre-agreed callback functions mentioned in this embodiment.
[0087] Based on the index relationship, in this step, the corresponding callback function table can be indexed from the registry of the target application, and then based on the mapping relationship between the callback function and the bit in the callback function tag, the bit corresponding to the callback function call identifier is determined, and the order of all bits set to the first target value in the callback function tag is determined, and then the table entry corresponding to the order in the callback function table is found. The callback function index stored in the table 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 triggering 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 the index.
[0090] In addition, in this embodiment, for the selection callback function, for any logical channel, by calling the selection callback function of any application, any application is determined as an activated application on the logical channel. Prior to this, the activated application in any logical channel needs to be deselected.
[0091] In addition to the above explicitly selected applications, there may also be implicitly selected applications in this embodiment. Specifically, if any application uses a target instruction to open any logical channel, the application is determined to be an implicitly selected application of the logical channel. It should be noted that the target instruction can be any pre-set instruction among the instructions that can open the logical channel.
[0092] If the embedded operating system receives a command to open any logical channel, it determines whether there is an implicitly selected application in the logical channel; if so, the implicitly selected application is determined as an activated application on the logical channel.
[0093] In this embodiment, when a life cycle triggering event of a target application is monitored in an embedded operating system, a callback function calling identifier corresponding to the life cycle triggering event is determined; based on the callback function tag of the callback function table in the application registration table of the target application, a callback function index corresponding to the callback function calling identifier is obtained from the callback function table; and the callback function corresponding to the life cycle triggering event is called based on the callback function index. Based on this, the present invention sets a callback function table in the application registration table, and determines the callback function index based on the callback function tag in the callback function table, thereby realizing the callback of the corresponding callback function, without recording the address of the callback function in the memory, thereby solving the problem of memory occupation during the callback function calling process, and solving the problem of insufficient resources that may be caused when calling the callback function in a resource-constrained device.
[0094] Embodiment 2
[0095] Figure 5 This is a schematic diagram of a structure of an application life cycle callback function calling device provided by the second embodiment of the present invention. Figure 4 As shown, the device comprises:
[0096] The determination module 501 is used to determine the callback function call identifier corresponding to the life cycle triggering event when the life cycle triggering event of the target application is detected in the embedded operating system;
[0097] An acquisition module 502 is used to acquire a callback function index corresponding to a callback function call identifier from a callback function table based on a callback function tag in a callback function table in an application registration table of a target application;
[0098] The calling module 503 is used to call the callback function corresponding to the life cycle triggering event based on the callback function index.
[0099] The application lifecycle callback function calling device provided in the embodiment of the present invention can execute the application lifecycle callback function calling method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0100] Embodiment 3
[0101] Figure 6 A schematic diagram of the structure of a restricted device provided for Embodiment 3 of the present invention. The restricted 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 restricted device, and a runtime environment is executed in the embedded operating system. The restricted device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, 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 examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0102] like Figure 6 As shown, the limited device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by the at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the limited device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0103] A number of components in the restricted device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the restricted device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0104] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the application lifecycle callback function call method.
[0105] In some embodiments, the application lifecycle callback function calling method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a 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 the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the application lifecycle callback function calling method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the application lifecycle callback function calling method in any other appropriate manner (e.g., by means of firmware).
[0106] Various implementations 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 chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0107] Computer programs for implementing 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, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0108] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0109] To provide interaction with a user, the systems and techniques described herein may be implemented on a constrained device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the constrained device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0110] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0111] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0112] Embodiment 4
[0113] This embodiment provides a terminal, including the restricted device provided in the aforementioned embodiment three.
[0114] Embodiment 5
[0115] This embodiment provides a computer-readable storage medium, which stores computer instructions. The computer instructions are used to enable a processor to implement the application lifecycle callback function calling method provided by any embodiment of the present application when executed.
[0116] Embodiment 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 calling method provided in any embodiment of the present application.
[0118] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0119] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for calling an application life cycle callback function. It is characterized in that The method comprises: When a life cycle triggering event of a target application is detected in the embedded operating system, a callback function call identifier corresponding to the life cycle triggering event is determined; the target application is any application that is not installed in the embedded operating system or has been installed in the embedded operating system; Based on the callback function tag of the callback function table in the application registration table of the target application, obtaining the callback function index corresponding to the callback function call identifier from the callback function table; The callback function corresponding to the life cycle triggering event is called based on the callback function index.
2. The method according to claim 1, It is characterized in that The method further comprises: When the target application is installed in the embedded system, creating a callback function tag in the callback function table based on the callback function registration parameter of the target function; A callback function table is created based on the callback function tag and the callback function registration parameter, and the callback function table is added to an application registration table of the target application.
3. The method according to claim 2, It is characterized in that The method further comprises: When the callback function registration is completed, performing a callback function minimum set check based on the callback function table; If the check result is passed, executing the steps of creating a callback function table based on the callback function tag and the callback function registration parameter, and adding the callback function table to the application registration table of the target application; If the check result is failure, the installation of the target application is stopped and an error is reported.
4. The method according to claim 3, It is characterized in that The callback function minimum set check includes a minimum set definition check and a minimum set compliance check; The checking of the minimum set of callback functions based on the callback function table includes: Perform a minimum set definition check based on the callback function table to obtain a first check result; Perform a minimum set compliance check based on the callback function table to obtain a second check result; If both the first check result and the second check result are passed, the callback function minimum set check is passed, otherwise it is failed.
5. The method according to claim 2, It is characterized in that The creating a callback function table based on the callback function tag and the callback function registration parameter, and adding the callback function table to the application registration table of the target application, comprises: Acquire the number of bytes in the callback function table where the callback function mark is set to a first target value, and allocate storage space for the callback function table based on the number of bytes; Creating a callback function table in the storage space based on the callback function index extracted from the callback function registration parameter, the callback function tag, and the byte bit sequence set to the first target value in the callback function tag; The index address of the callback function table is stored in the application registration table of the target application.
6. The method according to claim 5, It is characterized in that The step of creating a callback function table in the storage space based on the callback function index extracted from the callback function registration parameter, the callback function tag, and the byte sequence of the callback function tag set to the first target value includes: Creating a callback function table in the storage space; According to the byte order of the first target value in the callback function tag, the corresponding callback function index is stored in the callback function table; The callback function index is stored in a target table location of the callback function table.
7. The method according to claim 1, It is characterized in that The method further comprises: In the case of monitoring that the embedded operating system executes any virtual machine bytecode function call operation, determining whether the function to be called by the current virtual machine bytecode function call operation is a pre-agreed callback function; If so, determine whether the current operating environment is the system operating environment; If it is a system operating environment, it is determined that a life cycle triggering event of the target application is monitored; if it is a non-system operating environment, the calling of the function to be called is stopped.
8. An application life cycle callback function calling device, It is characterized in that The device comprises: A determination module, configured to determine a callback function call identifier corresponding to a life cycle triggering event of a target application when the life cycle triggering event is detected in the embedded operating system; An acquisition module, configured to acquire a callback function index corresponding to the callback function call identifier from the callback function table based on a callback function tag in the callback function table in the application registration table of the target application; A calling module is used to call the callback function corresponding to the life cycle triggering event based on the callback function index.
9. A restricted device, It is characterized in that The restricted device has an embedded operating system installed thereon, a runtime environment is executed in the embedded operating system, and 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 executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the application lifecycle callback function calling method described in any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the application lifecycle callback function calling method according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Control infrastructure
CN107210931A
MODBUS communication method and device based on data list structural body
CN116366391A
Data transfer circuitry, DSP wrapper circuitry and improved processor devices, methods and systems
US6105119A
Cited By
Loadable file creation method, executable module installation method and application operation control method
CN121501362A
Application life cycle callback function calling method, device, equipment and terminal
CN121501378A
Application lifecycle callback function calling method, apparatus, device and terminal
CN121501378B
