Update Method, Device, Equipment and Product of Internet of Things Operating System Adaptation Program

By automatically updating the adapter program of the IoT operating system, using the changes in the target relationship file and interface, the adapter compatibility problems caused by API changes are solved, and an efficient and automated update process is achieved.

CN119806603BActive Publication Date: 2025-06-27INFORMATION & COMM BRANCH OF STATE GRID JIANGSU ELECTRIC POWER +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510303519.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-14
Publication Date
2025-06-27
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 original hardware adapter not being able to run normally, and developers need to manually analyze and modify the code, which is inefficient and error-prone.

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, improves update efficiency, provides effective update solutions recommendations, and ensures that the adapter program is compatible with the new version of the operating system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806603B_ABST
    Figure CN119806603B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure disclose an update method, apparatus, device, and product for an Internet of Things operating system adaptation program, including: determining a target relationship file based on first interface information of a first operating system and second interface information of a second operating system; determining target interfaces based on the target relationship file, where the target interfaces include interfaces with changed function names, interfaces with increased return values, interfaces with deleted return values, interfaces with modified return value types, interfaces with deleted parameters, interfaces with deleted original parameters and added first target parameters, and / or interfaces with added second target parameters; updating an original adaptation program of the second operating system based on the target interfaces to obtain a target adaptation program applicable to the first operating system, and outputting an update report and a recommended modification plan report. This technical solution realizes the automatic update of the adaptation program, reduces the workload and input cost of developers, and provides developers with effective recommended update solutions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the technical field of system updates, and in particular, to an update method, device, equipment, and product for an Internet of Things operating system adaptation program. Background Art

[0002] In recent years, the development of Internet of Things operating systems has been changing rapidly. As an open-source Internet of Things operating system for all scenarios, the OpenHarmony operating system has been widely used in the fields of intelligent terminals, Internet of Things devices, etc. due to its distributed capabilities, powerful cross-device collaboration, and other characteristics.

[0003] With the continuous progress of technology and the increasing growth of user needs, the OpenHarmony operating system needs to continuously iterate versions to optimize performance, expand functions, and enhance security. However, each version iteration is often accompanied by changes in the Application Programming Interface (API). These API changes will cause the original hardware adaptation program written based on the old version API to not work properly, and developers need to update the original adaptation program to ensure its compatibility with the new version of the OpenHarmony operating system.

[0004] The traditional way to update the original adaptation program mainly relies on developers to manually analyze the 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 effort to understand the details of the changes in the new version API and the specific impact of these changes on the original adaptation program, which undoubtedly increases the cost and cycle of software development. Summary of the Invention

[0005] Embodiments of the present disclosure provide an update method, device, equipment, and product for an Internet of Things operating system adaptation program, which realizes the automatic update of the adaptation program, reduces the workload and input cost of developers, and provides effective update scheme recommendations for developers.

[0006] In a first aspect, an update method for an Internet of Things operating system adaptation program is provided, including:

[0007] Determining 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, where the target relationship file is used to describe the interface correspondence between the first operating system and the second operating system;

[0008] Determine a target interface based on the target relationship file, where 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 a deleted original parameter and an added first target parameter, and / or an interface with an added second target parameter;

[0009] Update the original adaptation program of the second operating system based on the target interface to obtain a target adaptation program applicable to the first operating system, and output an update report and a recommended modification plan report; the update report includes the update record of the target interface; the recommended modification plan 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.

[0010] In a second aspect, there is provided an update device for an Internet of Things operating system adaptation program, including:

[0011] A target relationship file determination module, configured 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, where the target relationship file is used to describe the interface correspondence 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, where 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 a deleted original parameter and an added first target parameter, and / or an interface with an added second target parameter;

[0013] A target adaptation program determination module, configured to update the original adaptation program of the second operating system based on the target interface to obtain a target adaptation program applicable to the first operating system, and output an update report and a recommended modification plan report; the update report includes the update record of the target interface; the recommended modification plan 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.

[0014] In a third aspect, there is provided an electronic device, 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 executable by the at least one processor, and when the computer program is executed by the at least one processor, the at least one processor is enabled to execute the update method of the Internet of Things operating system adaptation 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 update method of the Internet of Things operating system adaptation 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 includes a computer program, and when the computer program is executed by a processor, the update method of the Internet of Things operating system adaptation program as described in the first aspect above is implemented.

