Method, device, equipment and product for updating adapter program of internet-of-things operating system

Through the method of automatically updating the adapter program of the IoT operating system, the problem of inefficient adapter updates caused by API changes is solved, and the effect of automated updates and cost reduction is achieved.

CN119806603AActive Publication Date: 2025-04-11INFORMATION & COMM BRANCH OF STATE GRID JIANGSU ELECTRIC POWER +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510303519.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-14
Publication Date
2025-04-11
Estimated Expiration
2045-03-14

AI Technical Summary

Technical Problem

In the prior art, the iteration of the IoT operating system version leads to API changes, resulting in the inability to run the original hardware adapter program normally. Developers need to manually analyze and modify the code, which is inefficient and error-prone, which increases the cost and cycle of software development.

Method used

By determining the target interface based on the target relationship file, automatically update the adapter program of the IoT operating system, generate update reports and modify plan recommendation reports, and automatically update the adapter program.

Benefits of technology

It reduces the workload and investment costs of developers, provides effective update solutions, and improves the update efficiency and accuracy of adapter programs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806603A_ABST
    Figure CN119806603A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an updating method and device for an adapter program of an internet of things operating system, equipment and a product. The updating method comprises the steps that a target relation file is determined based on first interface information of a first operating system and second interface information of a second operating system; determining a target interface based on the target relation file, wherein the target interface comprises an interface of which the function name is changed, an interface of which the return value is increased, an interface of which the return value is deleted, an interface of which the type of the return value is modified, an interface of which the parameter is deleted, an interface of which the original parameter is deleted and a first target parameter is added and / or an interface of which a second target parameter is added; and updating the original adaptive program of the second operating system based on the target interface to obtain a target adaptive program suitable for the first operating system, and outputting an update report and a modification scheme recommendation report. According to the technical scheme, automatic updating of the adaptation program is achieved, the workload and the input cost of developers are reduced, and effective updating scheme recommendation is provided for the developers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the technical field of system update, and more particularly to a method, device, equipment and product for updating an adapter program of an Internet of Things operating system. Background Art

[0002] In recent years, the development of IoT operating systems has been changing with each passing day. As an open source IoT operating system for all scenarios, the OpenHarmony operating system has been widely used in smart terminals, IoT devices and other fields with its distributed capabilities and powerful cross-device collaboration.

[0003] With the continuous advancement of technology and the growing needs of users, the OpenHarmony operating system needs to continue to iterate to optimize performance, expand functions and improve security. However, each version iteration is often accompanied by changes in the Application Programming Interface (API). These API changes will cause the original hardware adapters written based on the old version of the API to not run properly. Developers need to update the original adapters to ensure that they are compatible with the new version of the OpenHarmony operating system.

[0004] The traditional way to update the original adapter mainly relies on developers to manually analyze API changes and then modify the code based on experience. This method is not only inefficient and error-prone, but also requires a high level of technical skills and experience from developers. Developers need to invest a lot of time and energy to understand the details of the new version of the API and the specific impact of these changes on the original adapter, which undoubtedly increases the cost and cycle of software development. Summary of the invention

[0005] The embodiments of the present disclosure provide a method, apparatus, device and product for updating an adapter program of an IoT operating system, which realizes automatic updating of the adapter program, reduces the workload and investment cost of developers, and provides effective update solution recommendations for developers.

[0006] In a first aspect, a method for updating an IoT operating system adapter is provided, comprising:

[0007] Determine a target relationship file based on first interface information of the first operating system and second interface information of the second operating system, wherein the target relationship file is used to describe the interface correspondence relationship between the first operating system and the second operating system;

[0008] Determining a target interface based on the target relationship file, the target interface includes an interface with a changed function name, an interface with an increased return value, an interface with a deleted return value, an interface with a modified return value type, an interface with a deleted parameter, an interface with an deleted original parameter and an added first target parameter, and / or an interface with an added second target parameter;

[0009] Based on the target interface, the original adapter of the second operating system is updated to obtain a target adapter suitable for the first operating system, and an update report and a modification plan recommendation report are output; the update report includes an update record of the target interface; the modification plan recommendation report includes a propagation path list, first recommended modification information and second recommended modification information; wherein the propagation path list is used to store the propagation path of the target variable; the first recommended modification information is a variable that matches the type of the first target parameter; the second recommended modification information is a variable that matches the type of the second target parameter.

[0010] In a second aspect, a device for updating an IoT operating system adapter program is provided, comprising:

[0011] a target relationship file determining module, configured to determine a target relationship file based on first interface information of the first operating system and second interface information of the second operating system, wherein the target relationship file is used to describe an interface correspondence relationship between the first operating system and the second operating system;

[0012] a target interface determination module, configured to determine a target interface based on the target relationship file, wherein the target interface includes an interface whose function name is changed, an interface whose return value is increased, an interface whose return value is deleted, an interface whose return value type is modified, an interface whose parameters are deleted, an interface whose original parameters are deleted and a first target parameter is added, and / or an interface whose second target parameter is added;

[0013] A target adapter determination module is used to update the original adapter of the second operating system based on the target interface, obtain a target adapter suitable for the first operating system, and output an update report and a modification plan recommendation report; the update report includes an update record of the target interface; the modification plan recommendation report includes a propagation path list, first recommended modification information and second recommended modification information; wherein the propagation path list is used to store the propagation path of the target variable; the first recommended modification information is a variable that matches the type of the first target parameter; the second recommended modification information is a variable that matches the type of the second target parameter.

[0014] In a third aspect, an electronic device is provided, including:

[0015] at least one processor; and,

[0016] a memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for updating the Internet of Things operating system adapter program as described in the first aspect above.

[0018] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method for updating the Internet of Things operating system adapter program as described in the first aspect above is implemented.

[0019] In a fifth aspect, a computer program product is provided, the computer program product comprising a computer program, and when the computer program is executed by a processor, the computer program implements the method for updating the Internet of Things operating system adapter program as described in the first aspect above.

[0020] The embodiment of the present disclosure discloses a method, device, equipment and product for updating an adapter program of an Internet of Things operating system. The method includes: determining a target relationship file based on first interface information of a first operating system and second interface information of a second operating system, wherein the target relationship file is used to describe the interface correspondence relationship between the first operating system and the second operating system; determining a target interface based on the target relationship file, wherein the target interface includes an interface with a changed function name, an interface with an increased return value, an interface with a deleted return value, an interface with a modified return value type, an interface with a deleted parameter, an interface with an deleted original parameter and an interface with a first target parameter added, and / or an interface with a second target parameter added; updating the original adapter program of the second operating system based on the target interface to obtain a target adapter program suitable for the first operating system, and outputting an update report and a modification scheme recommendation report; the update report includes an update record of the target interface; the modification scheme recommendation report includes a propagation path list, a first recommended modification information and a second recommended modification information; wherein the propagation path list is used to store the propagation path of the target variable; the first recommended modification information is a variable matching the type of the first target parameter; the second recommended modification information is a variable matching the type of the second target parameter. This technical solution uses the target interface to update the original adapter program, and outputs an update report and a modification plan recommendation report to achieve automatic updating of the adapter program, reduce the workload and investment costs of developers, and provide developers with effective update plan recommendations.

