Device control method and apparatus, computer device, and storage medium
By judging the node identifier of the control node in the controlled cluster, the identifier of the current focus device is obtained and the target controlled device is determined, which solves the problem of inconsistent operation during the switching of multiple control terminals and improves the convenience and accuracy of synchronous switching.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA CONSTRUCTION BANK
- Filing Date
- 2023-08-16
- Publication Date
- 2026-04-14
AI Technical Summary
In situations where multiple control terminals jointly control multiple controlled devices, existing technologies suffer from inconsistent operations during control terminal switching, resulting in complex and inconvenient operation steps, high hardware switcher costs, and a limited number of controlled objects.
By determining the node identifier of the control node in the controlled cluster, the identifier of the current focus device is obtained, and the target controlled device is determined based on the control information, ensuring the consistency of the master and slave control nodes, avoiding repeated switching actions, and improving the convenience of synchronous switching.
This technology improves the convenience and accuracy of synchronous switching between control nodes when multiple control nodes jointly control multiple controlled devices, avoids repeated switching operations, and ensures the consistency of the controlled objects between master and slave control nodes.
Smart Images

Figure CN117092935B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a device control method, apparatus, computer equipment, and storage medium. Background Technology
[0002] With the development of hardware functions of various devices, the control system composed of the control terminal and the controlled device has become increasingly flexible. Most of the controlled devices support receiving control signals from different control terminals in order to switch between multiple systems.
[0003] However, in scenarios with multiple control terminals, inconsistencies in the controlled objects of different terminals may occur during the switching process. For example, if a mouse and keyboard, which should be controlling the same computer, switch their control objects at a certain moment, the computers they are currently controlling will be different. In this case, it is necessary to operate the control terminal that failed to complete the switch to change its control object. This operation method results in complex procedures.
[0004] The current solution involves hardware-based switching, connecting all control terminals to a switching device, such as a KVM switch (Keyboard, Video, Mouse Switch, etc.). The KVM switch then focuses multiple control terminals onto a single controlled object. However, this method requires separate hardware purchase, resulting in high costs. Furthermore, the number of controlled objects supported by the hardware is limited, and switching requires physical buttons on the hardware. Therefore, this method is not very convenient and is not suitable for widespread use. Summary of the Invention
[0005] Therefore, it is necessary to provide a device control method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the convenience of synchronous switching between control terminals when multiple control terminals jointly control multiple controlled devices, in order to address the above-mentioned technical problems.
[0006] In a first aspect, this application provides a device control method. The method is applied to any controlled device in a controlled cluster, wherein the controlled devices are communicatively connected to each other, the controlled cluster is controlled by a control cluster, and the control cluster includes at least one master control node and at least one slave control node. The method includes:
[0007] Receive control information from the control cluster, wherein the control information carries the node identifier of the corresponding control node;
[0008] The node type of the control node is determined based on the node identifier;
[0009] When the node type of the control node is a slave control node, the current focus device identifier is obtained, wherein the current focus device identifier indicates the controlled device currently corresponding to the master control node;
[0010] The target controlled device is determined based on the current focus device identifier;
[0011] The target controlled device is instructed to perform the operation indicated by the control information.
[0012] In one embodiment, after determining the node type of the control node based on the node identifier, the method further includes:
[0013] If the node type of the control node is a master control node, determine whether the control information indicates a switching operation;
[0014] When the control information indicates a switching operation, the target focus device identifier is determined based on the control information. ;
[0015] Update the current focus device identifier based on the target focus device identifier.
[0016] In one embodiment, the control information includes first instruction information, and determining whether the control information indicates a switching operation when the node type of the control node is a master control node includes:
[0017] Extract the target value indicated by the first instruction information in real time;
[0018] Determine whether the target value exceeds the preset value boundary;
[0019] If the target value does not exceed the preset value boundary, it is determined that the first instruction information did not indicate a switching operation;
[0020] If the target value exceeds the preset value boundary, the first instruction information indicates a switching operation.
[0021] In one embodiment, the control information includes second instruction information, and determining whether the control information indicates a switching operation when the node type of the control node is a master control node includes:
[0022] Obtain a preset set of combined instructions, wherein the set of combined instructions is used to store at least one combined instruction, the combined instruction being a combination of multiple second instruction information;
[0023] Detect whether the combination of adjacent second instruction information is stored in the combined instruction set;
[0024] If the combination of adjacent second instruction information is not stored in the combined instruction set, it is determined that the second instruction information does not indicate a switching operation;
[0025] When adjacent combinations of the second instruction information are stored in the combined instruction set, it is determined that the second instruction information indicates a switching operation.
[0026] In one embodiment, after determining the focus device identifier based on the control information when the control information indicates a switching operation, the method further includes:
[0027] Broadcast the current focus device identifier to other controlled devices.
[0028] In one embodiment, the operation of instructing the target controlled device to perform the control information instruction includes:
[0029] Determine whether the currently controlled device is the same as the target controlled device;
[0030] If the current controlled device is different from the target controlled device, the control information is forwarded to the target controlled device to instruct the target controlled device to perform the operation indicated by the control information.
[0031] Secondly, this application also provides a device control apparatus. The apparatus is applied to any one controlled device in a controlled cluster, wherein the controlled devices are communicatively connected to each other, the controlled cluster is controlled by a control cluster, the control cluster includes at least one master control node and at least one slave control node, and the apparatus includes:
[0032] An information receiving module is used to receive control information from the control cluster, wherein the control information carries the node identifier of the corresponding control node;
[0033] An information processing module is used to determine the node type of the control node based on the node identifier;
[0034] The focus determination module is used to obtain the current focus device identifier when the node type of the control node is a slave control node, wherein the current focus device identifier indicates the controlled device currently corresponding to the master control node;
[0035] The target determination module is used to determine the target controlled device based on the current focus device identifier;
[0036] The information response module is used to instruct the target controlled device to perform the operation indicated by the control information.
[0037] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the steps described in the first aspect.
[0038] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the steps described in the first aspect.
[0039] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the steps described in the first aspect.
[0040] The aforementioned device control methods, apparatus, computer equipment, storage media, and computer program products determine the source of control information by judging the node identifier. Since in a control cluster, the master control node and its corresponding slave control node should control the same controlled device, once the source of the control information is determined, it can be ascertained whether the control information originated from a slave control node. Therefore, after the slave control node sends the information, the master control node's currently corresponding controlled device is promptly identified based on the current focus device identifier, thus determining the target controlled device to perform the corresponding operation. Furthermore, after determining the target controlled device, the current controlled device instructs the target controlled device to execute the operation indicated by the control information. Therefore, if the current controlled device differs from the target controlled device, the receiving controlled device will not perform the corresponding operation. This ensures that even if the controlled object of a slave control node is not consistent with that of the master control node, the corresponding operation can still be performed by the controlled device corresponding to the master control node, guaranteeing the consistency between master and slave control nodes and avoiding repeated switching actions. In situations where multiple control nodes jointly control multiple controlled devices, this improves the convenience of synchronous switching between control nodes. Attached Figure Description
[0041] Figure 1 This is an application environment diagram of a device control method in one embodiment;
[0042] Figure 2 This is a flowchart illustrating a device control method in one embodiment;
[0043] Figure 3 This is a flowchart illustrating a device control method in another embodiment;
[0044] Figure 4 This is a flowchart illustrating step S302 of a device control method in one embodiment;
[0045] Figure 5This is a flowchart illustrating step S302 of a device control method in another embodiment;
[0046] Figure 6 This is a structural block diagram of a device control apparatus in one embodiment;
[0047] Figure 7 This is an internal structural diagram of a computer device in one embodiment;
[0048] Figure 8 This is a diagram of the internal structure of a computer device in another embodiment. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0050] The device control method provided in this application embodiment is applicable to any controlled device in a controlled cluster, such as... Figure 1 In the illustrated application environment, the controlled devices are interconnected, and the controlled cluster is controlled by a control cluster, which includes at least one master control node and at least one slave control node. Terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located on the cloud or other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0051] In one embodiment, such as Figure 2 As shown, a device control method is provided, which is applied to... Figure 1 Taking terminal 102 as an example, the explanation includes the following steps S202 to S210:
[0052] Step S202: Receive control information from the control cluster, wherein the control information carries the node identifier of the corresponding control node.
[0053] The control cluster refers to a cluster of nodes capable of issuing control information, which includes at least one master control node and at least one slave control node. The master control node can be an independent device that issues control information or a device submodule capable of issuing control information. Similarly, the slave control node can also be an independent device that issues control information or a device submodule capable of issuing control information.
[0054] Control information refers to information issued by the control cluster to instruct the controlled device to perform a certain operation. Control information can be issued directly by a control node in the control cluster, or it can be issued by a control node in the control cluster, processed by the processing module of the control cluster, and then sent to the controlled device.
[0055] For example, the controlled device can be a computer host device, and the control node can be a peripheral device such as a mouse or keyboard. For instance, the mouse can be the master control node, and the keyboard can be the slave control node. In the controlled cluster, multiple computer host devices are deployed with applications, enabling them to communicate and connect with each other, forming a communication channel between different computer host devices. In the control cluster, peripheral devices such as mice and keyboards communicate with the computer host device via Bluetooth. When a key is pressed on the keyboard, or the mouse moves or clicks a key, the corresponding signal is received as control information by the computer host device connected to the mouse or keyboard.
[0056] Step S204: Determine the node type of the control node based on the node identifier.
[0057] The node type refers to the type of control node that issues the above control information, which includes master control nodes and slave control nodes.
[0058] For example, each peripheral device corresponds to a unique node identifier, and an application is deployed on the main computer. The application can pre-store the device identifiers of the mouse and keyboard on the main computer and define the mapping relationship between the control identifier as the master control node and the device identifier as the slave control node and the corresponding device. When the main computer receives control information, it can determine the corresponding node type through the node identifier in the control information according to the preset mapping relationship.
[0059] Step S206: When the node type of the control node is a slave control node, obtain the current focus device identifier, wherein the current focus device identifier indicates the controlled device currently corresponding to the master control node.
[0060] Among them, the focus device identifier refers to the unique identifier of the controlled device controlled by the master control node at the moment the control information is received.
[0061] For example, the focus device identifier can be obtained by the computer host device in real time when the application receives the control information; or it can be pre-stored in the system by the computer host device and directly called when the control information is received.
[0062] Step S208: Determine the target controlled device based on the current focus device identifier.
[0063] The target controlled device refers to the controlled device that should perform the operation indicated by the current control information. Since there is currently one master control node and at least one slave control node, if the controlled device currently controlled by the slave control node is inconsistent with that of the master control node, the controlled device controlled by the master control node can be determined based on the obtained focus device identifier.
[0064] For example, the main computer device can pre-store the mapping relationship between device identifiers and controlled devices, and the mapping relationship can be modified and adjusted by an application deployed on the main computer device. When the focus device identifier is obtained, the main computer device can find its corresponding controlled device through this mapping relationship and identify it as the target controlled device.
[0065] Step S210: Instruct the target controlled device to perform the operation indicated by the control information.
[0066] The target controlled device can be the same as the current controlled device or it can be different from the current controlled device. If the target controlled device is the same as the current controlled device, it means that the controlled device controlled by the current slave control node is the same as the controlled device controlled by the master control node; if the target controlled device is different from the current controlled device, it means that the controlled device controlled by the current slave control node is different from the controlled device controlled by the master control node.
[0067] For example, after the computer main device determines the target controlled device, if the target controlled device is the same as the current controlled device, the current computer main device can directly execute the instruction operation of the corresponding peripheral device; if the target controlled device is different from the current controlled device, the current computer main device needs to instruct the target controlled device to execute the instruction operation of the corresponding peripheral device through the communication channel between controlled devices.
[0068] Furthermore, if the control node is a mouse, which is connected to the main computer device via Bluetooth, and the target controlled device is different from the current controlled device, then after the main computer device receives the control information, it will instruct another main computer device, which is the target controlled device, to perform the operation corresponding to the received control information through the communication channel established by the application. The application will also disconnect the mouse that sent the control information from the main computer device and establish a Bluetooth connection with the target controlled device so that subsequent control information can be directly received by the target controlled device.
[0069] In the aforementioned device control method, the source of control information is determined by judging the node identifier. Since the master control node and its corresponding slave control node should control the same controlled device in a control cluster, once the source of the control information is determined, it can be known whether the control information was issued by the slave control node. Therefore, after the slave control node issues the information, the controlled device currently corresponding to the master control node is determined in a timely manner based on the current focus device identifier, thus identifying the target controlled device that should perform the corresponding operation. Furthermore, after the target controlled device is determined, the current controlled device instructs the target controlled device to perform the operation indicated by the control information. Therefore, if the current controlled device is different from the target controlled device, the corresponding operation will not be performed by the controlled device receiving the control information. This ensures that even if the controlled object of the slave control node is not consistent with that of the master control node, the corresponding operation can still be performed by the controlled device corresponding to the master control node, guaranteeing the consistency between the master and slave control nodes and avoiding repeated switching actions. In the case where multiple control nodes jointly control multiple controlled devices, the convenience of synchronous switching of control nodes is improved.
[0070] In one embodiment, such as Figure 3 As shown, after step S204, the following steps S302 to S306 are also included:
[0071] Step S302: If the node type of the control node is a master control node, determine whether the control information indicates a switching operation.
[0072] The switching operation refers to changing the controlled device controlled by the current master control node.
[0073] For example, if the current control node is the master control node, the control information it issues can instruct the controlled device to perform certain specific operations, or it can instruct a switching operation, or it can instruct the controlled device to perform certain specific operations while instructing a switching operation. If the current control information includes information instructing a switching operation, it can be determined that the current control information instructs a switching operation, and other operations instructed by the current control information should be performed by the controlled device after the switch.
[0074] Step S304: When the control information indicates a switching operation, determine the target focus device identifier based on the control information.
[0075] For example, the main computer device can pre-deploy information about the switching operation. If the control information it receives contains information indicating the switching operation, it can match the relevant information in the data storage system to identify the switching operation. Furthermore, it can obtain the unique identifier of the target controlled device to be switched by parsing the control information and use it as the target focus device identifier. It can also determine the target controlled device based on the mapping relationship between the controlled device and the device identifier.
[0076] Step S306: Update the current focus device identifier based on the target focus device identifier.
[0077] Among them, the target focus device identifier refers to the identifier of the controlled device that should perform the specific operation in the control information as indicated by the control information received by the controlled device; the current focus device refers to the identifier of the controlled device currently recorded and controlled by the master control node.
[0078] For example, by updating the current focus device identifier to match the target focus device identifier, the updated focus device identifier can be synchronized when a message is subsequently received from the slave control node. This ensures that if the master control node switches the controlled object, the slave control node can also successfully switch over.
[0079] Furthermore, the main computer device can modify the corresponding field in the storage system every time the focus device identifier is updated, so that the latest focus device identifier can be obtained every time the current focus device identifier is called, thus ensuring the consistency of the control objects controlled by the master control node and the slave control node.
[0080] In this embodiment, by analyzing the information types contained in the control information, it is determined whether the current control information indicates a switch of the controlled device. When the controlled device needs to be switched, the current focus device identifier is updated. This ensures that the latest focus device identifier can be obtained every time the current focus device identifier needs to be called, so that the control object of the slave control node can always switch with the switch of the control object of the master control node without the need to switch the slave control node, thus improving the convenience of multi-device switching control.
[0081] In one embodiment, after step S304, the method further includes: broadcasting the current focus device identifier to other controlled devices.
[0082] For example, computer devices within the same controlled cluster establish communication channels with each other through an application, adhering to deployed communication protocols and formats. By placing these computer devices on the same local area network (LAN), the application can broadcast an updated current focus device identifier to other computer devices within the LAN using a selected communication protocol. Other computer devices within the LAN also have corresponding communication protocols and formats deployed to receive, parse, store, and process the broadcast current focus device identifier. Specifically, the received current focus device identifier is stored in a data storage system. If the computer device already has the corresponding information stored, it updates that information based on the received focus device identifier. If the computer device does not yet have the corresponding information stored, the received focus device identifier is stored for subsequent operations.
[0083] In this embodiment, by broadcasting the focus device identifier, the latest information of the device controlled by the master control node can be published to all controlled devices in the controlled cluster. This allows other controlled devices to automatically check their controlled objects by retrieving the focus device identifier when they receive control information from the slave control node. This ensures that the controlled objects of the slave control node are kept consistent with those of the master control node in a timely manner, without the need for corresponding switching operations on the slave control node. This shortens the control link and further improves the convenience and accuracy of multi-device switching control.
[0084] In one embodiment, such as Figure 4 As shown, the control information includes first instruction information, and step S302 includes the following steps S402 to S408:
[0085] Step S402: Extract the target value indicated by the first instruction information in real time.
[0086] The first instruction information includes information that can be compared with the numerical information stored in the controlled device, such as coordinate information and duration information.
[0087] For example, if the controlled device is a computer main unit and the main control node is a mouse, the first instruction information can be the cursor position information of the mouse on the computer main unit terminal. This position information is represented by horizontal and vertical coordinates, and the target value indicated by the first instruction information is the cursor's coordinate value. When the mouse moves, the computer main unit can obtain the cursor's position in real time through the corresponding computer program, thus achieving real-time extraction of its coordinate value.
[0088] In addition, the controlled device can also be a mobile device, the main control node can be a remote control device for the mobile device, the first instruction information is the location information of the mobile device, and the target value indicated by the first instruction information is the coordinate value of the mobile device. Map information of the current scene is pre-deployed in the mobile device. When the mobile device moves within the current scene, its location can be obtained in real time through the corresponding computer program, enabling real-time extraction of its coordinate values.
[0089] Step S404: Determine whether the target value exceeds the preset value boundary.
[0090] Among them, the preset numerical boundary refers to the limit value that is stored in the controlled device in advance and used to determine whether the controlled device needs to be switched.
[0091] For example, the preset numerical boundary can be the coordinates of the screen boundary of a computer terminal device. These coordinates can be pre-stored in the storage system of the computer terminal device. The computer system retrieves the coordinate values of the mouse in real time and compares them with the preset numerical boundary. When either the horizontal or vertical coordinate exceeds the portion corresponding to the preset numerical boundary, it is determined that the target value exceeds the preset numerical boundary; otherwise, it is determined that the target value has not exceeded the preset numerical boundary.
[0092] Step S406: If the target value does not exceed the preset value boundary, it is determined that the first instruction information did not indicate a switching operation.
[0093] For example, when the target value does not exceed the preset value boundary, it can be determined that the mouse has not yet moved to the edge of the screen of the currently controlled computer device, so there is no need to switch the computer device.
[0094] Step S408: If the target value exceeds the preset value boundary, determine that the first instruction information indicates a switching operation.
[0095] For example, when the target value exceeds the preset value boundary, it can be determined that the mouse has moved to the edge of the screen of the currently controlled computer device, and therefore, it is necessary to switch the computer device.
[0096] Furthermore, the switching operation needs to carry the unique identifier of the target controlled device. This can be achieved through an application deployed on the main computer device. A switching list can be preset in the application, and when a switching operation needs to be indicated, the target controlled device after the switch can be determined from the switching list. Optionally, a multi-dimensional switching list can be set to determine different target controlled devices based on different numerical boundaries.
[0097] In this embodiment, the method of identifying numerical boundaries is adopted to determine whether the controlled device needs to be switched based on the changes in values. This method is applicable to most control scenarios related to changes in values such as position and parameters, making its scope of application wider. At the same time, using numerical boundaries as the basis for switching the controlled device can improve the user experience and make it easier for users to understand and operate.
[0098] In one embodiment, such as Figure 5 As shown, the control information includes second instruction information, and step S302 includes the following steps S502 to S508:
[0099] Step S502: Obtain a preset combination instruction set, wherein the combination instruction set is used to store at least one combination instruction, and the combination instruction is a combination of multiple second instruction information.
[0100] In this context, a combined instruction set refers to one or more sets of instructions used to indicate a switching operation, where each instruction is composed of multiple second instruction information. Using combinations of multiple second instruction information to indicate a switching operation reduces the types and number of instruction information, simplifies the rules for instruction judgment, and further improves convenience.
[0101] For example, if the controlled device is a computer main unit and the main control node is a keyboard, the second instruction information can be the key information of the keyboard, the combination instruction is the key combination of the keyboard, and multiple key combinations form a set of key combinations, which are stored in the computer main unit.
[0102] Step S504: Detect whether the combination of adjacent second instruction information is stored in the combined instruction set.
[0103] For example, the main computer device can pre-input and store a set of combined instructions through a terminal device. When it receives a control signal, it first determines whether the current control signal and the adjacent signal together form a key combination recorded by the combined instruction set. The main computer device can specify the number and rules of key combinations when the instruction set is generated and modified, so that the main computer device can complete the judgment when receiving the instruction.
[0104] Step S506: If the combination of adjacent second instruction information is not stored in the combined instruction set, it is determined that the second instruction information does not indicate a switching operation.
[0105] For example, if the adjacent key information issued by the keyboard, acting as the main control node, cannot currently form a key combination in the combination instruction set, it can be assumed that the keyboard has not yet issued control information that can indicate a switching action. In this case, the system continues to receive the next control signal and continues to make the above judgment process.
[0106] Step S508: If the combination of adjacent second instruction information is stored in the combined instruction set, it is determined that the second instruction information indicates a switching operation.
[0107] When the adjacent key information issued by the keyboard, which is used as the main control node, can form a certain key combination in the combination instruction set, it can be considered that the keyboard has issued control information that can indicate the switching action.
[0108] In this embodiment, a combined instruction approach is adopted to combine individual second instruction information and reuse instruction information so that the controlled device can identify the control information indicating the switching operation. This can reduce the amount of data that the controlled device needs to store regarding the mapping relationship between control information and corresponding operations. Furthermore, even if the device corresponding to the control node does not have the ability to issue switching instructions, the switching of the controlled object can be completed without changing the hardware connection relationship, further improving the convenience and universality of multi-device switching control.
[0109] In one embodiment, step S210 includes:
[0110] Determine whether the current controlled device is the same as the target controlled device. If the current controlled device is different from the target controlled device, forward the control information to the target controlled device to instruct the target controlled device to perform the operation indicated by the control information.
[0111] For example, the computer's main device deploys a mapping relationship between controlled devices and device identifiers. This mapping relationship can determine whether the current controlled device and the target controlled device are the same. If the current controlled device and the target controlled device are the same, then the current controlled device is identified as the controlled device that needs to perform the control information instruction operation. If the current controlled device and the target controlled device are different, then the current controlled device needs to block the control information and does not need to perform the corresponding operation on the current controlled device. Instead, it needs to obtain the address and identification information of the target controlled device through the application program, and then forward the received control information to the target controlled device.
[0112] In this embodiment, when it is determined that the target controlled device is inconsistent with the current controlled device, the control information can be automatically forwarded to the target controlled device, so that the target controlled device can perform the corresponding operation according to the received control information. Therefore, even if the current controlled device of the control node is incorrect, it can still produce the effect of the control node controlling the correct controlled device, avoiding misoperation and improving the accuracy of multi-device control.
[0113] In another embodiment, the controlled device is a computer host device, and the control nodes are peripheral devices such as mice and keyboards, with the mouse serving as the master control node and the keyboard as the slave control node. In the controlled cluster, multiple computer host devices are deployed with applications, forming communication channels between different computer host devices. Peripheral devices such as mice and keyboards communicate with the computer host devices via Bluetooth.
[0114] First, the main computer device receives control information from peripheral devices via Bluetooth, parses the node type information carried in the control information, and thus determines whether the control node sending this control information is the mouse or the keyboard.
[0115] If the determination result indicates that the currently received control information comes from the keyboard, the current focus device identifier pre-stored in the computer's main unit is retrieved. Based on the current focus device identifier, the target controlled device is identified, and it is determined whether the current controlled device is the target controlled device. If the current controlled device is different from the target controlled device, the control information is forwarded to the target controlled device through the communication channel established by the application program, thereby instructing the target controlled device to execute the operation indicated by the control information.
[0116] If the determination result is that the currently received control information comes from the mouse, then the first instruction information is the cursor position information of the mouse on the computer terminal, which is represented by horizontal and vertical coordinates. The target value indicated by the first instruction information is the coordinate value of the cursor. When the mouse moves, the computer terminal can obtain the cursor position in real time through the corresponding computer program, realizing the real-time extraction of its coordinate value. Using the coordinates of the computer terminal screen boundary as a preset value boundary, these coordinates are pre-stored in the computer terminal's storage system. The computer system extracts the mouse coordinate value in real time and compares it with the preset value boundary. When either the horizontal or vertical coordinate exceeds the portion corresponding to the preset value boundary, it is determined that the target value exceeds the preset value boundary; otherwise, it is determined that the target value has not exceeded the preset value boundary. When the target value has not exceeded the preset value boundary, it can be determined that the mouse has not yet moved to the edge of the currently controlled computer terminal screen, therefore, there is no need to switch the computer terminal. When the target value exceeds the preset value boundary, it can be determined that the mouse has moved to the edge of the currently controlled computer terminal screen, therefore, it is necessary to switch the computer terminal.
[0117] Once the control information indicates a switching operation, the main computer device parses the control information to obtain the unique identifier of the target controlled device to be switched, uses it as the target focus device identifier, updates the current focus device identifier in the storage system based on the target focus device identifier, and determines the target controlled device based on the mapping relationship between the controlled device and the device identifier.
[0118] Next, the updated current focus device identifier is broadcast to other computer devices on the local area network (LAN) via the selected communication protocol through an application deployed on the main computer device. Other computer devices on the LAN, which also have the corresponding communication protocol and format deployed, will receive the broadcast current focus device identifier, parse, store, and process it. The received current focus device identifier will be stored in the data storage system. If the corresponding information is already stored on the main computer device, the information will be updated based on the received focus device identifier. If the corresponding information is not yet stored on the main computer device, the received focus device identifier will be stored for subsequent operations.
[0119] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0120] Based on the same inventive concept, this application also provides a device control apparatus for implementing the device control method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more device control apparatus embodiments provided below can be found in the limitations of the device control method described above, and will not be repeated here.
[0121] In one embodiment, such as Figure 6As shown, a device control apparatus is provided, which is applied to any controlled device in a controlled cluster. The controlled devices are interconnected, and the controlled cluster is controlled by a control cluster. The control cluster includes at least one master control node and at least one slave control node, and includes: an information receiving module 602, an information processing module 604, a focus determination module 606, a target determination module 608, and an information response module 610, wherein:
[0122] The information receiving module 602 is used to receive control information from the control cluster, wherein the control information carries the node identifier of the corresponding control node;
[0123] The information processing module 604 is used to determine the node type of the control node based on the node identifier;
[0124] The focus determination module 606 is used to obtain the current focus device identifier when the node type of the control node is a slave control node, wherein the current focus device identifier indicates the controlled device currently corresponding to the master control node;
[0125] Target determination module 608 is used to determine the target controlled device based on the current focus device identifier;
[0126] The information response module 610 is used to instruct the target controlled device to perform the operation indicated by the control information.
[0127] In one embodiment, the device further includes:
[0128] The information judgment module is used to determine whether the control information indicates a switching operation when the node type of the control node is the master control node.
[0129] The focus processing module is used to determine the target focus device identifier based on the control information when a switching operation is indicated. ;
[0130] The focus update module is used to update the current focus device identifier based on the target focus device identifier.
[0131] In one embodiment, the control information includes first instruction information, and the information judgment module includes:
[0132] The first extraction submodule is used to extract the target value indicated by the first instruction information in real time.
[0133] The first judgment submodule is used to determine whether the target value exceeds the preset value boundary;
[0134] The first determination unit is used to determine that the first instruction information did not indicate a switching operation when the target value does not exceed the preset value boundary.
[0135] The second determination unit is used to determine the switching operation indicated by the first instruction information when the target value exceeds the preset value boundary.
[0136] In one embodiment, the control information includes second instruction information, and the information judgment module includes:
[0137] The second extraction submodule is used to obtain a preset combination instruction set, wherein the combination instruction set is used to store at least one combination instruction, and the combination instruction is a combination of multiple second instruction information.
[0138] The second judgment submodule is used to detect whether the combination of adjacent second instruction information is stored in the combination instruction set;
[0139] The third determination unit is used to determine that the second instruction information does not indicate a switching operation when the combination of adjacent second instruction information is not stored in the combined instruction set.
[0140] The fourth determination unit is used to determine the second instruction information indicating a switching operation when adjacent second instruction information is stored in a combined instruction set.
[0141] In one embodiment, the device further includes:
[0142] The information broadcasting module is used to broadcast the identifier of the currently focused device to other controlled devices.
[0143] In one embodiment, the information response module 610 includes:
[0144] The target determination unit is used to determine whether the current controlled device is the same as the target controlled device.
[0145] The target forwarding unit is used to forward control information to the target controlled device when the current controlled device is different from the target controlled device, so as to instruct the target controlled device to perform the operation indicated by the control information.
[0146] Each module in the aforementioned equipment control device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0147] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores data such as controlled device identifiers and switching operation judgment rules. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a device control method.
[0148] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a device control method. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0149] Those skilled in the art will understand that Figure 8The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0150] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0151] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0152] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0153] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0154] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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.
[0155] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A device control method, characterized in that, The method is applied to any controlled device in a controlled cluster, wherein the controlled devices are communicatively connected to each other, the controlled cluster is controlled by a control cluster, and the control cluster includes at least one master control node and at least one slave control node. The method includes: Receive control information from the control cluster, wherein the control information carries the node identifier of the corresponding control node; The node type of the control node is determined based on the node identifier; When the node type of the control node is a slave control node, the current focus device identifier is obtained, wherein the current focus device identifier indicates the controlled device currently corresponding to the master control node; The target controlled device is determined based on the current focus device identifier; The target controlled device is instructed to perform the operation indicated by the control information.
2. The method according to claim 1, characterized in that, After determining the node type of the control node based on the node identifier, the method further includes: If the node type of the control node is a master control node, determine whether the control information indicates a switching operation; When the control information indicates a switching operation, the target focus device identifier is determined based on the control information. ; Update the current focus device identifier based on the target focus device identifier.
3. The method according to claim 2, characterized in that, The control information includes first instruction information. When the node type of the control node is a master control node, determining whether the control information indicates a switching operation includes: Extract the target value indicated by the first instruction information in real time; Determine whether the target value exceeds the preset value boundary; If the target value does not exceed the preset value boundary, it is determined that the first instruction information did not indicate a switching operation; If the target value exceeds the preset value boundary, the first instruction information indicates a switching operation.
4. The method according to claim 2, characterized in that, The control information includes second instruction information. When the node type of the control node is a master control node, determining whether the control information indicates a switching operation includes: Obtain a preset set of combined instructions, wherein the set of combined instructions is used to store at least one combined instruction, the combined instruction being a combination of multiple second instruction information; Detect whether the combination of adjacent second instruction information is stored in the combined instruction set; If the combination of adjacent second instruction information is not stored in the combined instruction set, it is determined that the second instruction information does not indicate a switching operation; When adjacent combinations of the second instruction information are stored in the combined instruction set, it is determined that the second instruction information indicates a switching operation.
5. The method according to claim 2, characterized in that, After determining the focus device identifier based on the control information when the control information indicates a switching operation, the method further includes: Broadcast the current focus device identifier to other controlled devices.
6. The method according to any one of claims 1-5, characterized in that, The operation of instructing the target controlled device to execute the control information instruction includes: Determine whether the currently controlled device is the same as the target controlled device; If the current controlled device is different from the target controlled device, the control information is forwarded to the target controlled device to instruct the target controlled device to perform the operation indicated by the control information.
7. A device control apparatus, characterized in that, The device is applied to any one of the controlled devices in a controlled cluster, wherein the controlled devices are communicatively connected to each other, the controlled cluster is controlled by a control cluster, the control cluster includes at least one master control node and at least one slave control node, and the device includes: An information receiving module is used to receive control information from the control cluster, wherein the control information carries the node identifier of the corresponding control node; An information processing module is used to determine the node type of the control node based on the node identifier; The focus determination module is used to obtain the current focus device identifier when the node type of the control node is a slave control node, wherein the current focus device identifier indicates the controlled device currently corresponding to the master control node; The target determination module is used to determine the target controlled device based on the current focus device identifier; The information response module is used to instruct the target controlled device to perform the operation indicated by the control information.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Synchronous control method and device for cluster equipment, computer equipment and storage medium
CN111427525A
Main / standby control method, device and equipment and readable storage medium
CN115914088A