Device control method, device, storage medium and electronic device
By establishing a content execution queue to determine the execution sequence of device control instructions, the problem of low device control efficiency is solved and the sequential processing and execution of device instructions is realized.
Patent Information
- Application Number
- CN202210911125.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-29
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-07-29
AI Technical Summary
In the device control scenario, when the control commands issued by the upper-layer application include multiple device attribute modifications, the device logic cannot be fully understood, resulting in a conflict in the order of command execution, resulting in low device control efficiency.
By obtaining device control instructions, a content execution queue is established according to the instruction content, the execution sequence of each instruction content is determined, and the target device execution operation is controlled based on the queue to ensure the correctness and efficiency of the instruction sequence.
It realizes the conversion of commands that cannot be accurately executed by the upper layer into command sequences that can be executed by the device, improves the device control efficiency, and solves the problem of low device control efficiency.
Smart Images

Figure CN115343984B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular, to a device control method, device, storage medium and electronic device. Background Art
[0002] In the device control scenario, when the control command sent by the upper-layer application at one time includes the modification of multiple device attributes, since the upper-layer application cannot fully understand the specific device logic, when multiple command contents are executed in the default order, conflicts are likely to occur, resulting in device control execution failure. Therefore, there is a problem of low device control efficiency.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present application provide a device control method, apparatus, storage medium and electronic device to at least solve the technical problem of low device control efficiency.
[0005] According to one aspect of an embodiment of the present application, there is provided a device control method, including:
[0006] Acquire a device control instruction triggered on a target device, wherein the device control instruction is used to instruct the target device to perform a control operation;
[0007] In the case where the device control instruction includes at least two instruction contents, obtaining a content execution queue according to the at least two instruction contents, wherein the content execution queue is used to determine the execution order of each instruction content in the at least two instruction contents;
[0008] Based on the content execution queue, the target device is controlled to perform the control operation.
[0009] According to another aspect of the embodiment of the present application, there is also provided a device control apparatus, including:
[0010] A first acquisition unit, configured to acquire a device control instruction triggered on a target device, wherein the device control instruction is used to instruct the target device to perform a control operation;
[0011] A second acquisition unit is used for acquiring a content execution queue according to the at least two instruction contents when the device control instruction includes at least two instruction contents, wherein the content execution queue is used to determine the execution order of each instruction content in the at least two instruction contents;
[0012] The first control unit is used to control the target device to perform the control operation based on the content execution queue.
[0013] As an optional solution, the above-mentioned second acquisition unit includes: a first acquisition module, which is used to acquire the above-mentioned content execution queue according to the above-mentioned at least two instruction contents when the above-mentioned device control instruction includes the above-mentioned at least two instruction contents and there is an association relationship between the above-mentioned at least two instruction contents.
[0014] As an optional solution, the above-mentioned first acquisition module includes: a first acquisition sub-module, used to obtain the attribute dimensions corresponding to the above-mentioned each instruction content, wherein the above-mentioned attribute dimensions are used to determine the above-mentioned association relationship; a first sorting sub-module, used to sort the above-mentioned each instruction content based on the above-mentioned attribute dimensions to obtain the above-mentioned content execution queue.
[0015] As an optional solution, the above-mentioned first control unit includes: a first control module, used to control the above-mentioned target device to execute the operations corresponding to the above-mentioned each instruction content according to the order corresponding to the above-mentioned content execution queue, until the operations corresponding to the above-mentioned each instruction content are all executed successfully, and it is determined that the above-mentioned control operation is executed successfully.
[0016] As an optional scheme, the above-mentioned first control module includes: a first control sub-module, which is used to control the above-mentioned target device to execute the first operation corresponding to the above-mentioned first instruction content when the above-mentioned content execution queue includes the first instruction content and the second instruction content, wherein the order of the above-mentioned first instruction content in the above-mentioned content execution queue is before the above-mentioned second instruction content; a second control sub-module, which is used to control the above-mentioned target device to execute the second operation corresponding to the above-mentioned second instruction content when the above-mentioned first operation is successfully executed; and a third control sub-module, which is used to determine that the above-mentioned control operation is successfully executed when the above-mentioned second operation is successfully executed.
[0017] As an optional scheme, the above-mentioned first control unit includes: a second control module, used to control the above-mentioned target device to execute the operations corresponding to the above-mentioned each instruction content according to the order corresponding to the above-mentioned content execution queue, and when at least one operation corresponding to the above-mentioned each instruction content fails to execute, adjust the order corresponding to the above-mentioned content execution queue, and re-control the above-mentioned target device to execute the operations corresponding to the above-mentioned each instruction content according to the order corresponding to the above-mentioned content execution queue, until all the operations corresponding to the above-mentioned each instruction content are successfully executed, and determine that the above-mentioned control operation is executed successfully.
[0018] As an optional scheme, the above-mentioned second control module includes: a fourth control sub-module, which is used to control the above-mentioned target device to execute the first operation corresponding to the above-mentioned first instruction content when the above-mentioned content execution queue includes the first instruction content and the second instruction content, wherein the order of the above-mentioned first instruction content in the above-mentioned content execution queue is before the above-mentioned second instruction content; a fifth control sub-module, which is used to adjust the order of the above-mentioned second instruction content in the above-mentioned content execution queue to before the above-mentioned first instruction content when the above-mentioned first operation fails to be executed; a sixth control sub-module, which is used to control the above-mentioned target device to execute the second operation corresponding to the above-mentioned second instruction content; a seventh control sub-module, which is used to control the above-mentioned target device to execute the above-mentioned first operation corresponding to the above-mentioned second instruction content when the above-mentioned second operation is successfully executed; and an eighth control sub-module, which is used to determine that the above-mentioned control operation is successfully executed when the above-mentioned first operation is successfully executed.
[0019] According to another aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above device control method.
[0020] According to another aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the device control method through the computer program.
[0021] In an embodiment of the present application, a device control instruction triggered on a target device is obtained, wherein the device control instruction is used to instruct the target device to perform a control operation; in the case where the device control instruction includes at least two instruction contents, a content execution queue is obtained according to the at least two instruction contents, wherein the content execution queue is used to determine the execution order of each instruction content in the at least two instruction contents; based on the content execution queue, the target device is controlled to perform the control operation, and the execution order of the instruction contents of at least two instructions is split and queued to form a content execution queue, thereby achieving the purpose of converting the commands issued by the upper layer that cannot be accurately executed into a single command or multiple commands that can actually be executed by the device, thereby achieving the technical effect of improving the efficiency of device control, and then solving the technical problem of low device control efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0023] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0024] Figure 1 is a schematic diagram of a hardware environment of an interaction method of a smart device according to an embodiment of the present application;
[0025] Figure 2 is a flow chart of an optional device control method according to an embodiment of the present application;
[0026] Figure 3 is a schematic diagram of an example of another optional device control method according to an embodiment of the present application;
[0027] Figure 4 is a schematic diagram of an example of another optional device control method according to an embodiment of the present application;
[0028] Figure 5 is a schematic diagram of an example of another optional device control method according to an embodiment of the present application;
[0029] Figure 6 is a schematic diagram of an example of another optional device control method according to an embodiment of the present application;
[0030] Figure 7 is a schematic diagram of an optional device control method apparatus according to an embodiment of the present application;
[0031] Figure 8 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0032] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0034] According to one aspect of an embodiment of the present application, a method for interacting with a smart home device is provided. The method for interacting with a smart home device is widely used in smart home, smart home, smart home device ecosystem, smart home ecosystem and other whole-house intelligent digital control application scenarios. Optionally, in this embodiment, the method for interacting with the smart home device can be applied to Figure 1 In the hardware environment composed of the terminal device 102 and the server 104 shown in FIG. Figure 1 As shown, the server 104 is connected to the terminal device 102 via a network, and can be used to provide services (such as application services, etc.) for the terminal or a client installed on the terminal. A database can be set on the server or independently of the server to provide data storage services for the server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data computing services for the server 104.
[0035] The network may include but is not limited to at least one of the following: wired network, wireless network. The wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network, and the wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal device 102 may be but is not limited to a PC, a mobile phone, a tablet computer, a smart air conditioner, a smart range hood, a smart refrigerator, a smart oven, a smart stove, a smart washing machine, a smart water heater, a smart washing device, a smart dishwasher, a smart projection device, a smart TV, a smart clothes drying rack, a smart curtain, a smart audio and video, a smart socket, a smart speaker, a smart fresh air device, a smart kitchen and bathroom device, a smart bathroom device, a smart sweeping robot, a smart window cleaning robot, a smart mopping robot, a smart air purification device, a smart steamer, a smart microwave oven, a smart kitchen treasure, a smart purifier, a smart water dispenser, a smart door lock, etc.
[0036] Optionally, as an optional implementation, as Figure 2 As shown, the device control method includes:
[0037] S202, obtaining a device control instruction triggered on a target device, wherein the device control instruction is used to instruct the target device to perform a control operation;
[0038] S204, when the device control instruction includes at least two instruction contents, obtaining a content execution queue according to the at least two instruction contents, wherein the content execution queue is used to determine an execution order of each instruction content in the at least two instruction contents;
[0039] S206: Based on the content execution queue, control the target device to execute a control operation.
[0040] Optionally, in this embodiment, the above device control method can be, but is not limited to, applied in the scenario of multiple control devices associated with the IOF system. In the Internet of Things (IoT) system, the upper-layer application party generally does not understand the specific device logic and cannot correctly issue the specific commands required by the device. The IoT system is required to process the commands issued by the upper-layer application party. When the control command issued by the upper-layer application at one time includes the modification of multiple device attributes, since there is a mutually exclusive or dependent relationship between device attributes, if the command to modify multiple attributes is directly issued to the device at one time, it may cause the device to fail to execute.
[0041] When the upper-layer application issues a command containing multiple mutually exclusive or dependent attribute modification commands, the present application splits the modification contents of multiple attributes in the command, queues all the split attribute modification contents according to the attribute dimensions in the order of the command contents, and forms a queue. If the command can be executed, the next attribute to be operated is calculated in sequence. If the command cannot be executed, it falls back to the previous attribute and requeues the calculation, so that the IOF system can convert the unexecutable command into one or more executable commands.
[0042] Optionally, in this embodiment, the target device may be, but is not limited to, an intelligent device that accepts control instructions and responds, the device control instructions are used to instruct the target device to perform control operations, and the content execution queue may be, but is not limited to, a queue with an execution order formed by sorting according to the attribute dimensions of each instruction content in at least two instruction contents.
[0043] Optionally, in this embodiment, the execution order of each instruction content in at least two instruction contents can be determined by but is not limited to using data structures such as queues and binary trees. When using a binary tree data structure, the control instructions are filled into the binary tree in order, and the root node of the binary tree is traversed to determine whether the operation corresponding to the content of the control instruction can be executed successfully. If the execution is successful, the left and right nodes of the root node of the binary tree are traversed to determine whether the execution operation is successful. The cycle is repeated in sequence. If the execution operation fails, the position of the binary tree node is adjusted and the above operation is performed again. By using a binary tree model to determine the execution order, the number of times the queue order is adjusted when using a queue is saved, the execution efficiency of the control instruction is improved, and the problem of low efficiency caused by multiple order adjustments can be overcome when executing multiple instructions.
[0044] It should be noted that, a device control instruction triggered on a target device is obtained, wherein the device control instruction is used to instruct the target device to perform a control operation; when the device control instruction includes at least two instruction contents, a content execution queue is obtained according to the at least two instruction contents, wherein the content execution queue is used to determine the execution order of each instruction content in the at least two instruction contents; based on the content execution queue, the target device is controlled to perform the control operation, and the execution order of each instruction content in the at least two instruction contents is determined by establishing an execution queue, thereby resolving conflicts caused by the order of the instruction contents and improving the control efficiency of the instructions.
[0045] To further illustrate, the optional Figure 3 As shown, when the scene sends instructions 302 to the target device to turn on and adjust the temperature to 25 degrees at the same time, there is no sequential execution relationship between the device control instructions, such as Figure 3 As shown in (a) in ; further, as Figure 3 As shown in (b) in FIG. 3 , when such an instruction is sent to a device in a shutdown state, the control instruction is first placed in the content execution queue 304, and the temperature is adjusted to 25 degrees according to the queue order. If it is found that the temperature cannot be adjusted because the device is in a shutdown state, the instruction execution fails, and the order of the control instructions in the content execution queue is readjusted to execute the power-on instruction first. If the instruction is executed successfully, the temperature adjustment to 25 degrees is executed. Figure 3 As shown in (c) in .
[0046] To further illustrate, the optional Figure 4 As shown, when multiple instructions are issued at the same time, in order to improve the computing efficiency of the loop adjustment queue, a binary tree data structure is used. For example, A, C, D, E, and B instructions are issued at the same time, and a binary tree data structure is used. At this time, the execution queue 402 is: ACDEB. When the execution of this queue fails, the root node is directly adjusted using the binary tree data structure to adjust the execution queue 402 to ABCDE.
[0047] Through the embodiments provided by the present application, a device control instruction triggered on a target device is obtained, wherein the device control instruction is used to instruct the target device to perform a control operation; in the case where the device control instruction includes at least two instruction contents, a content execution queue is obtained according to the at least two instruction contents, wherein the content execution queue is used to determine the execution order of each instruction content in the at least two instruction contents; based on the content execution queue, the target device is controlled to perform the control operation, and the execution order of the instruction contents of the at least two instructions is split and queued to form a content execution queue, thereby achieving the purpose of converting the commands issued by the upper layer that cannot be accurately executed into a single command or multiple commands that can actually be executed by the device, thereby achieving the technical effect of improving the efficiency of device control.
[0048] As an optional solution, in the case where the device control instruction includes at least two instruction contents, obtaining the content execution queue according to the at least two instruction contents includes:
[0049] When the device control instruction includes at least two instruction contents and there is an association relationship between the at least two instruction contents, a content execution queue is acquired according to the at least two instruction contents.
[0050] Optionally, in this embodiment, the association relationship between two instruction contents may be, but is not limited to, a mutually exclusive or dependent relationship, and no unnecessary limitation is made here.
[0051] Through the embodiments provided by the present application, when a device control instruction includes at least two instruction contents and there is an association relationship between at least two instruction contents, a content execution queue is obtained according to at least two instruction contents, thereby achieving the purpose of limiting the existence of a mutually exclusive or dependent relationship between the two instruction contents when two instructions are issued at the same time, thereby achieving the technical effect of resolving conflicts between instructions with an associated relationship.
[0052] As an optional solution, obtaining a content execution queue according to at least two instruction contents includes:
[0053] S1, obtaining the attribute dimension corresponding to each instruction content, wherein the attribute dimension is used to determine the association relationship;
[0054] S2, sorting the contents of each instruction based on the attribute dimension to obtain a content execution queue.
[0055] Optionally, in this embodiment, the attribute dimension is the attribute feature of the target device that can implement the device control instruction, which can be but not limited to a single attribute dimension or a combination of multiple attribute dimensions, and can include but not limited to: priority, execution frequency, complexity of executing instructions, matching degree and other attribute dimensions. The attribute dimension can be customized by the user according to the application scenarios of different devices, or set by the device manufacturer.
[0056] It should be noted that the attribute dimensions corresponding to each instruction content are obtained, wherein the attribute dimensions are used to determine the association relationship; the instruction contents are sorted based on the attribute dimensions to obtain the content execution queue, and different attribute dimensions corresponding to different devices are used as the basis for the execution queue to improve the accuracy of instruction control.
[0057] To further illustrate, the optional Figure 5 As shown, combining priority and execution frequency as attribute dimensions, the priority may be, but is not limited to, depending on the internal execution logic of the target device, and the execution frequency may be, but is not limited to, using a separate cache interval to record the historical number of times different instructions are executed in different time periods. For example, at 9 a.m., user A sends a command to the smart air conditioner "adjust to 18 degrees for cold air and blow downwards". The command is decomposed into "adjust to 18 degrees", "adjust to cold air" and "adjust to blow downwards" according to the key fields. At this time, the historical data 504 recorded in the cache interval is accessed. If it is detected that within this time period, the historical data 504 shows that in 90% of the cases, the order of successful execution of the instructions is: first adjust to cold air, then adjust to 18 degrees. Combined with the priority of the smart air conditioner device being mode control>temperature control>wind direction control, the execution order of the command is first adjust to cold air, then adjust to 18 degrees, and finally adjust to blow downwards.
[0058] Through the embodiments provided in the present application, the attribute dimensions corresponding to each instruction content are obtained, wherein the attribute dimensions are used to determine the association relationship; the instruction contents are sorted based on the attribute dimensions to obtain a content execution queue, and the correct instruction execution order is determined by combining different attribute dimensions, thereby achieving the purpose of reducing the time for adjusting the instruction sequence, thereby achieving the technical effect of improving device control efficiency.
[0059] As an optional solution, based on the content execution queue, controlling the target device to execute the control operation, the method includes:
[0060] The target device is controlled to execute operations corresponding to the contents of each instruction according to the order corresponding to the content execution queue, until all operations corresponding to the contents of each instruction are successfully executed, and it is determined that the control operation is successfully executed.
[0061] Optionally, in this embodiment, the condition for determining that the control operation is successfully executed may be but is not limited to that all instruction contents in the content execution queue are successfully executed. When all operations corresponding to the instruction contents in the content execution queue are successfully executed, a success response is returned to the user, and the sequential queue of the instructions is stored in the cache interval at the same time. When only a part of the operations corresponding to the instruction contents can be successfully executed and the other part cannot be executed by adjusting the order of the content execution queue, a half success response is returned; when the operations corresponding to the instructions cannot be successfully executed, a fall response is returned.
[0062] Through the embodiments provided by the present application, the target device is controlled to execute the operations corresponding to each instruction content according to the order corresponding to the content execution queue, until the operations corresponding to each instruction content are all executed successfully, and the control operation is determined to be executed successfully, thereby achieving the purpose of determining whether the instruction is executed successfully according to different responses, thereby achieving the technical effect of improving device control efficiency through historical feedback results.
[0063] As an optional solution, controlling the target device to execute operations corresponding to the contents of each instruction according to the order corresponding to the content execution queue until all operations corresponding to the contents of each instruction are successfully executed, and determining that the control operation is successfully executed includes:
[0064] S1, when the content execution queue includes a first instruction content and a second instruction content, controlling the target device to execute a first operation corresponding to the first instruction content, wherein the first instruction content is in an order before the second instruction content in the content execution queue;
[0065] S2, when the first operation is successfully executed, controlling the target device to execute a second operation corresponding to the second instruction content;
[0066] S3: When the second operation is successfully executed, determine that the control operation is successfully executed.
[0067] To further illustrate, the optional Figure 6 As shown, when the user sends an erroneous command "adjust the TV to channel 5 and sleep for ten minutes" to the smart TV, as shown in Figure (a), since the TV cannot be adjusted to channel 5 during sleep, the execution sequence is to adjust the TV to channel 5, then set the TV to sleep mode, and set the sleep time to 10 minutes. When all the instructions are executed successfully, a success response is returned to the user, and the sequence is recorded in the cache interval 602 for direct execution in sequence according to the historical record next time, as shown in Figure (b).
[0068] Through the embodiments provided by the present application, when the content execution queue includes a first instruction content and a second instruction content, the target device is controlled to execute a first operation corresponding to the first instruction content, wherein the first instruction content is in an order before the second instruction content in the content execution queue; when the first operation is successfully executed, the target device is controlled to execute a second operation corresponding to the second instruction content; when the second operation is successfully executed, it is determined that the control operation is successfully executed, thereby achieving the purpose of combining with the historical record information, thereby realizing the technical effect of determining the accuracy of the successful execution sequence of the device.
[0069] As an optional solution, based on the content execution queue, the target device is controlled to perform control operations, including:
[0070] S1, control the target device to execute the operations corresponding to the various instruction contents according to the order corresponding to the content execution queue, and when at least one operation corresponding to the various instruction contents fails to execute, adjust the order corresponding to the content execution queue, and re-control the target device to execute the operations corresponding to the various instruction contents according to the order corresponding to the content execution queue, until all the operations corresponding to the various instruction contents are executed successfully, and determine that the control operation is executed successfully.
[0071] Optionally, in this embodiment, all instruction contents in the content execution queue are fully arranged, and it is determined in turn in a loop whether the fully arranged instruction execution sequence can obtain a response that all operations are successfully executed.
[0072] Optionally, in this embodiment, when at least one of the operations corresponding to each instruction content fails to execute, the corresponding order of the content execution queue is adjusted, and the target device is re-controlled to execute the operations corresponding to each instruction content according to the order corresponding to the content execution queue, until all the operations corresponding to each instruction content are successfully executed, it is determined that the control operation is executed successfully, and a success flag is returned to the user.
[0073] Optionally, in this embodiment, when at least one of the operations corresponding to each instruction content fails to execute, the corresponding order of the content execution queue is adjusted, and the target device is re-controlled to execute the operations corresponding to each instruction content according to the corresponding order of the content execution queue; if only a part of the instructions can be executed successfully and the other part of the instructions fail to execute, only a part of the operation instructions is executed and the half success flag is returned to the user.
[0074] Optionally, in this embodiment, when at least one operation corresponding to each instruction content fails to execute, the corresponding order of the content execution queue is adjusted, and the target device is re-controlled to execute the operations corresponding to each instruction content according to the corresponding order of the content execution queue. If there is no successful operation, a fall flag is returned to the user, and the user is reminded to re-enter the instruction.
[0075] It should be noted that the target device is controlled to execute the operations corresponding to the contents of each instruction according to the order corresponding to the content execution queue, and when at least one operation corresponding to the contents of each instruction fails to execute, the order corresponding to the content execution queue is adjusted, and the target device is controlled again to execute the operations corresponding to the contents of each instruction according to the order corresponding to the content execution queue, until all the operations corresponding to the contents of each instruction are successfully executed, and it is determined that the control operation is executed successfully, which has the beneficial effect of improving the accuracy of determining the execution order of instructions through cyclic judgment.
[0076] Through the embodiments provided by the present application, the target device is controlled to execute the operations corresponding to the contents of each instruction according to the order corresponding to the content execution queue, and when at least one operation corresponding to the contents of each instruction fails to execute, the order corresponding to the content execution queue is adjusted, and the target device is re-controlled to execute the operations corresponding to the contents of each instruction according to the order corresponding to the content execution queue, until all the operations corresponding to the contents of each instruction are successfully executed, and it is determined that the control operation is executed successfully, thereby achieving the purpose of adjusting the content execution queue through cyclic judgment when the execution of the instruction fails, and realizing the purpose of converting the instructions that cannot be executed into the instruction contents that can be successfully executed through a cyclic sequence, thereby improving the efficiency and completion rate of device control.
[0077] As an optional solution, controlling the target device to execute the operations corresponding to the respective instruction contents according to the order corresponding to the content execution queue, and in the case where at least one operation corresponding to the respective instruction contents fails to be executed, adjusting the order corresponding to the content execution queue, and re-controlling the target device to execute the operations corresponding to the respective instruction contents according to the order corresponding to the content execution queue, until all the operations corresponding to the respective instruction contents are successfully executed, and determining that the control operation is successfully executed, includes:
[0078] S1, when the content execution queue includes a first instruction content and a second instruction content, controlling the target device to execute a first operation corresponding to the first instruction content, wherein the first instruction content is in an order before the second instruction content in the content execution queue;
[0079] S2, when the first operation fails to be executed, adjusting the order of the second instruction content in the content execution queue to be before the first instruction content;
[0080] S3, controlling the target device to execute a second operation corresponding to the second instruction content;
[0081] S4, if the second operation is successfully executed, controlling the target device to execute the first operation;
[0082] S5: When the first operation is successfully executed, determine that the control operation is successfully executed.
[0083] Optionally, in this embodiment, the first operation is an operation performed after the device receives the first instruction content, and the second operation is an operation performed after the device receives the second instruction content.
[0084] Through the embodiments provided by the present application, when the content execution queue includes a first instruction content and a second instruction content, the target device is controlled to execute a first operation corresponding to the first instruction content, wherein the order of the first instruction content in the content execution queue is before the second instruction content; when the first operation fails to execute, the order of the second instruction content in the content execution queue is adjusted to be before the first instruction content; the target device is controlled to execute the second operation corresponding to the second instruction content; when the second operation is successfully executed, the target device is controlled to execute the first operation; when the first operation is successfully executed, it is determined that the control operation is successfully executed, thereby achieving the purpose of adjusting the order to successfully execute the operation, thereby realizing the technical effect of improving the efficiency of device control.
[0085] For ease of understanding, the device testing method is applied to a specific device control scenario:
[0086] The IoT platform provides a unified downlink channel for device control commands. The IoT platform maintains a device model for each device instance, which includes the following: the current status of all device attributes; the dependency or mutual exclusion relationship between all device attributes.
[0087] When receiving commands containing multiple attribute modifications issued by upper-layer applications, the following processing is performed: the modification contents of multiple attributes in the command are split; all the split attribute modification contents are queued according to the dimension of a single attribute in the order of the command contents to form an initial queue; the following operations are performed on the attribute modification queue:
[0088] The first attribute modification content in the queue is brought into the device model to calculate whether the attribute is an operable attribute for the device in the current device state; if the attribute command can be executed, the next attribute to be operated is calculated in sequence, and when calculating the next attribute to be operated, the content corresponding to this operable attribute in the device model is replaced with the content of the request for this attribute, and the device model is recalculated; if the attribute command cannot be executed, then fall back to the previous attribute, replace it with other uncalculated attributes in the queue and requeue for calculation; perform the above calculations and judgments on all attributes of this attribute modification queue one by one until the following situation is unknown: all attributes in the queue can be executed after calculation, it is considered that there is a feasible queue, the queue order is recorded, and the calculation is stopped; all possible arrangements of all attributes in the queue may not exist after all arrangements that can be executed, it is considered that there is no feasible queue, and the calculation is stopped.
[0089] After completing the calculation of the queue, if there is a feasible queue, the actual command queue is generated according to the queue content generated by the calculation, and is issued to the devices one by one; if there is no mutual exclusion or dependency relationship between one or more adjacent attributes in the generated queue, and the device can support sending multiple attributes in one command, they can be merged into one command; if there is no feasible queue, an error is returned to the application layer.
[0090] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
[0091] According to another aspect of the embodiments of the present application, a device for implementing the above-mentioned device control is also provided. Figure 7 As shown, the device comprises:
[0092] A first acquisition unit 702 is used to acquire a device control instruction triggered on a target device, wherein the device control instruction is used to instruct the target device to perform a control operation;
[0093] A second acquisition unit 704 is configured to acquire a content execution queue according to the at least two instruction contents when the device control instruction includes at least two instruction contents, wherein the content execution queue is used to determine an execution order of each instruction content in the at least two instruction contents;
[0094] The first control unit 706 is configured to control the target device to execute a control operation based on the content execution queue.
[0095] For the specific implementation, reference may be made to the example shown in the above-mentioned device control apparatus, which will not be described in detail in this example.
[0096] As an optional solution, the second acquisition unit includes: a first acquisition module, which is used to acquire the content execution queue according to the at least two instruction contents when the device control instruction includes at least two instruction contents and there is an association relationship between the at least two instruction contents.
[0097] For specific embodiments, reference may be made to the examples shown in the above-mentioned device control method, which will not be described in detail in this example.
[0098] As an optional solution, the above-mentioned first acquisition module includes: a first acquisition sub-module, used to obtain the attribute dimension corresponding to each instruction content, wherein the attribute dimension is used to determine the association relationship; a first sorting sub-module, used to sort each instruction content based on the attribute dimension to obtain a content execution queue.
[0099] For specific embodiments, reference may be made to the examples shown in the above-mentioned device control method, which will not be described in detail in this example.
[0100] As an optional solution, the above-mentioned first control unit includes: a first control module, used to control the target device to execute operations corresponding to each instruction content according to the order corresponding to the content execution queue, until all operations corresponding to each instruction content are successfully executed, and determine that the control operation is executed successfully.
[0101] For specific embodiments, reference may be made to the examples shown in the above-mentioned device control method, which will not be described in detail in this example.
[0102] As an optional solution, the first control module includes:
[0103] S1, a first control submodule, configured to control a target device to execute a first operation corresponding to the first instruction content when the content execution queue includes a first instruction content and a second instruction content, wherein the first instruction content is in an order before the second instruction content in the content execution queue;
[0104] S2, a second control submodule, configured to control the target device to execute a second operation corresponding to the second instruction content if the first operation is successfully executed;
[0105] S3, a third control submodule, is used to determine that the control operation is successfully executed if the second operation is successfully executed.
[0106] For specific embodiments, reference may be made to the examples shown in the above-mentioned device control method, which will not be described in detail in this example.
[0107] As an optional solution, the above-mentioned first control unit includes: a second control module, which is used to control the target device to execute the operations corresponding to each instruction content according to the order corresponding to the content execution queue, and when at least one operation corresponding to each instruction content fails to execute, adjust the order corresponding to the content execution queue, and re-control the target device to execute the operations corresponding to each instruction content according to the order corresponding to the content execution queue, until all the operations corresponding to each instruction content are successfully executed, and determine that the control operation is executed successfully.
[0108] For specific embodiments, reference may be made to the examples shown in the above-mentioned device control method, which will not be described in detail in this example.
[0109] As an optional solution, the second control module includes:
[0110] S1, a fourth control submodule, configured to control the target device to execute a first operation corresponding to the first instruction content when the content execution queue includes the first instruction content and the second instruction content, wherein the first instruction content is in an order before the second instruction content in the content execution queue;
[0111] S2, a fifth control submodule, configured to adjust the order of the second instruction content in the content execution queue to be before the first instruction content if the first operation fails to be executed;
[0112] S3, a sixth control submodule, used to control the target device to perform a second operation corresponding to the second instruction content;
[0113] S4, a seventh control submodule, configured to control the target device to perform the first operation if the second operation is successfully performed;
[0114] S5, an eighth control submodule, is used to determine that the control operation is successfully executed if the first operation is successfully executed.
[0115] For specific embodiments, reference may be made to the examples shown in the above-mentioned device control method, which will not be described in detail in this example.
[0116] According to another aspect of the embodiments of the present application, an electronic device for implementing the above device control method is also provided. Figure 8 As shown, the electronic device includes a memory 802 and a processor 804. The memory 802 stores a computer program. The processor 804 is configured to execute the steps in any of the above method embodiments through the computer program.
[0117] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0118] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0119] S1, obtaining a device control instruction triggered on a target device, wherein the device control instruction is used to instruct the target device to perform a control operation;
[0120] S2, when the device control instruction includes at least two instruction contents, obtaining a content execution queue according to the at least two instruction contents, wherein the content execution queue is used to determine the execution order of each instruction content in the at least two instruction contents;
[0121] S3, based on the content execution queue, controlling the target device to execute the control operation.
[0122] Alternatively, a person skilled in the art may understand that: Figure 8 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Figure 8 The structure of the electronic device is not limited. Figure 8 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 8 Different configurations are shown.
[0123] Among them, the memory 802 can be used to store software programs and modules, such as the program instructions / modules corresponding to the device control method and apparatus in the embodiments of the present application. The processor 804 executes various functional applications and data processing by running the software programs and modules stored in the memory 802, that is, to implement the above-mentioned device control method. The memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 802 may further include a memory remotely located relative to the processor 804, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 802 may specifically be used, but is not limited to, to store information such as device control instructions, content execution queues, etc. As an example, such as Figure 8 As shown, the memory 802 may include but is not limited to the first acquisition unit 702, the second acquisition unit 704, and the first control unit 706 in the device control apparatus. In addition, it may also include but is not limited to other module units in the device control apparatus, which will not be repeated in this example.
[0124] Optionally, the transmission device 806 is used to receive or send data via a network. Specific examples of the network may include wired networks and wireless networks. In one example, the transmission device 806 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 806 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0125] In addition, the electronic device further includes: a display 808 for displaying the device control instructions, content execution queue and other information; and a connection bus 810 for connecting various module components in the electronic device.
[0126] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P) network, and any form of computing device, such as a server, terminal or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0127] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer program / instruction comprising a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, various functions provided by the embodiments of the present application are executed.
[0128] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0129] It should be noted that the computer system of the electronic device is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0130] The computer system includes a central processing unit (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) or the program loaded from the storage part to the random access memory (RAM). In the random access memory, various programs and data required for system operation are also stored. The central processing unit, the read-only memory and the random access memory are connected to each other through a bus. The input / output interface (I / O interface) is also connected to the bus.
[0131] The following components are connected to the input / output interface: an input part including a keyboard, a mouse, etc.; an output part including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage part including a hard disk, etc.; and a communication part including a network interface card such as a local area network card, a modem, etc. The communication part performs communication processing via a network such as the Internet. A drive is also connected to the input / output interface as needed. Removable media, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive as needed so that the computer program read therefrom is installed into the storage part as needed.
[0132] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, various functions defined in the system of the present application are executed.
[0133] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above-mentioned various optional implementations.
[0134] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0135] S1, obtaining a device control instruction triggered on a target device, wherein the device control instruction is used to instruct the target device to perform a control operation;
[0136] S2, when the device control instruction includes at least two instruction contents, obtaining a content execution queue according to the at least two instruction contents, wherein the content execution queue is used to determine the execution order of each instruction content in the at least two instruction contents;
[0137] S3, based on the content execution queue, controlling the target device to execute the control operation.
[0138] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0139] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0140] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to execute all or part of the steps of the methods of each embodiment of the present application.
[0141] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0142] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0143] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0144] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0145] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A device control method, characterized in that: include: Acquire a device control instruction triggered on a target device, wherein the device control instruction is used to instruct the target device to perform a control operation; In a case where the device control instruction includes at least two instruction contents, and there is an association relationship between the at least two instruction contents, acquiring attribute dimensions corresponding to the respective instruction contents, wherein the attribute dimensions are used to determine the association relationship, and the attribute dimensions include priority and execution frequency, the priority depends on the internal execution logic of the target device, and the execution frequency uses a separate cache interval to record the historical number of times different instructions are executed in different time periods; Sorting the respective instruction contents based on the attribute dimension to obtain a content execution queue, wherein the content execution queue is used to determine an execution order of the respective instruction contents in the at least two instruction contents; Based on the content execution queue, the target device is controlled to execute the control operation.
2. The method according to claim 1, characterized in that The method of controlling the target device to perform the control operation based on the content execution queue includes: The target device is controlled to execute the operations corresponding to the respective instruction contents according to the order corresponding to the content execution queue, until all the operations corresponding to the respective instruction contents are successfully executed, and it is determined that the control operation is successfully executed.
3. The method according to claim 2, characterized in that The controlling the target device to execute the operations corresponding to the respective instruction contents according to the order corresponding to the content execution queue until all the operations corresponding to the respective instruction contents are successfully executed, and determining that the control operation is successfully executed, includes: In a case where the content execution queue includes a first instruction content and a second instruction content, controlling the target device to execute a first operation corresponding to the first instruction content, wherein the first instruction content is in an order before the second instruction content in the content execution queue; If the first operation is successfully executed, controlling the target device to execute a second operation corresponding to the second instruction content; In a case where the second operation is successfully executed, it is determined that the control operation is successfully executed.
4. The method according to claim 1, characterized in that: The controlling the target device to perform the control operation based on the content execution queue includes: Control the target device to execute the operations corresponding to the various instruction contents according to the order corresponding to the content execution queue, and when at least one operation corresponding to the various instruction contents fails to execute, adjust the order corresponding to the content execution queue, and re-control the target device to execute the operations corresponding to the various instruction contents according to the order corresponding to the content execution queue, until all the operations corresponding to the various instruction contents are successfully executed, and determine that the control operation is executed successfully.
5. The method according to claim 4, characterized in that The controlling the target device to execute the operations corresponding to the respective instruction contents according to the order corresponding to the content execution queue, and in the case where at least one operation among the operations corresponding to the respective instruction contents fails to be executed, adjusting the order corresponding to the content execution queue, and re-controlling the target device to execute the operations corresponding to the respective instruction contents according to the order corresponding to the content execution queue, until all the operations corresponding to the respective instruction contents are successfully executed, and determining that the control operation is successfully executed, comprises: In a case where the content execution queue includes a first instruction content and a second instruction content, controlling the target device to execute a first operation corresponding to the first instruction content, wherein the first instruction content is in an order before the second instruction content in the content execution queue; In the case where the first operation fails to be executed, adjusting the order of the second instruction content in the content execution queue to be before the first instruction content; Controlling the target device to execute a second operation corresponding to the second instruction content; If the second operation is successfully executed, controlling the target device to execute the first operation; In a case where the first operation is successfully executed, it is determined that the control operation is successfully executed.
6. A device control device, characterized in that: include: A first acquisition unit, configured to acquire a device control instruction triggered on a target device, wherein the device control instruction is used to instruct the target device to perform a control operation; A second acquisition unit is used for acquiring a content execution queue according to the at least two instruction contents when the device control instruction includes at least two instruction contents, wherein the content execution queue is used to determine the execution order of each instruction content in the at least two instruction contents; A first control unit, configured to control the target device to execute the control operation based on the content execution queue; The second acquisition unit includes: a first acquisition module, configured to acquire the content execution queue according to the at least two instruction contents when the device control instruction includes the at least two instruction contents and there is an association relationship between the at least two instruction contents; The first acquisition module includes: a first acquisition sub-module, used to obtain the attribute dimensions corresponding to the contents of each instruction, wherein the attribute dimensions are used to determine the association relationship, the attribute dimensions include priority and execution frequency, the priority depends on the internal execution logic of the target device, and the execution frequency uses a separate cache interval to record the historical number of times different instructions are executed in different time periods; a first sorting sub-module, used to sort the contents of each instruction based on the attribute dimensions to obtain the content execution queue.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 5 when executed.
8. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 5 through the computer program.