[0020] Embodiments of the present disclosure disclose an update method, device, device and product of an Internet of Things operating system adaptation program. 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, where 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, where 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 a deleted original parameter and an added first target parameter, and / or an interface with an added second target parameter; updating the original adaptation program of the second operating system based on the target interface to obtain a target adaptation program applicable to the first operating system, and outputting an update report and a recommended modification plan report; the update report includes an update record of the target interface; the recommended modification plan 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 a 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 updates the original adaptation program using the target interface, and outputs an update report and a recommended modification plan report, realizing the automatic update of the adaptation program, reducing the workload and input cost of developers, and providing developers with an effective recommended update plan.

[0021] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used 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] To more clearly illustrate the technical solutions in the embodiments of the present disclosure, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the embodiments of the present disclosure. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

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

[0024] Figure 2 It is a schematic diagram of the update process of an adaptation program provided in the first embodiment of the present disclosure;

[0025] Figure 3 It is a schematic structural diagram of an IoT operating system adaptation program update device provided in the second embodiment of the present disclosure;

[0026] Figure 4 It is a schematic structural diagram of an electronic device provided in the third embodiment of the present disclosure. Detailed Description of the Embodiments

[0027] In order to enable those skilled in the art to better understand the solutions of the embodiments of the present disclosure, the following will clearly and completely describe the technical solutions in the embodiments of the present disclosure in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only some 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 those of ordinary skill in the art without creative efforts shall 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 description and claims of the embodiments of the present disclosure and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances 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 "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.

[0029] Embodiment 1

[0030] Figure 1The following is a flowchart of a method for updating an Internet of Things operating system adaptation program provided in Embodiment 1 of the present disclosure. This embodiment is applicable to the situation of updating the Internet of Things operating system adaptation program. This method can be executed by an updating device for the Internet of Things operating system adaptation program. The updating device for the Internet of Things operating system adaptation program can be implemented in the form of hardware and / or software. The updating device for the Internet of Things operating system adaptation program can be configured in an electronic device, and the electronic device includes, but is not limited to, devices with data processing capabilities such as computers, laptops, terminals, and servers. As Figure 1 shown, the method includes:

[0031] S110. 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. The target relationship file is used to describe the interface correspondence between the first operating system and the second operating system.

[0032] Specifically, the first operating system can be the updated operating system, and the second operating system can be the operating system before the update. Exemplarily, the first operating system can be the updated Openharmony operating system, and the second operating system can be the Openharmony operating system before the update. The first interface information can be determined based on the interface description document of the first operating system, and the second interface information can 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, which can provide all the information required for developers to use the API, so that developers can correctly call and integrate these interfaces.

[0033] Exemplarily, two website links can be input, respectively pointing to the interface description documents of the first operating system and the second operating system. That is, two strings describing the website addresses can be used as the initial input. Around 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. 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. By preprocessing the txt_old text, the second interface information can be obtained, and by preprocessing the txt_new text, the first interface information can be obtained. The preprocessing operation can be to convert the content in txt_old and txt_new into list forms according to the column names in the CSV file, namely the method name, parameters, 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. Each list item is still a list, which consists of a method name, a return value, and parameters in sequence. Among them, the method name and the return value each consist of a single item, and the parameters may consist of multiple items. Therefore, the length of the list of items representing a specific piece of interface information will vary according to the actual situation. At the same time, the return value and the parameters are allowed to be empty. When the return value is empty, the second item in the list representing a specific piece of interface information will be marked as empty and will not be omitted. When the parameters are empty, the third item in the list is marked as empty. That is, the length of the list of items representing a specific piece of interface information is at least 3. The first interface information may include a method name, a return value, parameters, an interface description, and an interface name. The second interface information may also include a method name, a return value, parameters, an interface description, and an interface name.

[0035] Continuing with the above description, the target relationship file can be determined based on the first interface information and the second interface information. 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 utilized to infer the cross-version correspondence relationship of the OpenHarmony operating system APIs through information such as interface descriptions and interface names, and output the complete information of the corresponding APIs pair by pair. Finally, the target relationship file is obtained according to the answer of the large language model.

[0036] S120. Determine the target interfaces based on the target relationship file. The target interfaces include interfaces with changed function names, interfaces with increased return values, interfaces with deleted return values, interfaces with modified return value types, interfaces with deleted parameters, interfaces with deleted original parameters and added first target parameters, and / or interfaces with added second target parameters.

[0037] In this embodiment, the target interfaces can be determined based on the target relationship file. During the update of the original adaptation program, the target interfaces can refer to the interfaces that have changed between the first operating system and the second operating system. These interface changes may include function adjustments, parameter modifications, or data format updates to ensure that the program can run properly in the new operating system environment. The target interfaces include interfaces with changed function names, interfaces with increased return values, interfaces with deleted return values, interfaces with modified return value types, interfaces with deleted parameters, interfaces with deleted original parameters and added first target parameters, and / or interfaces with added second target parameters.

