Instruction processing method, device and communication system
By determining whether the heartbeat message of the low-power device is in an active state within the set time, the problem that the low-power device cannot receive instructions in the sleep state is solved, and the successful sending and response of instructions is realized to ensure effective control of the device.
Patent Information
- Application Number
- CN202111530141.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-14
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2041-12-14
AI Technical Summary
Low-power IoT devices cannot receive instructions sent by cloud platforms in sleep state, resulting in failed command sending and response failure.
After obtaining the heartbeat message reported by the low-power device, it is determined whether the current time is within the set time. If so, the command to be sent is sent to ensure that the device is in an active state and to ensure that the command can be received and respond successfully.
It realizes successful sending and response of instructions, avoids command loss, and ensures effective control of low-power devices.
Smart Images

Figure CN114244893B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to an instruction processing method, device and communication system. Background Art
[0002] With the development of technology, there are more and more types of IoT devices. IoT devices are connected to the cloud platform through relevant protocols. The cloud platform can send instructions to IoT devices to control IoT devices to perform related operations, and return corresponding response information to the cloud platform to achieve successful response to the instructions.
[0003] At present, when a low-power Internet of Things device, that is, a low-power device, is connected to a cloud platform, since the low-power device is in a sleep state most of the time, when the cloud platform sends an instruction to the low-power device, the low-power device is in a sleep state and cannot receive the instruction sent by the cloud platform, resulting in a failure to send the instruction, and thus a failure to respond to the instruction. Summary of the invention
[0004] To overcome the problems existing in the related art, this specification provides an instruction processing method, device and communication system.
[0005] According to a first aspect of an embodiment of this specification, there is provided a command processing method, which is applied to a server, and the method includes:
[0006] Obtaining an instruction to be sent, and determining a first device corresponding to the instruction to be sent; wherein the first device is a device that reports a heartbeat message in each heartbeat cycle, and enters a dormant state after a set time after each heartbeat message is reported;
[0007] Based on the heartbeat message reported by the first device, the instruction to be sent is sent to the first device, so that the first device generates response information corresponding to the instruction to be sent when receiving the instruction to be sent;
[0008] Receive response information corresponding to the instruction to be sent sent by the first device.
[0009] Optionally, the sending the instruction to be sent to the first device based on the heartbeat message reported by the first device includes:
[0010] In response to the presence of a heartbeat message reported by the first device or identification information corresponding to the first device in the preset position, sending the instruction to be sent to the first device; wherein the identification information corresponding to the first device is determined when the heartbeat message reported by the first device is received;
[0011] In response to the absence of the heartbeat message reported by the first device or the identification information corresponding to the first device in the preset position, upon receiving a new heartbeat message reported by the first device, sending the to-be-sent instruction to the first device;
[0012] The heartbeat message reported by the first device in the preset position or the identification information corresponding to the first device is saved when the heartbeat message reported by the first device is received, and is deleted after the set time has passed.
[0013] Optionally, the sending the instruction to be sent to the first device based on the heartbeat message reported by the first device includes:
[0014] Obtaining a reporting time corresponding to a target heartbeat message, and obtaining a setting time corresponding to the first device; wherein the target heartbeat message represents a heartbeat message reported by the first device that was recently received;
[0015] According to the reporting time corresponding to the target heartbeat message and the set time, the to-be-sent instruction is sent to the first device.
[0016] Optionally, the sending the instruction to be sent to the first device according to the reporting time corresponding to the target heartbeat message and the set time includes:
[0017] Determine a first time range according to the reporting time corresponding to the target heartbeat message and the set time, where the first time range indicates a time range in which the first device is in an active state;
[0018] In response to the current moment being within the first time range, sending the instruction to be sent to the first device;
[0019] In response to the current time not being within the first time range, upon receiving a new heartbeat message reported by the first device, the to-be-sent instruction is sent to the first device.
[0020] Optionally, the sending the instruction to be sent to the first device based on the heartbeat message reported by the first device includes:
[0021] Obtaining a status flag corresponding to the first device; wherein the status flag is determined according to a heartbeat message reported by the first device;
[0022] When the state flag is a first preset flag, sending the to-be-sent instruction to the first device; wherein the first preset flag indicates that the first device is in an active state;
[0023] When the status flag is a second preset flag, upon receiving a new heartbeat message reported by the first device, the to-be-sent instruction is sent to the first device; wherein the second preset flag indicates that the first device is in a dormant state.
[0024] Optionally, the method further includes:
[0025] Upon receiving the heartbeat message reported by the first device, obtaining a set time corresponding to the first device;
[0026] Upon receiving the heartbeat message reported by the first device, obtaining a set time corresponding to the first device;
[0027] Save the heartbeat message reported by the first device to a preset location, or obtain identification information corresponding to the first device, and save the identification information corresponding to the first device to the preset location;
[0028] After a set time corresponding to the first device has passed, the heartbeat message reported by the first device is deleted from the preset location, or the identification information corresponding to the first device is deleted from the preset location.
[0029] Optionally, the method further includes:
[0030] Sending the to-be-sent instruction to the first device;
[0031] In response to not receiving response information corresponding to the instruction to be sent sent by the first device, returning to the step of sending the instruction to be sent to the first device;
[0032] In response to receiving response information corresponding to the instruction to be sent sent by the first device, stopping sending the instruction to be sent to the first device.
[0033] Optionally, the step of saving the heartbeat message reported by the first device to a preset location includes:
[0034] Obtaining a device identifier corresponding to the first device, and using the device identifier corresponding to the first device as a key name;
[0035] The heartbeat message reported by the first device is used as a key value, and the key name, the key value and the set time corresponding to the first device are saved to the preset location.
[0036] Optionally, the preset location includes one or more of a cache, a disk, and a database; the heartbeat message includes one or more of a current heartbeat cycle, a current alarm state, a current alarm threshold, a current signal strength, a current voltage, and a current tilt angle.
[0037] Optionally, the method further includes:
[0038] When a heartbeat message reported by the first device is received, the heartbeat message is parsed based on a preset protocol format, and the parsed heartbeat message is displayed.
[0039] Optionally, the instruction to be sent includes an update instruction;
[0040] The method further comprises:
[0041] In response to an update operation of the first device information in the first page, the updated first device information is obtained, and an update instruction corresponding to the first device is generated according to the updated first device information; wherein the update instruction instructs the first device to perform corresponding update processing based on the updated first device information; the first device information includes a heartbeat cycle and / or alarm threshold corresponding to the first device.
[0042] Optionally, the instruction to be sent includes a query instruction;
[0043] The method further comprises:
[0044] The to-be-queried information corresponding to the first device is acquired, and a query instruction corresponding to the first device is generated according to the to-be-queried information corresponding to the first device.
[0045] According to a second aspect of an embodiment of this specification, a communication system is provided, the communication system comprising a server and a first device;
[0046] The server is used to obtain the instruction to be sent and determine the first device corresponding to the instruction to be sent; based on the heartbeat message reported by the first device, send the instruction to be sent to the first device; and receive the response information corresponding to the instruction to be sent sent by the first device; wherein the first device is a device that reports a heartbeat message in each heartbeat cycle and enters a dormant state after a set time after each heartbeat message is reported;
[0047] The first device is used to generate response information corresponding to the instruction to be sent when receiving the instruction to be sent.
[0048] Optionally, the communication system further includes a display device;
[0049] The server is configured to, upon receiving the heartbeat message reported by the first device, parse the heartbeat message based on a preset protocol format, and send the parsed heartbeat message to the display device;
[0050] The display device is used to display the parsed heartbeat message.
[0051] Optionally, a first page is provided by the display device, and the first page displays first device information:
[0052] In response to an update operation of the first device information in the first page, the updated first device information is determined, and the first device information is sent to the server.
[0053] According to a third aspect of an embodiment of this specification, there is provided an instruction processing device, which is applied to a server, and the device includes:
[0054] An instruction acquisition module, used to acquire the instruction to be sent and determine the first device corresponding to the instruction to be sent; wherein the first device is a device that reports a heartbeat message in each heartbeat cycle and enters a dormant state after a set time after each heartbeat message is reported;
[0055] An instruction sending module, configured to send the instruction to be sent to the first device based on the heartbeat message reported by the first device, so that the first device generates response information corresponding to the instruction to be sent when receiving the instruction to be sent;
[0056] The information receiving module is used to receive the response information corresponding to the instruction to be sent sent by the first device.
[0057] Optionally, the instruction sending module is specifically used for:
[0058] In response to the presence of a heartbeat message reported by the first device or identification information corresponding to the first device in the preset position, sending the instruction to be sent to the first device; wherein the identification information corresponding to the first device is determined when the heartbeat message reported by the first device is received;
[0059] In response to the absence of the heartbeat message reported by the first device or the identification information corresponding to the first device in the preset position, upon receiving a new heartbeat message reported by the first device, sending the to-be-sent instruction to the first device;
[0060] The heartbeat message reported by the first device in the preset position or the identification information corresponding to the first device is saved when the heartbeat message reported by the first device is received, and is deleted after the set time has passed.
[0061] Optionally, the instruction sending module is specifically used for:
[0062] Obtaining a reporting time corresponding to a target heartbeat message, and obtaining a setting time corresponding to the first device; wherein the target heartbeat message represents a heartbeat message reported by the first device that was recently received;
[0063] According to the reporting time corresponding to the target heartbeat message and the set time, the to-be-sent instruction is sent to the first device.
[0064] Optionally, the instruction sending module is further specifically used for:
[0065] Determine a first time range according to the reporting time corresponding to the target heartbeat message and the set time, where the first time range indicates a time range in which the first device is in an active state;
[0066] In response to the current moment being within the first time range, sending the instruction to be sent to the first device;
[0067] In response to the current time not being within the first time range, upon receiving a new heartbeat message reported by the first device, the to-be-sent instruction is sent to the first device.
[0068] Optionally, the instruction sending module is also used to:
[0069] Obtaining a status flag corresponding to the first device; wherein the status flag is determined according to a heartbeat message reported by the first device;
[0070] When the state flag is a first preset flag, sending the to-be-sent instruction to the first device; wherein the first preset flag indicates that the first device is in an active state;
[0071] When the status flag is a second preset flag, upon receiving a new heartbeat message reported by the first device, the to-be-sent instruction is sent to the first device; wherein the second preset flag indicates that the first device is in a dormant state.
[0072] Optionally, the instruction sending module is also used to
[0073] Sending the to-be-sent instruction to the first device;
[0074] In response to not receiving response information corresponding to the instruction to be sent sent by the first device, returning to the step of sending the instruction to be sent to the first device;
[0075] In response to receiving response information corresponding to the instruction to be sent sent by the first device, stopping sending the instruction to be sent to the first device.
[0076] Optionally, the instruction processing device further includes an information storage module;
[0077] The information storage module is used for:
[0078] Upon receiving the heartbeat message reported by the first device, obtaining a set time corresponding to the first device;
[0079] Save the heartbeat message reported by the first device to a preset location, or obtain identification information corresponding to the first device, and save the identification information corresponding to the first device to the preset location;
[0080] After a set time corresponding to the first device has passed, the heartbeat message reported by the first device is deleted from the preset location, or the identification information corresponding to the first device is deleted from the preset location.
[0081] Optionally, the information storage module is specifically used to:
[0082] Obtaining a device identifier corresponding to the first device, and using the device identifier corresponding to the first device as a key name;
[0083] The heartbeat message reported by the first device is used as a key value, and the key name, the key value and the set time corresponding to the first device are saved to the preset location.
[0084] Optionally, the preset location includes one or more of a cache, a disk, and a database; the heartbeat message includes one or more of a current heartbeat cycle, a current alarm state, a current alarm threshold, a current signal strength, a current voltage, and a current tilt angle.
[0085] Optionally, the instruction processing device further includes a display module;
[0086] Display modules are used for:
[0087] When a heartbeat message reported by the first device is received, the heartbeat message is parsed based on a preset protocol format, and the parsed heartbeat message is displayed.
[0088] Optionally, the instruction to be sent includes an update instruction;
[0089] The instruction acquisition module is also used for:
[0090] In response to an update operation of the first device information in the first page, the updated first device information is obtained, and an update instruction corresponding to the first device is generated according to the updated first device information; wherein the update instruction instructs the first device to perform corresponding update processing based on the updated first device information; the first device information includes a heartbeat cycle and / or alarm threshold corresponding to the first device.
[0091] Optionally, the instruction to be sent includes a query instruction;
[0092] The instruction acquisition module is also used for:
[0093] The to-be-queried information corresponding to the first device is acquired, and a query instruction corresponding to the first device is generated according to the to-be-queried information corresponding to the first device.
[0094] According to a fourth aspect of an embodiment of this specification, a server is provided, including:
[0095] processor;
[0096] a memory for storing processor-executable instructions;
[0097] Wherein, the processor is configured to:
[0098] Get the instructions to be sent;
[0099] According to a preset sending method, the instruction to be sent is sent to the first device, so that the first device generates response information corresponding to the instruction to be sent when receiving the instruction to be sent; wherein the preset sending method includes a first preset sending method and / or a second preset sending method, the first preset sending method represents a method of continuously sending instructions; the second preset sending method represents a method of sending instructions based on a heartbeat message reported by the first device; the first device is a device that reports a heartbeat message in each heartbeat cycle, and enters a dormant state after a set time after each heartbeat message is reported;
[0100] Receive response information corresponding to the instruction to be sent sent by the first device.
[0101] According to the fifth aspect of the embodiments of this specification, a computer-readable storage medium is provided, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the instruction processing method described in the first aspect and various possible designs of the first aspect is implemented.
[0102] According to the sixth aspect of the embodiments of this specification, a computer program product is provided, including a computer program. When the computer program is executed by a processor, it implements the instruction processing method described in the first aspect and various possible designs of the first aspect.
[0103] The technical solutions provided by the embodiments of this specification may have the following beneficial effects:
[0104] In the embodiments of the present specification, when the instruction to be sent is obtained, it indicates that the instruction to be sent needs to be sent to the corresponding first device. The first device reports a heartbeat message for each heartbeat cycle, and after each heartbeat message is reported, it enters a sleep state after a set time. That is, the first device is a low-power device. Based on the heartbeat message reported by the first device, it is determined whether the current time is within the set time after the first device reports the message, that is, it is determined whether the first device is currently in a non-sleep state, that is, an active state. Therefore, when the first device is in an active state, the instruction to be sent is sent to the first device to achieve successful sending of the instruction and avoid loss of the instruction, so that the first device can generate corresponding response information based on the instruction to be sent, and return the response information to achieve a successful response to the instruction, thereby achieving successful control of the first device and meeting user needs.
[0105] 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 present specification. BRIEF DESCRIPTION OF THE DRAWINGS
[0106] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the specification and, together with the description, serve to explain the principles of the specification.
[0107] Figure 1 The flowchart of an instruction processing method is shown in the present specification according to an exemplary embodiment.
[0108] Figure 2 It is a flowchart of another instruction processing method shown in this specification according to an exemplary embodiment.
[0109] Figure 3 It is a schematic diagram of an interface of a second page according to an exemplary embodiment of this specification.
[0110] Figure 4 It is a hardware structure diagram of the server where the instruction processing device of the embodiment of this specification is located.
[0111] Figure 5 It is a structural block diagram of an instruction processing device shown in this specification according to an exemplary embodiment.
[0112] Figure 6 It is a structural diagram of a communication system shown in this specification according to an exemplary embodiment.
[0113] Figure 7 It is a structural diagram of another communication system shown in this specification according to an exemplary embodiment. DETAILED DESCRIPTION
[0114] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this specification. Instead, they are merely examples of devices and methods consistent with some aspects of this specification as detailed in the appended claims.
[0115] The terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit this specification. The singular forms "a", "the" and "the" used in this specification and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0116] It should be understood that although the terms first, second, third, etc. may be used in this specification to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0117] Next, the embodiments of this specification are described in detail.
[0118] In some implementations, low-power devices are in sleep mode most of the time and only become active when reporting a heartbeat message. Therefore, low-power devices are not able to receive and respond to instructions sent by the cloud platform in real time. That is, when low-power devices are in sleep mode, they cannot receive instructions sent by the cloud platform, resulting in failure to send instructions.
[0119] Therefore, in response to the above problems, the present application takes into account that the low-power device is in an active state within a certain period of time, that is, t time, or a set time (for example, 2 seconds) after reporting a heartbeat message, that is, it can receive instructions issued by the cloud platform within this t time. A method for issuing instructions is proposed, in which the cloud platform sends the instructions to be sent to the low-power device within t time after receiving the heartbeat message reported by the low-power device. In order to ensure that the instructions to be sent can be sent within the time t, the cloud platform can cyclically send the instructions to be sent to the low-power device until the time reaches the non-sleep period of the low-power device, that is, until the time t after the heartbeat message reported by the low-power device is reached, that is, until the low-power device is in an active state, so that the low-power device can receive the instructions to be sent and successfully send the instructions; the cloud platform can also determine whether the current time is within the time t after the first device reports the heartbeat message based on the heartbeat message reported by the first device most recently received, and send the instructions to be sent to the low-power device after determining that the current time is within the time t after the first device reports the heartbeat message, so that the low-power device can successfully receive the instructions to be sent, thereby achieving accurate issuance of instructions and avoiding waste of resources, thereby achieving control over the low-power device.
[0120] like Figure 1 As shown, Figure 1 This is a flowchart of a method for processing instructions according to an exemplary embodiment of the present specification. The method is applied to a server and includes the following steps:
[0121] Step 101: Obtain the instruction to be sent and determine the first device corresponding to the instruction to be sent, wherein the first device is a device that reports a heartbeat message in each heartbeat cycle and enters a dormant state after a set time after each heartbeat message is reported.
[0122] In this embodiment, when an instruction to be issued, ie, an instruction to be sent, is obtained, a target device corresponding to the instruction to be sent, ie, a device that needs to receive the instruction to be sent, ie, a first device, is obtained.
[0123] Among them, the first device is a device that reports a heartbeat message in each heartbeat cycle, and enters a dormant state after a set time after each heartbeat message is reported, that is, the first device enters an active state after reporting a heartbeat message to the server, and re-enters a dormant state after a set time corresponding to the active state. The set time indicates the length of time the first device is in an active state after reporting a heartbeat message, that is, within a set time after the first device reports a heartbeat message, that is, within time t, the first device is in an active state and can receive instructions sent by the server. For example, if the heartbeat cycle is 5 seconds and the set time is 2 seconds, the first device reports a heartbeat message to the server every 5 seconds, and the first device is in a dormant state within the 5 seconds. After reporting the heartbeat message, the first device re-enters a dormant state after 2 seconds, and the first device is in an active state within the 2 seconds.
[0124] Optionally, the instruction to be sent includes an update instruction and / or a query instruction. Of course, the instruction to be sent may also include other types of instructions, which only need to control the first device to perform a corresponding operation. Here, the type of the instruction to be sent is not limited.
[0125] The update instruction is used to instruct the first device to update relevant parameters; the query instruction is used to instruct the first device to query relevant parameters.
[0126] Optionally, when the instruction to be sent is obtained, the first device may be determined according to the device identifier in the instruction to be sent, that is, the device corresponding to the device identifier is used as the first device.
[0127] Step 102: Based on the heartbeat message reported by the first device, the instruction to be sent is sent to the first device, so that the first device generates response information corresponding to the instruction to be sent when receiving the instruction to be sent.
[0128] Step 103: Receive response information corresponding to the instruction to be sent sent by the first device.
[0129] In this embodiment, based on the heartbeat message reported by the first device, it is determined whether the first device is currently in a set time after reporting the heartbeat message, that is, it is determined whether the first device is currently in an active state, that is, it is determined whether the first device can currently receive instructions issued by the server. If it is determined that the first device is currently in a set time after reporting the heartbeat message, it indicates that the first device is currently in an active state, that is, it indicates that the first device can currently receive instructions issued by the server, then the instruction to be sent is sent to the first device, so that the first device can successfully receive the instruction to be sent, and the instruction is successfully sent, and the instruction is accurately sent, avoiding the loss of the instruction issued by the server, and avoiding waste of resources. When the first device receives the instruction to be sent, it executes the instruction to be sent, that is, it performs related operations based on the instruction to be sent, and generates corresponding response information, that is, it generates response information corresponding to the instruction to be sent, so as to achieve a successful response to the instruction, thereby achieving successful control of the first device and avoiding control failure of the first device.
[0130] In this embodiment, after generating response information corresponding to the instruction to be sent, the first device returns the response information to the server. When the server receives the response information, it determines that the first device has successfully received and executed the instruction to be sent, and there is no need to continue sending the instruction to be sent.
[0131] Optionally, when the instruction to be sent corresponding to the first device is sent to the first device, if no response information is received from the first device within a preset receiving time, indicating that the instruction to be sent may be lost or the first device has not executed the instruction to be sent, the instruction to be sent is resent to the first device.
[0132] The preset receiving time can be set according to actual conditions. For example, the preset receiving time is 1 minute.
[0133] From the above description, it can be seen that when the instruction to be sent is obtained, it indicates that the instruction to be sent needs to be sent to the corresponding first device. The first device reports a heartbeat message for each heartbeat cycle, and after each heartbeat message is reported, it enters a sleep state after a set time. That is, the first device is a low-power device. Based on the heartbeat message reported by the first device, it is determined whether the current time is within the set time after the first device reports the message, that is, it is determined whether the first device is currently in a non-sleep state, that is, an active state. Therefore, when the first device is in an active state, the instruction to be sent is sent to the first device to achieve successful sending of the instruction and avoid loss of the instruction, so that the first device can generate corresponding response information based on the instruction to be sent, and return the response information to achieve a successful response to the instruction, thereby achieving successful control of the first device and meeting user needs.
[0134] like Figure 2 As shown, Figure 2 This is a flowchart of another instruction processing method according to an exemplary embodiment of the present specification. When a heartbeat message reported by a first device is received, the heartbeat message can be displayed. The following will describe this process in detail in conjunction with a specific embodiment. Figure 2 As shown, the method comprises the following steps:
[0135] Step 201: Obtain an instruction to be sent, and determine a first device corresponding to the instruction to be sent.
[0136] In this embodiment, in response to the update operation of the first device information in the first page, the updated first device information is obtained, and an update instruction corresponding to the first device is generated according to the updated first device information. The update instruction instructs the first device to perform corresponding update processing based on the updated first device information. The first device information includes the heartbeat period and / or alarm threshold corresponding to the first device.
[0137] Specifically, when the user needs to modify the relevant information of the first device, the first device information in the displayed first page is modified accordingly, that is, the corresponding update operation is input. When the server receives the update operation corresponding to the first device information, it obtains the user's modified data, that is, the updated first device information, and generates an update instruction including the updated first device information, and sends the update instruction to the first device, so that the first device modifies the local first device information based on the updated first device information in the update instruction, thereby updating the relevant parameters of the first device, thereby achieving effective control of the first device.
[0138] For example, the current heartbeat cycle of the first device is 5 minutes. The user modifies the heartbeat cycle displayed on the first page, that is, updates it. The updated heartbeat cycle is 4 minutes. An update instruction including the updated heartbeat cycle is generated and sent to the first device. After receiving the update instruction, the first device extracts the updated heartbeat cycle from the update instruction and updates its own heartbeat cycle to 4 minutes.
[0139] The first device information may also include other types of information, which are not limited here.
[0140] Optionally, the first page may be a front-end page, which may be displayed by a display device, that is, the display device provides a first page, and the first page displays the first device information. In response to an update operation of the first device information in the first page, the updated first device information is determined, and the first device information is sent to the server.
[0141] Specifically, when the user needs to modify the first device information on the first page displayed on the display device, the first device information is modified accordingly, that is, a corresponding update operation is input, and the display device obtains the updated first device information corresponding to the update operation and sends it to the server, so that the server generates an update instruction including the updated first device information.
[0142] Optionally, the server may be a cloud platform. Of course, the cloud platform may also include a display device, that is, the cloud platform is composed of a server and a display device.
[0143] In this embodiment, when the user needs to query the relevant information of the first device, the information to be queried corresponding to the first device is obtained, and a query instruction corresponding to the first device is generated according to the information to be queried corresponding to the first device. The query instruction is sent to the first device, so that the first device performs a query based on the information to be queried in the query instruction, obtains the corresponding target information, and generates response information including the target information. The response information is sent to the server, so that the server obtains the target information from the response information, thereby realizing the information query.
[0144] Optionally, after obtaining the target information, the server may display the target information so that relevant personnel can directly and intuitively know the target information.
[0145] The information to be queried includes one or more of an alarm status, a heartbeat cycle, an alarm threshold, a signal strength, a voltage and a tilt angle corresponding to the first device.
[0146] The alarm threshold may represent the alarm threshold corresponding to the relevant parameter (e.g., voltage). The alarm state is based on the alarm threshold and the relevant parameter. For example, when the relevant parameter is greater than the alarm threshold, it indicates that the relevant parameter is abnormal, and the alarm state is the first state (e.g., Alarm state); for another example, when the relevant parameter is less than or equal to the alarm threshold, it indicates that the relevant parameter is normal, and the alarm state is the second state (e.g., No Alarm state).
[0147] Step 202: Based on the heartbeat message reported by the first device, the instruction to be sent is sent to the first device, so that the first device generates response information corresponding to the instruction to be sent when receiving the instruction to be sent.
[0148] In this embodiment, when a heartbeat message reported by a first device is received, a set time corresponding to the first device is obtained. The heartbeat message reported by the first device is saved to a preset location, or identification information corresponding to the first device is generated and saved to a preset location. After the set time corresponding to the first device has passed, the heartbeat message reported by the first device is deleted from the preset location, or the identification information corresponding to the first device is deleted from the preset location.
[0149] Specifically, in order to facilitate determining whether the first device is in an active state by judging whether there is a heartbeat message in a preset position, when a heartbeat message reported by the first device is received, the heartbeat message is saved to the preset position, and after the set time corresponding to the first device has passed, that is, after the heartbeat message is saved in the preset position for the set time, it indicates that the first device has entered a sleep state and cannot receive instructions issued by the server, then the heartbeat message is deleted from the preset position.
[0150] It can be understood that when there is a heartbeat message reported by the first device in the preset position, it indicates that the first device is in an active state, that is, it can receive instructions sent by the server. When there is no heartbeat message reported by the first device in the preset position, it indicates that the first device is currently in a dormant state, that is, it indicates that the time t for the first device to report a heartbeat message has passed, that is, it indicates that it cannot receive instructions sent by the server.
[0151] The preset location includes one or more of a cache, a disk, and a database. The preset location can be set as required. For example, in order to improve the efficiency of information reading and writing, the preset location can be set as a cache. Of course, the preset location can also include other locations, as long as the location can store data, and it is not limited here.
[0152] Specifically, in order to facilitate determining whether the first device is in an active state by judging whether there is identification information in a preset position, when a heartbeat message reported by the first device is received, corresponding identification information is generated and used as identification information corresponding to the first device. The identification information corresponding to the first device is saved in the preset position, and after the set time corresponding to the first device has passed, that is, after the identification information corresponding to the first device is saved in the preset position for a set time, it indicates that the first device has entered a sleep state and cannot receive instructions issued by the server, then the identification information corresponding to the first device is deleted from the preset position.
[0153] Among them, when generating the identification information corresponding to the first device, it can be generated based on the heartbeat message, or a preset identifier (for example, 01) can be directly used as the identification information corresponding to the first device. Here, there is no restriction on it, as long as it can indicate that the server has received the heartbeat message reported by the first device.
[0154] Optionally, when corresponding identification information is generated based on the heartbeat message, specified information in the heartbeat message can be used as the identification information, or it can be determined by performing relevant processing on the heartbeat message (for example, calculating the hash value corresponding to the heartbeat message and using the hash value as the identification information corresponding to the first device), or other information related to the first device (for example, the device identification corresponding to the first device) can be used as the identification information corresponding to the first device.
[0155] It can be understood that when the identification information corresponding to the first device exists in the preset position, it indicates that the first device is in an active state, that is, it can receive instructions sent by the server. When the identification information reported by the first device does not exist in the preset position, it indicates that the first device is currently in a dormant state, that is, it cannot receive instructions sent by the server.
[0156] Optionally, the heartbeat message reported by the first device can be saved to a preset location in the form of key, value, and t, so as to determine whether the heartbeat message reported by the first device exists in the preset location, that is, it can be searched by the device identifier corresponding to the first device, and the specific process is: obtain the device identifier corresponding to the first device, and use the device identifier corresponding to the first device as the key name, that is, use the device identifier corresponding to the first device as t. Use the heartbeat message reported by the first device as the key value, and save the key name, key value, and the set time corresponding to the first device to the preset location.
[0157] Among them, when the preset location is a cache, the code for saving the key name, key value, and the set time corresponding to the first device to the cache location is as follows:
[0158] / *
[0159] Message preset location
[0160] * /
[0161] if msg.Topic=="Publish Topic"{
[0162] global.Cache.Set("device_id","msg",t)
[0163] return
[0164] };
[0165] Optionally, the identification information corresponding to the first device can also be saved to a preset location in the form of key, value, and t, and the specific process is: obtain the device identification corresponding to the first device, and use the device identification corresponding to the first device as the key name, that is, use the device identification corresponding to the first device as t. Use the identification information corresponding to the first device as the key value, and save the key name, key value, and the set time corresponding to the first device to the preset location.
[0166] Optionally, when a heartbeat message reported by the first device is received, the state flag corresponding to the first device is modified to a first preset flag to indicate that the first device has entered an active state, that is, the first preset flag indicates that the first device is in an active state. After a set time corresponding to the first device has passed, the state flag corresponding to the first device is modified to a second preset flag to indicate that the first device has entered a dormant state, that is, the second preset flag indicates that the first device is in a dormant state.
[0167] The specific values of the first preset identifier and the second preset identifier can be set according to actual conditions, as long as the two are different. For example, the first preset identifier is 1 and the second preset identifier is 0.
[0168] Optionally, when sending the instruction to be sent to the first device based on the heartbeat message reported by the first device, the instruction can be sent in the following three ways.
[0169] One method is: in response to the presence of a heartbeat message reported by the first device or identification information corresponding to the first device in a preset position, sending a to-be-sent instruction to the first device. The identification information corresponding to the first device is determined upon receiving a heartbeat message reported by the first device. In response to the absence of a heartbeat message reported by the first device or identification information corresponding to the first device in the preset position, upon receiving a new heartbeat message reported by the first device, sending a to-be-sent instruction to the first device. The heartbeat message reported by the first device in the preset position or identification information corresponding to the first device is saved upon receiving a heartbeat message reported by the first device and deleted after the set time.
[0170] Specifically, when it is necessary to send the instruction to be sent corresponding to the first device to the first device, it is determined whether there is a heartbeat message reported by the first device or identification information corresponding to the first device in the preset position to determine whether the first device is currently in an active state, that is, to determine whether the first device can receive the instruction sent by the server, that is, to determine whether the current moment is within the time range in which the first device can receive the instruction after reporting the heartbeat message. In the case that there is a heartbeat message reported by the first device or identification information corresponding to the first device in the preset position, it indicates that the current moment is still within the time range in which the first device can receive the instruction, that is, it indicates that the first device is currently in an active state, and the instruction to be sent is sent to the first device. The first device can successfully receive the instruction to be sent, and the instruction can be accurately sent without repeatedly sending the instruction. On the basis of avoiding the failure of instruction sending, waste of resources can be avoided.
[0171] When there is no heartbeat message reported by the first device or the identification information corresponding to the first device in the preset position, it indicates that the current moment is not within the time range where the first device can receive instructions, that is, it indicates that the first device is currently in a dormant state. In order to avoid failure in issuing instructions, stop sending the pending instructions corresponding to the first device until the first device reports a heartbeat message, and then trigger the issuance of instructions. That is, when a new heartbeat message sent by the first device is received, it indicates that the first device is currently in an active state, and then send the pending instructions to the first device, so as to achieve accurate issuance of instructions. On the basis of avoiding failure in sending instructions, waste of resources can be avoided.
[0172] It can be understood that, in the case where the heartbeat message reported by the first device is directly saved to the preset location, when the instruction to be sent needs to be sent to the first device, it is determined whether the heartbeat message reported by the first device exists in the preset location. If the heartbeat message reported by the first device exists in the preset location, the instruction to be sent is sent to the first device. If the heartbeat message reported by the first device does not exist in the preset location, the instruction to be sent is sent to the first device when the heartbeat message uploaded by the first device is received again. Similarly, in the case where the identification information corresponding to the first device is saved to the preset location, when the instruction to be sent needs to be sent to the first device, it is determined whether the identification information corresponding to the first device exists in the preset location.
[0173] Optionally, judging whether there is a heartbeat message reported by the first device or identification information corresponding to the first device in the preset position can be judged by the device identification corresponding to the first device, so as to determine whether to directly send the instruction to be sent to the first device. The specific process is: if the value corresponding to the device identification corresponding to the first device is not found in the preset position, that is, the heartbeat message or the identification information corresponding to the first device, it indicates that the preset position is empty, then it is determined that there is no heartbeat message reported by the first device in the preset position, and when the heartbeat message uploaded by the first device again is received, the instruction to be sent is sent to the first device. If the value corresponding to the device identification corresponding to the first device is found in the preset position, that is, the heartbeat message or the identification information corresponding to the first device, it indicates that the preset position is not empty, then it is determined that there is a heartbeat message reported by the first device in the preset position, and the instruction to be sent is sent to the first device. Wherein, when the preset position is a cache, the implementation code of the process is as follows:
[0174] / *
[0175] Check whether the cache is empty
[0176] * /
[0177] if msg.Topic=="Subscribe Topic"{
[0178] get,_:=global.Cache.Get("device_id")
[0179] if get!=nil{
[0180] token:=mqttProducer.client.Publish(msg.Topic,msg.Qos,msg.Retained,msg.Payload)
[0181] }
[0182] else{
[0183] ProduceMqttMessageBytes("Subscribe Topic",gconv.Bytes(msg.Payload))
[0184] }
[0185] };
[0186] In this embodiment, when sending a to-be-sent instruction to the first device, since the heartbeat message reported by the first device or the identification information corresponding to the first device is only saved in the preset location for a set time, that is, the heartbeat message is saved in the preset location only within the set time of reporting the heartbeat message by the first device, it is possible to determine whether the current time is within the set time after the first device reports the heartbeat message by judging whether there is a heartbeat message reported by the first device or the identification information corresponding to the first device in the preset location, that is, to judge whether the first device is currently in an active state, thereby determining whether to immediately send the to-be-sent instruction, thereby achieving accurate issuance of the instruction, and avoiding the loss of instructions and waste of resources due to repeated sending.
[0187] Another method is to obtain the reporting time corresponding to the target heartbeat message and the set time corresponding to the first device. The target heartbeat message indicates the heartbeat message reported by the first device that was recently received. The set time indicates the duration of the first device being in an active state after reporting the heartbeat message. According to the reporting time corresponding to the target heartbeat message and the set time, the instruction to be sent is sent to the first device.
[0188] Specifically, when it is necessary to send the to-be-sent instruction corresponding to the first device to the first device, obtain the heartbeat message reported by the first device the most recently received, and use the heartbeat message as the target heartbeat message. Obtain the reporting time corresponding to the target heartbeat message, and obtain the set time corresponding to the first device, so as to use the reporting time and the set time to determine whether the first device is currently in an active state, that is, to determine whether the first device can receive the instruction sent by the server, that is, to determine whether the current time is within the time range in which the first device can receive the instruction after reporting the heartbeat message, so as to determine whether to send the to-be-sent instruction corresponding to the first device directly to the first device.
[0189] The reporting time may indicate the time when the heartbeat message reported by the first device is received, that is, when the heartbeat message reported by the first device is received, the current time is recorded and the current time is used as the reporting time. The reporting time may also indicate the time when the first device collects the heartbeat message, that is, when the first device needs to send a heartbeat message, it collects the corresponding information, records the collection time, generates a heartbeat message including the collected information and the collection time, and reports the heartbeat message to the server. When the server receives the heartbeat message, it extracts the collection time from the heartbeat message and uses the collection time as the reporting time corresponding to the first device.
[0190] Optionally, sending the instruction to be sent to the first device according to the reporting time and the set time corresponding to the target heartbeat message includes:
[0191] A first time range is determined according to a reporting time and a set time corresponding to the target heartbeat message, where the first time range indicates a time range in which the first device is in an active state.
[0192] In response to the current moment being within the first time range, the instruction to be sent is sent to the first device.
[0193] In response to the current time not being within the first time range, upon receiving a new heartbeat message reported by the first device, sending the to-be-sent instruction to the first device.
[0194] Specifically, the time when the first device is in an active state, that is, the first time range, is determined based on the most recently received heartbeat message, that is, the most recently uploaded heartbeat message of the first device, that is, the reporting time and set time corresponding to the target heartbeat message. It is determined whether the current moment is within the first time range to determine whether the first device is currently in an active state, that is, to determine whether the first device can receive instructions issued by the server. If the current moment is within the first time range, it indicates that the first device is currently in an active state, that is, it indicates that the first device can receive instructions issued by the server, then the to-be-sent instruction corresponding to the first device is sent to the first device, and the first device can successfully receive the to-be-sent instruction, thereby realizing accurate issuance of instructions without the need to repeatedly send instructions. On the basis of avoiding failure in instruction sending, waste of resources can be avoided.
[0195] When the current moment is not within the first time range, it indicates that the current moment is not within the time range in which the first device can receive instructions, that is, the first device is currently in a dormant state. In order to avoid failure in sending instructions, stop sending the pending instructions corresponding to the first device until the first device reports a heartbeat message, and then trigger the sending of instructions. That is, when a new heartbeat message sent by the first device is received, it indicates that the first device is currently in an active state, and the pending instructions are sent to the first device, so as to achieve accurate sending of instructions. On the basis of avoiding failure in sending instructions, waste of resources can be avoided.
[0196] Taking a specific application scenario as an example, the heartbeat period corresponding to the first device is 5 seconds, and the set time is 2 seconds, that is, the first device reports a heartbeat message every 5 seconds and is in an active state within 2 seconds of reporting the heartbeat message. The heartbeat message most recently uploaded by the first device, that is, the reporting time corresponding to the target heartbeat message is 9:00′20″, then the first device is in an active state within the time range of 9:00′20″-9:00′22″, that is, 9:00′20″-9:00′22″ is the first time range. When the current time is within the first time range, for example, the current time is 9:00′21″, indicating that the first device is currently in an active state, the instruction to be sent is sent to the first device. When the current time is not within the first time range, for example, the current time is 9:00′23″, indicating that the first device is not currently in an active state, the first device will report a heartbeat message again at 9:00′27″. When the server receives the heartbeat message reported by the first device again, the server will send the to-be-sent instruction to the first device.
[0197] In this embodiment, when sending a to-be-sent instruction to the first device, the reporting time corresponding to the heartbeat message reported by the first device that is most recently received is obtained, and based on the reporting time and the set time corresponding to the first device, it is directly determined whether the current time is within the set time of the heartbeat message reported by the first device, that is, it is directly determined whether the first device is currently in an active state, thereby determining whether to immediately send the to-be-sent instruction, thereby achieving accurate issuance of the instruction, and avoiding the loss of instructions and waste of resources due to repeated sending.
[0198] Another method is: obtain the status flag corresponding to the first device. The status flag is determined according to the heartbeat message reported by the first device. When the status flag is a first preset flag, the instruction to be sent is sent to the first device. The first preset flag indicates that the first device is in an active state. When the status flag is a second preset flag, upon receiving a new heartbeat message reported by the first device, the instruction to be sent is sent to the first device. The second preset flag indicates that the first device is in a dormant state.
[0199] Specifically, when the device to be sent corresponding to the first device needs to be sent to the first device, the status identification bit corresponding to the first device is obtained, that is, the current specific value of the status identification bit. When the status identification bit is the first preset identification bit, it indicates that it is still within the set time after the first device reports the heartbeat message, that is, it indicates that the first device is currently in an active state, and the instruction to be sent is sent to the first device. When the status identification bit is the second preset identification bit, it indicates that it is not currently within the set time after the first device reports the heartbeat message, that is, it indicates that the first device is currently in a dormant state, and then wait until a new heartbeat message reported by the first device is received, that is, when the status identification bit corresponding to the first device is the first preset identification bit again, the instruction to be sent is sent to the first device.
[0200] In this embodiment, when sending a to-be-sent instruction to the first device, the status identification bit corresponding to the first device is obtained, and the status identification bit is used to directly determine whether the current moment is within the set time for the first device to report a heartbeat message, that is, to directly determine whether the first device is currently in an active state, thereby determining whether to immediately send the to-be-sent instruction, thereby achieving accurate issuance of the instruction, avoiding the loss of the instruction and the waste of resources due to repeated sending.
[0201] Optionally, when it is necessary to send the instruction to be sent to the first device, the instruction to be sent can also be sent in a cyclic sending manner, that is, the instruction to be sent is sent to the first device; in response to not receiving the response information corresponding to the instruction to be sent sent by the first device, return to the step of sending the instruction to be sent to the first device; in response to receiving the response information corresponding to the instruction to be sent sent by the first device, stop sending the instruction to be sent to the first device.
[0202] Specifically, when the to-be-sent instruction is sent in a manner of continuously sending instructions, the to-be-sent instruction is sent to the first device at regular intervals until the to-be-sent instruction is stopped after response information returned by the first device is received.
[0203] Wherein, if the response information corresponding to the instruction to be sent sent by the first device is not received within the preset receiving time, it is determined that the response information corresponding to the instruction to be sent sent by the first device is not received. If the response information corresponding to the instruction to be sent sent by the first device is received within the preset receiving time, it is determined that the response information corresponding to the instruction to be sent sent by the first device is received.
[0204] Step 203: Receive response information corresponding to the instruction to be sent sent by the first device.
[0205] Step 204: When a heartbeat message reported by the first device is received, the heartbeat message is parsed based on a preset protocol format, and the parsed heartbeat message is displayed.
[0206] In this embodiment, when the server receives the heartbeat message reported by the first device, it parses the heartbeat message based on a preset protocol format, that is, extracts the required information from the heartbeat message to obtain the parsed heartbeat message, and displays the parsed heartbeat message to achieve visualization of the heartbeat message, so that relevant personnel can intuitively know the current situation of the first device.
[0207] The heartbeat message reported by the first device is associated with the type of the first device, and relevant personnel may also pre-set the information included in the heartbeat message reported by the first device. For example, when the first device is a dual-axis tilt sensor, the heartbeat message reported by the first device includes one or more of the current heartbeat cycle, the current alarm state, the current alarm threshold, the current signal strength, the current voltage, and the current tilt angle.
[0208] The current tilt angle includes the current X-axis angle and / or Y-axis angle.
[0209] The process of parsing the heartbeat message based on the preset protocol format is similar to the existing process of parsing related messages based on the protocol format, and will not be described in detail here.
[0210] Optionally, in the case of displaying the parsed heartbeat message, it can be displayed through the front end, that is, the leaf including the parsed heartbeat message can be displayed through the display device, that is, the server sends the parsed heartbeat message to the display device, so that the display device displays the parsed heartbeat message (such as Figure 3 The second page showing the parsed heartbeat message is shown).
[0211] In the case where the parsed heartbeat message is sent to a display device, it may be sent based on an Internet of Things (IoT) protocol.
[0212] The heartbeat message may also include the expected values corresponding to the relevant parameters, such as Figure 3 As shown, the expected value of the heartbeat cycle represents the standard value of the set heartbeat cycle, that is, the set value of the heartbeat cycle. For example, the heartbeat cycle of the first device is set to 6 seconds, but during the operation of the first device, the heartbeat cycle becomes 5 seconds, that is, the current heartbeat cycle is 5 seconds.
[0213] Optionally, the user can also modify relevant parameters on the second page, that is, enter the corresponding update operation. Figure 3As shown, the user can modify the heartbeat cycle and alarm threshold on the second page, that is, enter the corresponding modified value in the input box 10.
[0214] Optionally, the user can also refresh the parsed heartbeat message displayed on the second page, that is, for each information in the parsed heartbeat message, that is, the refresh button corresponding to the parameter (such as Figure 3 The refresh button 20 shown in the figure is used to update the information by triggering the refresh button. For example, the parsed heartbeat message includes voltage, and the voltage is refreshed by triggering the refresh button corresponding to the voltage to update it to the latest value.
[0215] Optionally, after obtaining the parsed heartbeat message, other processing operations can be performed on it. For example, when the alarm status in the parsed heartbeat message is the first status (for example, Alarm status), it indicates that the relevant parameters of the first device have exceeded the alarm threshold, that is, the first device has alarmed and relevant personnel are required to detect the first device. In this way, an alarm message is generated and sent to the user end corresponding to the relevant personnel.
[0216] In this embodiment, considering that the actual heartbeat cycle of the first device may not match the set heartbeat cycle, that is, the expected value of the heartbeat cycle, it is impossible to directly use the heartbeat cycle of the first device to determine whether the first device is in an active state, so when sending the instruction to be sent based on the heartbeat cycle corresponding to the first device, it is impossible to determine whether the first device is currently in an active state, and thus the instruction cannot be successfully sent. At the same time, considering that the instruction to be sent is sent only when the heartbeat message reported by the first device is received, each instruction may need to wait, resulting in delayed sending of the instruction. Therefore, the present application accurately determines whether the current moment is within the set time after the first device reports the heartbeat message based on the heartbeat message reported by the first device, that is, whether the first device is currently in an active state, so that when it is determined that the first device is currently in an active state, the instruction to be sent is sent to the first device, so as to achieve timely and accurate issuance of the instruction.
[0217] In this embodiment, the first device reports a heartbeat message to the server every heartbeat cycle. When the server receives the heartbeat message reported by the first device, it parses it to extract the required information, thereby obtaining a parsed heartbeat message, and displays the parsed heartbeat message to achieve a visual display of the heartbeat message, so that the user can intuitively know the heartbeat message of the first device, that is, the current situation of the first device, to meet user needs.
[0218] Corresponding to the embodiments of the aforementioned method, this specification also provides embodiments of an instruction processing device and a terminal to which it is applied.
[0219] The embodiments of the instruction processing device of this specification can be applied on a server, such as a server (for example, the media server described above). The device embodiments can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor in which it is located reading the corresponding computer program instructions in the non-volatile memory into the memory and running them. From the hardware level, if Figure 4 The figure is a hardware structure diagram of the server where the instruction processing device of the embodiment of this specification is located, except Figure 4 In addition to the processor 410, memory 430, network interface 420, and non-volatile memory 440 shown, the server where the instruction processing device 431 is located in the embodiment may also include other hardware according to the actual function of the server, which will not be described in detail.
[0220] like Figure 5 As shown, Figure 5 is a block diagram of an instruction processing device according to an exemplary embodiment of the present specification, the device comprising:
[0221] The instruction acquisition module 510 is used to acquire the instruction to be sent and determine the first device corresponding to the instruction to be sent; wherein the first device is a device that reports a heartbeat message in each heartbeat cycle and enters a sleep state after a set time after each heartbeat message is reported.
[0222] The instruction sending module 520 is used to send the instruction to be sent to the first device based on the heartbeat message reported by the first device, so that the first device generates response information corresponding to the instruction to be sent when receiving the instruction to be sent.
[0223] The information receiving module 530 is used to receive response information corresponding to the instruction to be sent sent by the first device.
[0224] Optionally, the instruction sending module 520 is specifically used for:
[0225] In response to the presence of a heartbeat message reported by the first device or identification information corresponding to the first device in the preset position, the instruction to be sent is sent to the first device, wherein the identification information corresponding to the first device is determined when the heartbeat message reported by the first device is received.
[0226] In response to the absence of a heartbeat message reported by the first device or identification information corresponding to the first device in the preset position, when a new heartbeat message reported by the first device is received, the instruction to be sent is sent to the first device.
[0227] The heartbeat message reported by the first device in the preset position or the identification information corresponding to the first device is saved when the heartbeat message reported by the first device is received, and is deleted after a set time has passed.
[0228] Optionally, the preset location includes one or more of a cache, a disk, and a database.
[0229] Optionally, the instruction sending module 520 is specifically used for:
[0230] The reporting time corresponding to the target heartbeat message is obtained, and the setting time corresponding to the first device is obtained, wherein the target heartbeat message represents the heartbeat message reported by the first device most recently received.
[0231] According to the reporting time corresponding to the target heartbeat message and the set time, the instruction to be sent is sent to the first device.
[0232] Optionally, the instruction sending module 520 is further specifically configured to:
[0233] A first time range is determined according to a reporting time and a set time corresponding to the target heartbeat message, where the first time range indicates a time range in which the first device is in an active state.
[0234] In response to the current moment being within the first time range, the instruction to be sent is sent to the first device.
[0235] In response to the current time not being within the first time range, upon receiving a new heartbeat message reported by the first device, sending the to-be-sent instruction to the first device.
[0236] Optionally, the instruction sending module 520 is further used for:
[0237] Obtain a status flag corresponding to the first device, wherein the status flag is determined according to a heartbeat message reported by the first device.
[0238] When the state flag is a first preset flag, the instruction to be sent is sent to the first device, wherein the first preset flag indicates that the first device is in an active state.
[0239] When the state flag is a second preset flag, when a new heartbeat message reported by the first device is received, the instruction to be sent is sent to the first device, wherein the second preset flag indicates that the first device is in a dormant state.
[0240] Optionally, the instruction sending module 520 is also used to
[0241] The instruction to be sent is sent to the first device.
[0242] In response to not receiving the response information corresponding to the instruction to be sent sent by the first device, return to the step of sending the instruction to be sent to the first device.
[0243] In response to receiving response information corresponding to the instruction to be sent sent by the first device, stopping sending the instruction to be sent to the first device.
[0244] Optionally, the instruction processing device also includes an information storage module.
[0245] The information storage module is used to:
[0246] When a heartbeat message reported by the first device is received, a set time corresponding to the first device is obtained.
[0247] The heartbeat message reported by the first device is saved to a preset location, or identification information corresponding to the first device is obtained and the identification information corresponding to the first device is saved to a preset location.
[0248] After a set time corresponding to the first device has passed, the heartbeat message reported by the first device is deleted from the preset location, or the identification information corresponding to the first device is deleted from the preset location.
[0249] Optionally, the information storage module is specifically used for:
[0250] A device identifier corresponding to the first device is obtained, and the device identifier corresponding to the first device is used as a key name.
[0251] The heartbeat message reported by the first device is used as the key value, and the key name, key value and the set time corresponding to the first device are saved to a preset location.
[0252] Optionally, the heartbeat message includes one or more of a current heartbeat cycle, a current alarm state, a current alarm threshold, a current signal strength, a current voltage, and a current tilt angle.
[0253] Optionally, the instruction processing device also includes a display module.
[0254] Display modules are used for:
[0255] When a heartbeat message reported by the first device is received, the heartbeat message is parsed based on a preset protocol format, and the parsed heartbeat message is displayed.
[0256] Optionally, the instructions to be sent include update instructions.
[0257] The instruction acquisition module 510 is also used for:
[0258] In response to an update operation of the first device information in the first page, the updated first device information is obtained, and an update instruction corresponding to the first device is generated according to the updated first device information. The update instruction instructs the first device to perform corresponding update processing based on the updated first device information. The first device information includes a heartbeat cycle and / or an alarm threshold corresponding to the first device.
[0259] Optionally, the instruction to be sent includes a query instruction.
[0260] The instruction acquisition module 510 is also used for:
[0261] The information to be queried corresponding to the first device is obtained, and a query instruction corresponding to the first device is generated according to the information to be queried corresponding to the first device.
[0262] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.
[0263] like Figure 6 As shown, Figure 6 It is a structural diagram of a communication system shown in this specification according to an exemplary embodiment, and the system includes a server and a first device.
[0264] The server 610 is used to obtain the instruction to be sent and determine the first device corresponding to the instruction to be sent. Based on the heartbeat message reported by the first device, the instruction to be sent is sent to the first device. And the response information corresponding to the instruction to be sent sent by the first device is received. The first device is a device that reports a heartbeat message in each heartbeat cycle and enters a dormant state after a set time after each heartbeat message is reported.
[0265] The first device 620 is configured to generate response information corresponding to the instruction to be sent when receiving the instruction to be sent.
[0266] In this embodiment, when the server 610 obtains the instruction to be sent, it indicates that the instruction to be sent needs to be sent to the corresponding first device 620. The first device 620 reports a heartbeat message for each heartbeat cycle, and after each heartbeat message is reported, the device enters a sleep state after a set time. That is, the first device 620 is a low-power device. The server 610 sends the instruction to be sent to the first device 620 based on the heartbeat message reported by the first device 620, so as to successfully send the instruction and avoid the loss of the instruction, so that the first device 620 can generate corresponding response information based on the instruction to be sent, and return the response information to achieve a successful response to the instruction, thereby achieving successful control of the first device 620 and meeting user needs.
[0267] like Figure 7 As shown, Figure 7is a structural diagram of another communication system shown in this specification according to an exemplary embodiment, such as Figure 7 As shown, the communication system further includes a display device 630;
[0268] The server 610 is used to parse the heartbeat message based on a preset protocol format when receiving the heartbeat message reported by the first device 620 , and send the parsed heartbeat message to the display device 630 .
[0269] The display device 630 is used to display the parsed heartbeat message.
[0270] Optionally, a first page is provided through the display device 630, and the first page displays the information of the first device 620. In response to the update operation of the first device 620 information in the first page, the updated first device 620 information is determined and sent to the server 610.
[0271] The implementation process of the functions and effects of each device in the above system is specifically described in the implementation process of the corresponding steps in the above method, which will not be repeated here.
[0272] An embodiment of the present application provides a computer-readable storage medium, in which a computer program code is stored. When the computer program code is executed by a processor, the above method steps are implemented.
[0273] An embodiment of the present application also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the above method steps are implemented.
[0274] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. A person of ordinary skill in the art can understand and implement it without paying creative labor.
[0275] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0276] Those skilled in the art will readily appreciate other embodiments of the specification after considering the specification and practicing the invention claimed herein. The specification is intended to cover any variations, uses or adaptations of the specification that follow the general principles of the specification and include common knowledge or customary techniques in the art that are not claimed in the specification. The specification and examples are to be considered exemplary only, and the true scope and spirit of the specification are indicated by the following claims.
[0277] It should be understood that the present description is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is limited only by the appended claims.
[0278] The above description is only a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this specification should be included in the scope of protection of this specification.
Claims
1. A command processing method, characterized in that: Applied to a server, the method comprises: Obtaining an instruction to be sent, and determining a first device corresponding to the instruction to be sent; wherein the first device is a device that reports a heartbeat message in each heartbeat cycle, and enters a dormant state after a set time after each heartbeat message is reported; Based on the heartbeat message reported by the first device, sending the instruction to be sent to the first device includes: based on the most recently received heartbeat message reported by the first device, within a set time after determining that the current moment is within the first device Reporting the heartbeat message, sending the instruction to be sent to the first device, so that the first device generates response information corresponding to the instruction to be sent when receiving the instruction to be sent; Receive response information corresponding to the instruction to be sent sent by the first device.
2. The method according to claim 1, characterized in that The sending the instruction to be sent to the first device based on the heartbeat message reported by the first device includes: In response to the presence of a heartbeat message reported by the first device or identification information corresponding to the first device in the preset position, sending the instruction to be sent to the first device; wherein the identification information corresponding to the first device is determined when the heartbeat message reported by the first device is received; In response to the absence of the heartbeat message reported by the first device or the identification information corresponding to the first device in the preset position, upon receiving a new heartbeat message reported by the first device, sending the to-be-sent instruction to the first device; The heartbeat message reported by the first device in the preset position or the identification information corresponding to the first device is saved when the heartbeat message reported by the first device is received, and is deleted after the set time has passed.
3. The method according to claim 1, characterized in that The method further comprises: When it is determined that the current time is not within the set time after the first device reports the heartbeat message, when a new heartbeat message reported by the first device is received, the to-be-sent instruction is sent to the first device.
4. The method according to claim 1, characterized in that: The sending the instruction to be sent to the first device based on the heartbeat message reported by the first device includes: Obtaining a status flag corresponding to the first device; wherein the status flag is determined according to a heartbeat message reported by the first device; When the state flag is a first preset flag, sending the instruction to be sent to the first device; wherein the first preset flag indicates that the first device is in an active state; When the status flag is a second preset flag, upon receiving a new heartbeat message reported by the first device, the to-be-sent instruction is sent to the first device; wherein the second preset flag indicates that the first device is in a dormant state.
5. The method according to claim 1, characterized in that The method further comprises: Sending the to-be-sent instruction to the first device; In response to not receiving response information corresponding to the instruction to be sent sent by the first device, returning to the step of sending the instruction to be sent to the first device; In response to receiving response information corresponding to the instruction to be sent sent by the first device, stopping sending the instruction to be sent to the first device.
6. The method according to claim 1, characterized in that The method further comprises: Obtaining a device identifier corresponding to the first device, and using the device identifier corresponding to the first device as a key name; The heartbeat message reported by the first device is used as a key value, and the key name, the key value and the set time corresponding to the first device are saved to a preset location.
7. The method according to claim 2 or 6, characterized in that: The preset location includes one or more of a cache, a disk and a database; the heartbeat message includes one or more of a current heartbeat cycle, a current alarm state, a current alarm threshold, a current signal strength, a current voltage and a current tilt angle.
8. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: When a heartbeat message reported by the first device is received, the heartbeat message is parsed based on a preset protocol format, and the parsed heartbeat message is displayed.
9. The method according to any one of claims 1 to 6, characterized in that: The instructions to be sent include update instructions; The method further comprises: In response to an update operation of the first device information in the first page, the updated first device information is obtained, and an update instruction corresponding to the first device is generated according to the updated first device information; wherein the update instruction instructs the first device to perform corresponding update processing based on the updated first device information; the first device information includes a heartbeat cycle and / or alarm threshold corresponding to the first device.
10. The method according to any one of claims 1 to 6, characterized in that: The instructions to be sent include query instructions; The method further comprises: The to-be-queried information corresponding to the first device is acquired, and a query instruction corresponding to the first device is generated according to the to-be-queried information corresponding to the first device.
11. A communication system, characterized in that: The communication system includes a server and a first device; The server is used to obtain the instruction to be sent and determine the first device corresponding to the instruction to be sent; Based on the heartbeat message reported by the first device, sending the instruction to be sent to the first device includes: based on the most recently received heartbeat message reported by the first device, within a set time after determining that the current moment is within the first device Reported heartbeat message, sending the instruction to be sent to the first device; and receiving response information corresponding to the instruction to be sent sent by the first device; wherein the first device is a device that reports a heartbeat message in each heartbeat cycle and enters a dormant state after a set time after each heartbeat message is reported; The first device is used to generate response information corresponding to the instruction to be sent when receiving the instruction to be sent.
12. The system according to claim 11, characterized in that The communication system also includes a display device; The server is configured to, upon receiving the heartbeat message reported by the first device, parse the heartbeat message based on a preset protocol format, and send the parsed heartbeat message to the display device; The display device is used to display the parsed heartbeat message.
13. The system according to claim 12, characterized in that Providing a first page by the display device, wherein the first page displays first device information: In response to an update operation of the first device information in the first page, the updated first device information is determined, and the first device information is sent to the server.
14. An instruction processing device, characterized in that: Applied to a server, the device comprises: An instruction acquisition module, used to acquire the instruction to be sent and determine the first device corresponding to the instruction to be sent; wherein the first device is a device that reports a heartbeat message in each heartbeat cycle and enters a dormant state after a set time after each heartbeat message is reported; The instruction sending module is used to send the instruction to be sent to the first device based on the heartbeat message reported by the first device, including: based on the heartbeat message reported by the first device that is received most recently, within a set time after determining that the current time is within the set time after the first device reports the heartbeat message, sending the instruction to be sent to the first device, so that the first device generates response information corresponding to the instruction to be sent when receiving the instruction to be sent; The information receiving module is used to receive the response information corresponding to the instruction to be sent sent by the first device.
15. A server, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the following method is implemented: Obtaining an instruction to be sent, and determining a first device corresponding to the instruction to be sent; wherein the first device is a device that reports a heartbeat message in each heartbeat cycle, and enters a dormant state after a set time after each heartbeat message is reported; Based on the heartbeat message reported by the first device, sending the instruction to be sent to the first device includes: based on the most recently received heartbeat message reported by the first device, within a set time after determining that the current moment is within the first device Reporting the heartbeat message, sending the instruction to be sent to the first device, so that the first device generates response information corresponding to the instruction to be sent when receiving the instruction to be sent; Receive response information corresponding to the instruction to be sent sent by the first device.
Citation Information
Patent Citations
User off-line detection method and user off-line detection system
CN105827697A
Control instruction processing method and device
CN112492555A
