An instruction transmission method and device, computer device and storage medium
By receiving delayed messages to determine the abnormality of low-power devices and processing them, the problem of low efficiency of instruction transmission between low-power devices and PaaS services is solved, and more efficient instruction transmission and integrity are achieved.
Patent Information
- Application Number
- CN202210973375.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-15
- Publication Date
- 2025-10-14
- Estimated Expiration
- 2042-08-15
AI Technical Summary
Low-power devices cannot be notified of abnormalities in the process of transmitting instructions to Platform as a Service (PaaS) in a timely manner, resulting in instruction loss and low transmission efficiency.
By receiving the delay message sent by the low-power device, the delivery time of the instruction transmission is determined, whether the device is abnormal, and corresponding processing is performed in the abnormal situation, including resending the instruction and adjusting the wake-up time to ensure the complete transmission of the instruction.
It improves the efficiency of instruction transmission between low-power devices and PaaS services, ensures the integrity and reliability of instructions, and avoids instruction loss due to device abnormalities.
Smart Images

Figure CN115426706B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to an instruction transmission method, device, computer equipment and storage medium. Background Art
[0002] Currently, during the instruction transmission process, low-power devices do not maintain a long connection with the Platform as a Service (PaaS) to reduce power consumption. Specifically, low-power devices use a fixed-cycle timed online and short reporting time for device data, and obtain operation instructions generated by client-initiated remote device operations from the PaaS service to achieve instruction interaction. Among them, the PaaS service is a business model that provides a server platform as a service, and the PaaS service uses an instruction cache queue, that is, a non-real-time interaction method, to issue operation instructions.
[0003] However, when a low-power device experiences an anomaly, the PaaS service is unaware of the anomaly, potentially leading to command loss. Furthermore, because low-power devices periodically wake up to receive commands, they often go to sleep after the specified time. If the command is not fully received, the return of the command result may be delayed until the next cycle.
[0004] It can be seen that the existing technology has the technical problem of low instruction transmission efficiency. Summary of the Invention
[0005] The embodiment of the present invention provides an instruction transmission method, apparatus, computer equipment and storage medium, by which the instruction transmission efficiency can be improved.
[0006] In a first aspect, a method for transmitting an instruction is provided, the method comprising:
[0007] The Platform as a Service (PaaS) service receives a delayed message for verifying the first instruction; wherein the delayed message is sent by the low-power device after obtaining the first instruction from the PaaS service;
[0008] When it is determined that the delivery time corresponding to the delayed message has arrived, determining whether there is an abnormality based on the instruction reply information of the low-power device;
[0009] When it is determined that an abnormality exists, the first instruction is processed based on a preset processing method.
[0010] In a possible implementation, the delivery time corresponding to the delayed message is determined based on the acquisition time of the first instruction, the wake-up time of the low-power device, and a preset redundancy time.
[0011] In a possible implementation, determining whether an abnormality occurs based on the instruction response information of the low-power device includes:
[0012] When it is determined that the instruction reply information does not include the first instruction execution result information, it is determined that the low-power consumption device is abnormal.
[0013] In a possible implementation, determining whether an abnormality occurs based on the instruction response information of the low-power device includes:
[0014] When it is determined that the instruction reply information does not include the first instruction execution result information, and the number of instruction acquisition requests received from the low-power device is not less than the first threshold, it is determined that there is an abnormality in the network between the low-power device and the PaaS service.
[0015] In a possible implementation, when it is determined that an exception exists, processing the first instruction based on a preset processing method includes:
[0016] When it is determined that an exception exists, placing the first instruction into an instruction queue;
[0017] When an acquisition request for acquiring the first instruction is received again, the first instruction is resent.
[0018] In a possible implementation, before the Platform as a Service (PaaS) service receives a delay message for verifying the first instruction, the method further includes:
[0019] After receiving the instruction acquisition request sent by the low-power device, the execution duration of the first instruction is added to the first instruction, so that the low-power device adjusts the preset wake-up duration based on the execution duration.
[0020] In a second aspect, an instruction transmission device is provided, the device comprising:
[0021] A receiving unit, configured for receiving a delay message for verifying a first instruction from a Platform as a Service (PaaS) service; wherein the delay message is sent by the low-power device after obtaining the first instruction from the PaaS service;
[0022] a determining unit, configured to determine whether there is an abnormality based on the instruction reply information of the low-power device when it is determined that the delivery time corresponding to the delayed message has arrived;
[0023] The processing unit is configured to process the first instruction based on a preset processing method when it is determined that an exception exists.
[0024] In a possible implementation, the delivery time corresponding to the delayed message is determined based on the acquisition time of the first instruction, the wake-up time of the low-power device, and a preset redundancy time.
[0025] In a possible implementation manner, the determining unit is configured to:
[0026] When it is determined that the instruction reply information does not include the first instruction execution result information, it is determined that the low-power consumption device is abnormal.
[0027] In a possible implementation, the determining unit is configured to:
[0028] When it is determined that the instruction reply information does not include the first instruction execution result information, and the number of instruction acquisition requests received from the low-power device is not less than the first threshold, it is determined that there is an abnormality in the network between the low-power device and the PaaS service.
[0029] In a possible implementation, the processing unit is configured to:
[0030] When it is determined that an exception exists, placing the first instruction into an instruction queue;
[0031] When an acquisition request for acquiring the first instruction is received again, the first instruction is resent.
[0032] In a possible implementation, the device further includes a preprocessing unit configured to:
[0033] After receiving the instruction acquisition request sent by the low-power device, the execution duration of the first instruction is added to the first instruction, so that the low-power device adjusts the preset wake-up duration based on the execution duration.
[0034] According to a third aspect, a computer device is provided, comprising:
[0035] a memory for storing program instructions;
[0036] The processor is configured to call the program instructions stored in the memory and execute the steps included in any one of the methods in the first aspect according to the obtained program instructions.
[0037] According to a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. The computer program is executed by a processor to implement the steps included in any method of the first aspect.
[0038] The technical solutions provided by the embodiments of the present invention bring at least the following beneficial effects:
[0039] In an embodiment of the present invention, a Platform as a Service (PaaS) service may receive a delayed message for verifying a first instruction; wherein the delayed message is sent by a low-power device after obtaining the first instruction from the PaaS service. Then, when it is determined that the delivery time corresponding to the delayed message has arrived, a determination is made based on the instruction reply information from the low-power device to determine whether an anomaly exists. If an anomaly exists, the first instruction is processed based on a preset processing method. In this way, the transmission of the instruction by the low-power device can be confirmed based on the delayed message, i.e., whether an anomaly exists, and corresponding processing can be performed, thereby improving the efficiency of instruction transmission.
[0040] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the description are used to explain the principles of the present invention, and do not constitute an improper limitation of the present invention.
[0042] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present invention;
[0043] Figure 2 A schematic diagram of a system architecture provided by an embodiment of the present invention;
[0044] Figure 3 A flowchart of an instruction transmission method provided by an embodiment of the present invention;
[0045] Figure 4 A schematic diagram of a timing diagram of instruction transmission provided by an embodiment of the present invention;
[0046] Figure 5 A schematic diagram of another timing diagram of instruction transmission provided by an embodiment of the present invention;
[0047] Figure 6 A schematic diagram of a timing diagram of another instruction transmission provided by an embodiment of the present invention;
[0048] Figure 7 A schematic diagram of an instruction transmission method provided by an embodiment of the present invention;
[0049] Figure 8 A schematic diagram of another instruction transmission method provided by an embodiment of the present invention;
[0050] Figure 9 A structural block diagram of an instruction transmission device provided by an embodiment of the present invention;
[0051] Figure 10A schematic structural diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. In the absence of conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other arbitrarily. In addition, although the logical order is shown in the flowchart, in some cases, the steps shown or described can be performed in an order different from that here.
[0053] The terms "first" and "second" in the specification and claims of the present invention and the accompanying drawings are used to distinguish between different objects, not to describe a specific order. Furthermore, the terms "comprising" and "including" and any variations thereof are intended to cover non-exclusive protection. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements, but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.
[0054] As mentioned previously, when a low-power device experiences an anomaly, the PaaS service is unaware of the anomaly, potentially leading to command loss. Furthermore, because low-power devices periodically wake up to receive commands, they enter sleep mode after the specified time. If the command is not fully received, the return of the command result may be delayed until the next cycle.
[0055] It can be seen that the existing technology has the technical problem of low instruction transmission efficiency.
[0056] In view of this, an embodiment of the present invention provides an instruction transmission method. Through this method, in the case where a low-power device abnormally does not return the instruction status, delays the return of the instruction status, and the network abnormal instruction status is lost, the abnormality of the instruction transmission can be quickly judged based on the delayed message, and the abnormal situation can be handled accordingly, thereby improving the efficiency of instruction transmission.
[0057] After introducing the design idea of the embodiment of the present application, the application scenarios to which the technical solution in the embodiment of the present application is applicable will be briefly introduced below. It should be noted that the application scenarios described in the embodiment of the present application are for more clearly explaining the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided by the embodiment of the present application. It can be known by those skilled in the art that, with the appearance of new application scenarios, the technical solution provided by the embodiment of the present application is also applicable to similar technical problems.
[0058] Please refer to Figure 1 As shown in FIG. 1, it is a scene schematic diagram to which the embodiment of the present application can be applicable. The scene includes a low-power device 101, an electronic device 102, and a computer device 103. The instruction transmission method of the embodiment of the present application can be implemented by the low-power device 101, the electronic device 102, and the computer device 103 in cooperation. Figure 1
[0059] The instruction transmission method provided by the embodiment of the present application can be applied to a scene of transmitting instructions by a Narrow Band Internet of Things (NB-IoT) device, for example, a scene of sending a password of an NB-IoT smart lock. The NB-IoT smart lock is a terminal of a traditional smart lock connected to an NB-IoT terminal network, which can realize computer NB remote unlocking, mobile phone Bluetooth unlocking, mobile phone NB unlocking, and intelligent management of door lock state monitoring of the electronic lock. For another example, it can be a scene of sending instructions of an NB-IoT door magnetic alarm. Of course, it can also be other scenes of transmitting instructions by an NB-IoT device, which is not limited in the embodiment of the present application.
[0060] In the embodiment of the present application, the aforementioned low-power device 101 can be understood as a device that is not online in real time, wakes up online at a fixed time, and enters sleep when the time reaches a preset wake-up duration. The low-power device is, for example, an NB-IoT device.
[0061] In the embodiment of the present application, the electronic device 102 can initiate remote device operation to the computer device 103. Then, the instruction management module in the computer device 103 can generate instructions corresponding to the operation, put them into an instruction queue, check the execution result of the instructions, and call the business processing after the execution of the instructions according to the execution result of the instructions.
[0062] In the embodiment of the present application, the computer device 103 can be understood as a device corresponding to a Platform as a Service (PaaS) service. The computer device 103 can include one or more processors 1031, a memory 1032, an I / O interface 1033 for interacting with the low-power device 101, and an I / O interface 1034 for interacting with the electronic device 102.
[0063] In the implementation process, the plurality of computer devices 103 can interact with the plurality of low-power devices 101, one computer device 103 can interact with the plurality of low-power devices 101, and one computer device 103 can interact with one low-power device 101, and the embodiments of the present application do not make any limitation. Figure 1 The computer device 103 and the low-power device 101 are taken as an example for interaction.
[0064] In the embodiments of the present application, the computer device 103 can receive the device information reported by the low-power device 101, the feedback instruction execution result and the delay message through the I / O interface 1033, and the low-power device 101 can obtain the instruction from the computer device 103 and execute it.
[0065] The low-power device 101 and the computer device 103, and the electronic device 102 and the computer device 103 can be connected through one or more networks 104. The network 104 can be a wired network or a wireless network, for example, the wireless network can be a mobile cellular network, or a wireless fidelity (WIFI) network, an NB-IoT network, and of course, other possible networks, and the embodiments of the present application do not make any limitation.
[0066] Please refer to Figure 2 , Figure 2 for another application scenario in the embodiments of the present application.
[0067] In the embodiments of the present application, the electronic device includes a remote operation initiation unit, which is configured to initiate a remote operation to the computer device. The computer device includes an instruction management unit and an instruction queue. The instruction management unit is configured to respond to the remote operation, generate an operation corresponding instruction, and put it into the instruction queue. In addition, the instruction management unit is also configured to check the instruction execution result, call the business processing after the instruction execution according to the instruction execution result, and the like.
[0068] The device wake-up unit in the low-power device is configured to report the device information based on the instruction processing unit when the wake-up duration is reached, and obtain the instruction from the instruction queue and execute it. When the instruction execution is completed, the instruction feedback unit can feedback to the instruction management unit.
[0069] It can be seen that, in the embodiments of the present application, the instruction transmission method provided by the present application can be realized based on the cooperation of the low-power device, the electronic device and the computer device.
[0070] To further illustrate the scheme of the instruction transmission method provided by the embodiments of the present application, the following will be combined with the accompanying Figure 3-8and the specific embodiments are described in detail. Although the embodiments of the present application provide the following examples or the accompanying drawings, the present application can include more or less operations in the methods based on the conventional or non-inventive labor. In the steps that there is no necessary causal relationship in logic, the execution order of the steps is not limited to the execution order provided by the embodiments of the present application. The methods can be executed in sequence or in parallel (for example, in the application environment of parallel processors or multi-threaded processors) when the methods are executed in actual processing or by devices, according to the method sequence shown in the embodiments or the accompanying drawings. Figure 3 , accompanying drawings Figure 7 , accompanying drawings Figure 8 The methods shown in the accompanying drawings can include more or less operation steps based on the conventional or non-inventive labor. In the steps that there is no necessary causal relationship in logic, the execution order of the steps is not limited to the execution order provided by the embodiments of the present application. The methods can be executed in sequence or in parallel (for example, in the application environment of parallel processors or multi-threaded processors) when the methods are executed in actual processing or by devices, according to the method sequence shown in the embodiments or the accompanying drawings.
[0071] The instruction transmission method in the embodiments of the present application is described below in conjunction with the method flowchart shown in the accompanying drawings, Figure 3 The steps shown in the accompanying drawings can be executed by the computer device shown in the accompanying drawings. In the specific implementation process, the computer device can be a server, for example, a personal computer, a large or medium-sized computer, a computer cluster, etc. Figure 3 Figure 1 Step 301: The Platform as a Service (PaaS) service receives a delay message for verifying a first instruction; wherein the delay message is sent by a low-power device after the low-power device obtains the first instruction from the PaaS service.
[0072] In the embodiments of the present application, the instruction management module in the computer device corresponding to the PaaS service can first determine the preset priority corresponding to the instruction supported by the low-power device and the time length required for instruction execution. Then, the instruction management module can generate an instruction corresponding to the preset priority corresponding to the instruction supported by the low-power device and the time length required for instruction execution according to the received device operation request, and put the instruction into the instruction queue. For example, it is assumed that the generated instruction is instruction A, and instruction A is put into the instruction queue.
[0073] In the embodiments of the present application, the low-power device can send an instruction obtaining request to the computer device, and the computer device can determine whether the instruction queue is empty after receiving the instruction obtaining request. When it is determined that the instruction queue is not empty, the computer device can feed back the first instruction to the low-power device.
[0074] In a possible implementation, when the computer device receives the instruction obtaining request sent by the low-power device, the execution time length of the first instruction is added to the first instruction, so that the low-power device adjusts the preset wake-up time length based on the execution time length.
[0075] In a possible implementation, when the computer device receives the instruction obtaining request sent by the low-power device, the execution time length of the first instruction is added to the first instruction, so that the low-power device adjusts the preset wake-up time length based on the execution time length.
[0076] After the low-power device receives the first instruction, it can adjust the preset wake-up duration. Thus, due to the adjusted preset wake-up duration, the low-power device will not enter sleep mode during execution. That is, each wake-up can complete the processing of instructions in the instruction queue, thereby improving instruction transmission efficiency without increasing device power consumption.
[0077] After the low-power device obtains the first instruction, the low-power device may also send a delayed message to the computer device for verifying the first instruction. The delayed message may use a message middleware such as ActiveMQ or RocketMQ.
[0078] Optionally, the delivery time of the delayed message is determined based on the acquisition time of the first instruction, the wake-up time of the low-power device, and a preset redundancy time. The preset redundancy time can be 10 seconds, 5 seconds, or other values, which are not limited in the embodiments of the present invention.
[0079] For example, assuming that the time when the low-power device obtains the first instruction is 20:11:00 on July 13, 2022, and the wake-up time of the low-power device is 30 seconds, that is, the low-power device wakes up once every 30 seconds, and the preset redundancy time is 10 seconds, then it can be determined that the corresponding delivery time of the delayed message is 20:11:40 on July 13, 2022.
[0080] Step 302: When it is determined that the delivery time corresponding to the delayed message has arrived, determine whether there is an abnormality based on the instruction reply information of the low-power device.
[0081] In an embodiment of the present invention, when the computer device determines that the delivery time corresponding to the delayed message has arrived, it can determine whether there is an abnormality based on the instruction reply information of the low-power device.
[0082] In an alternative embodiment, see Figure 4 , is a schematic diagram of a timing diagram of instruction transmission provided by an embodiment of the present invention. Figure 4 The device in is a low-power device, Figure 4 The instruction management in can be understood as the instruction management unit of the computer.
[0083] Specifically, the low-power device may send a request to the instruction management unit to obtain an instruction, and then the instruction management unit returns an instruction from the instruction sequence to the low-power device. The instruction is, for example, Figure 4 Instruction A in the low-power device, after obtaining the instruction, it can send a delay message to the instruction management unit, and the delay message is, for example, Figure 4 The delayed message M in the delay message arrives before the delivery time corresponding to the delayed message, that is, Figure 4After a time T, the instruction management unit receives an instruction reply message sent by the low-power device, and the instruction reply message includes the first instruction execution result information, and the first instruction execution result information is, for example, Figure 4 The execution result of the reported instruction A in the , that is, it is determined that the low-power device transmits the instruction normally.
[0084] In an alternative embodiment, see Figure 5 , is a schematic diagram of a timing diagram of instruction transmission provided by an embodiment of the present invention. Figure 5 The device in is a low-power device, Figure 5 The instruction management in can be understood as the instruction management unit of the computer.
[0085] Specifically, the low-power device may send a request to the instruction management unit to obtain an instruction, and then the instruction management unit returns an instruction from the instruction sequence to the low-power device. The instruction is, for example, Figure 5 Instruction A in the low-power device, after obtaining the instruction, it can send a delay message to the instruction management unit, and the delay message is, for example, Figure 5 The delayed message M in the delay message arrives before the delivery time corresponding to the delayed message, that is, Figure 5 After a time T, the instruction management unit receives an instruction reply message sent by the low-power device. When it is determined that the instruction reply information does not include the first instruction execution result information, it is determined that the low-power device is abnormal.
[0086] In an alternative embodiment, see Figure 6 , is a schematic diagram of a timing diagram of instruction transmission provided by an embodiment of the present invention. Figure 6 The device in is a low-power device, Figure 6 The instruction management in can be understood as the instruction management unit of the computer.
[0087] Specifically, the low-power device may send a request to the instruction management unit to obtain an instruction, and then the instruction management unit returns an instruction from the instruction sequence to the low-power device. The instruction is, for example, Figure 6 Instruction A in the low-power device, after obtaining the instruction, it can send a delay message to the instruction management unit, and the delay message is, for example, Figure 6 The delayed message M in the delay message arrives before the delivery time corresponding to the delayed message, that is, Figure 6 After time T, the instruction management unit receives an instruction reply message sent by the low-power device. When it is determined that the instruction reply information does not include the first instruction execution result information, and the number of instruction acquisition requests received from the low-power device is not less than the first threshold, it can be determined that the instruction execution has failed, that is, there is an abnormality in the network between the low-power device and the PaaS service, that is, the low-power device and the PaaS service.
[0088] The first threshold is, for example, Figure 6 For X in , the first threshold value may be 3 times, 5 times, or other times, which is not limited in the embodiment of the present invention.
[0089] Step 303: When it is determined that an abnormality exists, the first instruction is processed based on a preset processing method.
[0090] In an embodiment of the present invention, when the computer device determines that an abnormality exists, the first instruction can be placed in an instruction queue; when a request to obtain the first instruction is received again, the first instruction can be resent. Optionally, when the computer device determines that an abnormality exists, a service failure callback can be executed.
[0091] In the embodiment of the present invention, after the computer device determines that the instruction transmission is normal, it can process the instructions in the instruction queue.
[0092] In order to more clearly illustrate the execution process of the instruction transmission by the instruction management unit of the computer device in the embodiment of the present invention, please refer to Figure 7 , Figure 7 A schematic diagram of an instruction transmission method.
[0093] Step 701: Create a first instruction based on a remote operation request and preset instruction creation conditions.
[0094] Specifically, the preset instruction creation condition can be understood as satisfying the preset priority corresponding to the instruction supported by the low-power device and the length of time required for the instruction execution.
[0095] Step 702: Put the first instruction into the instruction queue.
[0096] Step 703: Receive an instruction acquisition request sent by the low-power device, and send a first instruction to the low-power device.
[0097] Step 704: Receive a delay message sent by the low-power device.
[0098] Step 705: When it is determined that the delivery time corresponding to the delayed message has arrived, determine whether to perform normal transmission processing based on whether the instruction reply information from the low-power device includes the first instruction execution result information. If it is determined that the delivery time corresponding to the delayed message has arrived and the instruction reply information from the low-power device includes the first instruction execution result information, then step 706 is executed; if it is determined that the delivery time corresponding to the delayed message has arrived and the instruction reply information from the low-power device does not include the first instruction execution result information, then step 707 is executed.
[0099] Step 706: Execute normal transmission instruction processing.
[0100] Step 707: Determine whether an exception exists and perform post-exception processing.
[0101] As can be seen, the instruction transmission method provided by the embodiments of the present invention can confirm the status of instruction transmission by a low-power device based on delayed messages, that is, determine whether an anomaly exists and perform corresponding processing, thereby improving the efficiency of instruction transmission. In other words, a judgment method is proposed for abnormal situations where the execution status of instructions is unknown, thereby closing the loop of the entire instruction transmission process logic.
[0102] In the embodiments of the present invention, see Figure 8 , Figure 8 A schematic diagram of an instruction transmission method provided by an embodiment of the present invention.
[0103] Step 801: When the low-power device determines that the preset wake-up time has been reached, it initializes the wake-up time and sends an instruction acquisition request to the computer device.
[0104] Step 802: The computer device determines whether the instruction queue is empty based on the instruction acquisition request. When it is determined that the instruction queue is empty, step 803 is executed; when it is determined that the instruction queue is not empty, step 804 is executed.
[0105] Step 803: The computer device sends a message to the low-power device indicating that the instruction queue is empty, and the low-power device enters a dormant state when the next preset wake-up time is reached.
[0106] Step 804: The computer device sends a first instruction to the low-power device.
[0107] Step 805: The low-power device updates the preset wake-up duration based on the first instruction; and sends a delay message to the computer device.
[0108] Step 806: The low-power device executes the first instruction and sends instruction response information to the computer device.
[0109] In an embodiment of the present invention, after the instruction reply information sent by the low-power device to the computer device includes the first instruction execution result information, the low-power device can continue to send instruction acquisition requests to the computer device until the preset wake-up time is reached, that is, the low-power device enters a sleep state.
[0110] Step 807: When the computer device determines that the delivery time corresponding to the delayed message has arrived, it determines that the instruction reply information of the low-power device includes the first instruction execution result information, determines to perform normal transmission processing, and abandons the delivery of the delayed message.
[0111] It can be seen that in the embodiment of the present application, the method for quickly judging whether there is an exception based on a delay message is provided to solve the problems of the low-power device in the prior art that does not return an instruction state, delays the return of an instruction state, and loses a network exception instruction state, and the method for sending an execution duration of an instruction to a low-power device and adjusting a wake-up duration of the low-power device based on the execution duration of the instruction is provided, so as to ensure that the low-power device can process the instructions in the instruction queue in a single wake-up, and thus the instruction transmission efficiency is improved.
[0112] Based on the same inventive concept, the embodiment of the present application provides an instruction transmission device capable of realizing the functions corresponding to the instruction transmission method. The instruction transmission device can be a hardware structure, a software module, or a hardware structure plus a software module. The instruction transmission device can be realized by a chip system, which can be composed of a chip or can include a chip and other discrete devices. Please refer to Figure 9 As shown in the figure, the instruction transmission device includes a receiving unit 901, a determining unit 902, and a processing unit 903, wherein:
[0113] The receiving unit 901 is configured to receive a delay message for checking a first instruction by a Platform as a Service (PaaS) service; wherein the delay message is sent by a low-power device after the low-power device obtains the first instruction from the PaaS service.
[0114] The determining unit 902 is configured to determine whether there is an exception based on instruction reply information of the low-power device when it is determined that the delivery time corresponding to the delay message is reached.
[0115] The processing unit 903 is configured to process the first instruction based on a preset processing mode when it is determined that there is an exception.
[0116] In a possible implementation, the delivery time corresponding to the delay message is determined based on an obtaining time of the first instruction, a wake-up duration of the low-power device, and a preset redundancy duration.
[0117] In a possible implementation, the determining unit 902 is configured to:
[0118] When it is determined that the first instruction execution result information is not included in the instruction reply information, it is determined that the low-power device is abnormal.
[0119] In a possible implementation, the determining unit 902 is configured to:
[0120] When it is determined that the instruction reply information does not include the first instruction execution result information, and the number of instruction acquisition requests received from the low-power device is not less than the first threshold, it is determined that there is an abnormality in the network between the low-power device and the PaaS service.
[0121] In a possible implementation, the processing unit 903 is configured to:
[0122] When it is determined that an exception exists, placing the first instruction into an instruction queue;
[0123] When an acquisition request for acquiring the first instruction is received again, the first instruction is resent.
[0124] In a possible implementation, the device further includes a preprocessing unit configured to:
[0125] After receiving the instruction acquisition request sent by the low-power device, the execution duration of the first instruction is added to the first instruction, so that the low-power device adjusts the preset wake-up duration based on the execution duration.
[0126] All relevant contents of each step involved in the embodiment of the aforementioned instruction transmission method can be referred to the functional description of the functional module corresponding to the instruction transmission device in the embodiment of the present invention, and will not be repeated here.
[0127] The module division in the embodiments of the present invention is illustrative and represents only a logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional modules in various embodiments of the present invention may be integrated into a single controller, exist physically as separate modules, or two or more modules may be integrated into a single module. The integrated modules may be implemented in either hardware or software functional modules.
[0128] Based on the same inventive concept, an embodiment of the present invention provides a computer device, see Figure 10 As shown, the computer device includes at least one processor 1001 and a memory 1002 connected to the at least one processor. The embodiment of the present invention does not limit the specific connection medium between the processor 1001 and the memory 1002. Figure 10 In the example, the processor 1001 and the memory 1002 are connected via a bus 1000. Figure 10 The bus 1000 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 10In the figure, only one thick line is used to represent the bus, but it does not mean that there is only one bus or one type of bus. In addition, the instruction transmission device also includes a communication interface 1003 for receiving or sending data.
[0129] In an embodiment of the present invention, the memory 1002 stores instructions that can be executed by at least one processor 1001. The at least one processor 1001 can execute the steps included in the aforementioned instruction transmission method by executing the instructions stored in the memory 1002.
[0130] Among them, the processor 1001 is the control center of the computer device, which can use various interfaces and lines to connect various parts of the entire computer device, and monitor the computer device as a whole by running or executing instructions stored in the memory 1002 and calling data stored in the memory 1002, various functions of the computer device and processing data.
[0131] Optionally, processor 1001 may include one or more processing units. Processor 1001 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interface, and application programs, and the modem processor primarily processes wireless communications. It is understood that the modem processor may not be integrated into processor 1001. In some embodiments, processor 1001 and memory 1002 may be implemented on the same chip. In some embodiments, they may also be implemented on separate chips.
[0132] The processor 1001 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present invention can be directly implemented as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.
[0133] The memory 1002 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 1002 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (RAM), a static random access memory (SRAM), a programmable read-only memory (PROM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic memory, a magnetic disk, an optical disk, and the like. The memory 1002 is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1002 in the embodiment of the present invention can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0134] By designing and programming the processor 1001, the code corresponding to the instruction transmission method introduced in the aforementioned embodiment can be solidified into the chip, so that the chip can execute the steps of the aforementioned instruction transmission method during operation. How to design and program the processor 1001 is a technology well known to those skilled in the art and will not be repeated here.
[0135] Based on the same inventive concept, an embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the aforementioned instruction transmission method are implemented.
[0136] In some possible implementations, various aspects of the instruction transmission method provided by the present invention can also be implemented in the form of a program product, which includes program code. When the program product is run on a control computer device, the program code is used to enable the control computer device to execute the steps of the instruction transmission method according to various exemplary embodiments of the present invention described above in this specification.
[0137] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage and optical storage, etc.) containing computer-usable program code.
[0138] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0139] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0140] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0141] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A method for transmitting an instruction, characterized in that: The method comprises: The Platform as a Service (PaaS) service receives a delayed message for verifying the first instruction; wherein the delayed message is sent by the low-power device after obtaining the first instruction from the PaaS service; When it is determined that the delivery time corresponding to the delayed message has arrived, determining whether there is an abnormality based on the instruction reply information of the low-power device; When it is determined that an abnormality exists, processing the first instruction based on a preset processing method; The delayed message is implemented based on ActiveMQ or RocketMQ; the delivery time of the delayed message is determined based on the acquisition time of the first instruction, the wake-up time of the low-power device, and the preset redundancy time; the instruction reply information is used to indicate the execution status of the first instruction; The determining whether there is an abnormality based on the instruction response information of the low-power device includes: When it is determined that the instruction reply information does not include the first instruction execution result information, it is determined that the low-power consumption device is abnormal; Before the Platform as a Service (PaaS) service receives a delay message for verifying the first instruction, the method further includes: After receiving the instruction acquisition request sent by the low-power device, the execution duration of the first instruction is added to the first instruction, so that the low-power device adjusts the preset wake-up duration based on the execution duration.
2. The method according to claim 1, wherein The determining whether there is an abnormality based on the instruction response information of the low-power device includes: When it is determined that the instruction reply information does not include the first instruction execution result information, and the number of instruction acquisition requests received from the low-power device is not less than the first threshold, it is determined that there is an abnormality in the network between the low-power device and the PaaS service.
3. The method according to claim 1, wherein When it is determined that an abnormality exists, processing the first instruction based on a preset processing method includes: When it is determined that an exception exists, placing the first instruction into an instruction queue; When an acquisition request for acquiring the first instruction is received again, the first instruction is resent.
4. A command transmission device, characterized in that: The device comprises: A receiving unit, configured for receiving a delay message for verifying a first instruction from a Platform as a Service (PaaS) service; wherein the delay message is sent by the low-power device after obtaining the first instruction from the PaaS service; a determining unit, configured to determine whether there is an abnormality based on the instruction reply information of the low-power device when it is determined that the delivery time corresponding to the delayed message has arrived; a processing unit, configured to process the first instruction based on a preset processing method when determining that an exception exists; The delayed message is implemented based on ActiveMQ or RocketMQ; the delivery time of the delayed message is determined based on the acquisition time of the first instruction, the wake-up time of the low-power device, and the preset redundancy time; the instruction reply information is used to indicate the execution status of the first instruction; The determining unit is specifically configured to: determine that the low-power consumption device is abnormal when it is determined that the instruction reply information does not include the first instruction execution result information; Before the Platform as a Service (PaaS) service receives a delay message for verifying the first instruction, the receiving unit is also used to: after receiving an instruction acquisition request sent by the low-power device, add the execution duration of the first instruction to the first instruction, so that the low-power device adjusts the preset wake-up duration based on the execution duration.
5. A computer device, characterized in that: The computer device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the instruction transmission method according to any one of claims 1 to 3 are implemented.
6. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the instruction transmission method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Remote control method, device and equipment for smart home and storage medium
CN114024787A