[0038] S130. Update 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 output an update report and a recommended modification plan report. The update report includes the update record of the target interface. The recommended modification plan report includes a propagation path list, first recommended modification information, and second recommended modification information. The propagation path list is used to store the propagation paths of target variables. 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 program of the second operating system can be updated based on the target interface to obtain a target adapter program suitable for the first operating system. At the same time, the update process of the target interface can be recorded and the update process can be recorded in the update report.

[0040] Continuing with the above description, an update report and a recommended modification plan report can be output. The recommended modification plan report includes a propagation path list, first recommended modification information, and second recommended modification information. The propagation path list is used to store the propagation paths of target variables. Exemplarily, the target variable can be the variable stored in the return value to be deleted in the interface that deletes the return value and / or the variable stored in the target return value in the interface whose return value type is modified. It should be noted that in the case where 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 a method for updating an adapter program of an Internet of Things operating system, including: determining 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, where the target relationship file is used to describe the interface correspondence between the first operating system and the second operating system; determining target interfaces based on the target relationship file, where the target interfaces include interfaces with changed function names, interfaces with increased return values, interfaces with deleted return values, interfaces with modified return value types, interfaces with deleted parameters, interfaces with deleted original parameters and added first target parameters, and / or interfaces with added second target parameters; updating the original adapter program of the second operating system based on the target interfaces to obtain a target adapter program applicable to the first operating system, and outputting an update report and a recommended modification plan report; the update report includes the update records of the target interfaces; the recommended modification plan report includes a propagation path list, first recommended modification information, and second recommended modification information; where the propagation path list is used to store the propagation paths of target variables; 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, realizing the automatic update of the original adapter program, reducing the workload and input cost of developers, and providing developers with effective recommended update plans.

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

[0043] 1) Obtain first call information including an initial function name in the original adapter program; the first call information includes a first call line number and 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 with a changed function name, first call information including the initial function name can be obtained in the original adapter program; the initial function name can be the function name in the original adapter program. Exemplarily, if the function name changes from "func1" to "func2", the initial function name is "func1", and the first call information can be the information of calling the initial function name, and the first call information includes a first call line number and 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. Exemplarily, 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 regular expressions) or a code parsing tool (such as an abstract syntax tree) can 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, if 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 process of updating the function name can be recorded in an update report. The update report can contain multiple update records. The logical structure of the update record is a list. Each table entry is an update record, and each update record is a triple (StartLineNo, codeBefore, codeAfter), which respectively represent the starting line number of the modification in the modified original adapter, the code snippet before modification, and the code snippet after modification.

[0049] As an optional implementation manner 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 including an 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.

[0051] It can be known that if the target interface is an interface with an increased return value, then second call information including an initial return value can be obtained in the original adapter. The first call information can be information including the initial return value. The second call information includes a second call line number and a 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 line before the line number of the second call. The first target line is used to store the increased target return value, and update the statement corresponding to the line number of the second call to a statement for assigning the target return value.

[0053] Specifically, after the line number of the second call and the second call code are determined, a first target line can be created before the line number of the second call. The first target line is used to store the increased target return value, and update the statement corresponding to the line number of the second call to a statement for assigning the target return value.

[0054] Exemplarily, the increase in the return value can be represented as modifying "null = func(X, Y, Z)" to "Var = func(X,Y,Z)". Obtain the call information for the initial return value, such as "func(x, y, z)", create a variable of the new return value type before the call occurrence line, such as "Var var = new Var( )", and rewrite the original call occurrence line as the assignment code for this new 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 manner of this embodiment, after updating the original adaptation program of the second operating system based on the target interface, it further includes:

[0057] Increment the line number of the second target line in the update report by 1; the second target line is the line in the update report that is after the line number corresponding to the first target line.

[0058] It should be noted that if the target interface is an interface for increasing the return value, after the update of the original adaptation program is completed, the line numbers of the lines after the line number corresponding to the first target line in the update report can be incremented by 1.

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

[0060] 1) Obtain the third call information including the return value to be deleted in the original adaptation program; 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 can be the interface where the return value is deleted. Exemplarily, the interface for deleting the return value can be modifying "Var = func(X,Y,Z)" to "null = func(X,Y,Z)". If the target interface is the interface for deleting the return value, the third call information containing the return value to be deleted can be obtained in the original adapter program; 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; 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 program based on the large language model.

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

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

