WO2020248172A1 - Functional module invoking method, device and computer readable storage medium - Google Patents

Functional module invoking method, device and computer readable storage medium Download PDF

Info

Publication number
WO2020248172A1
WO2020248172A1 PCT/CN2019/090985 CN2019090985W WO2020248172A1 WO 2020248172 A1 WO2020248172 A1 WO 2020248172A1 CN 2019090985 W CN2019090985 W CN 2019090985W WO 2020248172 A1 WO2020248172 A1 WO 2020248172A1
Authority
WO
WIPO (PCT)
Prior art keywords
sdk
event
engine
function module
target
Prior art date
Application number
PCT/CN2019/090985
Other languages
French (fr)
Chinese (zh)
Inventor
李小军
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2019/090985 priority Critical patent/WO2020248172A1/en
Priority to CN201980010025.0A priority patent/CN111684420A/en
Publication of WO2020248172A1 publication Critical patent/WO2020248172A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system

Definitions

  • the present invention relates to the field of software technology, and in particular to a method, equipment, and computer-readable storage medium for calling function modules.
  • cross-platform technology emerged as the times require, and cross-platform software development engines such as Unity are used to implement APP development to achieve cross-platform APP.
  • the functions that can be implemented in the cross-platform software development engine are limited. If you need to expand more functions, you need to call a third-party library or function modules in other libraries to implement it.
  • the cross-platform software development engine needs to configure the interface corresponding to each library, and the cross-platform software development engine directly calls the function module through the interface corresponding to the library where the function module is located. Therefore, in order to be able to call the function modules of various libraries other than the cross-platform software development engine, a large number of interfaces for calling the function modules will be introduced into the engine, which leads to the problem of difficult interface maintenance.
  • the present invention provides a method, equipment and computer-readable storage medium for calling function modules, which can avoid the problem of difficult interface maintenance caused by the introduction of a large number of interfaces for calling function modules in the engine.
  • a method for invoking a function module is provided, which is applied to an electronic device on which a cross-platform software development engine and a software development kit SDK are installed;
  • the method includes:
  • the SDK receives an event transmitted from the engine through a preset event interface, the event is related to the target function module to be called, and the event interface is an interface between the SDK and the engine;
  • the SDK calls the target function module from the function modules integrated by the SDK according to the event.
  • a method for invoking a function module is provided, which is applied to an electronic device on which a cross-platform software development engine and a software development kit SDK are installed;
  • the method includes:
  • the engine When a target function module needs to be called, the engine triggers an event, and the event is related to the target function module;
  • the engine transmits the event to the SDK through a preset event interface.
  • the event interface is an interface between the SDK and the engine, so that the SDK receives the event from the SDK.
  • the target function module is called in the function module integrated by the SDK.
  • an electronic device is provided, and a cross-platform software development engine and a software development kit SDK are installed on the electronic device;
  • the device includes: a memory and a processor
  • the memory is used to store program code
  • the processor is used to call the program code, and when the program code is executed, it is used to perform the following operations:
  • the SDK uses the SDK to receive an event transmitted from the engine through a preset event interface, the event is related to the target function module to be called, and the event interface is an interface between the SDK and the engine;
  • an electronic device is provided, and a cross-platform software development engine and a software development kit SDK are installed on the electronic device;
  • the device includes: a memory and a processor
  • the memory is used to store program code
  • the processor is used to call the program code, and when the program code is executed, it is used to perform the following operations:
  • the event interface is the interface between the SDK and the engine, so that the SDK receives the event from the
  • the target function module is called from the function module integrated by the SDK.
  • a fifth aspect of the embodiments of the present invention provides a computer-readable storage medium, which is characterized in that:
  • the computer-readable storage medium stores computer instructions, and when the computer instructions are executed, the method for invoking the functional modules described in the foregoing embodiments is implemented.
  • the engine can notify the SDK to call the function module through the event mechanism.
  • the engine needs to call the target function module, it can transmit events related to the target function module through the event interface between the engine and the SDK.
  • the SDK calls the target function module from the function module integrated by the SDK according to the event.
  • FIG. 1 is a schematic flowchart of a method for calling a function module according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of interaction between an engine and SDK according to an embodiment of the present invention
  • FIG. 3 is a schematic flowchart of a method for invoking a function module according to another embodiment of the present invention.
  • Fig. 4 is a structural block diagram of an electronic device according to an embodiment of the present invention.
  • first, second, third, etc. may be used in the present invention to describe various information, the information should not be limited to these terms. These terms are used to distinguish the same type of information from each other.
  • first information may also be referred to as second information, and similarly, the second information may also be referred to as first information.
  • word "if” used can be interpreted as "when", or "when”, or "in response to certainty.”
  • the method for invoking functional modules of the embodiment of the present invention can be used in apps that need to be cross-platform.
  • the apps are developed based on a cross-platform software development engine and can be used across platforms. There is no need to develop apps in corresponding platform local languages for different system platforms. It reduces the workload of APP development and also reduces the human resources required for code logic maintenance.
  • the function extension of the cross-platform software development engine can be realized.
  • the corresponding function can be realized by calling the function modules of various libraries outside the engine by the SDK. It is only necessary to configure a unified interface between the engine and the SDK. Configure corresponding interfaces for different libraries in the engine to avoid the problem of difficult interface maintenance caused by the introduction of a large number of interfaces.
  • Cross-platform is an important concept in software development, that is, it does not depend on the operating system or the hardware environment. An APP developed under one operating system can still run under another operating system.
  • the cross-platform in the embodiment of the present invention may be across two system platforms or across more system platforms.
  • the system platform can include popular operating system platforms such as windows, Mac, Android, iOS, Linux, etc., of course, can also include other system platforms, which will not be listed here.
  • the first aspect of the embodiments of the present invention provides a method for invoking a function module, which is applied to an electronic device on which a cross-platform software development engine and a software development kit SDK are installed;
  • the calling method of the function module may include the following steps:
  • the SDK receives an event transmitted from the engine through a preset event interface, the event is related to the target function module to be called, and the event interface is an interface between the SDK and the engine;
  • S200 The SDK calls the target function module from the function modules integrated by the SDK according to the event.
  • the execution subject of the calling method of the function module may be an electronic device, and further may be a processor of the electronic device, where the processor may be one or more, and the processor may be a general-purpose processor. Or a dedicated processor.
  • the specific type of electronic equipment is not limited, such as computer equipment, mobile equipment, etc.
  • a cross-platform software development engine and a software development kit SDK are installed on the electronic device. You can install an APP containing the engine and SDK on the electronic device to implement the installation of the engine and SDK. During the running of the APP, the function module can be called through the cooperation of the engine and the SDK to realize the required functions for the APP.
  • the cross-platform software development engine is a software development platform, and the developed software can be cross-platform.
  • the engines mentioned in the embodiments of the present invention all refer to cross-platform software development engines.
  • Cross-platform software development engines such as Unity, Cocos2d-x, Qt, etc., are not limited.
  • Unity the Unity technology framework has continued to mature. Because it has cross-platform features and uses the easy-to-use C# development language, it has gradually been welcomed by developers, not only in game development, but also in game development. Common application software has also begun to be used gradually.
  • Unity After Unity is completed, it can be compiled into files that support various system platforms.
  • Various file formats are different. For example, the file format that supports iOS is .framework, the file format that supports MacOS X is .bundle, and the file format that supports Windows The format is .dll, and the file format that supports Android is .so, etc.
  • Unity is installed on the corresponding system platform with a file that supports the file format of the electronic device.
  • the software development kit (abbreviated as SDK, and the full foreign language is called Software Development Kit) is generally a collection of development tools used by software engineers to build application software for specific software packages, software frameworks, hardware platforms, operating systems, etc.
  • step S100 the SDK receives an event transmitted from the engine through a preset event interface, the event is related to the target function module to be called, and the event interface is between the SDK and the engine. interface.
  • the engine When the engine needs to call the target function module, it will trigger an event related to the target function module, and notify the SDK in the form of an event that the target function module needs to be called. Events are transmitted through the event interface between the engine and the SDK.
  • the event interface may include an event sending interface on the engine for sending events and an event receiving interface on the SDK for receiving events.
  • the event interface may include an event sending interface 501 and an event receiving interface 601, and event transmission between the engine 50 and the SDK 60 can be realized through the event sending interface 501 and the event receiving interface 601.
  • the engine 50 triggers an event, it will send the event through the event sending interface 501, and the SDK 60 will receive the event through the event receiving interface 601.
  • the event interface can be configured in the engine and SDK in advance when developing the APP. All events related to the function module can be transmitted through the event interface between the engine and the SDK. In other words, whether it is a third-party library or a function module in a custom library, the SDK can be called through the same event interface.
  • the engine is configured with a corresponding interface for each library function module, which greatly reduces the number of interfaces required in the engine.
  • step S200 the SDK calls the target function module from the function modules integrated by the SDK according to the event.
  • each library can contain one or more than two functional modules.
  • each library can contain one or more than two functional modules.
  • SDK is a software toolkit, usually comes with some function module libraries.
  • the function modules integrated by the SDK may include the function modules that the SDK comes with, or may include the function modules that are added to the SDK in advance (for example, during the APP development process). At present, it is not ruled out that if the APP needs more functions in the future, the possibility of adding new function modules to the SDK.
  • the language of the SDK and its integrated functional modules can be a language suitable for underlying development and can support cross-platform use, for example, it can be a language such as C or C++.
  • the SDK When the SDK receives an event transmitted from the engine, since the event is related to the target function module, it can determine and call the target function module from all the function modules integrated by the SDK according to the event.
  • the SDK can be configured with the calling interface of the function modules of each library, and the target function module can be called through the calling interface of the target function module.
  • the target function module is called to realize the corresponding function. For example, when the target object needs to be accelerated, the engine will trigger an event related to the acceleration function module and send the event to the SDK. After receiving the event, the SDK will call the acceleration function module according to the event to achieve the acceleration of the target object.
  • the engine can notify the SDK to call the function module through the event mechanism.
  • the event related to the target function module can be transmitted to the SDK through the event interface between the engine and the SDK.
  • This event calls the target function module from the function module integrated by the SDK.
  • the interface causes the problem of difficulty in interface maintenance, and the function module is integrated in the SDK, which avoids the problem of the engine needing to manage a large number of libraries.
  • the event has a type field that records type information to which the event belongs;
  • step S200 the SDK calls the target function module from the function modules integrated by the SDK according to the event, including:
  • S201 The SDK parses the type field of the event
  • S202 The SDK calls the target function module from the function modules integrated by the SDK according to the parsed type information.
  • the engine When the engine triggers an event, it can write the type information of the event in the type field of the event.
  • the type information indicates the type of the event, and on the other hand, it can be used to determine the target function module.
  • the SDK After the SDK receives the event, it can determine and call the target function module according to the type information on the type field of the event.
  • the SDK can determine the target function module corresponding to the type information according to the type information, and call the target function module.
  • this is only an example, and the specific calling method is not limited, as long as the target function module can be called based on the type information.
  • the number of bits in the type field can be customized and can be determined according to the number of all event types, such as 32 bits, 64 bits, etc., and the specific number of bits is not limited.
  • the event can only have the type field, of course, can also have other fields, which can be determined according to needs.
  • the type field includes a first field and a second field
  • the first field records the target total type information to which the event belongs
  • the second field records the target subtype information to which the event belongs among all subtype information of the target total type information
  • step S202 the SDK calls the target function module from the function modules integrated by the SDK according to the parsed type information, including:
  • the SDK calls the target function module according to the target total type information and target subtype information.
  • the type field is divided into a first field and a second field.
  • the first field and the second field are used to record the target total type information and target subtype information of the event, respectively.
  • the upper 32 bits of the type field can be used as the first field, and the lower 32 bits can be used as the second field.
  • how to allocate the type field can be determined according to needs.
  • all events are classified in a classification manner of total type and sub-type, and the event type can be determined hierarchically, which is convenient for determining the event type so as to quickly call the target function module.
  • step S2021 the SDK calling the target function module according to the target total type information and target subtype information includes:
  • the SDK invokes the target message processing object corresponding to the target total type information, so as to use the target message processing object to determine the target event processing object corresponding to the target subtype information;
  • the SDK invokes the target event processing object to use the target event processing object to determine the functional module corresponding to the target subtype information
  • the SDK takes the determined function module as the target function module and calls the target function module.
  • the SDK can be pre-configured with a message processing object (Handler) corresponding to each total type information, and an event processing object (EventHandler) corresponding to the subtype information under each total type information, and the function module call is completed through these objects.
  • EventHandler message processing object
  • EventHandler event processing object
  • SDK management objects can be pre-created in the SDK for creating and managing various event processing objects.
  • Event processing objects can be responsible for the processing of one or more types of events through event type registration. The user can easily extend the event processing object to handle a variety of different transactions.
  • the SDK After the SDK receives the event, it can call the target message processing object corresponding to the target total type information according to the target total type information in the event.
  • the target message processing object can find the target event processing object according to the target subtype information, and set the target subtype Information is transmitted to the target event processing object, and the target event processing object can determine the target function module according to the target subtype information, and then call the target function module.
  • the target message processing object is determined first, and then the target message processing object distributes the event to the target event processing object for processing.
  • Different event processing objects can determine the function modules to be called according to the event subtype, and realize the event Distributed processing can improve the efficiency of event processing.
  • the method before the SDK receives the event transmitted from the engine through the preset event interface, the method further includes the following steps:
  • the SDK receives the creation message transmitted by the engine through the preset object management interface, the creation message is used to instruct the creation of the SDK management object, the SDK management object is used to manage the objects required to call the function module, so
  • the object management interface is the interface between the SDK and the engine;
  • S020 The SDK creates an SDK management object according to the creation message.
  • the object management interface may include a first message sending interface on the engine for sending messages and a first message receiving interface on the SDK for receiving messages (not shown in FIG. 2).
  • the engine can send a creation message to the SDK through the first message sending interface, and the SDK can receive the creation message from the engine through the first message receiving interface.
  • the creation message is used to instruct the creation of the SDK management object.
  • the SDK After the SDK receives the creation message, it can create the SDK management object based on the creation message.
  • the SDK management objects can be one or more than two, which are used to manage the objects required to call the function module, such as managing various event processing objects.
  • the SDK management object manages the event processing object, which is actually the management function module.
  • the creation message is transmitted through the object management interface to create the SDK management object, which facilitates the management of each event processing object and function module, and reduces the need for the engine Management work.
  • the object management interface can also be used to transmit other messages, such as the destruction message used to instruct the destruction of the SDK management object.
  • the engine can send the destruction message to the SDK through the first message sending interface, and the SDK can receive the message from the engine through the first message receiving interface. Destroy the message and destroy the created SDK management object according to the destruction message.
  • the method before the SDK receives the event transmitted from the engine through the preset event interface, the method further includes the following steps:
  • the SDK receives the initialization message transmitted by the engine through a preset object initialization interface, the initialization message is used to instruct to initialize the SDK management object, the SDK management object is used to manage the objects required to call the function module, so
  • the object initialization interface is the interface between the SDK and the engine;
  • S040 The SDK initializes the SDK management object according to the initialization message.
  • steps S030 and S040 are executed after steps S010 and S020.
  • the SDK object is created first, and then the SDK object is initialized.
  • the object initialization interface may include a second message sending interface on the engine for sending messages and a second message receiving interface on the SDK for receiving messages (not shown in FIG. 2).
  • the engine can send an initialization message to the SDK through the second message sending interface, and the SDK can receive the initialization message from the engine through the second message receiving interface.
  • the initialization message is used to indicate the initialization of the SDK management object. After the SDK receives the initialization message, it can initialize the created SDK management object according to the initialization message.
  • the initialization state of the SDK management object can be defined as required.
  • the engine can notify the SDK to initialize the SDK management object through an initialization message, which makes the initialization operation more convenient.
  • the method further includes the following steps:
  • S300 The SDK obtains the target execution result obtained by calling the target function module
  • the SDK transmits the target execution result to the engine through a preset callback interface;
  • the callback interface is an interface between the SDK and the engine, and is used to call the SDK into various functional modules
  • the execution result obtained is transmitted to the engine.
  • the callback interface can include a result sending interface on the SDK for sending execution results, and a result receiving interface on the engine for receiving execution results.
  • the SDK calls the target function module, it can send the target execution result obtained from the call to the engine through the result sending interface, and the engine receives the target execution result through the result receiving interface.
  • the callback interface includes a result sending interface 602 and a result receiving interface 502.
  • the transmission of the execution result between the SDK 60 and the engine 50 can be realized.
  • the SDK 60 can obtain the execution result after calling a function module, and sends the execution result to the engine 50 through the result sending interface 602, and the engine 50 receives the execution result through the result receiving interface.
  • the engine After the engine receives the target execution result, it can prompt for the target execution result, or perform the next transaction processing according to the target execution result to realize the required functions.
  • the event is triggered when the engine receives a call instruction indicating the target function module to be called, and the event also carries an identifier for identifying the call instruction;
  • step S400 the SDK transmits the target execution result to the engine through a preset callback interface, including:
  • S401 The SDK obtains an identifier from the event
  • the SDK carries the identifier in the target execution result and transmits it to the engine through the callback interface.
  • the event may be triggered by a call instruction, which may be input by an external user, or may be generated during the execution of the electronic device, which is not specifically limited.
  • the event carries an identifier that identifies the call instruction, so that the SDK can distinguish the call instruction that triggered the event based on the identifier; the execution result returned by the SDK also carries the identifier, so that the engine can determine the corresponding execution result based on the identifier Call the instruction to correctly prompt or further process the execution result.
  • the target message processing object when the target message processing object passes the target subtype information to the corresponding target event processing object, it can also pass the identifier into the target event processing object, and when the target execution result is obtained, it will also The identifier is carried in the target execution result, and the SDK transmits the target execution result carrying the identifier to the engine.
  • the event carries data related to the event
  • step S200 when the SDK calls the target function module from the function module integrated by the SDK according to the event, the method further includes:
  • S210 The SDK inputs the data into the target function module, so that the target function module performs processing according to the data.
  • the data carried in the event is the data required for the operation of the target function module.
  • the specific data required by each function module is different and can be determined according to actual needs.
  • the data may include data carried in the call instruction, data acquired on the electronic device, and so on.
  • the target function module After the SDK inputs the data carried by the event as a parameter to the target function module, the target function module performs corresponding processing according to the input data.
  • the target function module performs corresponding processing according to the input data.
  • the event may not carry relevant data.
  • the language of the SDK supports the operating system of the device, and the SDK supports an operating system different from the operating system of the device.
  • the language of the SDK can support more than two operating systems, of course, including the operating system of the electronic device that is the execution subject of the embodiment of the present invention. In this way, the SDK can be used across platforms.
  • the language of the SDK may include languages such as C, C++, etc., of course, it is not limited to this, and other languages that can support different operating systems are also possible.
  • the language of the interface on the SDK is preferably C language. Because C++ has the characteristics of overloading, it is easy to cause renaming problems. Using C language to write interfaces can avoid the problem of function renaming and ensure the uniqueness of interface names. To avoid calling errors.
  • the language of the SDK is the same as the language of the functional module integrated by the SDK.
  • the language of the SDK and the function module is the same, which makes the calling interface between the SDK and the function module easier to write, and the function module can be called more conveniently.
  • the language of the functional modules integrated by the SDK and SDK can be C or C++, etc.
  • the languages of the SDK and functional modules support different operating systems to ensure that the entire APP is cross-platform.
  • the SDK integrates multiple different functional modules. In this way, more functions can be extended for the engine.
  • These functional modules can be functional modules in the same library or functional modules in different libraries. Of course, it does not rule out that the SDK integrates only one functional module.
  • the second aspect of the embodiments of the present invention provides a method for invoking a function module, which is applied to an electronic device on which a cross-platform software development engine and a software development kit SDK are installed;
  • the calling method of the function module includes the following steps:
  • T100 When a target function module needs to be called, the engine triggers an event, and the event is related to the target function module;
  • the engine transmits the event to the SDK through a preset event interface.
  • the event interface is the interface between the SDK and the engine, so that the SDK receives the event from
  • the target function module is called from the function module integrated by the SDK.
  • the execution subject of the calling method of the function module may be an electronic device, and further may be a processor of the electronic device, where the processor may be one or more, and the processor may be a general-purpose processor. Or a dedicated processor.
  • the specific type of electronic equipment is not limited, such as computer equipment, mobile equipment, etc.
  • a cross-platform software development engine and a software development kit SDK are installed on the electronic device.
  • step T100 when the target function module needs to be called, the engine triggers an event, and the event is related to the target function module.
  • the engine When the engine needs to call the target function module, it will trigger an event related to the target function module, and notify the SDK in the form of an event that the target function module needs to be called.
  • step T200 the engine transmits the event to the SDK through a preset event interface.
  • the event interface is an interface between the SDK and the engine, so that the SDK depends on the received
  • the event calls the target function module from the function module integrated by the SDK.
  • the event interface may include an event sending interface on the engine for sending events and an event receiving interface on the SDK for receiving events.
  • the event interface may include an event sending interface 501 and an event receiving interface 601. Event transmission between the engine 50 and the SDK 60 can be realized through the event sending interface 501 and the event receiving interface 601.
  • the engine 50 triggers an event, it will send the event through the event sending interface 501, and the SDK 60 will receive the event through the event receiving interface 601.
  • the event interface can be configured in the engine and SDK in advance when developing the APP. All events related to the function module can be transmitted through the event interface between the engine and the SDK. In other words, whether it is a third-party library or a function module in a custom library, the SDK can be notified through the same event interface.
  • the engine is configured with a corresponding interface for each library function module, which greatly reduces the number of interfaces required in the engine.
  • each library can contain one or more than two functional modules.
  • each library can contain one or more than two functional modules.
  • SDK is a software toolkit, usually comes with some function module libraries.
  • the function modules integrated by the SDK may include the function modules that the SDK comes with, or may include the function modules that are added to the SDK in advance (for example, during the APP development process). At present, it is not ruled out that if the APP needs more functions in the future, the possibility of adding new function modules to the SDK.
  • the language of the SDK and its integrated functional modules can be a language suitable for underlying development and can support cross-platform use, for example, it can be a language such as C or C++.
  • the SDK When the SDK receives an event transmitted from the engine, since the event is related to the target function module, it can determine and call the target function module from all the function modules integrated by the SDK according to the event.
  • the SDK can be configured with the calling interface of the function modules of each library, and the target function module can be called through the calling interface of the target function module.
  • the target function module is called to realize the corresponding function. For example, when the target object needs to be accelerated, the engine will trigger an event related to the acceleration function module and send the event to the SDK. After receiving the event, the SDK will call the acceleration function module according to the event to achieve the acceleration of the target object.
  • the engine can notify the SDK to call the function module through the event mechanism.
  • the event related to the target function module can be transmitted to the SDK through the event interface between the engine and the SDK.
  • This event calls the target function module from the function module integrated by the SDK.
  • the interface causes the problem of difficulty in interface maintenance, and the function module is integrated in the SDK, which avoids the problem of the engine needing to manage a large number of libraries.
  • the event has a type field that records type information to which the event belongs.
  • the engine When the engine triggers an event, it can write the type information of the event in the type field of the event.
  • the type information indicates the type of the event, and on the other hand, it can be used to determine the target function module.
  • the SDK After the SDK receives the event, it can determine and call the target function module according to the type information on the type field of the event.
  • the SDK can determine the target function module corresponding to the type information according to the type information, and call the target function module.
  • this is only an example, and the specific calling method is not limited, as long as the target function module can be called based on the type information.
  • the number of bits in the type field can be customized and can be determined according to the number of all event types, such as 32 bits, 64 bits, etc., and the specific number of bits is not limited.
  • the event can only have the type field, of course, can also have other fields, which can be determined according to needs.
  • the type field includes a first field and a second field
  • the first field records the target total type information to which the event belongs
  • the second field records the target subtype information to which the event belongs among all subtype information of the target total type information.
  • the type field is divided into a first field and a second field.
  • the first field and the second field are used to record the target total type information and target subtype information of the event, respectively.
  • the upper 32 bits of the type field can be used as the first field, and the lower 32 bits can be used as the second field.
  • how to allocate the type field can be determined according to needs.
  • all events are classified in a classification manner of total type and sub-type, and the event type can be determined hierarchically, which is convenient for determining the event type so as to quickly call the target function module.
  • the method before the engine triggers an event, the method further includes:
  • the engine transmits a creation message to the SDK through the preset object management interface.
  • the creation message is used to instruct the creation of the SDK management object, and the SDK management object is used to manage the call to the function module.
  • the object management interface is an interface between the SDK and the engine, so that the SDK creates an SDK management object according to the received creation message.
  • the object management interface may include a first message sending interface on the engine for sending messages and a first message receiving interface on the SDK for receiving messages (not shown in FIG. 2).
  • the engine can send a creation message to the SDK through the first message sending interface, and the SDK can receive the creation message from the engine through the first message receiving interface.
  • the creation message is used to instruct the creation of the SDK management object.
  • the SDK After the SDK receives the creation message, it can create the SDK management object based on the creation message.
  • the SDK management objects can be one or more than two, which are used to manage the objects required to call the function module, such as managing various event processing objects.
  • the SDK management object manages the event processing object, which is actually the management function module.
  • the creation message is transmitted through the object management interface to create the SDK management object, which facilitates the management of each event processing object and function module, and reduces the need for the engine Management work.
  • the object management interface can also be used to transmit other messages, such as the destruction message used to instruct the destruction of the SDK management object.
  • the engine can send the destruction message to the SDK through the first message sending interface, and the SDK can receive the message from the engine through the first message receiving interface. Destroy the message and destroy the created SDK management object according to the destruction message.
  • the method before the engine triggers an event, the method further includes:
  • the engine transmits an initialization message to the SDK through the preset object initialization interface.
  • the initialization message is used to instruct to initialize the SDK management object, and the SDK management object is used to manage the call function module.
  • the object initialization interface is an interface between the SDK and the engine, so that the SDK initializes the SDK management object according to the received initialization message.
  • the object initialization interface can include a second message sending interface on the engine for sending messages and a second message receiving interface on the SDK for receiving messages (not shown in Figure 2).
  • the engine can send an initialization message to the SDK through the second message sending interface, and the SDK can receive the initialization message from the engine through the second message receiving interface.
  • the initialization message is used to indicate the initialization of the SDK management object. After the SDK receives the initialization message, it can initialize the created SDK management object according to the initialization message.
  • the initialization state of the SDK management object can be defined as required.
  • the engine can notify the SDK to initialize the SDK management object through an initialization message, which makes the initialization operation more convenient.
  • the method further includes:
  • the engine receives the target execution result transmitted from the SDK through a preset callback interface.
  • the target execution result is the execution result obtained by invoking the target function module;
  • the callback interface is the one between the SDK and the engine.
  • the inter-interface is used to transmit the execution result obtained by the SDK invoking each function module to the engine.
  • the callback interface can include a result sending interface on the SDK for sending execution results, and a result receiving interface on the engine for receiving execution results.
  • the SDK calls the target function module, it can send the target execution result obtained from the call to the engine through the result sending interface, and the engine receives the target execution result through the result receiving interface.
  • the callback interface includes a result sending interface 602 and a result receiving interface 502.
  • the transmission of the execution result between the SDK 60 and the engine 50 can be realized.
  • the SDK 60 can obtain the execution result after calling a function module, and sends the execution result to the engine 50 through the result sending interface 602, and the engine 50 receives the execution result through the result receiving interface.
  • the engine After the engine receives the target execution result, it can prompt for the target execution result, or perform the next transaction processing according to the target execution result to realize the required functions.
  • the method before the engine triggers an event, the method further includes:
  • the engine receives instructions
  • the call instruction When a call instruction is received, the call instruction is used to indicate the target function module to be called, and the engine determines that the target function module needs to be called.
  • the event may be triggered by a call instruction, which may be input by an external user, or may be generated during the execution of the electronic device, which is not specifically limited.
  • a call instruction which may be input by an external user, or may be generated during the execution of the electronic device, which is not specifically limited.
  • the engine transmits the event to the SDK through a preset event interface, including:
  • the engine carries the identifier in the event and transmits it to the SDK through the event interface, so that the SDK carries the identifier in the target execution result and transmits it to the target through the callback interface The engine.
  • the event carries an identifier that identifies the call instruction, so that the SDK can distinguish the call instruction that triggered the event based on the identifier; the execution result returned by the SDK also carries the identifier, so that the engine can determine the corresponding execution result based on the identifier Call the instruction to correctly prompt or further process the execution result.
  • the target message processing object when the target message processing object passes the target subtype information to the corresponding target event processing object, it can also pass the identifier into the target event processing object, and when the target execution result is obtained, it will also The identifier is carried in the target execution result, and the SDK transmits the target execution result carrying the identifier to the engine.
  • the instruction carries data related to the event
  • the engine transmits the event to the SDK through a preset event interface, including:
  • the engine obtains the data from the call instruction
  • the engine carries the data in the event and transmits it to the SDK through the event interface, so that the SDK inputs the data into the target function module.
  • the call instruction will carry the data required for the operation of the target function module. After the data is obtained from it, the obtained data is carried in the event, and the event carrying the data is transmitted to the SDK through the event interface.
  • the data carried in the event is the data required for the operation of the target function module.
  • the specific data required by each function module is different and can be determined according to actual needs.
  • the target function module After the SDK inputs the data carried by the event as a parameter to the target function module, the target function module performs corresponding processing according to the input data.
  • the target function module performs corresponding processing according to the input data.
  • the event may not carry relevant data.
  • the language of the SDK supports the operating system of the device, and the SDK supports an operating system different from the operating system of the device.
  • the language of the SDK can support more than two operating systems, of course, including the operating system of the electronic device that is the execution subject of the embodiment of the present invention. In this way, the SDK can be used across platforms.
  • the language of the SDK may include languages such as C, C++, etc., of course, it is not limited to this, and other languages that can support different operating systems are also possible.
  • the language of the interface on the SDK is preferably C language. Because C++ has the characteristics of overloading, it is easy to cause renaming problems. Using C language to write interfaces can avoid the problem of function renaming and ensure the uniqueness of interface names. To avoid calling errors.
  • the language of the SDK is the same as the language of the functional module integrated by the SDK.
  • the language of the SDK and the function module is the same, which makes the calling interface between the SDK and the function module easier to write, and the function module can be called more conveniently.
  • the language of the functional modules integrated by the SDK and SDK can be C or C++, etc.
  • the languages of the SDK and functional modules support different operating systems to ensure that the entire APP is cross-platform.
  • the SDK integrates multiple different functional modules. In this way, more functions can be extended for the engine.
  • These functional modules can be functional modules in the same library or functional modules in different libraries. Of course, it does not rule out that the SDK integrates only one functional module.
  • a third aspect of the embodiments of the present invention provides an electronic device, on which a cross-platform software development engine and a software development kit SDK are installed.
  • the electronic device 100 includes: a memory 101 and a processor 102.
  • the memory 101 is used to store program codes.
  • the processor 102 is used to call the program code, and when the program code is executed, it is used to perform the following operations:
  • the SDK uses the SDK to receive an event transmitted from the engine through a preset event interface, the event is related to the target function module to be called, and the event interface is an interface between the SDK and the engine;
  • the event has a type field that records type information to which the event belongs;
  • the processor uses the SDK to call the target function module from the function module integrated by the SDK according to the event, it is specifically used to:
  • the SDK is used to call the target function module from the function module integrated by the SDK according to the parsed type information.
  • the type field includes a first field and a second field
  • the first field records the target total type information to which the event belongs
  • the second field records the target subtype information to which the event belongs among all subtype information of the target total type information
  • the processor uses the SDK to call the target function module from the function module integrated with the SDK according to the type information parsed by the SDK, it is specifically used to:
  • the processor uses the SDK to call the target function module according to the target total type information and target subtype information, it is specifically configured to:
  • the processor before the processor receives an event transmitted from the engine through a preset event interface using the SDK, it is further used to:
  • the object management interface is the interface between the SDK and the engine;
  • the processor before the processor uses the SDK to receive the event transmitted from the engine through a preset event interface, it is further configured to:
  • the SDK is used to receive the initialization message transmitted by the engine through a preset object initialization interface.
  • the initialization message is used to instruct to initialize the SDK management object.
  • the SDK management object is used to manage the objects required to call the function module.
  • the object initialization interface is the interface between the SDK and the engine;
  • the processor uses the SDK to call the target function module from the function module integrated by the SDK according to the event, it is further configured to:
  • the callback interface is the interface between the SDK and the engine, and is used to call the SDK into various functional modules.
  • the execution result of is transmitted to the engine.
  • the event is triggered when the engine receives a call instruction indicating the target function module to be called, and the event also carries an identifier for identifying the call instruction;
  • the processor uses the SDK to transmit the target execution result to the engine through a preset callback interface, it is specifically used to:
  • the SDK is used to carry the identifier in the target execution result and is transmitted to the engine through the callback interface.
  • the event carries data related to the event
  • the processor uses the SDK to call the target function module from the function module integrated by the SDK according to the event, it is also used to:
  • the language of the SDK supports the operating system of the device, and the SDK supports an operating system different from the operating system of the device.
  • the language of the SDK is the same as the language of the functional module integrated by the SDK.
  • the SDK integrates multiple different functional modules.
  • a fourth aspect of the embodiments of the present invention provides an electronic device, on which a cross-platform software development engine and a software development kit SDK are installed.
  • the electronic device 100 includes: a memory 101 and a processor 102.
  • the memory 101 is used to store program codes.
  • the processor 102 is used to call the program code, and when the program code is executed, it is used to perform the following operations:
  • the event interface is the interface between the SDK and the engine, so that the SDK receives the event from the
  • the target function module is called from the function module integrated by the SDK.
  • the event has a type field that records type information to which the event belongs.
  • the type field includes a first field and a second field
  • the first field records the target total type information to which the event belongs
  • the second field records the target subtype information to which the event belongs among all subtype information of the target total type information.
  • the processor before the processor uses the engine to trigger an event, it is also used to:
  • the engine When an SDK management object needs to be created, the engine is used to transmit a creation message to the SDK through a preset object management interface.
  • the creation message is used to instruct the creation of the SDK management object, and the SDK management object is used to manage and call function modules.
  • a required object, the object management interface is an interface between the SDK and the engine, so that the SDK creates an SDK management object according to the received creation message.
  • the processor before the processor uses the engine to trigger an event, it is also used to:
  • the engine is used to transmit an initialization message to the SDK through the preset object initialization interface.
  • the initialization message is used to instruct to initialize the SDK management object, and the SDK management object is used to manage and call function modules.
  • the required object, the object initialization interface is an interface between the SDK and the engine, so that the SDK initializes the SDK management object according to the received initialization message.
  • the processor uses the engine to transmit the event to the SDK through a preset event interface, it is further used to:
  • the target execution result is the execution result obtained by calling the target function module
  • the callback interface is the SDK and the engine The interface between is used to transmit the execution result obtained by the SDK invoking each function module to the engine.
  • the processor before the processor uses the engine to trigger an event, it is also used to:
  • the call instruction When a call instruction is received, the call instruction is used to indicate the target function module to be called, and the engine is used to determine the target function module to be called.
  • the processor uses the engine to transmit the event to the SDK through a preset event interface, it is specifically used to:
  • the instruction carries data related to the event
  • the processor uses the engine to transmit the event to the SDK through a preset event interface, it is specifically used to:
  • the engine is used to carry the data in the event and is transmitted to the SDK through the event interface, so that the SDK inputs the data into the target function module.
  • the language of the SDK supports the operating system of the device, and the SDK supports an operating system different from the operating system of the device.
  • the language of the SDK is the same as the language of the functional module integrated by the SDK.
  • the SDK integrates multiple different functional modules.
  • an embodiment of the present invention also provides a computer-readable storage medium storing computer instructions, which can be implemented when the computer instructions are executed (for example, the computer instructions are executed by a processor)
  • the calling method of the function module described in the foregoing embodiment is also provided.
  • a typical implementation device is a computer.
  • the specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email receiving and sending device, and a game control A console, a tablet computer, a wearable device, or a combination of any of these devices.
  • the embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
  • a computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • these computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device,
  • the instruction device realizes the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded into a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, thereby executing instructions on the computer or other programmable equipment Provides steps for realizing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

