Equipment control method and device, configuration management platform and storage medium
By obtaining and assembling instruction messages and sending instructions based on the communication protocol of the target device, the complexity and cost problems of hard-coded methods being compatible with new devices or new functions are solved, and the stability and usability of the platform are improved.
Patent Information
- Application Number
- CN202510382690.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-06-24
AI Technical Summary
In the prior art, compatible with new devices or new functions through hard-code methods increases the maintenance and management complexity and development costs of the platform, and reduces the stability and availability of the platform.
By obtaining the instruction template and the target instruction parameters of the target instruction, assemble the instruction message, and send the instruction message according to the communication protocol of the target device, control of the target device is achieved. This method does not rely on hard coding and is flexible to new devices or new features.
It reduces the complexity of the platform's maintenance and management and development costs, improves the stability and availability of the platform, and achieves flexible compatibility with new devices or new functions.
Smart Images

Figure CN120200927A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet of Things communication technologies, and particularly to a device control method, apparatus, configuration management platform, and storage medium. Background Art
[0002] In Internet of Things technologies, an instruction is a piece of information or command used to interact with a device to achieve control. It is transmitted and reaches the device through a specific medium (such as a network, Bluetooth, etc.), and then controls the device to perform corresponding operations. Usually, a management platform issues instructions to devices it accesses, such as charging piles, to achieve control of the devices.
[0003] In related technologies, when the devices accessed by the platform change, such as when new devices are accessed or devices add new functions, when the platform controls the devices, a hard-coded method is usually adopted to be compatible with the new devices or new functions, that is, by modifying or adding code related to instructions, custom development of instructions for the new devices or new functions is carried out to achieve control of the devices. However, this hard-coded method increases the complexity of platform maintenance management and development costs, and reduces the stability and usability of the platform. Summary of the Invention
[0004] In view of this, embodiments of this application provide a device control method, apparatus, configuration management platform, and storage medium to solve the technical problems that using the hard-coded method to be compatible with new devices or new functions increases the complexity of platform maintenance management and development costs, and reduces the stability and usability of the platform.
[0005] In a first aspect, embodiments of this application provide a device control method applied to a configuration management platform. The method includes:
[0006] Obtain an instruction template and target instruction parameters of a target instruction; the instruction template includes an instruction identifier and message data of the target instruction, and the instruction identifier and the message data are determined according to the communication protocol corresponding to the target device;
[0007] Based on the message data, assemble the instruction identifier and the target instruction parameters to obtain an instruction message;
[0008] Send the instruction message to the target device, so that the target device performs corresponding operations according to the instruction identifier and target instruction parameters indicated by the instruction message, and the communication protocol corresponding to the target device, and returns the operation result to the configuration management platform; wherein, the communication protocol includes a processing logic corresponding to the instruction identifier.
[0009] In a possible implementation, the instruction identifier includes a function code, an offset, and an identification code;
[0010] Before obtaining the instruction template and target instruction parameters of the target instruction, the method further includes:
[0011] Obtain the instruction names, function codes, offsets, identification codes, and message data of multiple instructions to be configured; the message data includes a parsing method and a message length;
[0012] Generate an instruction template for each configured instruction according to the instruction name, the function code, the offset, the identification code, and the message data; wherein, the instruction name is used to query the corresponding instruction template.
[0013] In a possible implementation manner, the obtaining the instruction names, function codes, offsets, identification codes, and message data of multiple instructions to be configured includes:
[0014] Display a configuration interface, where the configuration interface includes an instruction configuration interface and an instruction parameter configuration interface;
[0015] In response to an input operation of the instruction name and function code for the instruction configuration interface, and an input operation of the offset, identification code, and message data for the instruction parameter configuration interface, obtain the instruction name, function code, offset, identification code, and message data of the instruction;
[0016] Correspondingly, the generating an instruction template for each configured instruction according to the instruction name, the function code, the offset, the identification code, and the message data includes:
[0017] Generate an instruction template for each configured instruction according to the instruction name, the function code, the offset, the identification code, and the message data according to preset requirements, and generate a running interface according to the instruction template; the running interface includes configuration items for configuring the target instruction parameters.
[0018] In a possible implementation manner, the instruction template further includes the parameter type of the target instruction and the verification type and rules;
[0019] Before assembling the instruction identifier and the target instruction parameters based on the message data to obtain an instruction message, it further includes:
[0020] Based on the parameter type and the verification type and rules, determine whether the target instruction parameters are valid;
[0021] The assembling the instruction identifier and the target instruction parameters based on the message data to obtain an instruction message includes:
[0022] If it is determined that the target instruction parameter is valid, an instruction message is obtained by assembling the instruction identifier and the target instruction parameter based on the message data.
[0023] In a possible implementation, the instruction template further includes the role to which the target instruction belongs, and the role to which the target instruction belongs indicates the role that has the permission to issue the target instruction;
[0024] Before obtaining the instruction message by assembling the instruction identifier and the target instruction parameter based on the message data, it further includes:
[0025] Based on the role to which the target instruction belongs, it is determined whether the role that issues the current instruction has the permission to issue the target instruction;
[0026] The obtaining the instruction message by assembling the instruction identifier and the target instruction parameter based on the message data includes:
[0027] If it is determined that the role that issues the current instruction has the permission to issue the target instruction, an instruction message is obtained by assembling the instruction identifier and the target instruction parameter based on the message data.
[0028] In a possible implementation, the obtaining the instruction template and the target instruction parameter of the target instruction includes:
[0029] Display an instruction issuing interface;
[0030] In response to a click operation on the instruction name of the target instruction for the instruction issuing interface, the instruction template of the target instruction is obtained, and the running interface is displayed;
[0031] In response to an instruction parameter input operation for the running interface, the target instruction parameter is obtained.
[0032] In a possible implementation, the obtaining the instruction message by assembling the instruction identifier and the target instruction parameter based on the message data includes:
[0033] Based on the parsing method, the function code, the offset, the identification code, and the message length are assembled;
[0034] According to the assembly result, an instruction message is obtained.
[0035] In a second aspect, an embodiment of the present application provides a device control device, which is applied to a configuration management platform and includes:
[0036] An acquisition unit, configured to acquire an instruction template and target instruction parameters of a target instruction; the instruction template includes an instruction identifier and message data of the target instruction, and the instruction identifier and the message data are determined according to a communication protocol corresponding to a target device.
[0037] A processing unit, configured to assemble the instruction identifier and the target instruction parameters based on the message data to obtain an instruction message.
[0038] A sending unit, configured to send the instruction message to the target device, so that the target device performs corresponding operations according to the instruction identifier and target instruction parameters indicated by the instruction message, and the communication protocol corresponding to the target device, and returns an operation result to the configuration management platform; wherein, the communication protocol includes a processing logic corresponding to the instruction identifier.
[0039] In a third aspect, an embodiment of the present application provides a configuration management platform, including a memory and a processor, where a computer program executable on the processor is stored in the memory, and when the processor executes the computer program, the device control method according to any one of the first aspect is implemented.
[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the device control method according to any one of the first aspect is implemented.
[0041] It can be understood that the beneficial effects of the above second aspect to the fourth aspect can refer to the relevant descriptions in the above first aspect, and will not be repeated here.
[0042] The device control method, device, configuration management platform and storage medium provided by the embodiments of the present application can, when controlling a target device, obtain an instruction message according to the acquired instruction template and target instruction parameters of the target instruction, and then send the instruction message to the target device, so that the target device performs corresponding operations according to the instruction identifier and target instruction parameters indicated by the instruction message, and the communication protocol corresponding to the target device, thereby realizing the control of the target device by the platform. Among them, the instruction identifier and message data included in the instruction template are determined according to the communication protocol used by the target device. For example, the present application first configures an instruction for controlling the target device according to the communication protocol used by the target device, that is, determines the instruction template of the instruction. In this way, the configuration management platform is compatible with new devices or new functions in a non-hard-coded manner, that is, the instruction is sent to the target device in a non-hard-coded manner to control the target device, reducing the maintenance management complexity and development cost of the platform, and improving the stability and availability of the platform.
[0043] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and do not limit this specification. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0045] Figure 1 is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0046] Figure 2 is a schematic flowchart of a device control method provided by an embodiment of the present application;
[0047] FIG. 3(a) is a schematic diagram of an instruction configuration interface provided by an embodiment of the present application;
[0048] FIG. 3(b) is a schematic diagram of an instruction parameter configuration interface provided by an embodiment of the present application;
[0049] FIG. 3(c) is a schematic diagram of an operation interface provided by an embodiment of the present application;
[0050] FIG. 3(d) is a schematic diagram of a total instruction operation interface provided by an embodiment of the present application;
[0051] Figure 4 is a schematic structural diagram of a device control device provided by an embodiment of the present application;
[0052] Figure 5 is a schematic structural diagram of a configuration management platform provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0053] The following further clarifies the present application in combination with specific embodiments. The following embodiments will help those skilled in the art further understand the function of the present application, but do not limit the present application in any form. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several deformations and improvements can also be made. These all belong to the protection scope of the present application.
[0054] It should be understood that when used in the specification of the present application and the appended claims, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0055] It should also be understood that the term "and / or" as used in the specification and appended claims of the present application refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations.
[0056] In the description of the specification and appended claims of the present application, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and should not be construed as indicating or implying relative importance.
[0057] Reference to "one embodiment" or "some embodiments" etc. described in the specification of the present application means that a specific feature, structure or characteristic described in connection with that embodiment is included in one or more embodiments of the present application. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments" etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "comprising", "including", "having" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0058] In addition, the "plurality" mentioned in the embodiments of the present application should be construed as two or more.
[0059] In the related art, when the devices accessed by the platform change, such as when new devices are accessed or devices add new functions, when the platform controls the devices, a hard-coded method is usually adopted to be compatible with the new devices or new functions, that is, by modifying or adding the code related to the instructions, custom development of instructions for the new devices or new functions is carried out to achieve the control of the devices. However, this hard-coded method increases the complexity of platform maintenance management and development costs, and reduces the stability and availability of the platform.
[0060] With the idea of avoiding the hard-coded method to be compatible with new devices or new functions, thereby reducing the complexity of platform maintenance management and development costs, the inventors have found that when the platform accesses new devices or devices add new functions, for the target device to be controlled, the platform can configure the instructions for controlling the target device according to the communication protocol corresponding to the target device. Specifically, determine the instruction template of the instruction, and the instruction template includes an instruction identifier and message data. Thus, when the platform controls the target device, it can obtain the instruction template and target instruction parameters of the target instruction in the instruction, and then obtain the instruction message according to the instruction template and target instruction parameters, and send the instruction message to the target device to realize the issuance of the target instruction, and further realize the control of the target device. In this way, the platform can adopt a non-hard-coded method to be compatible with new devices or new functions, that is, adopt a non-hard-coded method to realize the instruction issuance to the target device to control the target device.
[0061] Figure 1 is a schematic diagram of an application scenario provided by an embodiment of the present application. As Figure 1 shown, this application scenario includes a configuration management platform and a target device, and the target device is, for example, a charging pile.
[0062] Among them, the configuration management platform obtains the instruction template and target instruction parameters of the target instruction. The instruction template includes the instruction identifier and message data of the target instruction, and the instruction identifier and message data are determined according to the communication protocol corresponding to the target device. Then, the configuration management platform assembles the instruction identifier and target instruction parameters based on the message data to obtain an instruction message, and sends the instruction message to the target device.
[0063] After receiving the instruction message, the target device executes corresponding operations according to the instruction identifier and target instruction parameters indicated by the instruction message, and the communication protocol corresponding to the target device, and returns the operation result to the configuration management platform, where the communication protocol includes the processing logic corresponding to the instruction identifier.
[0064] In addition, the configuration management platform may include a display screen (not shown in the figure), and can display the instruction template, target instruction parameters and generated instruction message of the target instruction, as well as the operation result feedback by the target device received on the display screen.
[0065] Figure 2 is a schematic flowchart of a device control method provided by an embodiment of the present application. As Figure 2 shown, the method in the embodiment of the present application is applied to the configuration management platform. The above method may include:
[0066] Step 201, obtain the instruction template and target instruction parameters of the target instruction; the instruction template includes the instruction identifier and message data of the target instruction, and the instruction identifier and message data are determined according to the communication protocol corresponding to the target device.
[0067] In this embodiment, the target instruction is an instruction sent by the configuration management platform to the target device to control the target device to execute corresponding operations, and the target instruction parameters are used to indicate the specific conditions of the corresponding operations. For example, the target instruction may be to control the charging duration to be 2 hours, and 2 hours is the target instruction parameter.
[0068] Here, since the target device is a new device accessed by the configuration management platform or a device with new functions added, when the configuration management platform first accesses a new device or a device with new functions added, it does not have instructions for the new device or instructions for the new functions. Therefore, in this embodiment, new instructions are first configured for the target device, and the configuration of the new instructions is described first in the following embodiments.
[0069] In a possible implementation manner, the instruction identifier may include a function code, an offset, and an identification code. Before obtaining the instruction template and target instruction parameters of the target instruction, steps A1 to A2 may also be included.
[0070] A1. Obtain the instruction names, function codes, offsets, identification codes, and message data of multiple instructions to be configured; the message data includes a parsing method and a message length.
[0071] A2. Generate an instruction template for each configured instruction according to the instruction name, function code, offset, identification code, and message data; wherein, the instruction name is used to query the corresponding instruction template.
[0072] Exemplarily, the instructions to be configured are new instructions that the configuration management platform needs to configure for the target device. The function code defines the operation type executed by the device and is a number or short string used to identify a specific operation. The offset specifies the starting position of the data in the device memory and is used to determine the data address for reading or writing. The identification code is the unique identifier of the device and is used to ensure the accuracy and reliability of communication. The combination of the function code, offset, and identification code can represent the operation that the configured instruction instructs the target device to perform.
[0073] Optionally, in this embodiment, the function code, offset, and identification code are all determined according to the communication protocol used by the target device. In this way, when the target device subsequently receives an instruction message composed of the above function code, offset, and identification code, it can determine the corresponding processing logic and execute the corresponding operation according to the above function code, offset, and identification code, as well as the function code, offset, and identification code in the communication protocol used by the target device, thereby realizing the control of the target device by the configuration management platform. The parsing method and message length are also determined according to the communication protocol used by the target device. In this way, when the target device subsequently receives an instruction message assembled based on the parsing method and message length, it can accurately parse the instruction message according to the communication protocol used by the target device.
[0074] In this way, both the instruction identifier and the message data are determined according to the communication protocol used by the target device, and the setting of new instructions for the target device can be realized without using the hard-coding method.
[0075] In some embodiments, when obtaining the instruction names, function codes, offsets, identification codes, and message data of multiple instructions to be configured, a configuration interface may be displayed, where the configuration interface includes an instruction configuration interface and an instruction parameter configuration interface. Then, in response to the input operations of the instruction name and function code for the instruction configuration interface, and the input operations of the offset, identification code, and message data for the instruction parameter configuration interface, the instruction name, function code, offset, identification code, and message data of the instruction are obtained.
[0076] Correspondingly, when generating the instruction template for each configured instruction based on the instruction name, function code, offset, identification code, and message data, the instruction template for each configured instruction can be generated according to the instruction name, function code, offset, identification code, and message data in accordance with preset requirements, and a running interface can be generated based on the instruction template; the running interface includes configuration items for configuring target instruction parameters.
[0077] Exemplarily, when configuring the instruction template of the instruction in this embodiment, an instruction configuration interface and an instruction parameter configuration interface can be displayed, as shown in FIGS. 3(a) and 3(b) respectively, so that a user, a terminal, or other platforms can input the instruction name and function code in the instruction configuration interface, and input the offset, identification code, and message data in the instruction parameter configuration interface. Thus, in this embodiment, according to preset requirements such as preset layout or sequence, etc., based on the instruction name, function code, offset, identification code, and message data of the instruction to be configured obtained, the instruction template of the configured instruction can be generated.
[0078] In addition, a running interface can be generated according to the instruction template, as shown in FIG. 3(c). Since even when the same target instruction is issued, the values of the target instruction parameters may also be different, the running interface generated in this embodiment includes configuration items for configuring target instruction parameters, so that a user, a terminal, or other platforms can input target instruction parameters in the running interface.
[0079] It should be noted that instruction templates for multiple instructions can be obtained according to the above method, and the instruction name is used to query the corresponding instruction template. For example, it enables a user to more intuitively understand the operation that the instruction instructs the target device to perform, and facilitates the user to find the corresponding instruction according to the instruction name.
[0080] In this embodiment, before obtaining the instruction template of the target instruction and the target instruction parameters, the target device is first configured with a new instruction, and the function code, offset, and identification code (instruction identifier) of the instruction to be configured are obtained, as well as the decoding method and message length (message data). Among them, the above function code, offset, and identification code indicate the operation that the configured instruction instructs the target device to perform, and the decoding method and message length are used to form an instruction message in combination with the instruction identifier. Furthermore, based on the instruction name, function code, offset, identification code, and message data, the instruction template of each configured instruction is generated.
[0081] In this way, when the configuration management platform issues a target instruction to a target device to control the target device, it only needs to obtain the instruction template and target instruction parameters of the target instruction and send them to the target device. Since the instruction identifier and message data included in the target template are determined according to the communication protocol used by the target device, when the target device receives an instruction message composed of the instruction identifier, target instruction parameters, and message data, it can accurately parse the instruction message according to the communication protocol used by the target device, determine the corresponding processing logic, and execute the corresponding operation, thereby realizing the control of the target device by the configuration management platform. The instruction issuance to the target device can be realized without using the hard-coding method, reducing code redundancy and the volume of the finally packaged file, reducing the complexity of platform maintenance management and development costs, and improving the stability and availability of the platform.
[0082] In addition, in this embodiment, the configuration of a new instruction for the target device can be understood as customizing the configuration of the new instruction, which can be flexibly configured according to requirements to adapt to different application scenarios, improving flexibility and configurability. At the same time, for the custom configuration of new instructions, the instruction test of the configured instructions can be tested separately, improving the test efficiency and coverage, and avoiding the problem that every time a new instruction is developed using the hard-coding method, a comprehensive test of the instruction is required. In addition, the custom configuration of new instructions has encapsulation, and the code corresponding to the instructions is more modular, which is easy to maintain and reuse in the future.
[0083] In some embodiments, when obtaining the instruction template and target instruction parameters of the target instruction, an instruction issuance interface can be displayed, and in response to a click operation on the instruction name of the target instruction on the instruction issuance interface, the instruction template of the target instruction can be obtained, and a running interface can be displayed. In response to an instruction parameter input operation on the running interface, the target instruction parameters can be obtained.
[0084] As can be seen from the foregoing, in this embodiment, the instruction name is used to query the corresponding instruction template. Then, the instruction issuance interface can display the instruction names of each instruction corresponding to the target device, so that the user, terminal, or platform can click on the instruction name of the target instruction on the instruction issuance interface. Thus, the configuration management platform can obtain the instruction template of the target instruction and display the corresponding running interface, so that the user, terminal, or platform can input the target instruction parameters on the running interface. Thus, the configuration management platform can obtain the target instruction parameters.
[0085] Step 202: Assemble the instruction identifier and target instruction parameters based on the message data to obtain an instruction message.
[0086] Exemplarily, in this embodiment, when assembling the instruction identifier and target instruction parameters to obtain an instruction message, the function code, offset, identification code, and message length can be assembled based on the parsing method, and the instruction message can be obtained according to the assembly result.
[0087] Among them, the parsing method defines how to assemble and parse each part in the message, and the message length specifies the amount of data to be assembled and parsed.
[0088] Step 203: Send the instruction message to the target device, so that the target device executes corresponding operations according to the instruction identifier and target instruction parameters indicated by the instruction message, as well as the communication protocol corresponding to the target device, and returns the operation result to the configuration management platform.
[0089] Among them, the communication protocol includes the processing logic corresponding to the instruction identifier.
[0090] After generating the instruction message in this embodiment, the instruction message is sent to the target device, so that after receiving the instruction message, the target device parses the instruction message according to the communication protocol used by the target device, and determines the corresponding processing logic according to the function code, offset, and identification code (instruction identifier) obtained by parsing, as well as the above communication protocol, executes corresponding operations, and assembles the operation result into a result message according to the parsing method and message length, and feeds back the result message to the configuration management platform. Among them, when determining the target device, it is possible to respond to the click operation on the target device in the instruction sending interface to obtain the device name, device serial number, port, communication protocol version, etc. of the target device, and send the instruction message to the target device according to the above content.
[0091] After receiving the result message, the configuration management platform parses the result message according to the communication protocol used by the target device, obtains the operation result and displays it on the display screen, realizing the control of the target device by the configuration management platform.
[0092] The device control method provided by the embodiment of the present application can obtain an instruction message according to the instruction template and target instruction parameters of the target instruction when controlling the target device, and then send the instruction message to the target device, so that the target device executes corresponding operations according to the instruction identifier and target instruction parameters indicated by the instruction message, as well as the communication protocol corresponding to the target device, thereby realizing the control of the target device by the platform. Among them, the instruction identifier and message data included in the instruction template are determined according to the communication protocol used by the target device. For example, the present application first configures the instruction for controlling the target device according to the communication protocol used by the target device, that is, determines the instruction template of the instruction. In this way, the configuration management platform is compatible with new devices or new functions in a non-hard-coded manner, that is, realizes the instruction sending to the target device and controls the target device in a non-hard-coded manner, reducing the maintenance management complexity and development cost of the platform, and improving the stability and availability of the platform.
[0093] To ensure the validity of the target instruction parameters and avoid issuing invalid instructions, it is also possible to detect whether the target instruction parameters are valid. Specifically, when configuring the instruction template of the instruction, corresponding detection parameters can be set. Correspondingly, before the configuration management platform issues the target instruction, it performs a validity check on the target instruction parameters based on the detection parameters.
[0094] Exemplarily, in this embodiment, when configuring the instruction template of the instruction, referring to FIG. 3(b), the instruction parameter configuration interface may further include configuration items for parameter type, verification type, and verification rule, so that users, terminals, or other platforms can input the parameter type, verification type, and verification rule in the instruction parameter configuration interface. Among them, the parameter type defines the types of the target instruction parameters, which may include types such as string, integer, floating point, and radio selection. When the parameter type is radio selection, different options are set in the configuration items of the target instruction parameters included in the operation interface for users, terminals, or other platforms to select. The verification type may include length, format, etc. When the verification type is length, the verification rule is correspondingly set to limit the length of the target instruction parameter. For example, if the target instruction parameter is the charging duration and the verification type is length, the verification rule is correspondingly 0.5 to 10 hours, that is, the target instruction parameter can only be set to be greater than or equal to 0.5 hours and less than or equal to 10 hours. When the verification type is format, the verification rule is correspondingly that it can only be a number, that is, the target instruction parameter can only be set in a numerical format.
[0095] In this way, the configured instruction template further includes the parameter type of the instruction, as well as the verification type and rules, where the verification type and rules include the verification type and the verification rule.
[0096] In some embodiments, before assembling the instruction identifier and the target instruction parameters to obtain the instruction message, it is also possible to determine whether the target instruction parameters are valid based on the parameter type, as well as the verification type and rules.
[0097] Correspondingly, if it is determined that the target instruction parameters are valid, then based on the message data, the instruction identifier and the target instruction parameters are assembled to obtain the instruction message.
[0098] In this embodiment, after obtaining the target instruction parameters, first, based on the parameter type, verification type, and verification rule in the instruction template, it is detected whether the target instruction parameters are valid. Only when it is determined that the target instruction parameters are valid, based on the message data, the instruction identifier and the target instruction parameters are assembled to obtain the instruction message. Otherwise, an alarm prompt for invalid target instruction parameters is given to remind users, terminals, or other platforms that the target instruction parameters are invalid. In this way, the validity of the target instruction parameters can be ensured, the issuance of invalid instructions can be avoided, and at the same time, the stability and security can be improved to prevent illegal attacks.
[0099] To improve the security, stability, and management efficiency of the configuration management platform, it is also possible to restrict the roles that have the authority to issue target instructions. Specifically, when configuring the instruction template of the configuration instruction, corresponding role parameters can be set. Correspondingly, before the configuration management platform issues a target instruction, it detects whether the role issuing the current target instruction has the authority based on the role parameters.
[0100] Exemplarily, in this embodiment, when configuring the instruction template of the instruction, referring to Fig. 3(a), the instruction configuration interface may further include a configuration item for the affiliated role, so that the user, terminal, or other platforms can input the affiliated role in the instruction configuration interface. This affiliated role indicates the role that has the authority to issue the target instruction, that is, only the affiliated role can use this instruction. For example, the affiliated roles may include the super administrator role and the home version merchant role, etc. Among them, the super administrator role can use more instructions. In this way, the configured instruction template also includes the affiliated role of the instruction.
[0101] In some embodiments, before assembling the instruction identifier and the target instruction parameters to obtain the instruction message, it is also possible to determine whether the role issuing the current instruction has the authority to issue the target instruction based on the affiliated role.
[0102] Correspondingly, if it is determined that the role issuing the current instruction has the authority to issue the target instruction, then based on the message data, the instruction identifier and the target instruction parameters are assembled to obtain the instruction message.
[0103] In this embodiment, after obtaining the instruction template of the target instruction, first determine whether the role issuing the current instruction has the authority to issue this target instruction based on the affiliated role. Among them, the role issuing the current instruction can be determined according to the user name or user account currently logged in to the configuration management platform, etc. For example, according to the current user name and the classification of this user name when registering this user name, it can be determined that the current user name is the super administrator role, which matches the affiliated role of the target instruction. Then the role issuing the current instruction has the authority to issue the target instruction, and the instruction identifier and the target instruction parameters can be assembled based on the message data to obtain the instruction message. Otherwise, an unauthorized alarm prompt is given. In this way, the security, stability, and management efficiency of the configuration management platform can be improved, and illegal attacks, etc. can be prevented.
[0104] To facilitate users to view and query instructions more intuitively and conveniently, and to optimize the transmission efficiency, other parameters can also be set when configuring the instruction template of the instruction.
[0105] Exemplarily, when configuring the instruction template of the instruction in this embodiment, referring to Fig. 3(a), the instruction configuration interface may further include configuration items for instruction encoding and the instruction type to which it belongs, so that users, terminals or other platforms can input the instruction encoding and the instruction type to which it belongs in the instruction configuration interface. Among them, the instruction encoding is the unique encoding of the instruction, corresponding to the instruction name, which is machine-readable and suitable for use in communication, data transmission or underlying code, facilitating rapid processing and improving efficiency. The instruction type to which it belongs defines the type of the instruction, such as a common instruction, etc., facilitating users to query and manage the instruction.
[0106] Optionally, when configuring the instruction template of the instruction in this embodiment, referring to Fig. 3(b), the instruction parameter configuration interface may further include configuration items such as parameter key name, parameter name, parameter magnification factor, base number, and measurement point association encoding, so that users, terminals or other platforms can input the parameter key name, parameter name, parameter magnification factor, base number, and measurement point association encoding, etc. in the instruction parameter configuration interface. Among them, the parameter key name is the unique identifier of the instruction parameter, corresponding to the parameter name, and is used to distinguish different parameters. The parameter name is the name of the instruction parameter, suitable for use in the interface or debug log, facilitating users to understand the relevant instruction.
[0107] Exemplarily, the parameter magnification factor and the base number can be determined according to the communication protocol used by the target device. The parameter magnification factor is usually a scaling factor such as a proportional coefficient, used to adjust the precision or unit of the value. For example, if the target instruction parameter charging duration is 2.0 hours, then the charging duration value in the instruction message for transmission is 2.0÷0.1 = 20, and when parsing the instruction message, the charging duration value in the instruction message for transmission is 20, the parameter magnification factor is 0.1, then the actual charging duration is 20×0.1 = 2.0 hours. Setting the parameter magnification factor is to reduce the amount of transmitted data and adapt to devices with different precisions. The base number is an offset used to adjust the reference point of the transmitted value and is usually used in combination with the parameter magnification factor. For example, if the charging duration value in the instruction message for transmission is 50, the parameter magnification factor is 0.1, and the base number is -3, then the actual charging duration is 50×0.1 + (-3) = 2 hours. Based on the parameter magnification factor and the base number, the transmission efficiency of the data is optimized through scaling and offset. The measurement point association encoding is the encoding that uniquely identifies a measurement point (device) and is the identifier for displaying the backfilled data, i.e., the operation result, in the interface.
[0108] In some embodiments, instructions can also be issued in batches. For example, for write instructions, such as for a charging pile, write the charging duration of gun A, the number of high-temperature operations of gun A, the number of uses of gun A, the number of uses of the contactor relay of gun A, the charging duration of gun B, the number of high-temperature operations of gun B, the number of uses of gun B, the number of uses of the contactor relay of gun B, the operating duration of the whole machine's fan, the operating duration of the charging pile, the number of high-temperature operations of the charging pile, the number of lightning arrester alarms, temperature, the number of uses of the AC contactor, etc. These instructions can be classified as write terminal data instructions. In this way, when configuring instructions, the instructions can be separately configured according to the instruction configuration method provided in the foregoing embodiments of this application, and related instructions can be grouped into a general instruction. For example, read instructions can be grouped into the general instruction of reading terminal data instructions, write instructions can be grouped into the general instruction of writing terminal data instructions, and the read / write instructions of gun A can be grouped into gun A data instructions, etc. There is no specific limitation on the division of general instructions here. Any related instructions can be grouped into a general instruction, or any instructions according to user requirements can also be grouped into a general instruction.
[0109] In this way, after grouping related instructions into a general instruction, according to the instruction templates of each instruction under the general instruction, a general instruction operation interface is generated, as shown in FIG. 3(d). When issuing instructions in batches, obtain the instruction templates and target instruction parameters of each target instruction under the general instruction. For each target instruction, based on the message data of the target instruction, assemble the instruction identifier and target instruction parameters of the instruction to obtain the corresponding instruction message. Finally, send the instruction message to the corresponding target device, and the batch issuance of instructions can be realized, improving the efficiency of instruction issuance. For example, if the general instruction is the write terminal data instruction, the instruction parameters of the general instruction operation interface are the charging duration of gun A, the number of high-temperature operations of gun A, the number of uses of gun A, the number of uses of the contactor relay of gun A, the charging duration of gun B, the number of high-temperature operations of gun B, the number of uses of gun B, the number of uses of the contactor relay of gun B, the operating duration of the whole machine's fan, the operating duration of the charging pile, the number of high-temperature operations of the charging pile, the number of lightning arrester alarms, temperature, the number of uses of the AC contactor, as shown in FIG. 3(d).
[0110] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The order of execution of each process should be determined according to its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0111] Figure 4 is a schematic structural diagram of a device control device provided by an embodiment of this application. As Figure 4 shown, the device control device provided in this embodiment may include: an acquisition unit 401, a processing unit 402, and a sending unit 403.
[0112] Among them, an acquisition unit 401 is configured to acquire an instruction template and target instruction parameters of a target instruction; the instruction template includes an instruction identifier and message data of the target instruction, and the instruction identifier and the message data are determined according to a communication protocol corresponding to a target device.
[0113] A processing unit 402 is configured to assemble the instruction identifier and the target instruction parameters based on the message data to obtain an instruction message.
[0114] A sending unit 403 is configured to send the instruction message to the target device, so that the target device performs corresponding operations according to the instruction identifier and target instruction parameters indicated by the instruction message, and the communication protocol corresponding to the target device, and returns an operation result to the configuration management platform; wherein, the communication protocol includes a processing logic corresponding to the instruction identifier.
[0115] Optionally, the instruction identifier includes a function code, an offset, and an identification code; the acquisition unit 401 is further configured to:
[0116] Acquire instruction names, function codes, offsets, identification codes, and message data of a plurality of instructions to be configured; the message data includes a parsing method and a message length;
[0117] Generate an instruction template for each configured instruction according to the instruction name, the function code, the offset, the identification code, and the message data; wherein, the instruction name is used to query the corresponding instruction template.
[0118] Optionally, the acquisition unit 401 is further configured to:
[0119] Display a configuration interface, where the configuration interface includes an instruction configuration interface and an instruction parameter configuration interface;
[0120] Respond to an input operation of an instruction name and a function code for the instruction configuration interface, and an input operation of an offset, an identification code, and message data for the instruction parameter configuration interface, to obtain an instruction name, a function code, an offset, an identification code, and message data of the instruction;
[0121] And generate an instruction template for each configured instruction according to the instruction name, the function code, the offset, the identification code, and the message data according to a preset requirement, and generate a running interface according to the instruction template; the running interface includes a configuration item for configuring the target instruction parameters.
[0122] Optionally, the instruction template further includes a parameter type of the target instruction, and a verification type and rule; the processing unit 402 is further configured to:
[0123] Based on the parameter type, the verification type, and the rules, determine whether the target instruction parameter is valid;
[0124] And when it is determined that the target instruction parameter is valid, based on the message data, assemble the instruction identifier and the target instruction parameter to obtain an instruction message.
[0125] Optionally, the instruction template further includes the role to which the target instruction belongs, and the role to which the target instruction belongs indicates the role that has the permission to issue the target instruction; the processing unit 402 is further configured to:
[0126] Based on the role to which the target instruction belongs, determine whether the role of the currently issued instruction has the permission to issue the target instruction;
[0127] And when it is determined that the role of the currently issued instruction has the permission to issue the target instruction, based on the message data, assemble the instruction identifier and the target instruction parameter to obtain an instruction message.
[0128] Optionally, the obtaining unit 401 is further configured to:
[0129] Display an instruction issuing interface;
[0130] Respond to a click operation on the instruction name of the target instruction in the instruction issuing interface, obtain the instruction template of the target instruction, and display the operation interface;
[0131] Respond to an instruction parameter input operation on the operation interface to obtain the target instruction parameter.
[0132] Optionally, the processing unit 402 is further configured to:
[0133] Based on the parsing method, assemble the function code, the offset, the identification code, and the message length;
[0134] According to the assembly result, obtain an instruction message.
[0135] It should be noted that for the information interaction, execution process, etc. between the above-mentioned devices / units, since they are based on the same concept as the method embodiments of the present application, their specific functions and the technical effects brought about are specifically described in the method embodiment part, and will not be elaborated here.
[0136] Figure 5 This is a schematic structural diagram of a configuration management platform provided by an embodiment of the present application. As Figure 5 shown, the configuration management platform 500 of this embodiment includes: a processor 510 and a memory 520. A computer program 521 that can run on the processor 510 is stored in the memory 520. When the processor 510 executes the computer program 521, the steps in any of the above method embodiments are implemented, for exampleFigure 2 Steps 201 to 203 shown. Alternatively, when the processor 510 executes the computer program 521, it implements the functions of each module / unit in the above device embodiments, for example Figure 4 the functions of units 401 to 403 shown.
[0137] Exemplarily, the computer program 521 can be divided into one or more modules / units. One or more modules / units are stored in the memory 520 and executed by the processor 510 to complete this application. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, and these instruction segments are used to describe the execution process of the computer program 521 in the configuration management platform 500.
[0138] Those skilled in the art can understand that Figure 5 it is only an example of the configuration management platform and does not constitute a limitation on the configuration management platform. It may include more or fewer components than shown in the figure, or combine some components, or different components, such as input / output devices, network access devices, buses, etc.
[0139] The processor 510 can be a central processing unit (CPU), or can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or this processor can also be any conventional processor, etc.
[0140] The memory 520 can be an internal storage unit of the configuration management platform, such as the hard disk or memory of the configuration management platform, or can also be an external storage device of the configuration management platform, such as a plug-in hard disk equipped on the configuration management platform, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. The above memory 520 can also include both the internal storage unit and the external storage device of the configuration management platform. The above memory 520 is used to store the computer program and other programs and data required by the configuration management platform. The memory 520 can also be used to temporarily store the data that has been output or will be output.
[0141] Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be assigned to different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiments can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of this application. The specific working processes of the units and modules in the above system can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0142] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0143] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0144] In the embodiments provided by the present invention, it should be understood that the disclosed device / configuration management platform and method can be implemented in other ways. For example, the device / configuration management platform embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.
[0145] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0146] In addition, in each embodiment of the present invention, each functional unit may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of a software functional unit.
[0147] If the above integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on such an understanding, all or part of the processes in the above-described embodiment methods of the present invention may also be completed by instructing relevant hardware through a computer program. The computer program may be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-described method embodiments may be implemented. Among them, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.
[0148] The above-described embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A device control method, characterized in that: Applied to a configuration management platform, the method includes: Acquire an instruction template and target instruction parameters of a target instruction; the instruction template includes an instruction identifier and message data of the target instruction, and the instruction identifier and the message data are determined according to a communication protocol corresponding to the target device; Based on the message data, assembling the instruction identifier and the target instruction parameter to obtain an instruction message; The command message is sent to the target device so that the target device performs a corresponding operation according to the command identifier and target command parameters indicated by the command message and the communication protocol corresponding to the target device, and returns the operation result to the configuration management platform; wherein the communication protocol includes processing logic corresponding to the command identifier.
2. The device control method according to claim 1, characterized in that: The instruction identifier includes a function code, an offset and an identification code; Before acquiring the instruction template and the target instruction parameters of the target instruction, the method further includes: Obtaining instruction names, function codes, offsets, identification codes and message data of multiple instructions to be configured; the message data includes a parsing method and a message length; According to the instruction name, the function code, the offset, the identification code and the message data, an instruction template for each configured instruction is generated; wherein the instruction name is used to query the corresponding instruction template.
3. The device control method according to claim 2, characterized in that: The step of obtaining the instruction names, function codes, offsets, identification codes and message data of the multiple instructions to be configured includes: Display configuration interface, which includes command configuration interface and command parameter configuration interface; In response to the input operation of the command name and function code for the command configuration interface, and the input operation of the offset, identification code and message data for the command parameter configuration interface, the command name, function code, offset, identification code and message data of the command are obtained; Correspondingly, generating a configured instruction template for each instruction according to the instruction name, the function code, the offset, the identification code and the message data includes: According to the instruction name, the function code, the offset, the identification code and the message data, according to preset requirements, a configured instruction template for each instruction is generated, and according to the instruction template, an operation interface is generated; the operation interface includes configuration items for configuring the target instruction parameters.
4. The device control method according to any one of claims 1 to 3, characterized in that: The instruction template also includes the parameter type and verification type and rules of the target instruction; Before assembling the instruction identifier and the target instruction parameter based on the message data to obtain the instruction message, the method further includes: Based on the parameter type and the verification type and rule, determining whether the target instruction parameter is valid; The step of assembling the instruction identifier and the target instruction parameter based on the message data to obtain the instruction message includes: If it is determined that the target instruction parameter is valid, the instruction identifier and the target instruction parameter are assembled based on the message data to obtain an instruction message.
5. The device control method according to any one of claims 1 to 3, characterized in that: The instruction template also includes the role to which the target instruction belongs, where the role indicates the role that has the authority to issue the target instruction; Before assembling the instruction identifier and the target instruction parameter based on the message data to obtain the instruction message, the method further includes: Based on the role, determine whether the role currently issuing the instruction has the authority to issue the target instruction; The step of assembling the instruction identifier and the target instruction parameter based on the message data to obtain the instruction message includes: If it is determined that the role currently issuing the instruction has the authority to issue the target instruction, the instruction identifier and the target instruction parameter are assembled based on the message data to obtain an instruction message.
6. The device control method according to claim 3, characterized in that: The step of obtaining the instruction template and target instruction parameters of the target instruction includes: Display the command issuing interface; In response to a click operation on the instruction name of the target instruction on the instruction issuing interface, an instruction template of the target instruction is obtained, and the running interface is displayed; In response to the instruction parameter input operation on the operation interface, the target instruction parameter is obtained.
7. The device control method according to claim 2, characterized in that: The step of assembling the instruction identifier and the target instruction parameter based on the message data to obtain the instruction message includes: Based on the parsing method, assembling the function code, the offset, the identification code and the message length; According to the assembly result, the instruction message is obtained.
8. A device control device, characterized in that: Applied to configuration management platforms, including: An acquisition unit, used to acquire an instruction template and target instruction parameters of a target instruction; the instruction template includes an instruction identifier and message data of the target instruction, and the instruction identifier and the message data are determined according to a communication protocol corresponding to a target device; A processing unit, configured to assemble the instruction identifier and the target instruction parameter based on the message data to obtain an instruction message; A sending unit is used to send the instruction message to the target device so that the target device performs a corresponding operation according to the instruction identifier and target instruction parameters indicated by the instruction message and the communication protocol corresponding to the target device, and returns the operation result to the configuration management platform; wherein the communication protocol includes a processing logic corresponding to the instruction identifier.
9. A configuration management platform, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the computer program, the device control method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the device control method according to any one of claims 1 to 7 is implemented.