[0065] Following 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 program. Exemplarily, if var has not been used, automatically modify the code snippet to "func(x, y, z)".

[0066] 4) If it is used, determine whether the return value to be deleted is only assigned to the parameter deletion list; if so, delete the return value to be deleted in the original adapter program; otherwise, mark the propagation path of the first variable storing the return value to be deleted in the original adapter program 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 table to be deleted; if so, delete the return value to be deleted stored in the line corresponding to the third call line number in the original adapter program; otherwise, mark the propagation path of the first variable storing the return value to be deleted in the original adapter program and save the propagation path to the propagation path list. Here, the first variable can be the variable storing the return value to be deleted in the interface for deleting the return value. The propagation path can be composed of a list, and each entry represents a use of the API call result and is composed of a tuple (LineNo, varName, codeSnipt). Each element in the entry represents the line number, variable name, and code snippet in sequence.

[0068] Exemplarily, if var is only used to assign parameters in the parameter table to be deleted before being assigned otherwise, the variable storing the result is directly deleted at the API call line, that is, the code snippet is automatically modified to "func(x, y, z)". Otherwise, mark the propagation path UsagePath of the result in the original adapter program and save the propagation path UsagePath 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 manner of this embodiment, if the target interface is an interface whose return value type is modified, updating the original adapter program 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 program; 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 program; 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.

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

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

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

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

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

[0077] 4) If it is used, determine whether the target return value is only assigned to the parameter deletion list.

[0078] Continuing from the above description, if the variable storing the target return value is used by the original adapter program, it can be determined whether the target return value is only assigned to the parameter deletion list.

[0079] 5) If so, modify the variable type of the variable in the parameter deletion list to the target type.

[0080] Specifically, if the target return value is only assigned to the parameter deletion list, the variable type of the variable in the parameter deletion list 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 program and save the propagation path to the propagation path list.

[0082] Specifically, if the target return value is not only assigned to the parameter deletion list, the propagation path of the second variable storing the target return value in the original adapter program can be marked and the propagation path can be saved to the propagation path list. Among them, 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. For example, modify "Var1 = func(X,Y,Z)" to "Var2 = func(X,Y,Z)", obtain their fourth call information in the original adapter, and check the variables storing the results of these API calls. For example, in the code snippet "var = func(x, y, z)". Using a large language model, set relevant prompt words to confirm whether var is used or passed to other variables before being reassigned later. If not, directly modify the type definition of the variable storing the result at the fourth call line number 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 parameters in the parameter deletion table before being reassigned later, also directly modify the type definition of the variable storing the result at the fourth call line number of the API, that is, modify the code snippet "Var1 var = new Var1( )" to "Var2 var = new Var2( )". Otherwise, mark this propagation path in the original adapter and save the propagation path to the propagation path list UsagePath.

[0084] As an optional implementation manner 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 including the deletion 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 deletion parameter.

[0086] Specifically, if the target interface is a parameter deletion interface, the fifth call information including the deletion parameter 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 deletion parameter.

[0087] 2) Update the corresponding call function in the original adapter based on the fifth call information, and the call function is the function that calls the deletion parameter.

[0088] Specifically, based on the fifth call line number, the parameter to be deleted in the call function corresponding to the fifth call line number can be deleted. Exemplarily, the parameter deletion interface can be an interface that modifies "Var = func(X, Y, Z)" to "Var = func(X, Y)". The call function can be "var" in the code snippet "var = func(X, Y, Z)", 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 manner of this embodiment, if the target interface is an interface for deleting the original parameter and adding the first target parameter, updating the original adaptation program of the second operating system based on the target interface includes:

[0090] Obtain the sixth call information including the interface for deleting the original parameter and adding the first target parameter in the original adaptation program, and save the sixth call information to the parameter to-be-deleted table; where 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 can be an interface for deleting the original parameter and adding the first target parameter. Exemplarily, the target interface can be an interface that modifies "Var = func(X, Y, Z)" to "Var = func(X, Y, Q, P)". If the target interface is an interface for deleting the original parameter and adding the first target parameter, the sixth call information including the interface for deleting the original parameter and adding the first target parameter can be obtained in the original adaptation program, and the sixth call information can be saved to the parameter to-be-deleted table. Among them, the original parameter can be the parameter included in the original adaptation program, and the first target parameter can be the added parameter. Exemplarily, for the interface that modifies "Var = func(X, Y, Z)" to "Var = func(X, Y, Q, P)", the original parameter can be Z, and the first target parameters can be P and Q. It should be noted that the above update process can be recorded in the 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 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.