[0021] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the embodiments of the present disclosure. Other features of the embodiments of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0023] Figure 1 It is a flow chart of a method for updating an IoT operating system adapter program provided in the first embodiment of the present disclosure;

[0024] Figure 2 is a schematic diagram of an updating process of an adapter provided in Embodiment 1 of the present disclosure;

[0025] Figure 3 It is a structural diagram of an updating device for an Internet of Things operating system adapter program provided in the second embodiment of the present disclosure;

[0026] Figure 4 It is a structural diagram of an electronic device provided in Embodiment 3 of the present disclosure. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the solutions of the embodiments of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only embodiments of a part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the embodiments of the present disclosure.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0029] Embodiment 1

[0030] Figure 1This is a flowchart of a method for updating an IoT operating system adapter provided in the first embodiment of the present disclosure. This embodiment is applicable to the case of updating an IoT operating system adapter. The method can be executed by an updating device for the IoT operating system adapter. The updating device for the IoT operating system adapter can be implemented in the form of hardware and / or software. The updating device for the IoT operating system adapter can be configured in an electronic device, including but not limited to computers, computers, terminals, servers and other devices with data processing capabilities. Figure 1 As shown, the method includes:

[0031] S110: Determine a target relationship file based on first interface information of the first operating system and second interface information of the second operating system, where the target relationship file is used to describe an interface correspondence relationship between the first operating system and the second operating system.

[0032] Specifically, the first operating system may be an updated operating system, and the second operating system may be an operating system before the update. For example, the first operating system may be an updated Openharmony operating system, and the second operating system may be an Openharmony operating system before the update. The first interface information may be determined based on the interface description document of the first operating system, and the second interface information may be determined based on the interface description document of the first operating system. The interface description document is a technical document used to describe the functions, usage methods, and parameter details of the API, and can provide developers with all the information required to use the API so that developers can correctly call and integrate these interfaces.

[0033] Exemplarily, two URL links can be input, pointing to the interface description documents of the first operating system and the second operating system respectively, that is, two strings describing the URLs can be used as the initial input. Based on such input, the content of the interface description document can be obtained by constructing the request library of the Python language, and the content of the interface description document can be parsed using the BeautifulSoup library, and the API interface information of the first operating system and the second operating system obtained by parsing can be saved as two texts respectively. The API interface description document of the second operating system can be represented as txt_old, and the API interface description document of the first operating system can be represented as txt_new. The txt_old text can be preprocessed to obtain the second interface information, and the txt_new text can be preprocessed to obtain the first interface information. The preprocessing operation can be to convert the contents in txt_old and txt_new into list form according to the column names in the CSV file, that is, method name, parameter, and return value.

[0034] Specifically, in the process of determining the first interface information and the second interface information based on txt_new and txt_old, one piece of interface information recorded in each file will be converted into a list item, and each list item is still a list, which is composed of method name, return value and parameter in sequence, wherein the method name and return value are each composed of a single item, and the parameter may be composed of multiple items, so the list length of the item representing a specific interface information will change according to the actual situation, and at the same time, the return value and parameter are allowed to be empty. When the return value is empty, the second item of the list representing the item of a specific interface information will be marked as empty and will not be omitted. When the parameter is empty, the third item of the list is marked as empty, that is, the list length of the item of a specific interface information is at least 3. The first interface information may include the method name, return value and parameter, interface description and interface name, and the second interface information may also include the method name, return value and parameter, interface description and interface name.

[0035] Continuing with the above description, a target relationship file can be determined based on the first interface information and the second interface information, and the target relationship file is used to describe the interface correspondence between the first operating system and the second operating system. Exemplarily, a large language model can be used to infer the cross-version correspondence of the OpenHarmony operating system API through information such as interface description and interface name, and the corresponding APIs can be output pair by pair with complete information. Finally, the target relationship file is obtained according to the answer of the large language model.

[0036] S120. Determine the target interface based on the target relationship file, the target interface including an interface with a changed function name, an interface with an increased return value, an interface with a deleted return value, an interface with a modified return value type, an interface with a deleted parameter, an interface with an deleted original parameter and an added first target parameter, and / or an interface with an added second target parameter.

[0037] In this embodiment, the target interface can be determined based on the target relationship file. In the process of updating the original adapter program, the target interface can refer to the interface that changes between the first operating system and the second operating system. The changes in these interfaces may include functional adjustments, parameter modifications, or data format updates to ensure that the program can run normally under the new operating system environment. The target interface includes an interface with a changed function name, an interface with an increased return value, an interface with a deleted return value, an interface with a modified return value type, an interface with a deleted parameter, an interface with an original parameter deleted and a first target parameter added, and / or an interface with a second target parameter added.

[0038] S130. Update the original adapter of the second operating system based on the target interface to obtain a target adapter suitable for the first operating system, and output an update report and a modification plan recommendation report; the update report includes an update record of the target interface; the modification plan recommendation report includes a propagation path list, first recommended modification information and second recommended modification information; wherein, the propagation path list is used to store the propagation path of the target variable; the first recommended modification information is a variable that matches the type of the first target parameter; the second recommended modification information is a variable that matches the type of the second target parameter.

[0039] Specifically, after the target interface is determined, the original adapter of the second operating system can be updated based on the target interface to obtain a target adapter suitable for the first operating system. At the same time, the update process of the target interface can also be recorded and recorded in an update report.

[0040] Following the above description, an update report and a modification plan recommendation report can be output. The modification plan recommendation report includes a propagation path list, a first recommended modification information, and a second recommended modification information; wherein the propagation path list is used to store the propagation path of the target variable; illustratively, the target variable can be a variable stored in a return value to be deleted in an interface for deleting a return value and / or a variable stored in a target return value in an interface whose return value type is modified. It should be noted that if the target variable does not exist, the propagation path list can be empty. The first recommended modification information is a variable that matches the type of the first target parameter; the second recommended modification information is a variable that matches the type of the second target parameter.

[0041] This embodiment provides an updating method for an IoT operating system adapter, comprising: determining a target relationship file based on first interface information of a first operating system and second interface information of a second operating system, wherein the target relationship file is used to describe the interface correspondence between the first operating system and the second operating system; determining a target interface based on the target relationship file, wherein the target interface includes an interface with a changed function name, an interface with an increased return value, an interface with a deleted return value, an interface with a modified return value type, an interface with a deleted parameter, an interface with an deleted original parameter and an interface with a first target parameter added, and / or an interface with a second target parameter added; updating the original adapter of the second operating system based on the target interface to obtain a target adapter suitable for the first operating system, and outputting an update report and a modification scheme recommendation report; the update report includes an update record of the target interface; the modification scheme recommendation report includes a propagation path list, first recommended modification information, and second recommended modification information; wherein the propagation path list is used to store the propagation path of the target variable; the first recommended modification information is a variable matching the type of the first target parameter; the second recommended modification information is a variable matching the type of the second target parameter, so as to realize automatic updating of the original adapter, reduce the workload and investment cost of developers, and provide developers with effective update scheme recommendations.

