Control methods, control devices and electronic devices for embedded devices
By generating an instruction tree linked list, the control permissions of embedded devices can be set according to user level, which solves the problem that existing technologies cannot set permissions for different users, and realizes flexible device management and security control.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WEICHAI POWER CO LTD
- Filing Date
- 2023-03-03
- Publication Date
- 2026-05-26
AI Technical Summary
In existing technologies, the human-machine interface of embedded devices cannot set different access and control permissions for different users, which leads to management inconvenience.
By generating an instruction tree linked list, the control permissions of different users are determined based on the user level of keyword instructions, parameter instructions, and execution instructions, thereby realizing the target control set corresponding to different user levels.
It enables differentiated management of embedded device control permissions for different user levels, improving the flexibility and security of device management.
Smart Images

Figure CN116360854B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of embedded device control, and more specifically, to a control method, control device, and electronic device for an embedded device. Background Technology
[0002] After embedded device software is released, without effective status monitoring and problem localization methods, it is difficult to quickly repair and resolve faults. Therefore, a device debugging interface that allows for rapid access is needed, i.e., a human-machine interface (HMI). Existing HMIs for embedded software can be implemented based on serial ports, but specific commands correspond to specific function execution, making it difficult to implement complex interaction and control strategies. Command Line Interface (CLI) is one type of HMI for embedded devices, allowing clients to input control commands and view response information. However, currently, in the process of accessing embedded devices via CLI control commands, all users have the same access scope, making it impossible to set different access and control permissions for different users, which is detrimental to personnel and embedded device system management.
[0003] Therefore, there is an urgent need for a method that can simultaneously set different embedded device control permissions for different user types. Summary of the Invention
[0004] The main objective of this application is to provide a control method, control device, and electronic device for embedded devices, so as to at least solve the problem that the control permissions of embedded devices cannot be set in the prior art.
[0005] To achieve the above objectives, according to one aspect of this application, a control method for an embedded device is provided, comprising: obtaining control instructions from a user via a command-line interface to obtain a plurality of control instructions, wherein the control instructions consist of at least keyword instructions, parameter instructions, and execution instructions; obtaining the lowest user level corresponding to the keyword instructions in the control instructions; generating a node for the keyword instructions based at least on the keyword instructions and the lowest user level to obtain a keyword node; generating a node for the parameter instructions based at least on the parameter instructions in the control instructions to obtain a parameter node; generating a node for the execution instructions based at least on the execution instructions in the control instructions to obtain an execution node; sequentially connecting the keyword nodes, parameter nodes, and execution nodes corresponding to the control instructions to generate an instruction linked list corresponding to the control instructions; connecting the plurality of instruction linked lists corresponding to the plurality of control instructions to generate an instruction tree linked list, wherein the lowest user level represents the lowest user level required to execute the keyword instructions; determining all control instructions in the instruction tree linked list whose lowest user level is lower than the user level corresponding to the current user to obtain a target control instruction set; and executing the target control instruction set in the instruction tree linked list to control the embedded device.
[0006] Optionally, generating a keyword node based on at least the keyword instruction and the minimum user level includes: generating a keyword instruction node based on the type of the keyword instruction, the keyword instruction, and the minimum user level, thereby obtaining a keyword node, wherein the type of the keyword instruction is a non-terminal keyword type or a terminal keyword type, the terminal keyword type indicating that the keyword node is located at the end of the instruction chain excluding the execution node, and the non-terminal keyword type indicating that the keyword node is located at a non-terminal location of the instruction chain excluding the execution node.
[0007] Optionally, generating a parameter instruction node based at least on the parameter instruction in the control instruction, and obtaining a parameter node, includes: generating a parameter instruction node based on the parameter instruction, the type of the parameter instruction, and whether a default option is allowed, and obtaining a parameter node, wherein the parameter instruction includes at least one of enumeration, string, and integer, the enumeration is used to represent on or off, true or false, start or stop, the type of the parameter instruction includes non-terminal parameter type and terminal parameter type, the whether a default option is allowed includes default option and non-default option, the terminal parameter type indicates that the parameter node is located at the end of the instruction chain except for the execution node, the non-terminal parameter type indicates that the parameter node is located at a non-terminal of the instruction chain except for the execution node, the non-default option indicates that the parameter instruction needs to be input, and the default option indicates that the parameter instruction does not need to be input.
[0008] Optionally, generating an execution instruction node based at least on the execution instruction in the control instructions to obtain an execution node includes: generating an execution instruction node based on the type of the execution instruction, the function call entry point, the execution instruction, and the target subsystem, wherein the type of the execution instruction is an execution type, the function call entry point is used to call a function in the command-line interface, and the execution instruction is sent to the target subsystem, the target subsystem being a system other than the command-line interface used to execute the execution instruction.
[0009] Optionally, generating the instruction tree linked list further includes: generating the instruction tree linked list to the command parsing layer of the command-line interface, wherein the command parsing layer is used to parse the control instructions according to the instruction tree linked list.
[0010] Optionally, after generating the instruction tree linked list, the method further includes: obtaining multiple user levels corresponding to the current user from multiple host computer control terminals, and storing the multiple user levels corresponding to the multiple host computer control terminals in the link management layer of the command line interface, wherein the host computer control terminals and the embedded device are connected through the command line interface, and the link management layer is used to manage and maintain the connection links between the multiple host computer control terminals and the command line interface.
[0011] Optionally, after generating the instruction tree linked list, the method further includes: storing the username and password in the user management layer of the command-line interface, wherein the username and password correspond one-to-one, and the user management layer is used to determine whether the username and password of the current user are correct.
[0012] Optionally, after generating the instruction tree linked list, the method further includes: storing the function library and the execution instructions in the command execution layer of the command-line interface, wherein the command execution layer is used to execute the control instructions input by the current user, and the function library is used to store the functions required to execute the control instructions.
[0013] According to another aspect of this application, a control device for an embedded device is provided, comprising: an acquisition unit, configured to acquire user control commands via a command-line interface, and obtain a plurality of the control commands, wherein the control commands consist of at least keyword commands, parameter commands, and execution commands; and a first generation unit, configured to acquire the lowest user level corresponding to the keyword commands in the control commands, generate a node for the keyword commands based at least on the keyword commands and the lowest user level, thereby obtaining a keyword node, generate a node for the parameter commands based at least on the parameter commands in the control commands, thereby obtaining a parameter node, and generate a node for the execution commands based at least on the execution commands in the control commands, thereby obtaining a first generation unit. The system proceeds to the execution node; a second generation unit is configured to sequentially connect the keyword node, parameter node, and execution node corresponding to the control instruction to generate an instruction chain list corresponding to the control instruction, and connect multiple instruction chain lists corresponding to multiple control instructions to generate an instruction tree chain list, wherein the lowest user level represents the lowest user level required to execute the keyword instruction; an execution unit is configured to determine all control instructions in the instruction tree chain list whose lowest user level is lower than the user level corresponding to the current user, obtain a target control instruction set, and execute the target control instruction set in the instruction tree chain list to control the embedded device.
[0014] According to another aspect of this application, an electronic device includes: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include a control method for performing any of the embedded devices described above.
[0015] By applying the technical solution of this application, at least a keyword node is generated based on the keyword instruction and the lowest user level. Then, a parameter node and an execution node are generated. The keyword node, parameter node, and execution node are sequentially connected to generate an instruction chain list corresponding to the control instruction. Then, multiple instruction chains are connected to generate an instruction tree chain list. The control instructions whose user level is higher than the lowest user level corresponding to the keyword instruction are determined, and a target control set is defined. The target control set consists of multiple instructions that the current user can execute to control the embedded device. Compared with the existing technology where users can execute all instructions in the command line interface to control the embedded device, this application can set the lowest user level in the keyword node of the instruction chain list through the command line interface, so that different user levels correspond to different target control sets. That is, users of different user levels have different control permissions for instructions in the command line interface, thereby achieving different control permissions for embedded devices for users of different user levels. This solves the problem that the control permissions of embedded devices cannot be set in the prior art. Attached Figure Description
[0016] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0017] Figure 1 A hardware structure block diagram of a mobile terminal implementing a control method for an embedded device, according to an embodiment of this application, is shown.
[0018] Figure 2 A flowchart illustrating a control method for an embedded device according to an embodiment of this application is shown.
[0019] Figure 3 This illustration shows a human-computer interaction diagram of an embedded device in a control method for an embedded device according to an embodiment of this application.
[0020] Figure 4 This illustration shows a schematic diagram of the command-line interface architecture in a specific embedded device control method according to an embodiment of this application;
[0021] Figure 5 A flowchart illustrating a specific embedded device control method according to an embodiment of this application is shown.
[0022] Figure 6 A structural block diagram of a control device for an embedded device according to an embodiment of this application is shown.
[0023] The above figures include the following reference numerals:
[0024] 102. Processor; 104. Memory; 106. Transmission device; 108. Input / output device. Detailed Implementation
[0025] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application 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 where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0028] As described in the background section, in the prior art, during the access to embedded devices by control commands based on command-line control interfaces, all users have the same access range. In order to solve the problem that it is impossible to limit the control range of different embedded devices for different users, the embodiments of this application provide a control method, control device and electronic device for embedded devices.
[0029] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0030] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for an embedded device control method according to an embodiment of this application. (See diagram below.) Figure 1 As shown, a mobile terminal may include one or more ( Figure 1Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of a mobile terminal. For example, a mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0031] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the device information display method in this embodiment of the invention. The processor 102 executes various functional applications and data processing, i.e., the implemented method, by running the computer program stored in the memory 104. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The transmission device 106 is used to receive or send data via a network. Specific examples of the network may include a wireless network provided by the mobile terminal's communication provider. In one instance, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0032] This embodiment provides a control method for an embedded device that runs on a mobile terminal, computer terminal, or similar computing device. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0033] Figure 2 This is a flowchart illustrating a control method for an embedded device according to an embodiment of this application. Figure 2 As shown, the method includes the following steps:
[0034] Step S201: The command line interface obtains the user's control commands and obtains multiple control commands, wherein the control commands consist of at least keyword commands, parameter commands, and execution commands;
[0035] Specifically, the command-line interface is used for human-machine interaction in embedded software, providing a human-machine interface for operating embedded devices. Through various predefined control commands, developers, testers, and after-sales personnel can perform operations such as debugging, testing, status monitoring, and troubleshooting on the embedded devices. That is, they can input control commands through the command-line interface to control the embedded device and view response information. The command-line interface runs on top of the operating system as part of the embedded software and implements the functionality of a Telnet server (a standard protocol for network remote login services). The host computer terminal software acts as a client, establishing a connection with the embedded device and controlling it through command-line control commands. The command-line interface establishes the connection between the embedded device and the client based on a network interface. Network connections are implemented using physical interfaces such as Wi-Fi, Ethernet, and mobile communication networks. However, this application does not specifically limit the method of network connection or the form of the physical interface. The control commands of the command-line interface include at least keyword commands, parameter commands, and execution commands, arranged in the order of keyword commands, parameter commands, and execution commands. However, in practical applications, control commands can consist only of keyword commands, and parameter commands can be omitted. That is, this application does not specifically limit the specific composition of the control commands.
[0036] Step S202: Obtain the lowest user level corresponding to the keyword instruction in the control instructions; generate a node for the keyword instruction based on the keyword instruction and the lowest user level to obtain the keyword node; generate a node for the parameter instruction based on the parameter instruction in the control instructions to obtain the parameter node; and generate a node for the execution instruction based on the execution instruction in the control instructions to obtain the execution node.
[0037] Specifically, since the first instruction in the control commands is a keyword instruction, and different keyword instructions are executed by users at different user levels, a keyword node must be generated at least based on the keyword instruction and the lowest user level. This allows the command-line interface to determine whether the control command can continue to be executed based on the user level, and then generate the corresponding parameter node and execution node. For example, the keyword instruction "set" can only be executed by administrators or users at the administrator level or above (e.g., developers), so the lowest user level for the keyword instruction "set" is administrator.
[0038] Step S203: Connect the keyword node, parameter node and execution node corresponding to the control instruction in sequence to generate the instruction chain list corresponding to the control instruction. Connect the multiple instruction chain lists corresponding to multiple control instructions to generate the instruction tree chain list. The lowest user level represents the lowest user level required to execute the keyword instruction.
[0039] Specifically, by sequentially connecting the keyword node, parameter node, and execution node in the control instruction, the corresponding instruction list is obtained to ensure the integrity of the control instruction. Then, multiple instruction lists are connected, that is, the keyword nodes of multiple instruction lists are connected and summarized into a root node to generate an instruction tree list. The control instructions in the command line interface are presented in the form of an instruction tree list. Furthermore, the information of each node in the instruction tree list can be set. The method of setting the information of each node will be explained in detail below.
[0040] Step S204: Determine all control instructions in the instruction tree chain whose lowest user level is lower than the user level of the current user, obtain the target control instruction set, and execute the target control instruction set in the instruction tree chain to control the embedded device.
[0041] Specifically, since the keyword instruction can only be executed when the user level is higher than the lowest user level in the keyword node, all control instructions whose lowest user level is lower than the user level corresponding to the keyword instruction are the set of instructions that the current user can execute, i.e., the target control instruction set. This allows different user levels to control the embedded device according to the corresponding target control instruction set.
[0042] In this embodiment, keyword nodes can be generated based on at least the keyword instruction and the lowest user level. Then, parameter nodes and execution nodes are generated. The keyword nodes, parameter nodes, and execution nodes are sequentially connected to generate an instruction chain list corresponding to the control instruction. Then, multiple instruction chain lists are connected to generate an instruction tree chain list. It is determined that the current user's user level is higher than the lowest user level corresponding to the keyword instruction, and a target control set is defined. The target control set consists of multiple instructions that the current user can execute to control the embedded device. Compared with the existing technology where users can execute all instructions in the command line interface to control the embedded device, this application can set the lowest user level in the keyword node of the instruction chain list through the command line interface, so that different user levels correspond to different target control sets. That is, users of different user levels have different control permissions for instructions in the command line interface, thereby achieving different control permissions for embedded devices for users of different user levels. This solves the problem that the control permissions of embedded devices cannot be set in the prior art.
[0043] In the specific implementation process, step S202 can be achieved through the following steps: generating a keyword instruction node based at least on the keyword instruction and the minimum user level, thereby obtaining the keyword node. This includes: generating a keyword instruction node based on the type of the keyword instruction, the keyword instruction itself, and the minimum user level, thereby obtaining the keyword node. The keyword instruction type can be either a non-terminal keyword type or a terminal keyword type. A terminal keyword type indicates that the keyword node is located at the end of the instruction chain (excluding the execution node), while a non-terminal keyword type indicates that the keyword node is located at a non-terminal location in the instruction chain (excluding the execution node). This method uses the type of the keyword instruction to indicate whether the keyword instruction is located at the end of the corresponding control instruction. By comparing the minimum user level with the current user's user level, it determines whether the current user can execute the keyword instruction and the corresponding control instruction. This allows for permission settings for users at different user levels. The higher the user level, the more keyword instructions can be executed, i.e., the more control instructions can be executed, thus granting greater control over the embedded device.
[0044] Specifically, the keyword instruction "start" corresponds to a "non-terminal keyword type," meaning the keyword node is not located at the end of the control instruction. The lowest user level for the keyword instruction "start" is a regular user; users with a regular user level or higher can execute the control instruction containing the "start" keyword node. Similarly, the keyword instruction "debug" corresponds to a "terminal keyword type," meaning the keyword node is located at the end of the control instruction. The lowest user level for the keyword instruction "debug" is a developer; users with a developer level or higher can execute the control instruction containing the "debug" keyword node. It should be noted that a single control instruction can contain multiple keyword instructions; for example, the control instruction "set monitor lever alert" consists of four keyword instructions.
[0045] In the specific implementation process, step S202 can also be achieved through the following steps: generating parameter instruction nodes based on the parameter instructions in the control instructions, and obtaining parameter nodes, including: generating parameter instruction nodes based on the parameter instructions, the type of the parameter instructions, and whether a default option is allowed, and obtaining parameter nodes. The parameter instructions include at least one of enumeration, string, and integer. Enumeration is used to represent on or off, true or false, start or stop. The type of parameter instructions includes non-terminal parameter type and terminal parameter type. Whether a default option is allowed includes default option and non-default option. Terminal parameter type indicates that the parameter node is located at the end of the instruction chain (excluding the execution node), non-terminal parameter type indicates that the parameter node is located at a non-terminal part of the instruction chain (excluding the execution node), non-default option indicates that a parameter instruction needs to be input, and default option indicates that no parameter instruction needs to be input. This method, by setting the type of parameter instructions in the parameter nodes to indicate whether the parameter instructions are located at the end of the corresponding control instructions, by setting the content of the parameter instructions to represent the state, and by setting whether a default option is allowed to indicate whether the content of the parameter instructions can be omitted, allows for flexible setting of parameter nodes, thus making the expression of control instructions more flexible.
[0046] Specifically, if the parameter instruction is "on", the parameter instruction type is "enumeration type", which means the state is "on", and whether the option can be omitted is not omitted; for example, if the parameter instruction is "abc", the parameter instruction type is "string", and whether the option can be omitted is omitted, that is, the control instruction can not contain the parameter instruction "abc".
[0047] In specific implementation, step S202 can also be achieved through the following steps: At least based on the execution instructions in the control instructions, an execution instruction node is generated, resulting in an execution node. This includes: generating the execution instruction node based on the type of the execution instruction, the function call entry point, the execution instruction, and the target subsystem. The type of the execution instruction is the execution type; the function call entry point is used to call functions in the command-line interface; and the execution instruction is sent to the target subsystem, which is a system other than the command-line interface used to execute the execution instructions. This method allows the execution of control instructions by calling the function library of the command-line interface through setting the function call entry point of the execution node. By setting the execution instruction and the target subsystem, the execution instruction is sent to the target subsystem for execution. This allows the execution of control instructions through either of the two execution methods of the execution node, increasing the diversity of control instruction execution methods and avoiding situations where control instructions cannot be executed under only one execution method.
[0048] Specifically, the execution node is located at the end of the instruction chain. There is only one type of execution instruction, namely, the execution type is "Action". The function call entry point executes the instruction by calling the function corresponding to the keyword instruction. For example, if the keyword instruction is "level", the corresponding function is "setlevel()". That is, the "setlevel()" function in the function library of the command line interface is called through the function call entry point to execute the control instruction. Alternatively, the control instruction can be executed in another way, by sending the execution instruction, i.e., the instruction of the task to be implemented, to the target subsystem in the execution node for execution. For example, if the execution instruction is "cmdId4", it is sent to the target subsystem "taskId4" for execution.
[0049] To manage the multi-layered architecture of the command-line interface in an orderly manner and ensure the smooth execution of control commands, step S203 of this application can be achieved through the following steps: generating an instruction tree linked list, further including: generating the instruction tree linked list to the command parsing layer of the command-line interface, wherein the command parsing layer is used to parse control commands based on the instruction tree linked list. This method generates the instruction tree linked list to the command parsing layer, allowing user-inputted control commands to be parsed at the command parsing layer, that is, generating executable commands corresponding to the control commands based on the node information set for each node in the instruction tree linked list.
[0050] Specifically, the command parsing layer maintains and manages the entire instruction set in the form of an instruction tree, adding instruction lists corresponding to new control instructions in real time and deleting instruction lists corresponding to invalid control instructions in a timely manner. The instructions input by the host computer client are parsed according to the rules of the instruction tree, and after successful parsing, they are handed over to the command execution layer below for execution.
[0051] Step S203 of this application can also be implemented through the following steps: obtaining multiple user levels corresponding to the current user from multiple host computer control terminals, and storing the multiple user levels corresponding to the multiple host computer control terminals in the link management layer of the command-line interface. The host computer control terminals and the embedded device are connected through the command-line interface, and the link management layer is used to manage and maintain the connection links between the multiple host computer control terminals and the command-line interface. This method stores multiple user levels in the link management layer of the command-line interface, which allows for the determination of user levels in different links and improves the efficiency of embedded device interaction.
[0052] Specifically, the link management layer is responsible for maintaining multiple logical links. The command-line interface utilizes the characteristics of network interfaces, enabling a single physical link to support multiple logical links, thus allowing multiple host computer control terminals to control the embedded device. When multiple links simultaneously receive user commands, the link management layer first ensures successful connection of each link. Then, it sends the user level of different links to the command parsing layer for parsing. Specifically, it first determines whether the user level is higher than the lowest user level in the keyword node. Then, it executes the function in the control command to implement the corresponding functionality and outputs response information. This response information is transmitted to the corresponding host computer control terminal via the corresponding link in the link management layer. The link management layer ensures the smooth execution of this process until the host computer control terminal sends a termination command.
[0053] Step S203 of this application can also be implemented through the following steps: after generating the instruction tree linked list, it further includes: storing the username and password in the user management layer of the command-line interface, wherein the username and password are in one-to-one correspondence, and the user management layer is used to determine whether the current user's username and password are correct. This method stores the username and password in the user management layer for management, thus enabling the determination of whether the user's username and password are correct, thereby improving the security of the command-line interface and embedded devices.
[0054] Specifically, after the host computer control terminal connects to the embedded device, the user name and password must be entered first for authentication. Only after successful authentication can the command be entered. Then, the command is transmitted through the link management layer and parsed through the command parsing layer to obtain the execution result, i.e., the response information.
[0055] Step S203 of this application can also be implemented through the following steps: after generating the instruction tree linked list, it further includes: storing the function library and execution instructions in the command execution layer of the command-line interface, wherein the command execution layer is used to execute the control instructions currently input by the user, and the function library is used to store the functions required to execute the corresponding control instructions. This method can store the function library in the command execution layer, which ensures that the execution node can successfully call the function corresponding to the control instruction to achieve the corresponding function.
[0056] Specifically, as mentioned above, after the command parsing layer completes the parsing of the control instructions, it can execute the control instructions in two ways: one is to call the function in the function library of the command execution layer through the function call entry point to execute the control instructions, and the other is to send the execution instructions to the target subsystem for execution. These two different execution methods improve the efficiency of instruction execution.
[0057] To enable those skilled in the art to better understand the technical solution of this application, the implementation process of the embedded device control method of this application will be described in detail below with reference to specific embodiments.
[0058] Figure 3 The illustration shows a human-machine interaction diagram of an embedded device in a control method for an embedded device according to an embodiment of this application, such as... Figure 3 As shown, the embedded device includes a CLI (command line interface) control module, an operating system, and a business processing module. The embedded device implements Telnet (remote connection) service with multiple host computer control terminals 1, 2, ... through CLI.
[0059] This embodiment relates to a specific control method for an embedded device, such as... Figure 4 and Figure 5 As shown, it includes the following steps:
[0060] Step S1: The telnet server protocol is implemented through the protocol processing layer of the command-line interface, which connects the embedded device to multiple host computer control terminals;
[0061] Step S2: The link management layer of the command-line interface manages multiple users (links) of multiple host computer control terminals to enable smooth interaction between users of multiple links and embedded devices;
[0062] Step S3: The user management layer identifies the usernames and passwords entered by multiple users on the host computer control terminal, determines whether the usernames and passwords are correct and match, and automatically manages permissions according to the user's user level.
[0063] Step S4: The command parsing layer parses the user-input commands and is responsible for managing the command tree (command tree linked list), such as... Figure 5As shown, the command keyword node includes three items: node type (keyword instruction type), keyword (keyword instruction type), and user level (permissions). The parameter node includes three items: node type (parameter instruction type), parameter type (parameter instruction content), and whether a default option is allowed. The command execution node includes four items: node type (execution instruction type), function call entry point, command number (execution instruction), and destination subsystem. The instruction chain of the control instruction "start monitor" is as follows: Keyword node: keyword instruction type is TOKEN (non-terminal keyword node), keyword instruction is start, minimum user level is user; Keyword node: keyword instruction type is TOKEN_LEAF (terminal keyword node), keyword instruction is monitor, minimum user level is user; Execution node: execution instruction type is ACTION (execution instruction), function call entry point is startMo(), execution instruction is cmdId1, destination subsystem is taskd1. The instruction list for the control instruction "show monitor" consists of the following nodes: Keyword node: Keyword instruction type is TOKEN (non-terminal keyword node), Keyword instruction is show, and minimum user level is user; Keyword node: Keyword instruction type is TOKEN_LEAF (terminal keyword node), Keyword instruction is monitor, and minimum user level is user; Execution node: Execution instruction type is ACTION (execution instruction), function call entry is showMo(), execution instruction is cmdId2, and destination subsystem is taskd2.The instruction chain for the control command "set monitor switch on xxx xxx" consists of the following nodes: Keyword node: Keyword command type is TOKEN (non-terminal keyword node), Keyword command is set, minimum user level is admin; Keyword node: Keyword command type is TOKEN (non-terminal keyword node), Keyword command is monitor, minimum user level is admin; Keyword node: Keyword command type is TOKEN (non-terminal keyword node), Keyword command is monitor, minimum user level is admin; Keyword command type is TOKEN (non-terminal keyword node), Keyword command is switch, minimum user level is admin; Parameter node: Parameter command type is VALUE (non-terminal parameter type), Parameter command is ENUM (enumeration type), whether a default option is set to NO. DEFAULT (cannot be omitted); Parameter node: parameter instruction type is VALUE (non-terminal parameter type), parameter instruction is STRING (string type), whether it can be omitted is DEFAULT (can be omitted); Parameter node: parameter instruction type is VALUE_LEAF (terminal parameter type), parameter instruction is STRING (string type), whether it can be omitted is DEFAULT (can be omitted); Execution node: execution instruction type is ACTION (execution instruction), function call entry is SetSwitch(), execution instruction is cmdId3, destination subsystem is taskd3.
[0064] The instruction chain for the control command "start monitor level alert" is as follows: Keyword node: Keyword command type is TOKEN (non-terminal keyword node), keyword command is set, minimum user level is admin; Keyword node: Keyword command type is TOKEN (non-terminal keyword node), keyword command is monitor, minimum user level is admin; Keyword node: Keyword command type is TOKEN (non-terminal keyword node), keyword command is level, minimum user level is admin; Keyword node: Keyword command type is TOKEN_LEAF (terminal keyword node), keyword command is alert, minimum user level is admin; Execution node: Execution command type is ACTION (execution command), function call entry is setLevel(), execution command is cmdId4, destination subsystem is taskd4.
[0065] The instruction chain for the control command "start monitor level error" is as follows: Keyword node: Keyword command type is TOKEN (non-terminal keyword node), keyword command is set, minimum user level is admin; Keyword node: Keyword command type is TOKEN (non-terminal keyword node), keyword command is monitor, minimum user level is admin; Keyword node: Keyword command type is TOKEN (non-terminal keyword node), keyword command is level, minimum user level is admin; Keyword node: Keyword command type is TOKEN_LEAF (terminal keyword node), keyword command is error, minimum user level is admin; Execution node: Execution command type is ACTION (execution command), function call entry is setLevel(), execution command is cmdId5, destination subsystem is taskd5.
[0066] The instruction chain for the control command "start monitor level debug" is as follows: Keyword node: Keyword command type is TOKEN (non-terminal keyword node), keyword command is set, minimum user level is admin; Keyword node: Keyword command type is TOKEN (non-terminal keyword node), keyword command is monitor, minimum user level is admin; Keyword node: Keyword command type is TOKEN (non-terminal keyword node), keyword command is level, minimum user level is admin; Keyword node: Keyword command type is TOKEN_LEAF (terminal keyword node), keyword command is debug, minimum user level is develop; Execution node: Execution command type is ACTION (execution command), function call entry is setLevel(), execution command is cmdId6, target subsystem is taskd6.
[0067] Step S5: The command execution layer in the command line interface executes the instructions parsed by the command parsing layer, performing command execution and response processing.
[0068] This application also provides a control device for an embedded device. It should be noted that the control device for the embedded device in this application can be used to execute the control method for an embedded device provided in this application. This device is used to implement the embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0069] The control device for the embedded device provided in the embodiments of this application will be described below.
[0070] Figure 6 This is a structural block diagram of a control device for an embedded device according to an embodiment of this application. Figure 6 As shown, the device includes:
[0071] The acquisition unit 10 is used to acquire the user's control commands through the command line interface, and obtain multiple control commands, wherein the control commands consist of at least keyword commands, parameter commands, and execution commands;
[0072] The first generation unit 20 is used to obtain the lowest user level corresponding to the keyword instruction in the control instruction, generate the keyword instruction node based on the keyword instruction and the lowest user level to obtain the keyword node, generate the parameter instruction node based on the parameter instruction in the control instruction to obtain the parameter node, and generate the execution instruction node based on the execution instruction in the control instruction to obtain the execution node.
[0073] The second generation unit 30 is used to connect the keyword node, parameter node and execution node corresponding to the control instruction in sequence to generate the instruction chain list corresponding to the control instruction, and connect the multiple instruction chain lists corresponding to multiple control instructions to generate the instruction tree chain list. The lowest user level represents the lowest user level required to execute the keyword instruction.
[0074] The execution unit 40 is used to determine all control instructions in the instruction tree chain whose lowest user level is lower than the user level of the current user, obtain the target control instruction set, and execute the target control instruction set in the instruction tree chain to control the embedded device.
[0075] As an optional solution, the first generation unit includes: a first generation module, used to generate keyword instruction nodes based on the keyword instruction type, the keyword instruction itself, and the minimum user level, thus obtaining keyword nodes. The keyword instruction type is either a non-terminal keyword type or a terminal keyword type. A terminal keyword type indicates that the keyword node is located at the end of the instruction chain (excluding the execution node), while a non-terminal keyword type indicates that the keyword node is located at a non-terminal location in the instruction chain (excluding the execution node). This device uses the keyword instruction type to indicate whether the keyword instruction is located at the end of the corresponding control instruction. It compares the minimum user level with the current user's user level to determine whether the current user can execute the keyword instruction and the corresponding control instruction. This allows for permission settings for users at different user levels; the higher the user level, the more keyword instructions they can execute, i.e., the more control instructions they can execute, and thus, the greater their control over the embedded device.
[0076] Specifically, the keyword instruction "start" corresponds to a "non-terminal keyword type," meaning the keyword node is not located at the end of the control instruction. The lowest user level for the keyword instruction "start" is a regular user; users with a regular user level or higher can execute the control instruction containing the "start" keyword node. Similarly, the keyword instruction "debug" corresponds to a "terminal keyword type," meaning the keyword node is located at the end of the control instruction. The lowest user level for the keyword instruction "debug" is a developer; users with a developer level or higher can execute the control instruction containing the "debug" keyword node. It should be noted that a single control instruction can contain multiple keyword instructions; for example, the control instruction "set monitor lever alert" consists of four keyword instructions.
[0077] In some optional implementations, the first generation unit further includes: a second generation module, configured to generate parameter instruction nodes based on parameter instructions, the type of parameter instructions, and whether a default option is allowed, thereby obtaining parameter nodes. The parameter instructions include at least one of enumeration, string, and integer. Enumeration is used to represent on or off, true or false, start or stop. The type of parameter instruction includes non-terminal parameter type and terminal parameter type. Whether a default option is allowed includes default option and non-default option. Terminal parameter type indicates that the parameter node is located at the end of the instruction chain (excluding the execution node), non-terminal parameter type indicates that the parameter node is located at a non-terminal part of the instruction chain (excluding the execution node), non-default option indicates that a parameter instruction needs to be input, and default option indicates that no parameter instruction needs to be input. This device indicates whether a parameter instruction is located at the end of the corresponding control instruction by setting the type of parameter instructions in the parameter nodes, indicates the state by setting the content of the parameter instructions, and indicates whether the content of the parameter instructions can be omitted by setting whether a default option is allowed. This allows for flexible setting of parameter nodes, making the expression of control instructions more flexible.
[0078] Specifically, if the parameter instruction is "on", the parameter instruction type is "enumeration type", which means the state is "on", and whether the option can be omitted is not omitted; for example, if the parameter instruction is "abc", the parameter instruction type is "string", and whether the option can be omitted is omitted, that is, the control instruction can not contain the parameter instruction "abc".
[0079] In some optional implementations, the first generation unit further includes a third generation module, configured to generate an execution instruction node based on the type of the execution instruction, the function call entry point, the execution instruction, and the target subsystem, thereby obtaining an execution node. The execution instruction type is the execution type, the function call entry point is used to call functions in the command-line interface, and the execution instruction is sent to the target subsystem, which is a system other than the command-line interface used to execute the execution instruction. This device can call the function library of the command-line interface to execute control instructions by setting the function call entry point of the execution node. By setting the execution instruction and the target subsystem, the execution instruction is sent to the target subsystem for execution. This allows control instructions to be executed using either of the two execution methods of the execution node, increasing the diversity of control instruction execution methods and avoiding situations where control instructions cannot be executed under only one execution method.
[0080] Specifically, the execution node is located at the end of the instruction chain. There is only one type of execution instruction, namely, the execution type is "Action". The function call entry point executes the instruction by calling the function corresponding to the keyword instruction. For example, if the keyword instruction is "level", the corresponding function is "setlevel()". That is, the "setlevel()" function in the function library of the command line interface is called through the function call entry point to execute the control instruction. Alternatively, the control instruction can be executed in another way, by sending the execution instruction, i.e., the instruction of the task to be implemented, to the target subsystem in the execution node for execution. For example, if the execution instruction is "cmdId4", it is sent to the target subsystem "taskId4" for execution.
[0081] In some optional implementations, the second generation unit includes: a fourth generation module, used to generate an instruction tree linked list to the command parsing layer of the command-line interface, wherein the command parsing layer is used to parse control instructions based on the instruction tree linked list. This device generates the instruction tree linked list to the command parsing layer, allowing user-inputted control instructions to be parsed at the command parsing layer, i.e., generating executable instructions corresponding to the control instructions based on the node information set for each node in the instruction tree linked list.
[0082] Specifically, the command parsing layer maintains and manages the entire instruction set in the form of an instruction tree, adding instruction lists corresponding to new control instructions in real time and deleting instruction lists corresponding to invalid control instructions in a timely manner. The instructions input by the host computer client are parsed according to the rules of the instruction tree, and after successful parsing, they are handed over to the command execution layer below for execution.
[0083] In some optional embodiments, the apparatus further includes: a first storage unit, configured to obtain multiple user levels corresponding to the current user from multiple host computer control terminals, and store the multiple user levels corresponding to the multiple host computer control terminals in the link management layer of the command-line interface. The host computer control terminals and the embedded device are connected via the command-line interface, and the link management layer is used to manage and maintain the connection links between the multiple host computer control terminals and the command-line interface. By storing multiple user levels in the link management layer of the command-line interface, the apparatus can determine the user levels of different links, thereby improving the efficiency of embedded device interaction.
[0084] Specifically, the link management layer is responsible for maintaining multiple logical links. The command-line interface utilizes the characteristics of network interfaces, enabling a single physical link to support multiple logical links, thus allowing multiple host computer control terminals to control the embedded device. When multiple links simultaneously receive user commands, the link management layer first ensures successful connection of each link. Then, it sends the user level of different links to the command parsing layer for parsing. Specifically, it first determines whether the user level is higher than the lowest user level in the keyword node. Then, it executes the function in the control command to implement the corresponding functionality and outputs response information. This response information is transmitted to the corresponding host computer control terminal via the corresponding link in the link management layer. The link management layer ensures the smooth execution of this process until the host computer control terminal sends a termination command.
[0085] In some optional embodiments, the device further includes a second storage unit for storing the username and password in the user management layer of the command-line interface, wherein the username and password are in one-to-one correspondence, and the user management layer is used to determine whether the current user's username and password are correct. This device stores the username and password in the user management layer for management, thus enabling the determination of the user's username and password's correctness, thereby improving the security of the command-line interface and the embedded device.
[0086] Specifically, after the host computer control terminal connects to the embedded device, the user name and password must be entered first for authentication. Only after successful authentication can the command be entered. Then, the command is transmitted through the link management layer and parsed through the command parsing layer to obtain the execution result, i.e., the response information.
[0087] In some optional embodiments, the apparatus further includes a third storage unit for storing function libraries and execution instructions to the command execution layer of the command-line interface. The command execution layer executes the control instructions currently input by the user, and the function library stores the functions required to execute the corresponding control instructions. This apparatus can store the function library in the command execution layer, ensuring that the execution node can successfully call the functions corresponding to the control instructions to achieve the corresponding functionality.
[0088] Specifically, as mentioned above, after the command parsing layer completes the parsing of the control instructions, the control instructions can be executed through two methods: one is to call the function in the function library of the command execution layer through the function call entry point to execute the control instructions, and the other is to send the execution instructions to the target subsystem for execution. These two different execution methods improve the efficiency of instruction execution.
[0089] In this embodiment, the acquisition unit generates keyword nodes based at least on keyword instructions and the lowest user level. The first generation unit generates parameter nodes and execution nodes, and sequentially connects the keyword nodes, parameter nodes, and execution nodes to generate an instruction chain list corresponding to the control instructions. The second generation unit connects multiple instruction chain lists to generate an instruction tree chain list. The execution unit determines control instructions whose user level is higher than the lowest user level corresponding to the keyword instructions. The target control set is a set of multiple instructions that the current user can execute to control the embedded device. Compared with existing devices where users can execute all instructions in the command line interface to control the embedded device, this application can set the lowest user level in the keyword nodes of the instruction chain list through the command line interface, so that different user levels correspond to different target control sets. That is, users with different user levels have different control permissions for instructions in the command line interface, and thus different user levels have different control permissions for the embedded device. This solves the problem that the control permissions of embedded devices cannot be set in the prior art.
[0090] The control unit of an embedded device includes a processor and memory. Acquisition units, first generation units, second generation units, and execution units are all stored as program units in memory. The processor executes these program units to implement the corresponding functions. Modules may reside in the same processor; alternatively, modules may be located in different processors in any combination.
[0091] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and by adjusting kernel parameters, embedded devices can be controlled according to the user's privilege level.
[0092] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0093] This invention provides a computer-readable storage medium including a stored program, wherein, when the program is running, it controls the device where the computer-readable storage medium is located to execute a control method for an embedded device.
[0094] This invention provides a processor for running a program, wherein the program executes a control method for an embedded device during runtime.
[0095] This invention provides a device including a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs at least the following steps:
[0096] The command-line interface obtains the user's control commands, resulting in multiple control commands, which consist of at least keyword commands, parameter commands, and execution commands.
[0097] Obtain the lowest user level corresponding to the keyword instruction in the control instructions; generate the keyword instruction node based on at least the keyword instruction and the lowest user level to obtain the keyword node; generate the parameter instruction node based on at least the parameter instruction in the control instructions to obtain the parameter node; generate the execution instruction node based on at least the execution instruction in the control instructions to obtain the execution node.
[0098] The keyword node, parameter node and execution node corresponding to the control instruction are connected sequentially to generate the instruction chain list corresponding to the control instruction. Multiple instruction chain lists corresponding to multiple control instructions are connected to generate the instruction tree chain list. The lowest user level represents the lowest user level required to execute the keyword instruction.
[0099] Identify all control instructions in the instruction tree chain whose lowest user level is lower than the current user's user level corresponding to the keyword instruction, obtain the target control instruction set, and execute the target control instruction set in the instruction tree chain to control the embedded device.
[0100] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.
[0101] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having at least the following method steps: obtaining user control instructions through a command-line interface, obtaining multiple control instructions, wherein the control instructions consist of at least keyword instructions, parameter instructions, and execution instructions;
[0102] Obtain the lowest user level corresponding to the keyword instruction in the control instructions; generate the keyword instruction node based on at least the keyword instruction and the lowest user level to obtain the keyword node; generate the parameter instruction node based on at least the parameter instruction in the control instructions to obtain the parameter node; generate the execution instruction node based on at least the execution instruction in the control instructions to obtain the execution node.
[0103] The keyword node, parameter node and execution node corresponding to the control instruction are connected sequentially to generate the instruction chain list corresponding to the control instruction. Multiple instruction chain lists corresponding to multiple control instructions are connected to generate the instruction tree chain list. The lowest user level represents the lowest user level required to execute the keyword instruction.
[0104] Identify all control instructions in the instruction tree chain whose lowest user level is lower than the current user's user level corresponding to the keyword instruction, obtain the target control instruction set, and execute the target control instruction set in the instruction tree chain to control the embedded device.
[0105] It will be apparent to those skilled in the art that the modules or steps of this invention can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this invention is not limited to any particular combination of hardware and software.
[0106] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0107] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0108] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0109] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0110] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0111] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0112] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0113] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0114] As can be seen from the above description, the embodiments of this application achieve the following technical effects:
[0115] 1) In the embedded device control method of this application, at least keyword nodes are generated based on keyword instructions and the lowest user level, then parameter nodes and execution nodes are generated. Keyword nodes, parameter nodes, and execution nodes are sequentially connected to generate instruction chain lists corresponding to control instructions. Then, multiple instruction chain lists are connected to generate instruction tree chain lists. The control instructions whose user level is higher than the lowest user level corresponding to the keyword instructions are determined, and the target control set is defined. The target control set consists of multiple instructions that the current user can execute to control the embedded device. Compared with the prior art method where the user can execute all instructions in the command line interface to control the embedded device, this application can set the lowest user level in the keyword nodes of the instruction chain list through the command line interface, so that different user levels correspond to different target control sets. That is, users of different user levels have different control permissions for instructions in the command line interface, thereby achieving different control permissions for embedded devices for users of different user levels, thus solving the problem that the control permissions of embedded devices cannot be set in the prior art.
[0116] 2) In the embedded device control method of this application, keyword instruction nodes are generated based on the type of keyword instruction, the keyword instruction itself, and the minimum user level. This allows for permission settings for users at different user levels. The higher the user level, the more keyword instructions can be executed, i.e., the more control instructions can be executed, thus granting greater control authority over the embedded device. Parameter instruction nodes are generated based on parameter instructions, the type of parameter instructions, and whether default options are allowed. This allows for flexible setting of parameter nodes, making the expression of control instructions more flexible. Execution instruction nodes are generated based on the type of execution instruction, function call entry point, execution instruction, and target subsystem. This allows control instructions to be executed using either of the two execution methods of the execution node, increasing the diversity of control instruction execution methods and avoiding situations where control instructions cannot be executed under only one execution method. The instruction tree linked list also includes: generating the instruction tree linked list to the command parsing layer of the command-line interface, so that user-input control commands can be parsed at the command parsing layer, that is, generating executable commands corresponding to control commands based on the node information set by each node in the instruction tree linked list; obtaining multiple user levels corresponding to multiple current users from multiple host computer control terminals and storing multiple user levels corresponding to multiple host computer control terminals in the link management layer of the command-line interface, so as to determine the user level of different links and improve the efficiency of embedded device interaction; after generating the instruction tree linked list, it also includes: storing the username and password in the user management layer of the command-line interface, so as to determine whether the username and password are correct and improve the security of the command-line interface and the embedded device; after generating the instruction tree linked list, it also includes: storing the function library and execution commands in the command execution layer of the command-line interface, so as to ensure that the execution node can successfully call the function corresponding to the control command to achieve the corresponding function.
[0117] The above are merely preferred embodiments of this application and are 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 control method for an embedded device, characterized in that, include: The command-line interface obtains the user's control commands, resulting in multiple control commands, wherein each control command consists of at least a keyword command, a parameter command, and an execution command. Obtain the lowest user level corresponding to the keyword instruction in the control instruction, generate a node for the keyword instruction based at least on the keyword instruction and the lowest user level, and obtain a keyword node; generate a node for the parameter instruction based at least on the parameter instruction in the control instruction, and obtain a parameter node; generate a node for the execution instruction based at least on the execution instruction in the control instruction, and obtain an execution node. The keyword node, parameter node, and execution node corresponding to the control instruction are sequentially connected to generate an instruction linked list corresponding to the control instruction. Multiple instruction linked lists corresponding to multiple control instructions are connected to generate an instruction tree linked list. The lowest user level represents the lowest user level required to execute the keyword instruction. Determine all control instructions in the instruction tree chain whose lowest user level is lower than the user level corresponding to the keyword instruction, obtain a target control instruction set, and execute the target control instruction set in the instruction tree chain to control the embedded device.
2. The control method according to claim 1, characterized in that, The keyword node is obtained by generating at least the node that generates the keyword instruction based on the keyword instruction and the minimum user level, including: Based on the type of the keyword instruction, the keyword instruction, and the lowest user level, a node for the keyword instruction is generated to obtain the keyword node. The type of the keyword instruction is either a non-terminal keyword type or a terminal keyword type. The terminal keyword type indicates that the keyword node is located at the end of the instruction chain, excluding the execution node. The non-terminal keyword type indicates that the keyword node is located at a non-terminal part of the instruction chain, excluding the execution node.
3. The control method according to claim 1, characterized in that, At least a node for generating parameter instructions based on the parameter instructions in the control instructions is obtained, including: Based on the parameter instruction, the type of the parameter instruction, and whether a default option is allowed, a parameter instruction node is generated, resulting in a parameter node. The parameter instruction includes at least one of an enumeration, a string, and an integer. The enumeration represents on or off, true or false, start or stop. The parameter instruction type includes non-terminal parameter type and terminal parameter type. The default option includes default option and non-default option. The terminal parameter type indicates that the parameter node is located at the end of the instruction chain, excluding the execution node. The non-terminal parameter type indicates that the parameter node is located at a non-terminal part of the instruction chain, excluding the execution node. The non-default option indicates that the parameter instruction needs to be input, and the default option indicates that the parameter instruction does not need to be input.
4. The control method according to claim 1, characterized in that, At least a node for generating execution instructions based on the execution instructions in the control instructions is obtained, including: Based on the type of the execution instruction, the function call entry point, the execution instruction, and the target subsystem, an execution instruction node is generated to obtain an execution node. The type of the execution instruction is the execution type, the function call entry point is used to call the function in the command line interface, and the execution instruction is sent to the target subsystem, which is a system other than the command line interface used to execute the execution instruction.
5. The control method according to claim 1, characterized in that, The generation of the instruction tree linked list also includes: The instruction tree linked list is generated to the command parsing layer of the command-line interface, wherein the command parsing layer is used to parse the control instructions according to the instruction tree linked list.
6. The control method according to any one of claims 1 to 5, characterized in that, After generating the instruction tree linked list, the following is also included: Multiple user levels corresponding to the current user are obtained from multiple host computer control terminals, and the multiple user levels corresponding to the multiple host computer control terminals are stored in the link management layer of the command line interface. The host computer control terminals and the embedded device are connected through the command line interface, and the link management layer is used to manage and maintain the connection links between the multiple host computer control terminals and the command line interface.
7. The control method according to any one of claims 1 to 5, characterized in that, After generating the instruction tree linked list, the following is also included: The username and password are stored in the user management layer of the command-line interface, wherein the username and password are in one-to-one correspondence, and the user management layer is used to determine whether the username and password of the current user are correct.
8. The control method according to any one of claims 1 to 5, characterized in that, After generating the instruction tree linked list, the following is also included: The function library and the execution instructions are stored in the command execution layer of the command-line interface, wherein the command execution layer is used to execute the control instructions input by the current user, and the function library is used to store the functions required to execute the control instructions.
9. A control device for an embedded device, characterized in that, include: The acquisition unit is used to acquire user control commands through the command line interface and obtain multiple control commands, wherein the control commands consist of at least keyword commands, parameter commands, and execution commands; The first generation unit is configured to obtain the lowest user level corresponding to the keyword instruction in the control instruction, generate a node for the keyword instruction based at least on the keyword instruction and the lowest user level to obtain a keyword node, generate a node for the parameter instruction based at least on the parameter instruction in the control instruction to obtain a parameter node, and generate a node for the execution instruction based at least on the execution instruction in the control instruction to obtain an execution node. The second generation unit is used to sequentially connect the keyword node, parameter node and execution node corresponding to the control instruction to generate the instruction chain list corresponding to the control instruction, and connect multiple instruction chain lists corresponding to multiple control instructions to generate an instruction tree chain list, wherein the lowest user level represents the lowest user level required to execute the keyword instruction; An execution unit is configured to determine all control instructions in the instruction tree linked list whose lowest user level is lower than the user level corresponding to the keyword instruction, obtain a target control instruction set, and execute the target control instruction set in the instruction tree linked list to control the embedded device.
10. An electronic device, characterized in that, include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including a control method for performing an embedded device according to any one of claims 1 to 8.