Provided in the embodiments of the present invention are a functional module invoking method, a device and a computer readable storage medium. The method is applied to an electronic device. A cross-platform software development engine and a software development kit (SDK) are installed on the electronic device. The method comprises: the SDK receiving, by means of a preset event interface, an event transmitted from the engine, wherein the event is related to a target functional module to be invoked, and the event interface is an interface between the SDK and the engine; and the SDK invoking, according to the event, the target functional module from functional modules integrated by the SDK. The present invention avoids the problem that interface maintenance is difficult due to the introduction of a large number of interfaces invoking functional modules in the engine.

Description

功能模块的调用方法、设备、计算机可读存储介质Function module calling method, equipment, and computer readable storage medium 技术领域Technical field
本发明涉及软件技术领域,尤其是涉及一种功能模块的调用方法、设备、计算机可读存储介质。The present invention relates to the field of software technology, and in particular to a method, equipment, and computer-readable storage medium for calling function modules.
背景技术Background technique
随着计算机技术的发展,各种开发语言的系统平台不断走向成熟,例如windows、Mac、Android、iOS等操作系统平台。各个系统平台的本地语言不同,比如Android可以为Java或者kotlin,iOS可以用swift或者objectc等。通常,在各种系统平台上部署运行开发的应用程序APP时,需要基于具体系统平台开发相应语言的APP,不仅需要开发多种语言的APP,而且代码逻辑维护需要消耗大量的人力资源。With the development of computer technology, the system platforms of various development languages continue to mature, such as operating system platforms such as windows, Mac, Android, and iOS. The local language of each system platform is different. For example, Android can be Java or kotlin, and iOS can be swift or objectc. Generally, when deploying and running developed application apps on various system platforms, it is necessary to develop apps in corresponding languages based on specific system platforms. Not only does it need to develop apps in multiple languages, but also code logic maintenance requires a lot of human resources.
因此,跨平台技术应运而生,采用跨平台软件开发引擎比如Unity来实现APP的开发,以实现APP的跨平台。但是,跨平台软件开发引擎中可实现的功能是有限的,如果需要扩展更多的功能,就需要调用第三方库或其他库中的功能模块来实现。Therefore, cross-platform technology emerged as the times require, and cross-platform software development engines such as Unity are used to implement APP development to achieve cross-platform APP. However, the functions that can be implemented in the cross-platform software development engine are limited. If you need to expand more functions, you need to call a third-party library or function modules in other libraries to implement it.
相关功能模块的调用方式中,跨平台软件开发引擎中需要配置每一个库对应的接口,跨平台软件开发引擎直接通过该功能模块所在库对应的接口调用该功能模块。因此,为了能够实现调用跨平台软件开发引擎之外各种库的功能模块的调用,引擎中会引入大量调用功能模块的接口,导致接口维护较为困难的问题。In the calling method of related function modules, the cross-platform software development engine needs to configure the interface corresponding to each library, and the cross-platform software development engine directly calls the function module through the interface corresponding to the library where the function module is located. Therefore, in order to be able to call the function modules of various libraries other than the cross-platform software development engine, a large number of interfaces for calling the function modules will be introduced into the engine, which leads to the problem of difficult interface maintenance.
发明内容Summary of the invention
本发明提供一种功能模块的调用方法、设备、计算机可读存储介质,可避免引擎中会引入大量调用功能模块的接口导致接口维护较为困难的问题。The present invention provides a method, equipment and computer-readable storage medium for calling function modules, which can avoid the problem of difficult interface maintenance caused by the introduction of a large number of interfaces for calling function modules in the engine.
本发明实施例第一方面,提供一种功能模块的调用方法,应用于电子设备,所述电子设备上安装有跨平台软件开发引擎、及软件开发工具包SDK;In the first aspect of the embodiments of the present invention, a method for invoking a function module is provided, which is applied to an electronic device on which a cross-platform software development engine and a software development kit SDK are installed;
该方法包括:The method includes:
所述SDK通过预置的事件接口接收到来自所述引擎传输的事件,所述事件与需调用的目标功能模块相关,所述事件接口是所述SDK与所述引擎之间的接口;The SDK receives an event transmitted from the engine through a preset event interface, the event is related to the target function module to be called, and the event interface is an interface between the SDK and the engine;
所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块。The SDK calls the target function module from the function modules integrated by the SDK according to the event.
本发明实施例第二方面,提供一种功能模块的调用方法,应用于电子设备,所述电子设备上安装有跨平台软件开发引擎、及软件开发工具包SDK;In a second aspect of the embodiments of the present invention, a method for invoking a function module is provided, which is applied to an electronic device on which a cross-platform software development engine and a software development kit SDK are installed;
该方法包括:The method includes:
在需调用目标功能模块时,所述引擎触发事件,所述事件与所述目标功能模块相关;When a target function module needs to be called, the engine triggers an event, and the event is related to the target function module;
所述引擎通过预置的事件接口将所述事件传输至所述SDK,所述事件接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的所述事件从所述SDK集成的功能模块中调用所述目标功能模块。The engine transmits the event to the SDK through a preset event interface. The event interface is an interface between the SDK and the engine, so that the SDK receives the event from the SDK. The target function module is called in the function module integrated by the SDK.
本发明实施例第三方面,提供一种电子设备,所述电子设备上安装有跨平台软件开发引擎、及软件开发工具包SDK;In a third aspect of the embodiments of the present invention, an electronic device is provided, and a cross-platform software development engine and a software development kit SDK are installed on the electronic device;
所述设备包括:存储器和处理器;The device includes: a memory and a processor;
所述存储器,用于存储程序代码;The memory is used to store program code;
所述处理器,用于调用所述程序代码,当程序代码被执行时,用于执行以下操作:The processor is used to call the program code, and when the program code is executed, it is used to perform the following operations:
利用所述SDK通过预置的事件接口接收到来自所述引擎传输的事件,所述事件与需调用的目标功能模块相关,所述事件接口是所述SDK与所述引擎之间的接口;Use the SDK to receive an event transmitted from the engine through a preset event interface, the event is related to the target function module to be called, and the event interface is an interface between the SDK and the engine;
利用所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块。Use the SDK to call the target function module from the function modules integrated by the SDK according to the event.
本发明实施例第四方面,提供一种电子设备,所述电子设备上安装有跨平台软件开发引擎、及软件开发工具包SDK;In a fourth aspect of the embodiments of the present invention, an electronic device is provided, and a cross-platform software development engine and a software development kit SDK are installed on the electronic device;
所述设备包括:存储器和处理器;The device includes: a memory and a processor;
所述存储器,用于存储程序代码;The memory is used to store program code;
所述处理器,用于调用所述程序代码,当程序代码被执行时,用于执行以下操作:The processor is used to call the program code, and when the program code is executed, it is used to perform the following operations:
在需调用目标功能模块时,利用所述引擎触发事件,所述事件与所述目标功能模块相关;When a target function module needs to be called, use the engine to trigger an event, and the event is related to the target function module;
利用所述引擎通过预置的事件接口将所述事件传输至所述SDK,所述事件接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的所述事件从所述SDK集成的功能模块中调用所述目标功能模块。Use the engine to transmit the event to the SDK through a preset event interface. The event interface is the interface between the SDK and the engine, so that the SDK receives the event from the The target function module is called from the function module integrated by the SDK.
本发明实施例第五方面,提供一种计算机可读存储介质,其特征在于,A fifth aspect of the embodiments of the present invention provides a computer-readable storage medium, which is characterized in that:
所述计算机可读存储介质上存储有计算机指令,所述计算机指令被执行时,实现前述实施例所述的功能模块的调用方法。The computer-readable storage medium stores computer instructions, and when the computer instructions are executed, the method for invoking the functional modules described in the foregoing embodiments is implemented.
基于上述技术方案,本发明实施例中,可通过事件机制由引擎通知SDK调用功能模块,引擎可在需要调用目标功能模块时,通过引擎与SDK之间事件接口将与目标功能模块相关的事件传输给SDK,SDK依据该事件从SDK集成的功能模块中调用该目标功能模块,无需在引擎中为每个库的功能模块配置相应调用接口,不但减少了引擎中所需的接口,避免引擎中引入大量调用功能模块的接口导致接口维护较为困难的问题,而且功能模块集成在SDK中,避免了引擎需管理大量库的问题。Based on the above technical solution, in the embodiments of the present invention, the engine can notify the SDK to call the function module through the event mechanism. When the engine needs to call the target function module, it can transmit events related to the target function module through the event interface between the engine and the SDK. For the SDK, the SDK calls the target function module from the function module integrated by the SDK according to the event. There is no need to configure the corresponding call interface for each library function module in the engine, which not only reduces the interface required in the engine, and avoids the introduction of the engine A large number of interfaces that call function modules lead to the problem of difficult interface maintenance, and the function modules are integrated in the SDK to avoid the problem of the engine needing to manage a large number of libraries.
附图说明Description of the drawings
为了更加清楚地说明本发明实施例中的技术方案,下面将对本发明实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明中记载的一些实施例,对于本领域普通技术人员来讲,还可以依据本发明实施例的这些附图获得其它的附图。In order to more clearly describe the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings needed in the embodiments of the present invention. Obviously, the drawings in the following description are only some implementations recorded in the present invention. For example, for those of ordinary skill in the art, other drawings can be obtained based on these drawings of the embodiments of the present invention.
图1是本发明一实施例的功能模块的调用方法的流程示意图;FIG. 1 is a schematic flowchart of a method for calling a function module according to an embodiment of the present invention;
图2是本发明一实施例的引擎与SDK的交互示意图;2 is a schematic diagram of interaction between an engine and SDK according to an embodiment of the present invention;
图3是本发明另一实施例的功能模块的调用方法的流程示意图;3 is a schematic flowchart of a method for invoking a function module according to another embodiment of the present invention;
图4是本发明一实施例的电子设备的结构框图。Fig. 4 is a structural block diagram of an electronic device according to an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。另外,在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention. In addition, if there is no conflict, the following embodiments and the features in the embodiments can be combined with each other.
本发明使用的术语仅仅是出于描述特定实施例的目的,而非限制本发明。本发明和权利要求书所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其它含义。应当理解的是,本文中使用的术语“和/或”是指包含一个或多个相关联的列出项目的任何或所有可能组合。The terms used in the present invention are only for the purpose of describing specific embodiments, rather than limiting the present invention. The singular forms of "a", "said" and "the" used in the present invention and the claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should be understood that the term "and/or" as used herein refers to any or all possible combinations of one or more associated listed items.
尽管在本发明可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语用来将同一类型的信息彼此区分开。例如,在不脱离本发明范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,此外,所使用的词语“如果”可以被解释成为“在……时”,或者,“当……时”,或者,“响应于确定”。Although the terms first, second, third, etc. may be used in the present invention to describe various information, the information should not be limited to these terms. These terms are used to distinguish the same type of information from each other. For example, without departing from the scope of the present invention, the first information may also be referred to as second information, and similarly, the second information may also be referred to as first information. Depending on the context, in addition, the word "if" used can be interpreted as "when", or "when", or "in response to certainty."
本发明实施例的功能模块的调用方法可以用在需实现跨平台的APP中,APP是基于跨平台软件开发引擎开发的,可以跨平台使用,无需为不同系统平台开发相应平台本地语言的APP,减少了APP开发的工作量,也减小代码逻辑维护所需消耗的人力资源。The method for invoking functional modules of the embodiment of the present invention can be used in apps that need to be cross-platform. The apps are developed based on a cross-platform software development engine and can be used across platforms. There is no need to develop apps in corresponding platform local languages for different system platforms. It reduces the workload of APP development and also reduces the human resources required for code logic maintenance.
本发明实施例中,可以实现跨平台软件开发引擎的功能扩展,通过SDK 调用引擎之外各种库的功能模块来实现相应功能,只需在引擎和SDK之间配置统一的接口即可,无需在引擎中为不同库配置相应的接口,避免引入大量接口导致接口维护较为困难的问题。In the embodiment of the present invention, the function extension of the cross-platform software development engine can be realized. The corresponding function can be realized by calling the function modules of various libraries outside the engine by the SDK. It is only necessary to configure a unified interface between the engine and the SDK. Configure corresponding interfaces for different libraries in the engine to avoid the problem of difficult interface maintenance caused by the introduction of a large number of interfaces.
跨平台是软件开发中一个重要的概念,即不依赖于操作系统,也不依赖硬件环境,一个操作系统下开发的APP,放到另一个操作系统下依然可以运行。Cross-platform is an important concept in software development, that is, it does not depend on the operating system or the hardware environment. An APP developed under one operating system can still run under another operating system.
本发明实施例中的跨平台,可以是跨两个系统平台、或者跨更多系统平台。系统平台可以包括windows、Mac、Android、iOS、Linux等热门操作系统平台,当然,还可以包括其他的系统平台,在此不再列举。The cross-platform in the embodiment of the present invention may be across two system platforms or across more system platforms. The system platform can include popular operating system platforms such as windows, Mac, Android, iOS, Linux, etc., of course, can also include other system platforms, which will not be listed here.
下面对本发明实施例的功能模块的调用方法进行展开说明,但不应以此为限。The invoking method of the function module of the embodiment of the present invention will be explained below, but it should not be limited to this.
本发明实施例第一方面提供一种功能模块的调用方法,应用于电子设备,所述电子设备上安装有跨平台软件开发引擎、及软件开发工具包SDK;The first aspect of the embodiments of the present invention provides a method for invoking a function module, which is applied to an electronic device on which a cross-platform software development engine and a software development kit SDK are installed;
参看图1,在一个实施例中,该功能模块的调用方法可以包括以下步骤:Referring to Fig. 1, in one embodiment, the calling method of the function module may include the following steps:
S100:所述SDK通过预置的事件接口接收到来自所述引擎传输的事件,所述事件与需调用的目标功能模块相关,所述事件接口是所述SDK与所述引擎之间的接口;S100: The SDK receives an event transmitted from the engine through a preset event interface, the event is related to the target function module to be called, and the event interface is an interface between the SDK and the engine;
S200:所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块。S200: The SDK calls the target function module from the function modules integrated by the SDK according to the event.
本实施例中,功能模块的调用方法的执行主体可以为电子设备,进一步地可以为电子设备的处理器,其中,所述处理器可以为一个或多个,所述处理器可以为通用处理器或者专用处理器。电子设备具体类型不限,比如可以额是计算机设备、移动设备等。In this embodiment, the execution subject of the calling method of the function module may be an electronic device, and further may be a processor of the electronic device, where the processor may be one or more, and the processor may be a general-purpose processor. Or a dedicated processor. The specific type of electronic equipment is not limited, such as computer equipment, mobile equipment, etc.
电子设备上安装有跨平台软件开发引擎、及软件开发工具包SDK。可以在电子设备上安装包含引擎和SDK的APP,实现引擎和SDK的安装。在APP运行过程中,可通过引擎和SDK的配合实现功能模块的调用,为APP实现所需的功能。A cross-platform software development engine and a software development kit SDK are installed on the electronic device. You can install an APP containing the engine and SDK on the electronic device to implement the installation of the engine and SDK. During the running of the APP, the function module can be called through the cooperation of the engine and the SDK to realize the required functions for the APP.
跨平台软件开发引擎是一种软件开发平台,开发出的软件可实现跨平台。本发明实施例中提及的引擎均指跨平台软件开发引擎。跨平台软件开发引擎比如有Unity、Cocos2d-x、Qt等,具体不限。The cross-platform software development engine is a software development platform, and the developed software can be cross-platform. The engines mentioned in the embodiments of the present invention all refer to cross-platform software development engines. Cross-platform software development engines, such as Unity, Cocos2d-x, Qt, etc., are not limited.
以跨平台软件开发引擎为Unity为例,Unity技术框架不断成熟,因为其具有跨平台特性,且使用了易于掌握使用的C#开发语言,所以逐渐地受到开发者欢迎,不仅在游戏开发,且在普通的应用软件也开始逐步使用。Unity在完成开发后可以被分别编译成支持各种系统平台的文件,各种文件的格式不同,比如,支持iOS的文件格式为.framework,支持MacOS X的文件格式为.bundle,支持Windows的文件格式为.dll,支持安卓的文件格式为.so等。本实施例中,用支持电子设备的文件格式的文件在相应的系统平台安装Unity。Taking the cross-platform software development engine as Unity as an example, the Unity technology framework has continued to mature. Because it has cross-platform features and uses the easy-to-use C# development language, it has gradually been welcomed by developers, not only in game development, but also in game development. Common application software has also begun to be used gradually. After Unity is completed, it can be compiled into files that support various system platforms. Various file formats are different. For example, the file format that supports iOS is .framework, the file format that supports MacOS X is .bundle, and the file format that supports Windows The format is .dll, and the file format that supports Android is .so, etc. In this embodiment, Unity is installed on the corresponding system platform with a file that supports the file format of the electronic device.
软件开发工具包(缩写为SDK,外语全称为Software Development Kit)一般都是一些软件工程师为特定的软件包、软件框架、硬件平台、操作系统等建立应用软件时的开发工具的集合。The software development kit (abbreviated as SDK, and the full foreign language is called Software Development Kit) is generally a collection of development tools used by software engineers to build application software for specific software packages, software frameworks, hardware platforms, operating systems, etc.
步骤S100中,所述SDK通过预置的事件接口接收到来自所述引擎传输的事件,所述事件与需调用的目标功能模块相关,所述事件接口是所述SDK与所述引擎之间的接口。In step S100, the SDK receives an event transmitted from the engine through a preset event interface, the event is related to the target function module to be called, and the event interface is between the SDK and the engine. interface.
引擎在需要调用目标功能模块时,会触发与目标功能模块相关的事件,以事件形式通知SDK需要调用目标功能模块。事件是通过引擎和SDK之间的事件接口传输的,事件接口可以包括引擎上用于发送事件的事件发送接口和SDK上用于接收事件的事件接收接口。When the engine needs to call the target function module, it will trigger an event related to the target function module, and notify the SDK in the form of an event that the target function module needs to be called. Events are transmitted through the event interface between the engine and the SDK. The event interface may include an event sending interface on the engine for sending events and an event receiving interface on the SDK for receiving events.
参看图2,事件接口可以包括事件发送接口501和事件接收接口601,通过事件发送接口501和事件接收接口601可实现引擎50与SDK 60之间的事件传输。引擎50在触发一个事件时,会通过事件发送接口501发送该事件,SDK 60通过事件接收接口601接收该事件。Referring to FIG. 2, the event interface may include an event sending interface 501 and an event receiving interface 601, and event transmission between the engine 50 and the SDK 60 can be realized through the event sending interface 501 and the event receiving interface 601. When the engine 50 triggers an event, it will send the event through the event sending interface 501, and the SDK 60 will receive the event through the event receiving interface 601.
事件接口可以在开发APP时预先在引擎和SDK中配置好。所有与功能模块相关的事件均可通过引擎和SDK之间的事件接口进行传输,换言之,无论是第三方库还是自定义库中的功能模块,均可通过同一事件接口来通知SDK 调用,无需在引擎中为每个库的功能模块配置一个对应的接口,大大减少了引擎中所需的接口数量。The event interface can be configured in the engine and SDK in advance when developing the APP. All events related to the function module can be transmitted through the event interface between the engine and the SDK. In other words, whether it is a third-party library or a function module in a custom library, the SDK can be called through the same event interface. The engine is configured with a corresponding interface for each library function module, which greatly reduces the number of interfaces required in the engine.
步骤S200中,所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块。In step S200, the SDK calls the target function module from the function modules integrated by the SDK according to the event.
SDK中可以集成多个不同的库,每个库中可以包含一个或两个以上的功能模块,当然,也可以只集成一个库,具体并不做限定。SDK是软件工具包,通常自带有一些功能模块库。Multiple different libraries can be integrated in the SDK, and each library can contain one or more than two functional modules. Of course, it is also possible to integrate only one library, which is not limited. SDK is a software toolkit, usually comes with some function module libraries.
本实施例中,SDK集成的功能模块可以包括SDK自带的功能模块,也可以包括预先(比如在APP开发过程时)添加到SDK中的功能模块。当前,也不排除后续如果APP需要更多的功能时,将新功能模块加入到SDK中的可能性。SDK及其集成的功能模块的语言可以是适合于底层开发的语言,可以支持跨平台使用,比如可以是C或C++等语言。In this embodiment, the function modules integrated by the SDK may include the function modules that the SDK comes with, or may include the function modules that are added to the SDK in advance (for example, during the APP development process). At present, it is not ruled out that if the APP needs more functions in the future, the possibility of adding new function modules to the SDK. The language of the SDK and its integrated functional modules can be a language suitable for underlying development and can support cross-platform use, for example, it can be a language such as C or C++.
SDK在收到来自引擎传输的事件时,由于事件与目标功能模块相关,所以可依据事件从SDK集成的所有功能模块中确定并调用目标功能模块。SDK中可以配置有各个库的功能模块的调用接口,通过目标功能模块的调用接口来调用目标功能模块。When the SDK receives an event transmitted from the engine, since the event is related to the target function module, it can determine and call the target function module from all the function modules integrated by the SDK according to the event. The SDK can be configured with the calling interface of the function modules of each library, and the target function module can be called through the calling interface of the target function module.
目标功能模块被调用后实现相应的功能。比如,需要目标对象加速时,引擎会触发与加速功能模块相关的事件并将事件发送给SDK,SDK收到事件后会依据事件调用加速功能模块,以实现目标对象的加速。The target function module is called to realize the corresponding function. For example, when the target object needs to be accelerated, the engine will trigger an event related to the acceleration function module and send the event to the SDK. After receiving the event, the SDK will call the acceleration function module according to the event to achieve the acceleration of the target object.
本发明实施例中,可通过事件机制由引擎通知SDK调用功能模块,引擎可在需要调用目标功能模块时,通过引擎与SDK之间事件接口将与目标功能模块相关的事件传输给SDK,SDK依据该事件从SDK集成的功能模块中调用该目标功能模块,无需在引擎中为每个库的功能模块配置相应调用接口,不但减少了引擎中所需的接口,避免引擎中引入大量调用功能模块的接口导致接口维护较为困难的问题,而且功能模块集成在SDK中,避免了引擎需管理大量库的问题。In the embodiment of the present invention, the engine can notify the SDK to call the function module through the event mechanism. When the engine needs to call the target function module, the event related to the target function module can be transmitted to the SDK through the event interface between the engine and the SDK. This event calls the target function module from the function module integrated by the SDK. There is no need to configure the corresponding call interface for each library function module in the engine. This not only reduces the interface required in the engine, but also avoids the introduction of a large number of calling function modules in the engine. The interface causes the problem of difficulty in interface maintenance, and the function module is integrated in the SDK, which avoids the problem of the engine needing to manage a large number of libraries.
在一个实施例中,所述事件具有记录所述事件所属类型信息的类型字段;In an embodiment, the event has a type field that records type information to which the event belongs;
步骤S200中,所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块,包括:In step S200, the SDK calls the target function module from the function modules integrated by the SDK according to the event, including:
S201:所述SDK解析所述事件的类型字段;S201: The SDK parses the type field of the event;
S202:所述SDK依据解析出的类型信息从所述SDK集成的功能模块中调用所述目标功能模块。S202: The SDK calls the target function module from the function modules integrated by the SDK according to the parsed type information.
引擎在触发事件时,可在事件的类型字段上写入该事件的类型信息,类型信息一方面表明了事件的类型,另一方面可用于确定目标功能模块。SDK收到事件后,可根据事件的类型字段上的类型信息确定并调用目标功能模块。When the engine triggers an event, it can write the type information of the event in the type field of the event. On the one hand, the type information indicates the type of the event, and on the other hand, it can be used to determine the target function module. After the SDK receives the event, it can determine and call the target function module according to the type information on the type field of the event.
目标功能模块与该事件中的类型信息之间可以具有直接或间接的对应关系,如此,SDK可以根据类型信息确定与类型信息对应的目标功能模块,并调用该目标功能模块。当然,此处仅是举例,具体的调用方式不限,只要能够实现依据类型信息调用目标功能模块即可。There may be a direct or indirect correspondence between the target function module and the type information in the event. In this way, the SDK can determine the target function module corresponding to the type information according to the type information, and call the target function module. Of course, this is only an example, and the specific calling method is not limited, as long as the target function module can be called based on the type information.
类型字段的位数可以自定义,可以根据所有事件类型的数量来确定,比如可以为32位、64位等,具体位数不限。事件上可以只具有类型字段,当然还可以具有其他的字段,具体可以根据需要而定。The number of bits in the type field can be customized and can be determined according to the number of all event types, such as 32 bits, 64 bits, etc., and the specific number of bits is not limited. The event can only have the type field, of course, can also have other fields, which can be determined according to needs.
在一个实施例中,所述类型字段包括第一字段和第二字段;In an embodiment, the type field includes a first field and a second field;
所述第一字段上记录了所述事件所属的目标总类型信息,所述第二字段上记录了所述目标总类型信息的所有子类型信息中所述事件所属的目标子类型信息;The first field records the target total type information to which the event belongs, and the second field records the target subtype information to which the event belongs among all subtype information of the target total type information;
步骤S202中,所述SDK依据解析出的类型信息从所述SDK集成的功能模块中调用所述目标功能模块,包括:In step S202, the SDK calls the target function module from the function modules integrated by the SDK according to the parsed type information, including:
S2021:所述SDK依据所述目标总类型信息与目标子类型信息调用所述目标功能模块。S2021: The SDK calls the target function module according to the target total type information and target subtype information.
将类型字段划分成第一字段和第二字段,第一字段和第二字段分别用来记录事件的目标总类型信息和目标子类型信息。比如,可以将类型字段的高32位作为第一字段,将低32位作为第二字段,当然,如何分配类型字段可根据需要而定。The type field is divided into a first field and a second field. The first field and the second field are used to record the target total type information and target subtype information of the event, respectively. For example, the upper 32 bits of the type field can be used as the first field, and the lower 32 bits can be used as the second field. Of course, how to allocate the type field can be determined according to needs.
将所有事件类型先进行大类划分,划分出几个总类型,再对每个总类型进行小类划分,进一步划分出总类型下的几个子类型,根据目标总类型信息可以确定事件所属的总类型,根据目标子类型信息进而可以确定该总类型下事件所属的子类型。当然,具体如何对事件类型进行分类并不作为限制。Divide all event types into major categories first, divide into several general categories, and then divide each general category into sub-categories, and further divide into several sub-types under the general category. According to the target general category information, the general category to which the event belongs can be determined. Type, according to the target subtype information, the subtype to which the event belongs to the total type can be determined. Of course, how to classify event types is not a limitation.
本实施例中,以总类型和子类型的分类方式对所有事件进行归类,可以分级地确定事件类型,便于确定事件类型,以便快速调用目标功能模块。In this embodiment, all events are classified in a classification manner of total type and sub-type, and the event type can be determined hierarchically, which is convenient for determining the event type so as to quickly call the target function module.
在一个实施例中,步骤S2021中,所述SDK依据所述目标总类型信息与目标子类型信息调用所述目标功能模块,包括:In one embodiment, in step S2021, the SDK calling the target function module according to the target total type information and target subtype information includes:
所述SDK调用与所述目标总类型信息对应的目标消息处理对象,以利用所述目标消息处理对象确定与所述目标子类型信息对应的目标事件处理对象;The SDK invokes the target message processing object corresponding to the target total type information, so as to use the target message processing object to determine the target event processing object corresponding to the target subtype information;
所述SDK调用所述目标事件处理对象,以利用所述目标事件处理对象确定与所述目标子类型信息对应的功能模块;The SDK invokes the target event processing object to use the target event processing object to determine the functional module corresponding to the target subtype information;
所述SDK将确定出的功能模块作为目标功能模块并调用所述目标功能模块。The SDK takes the determined function module as the target function module and calls the target function module.
SDK中可以预先配置有各个总类型信息对应的消息处理对象(Handler),以及每个总类型信息下的子类型信息对应的事件处理对象(EventHandler),通过这些对象来完成功能模块的调用。The SDK can be pre-configured with a message processing object (Handler) corresponding to each total type information, and an event processing object (EventHandler) corresponding to the subtype information under each total type information, and the function module call is completed through these objects.
SDK中可以预先创建有SDK管理对象,用于创建和管理各事件处理对象。事件处理对象可以通过事件类型注册的方式来负责一个或多个类型事件的处理。用户可以方便地扩展事件处理对象,用于处理各种不同事务。SDK management objects can be pre-created in the SDK for creating and managing various event processing objects. Event processing objects can be responsible for the processing of one or more types of events through event type registration. The user can easily extend the event processing object to handle a variety of different transactions.
SDK收到事件后,可根据事件中的目标总类型信息调用与该目标总类型信息对应的目标消息处理对象,目标消息处理对象可以根据目标子类型信息找到目标事件处理对象,并将目标子类型信息传入到该目标事件处理对象,目标事件处理对象可依据目标子类型信息确定出目标功能模块,从而调用目标功能模块。After the SDK receives the event, it can call the target message processing object corresponding to the target total type information according to the target total type information in the event. The target message processing object can find the target event processing object according to the target subtype information, and set the target subtype Information is transmitted to the target event processing object, and the target event processing object can determine the target function module according to the target subtype information, and then call the target function module.
本实施例中,先确定出目标消息处理对象,再由目标消息处理对象将事 件分发给目标事件处理对象进行处理,不同事件处理对象可以根据事件子类型确定需调用的功能模块,实现了事件的分发处理,可以提升事件的处理效率。In this embodiment, the target message processing object is determined first, and then the target message processing object distributes the event to the target event processing object for processing. Different event processing objects can determine the function modules to be called according to the event subtype, and realize the event Distributed processing can improve the efficiency of event processing.
在一个实施例中,所述SDK通过预置的事件接口接收到来自所述引擎传输的事件之前,该方法还包括以下步骤:In an embodiment, before the SDK receives the event transmitted from the engine through the preset event interface, the method further includes the following steps:
S010:所述SDK通过预置的对象管理接口接收所述引擎传输的创建消息,所述创建消息用于指示创建SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象管理接口是所述SDK与所述引擎之间的接口;S010: The SDK receives the creation message transmitted by the engine through the preset object management interface, the creation message is used to instruct the creation of the SDK management object, the SDK management object is used to manage the objects required to call the function module, so The object management interface is the interface between the SDK and the engine;
S020:所述SDK依据所述创建消息创建SDK管理对象。S020: The SDK creates an SDK management object according to the creation message.
引擎和SDK之间具有对象管理接口,对象管理接口可包括引擎上用于发送消息的第一消息发送接口及SDK上用于接收消息的第一消息接收接口(图2中未示出)。引擎可通过第一消息发送接口发送创建消息给SDK,SDK可通过第一消息接收接口接收来自引擎的创建消息。There is an object management interface between the engine and the SDK, and the object management interface may include a first message sending interface on the engine for sending messages and a first message receiving interface on the SDK for receiving messages (not shown in FIG. 2). The engine can send a creation message to the SDK through the first message sending interface, and the SDK can receive the creation message from the engine through the first message receiving interface.
创建消息用于指示创建SDK管理对象,SDK收到创建消息后,可依据该创建消息创建SDK管理对象。SDK管理对象可以为一个或者两个以上,用于管理调用功能模块所需的对象,比如管理各个事件处理对象。The creation message is used to instruct the creation of the SDK management object. After the SDK receives the creation message, it can create the SDK management object based on the creation message. The SDK management objects can be one or more than two, which are used to manage the objects required to call the function module, such as managing various event processing objects.
本实施例中,SDK管理对象管理事件处理对象,事实上就是管理功能模块,通过对象管理接口传输创建消息来创建SDK管理对象,可便于各个事件处理对象、功能模块的管理,减轻了引擎所需的管理工作。In this embodiment, the SDK management object manages the event processing object, which is actually the management function module. The creation message is transmitted through the object management interface to create the SDK management object, which facilitates the management of each event processing object and function module, and reduces the need for the engine Management work.
当然,对象管理接口还可用于传输其他消息,比如用于指示销毁SDK管理对象的销毁消息,引擎可通过第一消息发送接口发送销毁消息给SDK,SDK可通过第一消息接收接口接收来自引擎的销毁消息、并根据销毁消息销毁已创建的SDK管理对象。Of course, the object management interface can also be used to transmit other messages, such as the destruction message used to instruct the destruction of the SDK management object. The engine can send the destruction message to the SDK through the first message sending interface, and the SDK can receive the message from the engine through the first message receiving interface. Destroy the message and destroy the created SDK management object according to the destruction message.
在一个实施例中,所述SDK通过预置的事件接口接收到来自所述引擎传输的事件之前,该方法还包括以下步骤:In an embodiment, before the SDK receives the event transmitted from the engine through the preset event interface, the method further includes the following steps:
S030:所述SDK通过预置的对象初始化接口接收所述引擎传输的初始化 消息,所述初始化消息用于指示初始化SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象初始化接口是所述SDK与所述引擎之间的接口;S030: The SDK receives the initialization message transmitted by the engine through a preset object initialization interface, the initialization message is used to instruct to initialize the SDK management object, the SDK management object is used to manage the objects required to call the function module, so The object initialization interface is the interface between the SDK and the engine;
S040:所述SDK依据所述初始化消息初始化SDK管理对象。S040: The SDK initializes the SDK management object according to the initialization message.
当然,步骤S030和S040在步骤S010和S020之后执行,先创建好SDK对象,再对SDK对象进行初始化。Of course, steps S030 and S040 are executed after steps S010 and S020. The SDK object is created first, and then the SDK object is initialized.
引擎和SDK之间具有对象初始化接口,对象初始化接口可包括引擎上用于发送消息的第二消息发送接口及SDK上用于接收消息的第二消息接收接口(图2中未示出)。引擎可通过第二消息发送接口发送初始化消息给SDK,SDK可通过第二消息接收接口接收来自引擎的初始化消息。There is an object initialization interface between the engine and the SDK, and the object initialization interface may include a second message sending interface on the engine for sending messages and a second message receiving interface on the SDK for receiving messages (not shown in FIG. 2). The engine can send an initialization message to the SDK through the second message sending interface, and the SDK can receive the initialization message from the engine through the second message receiving interface.
初始化消息用于指示初始化SDK管理对象,SDK收到初始化消息后,可依据该初始化消息初始化已创建的SDK管理对象。SDK管理对象的初始化状态可根据需要进行定义。The initialization message is used to indicate the initialization of the SDK management object. After the SDK receives the initialization message, it can initialize the created SDK management object according to the initialization message. The initialization state of the SDK management object can be defined as required.
本实施例中,引擎可通过初始化消息来通知SDK初始化SDK管理对象,使得初始化操作更为方便。In this embodiment, the engine can notify the SDK to initialize the SDK management object through an initialization message, which makes the initialization operation more convenient.
在一个实施例中,所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块之后,该方法还包括以下步骤:In one embodiment, after the SDK invokes the target function module from the function module integrated by the SDK according to the event, the method further includes the following steps:
S300:所述SDK获取调用所述目标功能模块所得的目标执行结果;S300: The SDK obtains the target execution result obtained by calling the target function module;
S400:所述SDK通过预置的回调接口将所述目标执行结果传输至所述引擎;所述回调接口是所述SDK与所述引擎之间的接口,用于将所述SDK调用各功能模块所得的执行结果传输至所述引擎。S400: The SDK transmits the target execution result to the engine through a preset callback interface; the callback interface is an interface between the SDK and the engine, and is used to call the SDK into various functional modules The execution result obtained is transmitted to the engine.
引擎和SDK之间具有回调接口,回调接口可包括SDK上用于发送执行结果的结果发送接口、引擎上用于接收执行结果的结果接收接口。SDK在调用目标功能模块后,可通过结果发送接口将调用所得的目标执行结果发送给引擎,引擎通过结果接收接口接收目标执行结果。There is a callback interface between the engine and the SDK. The callback interface can include a result sending interface on the SDK for sending execution results, and a result receiving interface on the engine for receiving execution results. After the SDK calls the target function module, it can send the target execution result obtained from the call to the engine through the result sending interface, and the engine receives the target execution result through the result receiving interface.
继续参看图2,回调接口包括结果发送接口602和结果接收接口502,通过结果发送接口602和结果接收接口502可以实现SDK 60与引擎50之间的 执行结果的传输。SDK 60在调用完一个功能模块时可以得到执行结果,通过结果发送接口602将执行结果发送给引擎50,引擎50通过结果接收接口接收执行结果。Continuing to refer to FIG. 2, the callback interface includes a result sending interface 602 and a result receiving interface 502. Through the result sending interface 602 and the result receiving interface 502, the transmission of the execution result between the SDK 60 and the engine 50 can be realized. The SDK 60 can obtain the execution result after calling a function module, and sends the execution result to the engine 50 through the result sending interface 602, and the engine 50 receives the execution result through the result receiving interface.
引擎在收到目标执行结果后,可以对目标执行结果进行提示、或依据目标执行结果进行下一步的事务处理等,实现所需的功能。After the engine receives the target execution result, it can prompt for the target execution result, or perform the next transaction processing according to the target execution result to realize the required functions.
在一个实施例中,所述事件是所述引擎在收到指示需调用的目标功能模块的调用指令时触发的,所述事件还携带有用于标识所述调用指令的标识符;In one embodiment, the event is triggered when the engine receives a call instruction indicating the target function module to be called, and the event also carries an identifier for identifying the call instruction;
步骤S400中,所述SDK通过预置的回调接口将所述目标执行结果传输至所述引擎,包括:In step S400, the SDK transmits the target execution result to the engine through a preset callback interface, including:
S401:所述SDK从所述事件中获取标识符;S401: The SDK obtains an identifier from the event;
S402:所述SDK将所述标识符携带在目标执行结果中并通过所述回调接口传输至所述引擎。S402: The SDK carries the identifier in the target execution result and transmits it to the engine through the callback interface.
本实施例中,事件可由调用指令触发,调用指令可以是由外部用户输入的,或者可以是电子设备在执行过程中产生的,具体不作限定。In this embodiment, the event may be triggered by a call instruction, which may be input by an external user, or may be generated during the execution of the electronic device, which is not specifically limited.
在电子设备上多次操作同一按键可以触发多个调用指令,比如,在同一加速键上操作两次,会进行两次加速,而两次加速的基础速度不同,所以即使调用同一功能模块,所得的执行结果也可能并不相同。为了使得引擎及SDK能够区分每次的调用指令,为每个调用指令确定了一个标识符。Operating the same button multiple times on an electronic device can trigger multiple call instructions. For example, operating the same accelerator key twice will accelerate twice, but the basic speed of the two accelerations is different, so even if the same function module is called, the result The results of the implementation may also be different. In order to enable the engine and SDK to distinguish each call instruction, an identifier is determined for each call instruction.
在事件中携带标识调用指令的标识符,使得SDK可依据标识符区分触发事件的调用指令;在SDK返回的执行结果中也携带该标识符,使得引擎可以依据标识符确定该执行结果所对应的调用指令,以正确地对执行结果进行提示或进一步处理。The event carries an identifier that identifies the call instruction, so that the SDK can distinguish the call instruction that triggered the event based on the identifier; the execution result returned by the SDK also carries the identifier, so that the engine can determine the corresponding execution result based on the identifier Call the instruction to correctly prompt or further process the execution result.
基于前述实施例中的描述,目标消息处理对象在将目标子类型信息传入到对应的目标事件处理对象时,还可将标识符传入目标事件处理对象,在得到目标执行结果时,还将标识符携带在目标执行结果,SDK将携带了标识符的目标执行结果传输给引擎。Based on the description in the foregoing embodiment, when the target message processing object passes the target subtype information to the corresponding target event processing object, it can also pass the identifier into the target event processing object, and when the target execution result is obtained, it will also The identifier is carried in the target execution result, and the SDK transmits the target execution result carrying the identifier to the engine.
在一个实施例中,所述事件携带有与所述事件相关的数据;In one embodiment, the event carries data related to the event;
步骤S200中,所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块时,该方法还包括:In step S200, when the SDK calls the target function module from the function module integrated by the SDK according to the event, the method further includes:
S210:所述SDK将所述数据输入至所述目标功能模块中,以使所述目标功能模块依据所述数据执行处理。S210: The SDK inputs the data into the target function module, so that the target function module performs processing according to the data.
事件中携带的数据是目标功能模块运行所需的数据,具体每个功能模块所需的数据不同,可以根据实际需要而定。数据可以包括调用指令中携带的数据、电子设备上获取的数据等。The data carried in the event is the data required for the operation of the target function module. The specific data required by each function module is different and can be determined according to actual needs. The data may include data carried in the call instruction, data acquired on the electronic device, and so on.
SDK将事件携带的数据作为传参输入到目标功能模块后,目标功能模块依据输入的数据执行相应的处理。当然,也不排除一些功能模块在运行时不需要输入数据的情况,此时,事件中也可以不携带相关数据。After the SDK inputs the data carried by the event as a parameter to the target function module, the target function module performs corresponding processing according to the input data. Of course, it is not ruled out that some functional modules do not need to input data during operation. At this time, the event may not carry relevant data.
在一个实施例中,所述SDK的语言支持本设备的操作系统,并且所述SDK支持与本设备的操作系统不同的操作系统。In one embodiment, the language of the SDK supports the operating system of the device, and the SDK supports an operating system different from the operating system of the device.
换言之,SDK的语言可以支持两个以上的操作系统,当然其中包括作为本发明实施例执行主体的电子设备的操作系统,如此,可以保证SDK能够跨平台使用。In other words, the language of the SDK can support more than two operating systems, of course, including the operating system of the electronic device that is the execution subject of the embodiment of the present invention. In this way, the SDK can be used across platforms.
SDK的语言比如可以包括C、C++等语言,当然具体不限于此,其他可支持不同操作系统的语言亦可。The language of the SDK may include languages such as C, C++, etc., of course, it is not limited to this, and other languages that can support different operating systems are also possible.
本发明实施例中,SDK上接口的语言优选为C语言,由于C++具有重载等特性,容易产生重命名的问题,使用C语言编写接口可以避免函数重命名的问题,保证接口名称的唯一性,避免调用错误。In the embodiment of the present invention, the language of the interface on the SDK is preferably C language. Because C++ has the characteristics of overloading, it is easy to cause renaming problems. Using C language to write interfaces can avoid the problem of function renaming and ensure the uniqueness of interface names. To avoid calling errors.
在一个实施例中,所述SDK的语言与所述SDK集成的功能模块的语言相同。SDK和功能模块的语言相同,使得SDK与功能模块之间的调用接口更容易编写,可以更方便地实现功能模块的调用。In one embodiment, the language of the SDK is the same as the language of the functional module integrated by the SDK. The language of the SDK and the function module is the same, which makes the calling interface between the SDK and the function module easier to write, and the function module can be called more conveniently.
SDK和SDK集成的功能模块的语言比如可以均为C或C++等语言,SDK和功能模块的语言均支持不同操作系统,保证APP整体实现跨平台。The language of the functional modules integrated by the SDK and SDK can be C or C++, etc. The languages of the SDK and functional modules support different operating systems to ensure that the entire APP is cross-platform.
在一个实施例中,所述SDK集成了多个不同的功能模块。如此,可以为引擎扩展更多的功能。In one embodiment, the SDK integrates multiple different functional modules. In this way, more functions can be extended for the engine.
这些功能模块可以是同一库中的功能模块,也可以是不同库中的功能模块。当然,也不排除SDK仅集成一个功能模块的情况。These functional modules can be functional modules in the same library or functional modules in different libraries. Of course, it does not rule out that the SDK integrates only one functional module.
本发明实施例第二方面提供一种功能模块的调用方法,应用于电子设备,所述电子设备上安装有跨平台软件开发引擎、及软件开发工具包SDK;The second aspect of the embodiments of the present invention provides a method for invoking a function module, which is applied to an electronic device on which a cross-platform software development engine and a software development kit SDK are installed;
参看图3,在一个实施例中,该功能模块的调用方法包括以下步骤:Referring to Figure 3, in one embodiment, the calling method of the function module includes the following steps:
T100:在需调用目标功能模块时,所述引擎触发事件,所述事件与所述目标功能模块相关;T100: When a target function module needs to be called, the engine triggers an event, and the event is related to the target function module;
T200:所述引擎通过预置的事件接口将所述事件传输至所述SDK,所述事件接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的所述事件从所述SDK集成的功能模块中调用所述目标功能模块。T200: The engine transmits the event to the SDK through a preset event interface. The event interface is the interface between the SDK and the engine, so that the SDK receives the event from The target function module is called from the function module integrated by the SDK.
本实施例中,功能模块的调用方法的执行主体可以为电子设备,进一步地可以为电子设备的处理器,其中,所述处理器可以为一个或多个,所述处理器可以为通用处理器或者专用处理器。电子设备具体类型不限,比如可以额是计算机设备、移动设备等。电子设备上安装有跨平台软件开发引擎、及软件开发工具包SDK。In this embodiment, the execution subject of the calling method of the function module may be an electronic device, and further may be a processor of the electronic device, where the processor may be one or more, and the processor may be a general-purpose processor. Or a dedicated processor. The specific type of electronic equipment is not limited, such as computer equipment, mobile equipment, etc. A cross-platform software development engine and a software development kit SDK are installed on the electronic device.
步骤T100中,在需调用目标功能模块时,所述引擎触发事件,所述事件与所述目标功能模块相关。In step T100, when the target function module needs to be called, the engine triggers an event, and the event is related to the target function module.
引擎在需要调用目标功能模块时,会触发与目标功能模块相关的事件,以事件形式通知SDK需要调用目标功能模块。When the engine needs to call the target function module, it will trigger an event related to the target function module, and notify the SDK in the form of an event that the target function module needs to be called.
步骤T200中,所述引擎通过预置的事件接口将所述事件传输至所述SDK,所述事件接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的所述事件从所述SDK集成的功能模块中调用所述目标功能模块。In step T200, the engine transmits the event to the SDK through a preset event interface. The event interface is an interface between the SDK and the engine, so that the SDK depends on the received The event calls the target function module from the function module integrated by the SDK.
事件是通过引擎和SDK之间的事件接口传输的,事件接口可以包括引擎上用于发送事件的事件发送接口和SDK上用于接收事件的事件接收接口。Events are transmitted through the event interface between the engine and the SDK. The event interface may include an event sending interface on the engine for sending events and an event receiving interface on the SDK for receiving events.
参看图2,事件接口可以包括事件发送接口501和事件接收接口601,通过事件发送接口501和事件接收接口601可实现引擎50与SDK 60之间的事 件传输。引擎50在触发一个事件时,会通过事件发送接口501发送该事件,SDK 60通过事件接收接口601接收该事件。Referring to FIG. 2, the event interface may include an event sending interface 501 and an event receiving interface 601. Event transmission between the engine 50 and the SDK 60 can be realized through the event sending interface 501 and the event receiving interface 601. When the engine 50 triggers an event, it will send the event through the event sending interface 501, and the SDK 60 will receive the event through the event receiving interface 601.
事件接口可以在开发APP时预先在引擎和SDK中配置好。所有与功能模块相关的事件均可通过引擎和SDK之间的事件接口进行传输,换言之,无论是第三方库还是自定义库中的功能模块,均可通过同一事件接口来通知SDK调用,无需在引擎中为每个库的功能模块配置一个对应的接口,大大减少了引擎中所需的接口数量。The event interface can be configured in the engine and SDK in advance when developing the APP. All events related to the function module can be transmitted through the event interface between the engine and the SDK. In other words, whether it is a third-party library or a function module in a custom library, the SDK can be notified through the same event interface. The engine is configured with a corresponding interface for each library function module, which greatly reduces the number of interfaces required in the engine.
SDK中可以集成多个不同的库,每个库中可以包含一个或两个以上的功能模块,当然,也可以只集成一个库,具体并不做限定。SDK是软件工具包,通常自带有一些功能模块库。Multiple different libraries can be integrated in the SDK, and each library can contain one or more than two functional modules. Of course, it is also possible to integrate only one library, which is not limited. SDK is a software toolkit, usually comes with some function module libraries.
本实施例中,SDK集成的功能模块可以包括SDK自带的功能模块,也可以包括预先(比如在APP开发过程时)添加到SDK中的功能模块。当前,也不排除后续如果APP需要更多的功能时,将新功能模块加入到SDK中的可能性。SDK及其集成的功能模块的语言可以是适合于底层开发的语言,可以支持跨平台使用,比如可以是C或C++等语言。In this embodiment, the function modules integrated by the SDK may include the function modules that the SDK comes with, or may include the function modules that are added to the SDK in advance (for example, during the APP development process). At present, it is not ruled out that if the APP needs more functions in the future, the possibility of adding new function modules to the SDK. The language of the SDK and its integrated functional modules can be a language suitable for underlying development and can support cross-platform use, for example, it can be a language such as C or C++.
SDK在收到来自引擎传输的事件时,由于事件与目标功能模块相关,所以可依据事件从SDK集成的所有功能模块中确定并调用目标功能模块。SDK中可以配置有各个库的功能模块的调用接口,通过目标功能模块的调用接口来调用目标功能模块。When the SDK receives an event transmitted from the engine, since the event is related to the target function module, it can determine and call the target function module from all the function modules integrated by the SDK according to the event. The SDK can be configured with the calling interface of the function modules of each library, and the target function module can be called through the calling interface of the target function module.
目标功能模块被调用后实现相应的功能。比如,需要目标对象加速时,引擎会触发与加速功能模块相关的事件并将事件发送给SDK,SDK收到事件后会依据事件调用加速功能模块,以实现目标对象的加速。The target function module is called to realize the corresponding function. For example, when the target object needs to be accelerated, the engine will trigger an event related to the acceleration function module and send the event to the SDK. After receiving the event, the SDK will call the acceleration function module according to the event to achieve the acceleration of the target object.
本发明实施例中,可通过事件机制由引擎通知SDK调用功能模块,引擎可在需要调用目标功能模块时,通过引擎与SDK之间事件接口将与目标功能模块相关的事件传输给SDK,SDK依据该事件从SDK集成的功能模块中调用该目标功能模块,无需在引擎中为每个库的功能模块配置相应调用接口,不但减少了引擎中所需的接口,避免引擎中引入大量调用功能模块的接口导 致接口维护较为困难的问题,而且功能模块集成在SDK中,避免了引擎需管理大量库的问题。In the embodiment of the present invention, the engine can notify the SDK to call the function module through the event mechanism. When the engine needs to call the target function module, the event related to the target function module can be transmitted to the SDK through the event interface between the engine and the SDK. This event calls the target function module from the function module integrated by the SDK. There is no need to configure the corresponding call interface for each library function module in the engine. This not only reduces the interface required in the engine, but also avoids the introduction of a large number of calling function modules in the engine. The interface causes the problem of difficulty in interface maintenance, and the function module is integrated in the SDK, which avoids the problem of the engine needing to manage a large number of libraries.
在一个实施例中,所述事件具有记录所述事件所属类型信息的类型字段。In one embodiment, the event has a type field that records type information to which the event belongs.
引擎在触发事件时,可在事件的类型字段上写入该事件的类型信息,类型信息一方面表明了事件的类型,另一方面可用于确定目标功能模块。SDK收到事件后,可根据事件的类型字段上的类型信息确定并调用目标功能模块。When the engine triggers an event, it can write the type information of the event in the type field of the event. On the one hand, the type information indicates the type of the event, and on the other hand, it can be used to determine the target function module. After the SDK receives the event, it can determine and call the target function module according to the type information on the type field of the event.
目标功能模块与该事件中的类型信息之间可以具有直接或间接的对应关系,如此,SDK可以根据类型信息确定与类型信息对应的目标功能模块,并调用该目标功能模块。当然,此处仅是举例,具体的调用方式不限,只要能够实现依据类型信息调用目标功能模块即可。There may be a direct or indirect correspondence between the target function module and the type information in the event. In this way, the SDK can determine the target function module corresponding to the type information according to the type information, and call the target function module. Of course, this is only an example, and the specific calling method is not limited, as long as the target function module can be called based on the type information.
类型字段的位数可以自定义,可以根据所有事件类型的数量来确定,比如可以为32位、64位等,具体位数不限。事件上可以只具有类型字段,当然还可以具有其他的字段,具体可以根据需要而定。The number of bits in the type field can be customized and can be determined according to the number of all event types, such as 32 bits, 64 bits, etc., and the specific number of bits is not limited. The event can only have the type field, of course, can also have other fields, which can be determined according to needs.
在一个实施例中,所述类型字段包括第一字段和第二字段;In an embodiment, the type field includes a first field and a second field;
所述第一字段上记录了所述事件所属的目标总类型信息,所述第二字段上记录了所述目标总类型信息的所有子类型信息中所述事件所属的目标子类型信息。The first field records the target total type information to which the event belongs, and the second field records the target subtype information to which the event belongs among all subtype information of the target total type information.
将类型字段划分成第一字段和第二字段,第一字段和第二字段分别用来记录事件的目标总类型信息和目标子类型信息。比如,可以将类型字段的高32位作为第一字段,将低32位作为第二字段,当然,如何分配类型字段可根据需要而定。The type field is divided into a first field and a second field. The first field and the second field are used to record the target total type information and target subtype information of the event, respectively. For example, the upper 32 bits of the type field can be used as the first field, and the lower 32 bits can be used as the second field. Of course, how to allocate the type field can be determined according to needs.
将所有事件类型先进行大类划分,划分出几个总类型,再对每个总类型进行小类划分,进一步划分出总类型下的几个子类型,根据目标总类型信息可以确定事件所属的总类型,根据目标子类型信息进而可以确定该总类型下事件所属的子类型。当然,具体如何对事件类型进行分类并不作为限制。Divide all event types into major categories first, divide into several general categories, and then divide each general category into sub-categories, and further divide into several sub-types under the general category. According to the target general category information, the general category to which the event belongs can be determined. Type, according to the target subtype information, the subtype to which the event belongs to the total type can be determined. Of course, how to classify event types is not a limitation.
本实施例中,以总类型和子类型的分类方式对所有事件进行归类,可以分级地确定事件类型,便于确定事件类型,以便快速调用目标功能模块。In this embodiment, all events are classified in a classification manner of total type and sub-type, and the event type can be determined hierarchically, which is convenient for determining the event type so as to quickly call the target function module.
在一个实施例中,所述引擎触发事件之前,该方法还包括:In an embodiment, before the engine triggers an event, the method further includes:
在需创建SDK管理对象时,所述引擎通过预置的对象管理接口传输创建消息至所述SDK,所述创建消息用于指示创建SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象管理接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的创建消息创建SDK管理对象。When the SDK management object needs to be created, the engine transmits a creation message to the SDK through the preset object management interface. The creation message is used to instruct the creation of the SDK management object, and the SDK management object is used to manage the call to the function module. The object management interface is an interface between the SDK and the engine, so that the SDK creates an SDK management object according to the received creation message.
引擎和SDK之间具有对象管理接口,对象管理接口可包括引擎上用于发送消息的第一消息发送接口及SDK上用于接收消息的第一消息接收接口(图2中未示出)。引擎可通过第一消息发送接口发送创建消息给SDK,SDK可通过第一消息接收接口接收来自引擎的创建消息。There is an object management interface between the engine and the SDK, and the object management interface may include a first message sending interface on the engine for sending messages and a first message receiving interface on the SDK for receiving messages (not shown in FIG. 2). The engine can send a creation message to the SDK through the first message sending interface, and the SDK can receive the creation message from the engine through the first message receiving interface.
创建消息用于指示创建SDK管理对象,SDK收到创建消息后,可依据该创建消息创建SDK管理对象。SDK管理对象可以为一个或者两个以上,用于管理调用功能模块所需的对象,比如管理各个事件处理对象。The creation message is used to instruct the creation of the SDK management object. After the SDK receives the creation message, it can create the SDK management object based on the creation message. The SDK management objects can be one or more than two, which are used to manage the objects required to call the function module, such as managing various event processing objects.
本实施例中,SDK管理对象管理事件处理对象,事实上就是管理功能模块,通过对象管理接口传输创建消息来创建SDK管理对象,可便于各个事件处理对象、功能模块的管理,减轻了引擎所需的管理工作。In this embodiment, the SDK management object manages the event processing object, which is actually the management function module. The creation message is transmitted through the object management interface to create the SDK management object, which facilitates the management of each event processing object and function module, and reduces the need for the engine Management work.
当然,对象管理接口还可用于传输其他消息,比如用于指示销毁SDK管理对象的销毁消息,引擎可通过第一消息发送接口发送销毁消息给SDK,SDK可通过第一消息接收接口接收来自引擎的销毁消息、并根据销毁消息销毁已创建的SDK管理对象。Of course, the object management interface can also be used to transmit other messages, such as the destruction message used to instruct the destruction of the SDK management object. The engine can send the destruction message to the SDK through the first message sending interface, and the SDK can receive the message from the engine through the first message receiving interface. Destroy the message and destroy the created SDK management object according to the destruction message.
在一个实施例中,所述引擎触发事件之前,该方法还包括:In an embodiment, before the engine triggers an event, the method further includes:
在需初始化SDK管理对象时,所述引擎通过预置的对象初始化接口传输初始化消息至所述SDK,所述初始化消息用于指示初始化SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象初始化接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的初始化消息初始化SDK管理对象。When the SDK management object needs to be initialized, the engine transmits an initialization message to the SDK through the preset object initialization interface. The initialization message is used to instruct to initialize the SDK management object, and the SDK management object is used to manage the call function module. The object initialization interface is an interface between the SDK and the engine, so that the SDK initializes the SDK management object according to the received initialization message.
引擎和SDK之间具有对象初始化接口,对象初始化接口可包括引擎上用 于发送消息的第二消息发送接口及SDK上用于接收消息的第二消息接收接口(图2中未示出)。引擎可通过第二消息发送接口发送初始化消息给SDK,SDK可通过第二消息接收接口接收来自引擎的初始化消息。There is an object initialization interface between the engine and the SDK. The object initialization interface can include a second message sending interface on the engine for sending messages and a second message receiving interface on the SDK for receiving messages (not shown in Figure 2). The engine can send an initialization message to the SDK through the second message sending interface, and the SDK can receive the initialization message from the engine through the second message receiving interface.
初始化消息用于指示初始化SDK管理对象,SDK收到初始化消息后,可依据该初始化消息初始化已创建的SDK管理对象。SDK管理对象的初始化状态可根据需要进行定义。The initialization message is used to indicate the initialization of the SDK management object. After the SDK receives the initialization message, it can initialize the created SDK management object according to the initialization message. The initialization state of the SDK management object can be defined as required.
本实施例中,引擎可通过初始化消息来通知SDK初始化SDK管理对象,使得初始化操作更为方便。In this embodiment, the engine can notify the SDK to initialize the SDK management object through an initialization message, which makes the initialization operation more convenient.
在一个实施例中,所述引擎通过预置的事件接口将所述事件传输至所述SDK之后,该方法还包括:In an embodiment, after the engine transmits the event to the SDK through a preset event interface, the method further includes:
所述引擎通过预置的回调接口接收来自所述SDK传输的目标执行结果,所述目标执行结果是调用所述目标功能模块所得的执行结果;所述回调接口是所述SDK与所述引擎之间的接口,用于将所述SDK调用各功能模块所得的执行结果传输至所述引擎。The engine receives the target execution result transmitted from the SDK through a preset callback interface. The target execution result is the execution result obtained by invoking the target function module; the callback interface is the one between the SDK and the engine. The inter-interface is used to transmit the execution result obtained by the SDK invoking each function module to the engine.
引擎和SDK之间具有回调接口,回调接口可包括SDK上用于发送执行结果的结果发送接口、引擎上用于接收执行结果的结果接收接口。SDK在调用目标功能模块后,可通过结果发送接口将调用所得的目标执行结果发送给引擎,引擎通过结果接收接口接收目标执行结果。There is a callback interface between the engine and the SDK. The callback interface can include a result sending interface on the SDK for sending execution results, and a result receiving interface on the engine for receiving execution results. After the SDK calls the target function module, it can send the target execution result obtained from the call to the engine through the result sending interface, and the engine receives the target execution result through the result receiving interface.
继续参看图2,回调接口包括结果发送接口602和结果接收接口502,通过结果发送接口602和结果接收接口502可以实现SDK 60与引擎50之间的执行结果的传输。SDK 60在调用完一个功能模块时可以得到执行结果,通过结果发送接口602将执行结果发送给引擎50,引擎50通过结果接收接口接收执行结果。Continuing to refer to FIG. 2, the callback interface includes a result sending interface 602 and a result receiving interface 502. Through the result sending interface 602 and the result receiving interface 502, the transmission of the execution result between the SDK 60 and the engine 50 can be realized. The SDK 60 can obtain the execution result after calling a function module, and sends the execution result to the engine 50 through the result sending interface 602, and the engine 50 receives the execution result through the result receiving interface.
引擎在收到目标执行结果后,可以对目标执行结果进行提示、或依据目标执行结果进行下一步的事务处理等,实现所需的功能。After the engine receives the target execution result, it can prompt for the target execution result, or perform the next transaction processing according to the target execution result to realize the required functions.
在一个实施例中,所述引擎触发事件之前,该方法还包括:In an embodiment, before the engine triggers an event, the method further includes:
所述引擎接收指令;The engine receives instructions;
当接收到调用指令时,所述调用指令用于指示需调用的目标功能模块,所述引擎确定需调用目标功能模块。When a call instruction is received, the call instruction is used to indicate the target function module to be called, and the engine determines that the target function module needs to be called.
本实施例中,事件可由调用指令触发,调用指令可以是由外部用户输入的,或者可以是电子设备在执行过程中产生的,具体不作限定。只要是收到了指示需调用的目标功能模块的调用指令,便可确定需调用目标功能模块,执行步骤T100。In this embodiment, the event may be triggered by a call instruction, which may be input by an external user, or may be generated during the execution of the electronic device, which is not specifically limited. As long as the call instruction indicating the target function module to be called is received, it can be determined that the target function module needs to be called, and step T100 is executed.
在一个实施例中,所述引擎通过预置的事件接口将所述事件传输至所述SDK,包括:In one embodiment, the engine transmits the event to the SDK through a preset event interface, including:
所述引擎依据所述调用指令确定用于标识所述调用指令的标识符;Determining, by the engine, an identifier for identifying the calling instruction according to the calling instruction;
所述引擎将所述标识符携带在所述事件中并通过所述事件接口传输至所述SDK,以使所述SDK将所述标识符携带在目标执行结果中并通过所述回调接口传输至所述引擎。The engine carries the identifier in the event and transmits it to the SDK through the event interface, so that the SDK carries the identifier in the target execution result and transmits it to the target through the callback interface The engine.
在电子设备上多次操作同一按键可以触发多个调用指令,比如,在同一加速键上操作两次,会进行两次加速,而两次加速的基础速度不同,所以即使调用同一功能模块,所得的执行结果也可能并不相同。为了使得引擎及SDK能够区分每次的调用指令,为每个调用指令确定了一个标识符。Operating the same button multiple times on an electronic device can trigger multiple call instructions. For example, operating the same accelerator key twice will accelerate twice, but the basic speed of the two accelerations is different, so even if the same function module is called, the result The results of the implementation may also be different. In order to enable the engine and SDK to distinguish each call instruction, an identifier is determined for each call instruction.
在事件中携带标识调用指令的标识符,使得SDK可依据标识符区分触发事件的调用指令;在SDK返回的执行结果中也携带该标识符,使得引擎可以依据标识符确定该执行结果所对应的调用指令,以正确地对执行结果进行提示或进一步处理。The event carries an identifier that identifies the call instruction, so that the SDK can distinguish the call instruction that triggered the event based on the identifier; the execution result returned by the SDK also carries the identifier, so that the engine can determine the corresponding execution result based on the identifier Call the instruction to correctly prompt or further process the execution result.
基于前述实施例中的描述,目标消息处理对象在将目标子类型信息传入到对应的目标事件处理对象时,还可将标识符传入目标事件处理对象,在得到目标执行结果时,还将标识符携带在目标执行结果,SDK将携带了标识符的目标执行结果传输给引擎。Based on the description in the foregoing embodiment, when the target message processing object passes the target subtype information to the corresponding target event processing object, it can also pass the identifier into the target event processing object, and when the target execution result is obtained, it will also The identifier is carried in the target execution result, and the SDK transmits the target execution result carrying the identifier to the engine.
在一个实施例中,所述指令携带有与所述事件相关的数据;In one embodiment, the instruction carries data related to the event;
所述引擎通过预置的事件接口将所述事件传输至所述SDK,包括:The engine transmits the event to the SDK through a preset event interface, including:
所述引擎从所述调用指令中获取所述数据;The engine obtains the data from the call instruction;
所述引擎将所述数据携带在所述事件中并通过所述事件接口传输至所述SDK,以使所述SDK将所述数据输入至所述目标功能模块中。The engine carries the data in the event and transmits it to the SDK through the event interface, so that the SDK inputs the data into the target function module.
调用指令中会携带目标功能模块运行所需的数据,从其中获取数据后,将获取的数据携带在事件中,并通过事件接口将携带了数据的事件传输至SDK。The call instruction will carry the data required for the operation of the target function module. After the data is obtained from it, the obtained data is carried in the event, and the event carrying the data is transmitted to the SDK through the event interface.
事件中携带的数据是目标功能模块运行所需的数据,具体每个功能模块所需的数据不同,可以根据实际需要而定。The data carried in the event is the data required for the operation of the target function module. The specific data required by each function module is different and can be determined according to actual needs.
SDK将事件携带的数据作为传参输入到目标功能模块后,目标功能模块依据输入的数据执行相应的处理。当然,也不排除一些功能模块在运行时不需要输入数据的情况,此时,事件中也可以不携带相关数据。After the SDK inputs the data carried by the event as a parameter to the target function module, the target function module performs corresponding processing according to the input data. Of course, it is not ruled out that some functional modules do not need to input data during operation. At this time, the event may not carry relevant data.
在一个实施例中,所述SDK的语言支持本设备的操作系统,并且所述SDK支持与本设备的操作系统不同的操作系统。In one embodiment, the language of the SDK supports the operating system of the device, and the SDK supports an operating system different from the operating system of the device.
换言之,SDK的语言可以支持两个以上的操作系统,当然其中包括作为本发明实施例执行主体的电子设备的操作系统,如此,可以保证SDK能够跨平台使用。In other words, the language of the SDK can support more than two operating systems, of course, including the operating system of the electronic device that is the execution subject of the embodiment of the present invention. In this way, the SDK can be used across platforms.
SDK的语言比如可以包括C、C++等语言,当然具体不限于此,其他可支持不同操作系统的语言亦可。The language of the SDK may include languages such as C, C++, etc., of course, it is not limited to this, and other languages that can support different operating systems are also possible.
本发明实施例中,SDK上接口的语言优选为C语言,由于C++具有重载等特性,容易产生重命名的问题,使用C语言编写接口可以避免函数重命名的问题,保证接口名称的唯一性,避免调用错误。In the embodiment of the present invention, the language of the interface on the SDK is preferably C language. Because C++ has the characteristics of overloading, it is easy to cause renaming problems. Using C language to write interfaces can avoid the problem of function renaming and ensure the uniqueness of interface names. To avoid calling errors.
在一个实施例中,所述SDK的语言与所述SDK集成的功能模块的语言相同。SDK和功能模块的语言相同,使得SDK与功能模块之间的调用接口更容易编写,可以更方便地实现功能模块的调用。In one embodiment, the language of the SDK is the same as the language of the functional module integrated by the SDK. The language of the SDK and the function module is the same, which makes the calling interface between the SDK and the function module easier to write, and the function module can be called more conveniently.
SDK和SDK集成的功能模块的语言比如可以均为C或C++等语言,SDK和功能模块的语言均支持不同操作系统,保证APP整体实现跨平台。The language of the functional modules integrated by the SDK and SDK can be C or C++, etc. The languages of the SDK and functional modules support different operating systems to ensure that the entire APP is cross-platform.
在一个实施例中,所述SDK集成了多个不同的功能模块。如此,可以为引擎扩展更多的功能。In one embodiment, the SDK integrates multiple different functional modules. In this way, more functions can be extended for the engine.
这些功能模块可以是同一库中的功能模块,也可以是不同库中的功能模块。当然,也不排除SDK仅集成一个功能模块的情况。These functional modules can be functional modules in the same library or functional modules in different libraries. Of course, it does not rule out that the SDK integrates only one functional module.
本发明实施例第三方面提供一种电子设备,所述电子设备上安装有跨平台软件开发引擎、及软件开发工具包SDK。A third aspect of the embodiments of the present invention provides an electronic device, on which a cross-platform software development engine and a software development kit SDK are installed.
参看图4,在一个实施例中,所述电子设备100包括:存储器101和处理器102。所述存储器101用于存储程序代码。所述处理器102用于调用所述程序代码,当程序代码被执行时,用于执行以下操作:Referring to FIG. 4, in one embodiment, the electronic device 100 includes: a memory 101 and a processor 102. The memory 101 is used to store program codes. The processor 102 is used to call the program code, and when the program code is executed, it is used to perform the following operations:
利用所述SDK通过预置的事件接口接收到来自所述引擎传输的事件,所述事件与需调用的目标功能模块相关,所述事件接口是所述SDK与所述引擎之间的接口;Use the SDK to receive an event transmitted from the engine through a preset event interface, the event is related to the target function module to be called, and the event interface is an interface between the SDK and the engine;
利用所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块。Use the SDK to call the target function module from the function modules integrated by the SDK according to the event.
在一个实施例中,所述事件具有记录所述事件所属类型信息的类型字段;In an embodiment, the event has a type field that records type information to which the event belongs;
所述处理器利用所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块时,具体用于:When the processor uses the SDK to call the target function module from the function module integrated by the SDK according to the event, it is specifically used to:
利用所述SDK解析所述事件的类型字段;Parse the type field of the event by using the SDK;
利用所述SDK依据解析出的类型信息从所述SDK集成的功能模块中调用所述目标功能模块。The SDK is used to call the target function module from the function module integrated by the SDK according to the parsed type information.
在一个实施例中,所述类型字段包括第一字段和第二字段;In an embodiment, the type field includes a first field and a second field;
所述第一字段上记录了所述事件所属的目标总类型信息,所述第二字段上记录了所述目标总类型信息的所有子类型信息中所述事件所属的目标子类型信息;The first field records the target total type information to which the event belongs, and the second field records the target subtype information to which the event belongs among all subtype information of the target total type information;
所述处理器利用所述SDK依据解析出的类型信息从所述SDK集成的功能模块中调用所述目标功能模块时,具体用于:When the processor uses the SDK to call the target function module from the function module integrated with the SDK according to the type information parsed by the SDK, it is specifically used to:
利用所述SDK依据所述目标总类型信息与目标子类型信息调用所述目标功能模块。Using the SDK to call the target function module according to the target total type information and target subtype information.
在一个实施例中,In one embodiment,
所述处理器利用所述SDK依据所述目标总类型信息与目标子类型信息调用所述目标功能模块时,具体用于:When the processor uses the SDK to call the target function module according to the target total type information and target subtype information, it is specifically configured to:
利用所述SDK调用与所述目标总类型信息对应的目标消息处理对象,以利用所述目标消息处理对象确定与所述目标子类型信息对应的目标事件处理对象;Calling the target message processing object corresponding to the target total type information by using the SDK, so as to use the target message processing object to determine the target event processing object corresponding to the target subtype information;
利用所述SDK调用所述目标事件处理对象,以利用所述目标事件处理对象确定与所述目标子类型信息对应的功能模块;Using the SDK to call the target event processing object, so as to use the target event processing object to determine the functional module corresponding to the target subtype information;
利用所述SDK将确定出的功能模块作为目标功能模块并调用所述目标功能模块。Use the SDK to take the determined function module as the target function module and call the target function module.
在一个实施例中,所述处理器利用SDK通过预置的事件接口接收到来自所述引擎传输的事件之前,还用于:In an embodiment, before the processor receives an event transmitted from the engine through a preset event interface using the SDK, it is further used to:
利用所述SDK通过预置的对象管理接口接收所述引擎传输的创建消息,所述创建消息用于指示创建SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象管理接口是所述SDK与所述引擎之间的接口;Use the SDK to receive a creation message transmitted by the engine through a preset object management interface, the creation message is used to instruct the creation of an SDK management object, and the SDK management object is used to manage objects required for invoking a function module. The object management interface is the interface between the SDK and the engine;
利用所述SDK依据所述创建消息创建SDK管理对象。Use the SDK to create an SDK management object according to the creation message.
在一个实施例中,所述处理器利用所述SDK通过预置的事件接口接收到来自所述引擎传输的事件之前,还用于:In one embodiment, before the processor uses the SDK to receive the event transmitted from the engine through a preset event interface, it is further configured to:
利用所述SDK通过预置的对象初始化接口接收所述引擎传输的初始化消息,所述初始化消息用于指示初始化SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象初始化接口是所述SDK与所述引擎之间的接口;The SDK is used to receive the initialization message transmitted by the engine through a preset object initialization interface. The initialization message is used to instruct to initialize the SDK management object. The SDK management object is used to manage the objects required to call the function module. The object initialization interface is the interface between the SDK and the engine;
利用所述SDK依据所述初始化消息初始化SDK管理对象。Use the SDK to initialize the SDK management object according to the initialization message.
在一个实施例中,所述处理器利用所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块之后,还用于:In an embodiment, after the processor uses the SDK to call the target function module from the function module integrated by the SDK according to the event, it is further configured to:
利用所述SDK获取调用所述目标功能模块所得的目标执行结果;Using the SDK to obtain the target execution result obtained by invoking the target function module;
利用所述SDK通过预置的回调接口将所述目标执行结果传输至所述引擎;所述回调接口是所述SDK与所述引擎之间的接口,用于将所述SDK调用各功能模块所得的执行结果传输至所述引擎。Use the SDK to transmit the target execution result to the engine through a preset callback interface; the callback interface is the interface between the SDK and the engine, and is used to call the SDK into various functional modules. The execution result of is transmitted to the engine.
在一个实施例中,In one embodiment,
所述事件是所述引擎在收到指示需调用的目标功能模块的调用指令时触发的,所述事件还携带有用于标识所述调用指令的标识符;The event is triggered when the engine receives a call instruction indicating the target function module to be called, and the event also carries an identifier for identifying the call instruction;
所述处理器利用所述SDK通过预置的回调接口将所述目标执行结果传输至所述引擎时,具体用于:When the processor uses the SDK to transmit the target execution result to the engine through a preset callback interface, it is specifically used to:
利用所述SDK从所述事件中获取标识符;Use the SDK to obtain an identifier from the event;
利用所述SDK将所述标识符携带在目标执行结果中并通过所述回调接口传输至所述引擎。The SDK is used to carry the identifier in the target execution result and is transmitted to the engine through the callback interface.
在一个实施例中,In one embodiment,
所述事件携带有与所述事件相关的数据;The event carries data related to the event;
所述处理器利用所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块时,还用于:When the processor uses the SDK to call the target function module from the function module integrated by the SDK according to the event, it is also used to:
利用所述SDK将所述数据输入至所述目标功能模块中,以使所述目标功能模块依据所述数据执行处理。Use the SDK to input the data into the target function module, so that the target function module executes processing according to the data.
在一个实施例中,所述SDK的语言支持本设备的操作系统,并且所述SDK支持与本设备的操作系统不同的操作系统。In one embodiment, the language of the SDK supports the operating system of the device, and the SDK supports an operating system different from the operating system of the device.
在一个实施例中,所述SDK的语言与所述SDK集成的功能模块的语言相同。In one embodiment, the language of the SDK is the same as the language of the functional module integrated by the SDK.
在一个实施例中,所述SDK集成了多个不同的功能模块。In one embodiment, the SDK integrates multiple different functional modules.
关于本发明实施例第三方面提供的电子设备的具体内容可参看本发明实施例第一方面提供的功能模块的调用方法中的描述内容,在此不再赘述。For the specific content of the electronic device provided in the third aspect of the embodiment of the present invention, please refer to the description content in the method for invoking a function module provided in the first aspect of the embodiment of the present invention, which is not repeated here.
本发明实施例第四方面提供一种电子设备,所述电子设备上安装有跨平台软件开发引擎、及软件开发工具包SDK。A fourth aspect of the embodiments of the present invention provides an electronic device, on which a cross-platform software development engine and a software development kit SDK are installed.
参看图4,在一个实施例中,所述电子设备100包括:存储器101和处理器102。所述存储器101用于存储程序代码。所述处理器102用于调用所述程序代码,当程序代码被执行时,用于执行以下操作:Referring to FIG. 4, in one embodiment, the electronic device 100 includes: a memory 101 and a processor 102. The memory 101 is used to store program codes. The processor 102 is used to call the program code, and when the program code is executed, it is used to perform the following operations:
在需调用目标功能模块时,利用所述引擎触发事件,所述事件与所述目标功能模块相关;When a target function module needs to be called, use the engine to trigger an event, and the event is related to the target function module;
利用所述引擎通过预置的事件接口将所述事件传输至所述SDK,所述事件接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的所述事件从所述SDK集成的功能模块中调用所述目标功能模块。Use the engine to transmit the event to the SDK through a preset event interface. The event interface is the interface between the SDK and the engine, so that the SDK receives the event from the The target function module is called from the function module integrated by the SDK.
在一个实施例中,所述事件具有记录所述事件所属类型信息的类型字段。In one embodiment, the event has a type field that records type information to which the event belongs.
在一个实施例中,所述类型字段包括第一字段和第二字段;In an embodiment, the type field includes a first field and a second field;
所述第一字段上记录了所述事件所属的目标总类型信息,所述第二字段上记录了所述目标总类型信息的所有子类型信息中所述事件所属的目标子类型信息。The first field records the target total type information to which the event belongs, and the second field records the target subtype information to which the event belongs among all subtype information of the target total type information.
在一个实施例中,所述处理器利用所述引擎触发事件之前,还用于:In an embodiment, before the processor uses the engine to trigger an event, it is also used to:
在需创建SDK管理对象时,利用所述引擎通过预置的对象管理接口传输创建消息至所述SDK,所述创建消息用于指示创建SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象管理接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的创建消息创建SDK管理对象。When an SDK management object needs to be created, the engine is used to transmit a creation message to the SDK through a preset object management interface. The creation message is used to instruct the creation of the SDK management object, and the SDK management object is used to manage and call function modules. A required object, the object management interface is an interface between the SDK and the engine, so that the SDK creates an SDK management object according to the received creation message.
在一个实施例中,所述处理器利用所述引擎触发事件之前,还用于:In an embodiment, before the processor uses the engine to trigger an event, it is also used to:
在需初始化SDK管理对象时,利用所述引擎通过预置的对象初始化接口传输初始化消息至所述SDK,所述初始化消息用于指示初始化SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象初始化接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的初始化消息初始化SDK管理对象。When the SDK management object needs to be initialized, the engine is used to transmit an initialization message to the SDK through the preset object initialization interface. The initialization message is used to instruct to initialize the SDK management object, and the SDK management object is used to manage and call function modules. The required object, the object initialization interface is an interface between the SDK and the engine, so that the SDK initializes the SDK management object according to the received initialization message.
在一个实施例中,所述处理器利用所述引擎通过预置的事件接口将所述事件传输至所述SDK之后,还用于:In an embodiment, after the processor uses the engine to transmit the event to the SDK through a preset event interface, it is further used to:
利用所述引擎通过预置的回调接口接收来自所述SDK传输的目标执行结果,所述目标执行结果是调用所述目标功能模块所得的执行结果;所述回调接口是所述SDK与所述引擎之间的接口,用于将所述SDK调用各功能模块所得的执行结果传输至所述引擎。Use the engine to receive the target execution result transmitted from the SDK through the preset callback interface, the target execution result is the execution result obtained by calling the target function module; the callback interface is the SDK and the engine The interface between is used to transmit the execution result obtained by the SDK invoking each function module to the engine.
在一个实施例中,所述处理器利用所述引擎触发事件之前,还用于:In an embodiment, before the processor uses the engine to trigger an event, it is also used to:
利用所述引擎接收指令;Use the engine to receive instructions;
当接收到调用指令时,所述调用指令用于指示需调用的目标功能模块,利用所述引擎确定需调用目标功能模块。When a call instruction is received, the call instruction is used to indicate the target function module to be called, and the engine is used to determine the target function module to be called.
在一个实施例中,所述处理器利用所述引擎通过预置的事件接口将所述事件传输至所述SDK时,具体用于:In one embodiment, when the processor uses the engine to transmit the event to the SDK through a preset event interface, it is specifically used to:
利用所述引擎依据所述调用指令确定用于标识所述调用指令的标识符;Using the engine to determine an identifier for identifying the calling instruction according to the calling instruction;
利用所述引擎将所述标识符携带在所述事件中并通过所述事件接口传输至所述SDK,以使所述SDK将所述标识符携带在目标执行结果中并通过所述回调接口传输至所述引擎。Use the engine to carry the identifier in the event and transmit it to the SDK through the event interface, so that the SDK carries the identifier in the target execution result and transmits it through the callback interface To the engine.
在一个实施例中,所述指令携带有与所述事件相关的数据;In one embodiment, the instruction carries data related to the event;
所述处理器利用所述引擎通过预置的事件接口将所述事件传输至所述SDK时,具体用于:When the processor uses the engine to transmit the event to the SDK through a preset event interface, it is specifically used to:
利用所述引擎从所述调用指令中获取所述数据;Obtain the data from the call instruction by using the engine;
利用所述引擎将所述数据携带在所述事件中并通过所述事件接口传输至所述SDK,以使所述SDK将所述数据输入至所述目标功能模块中。The engine is used to carry the data in the event and is transmitted to the SDK through the event interface, so that the SDK inputs the data into the target function module.
在一个实施例中,所述SDK的语言支持本设备的操作系统,并且所述SDK支持与本设备的操作系统不同的操作系统。In one embodiment, the language of the SDK supports the operating system of the device, and the SDK supports an operating system different from the operating system of the device.
在一个实施例中,所述SDK的语言与所述SDK集成的功能模块的语言相同。In one embodiment, the language of the SDK is the same as the language of the functional module integrated by the SDK.
在一个实施例中,所述SDK集成了多个不同的功能模块。In one embodiment, the SDK integrates multiple different functional modules.
关于本发明实施例第四方面提供的电子设备的具体内容可参看本发明实施例第二方面提供的功能模块的调用方法中的描述内容,在此不再赘述。For the specific content of the electronic device provided in the fourth aspect of the embodiment of the present invention, please refer to the description content in the method for invoking a function module provided in the second aspect of the embodiment of the present invention, which is not repeated here.
基于与上述方法同样的发明构思,本发明实施例中还提供一种计算机可读存储介质上存储有计算机指令,所述计算机指令被执行(如所述计算机指令被处理器执行)时,可以实现前述实施例中所述的功能模块的调用方法。Based on the same inventive concept as the above method, an embodiment of the present invention also provides a computer-readable storage medium storing computer instructions, which can be implemented when the computer instructions are executed (for example, the computer instructions are executed by a processor) The calling method of the function module described in the foregoing embodiment.
上述实施例阐明的系统、装置、模块或单元,可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。The systems, devices, modules or units explained in the above embodiments may be implemented by computer chips or entities, or implemented by products with certain functions. A typical implementation device is a computer. The specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email receiving and sending device, and a game control A console, a tablet computer, a wearable device, or a combination of any of these devices.
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本发明时可以把各单元的功能在同一个或多个软件和/或硬件中实现。For the convenience of description, when describing the above device, the functions are divided into various units and described separately. Of course, when implementing the present invention, the functions of each unit can be implemented in the same one or more software and/or hardware.
本领域内的技术人员应明白,本发明实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
本发明是参照依据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可以由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其它可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其它可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowcharts and/or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and/or block in the flowchart and/or block diagram, and the combination of processes and/or blocks in the flowchart and/or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing equipment to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing equipment are generated It is a device that realizes the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
而且,这些计算机程序指令也可以存储在能引导计算机或其它可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一 个流程或者多个流程和/或方框图一个方框或者多个方框中指定的功能。Moreover, these computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device, The instruction device realizes the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可装载到计算机或其它可编程数据处理设备,使得在计算机或者其它可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其它可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded into a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, thereby executing instructions on the computer or other programmable equipment Provides steps for realizing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
以上所述仅为本发明实施例而已,并不用于限制本发明。对于本领域技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原理之内所作的任何修改、等同替换、改进,均应包含在本发明的权利要求范围之内。The above descriptions are only embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, the present invention can have various modifications and changes. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims (49)

  1. 一种功能模块的调用方法,其特征在于,应用于电子设备,所述电子设备上安装有跨平台软件开发引擎、及软件开发工具包SDK;A method for invoking a functional module, which is characterized in that it is applied to an electronic device on which a cross-platform software development engine and a software development kit SDK are installed;
    该方法包括:The method includes:
    所述SDK通过预置的事件接口接收到来自所述引擎传输的事件,所述事件与需调用的目标功能模块相关,所述事件接口是所述SDK与所述引擎之间的接口;The SDK receives an event transmitted from the engine through a preset event interface, the event is related to the target function module to be called, and the event interface is an interface between the SDK and the engine;
    所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块。The SDK calls the target function module from the function modules integrated by the SDK according to the event.
  2. 如权利要求1所述的功能模块的调用方法,其特征在于,所述事件具有记录所述事件所属类型信息的类型字段;The method for invoking a function module according to claim 1, wherein the event has a type field that records type information to which the event belongs;
    所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块,包括:The SDK calling the target function module from the function module integrated by the SDK according to the event includes:
    所述SDK解析所述事件的类型字段;The SDK parses the type field of the event;
    所述SDK依据解析出的类型信息从所述SDK集成的功能模块中调用所述目标功能模块。The SDK calls the target function module from the function modules integrated by the SDK according to the parsed type information.
  3. 如权利要求2所述的功能模块的调用方法,其特征在于,所述类型字段包括第一字段和第二字段;The method for invoking a function module according to claim 2, wherein the type field includes a first field and a second field;
    所述第一字段上记录了所述事件所属的目标总类型信息,所述第二字段上记录了所述目标总类型信息的所有子类型信息中所述事件所属的目标子类型信息;The first field records the target total type information to which the event belongs, and the second field records the target subtype information to which the event belongs among all subtype information of the target total type information;
    所述SDK依据解析出的类型信息从所述SDK集成的功能模块中调用所述目标功能模块,包括:The SDK calls the target function module from the function modules integrated by the SDK according to the parsed type information, including:
    所述SDK依据所述目标总类型信息与目标子类型信息调用所述目标功能模块。The SDK calls the target function module according to the target total type information and target subtype information.
  4. 如权利要求3所述的功能模块的调用方法,其特征在于,The calling method of the function module according to claim 3, characterized in that,
    所述SDK依据所述目标总类型信息与目标子类型信息调用所述目标功能 模块,包括:The SDK calling the target function module according to the target total type information and target subtype information includes:
    所述SDK调用与所述目标总类型信息对应的目标消息处理对象,以利用所述目标消息处理对象确定与所述目标子类型信息对应的目标事件处理对象;The SDK invokes the target message processing object corresponding to the target total type information, so as to use the target message processing object to determine the target event processing object corresponding to the target subtype information;
    所述SDK调用所述目标事件处理对象,以利用所述目标事件处理对象确定与所述目标子类型信息对应的功能模块;The SDK invokes the target event processing object to use the target event processing object to determine the functional module corresponding to the target subtype information;
    所述SDK将确定出的功能模块作为目标功能模块并调用所述目标功能模块。The SDK takes the determined function module as the target function module and calls the target function module.
  5. 如权利要求1所述的功能模块的调用方法,其特征在于,所述SDK通过预置的事件接口接收到来自所述引擎传输的事件之前,该方法还包括:The method for invoking a function module according to claim 1, wherein before the SDK receives the event transmitted from the engine through a preset event interface, the method further comprises:
    所述SDK通过预置的对象管理接口接收所述引擎传输的创建消息,所述创建消息用于指示创建SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象管理接口是所述SDK与所述引擎之间的接口;The SDK receives a creation message transmitted by the engine through a preset object management interface, the creation message is used to instruct the creation of an SDK management object, the SDK management object is used to manage objects required to call a function module, the object The management interface is the interface between the SDK and the engine;
    所述SDK依据所述创建消息创建SDK管理对象。The SDK creates an SDK management object according to the creation message.
  6. 如权利要求1所述的功能模块的调用方法,其特征在于,所述SDK通过预置的事件接口接收到来自所述引擎传输的事件之前,该方法还包括:The method for invoking a function module according to claim 1, wherein before the SDK receives the event transmitted from the engine through a preset event interface, the method further comprises:
    所述SDK通过预置的对象初始化接口接收所述引擎传输的初始化消息,所述初始化消息用于指示初始化SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象初始化接口是所述SDK与所述引擎之间的接口;The SDK receives the initialization message transmitted by the engine through a preset object initialization interface, the initialization message is used to instruct to initialize the SDK management object, the SDK management object is used to manage the objects required to call the function module, the object The initialization interface is the interface between the SDK and the engine;
    所述SDK依据所述初始化消息初始化SDK管理对象。The SDK initializes the SDK management object according to the initialization message.
  7. 如权利要求1所述的功能模块的调用方法,其特征在于,所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块之后,该方法还包括:The method for invoking a function module according to claim 1, wherein after the SDK invokes the target function module from the function module integrated by the SDK according to the event, the method further comprises:
    所述SDK获取调用所述目标功能模块所得的目标执行结果;Acquiring, by the SDK, a target execution result obtained by invoking the target function module;
    所述SDK通过预置的回调接口将所述目标执行结果传输至所述引擎;所述回调接口是所述SDK与所述引擎之间的接口,用于将所述SDK调用各功 能模块所得的执行结果传输至所述引擎。The SDK transmits the target execution result to the engine through a preset callback interface; the callback interface is an interface between the SDK and the engine, and is used to call each function module of the SDK. The execution result is transmitted to the engine.
  8. 如权利要求7所述的功能模块的调用方法,其特征在于,The calling method of the function module according to claim 7, wherein:
    所述事件是所述引擎在收到指示需调用的目标功能模块的调用指令时触发的,所述事件还携带有用于标识所述调用指令的标识符;The event is triggered when the engine receives a call instruction indicating the target function module to be called, and the event also carries an identifier for identifying the call instruction;
    所述SDK通过预置的回调接口将所述目标执行结果传输至所述引擎,包括:The SDK transmits the target execution result to the engine through a preset callback interface, including:
    所述SDK从所述事件中获取标识符;The SDK obtains an identifier from the event;
    所述SDK将所述标识符携带在目标执行结果中并通过所述回调接口传输至所述引擎。The SDK carries the identifier in the target execution result and transmits it to the engine through the callback interface.
  9. 如权利要求1所述的功能模块的调用方法,其特征在于,The calling method of the function module according to claim 1, wherein:
    所述事件携带有与所述事件相关的数据;The event carries data related to the event;
    所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块时,该方法还包括:When the SDK calls the target function module from the function module integrated by the SDK according to the event, the method further includes:
    所述SDK将所述数据输入至所述目标功能模块中,以使所述目标功能模块依据所述数据执行处理。The SDK inputs the data into the target function module, so that the target function module performs processing according to the data.
  10. 如权利要求1-9中任一项所述的功能模块的调用方法,其特征在于,所述SDK的语言支持本设备的操作系统,并且所述SDK支持与本设备的操作系统不同的操作系统。The method for calling a function module according to any one of claims 1-9, wherein the language of the SDK supports the operating system of the device, and the SDK supports an operating system different from the operating system of the device .
  11. 如权利要求1-9中任一项所述的功能模块的调用方法,其特征在于,所述SDK的语言与所述SDK集成的功能模块的语言相同。The method for invoking a function module according to any one of claims 1-9, wherein the language of the SDK is the same as the language of the function module integrated by the SDK.
  12. 如权利要求1-9中任一项所述的功能模块的调用方法,其特征在于,所述SDK集成了多个不同的功能模块。The method for invoking a function module according to any one of claims 1-9, wherein the SDK integrates a plurality of different function modules.
  13. 一种功能模块的调用方法,其特征在于,应用于电子设备,所述电子设备上安装有跨平台软件开发引擎、及软件开发工具包SDK;A method for invoking a functional module, which is characterized in that it is applied to an electronic device on which a cross-platform software development engine and a software development kit SDK are installed;
    该方法包括:The method includes:
    在需调用目标功能模块时,所述引擎触发事件,所述事件与所述目标功能模块相关;When a target function module needs to be called, the engine triggers an event, and the event is related to the target function module;
    所述引擎通过预置的事件接口将所述事件传输至所述SDK,所述事件接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的所述事件从所述SDK集成的功能模块中调用所述目标功能模块。The engine transmits the event to the SDK through a preset event interface. The event interface is an interface between the SDK and the engine, so that the SDK receives the event from the SDK. The target function module is called in the function module integrated by the SDK.
  14. 如权利要求13所述的功能模块的调用方法,其特征在于,所述事件具有记录所述事件所属类型信息的类型字段。The method for invoking a function module according to claim 13, wherein the event has a type field that records type information to which the event belongs.
  15. 如权利要求14所述的功能模块的调用方法,其特征在于,所述类型字段包括第一字段和第二字段;The method for invoking a function module according to claim 14, wherein the type field includes a first field and a second field;
    所述第一字段上记录了所述事件所属的目标总类型信息,所述第二字段上记录了所述目标总类型信息的所有子类型信息中所述事件所属的目标子类型信息。The first field records the target total type information to which the event belongs, and the second field records the target subtype information to which the event belongs among all subtype information of the target total type information.
  16. 如权利要求13所述的功能模块的调用方法,其特征在于,所述引擎触发事件之前,该方法还包括:The method for invoking a function module according to claim 13, wherein before the engine triggers an event, the method further comprises:
    在需创建SDK管理对象时,所述引擎通过预置的对象管理接口传输创建消息至所述SDK,所述创建消息用于指示创建SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象管理接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的创建消息创建SDK管理对象。When the SDK management object needs to be created, the engine transmits a creation message to the SDK through the preset object management interface. The creation message is used to instruct the creation of the SDK management object, and the SDK management object is used to manage the call to the function module. The object management interface is an interface between the SDK and the engine, so that the SDK creates an SDK management object according to the received creation message.
  17. 如权利要求13所述的功能模块的调用方法,其特征在于,所述引擎触发事件之前,该方法还包括:The method for invoking a function module according to claim 13, wherein before the engine triggers an event, the method further comprises:
    在需初始化SDK管理对象时,所述引擎通过预置的对象初始化接口传输初始化消息至所述SDK,所述初始化消息用于指示初始化SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象初始化接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的初始化消息初始化SDK管理对象。When the SDK management object needs to be initialized, the engine transmits an initialization message to the SDK through the preset object initialization interface. The initialization message is used to instruct to initialize the SDK management object, and the SDK management object is used to manage the call function module. The object initialization interface is an interface between the SDK and the engine, so that the SDK initializes the SDK management object according to the received initialization message.
  18. 如权利要求13所述的功能模块的调用方法,其特征在于,所述引擎通过预置的事件接口将所述事件传输至所述SDK之后,该方法还包括:The method for invoking a function module according to claim 13, wherein after the engine transmits the event to the SDK through a preset event interface, the method further comprises:
    所述引擎通过预置的回调接口接收来自所述SDK传输的目标执行结果, 所述目标执行结果是调用所述目标功能模块所得的执行结果;所述回调接口是所述SDK与所述引擎之间的接口,用于将所述SDK调用各功能模块所得的执行结果传输至所述引擎。The engine receives the target execution result transmitted from the SDK through a preset callback interface, and the target execution result is the execution result obtained by calling the target function module; the callback interface is the one between the SDK and the engine The inter-interface is used to transmit the execution result obtained by the SDK invoking each function module to the engine.
  19. 如权利要求18所述的功能模块的调用方法,其特征在于,所述引擎触发事件之前,该方法还包括:The method for invoking a function module according to claim 18, wherein before the engine triggers an event, the method further comprises:
    所述引擎接收指令;The engine receives instructions;
    当接收到调用指令时,所述调用指令用于指示需调用的目标功能模块,所述引擎确定需调用目标功能模块。When a call instruction is received, the call instruction is used to indicate the target function module to be called, and the engine determines that the target function module needs to be called.
  20. 如权利要求19所述的功能模块的调用方法,其特征在于,所述引擎通过预置的事件接口将所述事件传输至所述SDK,包括:The method for invoking a function module according to claim 19, wherein the engine transmits the event to the SDK through a preset event interface, comprising:
    所述引擎依据所述调用指令确定用于标识所述调用指令的标识符;Determining, by the engine, an identifier for identifying the calling instruction according to the calling instruction;
    所述引擎将所述标识符携带在所述事件中并通过所述事件接口传输至所述SDK,以使所述SDK将所述标识符携带在目标执行结果中并通过所述回调接口传输至所述引擎。The engine carries the identifier in the event and transmits it to the SDK through the event interface, so that the SDK carries the identifier in the target execution result and transmits it to the target through the callback interface The engine.
  21. 如权利要求19所述的功能模块的调用方法,其特征在于,所述指令携带有与所述事件相关的数据;The method for invoking a function module according to claim 19, wherein the instruction carries data related to the event;
    所述引擎通过预置的事件接口将所述事件传输至所述SDK,包括:The engine transmits the event to the SDK through a preset event interface, including:
    所述引擎从所述调用指令中获取所述数据;The engine obtains the data from the call instruction;
    所述引擎将所述数据携带在所述事件中并通过所述事件接口传输至所述SDK,以使所述SDK将所述数据输入至所述目标功能模块中。The engine carries the data in the event and transmits it to the SDK through the event interface, so that the SDK inputs the data into the target function module.
  22. 如权利要求13-21中任一项所述的功能模块的调用方法,其特征在于,所述SDK的语言支持本设备的操作系统,并且所述SDK支持与本设备的操作系统不同的操作系统。The method for invoking a function module according to any one of claims 13-21, wherein the language of the SDK supports the operating system of the device, and the SDK supports an operating system different from the operating system of the device .
  23. 如权利要求13-21中任一项所述的功能模块的调用方法,其特征在于,所述SDK的语言与所述SDK集成的功能模块的语言相同。The method for invoking a function module according to any one of claims 13-21, wherein the language of the SDK is the same as the language of the function module integrated by the SDK.
  24. 如权利要求13-21中任一项所述的功能模块的调用方法,其特征在于,所述SDK集成了多个不同的功能模块。The method for invoking a function module according to any one of claims 13-21, wherein the SDK integrates a plurality of different function modules.
  25. 一种电子设备,其特征在于,所述电子设备上安装有跨平台软件开发引擎、及软件开发工具包SDK;An electronic device, characterized in that a cross-platform software development engine and a software development kit SDK are installed on the electronic device;
    所述设备包括:存储器和处理器;The device includes: a memory and a processor;
    所述存储器,用于存储程序代码;The memory is used to store program code;
    所述处理器,用于调用所述程序代码,当程序代码被执行时,用于执行以下操作:The processor is used to call the program code, and when the program code is executed, it is used to perform the following operations:
    利用所述SDK通过预置的事件接口接收到来自所述引擎传输的事件,所述事件与需调用的目标功能模块相关,所述事件接口是所述SDK与所述引擎之间的接口;Use the SDK to receive an event transmitted from the engine through a preset event interface, the event is related to the target function module to be called, and the event interface is an interface between the SDK and the engine;
    利用所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块。Use the SDK to call the target function module from the function modules integrated by the SDK according to the event.
  26. 如权利要求25所述的设备,其特征在于,所述事件具有记录所述事件所属类型信息的类型字段;The device according to claim 25, wherein the event has a type field for recording type information to which the event belongs;
    所述处理器利用所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块时,具体用于:When the processor uses the SDK to call the target function module from the function module integrated by the SDK according to the event, it is specifically used to:
    利用所述SDK解析所述事件的类型字段;Parse the type field of the event by using the SDK;
    利用所述SDK依据解析出的类型信息从所述SDK集成的功能模块中调用所述目标功能模块。The SDK is used to call the target function module from the function module integrated by the SDK according to the parsed type information.
  27. 如权利要求26所述的设备,其特征在于,所述类型字段包括第一字段和第二字段;The device of claim 26, wherein the type field includes a first field and a second field;
    所述第一字段上记录了所述事件所属的目标总类型信息,所述第二字段上记录了所述目标总类型信息的所有子类型信息中所述事件所属的目标子类型信息;The first field records the target total type information to which the event belongs, and the second field records the target subtype information to which the event belongs among all subtype information of the target total type information;
    所述处理器利用所述SDK依据解析出的类型信息从所述SDK集成的功能模块中调用所述目标功能模块时,具体用于:When the processor uses the SDK to call the target function module from the function module integrated with the SDK according to the type information parsed by the SDK, it is specifically used to:
    利用所述SDK依据所述目标总类型信息与目标子类型信息调用所述目标功能模块。Using the SDK to call the target function module according to the target total type information and target subtype information.
  28. 如权利要求27所述的设备,其特征在于,The device of claim 27, wherein:
    所述处理器利用所述SDK依据所述目标总类型信息与目标子类型信息调用所述目标功能模块时,具体用于:When the processor uses the SDK to call the target function module according to the target total type information and target subtype information, it is specifically configured to:
    利用所述SDK调用与所述目标总类型信息对应的目标消息处理对象,以利用所述目标消息处理对象确定与所述目标子类型信息对应的目标事件处理对象;Calling the target message processing object corresponding to the target total type information by using the SDK, so as to use the target message processing object to determine the target event processing object corresponding to the target subtype information;
    利用所述SDK调用所述目标事件处理对象,以利用所述目标事件处理对象确定与所述目标子类型信息对应的功能模块;Using the SDK to call the target event processing object, so as to use the target event processing object to determine the functional module corresponding to the target subtype information;
    利用所述SDK将确定出的功能模块作为目标功能模块并调用所述目标功能模块。Use the SDK to take the determined function module as the target function module and call the target function module.
  29. 如权利要求25所述的设备,其特征在于,所述处理器利用SDK通过预置的事件接口接收到来自所述引擎传输的事件之前,还用于:The device according to claim 25, wherein, before the processor receives the event transmitted from the engine through the preset event interface by using the SDK, it is further configured to:
    利用所述SDK通过预置的对象管理接口接收所述引擎传输的创建消息,所述创建消息用于指示创建SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象管理接口是所述SDK与所述引擎之间的接口;Use the SDK to receive a creation message transmitted by the engine through a preset object management interface, the creation message is used to instruct the creation of an SDK management object, and the SDK management object is used to manage objects required for invoking a function module. The object management interface is the interface between the SDK and the engine;
    利用所述SDK依据所述创建消息创建SDK管理对象。Use the SDK to create an SDK management object according to the creation message.
  30. 如权利要求25所述的设备,其特征在于,所述处理器利用所述SDK通过预置的事件接口接收到来自所述引擎传输的事件之前,还用于:The device according to claim 25, wherein before the processor uses the SDK to receive the event transmitted from the engine through a preset event interface, it is further configured to:
    利用所述SDK通过预置的对象初始化接口接收所述引擎传输的初始化消息,所述初始化消息用于指示初始化SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象初始化接口是所述SDK与所述引擎之间的接口;The SDK is used to receive the initialization message transmitted by the engine through a preset object initialization interface. The initialization message is used to instruct to initialize the SDK management object. The SDK management object is used to manage the objects required to call the function module. The object initialization interface is the interface between the SDK and the engine;
    利用所述SDK依据所述初始化消息初始化SDK管理对象。Use the SDK to initialize the SDK management object according to the initialization message.
  31. 如权利要求25所述的设备,其特征在于,所述处理器利用所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块之后,还用于:The device according to claim 25, wherein after the processor uses the SDK to call the target function module from the function module integrated by the SDK according to the event, it is further configured to:
    利用所述SDK获取调用所述目标功能模块所得的目标执行结果;Using the SDK to obtain the target execution result obtained by invoking the target function module;
    利用所述SDK通过预置的回调接口将所述目标执行结果传输至所述引擎;所述回调接口是所述SDK与所述引擎之间的接口,用于将所述SDK调用各功能模块所得的执行结果传输至所述引擎。Use the SDK to transmit the target execution result to the engine through a preset callback interface; the callback interface is the interface between the SDK and the engine, and is used to call the SDK into various functional modules. The execution result of is transmitted to the engine.
  32. 如权利要求31所述的设备,其特征在于,The device of claim 31, wherein:
    所述事件是所述引擎在收到指示需调用的目标功能模块的调用指令时触发的,所述事件还携带有用于标识所述调用指令的标识符;The event is triggered when the engine receives a call instruction indicating the target function module to be called, and the event also carries an identifier for identifying the call instruction;
    所述处理器利用所述SDK通过预置的回调接口将所述目标执行结果传输至所述引擎时,具体用于:When the processor uses the SDK to transmit the target execution result to the engine through a preset callback interface, it is specifically used to:
    利用所述SDK从所述事件中获取标识符;Use the SDK to obtain an identifier from the event;
    利用所述SDK将所述标识符携带在目标执行结果中并通过所述回调接口传输至所述引擎。The SDK is used to carry the identifier in the target execution result and is transmitted to the engine through the callback interface.
  33. 如权利要求25所述的设备,其特征在于,The device of claim 25, wherein:
    所述事件携带有与所述事件相关的数据;The event carries data related to the event;
    所述处理器利用所述SDK依据所述事件从所述SDK集成的功能模块中调用所述目标功能模块时,还用于:When the processor uses the SDK to call the target function module from the function module integrated by the SDK according to the event, it is also used to:
    利用所述SDK将所述数据输入至所述目标功能模块中,以使所述目标功能模块依据所述数据执行处理。Use the SDK to input the data into the target function module, so that the target function module executes processing according to the data.
  34. 如权利要求25-33中任一项所述的设备,其特征在于,所述SDK的语言支持本设备的操作系统,并且所述SDK支持与本设备的操作系统不同的操作系统。The device according to any one of claims 25-33, wherein the language of the SDK supports the operating system of the device, and the SDK supports an operating system different from the operating system of the device.
  35. 如权利要求25-33中任一项所述的设备,其特征在于,所述SDK的语言与所述SDK集成的功能模块的语言相同。The device according to any one of claims 25-33, wherein the language of the SDK is the same as the language of the functional module integrated with the SDK.
  36. 如权利要求25-33中任一项所述的设备,其特征在于,所述SDK集成了多个不同的功能模块。The device according to any one of claims 25-33, wherein the SDK integrates multiple different functional modules.
  37. 一种电子设备,其特征在于,所述电子设备上安装有跨平台软件开发引擎、及软件开发工具包SDK;An electronic device, characterized in that a cross-platform software development engine and a software development kit SDK are installed on the electronic device;
    所述设备包括:存储器和处理器;The device includes: a memory and a processor;
    所述存储器,用于存储程序代码;The memory is used to store program code;
    所述处理器,用于调用所述程序代码,当程序代码被执行时,用于执行以下操作:The processor is used to call the program code, and when the program code is executed, it is used to perform the following operations:
    在需调用目标功能模块时,利用所述引擎触发事件,所述事件与所述目标功能模块相关;When a target function module needs to be called, use the engine to trigger an event, and the event is related to the target function module;
    利用所述引擎通过预置的事件接口将所述事件传输至所述SDK,所述事件接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的所述事件从所述SDK集成的功能模块中调用所述目标功能模块。Use the engine to transmit the event to the SDK through a preset event interface. The event interface is the interface between the SDK and the engine, so that the SDK receives the event from the The target function module is called from the function module integrated by the SDK.
  38. 如权利要求37所述的设备,其特征在于,所述事件具有记录所述事件所属类型信息的类型字段。The device according to claim 37, wherein the event has a type field for recording type information to which the event belongs.
  39. 如权利要求38所述的设备,其特征在于,所述类型字段包括第一字段和第二字段;The device of claim 38, wherein the type field includes a first field and a second field;
    所述第一字段上记录了所述事件所属的目标总类型信息,所述第二字段上记录了所述目标总类型信息的所有子类型信息中所述事件所属的目标子类型信息。The first field records the target total type information to which the event belongs, and the second field records the target subtype information to which the event belongs among all subtype information of the target total type information.
  40. 如权利要求37所述的设备,其特征在于,所述处理器利用所述引擎触发事件之前,还用于:The device of claim 37, wherein before the processor uses the engine to trigger an event, it is further configured to:
    在需创建SDK管理对象时,利用所述引擎通过预置的对象管理接口传输创建消息至所述SDK,所述创建消息用于指示创建SDK管理对象,所述SDK管理对象用于管理调用功能模块所需的对象,所述对象管理接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的创建消息创建SDK管理对象。When an SDK management object needs to be created, the engine is used to transmit a creation message to the SDK through a preset object management interface. The creation message is used to instruct the creation of the SDK management object, and the SDK management object is used to manage and call function modules. A required object, the object management interface is an interface between the SDK and the engine, so that the SDK creates an SDK management object according to the received creation message.
  41. 如权利要求37所述的设备,其特征在于,所述处理器利用所述引擎触发事件之前,还用于:The device of claim 37, wherein before the processor uses the engine to trigger an event, it is further configured to:
    在需初始化SDK管理对象时,利用所述引擎通过预置的对象初始化接口传输初始化消息至所述SDK,所述初始化消息用于指示初始化SDK管理对象, 所述SDK管理对象用于管理调用功能模块所需的对象,所述对象初始化接口是所述SDK与所述引擎之间的接口,以使所述SDK依据接收的初始化消息初始化SDK管理对象。When the SDK management object needs to be initialized, the engine is used to transmit an initialization message to the SDK through a preset object initialization interface. The initialization message is used to instruct to initialize the SDK management object, and the SDK management object is used to manage and call function modules. The required object, the object initialization interface is an interface between the SDK and the engine, so that the SDK initializes the SDK management object according to the received initialization message.
  42. 如权利要求37所述的设备,其特征在于,所述处理器利用所述引擎通过预置的事件接口将所述事件传输至所述SDK之后,还用于:The device of claim 37, wherein after the processor uses the engine to transmit the event to the SDK through a preset event interface, it is further used for:
    利用所述引擎通过预置的回调接口接收来自所述SDK传输的目标执行结果,所述目标执行结果是调用所述目标功能模块所得的执行结果;所述回调接口是所述SDK与所述引擎之间的接口,用于将所述SDK调用各功能模块所得的执行结果传输至所述引擎。Use the engine to receive the target execution result transmitted from the SDK through the preset callback interface, the target execution result is the execution result obtained by calling the target function module; the callback interface is the SDK and the engine The interface between is used to transmit the execution result obtained by the SDK invoking each function module to the engine.
  43. 如权利要求42所述的设备,其特征在于,所述处理器利用所述引擎触发事件之前,还用于:The device according to claim 42, wherein before the processor uses the engine to trigger an event, it is further configured to:
    利用所述引擎接收指令;Use the engine to receive instructions;
    当接收到调用指令时,所述调用指令用于指示需调用的目标功能模块,利用所述引擎确定需调用目标功能模块。When a call instruction is received, the call instruction is used to indicate the target function module to be called, and the engine is used to determine the target function module to be called.
  44. 如权利要求43所述的设备,其特征在于,所述处理器利用所述引擎通过预置的事件接口将所述事件传输至所述SDK时,具体用于:The device according to claim 43, wherein when the processor uses the engine to transmit the event to the SDK through a preset event interface, it is specifically configured to:
    利用所述引擎依据所述调用指令确定用于标识所述调用指令的标识符;Using the engine to determine an identifier for identifying the calling instruction according to the calling instruction;
    利用所述引擎将所述标识符携带在所述事件中并通过所述事件接口传输至所述SDK,以使所述SDK将所述标识符携带在目标执行结果中并通过所述回调接口传输至所述引擎。Use the engine to carry the identifier in the event and transmit it to the SDK through the event interface, so that the SDK carries the identifier in the target execution result and transmits it through the callback interface To the engine.
  45. 如权利要求43所述的设备,其特征在于,所述指令携带有与所述事件相关的数据;The device according to claim 43, wherein the instruction carries data related to the event;
    所述处理器利用所述引擎通过预置的事件接口将所述事件传输至所述SDK时,具体用于:When the processor uses the engine to transmit the event to the SDK through a preset event interface, it is specifically used to:
    利用所述引擎从所述调用指令中获取所述数据;Obtain the data from the call instruction by using the engine;
    利用所述引擎将所述数据携带在所述事件中并通过所述事件接口传输至所述SDK,以使所述SDK将所述数据输入至所述目标功能模块中。The engine is used to carry the data in the event and is transmitted to the SDK through the event interface, so that the SDK inputs the data into the target function module.
  46. 如权利要求37-45中任一项所述的设备,其特征在于,所述SDK的语言支持本设备的操作系统,并且所述SDK支持与本设备的操作系统不同的操作系统。The device according to any one of claims 37-45, wherein the language of the SDK supports the operating system of the device, and the SDK supports an operating system different from the operating system of the device.
  47. 如权利要求37-45中任一项所述的设备,其特征在于,所述SDK的语言与所述SDK集成的功能模块的语言相同。The device according to any one of claims 37-45, wherein the language of the SDK is the same as the language of the functional module integrated with the SDK.
  48. 如权利要求37-45中任一项所述的设备,其特征在于,所述SDK集成了多个不同的功能模块。The device according to any one of claims 37-45, wherein the SDK integrates multiple different functional modules.
  49. 一种计算机可读存储介质,其特征在于,A computer-readable storage medium, characterized in that:
    所述计算机可读存储介质上存储有计算机指令,所述计算机指令被执行时,实现权利要求1-24中任一项的功能模块的调用方法。The computer-readable storage medium stores computer instructions, and when the computer instructions are executed, the method for invoking the functional module of any one of claims 1-24 is realized.