[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, 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 meanings of the table entries are the line number of the call in the original adapter, the variable name corresponding to the parameter to be deleted, and the method name in sequence.

[0094] As an optional implementation manner 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] Obtain the seventh call information including the interface for adding the second target parameter in the original adapter, and save the seventh call information to the parameter to be added / 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 can be an interface for adding a second target parameter. Exemplarily, the target interface can be expressed as an interface that modifies "Var = func(X, Y, Z)" to "Var = func(X, Y, Z, Q)", and Q can be the added second target parameter. The seventh call information including the interface for adding the second target parameter can be obtained in the original adapter. 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.

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

[0098] As an optional implementation manner of this embodiment, if the target interface is an interface for deleting the original parameter and adding the first target parameter, the method further includes:

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

[0100] Specifically, for an interface that deletes the original parameter and adds a first target parameter, the first target variable can 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) Determine the 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 an API with parameter changes, list all APIs with changes including deleting the original parameter and adding the first target parameter. For example, changing "Var = func(X, Y, Z)" to "Var = func(X, Y, Q)", where Z can represent the deleted original parameter and Q can represent the added first target parameter. The call information of the first target parameter can be obtained, and the first target variables that match the type of the modified first target parameter in the original adapter before the call occurs can be retrieved, and the first target variables are summarized into a list as the first recommended modification information.

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

[0104] 1) Determine the 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, the second target variable can 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 the 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 an API with parameter changes, list all APIs with changes including adding parameters. For example, changing "Var = func(X, Y, Z)" to "Var = func(X, Y, Z, Q)", where Q can represent the second target parameter, and the variables stored in Q can be the second target variables. The call information of the second target parameter can be obtained, and the second target variables that match the type of the second target parameter in the original adapter before the seventh call information occurs can be retrieved, and the second target variables are summarized into a list as the second recommended modification information.

[0108] Taking the Openharmony operating system as an example, Figure 2 is a schematic diagram of the update process of an adapter provided in this embodiment, as Figure 2 shown.

[0109] Step 1) Automatically capture API update content. Two website links can be input, which respectively point 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, two strings describing the website addresses are used as the initial input. Based on such input, the request library in the Python language is used to actually obtain the content of the web page (interface description document), and the BeautifulSoup library is further applied to parse the web page content and extract the content with practical significance, automatically capturing the interface description documents of the first operating system and the second operating system. That is, the specific content in the two website addresses is saved as text txt_old and txt_new respectively.

[0110] Step 2) Automatically identify API correspondence. The texts txt_old and txt_new of the specific content of the interface description documents of the two versions of the OpenHarmony operating system are used as input, and the large language model is applied to automatically identify the API correspondence of the multi-version OpenHarmony operating system.

[0111] First, read the texts txt_old and txt_new for preprocessing. According to the column names in the CSV file, namely the method name, parameters, and return value, the content in the two files is converted into list forms respectively, namely OH_API_oldVer (the second interface information) and OH_API_newVer (the first interface information). Parse OH_API_oldVer and OH_API_newVer, and obtain the API old and new version correspondence file (target relationship file) OH_API_Mapping according to the answer of the large language model.

[0112] Step 3) The first step of the automatic update of the adaptation program - automatically replace the updated function names. Identify the changes in function names during the API version iteration and perform the first update of the adaptation program Px (the original adaptation program). Read the API old and new version correspondence file OH_API_Mapping. For the APIs with changed function names, list all these APIs. For example, change the function name from "func1" to "func2". According to the function name before the version change, such as "func1", obtain the call information (the first call information) of these functions in the adaptation program Px (the original adaptation program). 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. Directly modify these function calls according to the target relationship file of the API version change. For example, directly modify the above function calls to "func2(x, y, z)", "var = func2(x, y, z)". After the modification, summarize the modification records into Update_report (the update report). The logical structure of the modification records is a list, each table item is a modification record, and each modification record is a triple (StartLineNo, codeBefore, codeAfter). The table items represent the starting line number of the modification in the modified adaptation program, the code snippet before the modification, and the code snippet after the modification in sequence.

[0113] Step 4) The second step of the automatic update of the adaptation program - automatically correct the scenario where the return value increases. Identify the situation where the API adds a return value during the API version iteration and perform the second update of the adaptation program Px (the original adaptation program).