[0042] As an optional implementation of this embodiment, if the target interface is an interface with a changed function name, updating the original adapter of the second operating system based on the target interface includes:

[0043] 1) Obtain the first call information including the initial function name in the original adapter; the first call information includes a first call line number and a first call code; the first call line number is the call line number corresponding to the initial function name; the first call code is the call code corresponding to the initial function name.

[0044] It can be known that if the target interface is an interface whose function name has changed, the first call information including the initial function name can be obtained in the original adapter; the initial function name can be the function name in the original adapter, for example, the function name is changed from "func1" to "func2", and the initial function name is "func1", the first call information can be the information for calling the initial function name, the first call information includes the first call line number and the first call code; the first call line number is the call line number corresponding to the initial function name; the first call code is the call code corresponding to the initial function name. For example, the first call code can be expressed as func1(x, y, z) and / or var = func1(x, y, z).

[0045] Exemplarily, a text parsing tool (such as a regular expression) or a code parsing tool (such as an abstract syntax tree) may be used to analyze the source code to determine the specific location (line number) and code snippet of each function call.

[0046] 2) Update the initial function name in the first call information to the target function name applied to the target adapter.

[0047] Specifically, after determining the first call information, the initial function name in the first call information can be updated to the target function name applied to the target adapter. Exemplarily, the function name is changed from "func1" to "func2", the initial function name is "func1", the target function name is "func2", and the call line numbers are 5 and 17. Then, the "func1(x, y, z)" and "var = func1(x, y, z)" in the original adapter can be directly modified to "func2(x, y, z)" and "var = func2(x, y, z).

[0048] It should be noted that the update process of the function name can be recorded in the update report, which can contain multiple update records. The logical structure of the update record is a list, each table item is an update record, and each update record is a triple (StartLineNo, codeBefore, codeAfter). The table items represent the starting line number of the modification in the modified original adapter program, the code snippet before the modification, and the code snippet after the modification.

[0049] As an optional implementation of this embodiment, if the target interface is an interface with an increased return value, updating the original adapter of the second operating system based on the target interface includes:

[0050] 1) Obtain second call information containing the initial return value in the original adapter; the second call information includes a second call line number and a second call code; the second call information is the call line number corresponding to the initial return value; and the second call code is the call code corresponding to the initial return value.

[0051] It can be known that if the target interface is an interface with an added return value, the second call information containing the initial return value can be obtained in the original adapter program, the first call information can be the information containing the initial return value, and the second call information includes the second call line number and the second call code; the second call line number is the call line number corresponding to the initial return value; the second call code is the call code corresponding to the initial return value.

[0052] 2) Create a first target row in the row before the second call line number, the first target row is used to store the added target return value, and update the statement corresponding to the second call line number to a statement for assigning the target return value.

[0053] Specifically, after the second call line number and the second call code are determined, a first target line can be created in the line before the second call line number. The first target line is used to store the added target return value, and the statement corresponding to the second call line number is updated to a statement that assigns the target return value.

[0054] Exemplarily, the return value increase can be expressed as "null = func(X, Y, Z)" is changed to "Var = func(X,Y,Z)". Get the call information of the initial return value, such as "func(x, y, z)", create a variable of the newly added return value type before the call occurs, such as "Var var = new Var()", and rewrite the original call occurrence line into the assignment code of the newly added variable, such as "var = func(x, y, z)".

[0055] It should be noted that the process of increasing the return value can be recorded in the update report.

[0056] As an optional implementation of this embodiment, after the original adapter of the second operating system is updated based on the target interface, the method further includes:

[0057] The row number of the second target row in the update report is increased by 1; the second target row is the row in the update report that is located after the row number corresponding to the first target row.

[0058] It should be noted that if the target interface is an interface with an increased return value, after the original adapter is updated, the line number of the line following the line number corresponding to the first target line in the update report may be increased by 1.

[0059] As an optional implementation of this embodiment, the target variable includes a first variable and a second variable; if the target interface is an interface for deleting a return value, updating the original adapter of the second operating system based on the target interface includes:

[0060] 1) Obtain the third call information containing the return value to be deleted in the original adapter; the third call information includes the third call line number and the third call code; the third call information is the call line number corresponding to the return value to be deleted; the third call code is the call code corresponding to the return value to be deleted.

[0061] It can be known that the interface for deleting the return value may be the interface where the return value is deleted. For example, the interface for deleting the return value may be to modify "Var = func(X,Y,Z)" to "null = func(X,Y,Z)". If the target interface is an interface for deleting the return value, the third call information including the return value to be deleted may be obtained in the original adapter; the third call information includes the third call line number and the third call code; the third call line number is the call line number corresponding to the return value to be deleted; and the third call code is the call code corresponding to the return value to be deleted.

[0062] 2) Determine whether the return value to be deleted is used by the original adapter based on the large language model.

[0063] Specifically, after the third call information is determined, it can be determined based on the large language model whether the return value to be deleted is used by the original adapter. Exemplarily, after the third call information is determined, the variables storing the call results of the interface that deletes the return value are checked, such as the "var" in the code snippet "var = func(x, y, z)". Using the large language model, relevant prompt words are set to confirm whether var has been used or passed to other variables before being assigned a value later.

[0064] 3) If not used, delete the return value to be deleted in the original adapter.

[0065] Continuing with the above description, if the return value to be deleted has not been used, the return value to be deleted can be deleted in the original adapter. For example, if var has not been used, the code snippet is automatically modified to "func(x, y, z)".

[0066] 4) If used, determine whether the return value to be deleted is only assigned to the parameter to be deleted table; if so, delete the return value to be deleted in the original adapter; otherwise, mark the propagation path of the first variable storing the return value to be deleted in the original adapter, and save the propagation path to the propagation path list.

[0067] Specifically, if the return value to be deleted is used, determine whether the return value to be deleted is only assigned to the parameter to be deleted table; if so, delete the return value to be deleted stored in the row corresponding to the third call line number in the original adapter; otherwise, mark the propagation path of the first variable storing the return value to be deleted in the original adapter, and save the propagation path to the propagation path list. Among them, the first variable can be the variable storing the return value to be deleted in the interface that deletes the return value. The propagation path can be composed of a list, each table item represents a use of the API call result, and is composed of a multi-tuple (LineNo, varName, codeSnipt), and each element in the table item represents the line number, variable name, and code snippet in turn.

[0068] For example, if var is only used to assign a parameter in the parameter to be deleted table before being assigned a value, the variable storing the result is also directly deleted in the API call line, that is, the code snippet is automatically modified to "func(x, y, z)". Otherwise, the propagation path UsagePath of the result in the original adapter is marked, and the propagation path UsagePath is saved to the propagation path list. It should be noted that the process of deleting the return value can be recorded in the update report.