PCT/CN2019/090985 2019-06-12 2019-06-12 Functional module invoking method, device and computer readable storage medium WO2020248172A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/090985 WO2020248172A1 (en) 2019-06-12 2019-06-12 Functional module invoking method, device and computer readable storage medium
CN201980010025.0A CN111684420A (en) 2019-06-12 2019-06-12 Method and device for calling functional module and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/090985 WO2020248172A1 (en) 2019-06-12 2019-06-12 Functional module invoking method, device and computer readable storage medium

Publications (1)

Publication Number Publication Date
WO2020248172A1 true WO2020248172A1 (en) 2020-12-17

Family

ID=72433222

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/090985 WO2020248172A1 (en) 2019-06-12 2019-06-12 Functional module invoking method, device and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN111684420A (en)
WO (1) WO2020248172A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023245526A1 (en) * 2022-06-23 2023-12-28 广州视源电子科技股份有限公司 Desktop element operation method, electronic device and intelligent interaction tablet

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090307260A1 (en) * 2006-09-22 2009-12-10 Roemerman Steven D System-of-Systems Knowledge Management System and Method of Operating the Same
CN104461575A (en) * 2014-12-26 2015-03-25 北京华电万通科技有限公司 Device and method for JavaScript native interface calling conducted by crossing mobile operating system platform
CN105389222A (en) * 2015-12-15 2016-03-09 中国科学院声学研究所 Method, apparatus and system for dynamically calling native interface

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103559040B (en) * 2013-11-12 2016-05-18 厦门卓讯信息技术有限公司 A kind of system and method based on SDK rapid build mobile Internet application module
CN107066291A (en) * 2017-02-09 2017-08-18 阿里巴巴集团控股有限公司 Packaging method, device and the equipment of SDK, computer-readable recording medium
CN108897567B (en) * 2018-06-08 2021-11-23 广州虎牙信息科技有限公司 Method, device, equipment and storage medium for loading files by software based on Unity

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090307260A1 (en) * 2006-09-22 2009-12-10 Roemerman Steven D System-of-Systems Knowledge Management System and Method of Operating the Same
CN104461575A (en) * 2014-12-26 2015-03-25 北京华电万通科技有限公司 Device and method for JavaScript native interface calling conducted by crossing mobile operating system platform
CN105389222A (en) * 2015-12-15 2016-03-09 中国科学院声学研究所 Method, apparatus and system for dynamically calling native interface

