Remote control method and device, equipment and storage medium
By establishing a message queue telemetry transmission protocol connection between the edge server and the sensor, the problem of edge server and sensor being unable to interact and batch control is solved, and the interconnection and cluster control of BMC and MCU are realized.
Patent Information
- Application Number
- CN202510564443.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-08-05
AI Technical Summary
In the prior art, edge servers and sensors cannot interact through a unified protocol due to limited network and hardware resources, and can only perform single-device control and batch control cannot be achieved.
By establishing a message queue telemetry transmission protocol connection between the client controller and the server, the server obtains task information, controller location and priority, determines commands and execution controllers, and the execution controller issues control messages through the MQTT protocol to control the corresponding device.
It realizes interconnection between the server, BMC and MCU, supports batch control using the MQTT protocol alone, which facilitates remote function development and cluster control.
Smart Images

Figure CN120434233A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a remote control method, apparatus, device and storage medium. Background Art
[0002] Edge servers and sensors are usually set up in a decentralized environment. When simple maintenance of the edge servers is required, it can only be centrally issued through command lines. In existing technologies, remote interaction with edge servers is mainly carried out through redfish or IPMI (Intelligent Platform Management Interface). However, due to limited network and hardware resources, sensors generally only support the MQTT (Message Queuing Telemetry Transport) protocol, and interaction between edge servers and sensors cannot be achieved through a unified protocol. At the same time, only single-device control of edge servers and sensors is currently supported, and batch control cannot be achieved.
[0003] Therefore, in view of the shortcomings of the existing technical solutions, the present invention provides a remote control method. Summary of the Invention
[0004] The present application provides a remote control method, apparatus, device and storage medium to at least solve the problem of poor quality of images generated in the related art.
[0005] The present application provides a remote control method, which is applied to a control system, wherein the control system includes a server and multiple clients, and the client includes a controller. The method includes: establishing a message queue telemetry transmission protocol connection between the controller in the client and the server; the server obtains one or more of task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; the server determines a command controller and an execution controller in at least one controller based on one or more of the task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; the execution controller receives a control message issued by the command controller through the message queue telemetry transmission protocol through the server, and controls the device corresponding to the execution controller according to the control message.
[0006] The present application also provides a remote control device, which is applied to a control system, wherein the control system includes a server and multiple clients, and the client includes a controller. The device includes: an establishment module, which is used to establish a message queue telemetry transmission protocol connection between the controller in the client and the server; a first processing module, which is used for the server to obtain task information, the location of the controller, the device capabilities of the device corresponding to the controller, and one or more of the priorities of the controller; a second processing module, which is used for the server to determine a command controller and an execution controller in at least one controller based on one or more of the task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; and a third processing module, which is used for the execution controller to receive, through the server, a control message issued by the command controller through the message queue telemetry transmission protocol, and control the device corresponding to the execution controller according to the control message.
[0007] The present application also provides an electronic device, comprising: a memory for storing a computer program; a processor for implementing the following steps when executing the computer program: establishing a message queue telemetry transmission protocol connection between a controller in a client and a server; the server obtaining one or more of task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; the server determining a command controller and an execution controller in at least one controller based on one or more of the task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; the execution controller receives a control message issued by the command controller through the message queue telemetry transmission protocol through the server, and controls the device corresponding to the execution controller according to the control message.
[0008] The present application also provides a computer-readable storage medium, in which a computer program is stored, wherein when the computer program is executed by a processor, the following steps are implemented: establishing a message queue telemetry transmission protocol connection between the controller in the client and the server; the server obtains one or more of the task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; the server determines a command controller and an execution controller in at least one controller based on the task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; the execution controller receives the control message issued by the command controller through the message queue telemetry transmission protocol through the server, and controls the device corresponding to the execution controller according to the control message.
[0009] The present application also provides a computer program product, including a computer program, which implements the following steps when executed by a processor: establishing a message queue telemetry transmission protocol connection between a controller in a client and a server; the server obtains one or more of task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; the server determines a command controller and an execution controller in at least one controller based on one or more of the task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; the execution controller receives a control message issued by the command controller through the message queue telemetry transmission protocol through the server, and controls the device corresponding to the execution controller according to the control message.
[0010] Through the present application, a message queue telemetry transmission protocol connection is established between the controller in the client and the server; the server obtains one or more of the task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; the server determines the command controller and the execution controller in at least one controller based on the task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; the execution controller receives the control message published by the command controller through the message queue telemetry transmission protocol through the server, and controls the device corresponding to the execution controller according to the control message. Therefore, interconnection can be achieved between the server, BMC and MCU, facilitating remote function development and implementation; by establishing an MQTT protocol connection between the controller and the server, the MQTT protocol can be used alone to control the corresponding devices of other controllers through the controller without introducing other protocols, and batch operations can be performed to achieve cluster control. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0012] Figure 1 A flowchart of a remote control method provided in an embodiment of the present application;
[0013] Figure 2 A schematic diagram of a flow chart of establishing a protocol connection for a remote control method provided in an embodiment of the present application;
[0014] Figure 3 A schematic diagram of a flow chart of a controller sending a control message in a remote control method provided in an embodiment of the present application;
[0015] Figure 4A schematic diagram of a remote control method according to an embodiment of the present application, wherein the server sends a control message;
[0016] Figure 5 A schematic diagram of the architecture of a remote control method provided in an embodiment of the present application;
[0017] Figure 6 A structural block diagram of a remote control device provided in an embodiment of the present application;
[0018] Figure 7 This is a diagram of the internal structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0019] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0020] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0021] It should be noted that the terms "S1", "S2", etc. are used only for the purpose of describing the steps and do not specifically refer to the order or sequence, nor are they used to limit this application. They are merely for the convenience of describing the method of this application and should not be understood as indicating the order of the steps. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the fact that ordinary technicians in this field can implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0022] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0023] An embodiment of the present application provides a remote control method, which is applied to a control system. The control system includes a server and multiple clients. The client includes a controller. The method is described in detail in conjunction with the execution process of the remote control method.
[0024] S101: Establish a message queue telemetry transmission protocol connection between the controller in the client and the server.
[0025] Here, the Message Queuing Telemetry Transport Protocol (MQTT protocol) is a lightweight publish-subscribe message transmission protocol, which is usually used for communication in low-bandwidth, high-latency or unreliable network environments. It is particularly suitable for scenarios such as the Internet of Things, mobile applications and remote sensors.
[0026] The controller may include a BMC (Baseboard Management Controller), an MCU (Microcontroller Unit), a PLC (Programmable Logic Controller), a GPU (Graphics Processing Unit), and the like.
[0027] Here, the server end may be an operating system of the server, such as an OS (Operating System).
[0028] Here, an MQTT protocol connection is established between a server and multiple client controllers.
[0029] S102: The server obtains one or more of task information, the location of the controller, the device capability of the device corresponding to the controller, and the priority of the controller.
[0030] Here, the task may include controlling the BMC corresponding device to perform operations such as power on and off, or controlling the MCU corresponding device to perform operations such as cabinet opening and unlocking.
[0031] Here, mission information may include objectives, requirements, performance indicators, resource requirements, location dependencies, security, and budget constraints, etc.
[0032] Here, the location of the controller may include being located at a core position or an edge position of the system.
[0033] Here, device capabilities may include computing capabilities, network capabilities, and storage capabilities.
[0034] Among them, each controller supports the MQTT protocol.
[0035] S103: The server determines a command controller and an execution controller in at least one controller according to one or more of the task information, the location of the controller, the device capability of the device corresponding to the controller, and the priority of the controller.
[0036] Here, the command controller is used to send control commands, and the execution controller is used to receive and execute control commands.
[0037] Among them, the BMC can be a command controller or an execution controller; the MCU can be an execution controller.
[0038] The command controller may include one or more controllers, and the execution controller may include one or more controllers.
[0039] Among them, when the controller is located at the core position of the system, the controller is selected as the command controller, and the controller close to the controlled device is selected as the execution controller.
[0040] Among them, when the corresponding device of the controller supports high-speed and stable network connection, and can store a large amount of historical data or configuration information, the controller is used as a command controller; when the corresponding device of the controller has a dedicated interface, low-power design and real-time performance, the controller is used as an execution controller.
[0041] Among them, the controller with higher priority serves as the command controller, and the controller with lower priority serves as the execution controller.
[0042] In one embodiment, a weight can be assigned to each parameter based on the task information. For example, if the task has high real-time requirements, a higher weight is assigned to the location and device capabilities; if the task has high global optimization requirements, a higher weight is assigned to the task and priority.
[0043] S104: The execution controller receives, through the server, a control message issued by the command controller through the message queue telemetry transmission protocol, and controls the device corresponding to the execution controller according to the control message.
[0044] Among them, control messages may include control operations such as powering on, powering off, reading device status information, reading sensor readings, opening a cabinet, unlocking, upgrading firmware, restarting the machine, setting startup items, and configuring BIOS (Basic Input / Output System) options.
[0045] Specifically, when the execution controller is a BMC, the corresponding device may be an edge server; when the execution controller is an MCU, the corresponding device may be a sensor.
[0046] Specifically, the command controller generates a control command, sends it to the server, and the server forwards it to the execution controller.
[0047] In one embodiment, the server may also generate and send a control message to the controller.
[0048] In one embodiment, the execution controller can be configured to perform periodic reporting, such as reporting heartbeat information.
[0049] In one embodiment, the execution controller can proactively report information when establishing a connection or when information changes. For example, this can be done by defining the subject as BMC / {PN} / status and setting the Quality of Service (QoS) to 1. BMC represents the message type sent by the BMC, and PN is the machine PN extracted after the BMC reads the entire machine's fru information. Status indicates that the content sent is basic information corresponding to the PN, including boot information and asset information.
[0050] It should be noted that this application establishes an MQTT protocol connection between the controller and the server. Without introducing other protocols, the MQTT protocol can be used alone to control the corresponding devices through the controller, and batch operations can be performed on the controller to achieve cluster control. At the same time, interconnection can be achieved between the server, BMC and MCU, facilitating remote function development and implementation.
[0051] In some embodiments, establishing a message queue telemetry transport protocol connection between a controller in a client and a server includes:
[0052] The controller in the server and client establishes a transmission control protocol connection;
[0053] Based on the Transmission Control Protocol, the server sends a message to the controller in the client requesting to establish a message queue telemetry transport protocol connection;
[0054] The controller in the client returns a reply message to the server;
[0055] In response to the reply message received by the server being a connection consent message, a message queue telemetry transmission protocol connection is established between the controller in the client and the server.
[0056] Here, the Transmission Control Protocol is a connection-oriented, reliable transport layer communication protocol that provides reliable data transmission services between application programs on different hosts in the network.
[0057] Here, a message is a data unit exchanged between two nodes in a network. It can carry control information or application data. A message usually consists of a header, a payload, optional options, and a trailer.
[0058] The reply message may include a connection approval message and a connection disapproval message.
[0059] In one embodiment, the transmission control protocol connection failure may be determined by the interruption of the transmission control protocol connection monitoring or the inability to ping the management platform IP.
[0060] In this way, by combining the transmission control protocol with the message queue telemetry transmission protocol connection, transmission stability and reliability can be guaranteed, while also providing efficient and flexible message delivery capabilities; at the same time, unified sending and receiving protocols can reduce the hardware pressure on the server side and improve the efficiency of server-side software development.
[0061] In some specific embodiments, the server determines a command controller and an execution controller in at least one controller based on one or more of task information, a location of the controller, device capabilities of a device corresponding to the controller, and a priority of the controller, including:
[0062] Determining, based on the task information, an importance ranking of one or more of a location of the controller, a device capability of a device corresponding to the controller, and a priority of the controller;
[0063] Sort by importance and build a judgment matrix;
[0064] Calculating, by using a judgment matrix, a weight of one or more of a position of the controller, a device capability of a device corresponding to the controller, and a priority of the controller;
[0065] Calculating a score for at least one controller based on one or more of a location of the controller, a device capability of a device corresponding to the controller, and a priority of the controller in combination with a weight;
[0066] A command controller and an execution controller are determined in at least one controller according to the score.
[0067] Here, the importance of each parameter varies according to different task information.
[0068] Among them, according to the score, the one with high score is used as the command controller and the one with low score is used as the execution controller.
[0069] Here, the data in the judgment matrix is the importance score between each two parameters.
[0070] Specifically, a judgment matrix is constructed based on the importance ranking. For example, assuming that the task information is ranked by importance as location, equipment capability, and priority, the importance scores between location and equipment capability, location and priority, and equipment capability and priority are calculated based on a preset comparison rule. The comparison rule can be a 1-9 scale, where 1 means factors A and B are equally important; 3: Factor A is slightly more important than B; 5: Factor A is significantly more important than B; 7: Factor A is strongly more important than B; and 9: Factor A is extremely more important than B. If B is more important than A, a score is used to represent this. For example, if B is slightly more important than A, A's score is 1 / 3.
[0071] Specifically, according to the importance score between each parameter and other parameters, the geometric mean of the parameter is calculated, and the geometric mean is normalized to obtain the weight of the parameter.
[0072] In one embodiment, the judgment matrix is checked for consistency by calculating consistency indicators, randomly querying consistency indicators, and / or calculating consistency ratios. A dynamic feedback mechanism can also be designed to adjust weights and scores in real time based on task execution and system status. In addition, a machine learning algorithm can be introduced to optimize weight distribution based on historical data. This can improve the accuracy of weights.
[0073] In this way, by using the hierarchical analysis method to determine the command controller and the execution controller, the combination of qualitative and quantitative analysis can be achieved, the results obtained are more accurate, and resource allocation is optimized.
[0074] In some specific embodiments, the execution controller receives, through the server, a control message published by the command controller through a message queue telemetry transmission protocol, including:
[0075] According to the topic of the control message corresponding to the command controller, the execution controller subscribes to the topic of the control message;
[0076] According to the status feedback topic corresponding to the execution controller, the command controller subscribes to the status feedback topic.
[0077] Here, topics are used to categorize and route messages, allowing publishers and subscribers to exchange information through well-defined topics.
[0078] The status feedback may be the return of the execution result or the reporting of status information.
[0079] For example, assuming that the command controller is a BMC, the subject of the control message may be bmc / control; assuming that the execution controller is an MCU, the subject of the status feedback may be mcu / sensor_data.
[0080] Specifically, the command controller publishes a control message, and since the execution controller subscribes to the topic of the control message, the execution controller can receive the execution message. For example, the message can be forwarded by the server.
[0081] In this way, publishers and subscribers can be made independent of each other, enhancing the flexibility of the system; supporting one-to-many message propagation and improving communication efficiency.
[0082] In some specific embodiments, the execution controller receives, through the server, a control message issued by the command controller through a message queue telemetry transmission protocol, and controls the device corresponding to the execution controller according to the control message, including:
[0083] The execution controller parses the control message and obtains the parameters of the control message;
[0084] The execution controller verifies the integrity, timeliness and rationality of the control message based on the parameters of the control message and the preset rules;
[0085] In response to the control message passing the verification, obtaining a control mode, a controller type, a device number, and a control content, where the controller type includes a first controller and a second controller, and the control mode includes single-device control and multi-device control;
[0086] In response to the control mode being single device control, the controller determines the control object according to the device code;
[0087] In response to the control mode being multi-device control, the execution controller determines a control object according to a controller type, wherein the control object includes at least one controller;
[0088] The control object controls the corresponding device according to the control content and generates the execution result;
[0089] By controlling the processing code of the message queue telemetry transmission protocol in the object, a response message corresponding to the message queue telemetry transmission protocol is generated according to the execution result.
[0090] Here, the first controller may be a BMC, and the second controller may be an MCU.
[0091] Here, each controller stores MQTT protocol-related codes for parsing control messages.
[0092] The parameters of the control message may include parameters such as timestamp, session identifier, interface protocol version, effective time, operation type, control mode, and controller type. For example, the control message may store the above parameters through fields such as timeStamp, seqNum, protocolVersion, time, and power. The timeStamp field stores the timestamp, which is UTC time, in milliseconds, accurate to the millisecond; the seqNum field stores the session unique identifier; the protocolVersion field stores the interface protocol version; the time field stores the effective time, with 0 indicating immediate effect and values greater than 0 indicating UTC time; and the power field stores the operation type, with 0 indicating power on, 1 indicating power off, and 2 indicating restart.
[0093] The preset rules may include control message format standards, timestamp standards, and parameter range standards. For example, the integrity of the control information can be determined by verifying the legitimacy of the format, the timeliness can be determined by verifying whether the timestamp is within the permitted range, and the rationality can be determined by verifying whether the parameters are within the permitted range.
[0094] For example, the control mode and controller type can be stored through the Des field. The 0th to 2nd bits in the Des field are used to store the destination of the message (i.e., the control type), where 000 indicates that the destination is a computing unit, 1 indicates BMC, and 2 indicates a system consisting of an MCU and a sensor; the 8th bit in the Des field is used to store the control mode, where 0 indicates operating a single device and 1 indicates operating all devices.
[0095] For example, the device number may be stored in a PN field, and the PN field stores the asset information of the device.
[0096] For example, the response message may include fields such as timeStamp, seqNum, PN, and status, which are used to inform the execution controller whether the device operation was successful. The timeStamp field stores the timestamp; the seqNum field stores the unique session identifier; the PN field stores the device PN; and the status field stores the status code, with 0 indicating failure and 1 indicating success.
[0097] Specifically, all execution controllers that subscribe to the topic receive control messages, parse the control messages in each execution controller respectively, and determine whether the control message is a control message for itself. First, identify the operation type to determine whether it is for BMC or MCU. If the type is correct, proceed to the next step of judgment. If the type is wrong, end the operation and further determine whether the operation mode is multi-device control or single-device control. When the operation mode is multi-device control, execute the operation directly. When the operation mode is single-device control, read the device code to determine whether it is the device corresponding to the code. If not, end the operation. If so, execute the operation.
[0098] In this way, collaborative management of multiple types of devices can be achieved, and closed-loop verification can be achieved through response messages to ensure that instructions are delivered.
[0099] In some specific embodiments, after establishing a message queue telemetry transmission protocol connection between the controller in the client and the server, the method further includes:
[0100] Get the parameters of the message queue telemetry transport protocol connection between the controller in the client and the server, including the timeout period;
[0101] In response to not detecting data interaction within the timeout period, the controller in the client sends a probe message to the server;
[0102] When the controller in the client does not receive the reply message sent by the server, it is determined that a message queue telemetry transmission protocol connection between the controller in the client and the server is faulty.
[0103] Here, the timeout period is used to ensure that the connection between the client and the server remains active. For example, it can be set to 1.5 times the keep-alive period of the MQTT protocol.
[0104] Here, the probe message can be PINGREQ, that is, a request message sent by the client to the server to check whether the connection between the client and the server is still active; the reply message can be PINGREQ, that is, a response message from the server to the PINGREQ sent by the client to confirm that the server is still online and can communicate normally.
[0105] Specifically, if there is no data interaction between the client and the server within 1.5 times the keep-alive time, the client will send a PINGREQ to detect the server. If no PINGREQ response is received, the client will determine that the connection is disconnected.
[0106] In one embodiment, the length of the timeout period can be dynamically adjusted according to specific network conditions and application scenarios to achieve more accurate fault judgment.
[0107] In one embodiment, when the quality of service (QoS) is 1, after the client sends information to the server or the server sends information to the client, if no response is received within a preset time, fault detection is also required.
[0108] In one embodiment, when the client attempts to reconnect and fails multiple times, it is determined that there is a fault in the protocol connection.
[0109] In this way, connection failures can be discovered in time, pseudo-dead states can be avoided, and system reliability can be improved.
[0110] In some specific embodiments, after determining that a message queue telemetry transmission protocol connection between the controller in the client and the server is faulty, the method further includes:
[0111] Determine the target server based on the preset backup server address, replace the failed server with the target server, and establish a message queue telemetry transmission protocol connection between the controller in the client and the target server, where the target server is the device corresponding to the client's controller;
[0112] In response to the failed server recovering, the target server sends a recovery message to the controller in the client;
[0113] The controller in the client receives the recovery message and disconnects from the target server;
[0114] The controller in the client re-establishes the message queue telemetry transport protocol connection with the server;
[0115] The target server synchronizes the data during the server failure to the server through the message queue telemetry transmission protocol.
[0116] Here, the backup server is the device corresponding to the client's controller.
[0117] Here, the preset backup server address may include one or more fixed addresses. The preset backup server address may be pre-configured in the server. After receiving the preset backup server address, the server sends it to the controller of the client. The controller receives and stores the preset backup server address.
[0118] In one embodiment, a backup server can be determined through a dynamic election method based on the parameters of each server and an election rule.
[0119] Specifically, according to the preset backup server address, the backup server is determined, and the connection between each controller in the client and the original server is disconnected. Each controller in the client establishes an MQTT protocol connection with the backup server according to the preset backup server address; when the faulty original server is restored, the backup server sends a message broadcast to all clients to notify the client's controller that the original server has been restored. The client's controller disconnects from the backup server and establishes an MQTT protocol connection with the original server. The backup server switches to the client and establishes an MQTT protocol connection with the original server. The backup server sends the data during the original server failure to the original server to achieve data synchronization.
[0120] In one embodiment, after a server failure, the faulty part can be specifically identified by the following method: the backup server sends a power status query message to the BMC of the original server in MQTT. If the reply is that the server is in a shutdown state, an automatic startup will be issued and a log will be recorded. If the reply is that the server is in a power-on state, it is an OS system problem, and a shutdown and restart instruction will be issued, and a log and an alarm will be recorded. If the server cannot be started, hardware damage may occur, and the BMC log will be exported and the management platform log and alarm will be recorded. If no reply is received, it means that there is a problem with the overall status of the server (hardware / power supply / network problem), and a log and an alarm will be recorded.
[0121] Specifically, by detecting the connections between multiple controllers and servers, it can be determined whether the fault is in the controller or the server.
[0122] In this way, automatic fault recovery can be achieved and data consistency can be guaranteed.
[0123] In one embodiment, Figure 2 This is a flow chart of establishing a protocol connection in an embodiment of the present application. Figure 2 As shown, the process of establishing a protocol connection in the present application includes: S201: establishing a transmission control protocol connection between the client controller and the server; S202: the server sends a connection request message to the client controller; S203: the server determines whether it has received a reply message returned by the controller; if not, returns to S202; if received, executes S204: the execution controller and the command controller subscribe to each other's topics; S205: the command controller sends a control message; S206: the execution controller determines whether it has received the control message; if not, returns to S205; if received, the execution controller returns the execution result.
[0124] In one embodiment, Figure 3 This is a flow chart of the controller sending a control message in an embodiment of the present application, such as Figure 3 As shown, the process of the controller sending control messages in this application includes: the client MCU subscribes to the topic of the client BMC1; the client BMC1 sends a command to the MCU; the server forwards the command from the BMC to the MCU, the client MCU receives the forwarded command, parses the command, and determines whether it is a command sent to itself. If so, the command is executed, and after execution, the execution result is returned to the BMC (for example, returning the sensor reading or whether the cabinet unlocking is successful).
[0125] In one embodiment, Figure 4 This is a flow chart of the process of the server sending a control message in an embodiment of the present application, such as Figure 4 As shown, the process of the server sending control messages in this application includes: the client and the management platform (i.e., the server) establish an MQTT protocol connection and subscribe to the topic; the management platform sends a control message (for example, the server will publish a message with / BMC / power as the topic, and this message will be received by all BMC clients that have subscribed to this topic); the client parses the message (for example, parses it in the MQTT protocol related code); executes and returns the execution result (for example, returns an Errorcode); parses the execution result into the corresponding MQTT response (for example, parses it through the MQTT processing code); and sends the MQTT response result to the management platform.
[0126] In one embodiment, Figure 5 This is a schematic diagram of the architecture in the embodiment of the present application, such as Figure 5As shown, the architecture in this application includes: a management platform (i.e., a server), server 1 OS, server 1 BMC, server 2 OS, server 2 BMC, and an MCU sensor.
[0127] It should be understood that although Figure 1-5 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 1-5 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0129] An embodiment of the present application also provides a remote control device, which is applied to a control system, wherein the control system includes a client and a server, and the client includes at least one controller. The device includes: an establishment module 601, which is used to establish a message queue telemetry transmission protocol connection between the controller in the client and the server; a first processing module 602, which is used for the server to obtain one or more of task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; a second processing module 603, which is used for the server to determine a command controller and an execution controller in at least one controller based on one or more of task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; a third processing module 604, which is used for the execution controller to receive, through the server, a control message issued by the command controller through the message queue telemetry transmission protocol, and control the device corresponding to the execution controller according to the control message.
[0130] As a preferred implementation method, in an embodiment of the present application, the establishment module 601 is specifically used to: establish a transmission control protocol connection between the server and the controller in the client; based on the transmission control protocol, the server sends a message to the controller in the client requesting to establish a message queue telemetry transmission protocol connection; the controller in the client returns a reply message to the server; in response to the reply message received by the server being a connection consent message, a message queue telemetry transmission protocol connection is established between the controller in the client and the server.
[0131] As a preferred implementation manner, in an embodiment of the present application, the second processing module 603 is specifically used to: determine the importance ranking of one or more of the controller's location, the device capability of the controller's corresponding device, and the controller's priority based on task information; construct a judgment matrix based on the importance ranking; calculate the weights of one or more of the controller's location, the device capability of the controller's corresponding device, and the controller's priority through the judgment matrix; calculate the score of at least one controller based on the controller's location, the device capability of the controller's corresponding device, and the controller's priority, combined with the weights; and determine a command controller and an execution controller in at least one controller based on the score.
[0132] As a preferred implementation, in an embodiment of the present application, the third processing module 604 is specifically used to: execute the controller to subscribe to the topic of the control message according to the topic of the control message corresponding to the command controller; and command the controller to subscribe to the topic of the status feedback according to the topic of the status feedback corresponding to the execution controller.
[0133] As a preferred implementation method, in an embodiment of the present application, the third processing module 604 is specifically further used to: execute the controller to parse the control message and obtain the parameters of the control message; execute the controller to verify the integrity, timeliness and rationality of the control message based on the parameters of the control message in combination with preset rules; in response to the control message passing the verification, obtain the control mode, controller type, device number and control content, the controller type includes a first controller and a second controller, and the control mode includes single-device control and multi-device control; in response to the control mode being single-device control, the controller determines the control object based on the device code; in response to the control mode being multi-device control, the execution controller determines the control object based on the controller type, wherein the control object includes at least one controller; the control object controls the corresponding device according to the control content and generates an execution result; through the processing code of the message queue telemetry transmission protocol in the control object, a response message corresponding to the message queue telemetry transmission protocol is generated according to the execution result.
[0134] As a preferred implementation manner, in an embodiment of the present application, the device also includes a first monitoring module, which is used to: obtain parameters of the message queue telemetry transmission protocol connection between the controller in the client and the server, wherein the parameters include a timeout period; in response to no data interaction being detected within the timeout period, the controller in the client sends a probe message to the server; when the controller in the client does not receive a reply message sent by the server, it is determined that there is a fault in the message queue telemetry transmission protocol connection between the controller in the client and the server.
[0135] As a preferred implementation manner, in an embodiment of the present application, the device also includes: a fault handling module, the fault handling module is used to: determine the target server according to a preset backup server address, replace the faulty server with the target server, and establish a message queue telemetry transmission protocol connection between the controller in the client and the target server, wherein the target server is the device corresponding to the controller of the client; in response to the recovery of the faulty server, the target server sends a recovery message to the controller in the client; the controller in the client receives the recovery message and disconnects from the target server; the controller in the client re-establishes the message queue telemetry transmission protocol connection with the server; the target server synchronizes the data during the server failure to the server through the message queue telemetry transmission protocol.
[0136] For the description of the features in the embodiment corresponding to the remote control device, reference can be made to the relevant description of the embodiment corresponding to the remote control method, and no further details will be given here.
[0137] The embodiment of the present application further provides an electronic device, which may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The electronic device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a remote control method is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.
[0138] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the electronic device to which the solution of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0139] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented: S1: establishing a message queue telemetry transmission protocol connection between a controller in a client and a server; S2: the server obtains one or more of task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; S3: the server determines a command controller and an execution controller in at least one controller based on one or more of the task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; S4: the execution controller receives, through the server, a control message issued by the command controller through the message queue telemetry transmission protocol, and controls the device corresponding to the execution controller according to the control message.
[0140] In one embodiment, when the processor executes the computer program, it also implements the following steps: the server and the controller in the client establish a transmission control protocol connection; based on the transmission control protocol, the server sends a message to the controller in the client requesting to establish a message queue telemetry transmission protocol connection; the controller in the client returns a reply message to the server; in response to the reply message received by the server being a connection consent message, a message queue telemetry transmission protocol connection is established between the controller in the client and the server.
[0141] In one embodiment, when the processor executes the computer program, it also implements the following steps: determining the importance ranking of one or more of the controller's location, the device capability of the controller's corresponding device, and the controller's priority based on the task information; constructing a judgment matrix based on the importance ranking; calculating the weights of one or more of the controller's location, the device capability of the controller's corresponding device, and the controller's priority through the judgment matrix; calculating the score of at least one controller based on the controller's location, the device capability of the controller's corresponding device, and the controller's priority, combined with the weights; and determining a command controller and an execution controller in at least one controller based on the score.
[0142] In one embodiment, when the processor executes the computer program, it further implements the following steps: according to the subject of the control message corresponding to the command controller, the execution controller subscribes to the subject of the control message; according to the subject of the status feedback corresponding to the execution controller, the command controller subscribes to the subject of the status feedback.
[0143] In one embodiment, when the processor executes the computer program, it also implements the following steps: the execution controller parses the control message to obtain the parameters of the control message; the execution controller verifies the integrity, timeliness and rationality of the control message based on the parameters of the control message in combination with preset rules; in response to the control message passing the verification, the control mode, controller type, device number and control content are obtained, the controller type includes a first controller and a second controller, and the control mode includes single-device control and multi-device control; in response to the control mode being single-device control, the controller determines the control object based on the device code; in response to the control mode being multi-device control, the execution controller determines the control object based on the controller type, wherein the control object includes at least one controller; the control object controls the corresponding device according to the control content and generates an execution result; through the processing code of the message queue telemetry transmission protocol in the control object, a response message corresponding to the message queue telemetry transmission protocol is generated according to the execution result.
[0144] In one embodiment, when the processor executes the computer program, it also implements the following steps: obtaining parameters of the message queue telemetry transmission protocol connection between the controller in the client and the server, where the parameters include a timeout period; in response to no data interaction being detected within the timeout period, the controller in the client sends a probe message to the server; when the controller in the client does not receive a reply message sent by the server, it determines that there is a fault in the message queue telemetry transmission protocol connection between the controller in the client and the server.
[0145] In one embodiment, when the processor executes the computer program, it further implements the following steps: determining the target server according to the preset backup server address, replacing the failed server with the target server, and establishing
[0146] A message queue telemetry transmission protocol connection is established between the controller in the client and the target server, where the target server is the device corresponding to the controller in the client; in response to the recovery of the failed server, the target server sends a recovery message to the controller in the client; the controller in the client receives the recovery message and disconnects from the target server; the controller in the client re-establishes a message queue telemetry transmission protocol connection with the server; the target server synchronizes the data during the server failure to the server via the message queue telemetry transmission protocol.
[0147] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: S1: establishing a message queue telemetry transmission protocol connection between a controller in a client and a server; S2: the server obtains one or more of task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; S3: the server determines a command controller and an execution controller in at least one controller based on one or more of the task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; S4: the execution controller receives a control message issued by the command controller through the message queue telemetry transmission protocol through the server, and controls the device corresponding to the execution controller according to the control message.
[0148] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: the server and the controller in the client establish a transmission control protocol connection; based on the transmission control protocol, the server sends a message to the controller in the client requesting to establish a message queue telemetry transmission protocol connection; the controller in the client returns a reply message to the server; in response to the reply message received by the server being a connection consent message, a message queue telemetry transmission protocol connection is established between the controller in the client and the server.
[0149] In one embodiment, when the processor executes the computer program, it also implements the following steps: determining the importance ranking of one or more of the controller's location, the device capability of the controller's corresponding device, and the controller's priority based on the task information; constructing a judgment matrix based on the importance ranking; calculating the weights of one or more of the controller's location, the device capability of the controller's corresponding device, and the controller's priority through the judgment matrix; calculating the score of at least one controller based on the controller's location, the device capability of the controller's corresponding device, and the controller's priority, combined with the weights; and determining a command controller and an execution controller in at least one controller based on the score.
[0150] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: according to the subject of the control message corresponding to the command controller, the execution controller subscribes to the subject of the control message; according to the subject of the status feedback corresponding to the execution controller, the command controller subscribes to the subject of the status feedback.
[0151] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: the execution controller parses the control message to obtain the parameters of the control message; the execution controller verifies the integrity, timeliness and rationality of the control message based on the parameters of the control message in combination with preset rules; in response to the control message passing the verification, the control mode, controller type, device number and control content are obtained, the controller type includes a first controller and a second controller, and the control mode includes single-device control and multi-device control; in response to the control mode being single-device control, the controller determines the control object based on the device code; in response to the control mode being multi-device control, the execution controller determines the control object based on the controller type, wherein the control object includes at least one controller; the control object controls the corresponding device according to the control content and generates an execution result; through the processing code of the message queue telemetry transmission protocol in the control object, a response message corresponding to the message queue telemetry transmission protocol is generated according to the execution result.
[0152] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining parameters of the message queue telemetry transmission protocol connection between the controller in the client and the server, where the parameters include a timeout period; in response to no data interaction being detected within the timeout period, the controller in the client sends a probe message to the server; when the controller in the client does not receive a reply message sent by the server, it is determined that there is a fault in the message queue telemetry transmission protocol connection between the controller in the client and the server.
[0153] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: according to the preset backup server address, the target server is determined, the failed server is replaced by the target server, and a message queue telemetry transmission protocol connection is established between the controller in the client and the target server, wherein the target server is the device corresponding to the controller of the client; in response to the recovery of the failed server, the target server sends a recovery message to the controller in the client; the controller in the client receives the recovery message and disconnects from the target server; the controller in the client re-establishes the message queue telemetry transmission protocol connection with the server; the target server synchronizes the data during the server failure to the server through the message queue telemetry transmission protocol.
[0154] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0155] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0156] The above embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A remote control method, characterized in that: Applied to a control system, the control system includes a server and multiple clients, the clients include a controller, and the method includes: Establishing a message queue telemetry transmission protocol connection between the controller in the client and the server; The server obtains one or more of task information, a location of the controller, device capabilities of a device corresponding to the controller, and a priority of the controller; The server determines a command controller and an execution controller in at least one controller based on one or more of the task information, the location of the controller, the device capabilities of the device corresponding to the controller, and the priority of the controller; the execution controller receives the control message published by the command controller through the message queue telemetry transmission protocol through the server, and controls the device corresponding to the execution controller according to the control message.
2. The remote control method according to claim 1, wherein: The establishing of a message queue telemetry transmission protocol connection between the controller in the client and the server includes: The server establishes a transmission control protocol connection with the controller in the client; Based on the transmission control protocol, the server sends a message to the controller in the client requesting to establish a message queue telemetry transmission protocol connection; The controller in the client returns a reply message to the server; In response to the reply message received by the server being a connection consent message, a message queue telemetry transmission protocol connection is established between the controller in the client and the server.
3. The remote control method according to claim 1, wherein: The server determines, in at least one controller, a command controller and an execution controller based on one or more of the task information, a location of the controller, a device capability of a device corresponding to the controller, and a priority of the controller, including: determining, based on the task information, an importance ranking of one or more of a location of the controller, a device capability of a device corresponding to the controller, and a priority of the controller; Sorting according to the importance, constructing a judgment matrix; Calculating, by using the judgment matrix, a weight of one or more of the position of the controller, a device capability of a device corresponding to the controller, and a priority of the controller; Calculating a score for the at least one controller based on one or more of a location of the controller, a device capability of a device corresponding to the controller, and a priority of the controller in combination with the weight; A command controller and an execution controller are determined in the at least one controller according to the score.
4. The remote control method according to claim 1, wherein: The execution controller receives, through the server, a control message published by the command controller through the message queue telemetry transmission protocol, including: According to the subject of the control message corresponding to the command controller, the execution controller subscribes to the subject of the control message; according to the subject of the status feedback corresponding to the execution controller, the command controller subscribes to the subject of the status feedback.
5. The remote control method according to claim 1, wherein: The execution controller receives, through the server, a control message published by the command controller through the message queue telemetry transmission protocol, and controls a device corresponding to the execution controller according to the control message, including: The execution controller parses the control message to obtain parameters of the control message; The execution controller verifies the integrity, timeliness and rationality of the control message according to the parameters of the control message and in combination with preset rules; In response to the control message passing verification, a control mode, a controller type, a device number, and a control content are acquired, where the controller type includes a first controller and a second controller, and the control mode includes single-device control and multi-device control; in response to the control mode being single-device control, the controller determines the control object according to the device code; in response to the control mode being multi-device control, the execution controller determines the control object according to the controller type, where the control object includes at least one controller; The control object controls the corresponding device according to the control content and generates an execution result; A response message corresponding to the message queue telemetry transmission protocol is generated according to the execution result through the processing code of the message queue telemetry transmission protocol in the control object.
6. The remote control method according to claim 1, wherein: After establishing a message queue telemetry transmission protocol connection between the controller in the client and the server, the method further includes: Obtaining parameters of a message queue telemetry transmission protocol connection between the controller in the client and the server, wherein the parameters include a timeout period; In response to not detecting data interaction within the timeout period, the controller in the client sends a detection message to the server; When the controller in the client does not receive the reply message sent by the server, it is determined that there is a fault in the message queue telemetry transmission protocol connection between the controller in the client and the server.
7. The remote control method according to claim 6, characterized in that: After determining that a message queue telemetry transmission protocol connection between the controller in the client and the server is faulty, the method further includes: Determine a target server according to a preset backup server address, replace the failed server with the target server, and establish a message queue telemetry transmission protocol connection between the controller in the client and the target server, wherein the target server is a device corresponding to the controller of the client; In response to the failed server being restored, the target server sends a recovery message to the controller in the client; the controller in the client receives the recovery message and disconnects from the target server; The controller in the client re-establishes a message queue telemetry transmission protocol connection with the server; The target server synchronizes the data during the server failure to the server through the message queue telemetry transmission protocol.
8. A remote control device, characterized in that: Applied to a control system, the control system includes a server and multiple clients, the clients include a controller, and the device includes: An establishment module for establishing a message queue telemetry transmission protocol connection between the controller in the client and the server; A first processing module is configured to obtain, from the server, one or more of task information, the location of the controller, the device capability of the device corresponding to the controller, and the priority of the controller; a second processing module, configured for the server to determine, in at least one controller, a command controller and an execution controller based on one or more of the task information, a location of the controller, a device capability of a device corresponding to the controller, and a priority of the controller; The third processing module is used for the execution controller to receive the control message published by the command controller through the message queue telemetry transmission protocol through the server, and control the device corresponding to the execution controller according to the control message.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the remote control method according to any one of claims 1 to 7 when executing a computer program.
10. A computer-readable storage medium, characterized in that A computer program is stored in the computer-readable storage medium, wherein when the computer program is executed by a processor, the steps of the remote control method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
A remote control method based on MQTT protocol
CN109088723A
Remote consultation control method and control system, computer equipment and medium
CN113593720A
Motion control method, motion control device and robot
CN114347020A
Internet of Things message service system, method and device based on MQTT and storage medium
CN117354349A
Reasoning apparatus and method for user adaptive service and context-aware knowledge system using its
KR1020090053178A