[0069] As an optional implementation of this embodiment, if the target interface is an interface whose return value type is modified, updating the original adapter of the second operating system based on the target interface includes:

[0070] 1) Obtain the fourth call information containing the target return value in the original adapter; the fourth call information includes the fourth call line number and the fourth call code; the fourth call line number is the call line number corresponding to the target return value; the fourth call code is the call code corresponding to the target return value; the type of the target return value is the modified target type.

[0071] It can be known that if the target interface is an interface whose return value type is modified, the fourth call information containing the target return value (the return value of the modified type) can be obtained in the original adapter; the fourth call information includes the fourth call line number and the fourth call code; the fourth call line number is the corresponding call line number of the target return value; the fourth call code is the corresponding call code of the target return value; the type of the target return value is the modified target type.

[0072] Exemplarily, the interface whose return value type is modified may be an interface in which "Var1 = func(X,Y,Z)" is modified to "Var2 = func(X,Y,Z)".

[0073] 2) Determine whether the variable storing the target return value is used by the original adapter based on the large language model.

[0074] Specifically, it may be determined based on the large language model whether the variable storing the target return value is used by the original adapter.

[0075] 3) If it is not used, change the variable type of the variable stored in the original adapter to the target type.

[0076] Continuing with the above description, if the variable storing the target return value is not used by the original adapter, the variable type storing the variable in the original adapter can be modified to the target type.

[0077] 4) If used, determine whether the target return value is only assigned to the parameter to-be-deleted table.

[0078] Continuing with the above description, if the variable storing the target return value is used by the original adapter, it can be determined whether the target return value is only assigned to the parameter to-be-deleted table.

[0079] 5) If yes, change the variable type of the variable in the parameter to be deleted table to the target type.

[0080] Specifically, if the target return value is only assigned to the parameter to be deleted table, the variable type of the variable in the parameter to be deleted table can be modified to the target type.

[0081] 6) Otherwise, mark the propagation path of the second variable storing the target return value in the original adapter, and save the propagation path to the propagation path list.

[0082] Specifically, if the target return value is not only assigned to the parameter to be deleted table, the propagation path of the second variable storing the target return value in the original adapter can be marked, and the propagation path can be saved in the propagation path list. The second variable can be the variable storing the target return value in the interface whose return value type is modified.

[0083] Exemplarily, for APIs whose return values ​​change, list all APIs that modify the return value type, such as changing "Var1 = func(X,Y,Z)" to "Var2 = func(X,Y,Z)", obtain their fourth call information in the original adapter program, and check the variables that store the results of these API calls, such as "var = func(x, y, z)" in the code snippet. Using the large language model, set relevant prompt words to confirm whether var has been used or passed to other variables before being assigned a value. If not, modify the type definition of the variable storing the result directly at the fourth call line of the API, that is, modify the code snippet "Var1 var = new Var1()" to "Var2 var = new Var2()"; If var is only used to assign a parameter in the parameter to be deleted table before being assigned a value, modify the type definition of the variable storing the result directly at the fourth call line of the API, that is, modify the code snippet "Var1 var = new Var1()" to "Var2 var = new Var2()". Otherwise, mark the propagation path in the original adapter and save the propagation path to the propagation path list UsagePath.

[0084] As an optional implementation of this embodiment, if the target interface is a parameter deletion interface, updating the original adapter of the second operating system based on the target interface includes:

[0085] 1) Obtain the fifth call information containing the delete parameter interface in the original adapter; the fifth call information includes the fifth call line number; the fifth call line number is the call line number corresponding to the delete parameter.

[0086] Specifically, if the target interface is a parameter deletion interface, the fifth call information including the parameter deletion interface can be obtained in the original adapter; the fifth call information includes the fifth call line number; the fifth call line number is the call line number corresponding to the parameter deletion.

[0087] 2) Based on the fifth calling information, a corresponding calling function in the original adapter is updated, where the calling function is a function that calls the deleted parameters.

[0088] Specifically, based on the fifth call line number, the parameters to be deleted in the calling function corresponding to the fifth call line number can be deleted. Exemplarily, the parameter deletion interface can be represented as an interface that modifies "Var = func(X, Y, Z)" to "Var = func(X,Y)", and the calling function can be the "var" of "var = func(X, Y, Z)" in the code snippet, and the func(X, Y, Z) function call can be directly modified to "func(X,Y)". It should be noted that the above update process can be recorded in the update report.

[0089] As an optional implementation of this embodiment, if the target interface is an interface that deletes the original parameter and adds the first target parameter, updating the original adapter of the second operating system based on the target interface includes:

[0090] The sixth call information including deleting the original parameter and adding the first target parameter interface is obtained in the original adapter, and the sixth call information is saved in the parameter to be deleted table; wherein the sixth call information includes the sixth call line number and the sixth call code; the sixth call line number includes the call line number corresponding to the deleted original parameter and the call line number corresponding to the first target parameter; the sixth call code includes the call code corresponding to the deleted original parameter and the call code corresponding to the first target parameter.

[0091] Specifically, the target interface may be an interface that deletes the original parameters and adds the first target parameters. Exemplarily, the target interface may represent an interface that modifies "Var = func(X, Y, Z)" to "Var = func(X, Y, Q, P)". If the target interface is an interface that deletes the original parameters and adds the first target parameters, the sixth call information containing the interface for deleting the original parameters and adding the first target parameters may be obtained in the original adapter, and the sixth call information may be saved to the parameter to be deleted table. Among them, the original parameters may be the parameters contained in the original adapter, and the first target parameters may be the added parameters. Exemplarily, for the interface that modifies "Var = func(X, Y, Z)" to "Var = func(X, Y, Q, P)", the original parameters may be Z, and the first target parameters may be P or Q. It should be noted that the above update process may be recorded in an update report.

[0092] Among them, the sixth call information includes the sixth call line number and the sixth call code; the sixth call line number includes the call line number corresponding to the deleted original parameters and the call line number corresponding to the first target parameters; the sixth call code includes the call code corresponding to the deleted original parameters and the call code corresponding to the first target parameters.

[0093] Exemplarily, for the target interface that modifies "Var = func(X, Y, Z)" to "Var = func(X, Y, Q, P)", obtain their sixth call information in the original adapter program, and record the relevant sixth call information in detail to form the parameter to be deleted table API_PmtToDel, each table entry represents a call information, and each call information is represented by a triple (LineNo, ptmName, funcName), where the table entries mean the line number of the call in the original adapter program, the variable name corresponding to the parameter to be deleted, and the method name.

[0094] As an optional implementation of this embodiment, if the target interface is an interface for adding a second target parameter, updating the original adapter of the second operating system based on the target interface includes:

[0095] The seventh call information including the interface for adding the second target parameter is obtained in the original adapter program, and the seventh call information is saved in the parameter to be added and modified table; the seventh call information includes the seventh call line number and the seventh call code; the seventh call line number is the call line number corresponding to the second target parameter; the seventh call code is the call code corresponding to the second target parameter.

