Software Development Kit Interface Adaptation Method, Device, Equipment and Storage Medium
By determining the interface adaptation standards in the software development toolkit interface adaptation, creating interface conversion layer and business threads, the development inconvenience and long cycle problems caused by differences in SDK interfaces of each manufacturer are solved, and a more convenient and fast product development process is achieved.
Patent Information
- Application Number
- CN202111195194.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-13
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2041-10-13
AI Technical Summary
The software development toolkit interfaces provided by manufacturers in the prior art lack uniform specifications, resulting in inconvenient product development and long development cycles.
By determining the interface adaptation standards for the software development toolkit to be adapted, an interface conversion layer is created, the interface definition of the software development toolkit to be adapted to be adapted to the standard interface definition, and a business thread is created based on the standard interface definition to complete the adaptation of the software development toolkit interface.
It realizes that product development can be completed without considering the differences in API usage of SDKs of each manufacturer, simplifying the development process and improving product development efficiency.
Smart Images

Figure CN113900646B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of the Internet of Things, and particularly to a method, device, equipment and storage medium for adapting software development kit interfaces. Background Art
[0002] At present, with the rapid development of China's economy and the rapid improvement of people's living standards, people's pursuit of the quality of life is also getting higher and higher, and intelligent devices have gradually entered thousands of households. However, in the process of developing intelligent devices or intelligent products, due to the lack of unified specifications for the software development kits (SDKs) provided by each chip manufacturer, it will bring many inconveniences to product development. For example, the hardware architectures and hardware resources selected by each chip manufacturer are different, the operating systems and software frameworks provided are different, the application programming interfaces (APIs) of the output SDKs are different, and the protocol stacks and software library versions used in the SDKs of each manufacturer are inconsistent. The above usage differences make it necessary to perform different interface adaptations for different manufacturer SDKs during product development, which makes product development inconvenient and prolongs the development cycle.
[0003] The above content is only used to assist in understanding the technical solution of the present invention, and does not represent an admission that the above content is prior art. Summary of the Invention
[0004] The main purpose of the present invention is to provide a method, device, equipment and storage medium for adapting software development kit interfaces, aiming to solve the technical problem that the software development kit interfaces provided by each manufacturer in the prior art do not have a unified usage specification, which makes product development inconvenient and the development cycle longer.
[0005] To achieve the above purpose, the present invention provides a method for adapting software development kit interfaces, and the method includes the following steps:
[0006] Determine the interface adaptation standard of the software development kit to be adapted;
[0007] Create an interface conversion layer according to the interface adaptation standard;
[0008] Convert the interface definition of the software development kit to be adapted into a standard interface definition through the interface conversion layer;
[0009] Create a business thread based on the standard interface definition to complete the adaptation of the software development kit interface.
[0010] Optionally, the step of determining the interface adaptation standard of the software development kit to be adapted includes:
[0011] Obtain the type of the software development kit to be adapted;
[0012] Determine the interface adaptation standard of the software development kit to be adapted according to the type of the software development kit to be adapted.
[0013] Optionally, the step of determining the interface adaptation standard of the software development kit to be adapted according to the type of the software development kit to be adapted includes:
[0014] Create a configuration file, and determine a selection code through macro definitions in the configuration file according to the type of the software development kit to be adapted;
[0015] Obtain the interface adaptation standard of the software development kit to be adapted according to the selection code.
[0016] Optionally, after the step of obtaining the interface adaptation standard of the software development kit to be adapted according to the selection code, it includes:
[0017] Detect the current usage version of the adaptation component in the interface adaptation standard;
[0018] Obtain the latest usage version of the adaptation component, and determine whether the current usage version needs to be upgraded based on the latest usage version;
[0019] If so, use the latest usage version as the current usage version of the adaptation component.
[0020] Optionally, the step of converting the interface definition of the software development kit to be adapted into a standard interface definition through the interface conversion layer includes:
[0021] Obtain the interface information that needs to be converted in the interface definition for each software development kit to be adapted, and determine the interface type for interface definition conversion based on the interface information;
[0022] Create an interface conversion layer, and convert the interface definitions of each software development kit to be adapted into standard interface definitions through the interface conversion layer based on the interface type.
[0023] Optionally, after the step of creating a business thread based on the standard interface definition, it includes:
[0024] Obtain the callback command corresponding to the business thread;
[0025] Add the callback command to the business thread so that the business thread runs according to the callback command.
[0026] Optionally, after the step of creating a business thread based on the standard interface definition, it further includes:
[0027] Obtain a minimum sample test example, perform a functional test on the service thread based on the minimum sample test example, and obtain a test result;
[0028] Judge whether the service thread is reasonable based on the test result;
[0029] If not, iterate on the service thread until the service thread is reasonable.
[0030] In addition, to achieve the above object, the present invention also proposes a software development kit interface adaptation device, and the software development kit interface adaptation device includes:
[0031] A determination module, configured to determine an interface adaptation standard for a software development kit to be adapted;
[0032] A creation module, configured to create an interface conversion layer according to the interface adaptation standard;
[0033] A conversion module, configured to convert the interface definition of the software development kit to be adapted into a standard interface definition through the interface conversion layer;
[0034] An adaptation module, configured to create a service thread based on the standard interface definition to complete the adaptation of the software development kit interface.
[0035] In addition, to achieve the above object, the present invention also proposes a software development kit interface adaptation device, and the software development kit interface adaptation device includes: a memory, a processor, and a software development kit interface adaptation program stored on the memory and executable on the processor, and the software development kit interface adaptation program is configured to implement the steps of the software development kit interface adaptation method as described above.
[0036] In addition, to achieve the above object, the present invention also proposes a storage medium, and a software development kit interface adaptation program is stored on the storage medium, and when the software development kit interface adaptation program is executed by a processor, the steps of the software development kit interface adaptation method as described above are implemented.
[0037] The present invention adapts the interface of a software development kit to be adapted by determining the interface adaptation standard of the software development kit to be adapted; creating an interface conversion layer according to the interface adaptation standard; converting the interface definition of the software development kit to be adapted into a standard interface definition through the interface conversion layer; and creating a service thread based on the standard interface definition to complete the adaptation of the software development kit interface. By the above method, the interface definition of the software development kit to be adapted is converted into a standard interface definition through the interface conversion layer, so that when developing a product, it is not necessary to consider the differences in the use of APIs of the SDKs provided by each manufacturer, and the relevant product development can be completed only based on the standard interface definition. The above process avoids the problem of continuously adapting to the original factory SDK in the traditional method, makes the development process more convenient and fast, and effectively improves the product development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 is a schematic structural diagram of a software development kit interface adaptation device in the hardware operating environment related to the solution of the embodiment of the present invention;
[0039] Figure 2 is a schematic flowchart of the first embodiment of a method for adapting a software development kit interface according to the present invention;
[0040] Figure 3 is a schematic flowchart of the second embodiment of a method for adapting a software development kit interface according to the present invention;
[0041] Figure 4 is a schematic flowchart of the third embodiment of a method for adapting a software development kit interface according to the present invention
[0042] Figure 5 is a structural block diagram of the first embodiment of a device for adapting a software development kit interface according to the present invention.
[0043] The implementation, functional features and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0044] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0045] Refer to Figure 1 , Figure 1 is a schematic structural diagram of a software development kit interface adaptation device in the hardware operating environment related to the solution of the embodiment of the present invention.
[0046] As Figure 1As shown in the figure, the software development kit interface adaptation device may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen and an input unit such as a keyboard. Optionally, the user interface 1003 may further include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a Wireless-Fidelity (WI-FI) interface). The memory 1005 may be a high-speed Random Access Memory (RAM), or a stable Non-Volatile Memory (NVM), such as a disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0047] Those skilled in the art can understand that Figure 1 the structure shown in does not constitute a limitation on the software development kit interface adaptation device, and may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0048] As Figure 1 shown, in the memory 1005 as a storage medium, there may be included an operating system, a network communication module, a user interface module, and a software development kit interface adaptation program.
[0049] In Figure 1 the software development kit interface adaptation device shown, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the software development kit interface adaptation device of the present invention may be provided in the software development kit interface adaptation device. The software development kit interface adaptation device calls the software development kit interface adaptation program stored in the memory 1005 through the processor 1001, and executes the software development kit interface adaptation method provided by the embodiments of the present invention.
[0050] The embodiments of the present invention provide a software development kit interface adaptation method. Referring to Figure 2 , Figure 2 it is a schematic flowchart of the first embodiment of a software development kit interface adaptation method of the present invention.
[0051] In this embodiment, the software development kit interface adaptation method includes the following steps:
[0052] Step S10: Determine the interface adaptation standard for the software development kit to be adapted.
[0053] It should be noted that the execution subject of the method of the present invention can be a computer device with functions such as data processing and program running, such as a computer, or other electronic devices with similar functions. This embodiment does not limit this.
[0054] Furthermore, it should be noted that a software development kit can be understood as a tool used by software engineers to build application software development for specific software packages, software frameworks, hardware platforms, operating systems, etc. It is generally called a software development kit, that is, SDK, and is a tool kit provided by a third-party service provider to implement a certain function of a software product. It should be understood that during the product development process, for the SDKs provided by different manufacturers, developers need to perform different interface adaptation work according to different business requirements, and the number of SDKs selected can be specifically selected according to the actual business requirements of the developers. This embodiment does not limit this. The interface adaptation standard can be understood as that the user selects a protocol stack and components serving the interface adaptation work. The protocol stack refers to the sum of protocols at each layer in the network, which vividly reflects the process of file transmission in a network: from the upper-layer protocol to the lower-layer protocol, and then from the lower-layer protocol to the upper-layer protocol. The component is a code module for implementing a certain part of the function.
[0055] In specific implementation, each original factory SDK and the development adaptation layer have a protocol stack. Before the start of the overall development process, developers can select a suitable protocol stack according to the actual business requirements.
[0056] Step S20: Create an interface conversion layer according to the interface adaptation standard.
[0057] It should be noted that the interface conversion layer can be understood as a functional layer for formulating the interface output standard for application development, and can also be called an interface adaptation layer. For example, the relevant code provided by HAL, whose function is to convert the API interface definition of the original factory SDK into the interface definition of the interface adaptation layer standard.
[0058] In specific implementation, based on the selected interface adaptation standard, that is, the selected protocol stack, an interface conversion layer is created, and the interface definitions of all the original factory SDKs that may be used are converted in the adaptation layer. During the subsequent development process, developers can specifically select and use them according to the actual situation with a configuration file.
[0059] Step S30: Convert the interface definition of the software development kit to be adapted into a standard interface definition through the interface conversion layer.
[0060] It should be noted that during application development, the standard interface definition has already adapted to the differences of each original factory's SDK. In specific implementation, there is no need to consider the usage differences between each original factory's SDK. After passing through the standard definition of the interface adaptation layer, the interface naming and naming parameters of the standard interface can be output to the application development layer. Taking the operation of flash as an example, when using the original factory's SDK1, operations such as closing flash protection, writing flash data, and opening flash protection are required; for the use of the original factory's SDK2, only directly calling flash write data is needed. The interface naming rules of these two original factory's SDKs are different, which is not convenient for developers to directly call during business development. At this time, through the interface conversion layer, such as defined as HAL_app, the interface naming rules can be converted, and the standard for defining the interface naming parameters can be output to the application development layer for easy development.
[0061] Step S40: Create a business thread based on the standard interface definition to complete the adaptation of the software development kit interface.
[0062] It is easy to understand that a thread is the smallest unit of a program execution flow and has three states: ready, blocked, and running. Therefore, after completing the above interface definition conversion process, specific business work needs to be completed through threads.
[0063] In specific implementation, a business thread is created in the original factory's SDK, and the interface adaptation layer adapts to the original factory's SDK, for example, completed through HAL_app. Further, the business framework of the interface adaptation layer, such as the Libevent framework, is called in a thread of the OS API layer of the original factory's SDK in the form of a callback. Furthermore, the application layer calls the interface of the interface adaptation layer, mainly calling the business middleware of the interface adaptation layer to implement specific business. For example, if a certain product needs to implement the OTA function, that is, to provide a voice data service function, the application layer only needs to call the OTA middleware; if a certain device needs to connect to the server and subscribe and publish messages in the MQTT mode, only the MQTT middleware needs to be called. In addition, the application layer can also call other interfaces in HAL_app. Such as calling peripheral UART, LED, etc., OS interface semaphores, queues, etc.
[0064] In this embodiment, the interface adaptation standard of the software development kit to be adapted is determined; an interface conversion layer is created according to the interface adaptation standard; the interface definition of the software development kit to be adapted is converted into a standard interface definition through the interface conversion layer; and a service thread is created based on the standard interface definition to complete the adaptation of the software development kit interface. In the above manner, the interface definition of the software development kit to be adapted is converted into a standard interface definition through the interface conversion layer, so that when developing a product, it is not necessary to consider the differences in the use of APIs of the SDKs provided by each manufacturer, and only the standard interface of the interface adaptation layer needs to be called at the application layer to complete the development of the relevant product. This embodiment makes the development process more convenient and fast, and effectively improves the product development efficiency.
[0065] Reference Figure 3 , Figure 3 is a schematic flowchart of the second embodiment of a method for adapting an interface of a software development kit according to the present invention.
[0066] Based on the above first embodiment, the second embodiment of the present invention is proposed. Step S10 of the method for adapting an interface of a software development kit in this embodiment includes:
[0067] Step S101: Obtain the type of the software development kit to be adapted.
[0068] It should be noted that since the SDKs provided by each manufacturer are different, selecting different SDKs for different business functions can effectively improve the development efficiency. Further, it should be noted that since there are differences in the use of the interfaces of each SDK, such as read-only, write-only, readable and writable types, etc., therefore, the most suitable interface adaptation standard can be determined according to these type differences in combination with one's own actual business needs.
[0069] Step S102: Determine the interface adaptation standard of the software development kit to be adapted according to the type of the software development kit to be adapted.
[0070] It is easy to understand that since both the original factory SDK and the interface adaptation layer have corresponding adaptation standards, that is, protocol stacks, therefore, which protocol stack to specifically select can be judged through the type of function interface provided by the development tool. If the functions provided by the SDK are relatively single, the protocol stack of the interface adaptation layer can be selected. Generally speaking, selecting the protocol stack of the interface adaptation layer is sufficient to meet the needs of users.
[0071] In a specific implementation, the step of determining the interface adaptation standard of the software development kit to be adapted according to the type of the software development kit to be adapted includes:
[0072] Create a configuration file, and determine the selection code through the macro definition in the configuration file according to the type of the software development kit to be adapted;
[0073] Obtain the interface adaptation standard of the software development kit to be adapted according to the selected code number.
[0074] It should be noted that by creating a configuration file, assigning a code number through macro definition, and matching the code number with the type selected by the user, the specific interface adaptation standard to be used can be determined.
[0075] In some embodiments, after the step of obtaining the interface adaptation standard of the software development kit to be adapted according to the selected code number, it includes:
[0076] Detect the current version of the adaptation component used in the interface adaptation standard;
[0077] Obtain the latest version of the adaptation component used, and determine whether the current version needs to be upgraded based on the latest version;
[0078] If so, use the latest version as the current version of the adaptation component.
[0079] It should be noted that the adaptation component can be understood as a code module that implements part of the adaptation function. During the development process, this component can be directly used, thus reducing the coding volume of developers. Therefore, during the specific use process, it is necessary to detect the current version of the component used. If a latest version is detected, the current version can be upgraded to obtain more complete functions.
[0080] In this embodiment, by creating a configuration file and selecting the interface adaptation standard according to the type of the software development kit, the most suitable interface adaptation standard for different services is realized. Based on the adaptation standard, the interface standard for application development is formulated, reducing the dependence on the original factory SDK for the development of the Internet of Things channel, thereby improving the development efficiency.
[0081] Reference Figure 4 , Figure 4 is a schematic flowchart of the third embodiment of a method for adapting an interface of a software development kit according to the present invention.
[0082] Based on the above second embodiment, the third embodiment of the present invention is proposed. Step S20 of the method for adapting an interface of a software development kit in this embodiment includes:
[0083] Step S201: Obtain the interface information that needs to be converted for interface definition of each software development kit to be adapted, and determine the interface type for interface definition conversion based on the interface information.
[0084] It is easy to understand that since different interfaces provide different specific functions, such as an interface for lighting a lamp function, an interface for driving a device to start, etc., the interface type for interface definition conversion can be determined according to the interface function information, specifically what kind of function usage type it is.
[0085] Step S202: Create an interface conversion layer, and based on the interface type, convert the interface definitions of each software development kit to be adapted into standard interface definitions through the interface conversion layer.
[0086] It is easy to understand that since there are many software development kits available for specific business development, to avoid omissions, when creating an interface conversion layer for interface definition conversion, the interface definitions of all software development kits to be adapted that may be used are converted into standard interface definitions. In this way, during the development process, when the user needs to use a certain SDK, the application layer can directly call the interface of the interface conversion layer, avoiding the inconvenience caused by the need to use a certain interface but without interface definition conversion. In specific implementation, the selection code is determined through macro definition, and then the SDK to be used is determined.
[0087] In specific implementation, after the step of creating a service thread based on the standard interface definition, it includes:
[0088] Obtain the callback command corresponding to the service thread;
[0089] Add the callback command to the service thread so that the service thread runs according to the callback command.
[0090] It is easy to understand that when developers perform business development in the application layer, based on the already constructed service thread, developers write the implementation code for a specific function to be implemented in the application layer. The specific implementation process is completed by the service thread, and since the interface adaptation work has been completed before this, there is no need to consider the differences between the original factory SDKs. By calling back the Internet of Things channel thread created in the SDK, that is, the service thread, the entire service thread runs.
[0091] In some implementation processes, after the step of creating a service thread based on the standard interface definition, it further includes:
[0092] Obtain the minimum sample test example, perform functional testing on the service thread based on the minimum sample test example, and obtain the test result;
[0093] Judge whether the service thread is reasonable based on the test result;
[0094] If not, iterate on the service thread until the service thread is reasonable.
[0095] It is easy to understand that since corresponding development examples are provided in the complete SDK, for specific business functions, function debugging can be carried out through sample test examples to verify whether the coding is reasonable, and based on the debugging results, verify whether the application development is successful. Moreover, during the process of detection and debugging, the code quality is improved through repeated iterations.
[0096] In this embodiment, the business thread in the original factory SDK is called in the form of a callback, so that the created business thread can complete the corresponding actual tasks. After the call is completed, the rationality of the business thread is detected through test examples, and continuous iteration is carried out based on the detection results, thereby improving the code quality.
[0097] In addition, an embodiment of the present invention further provides a storage medium, on which a software development kit interface adaptation program is stored. When the software development kit interface adaptation program is executed by a processor, the steps of the software development kit interface adaptation method described above are implemented.
[0098] Refer to Figure 5 , Figure 5 which is the structural block diagram of the first embodiment of the software development kit interface adaptation device of the present invention.
[0099] As Figure 5 shown, the software development kit interface adaptation device proposed by the embodiment of the present invention includes:
[0100] A determination module 10, configured to determine the interface adaptation standard of the software development kit to be adapted;
[0101] A creation module 20, configured to create an interface conversion layer according to the interface adaptation standard;
[0102] A conversion module 30, configured to convert the interface definition of the software development kit to be adapted into a standard interface definition through the interface conversion layer;
[0103] An adaptation module 40, configured to create a business thread based on the standard interface definition to complete the adaptation of the software development kit interface.
[0104] Further, the determination module 10 is further configured to obtain the type of the software development kit to be adapted; determine the interface adaptation standard of the software development kit to be adapted according to the type of the software development kit to be adapted.
[0105] Further, the determination module 10 is further configured to create a configuration file, determine a selection code through macro definition according to the type of the software development kit to be adapted; obtain the interface adaptation standard of the software development kit to be adapted according to the selection code.
[0106] Further, the software development kit interface adaptation device provided by the embodiment of the present invention further includes: an upgrade module, configured to detect the current usage version of the adaptation component in the interface adaptation standard; obtain the latest usage version of the adaptation component, and determine whether the current usage version needs to be upgraded based on the latest usage version; if so, upgrade the current usage version according to the latest usage version.
[0107] Further, the conversion module 30 is further configured to obtain the interface information that needs to be subjected to interface definition conversion for each software development kit to be adapted, and determine the interface type for performing interface definition conversion based on the interface information; create an interface conversion layer, and convert the interface definitions of each software development kit to be adapted into standard interface definitions through the interface conversion layer.
[0108] Further, the software development kit interface adaptation device provided by the embodiment of the present invention further includes: a callback module, configured to obtain the callback command corresponding to the service thread; add the callback command into the service thread to make the service thread run.
[0109] Further, the software development kit interface adaptation device provided by the embodiment of the present invention further includes: a detection module, configured to obtain a minimum sample test example, perform a function test on the service thread based on the minimum sample test example, and obtain a test result; determine whether the service thread is reasonable based on the test result; if not, iterate the service thread until the service thread is reasonable.
[0110] In this embodiment, the determination module 10 determines the interface adaptation standard of the software development kit to be adapted; the creation module 20 creates an interface conversion layer according to the interface adaptation standard; the conversion module 30 converts the interface definition of the software development kit to be adapted into a standard interface definition through the interface conversion layer; the adaptation module 40 creates a service thread based on the standard interface definition to complete the adaptation of the software development kit interface. Thus, it is realized that the interface definition of the software development kit to be adapted is converted into a standard interface definition through the interface conversion layer, so that when developing a product, it is not necessary to consider the API usage differences of the SDKs provided by each manufacturer, and relevant product development can be completed only based on the standard interface definition. The above process avoids the problem that the original factory SDK needs to be continuously adapted in the traditional method, makes the development process more convenient and fast, and effectively improves the product development efficiency.
[0111] It should be understood that the above is only an example for illustration, and does not constitute any limitation to the technical solution of the present invention. In specific applications, those skilled in the art can set according to needs, and the present invention does not make any restrictions on this.
[0112] It should be noted that the workflow described above is only illustrative and does not limit the protection scope of the present invention. In actual applications, those skilled in the art can select some or all of them according to actual needs to achieve the purpose of the solution of this embodiment, and no limitation is imposed here.
[0113] In addition, for the technical details not described in detail in this embodiment, reference can be made to the software development kit interface adaptation method provided in any embodiment of the present invention, and details will not be repeated here.
[0114] In addition, it should be noted that in this article, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or system. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or system including that element.
[0115] The serial numbers of the above embodiments of the present invention are only for description and do not represent the superiority or inferiority of the embodiments.
[0116] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as a read-only memory (ROM) / RAM, magnetic disk, optical disk), and includes several instructions for causing a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present invention.
[0117] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent structural or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present invention.
Claims
1. A software development kit interface adaptation method, characterized in that The method includes the following steps: Determine the interface adaptation standard for the software development kit to be adapted. The interface adaptation standard is to select a protocol stack and components serving the interface adaptation work. The protocol stack is the sum of the protocols at each layer in the network, reflecting the process of file transfer in the network, and the component is a code module that implements part of the function; Create an interface conversion layer according to the interface adaptation standard; Convert the interface definition of the software development kit to be adapted into a standard interface definition through the interface conversion layer; Create a service thread based on the standard interface definition to complete the adaptation of the software development kit interface; Among them, the step of determining the interface adaptation standard for the software development kit to be adapted includes: Obtain the type of the software development kit to be adapted; Create a configuration file, and determine the selection code through the macro definition in the configuration file according to the type of the software development kit to be adapted; Obtain the interface adaptation standard of the software development kit to be adapted according to the selection code.
2. The method according to claim 1, characterized in that After the step of obtaining the interface adaptation standard of the software development kit to be adapted according to the selection code, it includes: Detect the current version of the adaptation component used in the interface adaptation standard; Obtain the latest version of the adaptation component used, and determine whether the current version needs to be upgraded based on the latest version; If so, use the latest version as the current version of the adaptation component.
3. The method according to claim 1, wherein The step of converting the interface definition of the software development kit to be adapted into a standard interface definition through the interface conversion layer includes: Obtain the interface information that needs to be converted for each software development kit to be adapted, and determine the interface type for interface definition conversion based on the interface information; Create an interface conversion layer, and convert the interface definitions of each software development kit to be adapted into standard interface definitions through the interface conversion layer based on the interface type.
4. The method according to claim 3, characterized in that After the step of creating a service thread based on the standard interface definition, it includes: Obtain the callback command corresponding to the service thread; Add the callback command to the service thread so that the service thread runs according to the callback command.
5. The method according to claim 4, wherein After the step of creating a service thread based on the standard interface definition, it also includes: Obtain the minimum sample test example, perform a function test on the service thread based on the minimum sample test example, and obtain the test result; Judge whether the service thread is reasonable based on the test result; If not, iterate the service thread until the service thread is reasonable.
6. A software development kit interface adaptation device, characterized in that The software development kit interface adaptation device includes: A determination module for determining the interface adaptation standard for the software development kit to be adapted. The interface adaptation standard is to select a protocol stack and components serving the interface adaptation work. The protocol stack is the sum of the protocols at each layer in the network, reflecting the process of file transfer in the network, and the component is a code module that implements part of the function; A creation module for creating an interface conversion layer according to the interface adaptation standard; A conversion module for converting the interface definition of the software development kit to be adapted into a standard interface definition through the interface conversion layer; An adaptation module, configured to create a service thread based on the standard interface definition to complete the adaptation of the software development kit interface; Among them, the step of determining the interface adaptation standard of the software development kit to be adapted includes: Obtain the type of the software development kit to be adapted; Create a configuration file, and determine the selection code through macro definitions in the configuration file according to the type of the software development kit to be adapted; Obtain the interface adaptation standard of the software development kit to be adapted according to the selection code.
7. A software development kit interface adaptation device, characterized in that, The device includes: a memory, a processor, and a software development kit interface adaptation program stored on the memory and executable on the processor. The software development kit interface adaptation program is configured to implement the steps of the software development kit interface adaptation method according to any one of claims 1 to 5.
8. A storage medium, characterized in that, A software development kit interface adaptation program is stored on the storage medium. When the software development kit interface adaptation program is executed by a processor, it implements the steps of the software development kit interface adaptation method according to any one of claims 1 to 5.