Data processing method and device, electronic equipment and computer readable storage medium
Patent Information
- Application Number
- CN202310176713.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-22
- Publication Date
- 2026-08-28
- Estimated Expiration
- 2043-02-22
AI Technical Summary
[0003]本申请提供一种数据处理方法、装置、电子设备及计算机可读存储介质,以解决现有技术中需要通过工作人员输入各种命令来实现编译、验证、版本管理等操作,导致软件开发的过程较为繁琐,且掌握输入命令实现编译、验证、版本管理等操作对一般开发人员来说较为困难,费时又容易出错的问题
[0003] This application provides a data processing method, apparatus, electronic device, and computer-readable storage medium to solve the problem that in the prior art, various commands need to be entered by staff to achieve operations such as compilation, verification, and version management, which makes the software development process cumbersome. Furthermore, mastering the input commands to achieve operations such as compilation, verification, and version management is difficult for general developers, time-consuming, and prone to errors.
Smart Images

Figure CN116301886B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a data processing method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] In current software development processes, compiling, verifying, and version managing the code of a project are necessary. This is typically achieved by staff inputting various commands. Each operation requires inputting a specific command, and software development often involves multiple projects undergoing the same compilation, verification, and version management processes repeatedly. This makes the development process cumbersome, and mastering the command-line skills for compilation, verification, and version management is difficult for most developers, time-consuming, and prone to errors. Summary of the Invention
[0003] This application provides a data processing method, apparatus, electronic device, and computer-readable storage medium to solve the problem that in the prior art, various commands need to be entered by staff to achieve operations such as compilation, verification, and version management, which makes the software development process cumbersome. Furthermore, mastering the input commands to achieve operations such as compilation, verification, and version management is difficult for general developers, time-consuming, and prone to errors.
[0004] In a first aspect, this application provides a data processing method, comprising: responding to a user's first operation command based on a function list, obtaining a command script corresponding to a target function selected by the first operation command; responding to a user's second operation command based on an object list, obtaining target code corresponding to a target object selected by the second operation command; and running the command script to process the target code according to the target function, thereby obtaining a processing result.
[0005] In this embodiment, users can execute the command script corresponding to the target function on the target code corresponding to the target object by selecting the target object and the target function in the object list and the function list, without having to manually enter the command, which simplifies the user's operation process and reduces the difficulty of the user's operation.
[0006] In conjunction with the technical solution provided in the first aspect above, in some possible implementations, if the target function is a first type of function, the object list includes a project list, the project list contains one or more projects, each project corresponds to a project code, and each project includes at least one module; all modules under the same project share the same project code, and each module corresponds to a set of parameters; if the target object is a target project, obtaining the target code corresponding to the target object selected by the second operation command includes: obtaining the project code of the target project, where the project code of the target project is the target code.
[0007] In this embodiment of the application, since different types of functions require different target codes, when obtaining the target code corresponding to the target project, the method of obtaining the target code is determined according to the type of the target function, thereby improving the flexibility of this solution.
[0008] In conjunction with the technical solution provided in the first aspect above, in some possible implementations, if the target function is a second type of function, the object list includes a project list and a module list. Each project in the project list corresponds to a module list, each project corresponds to a project code, and each module in the same module list shares the project code corresponding to the project in that module list. Each module corresponds to a set of parameters. If the target object includes a target project and a target module, obtaining the target code corresponding to the target object selected by the second operation command includes: obtaining the project code corresponding to the target project and obtaining the target parameters corresponding to the target module; and obtaining the target code corresponding to the target object based on the target parameters and the project code corresponding to the target project.
[0009] In this embodiment of the application, since different types of functions require different target codes, when obtaining the target code corresponding to the target project, the method of obtaining the target code is determined according to the type of the target function, thereby improving the flexibility of this solution.
[0010] In conjunction with the technical solution provided in the first aspect above, in some possible implementations, obtaining the command script corresponding to the target function selected by the first operation command includes: obtaining the command script that comes with the operating system and corresponds to the target function selected by the first operation command, or obtaining the script that comes with the project corresponding to the target object and corresponds to the target function selected by the first operation command.
[0011] In conjunction with the technical solution provided in the first aspect above, in some possible implementations, responding to a user's first operation command based on a function list includes: responding to a user's first operation command based on a function list displayed in a visual interface.
[0012] In this embodiment of the application, by setting a visual interface, the user can select target objects and target functions more intuitively, thereby further improving the user experience.
[0013] In conjunction with the technical solution provided in the first aspect above, in some possible implementations, the object list includes a project list, a module list, and a platform list. The method further includes: responding to the user's operation of selecting a target function and a target platform, displaying a project list corresponding to the target platform in the visualization interface; responding to the user's operation of selecting a target project, determining whether the execution object of the target function is a project; if not, displaying a module list corresponding to the target project in the visualization interface.
[0014] In conjunction with the technical solution provided in the first aspect above, in some possible implementations, the visual interface further includes a confirmation option. The step of responding to a user's first operation command based on a function list, obtaining the command script corresponding to the target function selected by the first operation command; and responding to a user's second operation command based on an object list, obtaining the target code corresponding to the target object selected by the second operation command, includes: responding to a user's first operation instruction to select the target function, a second operation instruction to select the target object, and selecting the confirmation option; saving the target object and the target function selected by the user; and obtaining the target code corresponding to the target object and the command script corresponding to the target function.
[0015] In conjunction with the technical solution provided in the first aspect above, in some possible implementations, the function list includes at least one of the functions of downloading, updating, submitting, querying, compiling, debugging, and publishing.
[0016] Secondly, this application provides a project operating system, including: an acquisition module and a processing module. The acquisition module is used to respond to a user's first operation command based on a function list and acquire a command script corresponding to the target function selected by the first operation command; the acquisition module is also used to respond to a user's second operation command based on an object list and acquire the target code corresponding to the target object selected by the second operation command; the processing module is used to run the command script to process the target code according to the target function and obtain a processing result.
[0017] Thirdly, embodiments of this application also provide an electronic device, including: a memory and a processor, the memory and the processor being connected; the memory being used to store a program; the processor being used to invoke the program stored in the memory to perform a method provided as described in the first aspect embodiments and / or in combination with any possible implementation of the first aspect embodiments.
[0018] Fourthly, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when run by a computer, performs the method provided by any possible implementation of the first aspect embodiments and / or in combination with the first aspect embodiments. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a schematic flowchart illustrating a data processing method according to an embodiment of this application;
[0021] Figure 2 This is a schematic diagram illustrating the structure of a visual interface according to an embodiment of this application;
[0022] Figure 3 This is a flow structure block diagram of a project operating system shown in an embodiment of this application;
[0023] Figure 4 This is a structural block diagram of an electronic device shown in an embodiment of this application. Detailed Implementation
[0024] The terms “first,” “second,” “third,” etc., are used only for distinguishing descriptions and do not indicate a sequence number, nor should they be interpreted as indicating or implying relative importance.
[0025] Furthermore, terms such as "horizontal," "vertical," and "sag" do not imply that components must be absolutely horizontal or suspended, but rather that they can be slightly tilted. For example, "horizontal" simply means that its direction is more horizontal relative to "vertical," and does not mean that the structure must be completely horizontal, but can be slightly tilted.
[0026] In the description of this application, it should be noted that the terms "inner", "outer", "left", "right", "upper", "lower", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of this application is in use. They are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application.
[0027] In the description of this application, unless otherwise expressly specified and limited, the terms “set up,” “install,” “connect,” and “link” shall be interpreted broadly, for example, as a fixed connection, a detachable connection, or an integral connection; as a mechanical connection or an electrical connection; as a direct connection or an indirect connection through an intermediate medium; or as a connection within two components.
[0028] The technical solution of this application will now be described in detail with reference to the accompanying drawings.
[0029] Please see Figure 1 , Figure 1 This is a flowchart illustrating a data processing method provided in an embodiment of this application. The following will be combined with... Figure 1 The steps involved are explained.
[0030] S100: Respond to the user's first operation command based on the function list and obtain the command script corresponding to the target function selected by the first operation command.
[0031] In one implementation, the process of obtaining the command script corresponding to the target function selected by the first operation command may be to obtain the command script that is built into the operating system and corresponds to the target function selected by the first operation command, or to obtain the script that is built into the project corresponding to the target object and corresponds to the target function selected by the first operation command.
[0032] This can be done by first determining the location of the corresponding command script based on the target function, and then retrieving the command script from the operating system or from the project corresponding to the target object.
[0033] S200: Respond to the user's second operation command based on the object list, and obtain the target code corresponding to the target object selected by the second operation command.
[0034] The target object can be any of the following: platform, project, or module. A platform can have multiple projects, and a project can correspond to multiple modules. Each platform corresponds to one compiler, each project corresponds to one set of project code, and each module corresponds to a set of parameters.
[0035] Specifically, projects on the same platform use the same compiler and basic compilation options (the basic compilation options mentioned here are the options that the main control manufacturer requires to be passed in for source code compilation).
[0036] For example, when products using the same controller employ the same compiler and basic compilation options across projects, they belong to the same platform. Additionally, chips designed by different controller manufacturers form a series. These chips use the same core but differ slightly in peripherals; however, they share the same compiler and basic compilation options, thus belonging to the same platform. Even with the same platform but different controllers, differentiation based on the controller is often necessary in code implementation, making controller model information frequently required. One platform may correspond to multiple controllers; therefore, a configuration file showing the controller list and platform mappings can be stored in the project's operating system, allowing it to be transferred to various projects via scripts.
[0037] It is important to note that a project can be compiled using different compilers or basic compilation options. Therefore, a project is not necessarily for use on only one platform; that is, the same project can exist on multiple platforms at the same time.
[0038] The projects can be categorized according to Table 1.
[0039] Table 1
[0040]
[0041]
[0042] As shown in Table 1, the first type of project is commonly found in some open source projects, such as uboot, linux kernel, busybox, etc. They all come with configuration commands. After configuration, a .config file will be generated. The differences between different products are all in this .config file.
[0043] The second type of project is commonly found in some third-party open-source projects. No code modification is required; simply recompile the code using the compiler and compilation options corresponding to the main controller for different products.
[0044] The third type of project is common in self-developed projects. Since company products are generally planned as series, the code within the same series, and even different series, may be largely the same, with only a few features needing differentiation or addition / removal. Adding pre-compiled macros to the code and build scripts, allowing different products to use different macros, could achieve a shared project. While determining which macros to use based on the product is clearly feasible, it would create significant inconvenience for project management due to the broad scope of products, necessitating finer segmentation. In practice, a compromise can be reached: using the main controller used by the product to differentiate macros, while placing those relevant to the actual product within the project code, dynamically adapting to the product model at runtime.
[0045] The fourth type of project is commonly found in self-developed projects, such as driver projects and toolkits. The characteristic is that a single project contains various driver modules or tool source code; they are all independent, and are grouped together for ease of management.
[0046] A module is the smallest unit of compilation, and each module can be compiled, debugged, and published independently.
[0047] Different types of projects are broken down into modules in different ways.
[0048] For the first type of project mentioned above, each product of the project will be assigned to a separate module.
[0049] To facilitate listing module names later, a separate directory (e.g., Configs) can be created to store various configuration files named after different modules. Module names can use product names or their abbreviations, or nouns that reflect the characteristics of the module. For example, controller name, memory characteristics (type, frequency, size, etc.), storage chip characteristics (type, size, etc.), etc.
[0050] For the second type of project, since the only differences are the compiler and basic compilation options (which are distributed through the compilation system), a single project (or module) can be used across different platforms. Therefore, a personalized alias can be assigned to the project name, and this alias can be saved as the module name in the project's configuration file for later use when listing modules. For a given platform, the module list for that project can only include one module.
[0051] For Category 3 projects, the number of modules in the module list corresponding to the project is the same as the number of main control types required for the operation of multiple products corresponding to the project, and the parameters corresponding to the modules include the type of main control chip.
[0052] Optionally, since most of the code in different modules is the same, with only some functional blocks differing due to variations in different controllers, these differences can be organized into functional blocks controlled by compiler macros. The project's build script can then be modified to determine whether to define these compiler macros based on the controller passed to the build system. This allows for a similar approach to the second type of project, where a personalized alias is assigned to the project name and saved in the project's configuration file for use when listing modules. When listing modules, the controller name and the project alias are combined to form the module name.
[0053] For the fourth type of project, each sub-project corresponding to the project is treated as a module, and the number of modules corresponding to the project is the same as the number of sub-projects included in the project.
[0054] Optionally, each sub-project can be compiled independently, so each sub-project can correspond to one module. The module name can be the directory name where each sub-project is located.
[0055] Since the target objects are different when the target functions are different, the implementation methods for obtaining the target code corresponding to the target object selected by the second operation command are also different. Specifically, there are the following two implementation methods.
[0056] In the first implementation, if the target function is a first type of function, the object list includes a project list, the project list contains one or more projects, each project corresponds to a project code, and each project includes at least one module; all modules under the same project share the same project code, and each module corresponds to a set of parameters. If the target object is the target project, the specific process of obtaining the target code corresponding to the target object selected by the second operation command is to obtain the project code of the target project, and the project code of the target project is the target code.
[0057] The first category of functions only requires application to the project code, such as downloading, updating, submitting, and querying.
[0058] In the second implementation, if the target function is a second type of function, the object list includes a project list and a module list. Each project in the project list corresponds to a module list, and each project corresponds to a project code. Each module in the same module list shares the project code corresponding to the project in that module list. Each module corresponds to a set of parameters. If the target object includes a target project and a target module, the specific process of obtaining the target code corresponding to the target object selected by the second operation command can be as follows: First, obtain the project code corresponding to the target project and obtain the target parameters corresponding to the target module; then, based on the target parameters and the project code corresponding to the target project, obtain the target code corresponding to the target object.
[0059] The second type of function requires the application of parameters corresponding to the module, such as compilation, debugging, and deployment.
[0060] For example, when the target object is module 1 under project A, first obtain the project code of project A and the parameters corresponding to module 1. Then, based on the parameters of module 1 and the project code of project A, the target code can be obtained.
[0061] In one implementation, the object list may further include a platform list, where each platform includes at least one project, each project includes at least one module, the same platform corresponds to one compiler, each project corresponds to one project code, and each module corresponds to a set of parameters. The target object includes the target platform. The specific process of obtaining the target code corresponding to the target object selected by the second operation command can be divided into the following two cases.
[0062] In the first scenario, if the target function is a first-class function, for each project included in the target platform, obtain the project code corresponding to that project. The project code corresponding to each project is the target code.
[0063] In the second scenario, if the target function is a second type of function, for each project included in the target platform, obtain the project code corresponding to that project and the parameters corresponding to each module included in that project; based on the project code corresponding to each project included in the target platform and the parameters corresponding to each module included in each project, obtain the target code corresponding to the target object.
[0064] For example, when the target object is platform A, platform A includes two projects, project A and project B, and project A includes three modules, module 1, module 2 and module 3, and project B includes two modules, module 4 and module 5.
[0065] If the target function is a first-class function, obtain the project code corresponding to project A and project B respectively. The target code includes the project code corresponding to project A and project B respectively.
[0066] If the target function is a second type of function, for project A, first obtain the project code of project A, as well as the parameters corresponding to modules 1, 2, and 3. Then, based on the parameters corresponding to module 1 and the project code of project A, obtain the first target code; based on the parameters corresponding to module 2 and the project code of project A, obtain the second target code; based on the parameters corresponding to module 3 and the project code of project A, obtain the third target code. For project B, first obtain the project code of project B, as well as the parameters corresponding to modules 4 and 5. Then, based on the parameters corresponding to module 4 and the project code of project B, obtain the fourth target code; based on the parameters corresponding to module 5 and the project code of project B, obtain the fifth target code. The target codes include the first target code, the second target code, the third target code, the fourth target code, and the fifth target code.
[0067] S300: Runs a command script to process the target code according to the target function and obtain the processing result.
[0068] After obtaining the command script and the target code, running the command script will perform the processing corresponding to the target function on the target code and obtain the processing result.
[0069] Generally, processing a project requires navigating to its local directory. Some functions, such as updating, committing, and querying, do not require the project's built-in scripts because these operations are related to the tools used to host the project on the code server (such as Git or SVN). Therefore, these operations only need to invoke the corresponding tools installed on the build server. However, some functions, such as compiling, debugging, and deploying, require the project's built-in command scripts, and the function and the list of modules to be operated on must be passed to the command scripts.
[0070] Functions that don't require the project's built-in scripts, such as updates, commits, and common queries (e.g., project version and commit logs, status (whether modifications have been made locally), and the content of local modifications), can be achieved using single or multiple commands from Git or SVN. More complex queries (e.g., how many commits haven't been updated on the hosting server, specific modifications, whether the compilation results of each module of the project have been published), can be accomplished using scripts combined with commands from Git or SVN.
[0071] All four project types mentioned above can be compiled, debugged, and deployed using a single universal script. That is, when adding projects later, a simple script is needed to download and execute the universal script, enabling compilation, debugging, and deployment for each project, simplifying project maintenance. Since this universal script needs to support compilation, debugging, and deployment, various parameters need to be passed when calling it, as shown in Table 2:
[0072] Table 2
[0073]
[0074] All three commands take the following parameters: the command itself, the platform name, the project name, and a list of modules. The command itself tells the general script which processing branch to enter for operation. The combination of platform name, project name, and module ensures uniqueness; that is, as long as files named "module" are saved in a directory structure like "platform name / project name / module", it can be guaranteed that all modules for a certain platform are placed in the "platform name" directory without conflict.
[0075] The specific compilation process is related to the project types in Table 1.
[0076] For the first type of project, first copy the configuration file corresponding to the module as the configuration file that the project depends on, and then run the compilation command to compile.
[0077] For the second type of project, simply pass the compiler and compilation options to the compilation command to compile.
[0078] For the third type of project, simply pass the controller name, compiler, and compilation options to the compilation command to perform the compilation. The project's compilation script can distinguish which functional blocks are compiled using the controller name. Since the module name for this type is prefixed with the controller name, the controller name can be extracted from the module name.
[0079] For the fourth type of project, simply navigate to the subdirectory with the same name as each module and run the compilation command to compile.
[0080] It's difficult for a generic script to determine which of the first four categories a project belongs to. You can configure the project type in the project's configuration file, and the generic script can then retrieve it from the configuration file.
[0081] After successful compilation, the general script can copy the compilation results to "<specified directory> / <platform name> / <project name> / <module>". If the compilation result is a library, the header files also need to be copied. The "<specified directory>" is used to share the compiled libraries and tools with the compilation of other projects, allowing them to find the dependent libraries and header files from this "<specified directory>" according to the "<platform name> / <project name> / <module>" rule.
[0082] The function of debugging is to verify whether the previously compiled results can run normally as expected. The debugging process is as follows: First, navigate to the local project directory, run the general script, and copy the compiled results one by one according to the module list to "<debug directory> / <platform name> / <project name> / <module>". "<debug directory>" is a temporary directory for the product program, usually defined by the program packaging environment. The script for creating the product program retrieves resources from this directory and compiles them into the application or packages them into the image file.
[0083] The publishing function involves submitting the previously verified compilation results to the publishing server for use by other developers. The compilation results may be libraries, tools, or other files (such as uboot and kernel, which are executable files after compilation). If the compilation result is a library, the header files also need to be submitted for other developers to include. Libraries are divided into static libraries and dynamic libraries. Static libraries are linked during application compilation, while dynamic libraries need to be published with the application for dynamic loading.
[0084] The release process is as follows: First, download previously submitted versions from the URL on the release server corresponding to the project's compilation results to a specified local directory. Then, navigate to the local project directory and copy the compiled results one by one to the specified local directory according to the module list. The specific path can be "<specified directory> / <platform name> / <project name> / <module>". If the compiled result is a library, the header files also need to be copied to the directory containing the "<module>". Finally, in the "<specified directory>", commit the modified files to the release server. The entire release process described above can be completed using a script.
[0085] Optionally, if a new master controller needs to be added, first determine if its compiler and basic compilation options are the same as an existing platform. If so, no new platform needs to be added; simply add the master controller to the "Master Controller List and Platform-Specific Configuration Files". If new projects need to be added to the newly added master controller, add the projects according to the rules. If the newly added master controller belongs to a new platform, create a new platform directory (which can be named after the master controller) under the platform configuration directory, and add the corresponding project configuration files to it.
[0086] In one implementation, a visual interface may also be included. By setting up a visual interface, the user can more intuitively select target objects and target functions, further improving the user experience. Accordingly, responding to a user's first operation command based on the function list includes: responding to a user's first operation command based on the function list displayed in the visual interface. Similarly, responding to a user's second operation command based on the object list includes: responding to a user's second operation command based on the object list displayed in the visual interface.
[0087] The visual interface can include a platform list, a project list, a function list, and a module list.
[0088] The feature list may include at least one of the following: download, update, submit, query, compile, debug, and publish.
[0089] For ease of understanding, the following explanation uses a visual interface including a platform list, project list, module list, and function list as an example. Please refer to [link / reference]. Figure 2 For ease of subsequent operations, a directory (e.g., Platforms) can be created in the project's operating system to specifically store platform-related configurations. Within this directory, create subdirectories for each platform, naming them after the platform. Then, within each platform directory, create a configuration file that records the names of all projects included on that platform (considering some project names are quite long, abbreviations can be used for easier memorization), as well as the project's URL on the code server (UniformResource Locator).
[0090] The list of platform names in the menu can be obtained by listing the directory names created earlier, each named after a platform. If all platform configurations are located in the Platforms directory, simply iterate through all directories under this directory, obtaining each directory name; each directory name represents a platform name.
[0091] The project list includes the project names of all projects corresponding to the selected platform. The project names can be obtained by parsing the configuration files in the directory of the selected platform.
[0092] The module list includes the module names of all modules contained in the selected project.
[0093] Module names can be obtained by entering the local directory of the selected project and then running the preset "list modules" script.
[0094] Specifically, for the first type of project, if all product-related or module-specific configurations for the project are placed in the Configs directory of their respective projects, then all files in the Configs directory are traversed to obtain each filename in the Configs directory, and each filename is a module name.
[0095] For the second type of project, the module name can be obtained from the project's configuration file.
[0096] For the third type of project, the project alias is obtained from the project's configuration file, and then the names of each master controller corresponding to the platform are added to the beginning of the alias to form the module name. The number of master controllers is the same as the number of modules.
[0097] For the fourth type of project, iterate through all directories under the project directory and get the directory names. Each directory name is a module name.
[0098] Specifically, when the object list includes a project list, a module list, and a platform list, it can respond to the user's selection of a target function and a target platform by displaying the project list corresponding to the target platform in the visual interface. Then, responding to the user's selection of a target project, it determines whether the execution object of the target function is a project; if not, it displays the module list corresponding to the target project in the visual interface.
[0099] After selecting the target object and target function, the user can click the "Confirm" menu to execute steps S100 and S200. If the user selects "Cancel," the system will respond to the user's action and exit the menu interface.
[0100] Optionally, since the visual interface also includes a confirmation option, the process of responding to the user's first operation command based on the function list and obtaining the command script corresponding to the target function selected by the first operation command; and responding to the user's second operation command based on the object list and obtaining the target code corresponding to the target object selected by the second operation command can be as follows: responding to the user's first operation command to select the target function, the second operation command to select the target object and select the confirmation option, saving the target object and target function selected by the user, and obtaining the target code corresponding to the target object and the command script corresponding to the target function.
[0101] In one implementation, the visualization interface can be achieved by first using a script to obtain the information required to build the visualization interface, resulting in a filled-in JSON file (denoted as MenuFile.json).
[0102] Since the required functions can be determined in advance, the contents of the "command list" can be set directly, that is, each function corresponds to a name.
[0103] The value of the field "<platform name i>" in the visualization interface is obtained by traversing all directories under the Platforms directory (all platform configurations are located in the Platforms directory) to get the directory name.
[0104] The value of the field "<project name j>" in the visualization interface is obtained by parsing the configuration files in the various platform directories under the Platforms directory. It is important to note the correspondence between "<project name j>" and "<platform name i>".
[0105] The "<module k>" in the visualization interface is obtained through the script of the corresponding project. On the first operation, the corresponding project needs to be downloaded to a specific local directory, and then the script within that project is invoked to retrieve the module list. Afterwards, if any modules in the project change, the script must be invoked again to retrieve the module list and update the JSON file. The specific local directory can be chosen according to actual needs; there are no restrictions here.
[0106] After obtaining the necessary information for building the visual interface using a script, you can then use the script to populate the MenuFile.json file. Once the MenuFile.json file is complete, you can modify the status codes of each option to initialize the menu item's selection. For example, status code 1 indicates that the item is selected, and status code 0 indicates that it is not selected. Modifying the options and their status codes in the file can be done using a text editor or by developing a dedicated Linux or Windows tool.
[0107] Because JSON files are simple and easy to use, and have a wide range of applications, and there are several open-source projects available for parsing JSON files, it is very suitable to use JSON files as configuration files for building visual interfaces.
[0108] JSON files store a series of objects, each existing as a key-value pair. The key is typically a string, while the value can be a simple string, a number, an object, or an array. Because values can take many forms, the way a JSON file describes the same thing can vary. For example, a JSON file might contain:
[0109]
[0110] In this context, “…” represents an ellipsis.
[0111] The colon (:) is a key on the left and a value on the right, forming a key-value pair.
[0112] Everything enclosed in curly braces {} is an object, although in some cases the curly braces can be omitted. Each key-value pair is an object regardless of whether it is enclosed in curly braces or not.
[0113] The array is enclosed in square brackets []. Array members can be numbers, strings, or objects, separated by commas.
[0114] Fields enclosed in <> should be replaced with their actual values.
[0115] The status code is a number (such as 0, 1, 2) that indicates the status of the corresponding menu item being selected: not selected (such as 0), selected but not highlighted (such as 1), selected and highlighted (such as 2).
[0116] The JSON files provided above are for illustrative purposes only and are not intended to limit this application.
[0117] The previous section described how to generate a configuration file for a visual interface. The following example illustrates how to implement a visual interface using the configuration file MenuFile.json on a Linux operating system.
[0118] Based on the characteristics of JSON files, they can be parsed into arrays of structures, and nesting can be used to preserve hierarchy. For example, parsing the JSON file MenuFile.json, its first-level structure (denoted as stMenuFile) contains an array of command structures (denoted as astCommands[i], where i ranges from 0 to the number of commands minus 1) and arrays of platform structures (denoted as astPlatforms[i], where i ranges from 0 to the number of platforms minus 1). The command structure contains the status code and the specific command string. The platform structure contains the status code and an array of project structures (denoted as astProjects[j], where j ranges from 0 to the number of projects minus 1). The project structure array contains the status code and an array of module structures (denoted as astModules[k], where k ranges from 0 to the number of modules minus 1); the module structure contains the status code and the specific module name string. Through this nesting method, all key-value pairs in the JSON file can be included while preserving hierarchy. When parsing the JSON file as an array of structures for the first time, the status code of the first item in each list can be selected and highlighted.
[0119] If the server is based on the Linux operating system (as is common in embedded development environments), developers can remotely log in to the server for development using terminal emulation software (such as Xshell, PuTTY, SecureCRT, etc.). Therefore, when designing a visual interface, it is also necessary to consider whether the terminal emulation software used supports interface display. Through the inventor's practical verification, the open-source ncurses library and the popular Python library both support interface display. The examples provided here are for illustrative purposes only and should not be construed as limiting this application.
[0120] Because the open-source ncurses library supports both keyboard and mouse operations, it's easy to write programs that meet the requirements. The following section will explain the design method for a visual interface based on the ncurses library. Since the ncurses library is written in C, the structure obtained from parsing the JSON file MenuFile.json needs to be converted into a format supported by C. A tool for parsing JSON files and implementing menu operations can be developed using C. This tool can then be called using a shell script to present the visual interface to the project developers and respond to user actions on the interface.
[0121] Menu items in the same list can be selected multiple times, and hierarchical lists have dependencies (e.g., platform list and project list), making menu operations complex. The "Command List" only needs to support single selection. The "Platform List," "Project List," and "Module List" can all support multiple selection. The "Project List" depends on the currently selected "Platform Name," while the "Module List" depends on the currently selected "Project Name." That is, the current "Project List" includes all projects included in the currently selected platform, and the current "Module List" includes all modules included in the currently selected project.
[0122] To improve user experience, in one implementation, the display of selected and unselected menu items should differ. For example, this could be achieved through font color, with selected options displayed in red and unselected options in black. This example is for illustrative purposes only and should not be construed as limiting the scope of this application.
[0123] Since the "Platform List," "Project List," and "Module List" all support multi-selection, for menu items that support multiple selections, multiple selections of the same item may be possible. If a lower-level menu item is related to another item, its display should be different; for example, the font color should reflect the selected item, and the background color should also be set to a different color (e.g., blue). Once the visual interface design is complete, users can select menus using the arrow keys or the mouse. The difference between using the arrow keys and the mouse is that the arrow keys can only move to different menu items one by one (up, down, left, right), and cannot move outside the menu items; while the mouse can move to any position on the screen, and the mouse may land outside the menu item. The specific menu item the mouse cursor lands on is determined by whether the mouse cursor's coordinates on the screen fall within the range of the menu item.
[0124] When using the keyboard, to facilitate user operation, when the cursor is moved to a menu item using the arrow keys, a color (such as green) can be added to the background of the menu item to distinguish it. It should be noted that the background color here needs to be different from the background color of the item associated with the next level menu list and the currently selected option.
[0125] When using the keyboard, the Enter key can be set to confirm, meaning that when the user presses the Enter key, it is considered that an action has been taken on the currently selected menu item. This example is for illustrative purposes only and should not be construed as limiting the scope of this application.
[0126] When using a mouse, since the mouse cursor itself is a symbol that can be used to remind the user, it is not necessary to add color to the background of the menu item when moving the mouse over it.
[0127] When using a mouse for operation, it can be set to confirm with a left mouse button click; that is, when the user clicks the left mouse button, it is considered that an operation is to be performed on the currently selected menu item. This example is for illustrative purposes only and should not be construed as limiting this application.
[0128] When the user confirms the action, the display state of the selected menu item changes. If the menu item was not previously selected, it will be displayed as selected, and can be highlighted (e.g., displaying the background color when selected). At the same time, the next level menu changes accordingly. For example, when the user selects item A in the item list, item A will be displayed as selected and highlighted, and all modules corresponding to item A will be displayed in the module list.
[0129] If the menu item was previously selected but not highlighted, it will then be highlighted, and the next level menu will change accordingly.
[0130] If a menu item has been previously selected and highlighted, it will appear unselected. The next selected menu item in the same list will be highlighted, and the next level menu will change accordingly. If no other menu items are selected, the next level menu will be hidden.
[0131] In short, the content displayed in the next level menu item is related to the selected and highlighted menu item in the previous level menu item.
[0132] Each menu item in the same list is a single selection. When one item is selected, the previously selected item should automatically become unselected, and the next level menu should change accordingly.
[0133] It's important to note that the multi-selectable option list always includes a "<All>" option. Selecting "<All>" means all options in that list are selected. The previously highlighted menu items remain unchanged. Selecting "<All>" and then deselecting it deselects all subsequent items, and the next-level menu item is hidden. Whether "<All>" is selected or deselected, you can continue to individually select or deselect subsequent items. When not all subsequent items are selected, the "<All>" option is set to unselected.
[0134] The "All" menu item is a virtual menu item, and highlighting it is meaningless; therefore, it can be left unhighlighted. Each time a user selects a menu item, the system can determine whether the currently selected item is a "Confirm" or "Cancel" item. If it's a "Confirm" item, the status of each menu item is modified and saved to the MenuFile.json file; if it's a "Cancel" item, the system exits immediately.
[0135] Based on the same inventive concept, this application also provides a project operating system, such as Figure 3 As shown, the operating system 100 of this project includes an acquisition module 110 and a processing module 120.
[0136] The acquisition module 110 is used to respond to the user's first operation command based on the function list and acquire the command script corresponding to the target function selected by the first operation command.
[0137] The acquisition module 110 is also used to respond to a second operation command from the user based on the object list and acquire the target code corresponding to the target object selected by the second operation command.
[0138] The processing module 120 is used to run the command script to process the target code according to the target function and obtain the processing result.
[0139] The acquisition module 110 is specifically used to acquire the project code of the target project if the target function is a first type of function, the object list includes a project list, the project list contains one or more projects, each project corresponds to a project code, each project includes at least one module; all modules under the same project share the same project code, each module corresponds to a set of parameters, and if the target object is a target project, the project code of the target project is acquired.
[0140] The acquisition module 110 is specifically used to: if the target function is a second type of function, the object list includes a project list and a module list, each project in the project list corresponds to a module list, each project corresponds to a project code, each module in the same module list shares the project code corresponding to the project in that module list, and each module corresponds to a set of parameters; if the target object includes a target project and a target module, acquire the project code corresponding to the target project and acquire the target parameters corresponding to the target module; and obtain the target code corresponding to the target object based on the target parameters and the project code corresponding to the target project.
[0141] The acquisition module 110 is specifically used to acquire the command script that is built into the operating system and corresponds to the target function selected by the first operation command, or to acquire the script that is built into the project corresponding to the target object and corresponds to the target function selected by the first operation command.
[0142] The acquisition module 110 is specifically used to respond to the user's first operation command based on the function list displayed in the visual interface.
[0143] The acquisition module 110 is also used to respond to the user's operation of selecting a target function and a target platform, and to display a list of projects corresponding to the target platform in the visualization interface; and to respond to the user's operation of selecting a target project, and to determine whether the execution object of the target function is a project; if not, to display a list of modules corresponding to the target project in the visualization interface.
[0144] The acquisition module 110 is also used to include a confirmation option in the visualization interface, respond to the user's first operation instruction to select the target function, the second operation instruction to select the target object and the confirmation option, save the target object and the target function selected by the user, and acquire the target code corresponding to the target object and the command script corresponding to the target function.
[0145] In one implementation, the function list includes at least one of the following functions: download, update, submit, query, compile, debug, and publish.
[0146] The project operating system 100 provided in this application embodiment has the same implementation principle and technical effects as the aforementioned data processing method embodiment. For the sake of brevity, any parts not mentioned in the project operating system embodiment can be referred to the corresponding content in the aforementioned data processing method embodiment.
[0147] Please see Figure 4 This is an electronic device 200 provided in the embodiments of this application. The electronic device 200 includes: a transceiver 210, a memory 220, a communication bus 230, and a processor 240.
[0148] The transceiver 210, memory 220, and processor 240 are electrically connected directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses 230 or signal lines. The transceiver 210 is used to send and receive data. The memory 220 is used to store computer programs, such as... Figure 3The software functional module shown is the project operating system 100. The project operating system 100 includes at least one software functional module that can be stored in the memory 220 or embedded in the operating system (OS) of the electronic device 200 in the form of software or firmware. The processor 240 is used to execute executable modules stored in the memory 220, such as the software functional modules or computer programs included in the project operating system 100. At this time, the processor 240 is used to respond to a first operation command from the user based on a function list, obtain a command script corresponding to the target function selected by the first operation command; respond to a second operation command from the user based on an object list, obtain the target code corresponding to the target object selected by the second operation command; and run the command script to process the target code according to the target function, obtaining a processing result.
[0149] The memory 220 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), NOR flash memory, NAND flash memory, embedded multimedia card (eMMC), etc.
[0150] Processor 240 may be an integrated circuit chip with signal processing capabilities. The aforementioned processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor, or processor 240 can be any conventional processor.
[0151] Among them, the aforementioned electronic devices 200 include, but are not limited to, personal computers, servers, etc.
[0152] This application also provides a non-volatile computer-readable storage medium (hereinafter referred to as the storage medium) storing a computer program. When the computer program is run by a computer, such as the electronic device 200 described above, it executes the data processing method described above. The computer-readable storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0153] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A data processing method, characterized in that, include: In response to the user's first operation command based on the function list, obtain the command script corresponding to the target function selected by the first operation command; In response to the user's second operation command based on the object list, retrieve the target code corresponding to the target object selected by the second operation command; Run the command script to process the target code according to the target function and obtain the processing result; Wherein, if the target function is a first type of function, the object list includes a project list, the project list contains one or more projects, each project corresponds to a project code, and each project includes at least one module; all modules under the same project share the same project code, and each module corresponds to a set of parameters; if the target object is a target project, obtaining the target code corresponding to the target object selected by the second operation command includes: Obtain the project code of the target project, wherein the project code of the target project is the target code; If the target function is a second type of function, the object list includes a project list and a module list. Each project in the project list corresponds to a module list, and each project corresponds to a project code. Each module in the same module list shares the project code corresponding to the project in that module list. Each module corresponds to a set of parameters. If the target object includes a target project and a target module, obtaining the target code corresponding to the target object selected by the second operation command includes: Obtain the project code corresponding to the target project, and obtain the target parameters corresponding to the target module; Based on the target parameters and the project code corresponding to the target project, the target code corresponding to the target object is obtained; The first category of functions includes any one of the functions of downloading, updating, submitting, and querying; the second category of functions includes any one of the functions of compiling, debugging, and publishing. The step of obtaining the command script corresponding to the target function selected by the first operation command includes: obtaining the command script that comes with the operating system and corresponds to the target function selected by the first operation command, or obtaining the script that comes with the project corresponding to the target object and corresponds to the target function selected by the first operation command. If the target function is any one of compilation, debugging, or release, running the command script includes: calling a preset general script and passing the required parameters, including the command itself, platform name, project name, and module list, to the general script to process the target code corresponding to the target function.
2. The method according to claim 1, characterized in that, The response to the user's first operation command based on the function list includes: Respond to the user's first action command based on the list of functions displayed in the visual interface.
3. The method according to claim 2, characterized in that, The object list includes a project list, a module list, and a platform list, and the method further includes: In response to the user's selection of a target function and target platform, a list of projects corresponding to the target platform is displayed on the visual interface; In response to the user's selection of a target project, determine whether the target function is executed on a project; if not, display a list of modules corresponding to the target project in the visualization interface.
4. The method according to claim 3, characterized in that, The visual interface also includes a confirmation option, and the response to the user's first operation command based on the function list is to obtain the command script corresponding to the target function selected by the first operation command; In response to the user's second operation command based on the object list, retrieve the target code corresponding to the target object selected by the second operation command, including: In response to the user's first operation instruction to select the target function, the second operation instruction to select the target object, and the selection of the confirmation option, the user-selected target object and target function are saved, and the target code corresponding to the target object and the command script corresponding to the target function are obtained.
5. A project operating system, characterized in that, include: The acquisition module is used to respond to the user's first operation command based on the function list and acquire the command script corresponding to the target function selected by the first operation command. The acquisition module is also used to respond to a second operation command from the user based on the object list and acquire the target code corresponding to the target object selected by the second operation command; The processing module is used to run the command script to process the target code according to the target function and obtain the processing result; If the target function is a first type of function, the object list includes a project list, the project list contains one or more projects, each project corresponds to a project code, and each project includes at least one module; all modules under the same project share the same project code, and each module corresponds to a set of parameters; if the target object is a target project, the acquisition module is specifically used to acquire the project code of the target project, and the project code of the target project is the target code. If the target function is a second type of function, the object list includes a project list and a module list. Each project in the project list corresponds to a module list, and each project corresponds to a project code. Each module in the same module list shares the project code corresponding to the project in that module list. Each module corresponds to a set of parameters. If the target object includes a target project and a target module, the acquisition module is specifically used to acquire the project code corresponding to the target project and to acquire the target parameters corresponding to the target module. Based on the target parameters and the project code corresponding to the target project, the target code corresponding to the target object is obtained; The first category of functions includes any one of the functions of downloading, updating, submitting, and querying; the second category of functions includes any one of the functions of compiling, debugging, and publishing. The acquisition module is specifically used to acquire the command script that is built into the operating system and corresponds to the target function selected by the first operation command, or to acquire the script that is built into the project corresponding to the target object and corresponds to the target function selected by the first operation command. If the target function is any one of compilation, debugging, or release, the processing module is specifically used to call a preset general script and pass the required parameters, including the command itself, platform name, project name, and module list, to the general script to perform the processing corresponding to the target function on the target code.
6. An electronic device, characterized in that, include: A memory and a processor, wherein the memory and the processor are connected; The memory is used to store programs; The processor is configured to invoke a program stored in the memory to perform the method as described in any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, It stores a computer program, which, when executed by a computer, performs the method as described in any one of claims 1-4.
Citation Information
Patent Citations
Background order processing apparatus and method
CN101198137A
Visual programming method for automatically generating and uniformly maintaining java items
CN102779037A
Data processing method and device
CN108647316A
Function test method and device thereof, electronic equipment and storage medium
CN114064510A