[0096] Specifically, the target interface may be an interface for adding a second target parameter. For example, the target interface may be represented as an interface for modifying "Var = func(X, Y, Z)" to "Var = func(X, Y, Z, Q)", where Q may be the added second target parameter. The seventh call information including the interface for adding the second target parameter may be obtained in the original adapter, the seventh call information including the seventh call line number and the seventh call code; the seventh call line number is the call line number corresponding to the second target parameter; and the seventh call code is the call code corresponding to the second target parameter.

[0097] Continuing with the above description, after the seventh call information is determined, the seventh call information can be saved to the parameter to be added or modified table, and the parameter to be added or modified table can save parameters added or modified according to specific rules or conditions. It should be noted that the above update process can be recorded in an update report.

[0098] As an optional implementation of this embodiment, if the target interface is an interface that deletes the original parameter and adds the first target parameter, the method further includes:

[0099] 1) Determine a first target variable based on the sixth call information, where the first target variable is a variable that matches the type of the first target parameter.

[0100] Specifically, for an interface that deletes original parameters and adds a first target parameter, a first target variable may also be determined based on the sixth call information, where the first target variable is a variable that matches the type of the first target parameter.

[0101] 2) determining first recommended modification information based on the first target variable;

[0102] Specifically, the first target variables can be summarized into a list as the first recommended modification information. Exemplarily, for APIs whose parameters have changed, all changes are listed, including deleting the original parameters and adding the first target parameters. For example, "Var = func(X, Y, Z)" is modified to "Var = func(X, Y, Q)", where Z can represent the deleted original parameter and Q can represent the added first target parameter. The calling information of the first target parameter can be obtained, and all first target variables of the type that meet the modified first target parameter before the call of the original adapter occurs can be retrieved, and the first target variables can be summarized into a list as the first recommended modification information.

[0103] As an optional implementation of this embodiment, if the target interface is an interface for adding a second target parameter, the method further includes:

[0104] 1) Determine a second target variable based on the seventh call information, where the second target variable is a variable that matches the type of the second target parameter.

[0105] Specifically, for an interface that adds a second target parameter, a second target variable may also be determined based on the seventh call information, where the second target variable is a variable that matches the type of the second target parameter.

[0106] 2) Determine second recommended modification information based on the second target variable.

[0107] Specifically, the second target variables can be summarized into a list as the second recommended modification information. Exemplarily, for APIs whose parameters have changed, all changes including the APIs with added parameters are listed, for example, "Var = func(X, Y, Z)" is modified to "Var = func(X, Y, Z, Q)", Q can represent the second target parameter, and the variable stored in Q can be the second target variable. Obtain the calling information of the second target parameter, retrieve all the second target variables that meet the second target parameter type in the original adapter before the seventh calling information occurs, and summarize the second target variables into a list as the second recommended modification information.

[0108] Take the Openharmony operating system as an example. Figure 2 A schematic diagram of an updating process of an adapter provided in this embodiment, such as Figure 2 shown.

[0109] Step 1) Automatically crawl API update content. You can enter two URL links, pointing to the interface description documents of the new version of the OpenHarmony operating system (the first operating system) and the old version of the OpenHarmony operating system (the second operating system). That is, take two strings describing the URLs as the initial input. Construct the request library of the Python language around such input to actually obtain the content of the web page (interface description document), and further use the BeautifulSoup library to parse the web page content and extract the content containing practical meaning, automatically crawl the interface description documents of the first operating system and the second operating system, that is, save the specific contents of the two URLs as text txt_old and txt_new respectively.

[0110] Step 2) Automatically identify API correspondence. Take the text txt_old and txt_new of the specific content of the two versions of the OpenHarmony operating system interface description documents as input, and use the large language model to automatically identify the correspondence between multiple versions of the OpenHarmony operating system interface.

[0111] First, read the text txt_old and txt_new for preprocessing. According to the column names in the CSV file, namely method name, parameter, and return value, convert the contents of the two files into lists, namely OH_ API_oldVer (second interface information) and OH_ API_newVer (first interface information). By parsing OH_API_ oldVer and OH_API_ newVer, the corresponding relationship file (target relationship file) OH_API_Mapping of the old and new API versions is obtained according to the answer of the large language model.

[0112] Step 3) The first step of automatic adapter update - automatically replace the updated function name. Identify the changes in the function name during the API version iteration, and perform the first step of updating the adapter Px (original adapter). Read the API new and old version correspondence file OH_API_Mapping. For APIs with changed function names, list all these APIs, such as changing the function name from "func1" to "func2". According to the function name before the version change, such as "func1", obtain the call information (first call information) of these functions in the adapter Px (original adapter). The first call information includes the first call line number and the first call code. The first call code can be expressed as "func1(x, y, z)", "var = func1(x, y, z)", etc. Modify these function calls directly according to the target relationship file of the API version change. For example, the above function calls are directly modified to "func2(x, y, z)", "var = func2(x, y, z)". After the modification, the modification records are summarized in Update_report. The logical structure of the modification record is a list. Each table entry is a modification record. Each modification record is a triple (StartLineNo, codeBefore, codeAfter). The table entries represent the starting line number of the modification in the modified adapter, the code snippet before the modification, and the code snippet after the modification.

[0113] Step 4) Adapter automatic update step 2 - automatically correct the scenario of increased return value. Identify the situation of newly added return value of API in API version iteration, and perform the second step update of adapter Px (original adapter).

[0114] For APIs whose return values ​​have changed, list all APIs with newly added return values, such as changing "null = func(X,Y, Z)" to "Var = func(X,Y,Z)", and obtain their call information (second call information) in the adapter Px. For example, the second call code can be "func(x, y, z)". Before the call occurs, create a new line (first target line) to store the variable of the newly added return value (target return value) type, such as "Var var = new Var()", and rewrite the original call occurrence line (second call line number) to the assignment code of the newly added variable, such as "var = func(x, y, z)". Whenever the above modification occurs, first record the latest modification in the form of a triple (StartLineNo, codeBefore, codeAfter), and then update the start line number (second target line) of the modification record whose line number is subsequent to the modification in Update_report by incrementing by one (+1).

[0115] Step 5) The third step of the automatic update of the adapter program - automatically correct the scenario where the parameters are only deleted. Identify the situation where the API parameter changes in the API version iteration only include deletions, and perform the third step update of the original adapter Px. For the APIs whose parameters have changed, list all APIs that have only deleted parameters, such as changing "Var = func(X, Y, Z)" to "Var = func(X,Y)", obtain their call information in the original adapter Px (the fifth call information), and check the variables that store the results of these API calls based on the fifth call line number in the fifth call information, such as "var" in the code snippet "var = func(x, y, z)", and modify these function calls directly according to the corresponding relationship of the API version changes, for example, the above function call is directly modified to "func(x, y)". If the above modifications occur, the modifications are summarized and recorded in Update_report.