[0114] For APIs whose return values change, list all the APIs with new return values. For example, change "null = func(X,Y, Z)" to "Var = func(X,Y,Z)", and obtain their call information (the second call information) in the adapter program Px. For example, the second call code can be "func(x, y, z)". Before the line where the call occurs, create a new line (the first target line) to store a variable of the type of the new return value (the target return value). For example, "Var var = new Var( )", and rewrite the original call occurrence line (the second call line number) as the assignment code for this new variable. For example, "var = func(x, y, z)". Whenever the above-mentioned modification occurs, first record the latest modification in the form of a triple (StartLineNo, codeBefore, codeAfter). Then, increment by one (+1) the starting line number (the second target line) of the modification records in the Update_report (update report) that are after the line number of the modification.

[0115] Step 5) The third step of the automatic update of the adapter program - automatically correct the scenario where only deletion changes occur in the parameters. Identify the cases where only deletions occur in the API parameters during the API version iteration, and perform the third step update of the original adapter program Px. For APIs with parameter changes, list all the APIs that have only had parameters deleted. For example, change "Var = func(X, Y, Z)" to "Var = func(X,Y)", and obtain their call information (the fifth call information) in the original adapter program Px. Based on the fifth call line number in the fifth call information, check the variables storing the call results of these APIs. For example, "var" in the code snippet "var =func(x, y, z)", and directly modify these function calls according to the corresponding relationship of the API version change. For example, directly modify the above function call to "func(x, y)". If the above-mentioned modification occurs, summarize the modification records in the Update_report (update report).

[0116] Step 6) Automatically identify scenarios where other deletion changes occur to parameters, and construct an understanding of change knowledge. For APIs with parameter changes, list all changed APIs including those with deleted parameters, covering all cases in the previous step. For example, changing "Var = func(X, Y, Z)" to "Var = func(X, Y, Q, P)", obtain their sixth call information in the original adapter program Px, and record relevant information in detail to form the API 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 meanings of the table entries are the line number in the adapter program Px where the call is located, the variable name corresponding to the parameter to be deleted, and the method name respectively.

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

[0118] Step 8) The adapter program automatically updates step 4 and constructs an understanding of change knowledge - automatically correct scenarios where the return value has a deletion change. Identify the situation where the API deletes the return value during API version iteration, and perform the fourth step update of the adapter program Px (original adapter program) and understand the change knowledge.

[0119] For APIs whose return values change, list all the APIs that delete the return values. For example, modify "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. For example, "var" in the code snippet "var = func(x, y, z)". Using a large language model, set relevant prompt words to confirm whether var is used or passed to other variables before being reassigned later. If not, directly delete the variable that stores the result on 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 as an argument to be deleted in the API_PmtToDel table before being reassigned later, also directly delete the variable that stores the result on 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 modifications occur, summarize the modification records into the Update_report (update report); otherwise, mark the propagation path UsagePath of the result in Px and save the propagation path to the propagation path list. Each entry in the propagation path list represents a use of the API call result and is composed of a tuple (LineNo, varName, codeSnipt), where each element in the entry represents the line number, variable name, and code snippet in sequence.

[0120] Step 9) The adaptation program automatically updates the fifth step and constructs the understanding of change knowledge - automatically corrects the scenarios where the return value type changes. Identify the cases where the API modifies the return value type during the API version iteration, and perform the fifth step update of the adaptation program Px and the understanding of the change knowledge. For the APIs with changed return values, list all the 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 storing 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 is used or passed to other variables before being reassigned later. If not, directly modify the type definition of the variable storing the result at the API call line (the fourth call line number), that is, change the code snippet "Var1 var = new Var1( )" to "Var2 var = new Var2( )"; if var is only used to assign parameters in API_PmtToDel (parameter to be deleted table) before being reassigned later, also directly modify the type definition of the variable storing the result at the API call line (the fourth call line number), that is, change the code snippet "Var1 var =new Var1( )" to "Var2 var = new Var2( )". If the above modifications occur, summarize the modification records into the Update_report (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) Aggregate all the understanding of change knowledge to automatically form a recommended modification plan. Aggregate all the knowledge understanding of the API version iteration to form a recommended modification plan for developers. For the APIs with changed parameters, list all the changes including the APIs with added parameters, such as changing "Var = func(X, Y, Z)" to "Var = func(X, Y, Z,Q)", obtain their call information (the seventh call information) in the adaptation program Px, retrieve all the variables that match the new parameter type before the call in the adaptation program (the second target variables), summarize them into a list as the recommended modification information (the second recommended modification information), and record it in the recommended modification plan report Recom_Report.

