Application program and SDK communication method and apparatus
Through the communication engine's encapsulators, adapters, managers, and executors, direct integration communication between applications and SDKs is achieved, solving the problem of high coupling between applications and SDKs, reducing complexity and development difficulty, and improving development efficiency and business scalability.
Patent Information
- Application Number
- CN202110183347.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-10
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2041-02-10
AI Technical Summary
In the existing technology, direct integration of SDK into applications leads to high coupling, which increases the complexity of the applications and the difficulty of development and maintenance. Adaptive updates are required every time the SDK code changes.
A communication engine is used, including a wrapper, an adapter, a manager and an executor, to realize the communication between the application and the SDK through the first working mode. The manager receives the application command to create the engine command, the executor dispatches it to the adapter, and the adapter calls the target SDK encapsulated by the wrapper according to the interface contract to realize function integration without directly integrating the SDK.
It reduces the coupling between the application and the SDK, reduces the complexity of the application and the difficulty of development and maintenance, improves development efficiency, and realizes the functional integration of the application into the SDK.
Smart Images

Figure CN114911635B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a communication method and device between an application and an SDK. Background Art
[0002] As application development technology improves, the functionality of applications becomes richer.
[0003] Currently, when developing applications, technicians can usually use the software development kit (SDK) provided by the service provider, so that the application can integrate corresponding functions to meet the business needs of the application and reduce the development workload of the technicians.
[0004] Specifically, the existing technology can usually integrate the SDK directly into the application to achieve the integration of the application with the corresponding functions.
[0005] However, direct integration increases the coupling between the application and the SDK. Whenever the software code in the SDK changes, the application will likely need to be adaptively updated, which increases the complexity of the application and makes development and maintenance more difficult. Summary of the Invention
[0006] In view of the above problems, the present invention provides a method and device for communication between an application and an SDK that overcomes the above problems or at least partially solves the above problems. The technical solution is as follows:
[0007] A communication method between an application and an SDK, the method being applied to a communication engine, the communication engine comprising at least: an encapsulator, an adapter, a manager, and an executor, the communication engine comprising at least a first working mode;
[0008] In the first working mode, the manager receives an application command sent by the application, creates a first engine command of a corresponding command type according to the application command, and sends the first engine command to the executor, wherein the command type includes at least an operation type;
[0009] The executor dispatches the first engine command to the adapter;
[0010] The adapter calls the target SDK encapsulated by the encapsulator to execute the first engine command according to the interface contract matching the operation type.
[0011] Optionally, the communication engine includes multiple encapsulators and multiple adapters, and the command type further includes an SDK type; the executor dispatches the first engine command to the adapter, including:
[0012] The executor dispatches the first engine command to a target adapter corresponding to the target SDK type among the multiple adapters;
[0013] The adapter calls the target SDK encapsulated by the encapsulator to execute the first engine command according to the interface contract matching the operation type, including:
[0014] The target adapter calls the target SDK encapsulated by the target wrapper to execute the first engine command according to the interface contract matching the operation type. The target wrapper is a wrapper corresponding to the target adapter among the multiple wrappers.
[0015] Optionally, the communication engine further includes a second working mode; and the method further includes:
[0016] In the second working mode, the adapter receives the SDK command sent by the target SDK encapsulated by the encapsulator;
[0017] The adapter calls the manager so that the manager creates a second engine command of a corresponding command type according to the SDK command;
[0018] The manager sends the second engine command to the executor;
[0019] The executor dispatches the second engine command to the application through the manager, so that the application executes the operation corresponding to the second engine command.
[0020] Optionally, the communication engine further includes: an interface contract definer;
[0021] The interface contract definer is used to predefine the interface contract.
[0022] Optionally, the communication engine includes a plurality of executors; the manager sending the first engine command to the executors includes:
[0023] The manager sends the first engine command to a target executor corresponding to the command type among the plurality of executors;
[0024] The executor dispatches the first engine command to the adapter, including:
[0025] The target executor dispatches the first engine command to the adapter.
[0026] Optionally, the executor includes a command queue, wherein the command queue is composed of ordered engine commands arranged according to arrival time; after the manager sends the first engine command to the executor, the method further includes:
[0027] The executor adds the first engine command to the command queue;
[0028] The executor dispatches the first engine command to the adapter, including:
[0029] The executor dispatches the first engine command to the adapter according to the command dispatching policy.
[0030] A communication device between an application and an SDK, applied to a communication engine, the communication engine comprising at least: an encapsulator, an adapter, a manager, and an executor, the communication engine comprising at least a first working mode;
[0031] In the first working mode, the manager receives an application command sent by the application, creates a first engine command of a corresponding command type according to the application command, and sends the first engine command to the executor, wherein the command type includes at least an operation type;
[0032] The executor dispatches the first engine command to the adapter;
[0033] The adapter calls the target SDK encapsulated by the encapsulator to execute the first engine command according to the interface contract matching the operation type.
[0034] Optionally, the communication engine includes multiple encapsulators and multiple adapters, and the command type further includes an SDK type; the executor dispatches the first engine command to the adapter, and is configured as follows:
[0035] The executor dispatches the first engine command to a target adapter corresponding to the target SDK type among the multiple adapters;
[0036] The adapter calls the target SDK encapsulated by the encapsulator to execute the first engine command according to the interface contract matching the operation type, and is set to:
[0037] The target adapter calls the target SDK encapsulated by the target wrapper to execute the first engine command according to the interface contract matching the operation type. The target wrapper is a wrapper corresponding to the target adapter among the multiple wrappers.
[0038] Optionally, the communication engine further includes a second working mode;
[0039] In the second working mode, the adapter receives the SDK command sent by the target SDK encapsulated by the encapsulator;
[0040] The adapter calls the manager so that the manager creates a second engine command of a corresponding command type according to the SDK command;
[0041] The manager sends the second engine command to the executor;
[0042] The executor dispatches the second engine command to the application through the manager, so that the application executes the operation corresponding to the second engine command.
[0043] Optionally, the communication engine further includes: an interface contract definer;
[0044] The interface contract definer is used to predefine the interface contract.
[0045] Optionally, the communication engine includes multiple executors; the manager sends the first engine command to the executor, and is configured to:
[0046] The manager sends the first engine command to a target executor corresponding to the command type among the plurality of executors;
[0047] The executor dispatches the first engine command to the adapter, and is configured as follows:
[0048] The target executor dispatches the first engine command to the adapter.
[0049] Optionally, the executor includes a command queue, wherein the command queue is composed of ordered engine commands arranged according to arrival time;
[0050] After the manager sends the first engine command to the executor, the executor adds the first engine command to the command queue;
[0051] The executor dispatches the first engine command to the adapter, and is configured as follows:
[0052] The executor dispatches the first engine command to the adapter according to the command dispatching policy.
[0053] An electronic device, comprising at least one processor, and at least one memory connected with the processor through a bus; the memory stores program instructions of the communication engine, the communication engine comprises a packager, an adapter, a manager and an executor; wherein the processor, the memory and the bus complete mutual communication; the processor is used to call the program instructions in the memory to execute: the communication method between any application program and SDK.
[0054] A computer readable storage medium, the computer readable storage medium stores computer programs / instructions, the computer programs / instructions are executed by a processor to realize: the communication method between any application program and SDK.
[0055] A computer program product, the computer program product comprises computer programs / instructions, the computer programs / instructions are executed by a processor to realize: the communication method between any application program and SDK.
[0056] The application provides a communication method and device for an application program and an SDK, which can be applied to a communication engine, and the communication engine at least includes a packager, an adapter, a manager and an executor, and at least includes a first working mode. In the first working mode, the manager receives an application program command sent by an application program, creates a first engine command of a corresponding command type according to the application program command, sends the first engine command to the executor, at least includes an operation type in the command type, the executor schedules the first engine command to the adapter, the adapter calls a target SDK packaged by the packager to execute the first engine command according to an interface contract matched with the operation type. The application can realize the communication between the application program and the target SDK through the communication engine, so that the application program can call the target SDK without directly integrating the target SDK, thereby realizing the functional integration of the application program to the target SDK, reducing the coupling degree of the application program and the target SDK, and effectively reducing the complexity, development difficulty and maintenance difficulty of the application program, and improving the development efficiency of the application program.
[0057] The above description is only a summary of the technical scheme of the application, in order to more clearly understand the technical means of the application, the specific embodiments of the application can be implemented according to the content of the specification, and in order to make the above and other purposes, characteristics and advantages of the application more obvious and easy to understand, the following specific embodiments of the application are described. BRIEF DESCRIPTION OF DRAWINGS
[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the accompanying drawings in the following description only relate to the embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative effort based on the provided drawings.
[0059] Figure 1 A flow chart of a communication method between an application and an SDK according to an embodiment of the present application is shown;
[0060] Figure 2 A flow chart of another communication method between an application and an SDK according to an embodiment of the present application is shown;
[0061] Figure 3 A structural schematic diagram of a communication device between an application and an SDK according to an embodiment of the present application is shown;
[0062] Figure 4 A structural schematic diagram of an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0063] Exemplary embodiments of the present application will be described in detail with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present application can be more thoroughly understood and so that the scope of the present application can be completely conveyed to those skilled in the art.
[0064] As shown in Figure 1 The present embodiment proposes a communication method between an application and an SDK, which can be applied to a communication engine. The communication engine can include at least a packager, an adapter, a manager and an executor, and the communication engine can include at least a first working mode.
[0065] In the first working mode, the manager receives an application command sent by an application.
[0066] The present application does not limit the specific type of the application. For example, the application can be a real-time audio / video communication application, a picture processing application, a short video making application or a car navigation application.
[0067] The SDK can be an SDK provided by a service provider to an application. The type of the SDK can match the type of the application, for example, when the application is an RTC application, the SDK can be an SDK for providing a real-time video call service, can be an SDK for providing an interactive live streaming service, or can be an SDK for providing a screen sharing service. It should be noted that one SDK can provide at least one service, for example, an SDK for providing a real-time video call service can provide a video call service, a video receiving service, and a call hang-up service, and the like.
[0068] The communication engine can be software for enabling the application to communicate with the target SDK. Specifically, when the communication engine receives an application command sent by the application, the communication engine can create an engine command of a corresponding type, and can invoke the target SDK to perform an operation corresponding to the engine command according to a predefined interface contract, so that the target SDK provides a corresponding service, so that the application can invoke the target SDK without directly integrating the target SDK, and the application can integrate the functions of the target SDK, thereby reducing the coupling degree of the application and the target SDK, and effectively reducing the complexity, development difficulty, and maintenance difficulty of the application, and improving the development efficiency of the application. For example, when the application is an RTC application and the SDK is an SDK for providing a real-time video call service, a user can make a video call to another user through the RTC application. At this time, the communication engine can receive a video call command sent by the RTC application, create an engine command of a corresponding type according to the video call command, and can invoke the target SDK to perform a video call corresponding to the engine command according to a predefined interface contract, so as to make a video call to the other user, and so that the target SDK provides a video call service.
[0069] The engine command can be signaling information for instructing the SDK to perform a corresponding operation. The command type of the engine command can include at least an operation type. After receiving the engine command, the SDK can perform an operation corresponding to the operation type of the engine command, for example, when the SDK receives an engine command with an operation type of video call, the SDK can perform a video call, that is, make a video call to a related user.
[0070] It should be noted that the present invention can predefine corresponding interface contracts for different services provided by the target SDK, and the communication engine can call the target SDK to provide the corresponding services according to the predefined interface contracts. For example, when the target SDK can provide a first service and a second service, the present invention can predefine a corresponding first interface contract for the first service and a corresponding second interface contract for the second service, so that the communication engine can call the target SDK according to the first interface contract to perform corresponding operations to provide the first service, and can call the target SDK according to the second interface contract to perform corresponding operations to provide the second service.
[0071] Optionally, in other communication methods between applications and SDKs proposed in this embodiment, the communication engine may further include: an interface contract definer;
[0072] Interface contract definer, used to predefine interface contracts.
[0073] The interface contract definer can automatically define an interface contract corresponding to the services that the SDK can provide based on the type of SDK, related parameters, and the operations that the SDK can perform, that is, the services that the SDK can provide.
[0074] It is understandable that the interface contract can also be predefined by technical personnel based on the type of SDK, relevant parameters and services that the SDK can provide.
[0075] Optionally, the interface contract definer can define corresponding interface contracts based on the type of SDK. For example, if the SDK is used to provide real-time video call services, the interface contract definer can define a video call contract; if the SDK is used to provide interactive live broadcast services, the interface contract definer can define an online live broadcast contract; if the SDK is used to provide screen sharing services, the interface contract definer can define a screen sharing contract. Of course, the interface contract definer can also define client-class contracts, device operation-class contracts, and message notification-class contracts, covering a variety of functions and providing a rich interface for communication between applications and SDKs.
[0076] The wrapper is a component of the communication engine that can be used to encapsulate the target SDK to achieve interoperability between the application and the target SDK in programming languages. Specifically, the wrapper can encapsulate the target SDK using the programming language used by the application.
[0077] It should be noted that the programming language used by the SDK provided by the service provider may be different from the programming language used by the application (such as C, C++, or C#). Therefore, to achieve interoperability between the application and the target SDK in terms of programming language, the present invention can use a wrapper to encapsulate the target SDK, making the application and the target SDK interoperable in terms of programming language, thereby allowing the application to integrate the target SDK.
[0078] The adapter is a component module of the communication engine, which can be used to implement a predefined interface contract, that is, it can implement the call to the target SDK according to the predefined interface contract, so that the target SDK can provide corresponding services.
[0079] The manager may be a component module of the communication engine, and may be used to control the operation state of the communication engine (such as loading, opening, closing, and normal operation) or create engine commands according to application commands sent by the application.
[0080] Optionally, when an application calls the communication engine, the manager can receive a call instruction from the application and control the loading, startup, or normal operation of the communication engine. Optionally, when an application stops or exits the call to the communication engine, the manager can receive a stop call instruction from the application and shut down the communication engine, freeing up the system memory and resources occupied by the communication engine.
[0081] The executor is a component of the communication engine that dispatches engine commands created by the manager to the adapter. Optionally, there can be one or more executors. Executors can be categorized by the type of engine commands they dispatch. For example, if the application is an RTC application, the executor could be a call signaling executor, a call audio and video frame data executor, or a call record executor.
[0082] The communication engine can implement the application program's call to the target SDK. Specifically, when the communication engine receives an application program command sent by the application program for calling the target SDK, the communication engine can enter the first working mode.
[0083] Specifically, when the communication engine is in the first working mode, the manager can receive an application command sent by the application for calling the target SDK.
[0084] S102: The manager creates a first engine command of a corresponding command type according to the application command, where the command type at least includes an operation type.
[0085] Specifically, after receiving the application command sent by the application, the manager may create a first engine command of a corresponding command type.
[0086] The first engine command can be used to instruct the adapter to call the target SDK to provide the corresponding service in accordance with the interface contract corresponding to the operation type of the first engine command. For example, when the application is an RTC application and a user makes a video call to another user through the RTC application, the manager can receive the video call command sent by the RTC application and, based on the video call command, create a first engine command with the operation type of video call. In this case, the first engine command can be used to instruct the adapter to call the target SDK to make a video call to the other user in accordance with the interface contract corresponding to the video call, so that the target SDK provides the video call service.
[0087] S103: The manager sends the first engine command to the executor.
[0088] Specifically, after creating the first engine command, the manager may send the first engine command to the executor, and the executor schedules the first engine command.
[0089] S104, the executor dispatches the first engine command to the adapter;
[0090] Specifically, after receiving the first engine command, the executor may dispatch the first engine command to the adapter.
[0091] It should be noted that a command queue may be provided in the executor. In other communication methods between applications and SDKs proposed in this embodiment, the executor may include a command queue, which may be composed of ordered engine commands arranged according to arrival time. The executor may schedule the engine commands in the command queue according to the command scheduling policy. In this case, after step S103, the method may further include: the executor adds the first engine command to the command queue; in this case, step S104 may specifically include: the executor schedules the first engine command to the adapter according to the command scheduling policy.
[0092] S105 : The adapter calls the target SDK encapsulated by the encapsulator to execute the first engine command according to the interface contract matching the operation type.
[0093] After receiving the first engine command, the adapter may call the target SDK to execute the operation corresponding to the first engine command according to the interface contract matching the operation type of the first engine command, so that the target SDK provides the corresponding service.
[0094] It should be noted that the communication engine enables applications to call the target SDK by implementing communication between the application and the target SDK without directly integrating the target SDK, thereby achieving functional integration of the application with the target SDK, effectively reducing the complexity of the application and the degree of coupling between the application and the target SDK. Specifically, when the software code in the target SDK changes, the present invention can adaptively update the software code of the wrapper or adapter in the communication engine without modifying the software code of the application, thereby reducing the difficulty of application development and maintenance and improving application development efficiency.
[0095] The communication method between an application and an SDK proposed in this embodiment can be applied to a communication engine. The communication engine can include at least: an encapsulator, an adapter, a manager, and an executor. The communication engine includes at least a first working mode. In the first working mode, the manager receives an application command sent by the application, creates a first engine command of a corresponding command type according to the application command, and sends the first engine command to the executor. The command type includes at least an operation type. The executor dispatches the first engine command to the adapter. The adapter calls the target SDK encapsulated by the encapsulator to execute the first engine command according to the interface contract matching the operation type. The present invention can realize communication between the application and the target SDK through the communication engine, so that the application can call the target SDK without directly integrating the target SDK, thereby realizing the functional integration of the application with the target SDK, reducing the coupling between the application and the target SDK, and effectively reducing the complexity, development difficulty, and maintenance difficulty of the application, thereby improving the development efficiency of the application.
[0096] based on Figure 1 The method shown in the figure, this embodiment proposes another communication method between an application and an SDK. In this method, the communication engine may include multiple encapsulators and multiple adapters, and the command type may also include an SDK type. In this case, step S104 may be specifically as follows:
[0097] The executor dispatches the first engine command to a target adapter corresponding to the target SDK type among the multiple adapters.
[0098] It should be noted that the communication engine can enable communication between an application and one SDK, or between an application and multiple SDKs. The communication engine can enable the application to integrate multiple SDKs by enabling communication between the application and multiple SDKs.
[0099] Specifically, the present invention can develop corresponding wrappers and adapters for different SDKs, use multiple wrappers to encapsulate the corresponding SDKs, and use multiple adapters to call the corresponding SDKs. For example, for a first SDK and a second SDK, the present invention can develop a first wrapper and a first adapter for the first SDK, and a second wrapper and a second adapter for the second SDK. The first wrapper can be used to encapsulate the first SDK, the second wrapper can be used to encapsulate the second SDK, the first adapter can be used to call the first SDK, and the second adapter can be used to call the second SDK.
[0100] It should be noted that the present invention can divide the SDK to be integrated with the application into different types of SDKs. Among them, the SDK types of different SDKs can be different. It can be understood that the adapter and the wrapper can correspond to the corresponding types of SDKs. Specifically, the present invention can divide the types of SDKs according to the functions of the SDKs. For example, the present invention can divide the SDKs to be integrated with the RTC application into SDKs for providing real-time video call services, SDKs for providing interactive live broadcast services, and SDKs for providing screen sharing services. Optionally, the present invention can also divide the types of SDKs according to the service providers to which the SDKs belong. For example, the SDK provided by the first service provider is determined as an SDK of the first SDK type, and the SDK provided by the second service provider is determined as an SDK of the second SDK type.
[0101] The application command sent by the application to the manager may include identification information identifying the SDK type of the target SDK to be called. Upon receiving the application command from the application, the manager may create a first engine command of the corresponding SDK type and operation type based on the identification information carried in the application command.
[0102] Specifically, the manager can create a first engine command of the corresponding SDK type by writing identification information for identifying the SDK type into the engine command. For example, when an application sends an application command to the manager that carries identification information of the first SDK type, the manager can create a first engine command of the first SDK type by writing the identification information of the first SDK type into the engine command.
[0103] After receiving the first engine command, the executor may send the first engine command to a target adapter corresponding to the SDK type to which the first engine command belongs, and the target adapter may invoke the target SDK corresponding to the SDK type to perform a corresponding operation and provide a corresponding service. The executor may determine the SDK type to which the first engine command belongs by identifying identification information carried in the first engine command.
[0104] At this time, step S105 may specifically be:
[0105] The target adapter calls the target SDK encapsulated by the target wrapper to execute the first engine command according to the interface contract matching the operation type, and the target wrapper is a wrapper corresponding to the target adapter among the multiple wrappers.
[0106] The present invention can predefine the interface contracts corresponding to the services provided by different SDKs, so that the corresponding SDKs can be called to provide corresponding services through the interface contracts.
[0107] After receiving the first engine command, the target adapter may call the corresponding target SDK to execute the operation corresponding to the first engine command according to the interface contract matched by the operation type of the first engine command, so that the target SDK provides the corresponding service.
[0108] It should be noted that as more service providers invest in application development, the number and types of SDKs provided by different service providers continue to increase. To achieve more comprehensive service coverage, applications need to integrate SDKs from different service providers. For example, for RTC applications, to meet the needs of users using electronic devices (such as mobile phones and tablets) provided by different service providers and to integrate a wider range of audio and video calling functions, RTC needs to integrate RTC-related SDKs provided by different service providers.
[0109] However, due to the lack of unified industry standards, there are significant differences in the interfaces of the SDKs provided by different service providers. For example, for an SDK used to provide a video call answering service to an RTC application, the interface of the SDK provided by one service provider is the enterRoom interface, and the interface of the SDK provided by another service provider is the joinRoom interface. The room ID parameters accepted by the two interfaces are also different, one is of int type and the other is of string type. The existing technology uses a direct integration method to integrate different SDKs into an application, which may further increase the complexity, development difficulty and maintenance difficulty of the application. Among them, when the existing technology directly integrates a new SDK into each application, it may be necessary to modify the application code and add branching logic for the newly integrated SDK, resulting in the application not having good scalability.
[0110] Among them, the present invention can realize the communication between the application and multiple SDKs through the communication engine, shield the interface differences of different SDKs, and while realizing the integration of the application to multiple SDKs, that is, the expansion of different businesses, it can effectively reduce the complexity, development difficulty and maintenance difficulty of the application, and improve the business scalability of the application.
[0111] Specifically, the present invention can realize the calling of different SDKs by applications, i.e., realize the integration of applications into different SDKs, by using a manager, an executor, multiple adapters, and multiple wrappers in a communication engine, as well as predefined interface contracts, while shielding the interface differences of SDKs provided by different service providers. When integrating a new SDK into an application, the present invention can only compile a new wrapper and a new adapter for the new SDK, use the new wrapper to encapsulate the new SDK, and use the new adapter to call the new SDK encapsulated by the new wrapper, thus realizing the integration of the application into the new SDK without modifying the application code. This can effectively reduce the complexity, development difficulty, and maintenance difficulty of the application, and can effectively improve the business scalability of the application.
[0112] The communication method between the application and the SDK proposed in this embodiment can realize the application's call to different SDKs through the communication engine and the predefined interface contract while shielding the interface differences of the SDKs provided by different service providers, that is, realize the integration of the application to different SDKs, effectively reduce the complexity, development difficulty and maintenance difficulty of the application, and effectively improve the business scalability of the application.
[0113] based on Figure 1 This embodiment proposes another communication method between the application and the SDK, such as Figure 2The method is shown in the figure. In the method, the communication engine can further include a second working mode, and the method can further include the following steps:
[0114] S201, in the second working mode, the adapter receives the SDK command sent by the target SDK encapsulated by the encapsulator;
[0115] Wherein, when the communication engine receives the SDK command sent by the SDK, the communication engine can enter the second working mode. Specifically, in the second working mode, the adapter can receive the SDK command sent by the SDK encapsulated by the encapsulator.
[0116] S202, the adapter calls the manager to make the manager create a second engine command of a corresponding command type according to the SDK command;
[0117] Wherein, the adapter can call the manager to make the manager create a second engine command of a corresponding command type according to the SDK command after receiving the SDK command.
[0118] S203, the manager sends the second engine command to the executor.
[0119] Wherein, the manager can send the second engine command to the executor after creating the second engine command, and the executor can schedule the second engine command.
[0120] S204, the executor schedules the second engine command to the application program through the manager, so that the application program executes the operation corresponding to the second engine command.
[0121] Specifically, the executor can send the second engine command to the application program through the manager, so that the application program can execute the operation corresponding to the second engine command. For example, when the opposite end cancels the video call, the adapter can receive the SDK command of canceling the video call sent by the SDK (at this time, the communication engine can enter the second working mode), and then the adapter can call the manager to create a corresponding second engine command. The manager sends the second engine command to the executor, and the executor schedules the second engine command to the application program through the manager, and the application program executes the operation of canceling the video call.
[0122] Specifically, when the application program integrates multiple SDKs and the communication engine is in the second working mode, a certain adapter can receive the SDK command sent by the SDK corresponding to the adapter, and then the adapter receiving the SDK command can call the manager to create the engine command.
[0123] Wherein, the communication engine can realize the transmission of the command from the SDK to the application program, so that the application program can integrate more functions of the SDK, realize the coverage of a larger range of business, and further improve the expansibility of the application program to the business.
[0124] It can be understood that the communication engine can realize command transmission from the application to the SDK, and can also realize command transmission from the SDK to the application. Therefore, the communication engine can realize command interaction between the application and the SDK, so that the application can more completely integrate the functions of the SDK and further improve the scalability of the application to the business.
[0125] The communication method between the application and the SDK proposed in this embodiment can realize command interaction between the application and the SDK through the communication engine, so that the application can more completely integrate the functions of the SDK and further improve the scalability of the application to the business.
[0126] based on Figure 1 The method shown in the figure, this embodiment proposes another communication method between the application and the SDK, in which the communication engine may include multiple executors. In this case, step S103 may be specifically as follows:
[0127] The manager sends the first engine command to a target executor corresponding to the command type among the plurality of executors;
[0128] Among them, the present invention can classify executors according to the command type of the engine command scheduled by the executor. For example, when the application is an RTC application, the executor can include a call signaling type executor, a call audio and video frame data type executor, or a call bill type executor.
[0129] Specifically, the manager may send the first engine command to the corresponding target executor according to the command type of the first engine command. For example, when the command type of the first engine command is call signaling, the manager may send the first engine command to a call signaling type executor.
[0130] Step S104 may specifically include:
[0131] The target executor dispatches the first engine command to the adapter.
[0132] Specifically, after receiving the first engine command, the target executor may schedule the first engine command to the adapter according to the command scheduling policy.
[0133] Among them, the command scheduling strategies of different executors can be different, and the present invention can set corresponding command scheduling strategies for different types of executors. For example, when the application is an RTC application, the present invention can set a first-come-first-served command scheduling strategy for call signaling executors, and can not impose specific restrictions on the length of the buffered command queue; for call audio and video frame data executors, the present invention can set a regular destruction execution strategy, such as deleting unconsumed frame data within 40ms to free up the arrangement space of the command queue and save memory resources, and can limit the length of the buffered command queue, such as 20; for call bill executors, the present invention can set a low-priority scheduling strategy. When the length of the buffered command queue of other types of executors is less than 10, the call bill executor can start scheduling, otherwise it will suspend scheduling to save the operating resources of the central processing unit.
[0134] It should be noted that the present invention sets corresponding types of executors according to different command types, which can improve the scheduling efficiency of the executors for engine commands, and can further improve the scheduling efficiency of engine commands and save related resources by setting corresponding command scheduling strategies for different types of executors.
[0135] Optionally, after receiving a new engine command, the executor may add the new engine command to the end of the command queue. In the process of dispatching the engine commands in the command queue to the adapter, the executor may dispatch the engine commands in the command queue in order from the head of the queue to the end of the queue, and may prohibit the dispatch of the next adjacent engine command before the adapter has completed execution of the engine command. It should be noted that the adapter may feedback the execution status of the engine command to the executor. When the adapter completes the execution of an engine command, the adapter may feedback a message notification to the executor that the engine command has been executed.
[0136] It is understandable that the executor is prohibited from scheduling the next adjacent engine command before an engine command is executed by the adapter. This can effectively avoid application errors or instability caused by the simultaneous execution of different engine commands, and improve the stability and reliability of the application.
[0137] For example, when an RTC application answers a video call, the application will call the manager to create an engine command with the command type of video call and send it to the executor, which will add the engine command to the command queue. When the other party cancels the video call, the adapter can receive the SDK command sent by the SDK to cancel the video call. The adapter can call the manager to create an engine command with the command type of canceling the video call and send it to the executor, which will add the engine command to the command queue. When the two events of the RTC application answering an audio or video call and the other party canceling the audio or video call occur almost at the same time, the executor adds the engine commands to the command queue in the order of arrival time and prohibits scheduling the next engine command before one engine command is executed. Therefore, it can ensure that the logic of the RTC application answering the video call and the logic of canceling the video call are executed sequentially, thereby reducing potential problems that may be caused by the RTC application executing the logic of answering the video call and canceling the video call at the same time, thereby improving the reliability of the RTC application.
[0138] The communication method between the application and the SDK proposed in this embodiment can improve the scheduling efficiency of engine commands and save related resources. It can effectively avoid application errors or instability caused by the simultaneous execution of different engine commands, and improve the stability and reliability of the application.
[0139] and Figure 1 Corresponding to the method shown in FIG, this embodiment proposes a communication device between an application and an SDK, such as Figure 3 As shown, the device can be applied to a communication engine, the communication engine at least comprising: an encapsulator 301, an adapter 302, a manager 303 and an executor 304, and the communication engine at least comprising a first working mode;
[0140] In the first working mode, the manager 303 receives an application command sent by the application, creates a first engine command of a corresponding command type according to the application command, and sends the first engine command to the executor 304, where the command type includes at least an operation type;
[0141] The executor 304 dispatches the first engine command to the adapter 302;
[0142] The adapter 302 calls the target SDK encapsulated by the encapsulator 301 to execute the first engine command according to the interface contract matching the operation type.
[0143] The present invention does not limit the specific type of application. For example, the application can be an application for real-time audio and video calls, i.e., a real-time audio and video application, an application for image processing, an application for short video production, or an application for in-car navigation.
[0144] The SDK can be an SDK provided by a service provider to an application. The SDK type can match the application type. It should be noted that an SDK can provide at least one service. For example, an SDK for providing real-time video calling services can provide video calling services, video answering services, and call hang-up services.
[0145] The communication engine can be software used to implement communication between an application and a target SDK. Specifically, upon receiving an application command sent by an application, the communication engine can create an engine command of the corresponding type and call the target SDK to execute the operation corresponding to the engine command according to a predefined interface contract, so that the target SDK provides the corresponding service. This allows the application to call the target SDK without directly integrating the target SDK, realize the functional integration of the application into the target SDK, reduce the coupling between the application and the target SDK, effectively reduce the complexity, development difficulty, and maintenance difficulty of the application, and improve the development efficiency of the application.
[0146] The engine command may be signaling information used to instruct the SDK to perform a corresponding operation. The command type of the engine command may include at least an operation type. After receiving the engine command, the SDK may perform the operation corresponding to the operation type of the engine command.
[0147] It should be noted that the present invention can predefine corresponding interface contracts for different services provided by the target SDK, and the communication engine can call the target SDK to provide corresponding services according to the predefined interface contracts.
[0148] Optionally, in the communication device between other applications and SDKs proposed in this embodiment, the communication engine may further include: an interface contract definer;
[0149] Interface contract definer, used to predefine interface contracts.
[0150] The interface contract definer can automatically define an interface contract corresponding to the services that the SDK can provide based on the type of SDK, related parameters, and the operations that the SDK can perform, that is, the services that the SDK can provide.
[0151] It is understandable that the interface contract can also be predefined by technical personnel based on the type of SDK, relevant parameters and services that the SDK can provide.
[0152] Optionally, the interface contract definer can define corresponding interface contracts based on the type of SDK. For example, if the SDK is used to provide real-time video call services, the interface contract definer can define a video call contract; if the SDK is used to provide interactive live broadcast services, the interface contract definer can define an online live broadcast contract; if the SDK is used to provide screen sharing services, the interface contract definer can define a screen sharing contract. Of course, the interface contract definer can also define client-class contracts, device operation-class contracts, and message notification-class contracts, covering a variety of functions and providing a rich interface for communication between applications and SDKs.
[0153] The encapsulator 301 is a component module of the communication engine and can be used to encapsulate the target SDK to achieve interoperability between the application and the target SDK in programming language. Specifically, the encapsulator 301 can encapsulate the target SDK using the programming language used by the application.
[0154] It should be noted that the programming language used by the SDK provided by the service provider may be different from the programming language used by the application (such as C, C++, or C#). Therefore, to achieve interoperability between the application and the target SDK in terms of programming language, the present invention can use a wrapper 301 to encapsulate the target SDK, making the application and the target SDK interoperable in terms of programming language, thereby allowing the application to integrate the target SDK.
[0155] The adapter 302 is a component module of the communication engine, and can be used to implement a predefined interface contract, that is, it can implement the call to the target SDK according to the predefined interface contract, so that the target SDK can provide corresponding services.
[0156] The manager 303 may be a component module of the communication engine, and may be used to control the operation state of the communication engine (such as loading, opening, closing, and normal operation) or create engine commands according to application commands sent by the application.
[0157] Optionally, when an application calls the communication engine, manager 303 may receive a call instruction from the application and control the loading, startup, or normal operation of the communication engine. Optionally, when an application stops or exits the call to the communication engine, manager 303 may receive a stop call instruction from the application and shut down the communication engine, freeing up the system memory and resources occupied by the communication engine.
[0158] Executor 304 is a component module of the communication engine that dispatches engine commands created by manager 303 to adapter 302. Optionally, there can be one or more executors 304. Executors 304 can be categorized by the type of engine commands they dispatch. For example, if the application is an RTC application, executor 304 can be a call signaling executor 304, a call audio and video frame data executor 304, or a call record executor 304.
[0159] The communication engine can implement the application program's call to the target SDK. Specifically, when the communication engine receives an application program command sent by the application program for calling the target SDK, the communication engine can enter the first working mode.
[0160] Specifically, when the communication engine is in the first working mode, the manager 303 can receive an application command sent by the application for calling the target SDK.
[0161] Specifically, after receiving the application command sent by the application, the manager 303 may create a first engine command of a corresponding command type.
[0162] The first engine command may be used to instruct the adapter 302 to call the target SDK to provide corresponding services according to the interface contract corresponding to the operation type of the first engine command.
[0163] Specifically, after creating the first engine command, the manager 303 may send the first engine command to the executor 304 , and the executor 304 may schedule the first engine command.
[0164] Specifically, after receiving the first engine command, the executor 304 may dispatch the first engine command to the adapter 302 .
[0165] It should be noted that a command queue may be provided in the executor 304 .
[0166] Optionally, in other communication devices between applications and SDKs proposed in this embodiment, executor 304 may include a command queue, which may be composed of ordered engine commands arranged according to arrival time. Executor 304 may schedule the engine commands in the command queue according to a command scheduling policy. In this case, after manager 303 sends the first engine command to executor 304, executor 304 adds the first engine command to the command queue; at this time, executor 304 dispatches the first engine command to adapter 302. This can be configured as follows: executor 304 dispatches the first engine command to adapter 302 according to the command scheduling policy.
[0167] The adapter 302 can call the target SDK to perform an operation corresponding to the first engine command according to an interface contract matching the operation type of the first engine command after receiving the first engine command, so that the target SDK provides a corresponding service.
[0168] It should be noted that the communication engine can enable the application to implement the call of the application to the target SDK by implementing the communication between the application and the target SDK, so as to implement the functional integration of the application to the target SDK, effectively reduce the complexity of the application, and reduce the coupling degree of the application and the target SDK. Specifically, when the software code in the target SDK changes, the application can be only updated adaptively to the software code of the encapsulator 301 or the adapter 302 in the communication engine, without modifying the software code of the application, so as to reduce the development and maintenance difficulty of the application and improve the development efficiency of the application.
[0169] The application and SDK communication device provided in the embodiment can be applied to the communication engine, and the communication engine can at least include the encapsulator 301, the adapter 302, the manager 303, and the executor 304. The communication engine at least includes a first working mode. In the first working mode, the manager 303 receives an application command sent by an application, creates a first engine command of a corresponding command type according to the application command, and sends the first engine command to the executor 304. The command type at least includes an operation type. The executor 304 dispatches the first engine command to the adapter 302. The adapter 302 calls the target SDK encapsulated by the encapsulator 301 to execute the first engine command according to an interface contract matching the operation type. The application can communicate with the target SDK through the communication engine, so that the application can call the target SDK without directly integrating the target SDK, thereby realizing the functional integration of the application to the target SDK, reducing the coupling degree of the application and the target SDK, and effectively reducing the complexity, development difficulty, and maintenance difficulty of the application and improving the development efficiency of the application.
[0170] Based on Figure 3 The structure diagram is shown, and the embodiment provides another application and SDK communication device. In the device, the communication engine includes a plurality of encapsulators 301 and a plurality of adapters 302. The command type further includes an SDK type. The executor 304 dispatches the first engine command to the adapter 302, which is configured to:
[0171] The executor 304 dispatches the first engine command to a target adapter 302 corresponding to the target SDK type in the plurality of adapters 302;
[0172] The adapter 302 invokes the target SDK encapsulated by the encapsulator 301 to execute the first engine command according to the interface contract matched with the operation type, and is set as:
[0173] The target adapter 302 invokes the target SDK encapsulated by the target encapsulator 301 to execute the first engine command according to the interface contract matched with the operation type, and the target encapsulator 301 is the encapsulator 301 corresponding to the target adapter 302 in the plurality of encapsulators 301.
[0174] It should be noted that the communication engine can realize the communication between the application program and one SDK, and can also realize the communication between the application program and a plurality of SDKs. The communication engine can realize the integration of the application program to the plurality of SDKs by enabling the communication between the application program and the plurality of SDKs.
[0175] Specifically, the present application can write the corresponding encapsulator 301 and adapter 302 for different SDKs, use a plurality of encapsulators 301 to encapsulate the corresponding SDKs respectively, and can call the corresponding SDKs through a plurality of adapters 302.
[0176] It should be noted that the present application can divide the SDKs to be integrated by the application program into different types of SDKs. The SDK types of different SDKs can be different, and it can be understood that the adapter 302 and the encapsulator 301 can correspond to the SDKs of the corresponding type. Specifically, the present application can divide the types of the SDKs according to the functions of the SDKs. Optionally, the present application can also divide the types of the SDKs according to the service providers to which the SDKs belong.
[0177] Among them, the application program command sent by the application program to the manager 303 can carry identification information identifying the SDK type of the target SDK to be called by the application program. The manager 303 can create the first engine command of the corresponding SDK type and operation type according to the identification information carried in the application program command after receiving the application program command sent by the application program.
[0178] Specifically, the manager 303 can create the first engine command of the corresponding SDK type by writing the identification information for identifying the SDK type in the engine command.
[0179] After receiving the first engine command, the executor 304 can send the first engine command to the target adapter 302 corresponding to the SDK type according to the SDK type to which the first engine command belongs. The target adapter 302 then calls the target SDK corresponding to the SDK type to perform the corresponding operation and provide the corresponding service. The executor 304 can determine the SDK type to which the first engine command belongs by identifying the identification information carried in the first engine command.
[0180] The present invention can predefine interface contracts corresponding to services provided by different SDKs, so that corresponding SDKs can be called to provide corresponding services through the interface contracts.
[0181] After receiving the first engine command, the target adapter 302 may call the corresponding target SDK to execute the operation corresponding to the first engine command according to the interface contract matched by the operation type of the first engine command, so that the target SDK provides the corresponding service.
[0182] It should be noted that as more service providers invest in application service construction, the number and types of SDKs provided by different service providers continue to increase. In order to achieve more complete business coverage, applications need to integrate the SDKs provided by different service providers.
[0183] However, due to the lack of unified industry standards, the interfaces of SDKs provided by different service providers vary significantly. Existing technologies use direct integration to integrate different SDKs into applications, which can further increase the complexity, development difficulty, and maintenance difficulty of these applications. Specifically, each time a new SDK is directly integrated into an application, the existing technology may require modifying the application code and adding branching logic for the newly integrated SDK, resulting in poor scalability of the application.
[0184] Among them, the present invention can realize the communication between the application and multiple SDKs through the communication engine, shield the interface differences of different SDKs, and while realizing the integration of the application to multiple SDKs, that is, the expansion of different businesses, it can effectively reduce the complexity, development difficulty and maintenance difficulty of the application, and improve the business scalability of the application.
[0185] Specifically, the application can realize the calling of the application program to different SDKs, that is, the integration of the application program to different SDKs, by the manager 303, the executor 304, the plurality of adapters 302 and the plurality of wrappers 301 in the communication engine and the predefined interface contract, while shielding the interface differences of the SDKs provided by different service providers. When the application program integrates a new SDK, the application program can realize the integration of the new SDK by only writing a new wrapper 301 and a new adapter 302 for the new SDK, using the new wrapper 301 to encapsulate the new SDK, and using the new adapter 302 to call the new SDK encapsulated by the new wrapper 301, without modifying the code of the application program, thereby effectively reducing the complexity, development difficulty and maintenance difficulty of the application program, and effectively improving the business extensibility of the application program.
[0186] The application program and the SDK communication device provided in the embodiment can realize the calling of the application program to different SDKs, that is, the integration of the application program to different SDKs, by the communication engine and the predefined interface contract, while shielding the interface differences of the SDKs provided by different service providers, thereby effectively reducing the complexity, development difficulty and maintenance difficulty of the application program, and effectively improving the business extensibility of the application program.
[0187] Based on Figure 3 The application program and the SDK communication device provided in the embodiment can realize the calling of the application program to different SDKs, that is, the integration of the application program to different SDKs, by the communication engine and the predefined interface contract, while shielding the interface differences of the SDKs provided by different service providers, thereby effectively reducing the complexity, development difficulty and maintenance difficulty of the application program, and effectively improving the business extensibility of the application program.
[0188] In the second working mode, the adapter 302 receives the SDK command sent by the target SDK encapsulated by the wrapper 301.
[0189] The adapter 302 calls the manager 303 to make the manager 303 create a second engine command of a corresponding command type according to the SDK command.
[0190] The manager 303 sends the second engine command to the executor 304.
[0191] The executor 304 schedules the second engine command to the application program through the manager 303 to make the application program perform an operation corresponding to the second engine command.
[0192] When the communication engine receives the SDK command sent by the SDK, the communication engine can enter the second working mode. Specifically, in the second working mode, the adapter 302 can receive the SDK command sent by the SDK encapsulated by the wrapper 301.
[0193] After receiving the SDK command, the adapter 302 may call the manager 303 so that the manager 303 may create a second engine command of a corresponding command type according to the SDK command.
[0194] After creating the second engine command, the manager 303 may send the second engine command to the executor 304 , and the executor 304 may schedule the second engine command.
[0195] Specifically, the executor 304 may send the second engine command to the application program through the manager 303 , so that the application program may execute the operation corresponding to the second engine command.
[0196] Specifically, when an application integrates multiple SDKs and the communication engine is in the second working mode, an adapter 302 can receive an SDK command sent by its corresponding SDK, and then the adapter 302 that receives the SDK command can call the manager 303 to create an engine command.
[0197] Among them, the communication engine can realize the command transmission from the SDK to the application, so that the application can integrate more functions of the SDK, achieve coverage of a wider range of services, and further improve the scalability of the application to the business.
[0198] It can be understood that the communication engine can realize command transmission from the application to the SDK, and can also realize command transmission from the SDK to the application. Therefore, the communication engine can realize command interaction between the application and the SDK, so that the application can more completely integrate the functions of the SDK and further improve the scalability of the application to the business.
[0199] The communication device between the application and the SDK proposed in this embodiment can realize command interaction between the application and the SDK through the communication engine, so that the application can more completely integrate the functions of the SDK and further improve the scalability of the application to the business.
[0200] based on Figure 3 As shown in the structural diagram, this embodiment proposes another communication device between an application and an SDK, in which the communication engine may include multiple executors 304. The manager 303 sends the first engine command to the executor 304, which is set to:
[0201] The manager 303 sends the first engine command to a target executor 304 corresponding to the command type among the plurality of executors 304 ;
[0202] The executor 304 dispatches the first engine command to the adapter 302, which is set as:
[0203] The target executor 304 dispatches the first engine command to the adapter 302 .
[0204] The present invention may classify the executors 304 according to the command types of the engine commands scheduled by the executors 304 .
[0205] Specifically, the manager 303 may send the first engine command to the corresponding target executor 304 according to the command type of the first engine command.
[0206] Specifically, after receiving the first engine command, the target executor 304 may schedule the first engine command to the adapter 302 according to the command scheduling policy.
[0207] The command scheduling strategies for different executors 304 may be different, and the present invention may set corresponding command scheduling strategies for different types of executors 304 .
[0208] It should be noted that the present invention sets corresponding types of executors 304 according to different command types, which can improve the scheduling efficiency of the executor 304 for engine commands, and can further improve the scheduling efficiency of engine commands and save related resources by setting corresponding command scheduling strategies for different types of executors 304.
[0209] Optionally, after receiving a new engine command, the executor 304 may add the new engine command to the end of the command queue. In the process of dispatching the engine commands in the command queue to the adapter 302, the executor 304 may dispatch the engine commands in the command queue in order from the head of the queue to the end of the queue, and may prohibit dispatching the next adjacent engine command before the adapter 302 has completed execution of the engine command. It should be noted that the adapter 302 may feedback the execution status of the engine command to the executor 304. When the adapter 302 completes execution of an engine command, the adapter 302 may feedback a message notification to the executor 304 that the engine command has been executed.
[0210] It is understandable that the executor 304 prohibits scheduling the next adjacent engine command before an engine command is executed by the adapter 302, which can effectively avoid application errors or instability caused by the simultaneous execution of different engine commands, and improve the stability and reliability of the application.
[0211] The communication device between the application and the SDK proposed in this embodiment can improve the scheduling efficiency of engine commands and save related resources. It can effectively avoid application errors or instability caused by the simultaneous execution of different engine commands, and improve the stability and reliability of the application.
[0212] The communication device between the above-mentioned application and SDK may include a processor and a memory. The encapsulator 301, adapter 302, manager 303 and executor 304 constituting the communication engine are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize the corresponding functions.
[0213] The processor contains a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be configured. By adjusting kernel parameters, the number of interactions between the client and the electronic device (i.e., the server) can be reduced, reducing the network latency caused by these interactions and effectively improving service efficiency.
[0214] An embodiment of the present invention provides a computer-readable storage medium storing a computer program or instructions. When executed by a processor, the computer program or instructions can implement any of the aforementioned methods for communicating between an application and an SDK. When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can perform any of the aforementioned methods for communicating between an application and an SDK.
[0215] An embodiment of the present invention provides a processor, which is used to run a program, wherein the above-mentioned communication method between the application program and the SDK can be executed when the program is running.
[0216] like Figure 4 As shown, this embodiment provides an electronic device 400, which may include at least one processor 401, and at least one memory 402 and bus 403 connected to the processor 401; the memory 402 stores program instructions of the above-mentioned communication engine, and the above-mentioned communication engine includes an encapsulator 301, an adapter 302, a manager 303 and an executor 304; wherein the processor 401 and the memory 402 communicate with each other via the bus 403; the processor 401 is used to call the program instructions in the memory 403 to execute: any of the above-mentioned communication methods between the application and the SDK. The electronic device herein may be a server, a PC, a PAD, a mobile phone, etc.
[0217] The present invention also provides a computer program product, which may include a computer program / instruction, and when the computer program / instruction is executed by a processor, implements: any of the above-mentioned communication methods between the application program and the SDK.
[0218] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatuses, electronic 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 flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to produce a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0219] In a typical configuration, an electronic device includes one or more processors (CPUs), a memory, and a bus. The electronic device may also include an input / output interface, a network interface, and the like.
[0220] Memory may include non-permanent memory in a computer-readable storage medium, random access memory (RAM), and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory includes at least one memory chip. Memory is an example of a computer-readable storage medium.
[0221] Computer-readable storage media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable storage media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0222] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0223] The above are merely embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. A communication method between an application and an SDK, characterized in that: The method is applied to a communication engine, the communication engine comprising at least: an encapsulator, an adapter, a manager, and an executor, the communication engine comprising at least a first working mode; In the first working mode, the manager receives an application command sent by the application, creates a first engine command of a corresponding command type according to the application command, and sends the first engine command to the executor, wherein the command type includes at least an operation type; The executor dispatches the first engine command to the adapter; The adapter calls the target SDK encapsulated by the encapsulator to execute the first engine command according to the interface contract matching the operation type; The communication engine includes multiple encapsulators and multiple adapters, and the command type further includes an SDK type; the executor dispatches the first engine command to the adapter, including: The executor dispatches the first engine command to a target adapter corresponding to the target SDK type among the multiple adapters; The adapter calls the target SDK encapsulated by the encapsulator to execute the first engine command according to the interface contract matching the operation type, including: The target adapter calls the target SDK encapsulated by the target wrapper to execute the first engine command according to the interface contract matching the operation type. The target wrapper is a wrapper corresponding to the target adapter among the multiple wrappers.
2. The method according to claim 1, characterized in that The communication engine further includes a second working mode; the method further includes: In the second working mode, the adapter receives the SDK command sent by the target SDK encapsulated by the encapsulator; The adapter calls the manager so that the manager creates a second engine command of a corresponding command type according to the SDK command; The manager sends the second engine command to the executor; The executor dispatches the second engine command to the application through the manager, so that the application executes the operation corresponding to the second engine command.
3. The method according to claim 1, characterized in that The communication engine further includes: an interface contract definer; The interface contract definer is used to predefine the interface contract.
4. The method according to claim 1, wherein The communication engine includes a plurality of executors; the manager sends the first engine command to the executors, including: The manager sends the first engine command to a target executor corresponding to the command type among the plurality of executors; The executor dispatches the first engine command to the adapter, including: The target executor dispatches the first engine command to the adapter.
5. The method according to claim 1, wherein The executor includes a command queue, wherein the command queue is composed of ordered engine commands arranged according to arrival time; after the manager sends the first engine command to the executor, the method further includes: The executor adds the first engine command to the command queue; The executor dispatches the first engine command to the adapter, including: The executor dispatches the first engine command to the adapter according to the command dispatching policy.
6. A communication device between an application and an SDK, characterized in that: Applied to a communication engine, the communication engine comprising at least: an encapsulator, an adapter, a manager, and an executor, the communication engine comprising at least a first working mode; In the first working mode, the manager receives an application command sent by the application, creates a first engine command of a corresponding command type according to the application command, and sends the first engine command to the executor, wherein the command type includes at least an operation type; The executor dispatches the first engine command to the adapter; The adapter calls the target SDK encapsulated by the encapsulator to execute the first engine command according to the interface contract matching the operation type; The communication engine includes multiple encapsulators and multiple adapters, and the command type also includes an SDK type; the executor dispatches the first engine command to the adapter, and is set to: The executor dispatches the first engine command to a target adapter corresponding to the target SDK type among the multiple adapters; The adapter calls the target SDK encapsulated by the encapsulator to execute the first engine command according to the interface contract matching the operation type, and is set to: The target adapter calls the target SDK encapsulated by the target wrapper to execute the first engine command according to the interface contract matching the operation type. The target wrapper is a wrapper corresponding to the target adapter among the multiple wrappers.
7. The communication device between an application and an SDK according to claim 6, characterized in that: The communication engine also includes a second operating mode; In the second working mode, the adapter receives the SDK command sent by the target SDK encapsulated by the encapsulator; The adapter calls the manager so that the manager creates a second engine command of a corresponding command type according to the SDK command; The manager sends the second engine command to the executor; The executor dispatches the second engine command to the application through the manager, so that the application executes the operation corresponding to the second engine command.
8. The communication device between an application and an SDK according to claim 6, wherein: The communication engine further includes: an interface contract definer; The interface contract definer is used to predefine the interface contract.
Citation Information
Patent Citations
Page rendering method and device
CN111158818A
Functional module calling method, equipment, and computer readable storage medium
CN111684420A