[0116] Step 6) Automatically identify scenarios where other deletions and changes have occurred in parameters, and build knowledge about the changes. For APIs whose parameters have changed, list all APIs whose changes include deletions of parameters, including all situations in the previous step, such as changing "Var = func(X, Y, Z)" to "Var = func(X, Y, Q, P)", obtain their sixth call information in the original adapter Px, and record the relevant information in detail to form the parameter to be deleted table API_PmtToDel. Each table entry represents a call information, and each call information is represented by a triple (LineNo, ptmName, funcName), where the table entry means the line number of the call in the adapter Px, the variable name corresponding to the parameter to be deleted, and the method name.

[0117] Step 7) Automatically identify scenarios where other parameter changes occur and build change knowledge understanding. Identify changes in other API parameters during API version iterations and understand the change knowledge. For APIs with changed parameters, list all APIs whose changes do not include deleted parameters, such as changing "Var = func(X, Y, Z)" to "Var = func(X, Y, Z, Q)", obtain their seventh call information in the adapter Px, and record the relevant information in detail to form the parameter to be added or changed table API_PmtToAddORReplace. Each table entry represents a call information, and each call information is represented by a triple (LineNo, ptmName, funcName), where the table entry means the line number of the call in the adapter Px, the variable name corresponding to the parameter to be added or modified, and the method name.

[0118] Step 8) Automatically update the adapter in step 4 and build change knowledge understanding - automatically correct the scenario where the return value is deleted. Identify the situation where the API deletes the return value during the API version iteration, and perform the fourth step update of the adapter Px (original adapter) and the change knowledge understanding.

[0119] For APIs whose return values ​​change, list all APIs that delete the return values, such as changing "Var = func(X,Y,Z)" to "null = func(X,Y,Z)", obtain their third call information in Px, and check the variables that store the results of these API calls, such as "var" in "var = func(x, y, z)" in the code snippet. Use the large language model to set relevant prompt words to confirm whether var has been used or passed to other variables before being assigned a value later. If not, delete the variable storing the result directly in the API call line (the third call line number), that is, automatically modify the above code snippet to "func(x, y, z)"; if var is only used to assign parameters in the parameter to be deleted table API_PmtToDel before being assigned a value later, delete the variable storing the result directly in the API call line (the third call line number), that is, automatically modify the above code snippet to "func(x, y, z)". If the above modification occurs, the modification record is summarized in Update_report. Otherwise, the propagation path UsagePath of the result in Px is marked and saved in the propagation path list. Each entry in the propagation path list represents a use of the API call result, which consists of a tuple (LineNo, varName, codeSnipt). Each element in the entry represents the line number, variable name and code snippet in turn.

[0120] Step 9) The adapter automatically updates the fifth step and builds the understanding of the change knowledge - automatically correcting the scenario where the return value type changes. Identify the situation where the API modifies the return value type during the API version iteration, and update the fifth step of the adapter Px and understand the change knowledge. For APIs whose return values ​​have changed, list all APIs that modify the return value type, such as changing "Var1 = func(X,Y,Z)" to "Var2 = func(X,Y,Z)", obtain their fourth call information in Px, and check the variables that store the results of these API calls, such as "var = func(x, y, z)" in the code snippet. Using the large language model, set relevant prompt words to confirm whether var has been used or passed to other variables before being assigned a value later. If not, modify the type definition of the variable storing the result directly on the API call line (the fourth call line number), that is, modify the code snippet "Var1 var = new Var1()" to "Var2 var = new Var2()"; if var is only used to assign parameters in the API_PmtToDel (parameter to be deleted table) before being assigned a value later, modify the type definition of the variable storing the result directly on the API call line (the fourth call line number), that is, modify the code snippet "Var1 var = new Var1()" to "Var2 var = new Var2()". If the above modifications occur, summarize the modifications and record them in Update_report. Otherwise, mark the propagation path in Px, save the propagation path to UsagePath, and save the propagation path to the propagation path list.

[0121] Step 10) Gather all the knowledge and understanding of the changes to automatically form modification plan recommendations. Gather all the knowledge and understanding of API version iterations to form modification plan recommendations for developers. For APIs with changed parameters, list all APIs whose changes include added parameters, such as changing "Var = func(X, Y, Z)" to "Var = func(X, Y, Z,Q)", obtain their call information in the adapter Px (the seventh call information), retrieve all variables that meet the newly added parameter type before the call occurs in the adapter (the second target variable), summarize them into a list as modification recommendation information (the second recommended modification information), and record them in the modification plan recommendation report Recom_Report.

[0122] For APIs with changed parameters, list all APIs whose parameter types have been modified, such as changing "Var = func(X, Y, Z)" to "Var = func(X, Y, Q)", obtain their sixth call information in the adapter Px, retrieve all variables (first target variables) that match the modified parameter types before the adapter is called, summarize them into a list as modification recommendation information (first recommended modification information), and record them in the recommended modification plan (modification plan recommendation report) Recom_Report. Summarize all UsagePaths (propagation path list) into the recommended modification plan (modification plan recommendation report) Recom_Report as modification suggestions for other API call parts that require developer confirmation.

[0123] Step 11) Output the modified adapter, Update_report, and the recommended modification plan for subsequent complex updates (Recom_Report).

[0124] The present invention adopts the above technical solution and has the following beneficial effects:

[0125] This method uses large language models and program analysis technology to build the recognition and understanding of the operating system version update content, and systematically completes the in-depth automatic update of the adapter program, while providing a more comprehensive update recommendation plan, thereby helping developers quickly achieve adaptive synchronization of the adapter program.

[0126] Embodiment 2

[0127] Figure 3 is a structural diagram of an updating device for an IoT operating system adapter program provided in the second embodiment of the present disclosure; Figure 3 As shown, the device includes: a target relationship file determination module 210, a target interface determination module 220, and a target adapter determination module 230.

[0128] The target relationship file determination module 210 is used to determine a target relationship file based on the first interface information of the first operating system and the second interface information of the second operating system, wherein the target relationship file is used to describe the interface correspondence relationship between the first operating system and the second operating system;

[0129] A target interface determination module 220 is used to determine a target interface based on the target relationship file, wherein the target interface includes an interface whose function name is changed, an interface whose return value is increased, an interface whose return value is deleted, an interface whose return value type is modified, an interface whose parameters are deleted, an interface whose original parameters are deleted and a first target parameter is added, and / or an interface whose second target parameter is added;

[0130] The target adapter determination module 230 is used to update the original adapter of the second operating system based on the target interface, obtain the target adapter suitable for the first operating system, and output an update report and a modification plan recommendation report; the update report includes the update record of the target interface; the modification plan recommendation report includes a propagation path list, first recommended modification information and second recommended modification information; wherein the propagation path list is used to store the propagation path of the target variable; the first recommended modification information is a variable that matches the type of the first target parameter; the second recommended modification information is a variable that matches the type of the second target parameter.

[0131] Embodiment 2 of the present disclosure provides an updating device for an adapter program of an IoT operating system, which realizes automatic updating of the adapter program, reduces the workload and investment cost of developers, and provides effective update solution recommendations for developers.