[0122] For APIs with parameter changes, list all changes, including APIs with modified parameter types. For example, change "Var = func(X, Y, Z)" to "Var = func(X, Y, Q)". Obtain their sixth call information in the adaptation program Px. Retrieve all variables (first target variables) that conform to the modified parameter types before the call in the adaptation program, and summarize them into a list as the modification recommendation information (first recommended modification information), which is recorded in the recommended modification plan (modification plan recommendation report) Recom_Report. Summarize all UsagePaths (propagation path lists) into the recommended modification plan (modification plan recommendation report) Recom_Report as the modification opinions for other parts of the API calls that need to be confirmed by developers.

[0123] Step 11) Output the modified adaptation program, Update_report (update report), and the recommended modification plan (modification plan recommendation report) Recom_Report for subsequent complex updates.

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

[0125] This method utilizes large language models and program analysis techniques to construct the recognition and understanding of the updated content of the operating system version, and systematically completes the in-depth automatic update of the adaptation program. At the same time, it provides a more comprehensive update recommendation plan, thereby helping developers quickly achieve the adaptive synchronization of the adaptation program.

[0126] Embodiment 2

[0127] Figure 3 It is a schematic structural diagram of an update device for an Internet of Things operating system adaptation program provided in Embodiment 2 of the present disclosure; as Figure 3 shown, the device includes: a target relationship file determination module 210, a target interface determination module 220, and a target adaptation program determination module 230.

[0128] Among them, 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, and the target relationship file is used to describe the interface correspondence relationship between the first operating system and the second operating system;

[0129] The target interface determination module 220 is used to determine a target interface based on the target relationship file, and 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 a deleted original parameter and an added first target parameter, and / or an interface with an added second target parameter;

[0130] A target adapter determination module 230, configured to update the original adapter of the second operating system based on the target interface to obtain a target adapter applicable to the first operating system, and output an update report and a recommended modification plan report; the update report includes an update record of the target interface; the recommended modification plan 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 paths of target variables; 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.

[0131] Embodiment II of the present disclosure provides an update device for an Internet of Things operating system adapter, which realizes automatic update of the adapter, reduces the workload and input cost of developers, and provides effective recommended update solutions for developers.

[0132] Further, if the target interface is an interface with a changed function name, the target adapter determination module 230 is further configured to:

[0133] Obtain 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 the call line number corresponding to the initial function name; the first call code is the call code corresponding to the initial function name;

[0134] Update the initial function name in the first call information to a target function name applied to the target adapter.

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

[0136] Obtain second call information including an 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 line in the line before the second call line number, where the first target line is used to store the increased target return value, and update the statement corresponding to the second call line 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] A line number increment module for incrementing the line number of the second target line in the update report by 1; the second target line is the line in the update report that is after the line number corresponding to the first target line.

[0140] Further, the target variables include a first variable and a second variable; if the target interface is an interface for deleting return values, the target adapter determination module 230 is further configured to:

[0141] Obtain third call information including a to-be-deleted return value 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 to-be-deleted return value; the third call code is the call code corresponding to the to-be-deleted return value;

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

[0143] If not used, delete the to-be-deleted return value in the original adapter;

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

[0145] Further, the target variables include a first variable and a second variable; if the target interface is an interface for modifying the type of a return value, the target adapter determination module 230 is further configured to:

[0146] Obtain fourth call information including 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 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;

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

[0148] If not used, modify the variable type storing the variable in the original adapter to the target type;

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

[0150] If so, 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 stored in the target return value in the original adaptation program, and save the propagation path to the propagation path list.

[0152] Further, if the target interface is a parameter deletion interface, the target adaptation program determination module 230 is further configured to:

[0153] Obtain fifth call information including a fifth call line number in the original adaptation program, where the fifth call line number is the call line number corresponding to the deleted parameter; the fifth call information includes an interface for deleting a parameter;

[0154] Update the corresponding call function in the original adaptation program based on the fifth call information, where the call function is a function for calling the deleted parameter;

[0155] Further, if the target interface is an interface for deleting an original parameter and adding a first target parameter, the target adaptation program determination module 230 is further configured to:

[0156] Obtain sixth call information including a sixth call line number and a sixth call code in the original adaptation program, where 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, and the sixth call code includes the call code corresponding to the deleted original parameter and the call code corresponding to the first target parameter; save the sixth call information to the parameter to-be-deleted table; the sixth call information includes an interface for deleting an original parameter and adding a first target parameter;

[0157] Wherein, 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, and the sixth call code includes the call code corresponding to the deleted original parameter and the call code corresponding to the first target parameter;

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