Also Published As

Publication number Publication date
CN111684420A (en) 2020-09-18

Similar Documents

Publication Publication Date Title
US10862982B2 (en) Cloud-scale heterogeneous datacenter management infrastructure
US9983857B2 (en) Dynamic computational acceleration using a heterogeneous hardware infrastructure
US10592218B2 (en) Dynamic data and compute resource elasticity
US9658890B2 (en) Runtime agnostic representation of user code for execution with selected execution runtime
US9146843B2 (en) Recording execution information
US10585653B2 (en) Declarative programming model with a native programming language
KR20160132856A (en) Framework for user-mode crash reporting
EP3362900B1 (en) Telemetry system extension
CN113127050B (en) Application resource packaging process monitoring method, device, equipment and medium
US10394571B2 (en) Passing data from a host-based utility to a service processor
US8826238B2 (en) Per group verification
CN107003828B (en) Instrumentization of graphics instructions
WO2020248172A1 (en) Functional module invoking method, device and computer readable storage medium
CN110888628A (en) Method, device, equipment and storage medium for generating control tool
US10599444B2 (en) Extensible input stack for processing input device data
CN110837446A (en) Equipment management method and device applied to embedded system, medium and embedded equipment
CN113760491A (en) Task scheduling system, method, equipment and storage medium
WO2023098015A1 (en) Chip platform upgrade method and related device
US20190213015A1 (en) Extensible input stack for processing input device data
CN111433738A (en) Controller event queue
CN111209062A (en) Information acquisition method and device, electronic equipment and computer storage medium
CN110647405A (en) System message processing method, electronic device, and computer-readable storage medium
CN108228362B (en) Compatible method, module and channel system of VxWorks system
US20230359440A1 (en) Externally-initiated runtime type extension
CN113312120B (en) Method, device, electronic equipment and medium for executing C + + task in virtual machine

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19932565

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19932565

Country of ref document: EP

Kind code of ref document: A1