[0132] Furthermore, if the target interface is an interface whose function name changes, the target adapter determination module 230 is further used to:

[0133] Acquire first call information including an initial function name in the original adapter; the first call information includes a first call line number and a first call code; the first call line number is a call line number corresponding to the initial function name; the first call code is a call code corresponding to the initial function name;

[0134] The initial function name in the first calling information is updated to the target function name applied to the target adapter.

[0135] Furthermore, if the target interface is an interface with an increased return value, the target adapter determination module 230 is further configured to:

[0136] Acquire second call information including the initial return value in the original adapter; the second call information includes a second call line number and a second call code; the second call information is the call line number corresponding to the initial return value; the second call code is the call code corresponding to the initial return value;

[0137] Create a first target row in the row before the second call row number, the first target row is used to store the added target return value, and update the statement corresponding to the second call row number to a statement for assigning the target return value;

[0138] After updating the original adapter of the second operating system based on the target interface, the device further includes:

[0139] The row number adding module is used to increase the row number of the second target row in the update report by 1; the second target row is the row in the update report that is located after the row number corresponding to the first target row.

[0140] Further, the target variable includes a first variable and a second variable; if the target interface is an interface that deletes a return value, the target adapter determination module 230 is further used to:

[0141] Acquire third call information containing the return value to be deleted in the original adapter; the third call information includes a third call line number and a third call code; the third call information is the call line number corresponding to the return value to be deleted; the third call code is the call code corresponding to the return value to be deleted;

[0142] Determining whether the return value to be deleted is used by the original adapter based on the large language model;

[0143] If it is not used, deleting the return value to be deleted in the original adapter;

[0144] If used, determine whether the return value to be deleted is only assigned to the parameter to be deleted table; if so, delete the return value to be deleted in the original adapter; otherwise, mark the propagation path of the first variable storing the return value to be deleted in the original adapter, and save the propagation path to the propagation path list;

[0145] Further, the target variable includes a first variable and a second variable; if the target interface is an interface whose return value type is modified, the target adapter determination module 230 is further used to:

[0146] Acquire fourth call information containing a target return value in the original adapter; the fourth call information includes a fourth call line number and a fourth call code; the fourth call line number is a call line number corresponding to the target return value; the fourth call code is a call code corresponding to the target return value; the type of the target return value is the modified target type;

[0147] Determining whether the variable storing the target return value is used by the original adapter based on the large language model;

[0148] If it is not used, modifying the variable type storing the variable in the original adapter program to the target type;

[0149] If used, determining whether the target return value is only assigned to the parameter to-be-deleted table;

[0150] If yes, modify the variable type of the variable in the parameter to be deleted table to the target type;

[0151] Otherwise, mark the propagation path of the second variable storing the target return value in the original adapter, and save the propagation path to the propagation path list.

[0152] Furthermore, if the target interface is a parameter deletion interface, the target adapter determination module 230 is further configured to:

[0153] Acquire fifth call information including a delete parameter interface in the original adapter; the fifth call information includes a fifth call line number; the fifth call line number is a call line number corresponding to the delete parameter;

[0154] Based on the fifth calling information, a corresponding calling function in the original adapter is updated, wherein the calling function is a function that calls a deletion parameter;

[0155] Further, if the target interface is an interface that deletes the original parameters and adds the first target parameters, the target adapter determination module 230 is further used to:

[0156] Acquire sixth call information including deleting original parameters and adding first target parameter interface in the original adapter, and save the sixth call information to the parameter to be deleted table;

[0157] The sixth call information includes a sixth call line number and a sixth call code; the sixth call line number includes a call line number corresponding to the deleted original parameter and a call line number corresponding to the first target parameter; the sixth call code includes a call code corresponding to the deleted original parameter and a call code corresponding to the first target parameter;

[0158] If the target interface is an interface for adding a second target parameter, the target adapter determination module 230 is further configured to:

[0159] The seventh call information including adding the second target parameter interface is obtained in the original adapter program, and the seventh call information is saved in the parameter to be added and modified table; the seventh call information includes the seventh call line number and the seventh call code; the seventh call line number is the call line number corresponding to the second target parameter; the seventh call code is the call code corresponding to the second target parameter.

[0160] Further, if the target interface is an interface for deleting original parameters and adding first target parameters, the device further includes:

[0161] a first target variable determining module, configured to determine a first target variable based on the sixth call information, wherein the first target variable is a variable matching a type of the first target parameter;

[0162] A first recommended modification information determination module, configured to determine the first recommended modification information based on the first target variable;

[0163] Further, if the target interface is an interface for adding a second target parameter, the device further includes:

[0164] a second target variable determining module, configured to determine a second target variable based on the seventh call information, wherein the second target variable is a variable matching a type of the second target parameter;

[0165] The second recommended modification information determination module is configured to determine the second recommended modification information based on the second target variable.

[0166] The updating device for the Internet of Things operating system adapter program provided in the embodiments of the present disclosure can execute the updating method for the Internet of Things operating system adapter program provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0167] Embodiment 3

[0168] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of the present disclosure described and / or claimed herein.

[0169] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.

[0170] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0171] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microprocessor, etc. The processor 11 executes the various methods and processes described above, such as an updating method of an IoT operating system adapter or a query method of a knowledge graph.

[0172] In some embodiments, the updating method of the Internet of Things operating system adapter or the query method of the knowledge graph may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the updating method of the Internet of Things operating system adapter or the query method of the knowledge graph described above may be executed. Alternatively, in other embodiments, the processor 11 may be configured to execute the updating method of the Internet of Things operating system adapter or the query method of the knowledge graph by any other appropriate means (for example, by means of firmware).

[0173] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0174] The computer programs for implementing the methods of the embodiments of the present disclosure may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0175] In the context of the embodiments of the present disclosure, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0176] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0177] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0178] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0179] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in the embodiments of the present disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions of the embodiments of the present disclosure can be achieved, and this document does not limit this.

[0180] The above specific implementations do not constitute a limitation on the protection scope of the embodiments of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the embodiments of the present disclosure shall be included in the protection scope of the embodiments of the present disclosure.

[0181] The embodiments of the present disclosure also provide a computer program product, including a computer program and / or instructions, which, when executed by a processor, implements a method for updating an IoT operating system adapter program or a method for querying a knowledge graph as provided in any embodiment of the present application.

[0182] In the process of implementation, the computer program product can be written in one or more programming languages ​​or a combination thereof to write computer program codes for performing the operations of the embodiments of the present disclosure, and the programming languages ​​include object-oriented programming languages, such as Java, Smalltalk, C++, and also include conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0183] Note that the above are only preferred embodiments of the embodiments of the present disclosure and the technical principles used. Those skilled in the art will understand that the embodiments of the present disclosure are not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the embodiments of the present disclosure. Therefore, although the embodiments of the present disclosure are described in more detail through the above embodiments, the embodiments of the present disclosure are not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the embodiments of the present disclosure, and the scope of the embodiments of the present disclosure is determined by the scope of the attached claims.

Claims