[0159] Obtain seventh call information including a seventh call line number and a seventh call code in the original adaptation program, where 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; save the seventh call information to the parameter to-be-added / modified table; the seventh call information includes an interface for adding a second target parameter;

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

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

[0162] The first recommended modification information determination module is 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 apparatus further includes:

[0164] The second target variable determination module is configured to determine a second target variable based on the seventh call information, where the second target variable is a variable matching the 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 update device for the Internet of Things operating system adaptation program provided by the embodiments of the present disclosure can execute the update method for the Internet of Things operating system adaptation program provided by any embodiment of the embodiments of the present disclosure, and has corresponding functional modules and beneficial effects for executing the method.

[0167] Embodiment III

[0168] Figure 4 FIG. shows a schematic structural diagram of an electronic device 10 that can be used to implement the embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, for example, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the embodiments of the present disclosure described and / or claimed herein.

[0169] As Figure 4 shown, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc. Among them, the memory stores a computer program executable by at least one processor. 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 into 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] Multiple 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 disc, 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 via a computer network such as the Internet and / or various telecommunication networks.

[0171] The processor 11 can be various general-purpose and / or special-purpose 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 dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microprocessor, etc. The processor 11 executes the various methods and processes described above, such as the update method of the Internet of Things operating system adapter or the query method of the knowledge graph.

[0172] In some embodiments, the update method of the Internet of Things operating system adapter or the query method of the knowledge graph can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto 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 update method of the Internet of Things operating system adapter or the query method of the knowledge graph described above can be executed. Alternatively, in other embodiments, the processor 11 can be configured to execute the update method of the Internet of Things operating system adapter or the query method of the knowledge graph by any other suitable means (e.g., by means of firmware).

[0173] The various embodiments of the systems and technologies described above in this article 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 a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments 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 or general programmable processor, and can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0174] The computer program for implementing the method of the embodiments of the present disclosure can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowchart and / or block diagram to be implemented. The computer programs can be executed entirely on the machine, partially on the machine, as a stand-alone software package partially on the machine 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 can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0176] In order to provide interaction with a user, the systems and techniques described herein can 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 a trackball) by which the user can provide input to the electronic device. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and the input from the user can be received in any form (including acoustic input, voice input, or tactile input).

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

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

[0179] It should be understood that various forms of the processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in the embodiments of the present disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions of the embodiments of the present disclosure can be achieved, and no limitation is imposed herein.

[0180] The above specific implementation manners do not constitute a limitation on the protection scope of the embodiments of the present disclosure. Those skilled in the art should understand 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 principle of the embodiments of the present disclosure shall be included within 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, implement the update method of the Internet of Things operating system adaptation program or the query method of the knowledge graph provided in any embodiment of the present application.

[0182] In the process of implementing a computer program product, computer program code for performing the operations of the embodiments of the present disclosure can be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed 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, alternatively, can be connected to an external computer (e.g., by using an Internet service provider to connect through the Internet).

[0183] Note that the above is only the preferred embodiment of the embodiments of the present disclosure and the applied technical principles. Those skilled in the art will understand that the embodiments of the present disclosure are not limited to the specific embodiments here, and various obvious changes, re-adjustments, 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 have been described in more detail through the above embodiments, the embodiments of the present disclosure are not limited to the above embodiments. Without departing from the concept of the embodiments of the present disclosure, more other equivalent embodiments can be included, and the scope of the embodiments of the present disclosure is determined by the scope of the appended claims.

Claims

1. A method for updating an operating system adapter, characterized in that: The method is performed by an electronic device, and the method includes: 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; The original adapter of the second operating system is updated based on the target interface 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; the first operating system is the updated operating system, and the second operating system is the operating system before the update; For the target interface, obtaining call information for the target interface in the original adapter; the call information includes an initial function name, an initial return value, a return value to be deleted, a target return value, a deleted parameter, an interface of the deleted original parameter and the added first target parameter, and / or information corresponding to the added second target parameter; The original adapter is updated based on the calling information to obtain a target adapter suitable for the first operating system.

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 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; the first operating system is the updated operating system, and the second operating system is the operating system before the update; For the target interface, obtaining call information for the target interface in the original adapter; the call information includes an initial function name, an initial return value, a return value to be deleted, a target return value, a deleted parameter, an interface of the deleted original parameter and the added first target parameter, and / or information corresponding to the added second target parameter; The original adapter is updated based on the calling information to obtain a target adapter suitable for the first operating system.

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

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

    CN119225761A