1. A method for updating an operating system adapter, characterized in that: include: Determine a target relationship file based on first interface information of the first operating system and second interface information of the second operating system, wherein the target relationship file is used to describe the interface correspondence relationship between the first operating system and the second operating system; Determining a target interface based on the target relationship file, the target interface includes an interface with a changed function name, an interface with an increased return value, an interface with a deleted return value, an interface with a modified return value type, an interface with a deleted parameter, an interface with an deleted original parameter and an added first target parameter, and / or an interface with an added second target parameter; Based on the target interface, the original adapter of the second operating system is updated to obtain a target adapter suitable for the first operating system, and an update report and a modification solution recommendation report are output; The update report includes the update record of the target interface; the modification plan recommendation report includes a propagation path list, first recommended modification information and second recommended modification information; wherein the propagation path list is used to store the propagation path of the target variable; the first recommended modification information is a variable that matches the type of the first target parameter; and the second recommended modification information is a variable that matches the type of the second target parameter.

2. The method according to claim 1, characterized in that If the target interface is an interface with a changed function name, updating the original adapter of the second operating system based on the target interface includes: Acquire first call information including an initial function name in the original adapter; the first call information includes a first call line number and a first call code; the first call line number is a call line number corresponding to the initial function name; the first call code is a call code corresponding to the initial function name; The initial function name in the first calling information is updated to the target function name applied to the target adapter.

3. The method according to claim 1, characterized in that If the target interface is an interface with an increased return value, updating the original adapter of the second operating system based on the target interface includes: Acquire second call information including the initial return value in the original adapter; the second call information includes a second call line number and a second call code; the second call information is the call line number corresponding to the initial return value; the second call code is the call code corresponding to the initial return value; Create a first target row in the row before the second call row number, the first target row is used to store the added target return value, and update the statement corresponding to the second call row number to a statement for assigning the target return value; After the original adapter of the second operating system is updated based on the target interface, the method further includes: adding 1 to the line number of the second target line in the update report; the second target line is a line in the update report that is located after the line number corresponding to the first target line.

4. The method according to claim 1, characterized in that The target variable includes a first variable and a second variable; If the target interface is an interface for deleting a return value, updating the original adapter of the second operating system based on the target interface includes: Acquire third call information containing the return value to be deleted in the original adapter; the third call information includes a third call line number and a third call code; the third call information is the call line number corresponding to the return value to be deleted; the third call code is the call code corresponding to the return value to be deleted; Determining whether the return value to be deleted is used by the original adapter based on the large language model; If it is not used, deleting the return value to be deleted in the original adapter; If used, determine whether the return value to be deleted is only assigned to the parameter to be deleted table; if so, delete the return value to be deleted in the original adapter; otherwise, mark the propagation path of the first variable storing the return value to be deleted in the original adapter, and save the propagation path to the propagation path list; If the target interface is an interface whose return value type is modified, updating the original adapter of the second operating system based on the target interface includes: Acquire fourth call information containing a target return value in the original adapter; the fourth call information includes a fourth call line number and a fourth call code; the fourth call line number is a call line number corresponding to the target return value; the fourth call code is a call code corresponding to the target return value; the type of the target return value is the modified target type; Determining whether the variable storing the target return value is used by the original adapter based on the large language model; If it is not used, modifying the variable type storing the variable in the original adapter program to the target type; If used, determining whether the target return value is only assigned to the parameter to-be-deleted table; If yes, modify the variable type of the variable in the parameter to be deleted table to the target type; Otherwise, mark the propagation path of the second variable storing the target return value in the original adapter, and save the propagation path to the propagation path list.

5. The method according to claim 4, characterized in that If the target interface is a parameter deletion interface, updating the original adapter of the second operating system based on the target interface includes: Acquire fifth call information including a delete parameter interface in the original adapter; the fifth call information includes a fifth call line number; the fifth call line number is a call line number corresponding to the delete parameter; Based on the fifth calling information, a corresponding calling function in the original adapter is updated, wherein the calling function is a function that calls a deletion parameter; If the target interface is an interface that deletes original parameters and adds first target parameters, updating the original adapter of the second operating system based on the target interface includes: Acquire sixth call information including deleting original parameters and adding first target parameter interface in the original adapter, and save the sixth call information to the parameter to be deleted table; The sixth call information includes a sixth call line number and a sixth call code; the sixth call line number includes a call line number corresponding to the deleted original parameter and a call line number corresponding to the first target parameter; the sixth call code includes a call code corresponding to the deleted original parameter and a call code corresponding to the first target parameter; If the target interface is an interface for adding a second target parameter, updating the original adapter of the second operating system based on the target interface includes: The seventh call information including adding the second target parameter interface is obtained in the original adapter program, and the seventh call information is saved in the parameter to be added and modified table; the seventh call information includes the seventh call line number and the seventh call code; the seventh call line number is the call line number corresponding to the second target parameter; the seventh call code is the call code corresponding to the second target parameter.

6. The method according to claim 5, characterized in that If the target interface is an interface that deletes the original parameters and adds the first target parameters, the method further includes: Determine a first target variable based on the sixth call information, where the first target variable is a variable that matches a type of the first target parameter; determining the first recommended modification information based on the first target variable; If the target interface is an interface for adding a second target parameter, the method further includes: Determine a second target variable based on the seventh call information, where the second target variable is a variable that matches a type of the second target parameter; The second recommended modification information is determined based on the second target variable.

7. An operating system adapter program update device, characterized in that: include: a target relationship file determining module, configured to determine a target relationship file based on first interface information of a first operating system and second interface information of a second operating system, wherein the target relationship file is used to describe an interface correspondence relationship between the first operating system and the second operating system; a target interface determination module, configured to determine a target interface based on the target relationship file, wherein the target interface includes an interface whose function name is changed, an interface whose return value is increased, an interface whose return value is deleted, an interface whose return value type is modified, an interface whose parameters are deleted, an interface whose original parameters are deleted and a first target parameter is added, and / or an interface whose second target parameter is added; A target adapter determination module, configured to update the original adapter of the second operating system based on the target interface, obtain a target adapter suitable for the first operating system, and output an update report and a modification solution recommendation report; The update report includes the update record of the target interface; the modification plan recommendation report includes a propagation path list, first recommended modification information and second recommended modification information; wherein the propagation path list is used to store the propagation path of the target variable; the first recommended modification information is a variable that matches the type of the first target parameter; and the second recommended modification information is a variable that matches the type of the second target parameter.

8. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the operating system adapter updating method as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the updating method of the operating system adapter program as described in any one of claims 1 to 6 is implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the method for updating the operating system adapter according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Operating system switching method and device, equipment and storage medium

    CN117806720A

  • Compilation optimization method, device and equipment of power internet of things operating system and medium

    CN118151941A

  • Method, system, equipment and medium for power internet of things edge computing architecture based on autonomous controllable operating system

    CN119225761A

  • Method and apparatus for software update management

    US20160188316A1

  • Operating system data updating method and device, storage medium, and program product

    WO2022262754A1