Instruction transmission method and related device
By adopting two rounds of repeated code sending mechanisms in the one-way communication protocol, the problem of controlling the success rate and response speed of command transmission under the one-way communication protocol is solved, and a higher transmission success rate and user experience is achieved.
Patent Information
- Application Number
- CN202410916831.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2024-11-12
AI Technical Summary
Under one-way communication protocol, it is difficult to ensure the success of transmission and response speed during the transmission of control commands, especially in the presence of signal interference and cost and power consumption limitations.
The interval two-wheel repeated coding mechanism is adopted. The first round of repeated coding sending sends M control commands, and N control commands are sent after the interval is preset. M is less than N to ensure the transmission success rate and response speed.
It improves the transmission success rate and response speed of control instructions, improves the user experience, and reduces the compensation time when transmission failure, and improves the reliability of the overall system.
Smart Images

Figure CN118944818A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data communication technology, and in particular to an instruction transmission method and related devices. Background Art
[0002] With the rapid development of data communication technology, control instructions are transmitted based on data communication protocols to control the device state of the corresponding device as the expected state, which has brought great convenience to people in intelligent control of device state switching.
[0003] Common data communication protocols include two-way communication protocols and one-way communication protocols. In a two-way communication protocol, the receiving end of a control instruction can return a response message to the sending end of the control instruction to indicate whether the control instruction has been received, thereby ensuring the successful transmission of the control instruction. In a one-way communication protocol, the receiving end cannot return a response message to the sending end, so it is impossible to accurately determine whether the control instruction has been successfully transmitted.
[0004] In some control scenarios, one-way communication protocols are usually used due to factors such as cost and power consumption. However, due to the characteristics of one-way communication protocols and certain signal interference during the transmission process, it is difficult to ensure that the control instructions can be transmitted to the receiving end in time and the device status of the corresponding device can be controlled. Summary of the invention
[0005] In order to solve the above technical problems, the present application provides a command transmission method and related devices, which are conducive to improving the response speed, thereby improving the user experience. At the same time, two rounds of repeated coding are conducive to ensuring the transmission success rate.
[0006] The embodiments of the present application disclose the following technical solutions:
[0007] On the one hand, an embodiment of the present application provides an instruction transmission method, the method comprising:
[0008] In response to a control event, determining a receiving end corresponding to the control event and a control instruction corresponding to the control event, wherein the receiving end is used to control a device state of a device corresponding to the receiving end to be an expected state according to the control instruction;
[0009] Sending the control instruction to the receiving end sequentially M times based on a one-way communication protocol;
[0010] If the interval after sending the control instruction for the Mth time reaches the preset time, the control instruction is sent to the receiving end N times in sequence based on the unidirectional communication protocol, and M is less than N.
[0011] On the other hand, an embodiment of the present application provides an instruction transmission device, the device comprising a determining unit and a sending unit:
[0012] The determining unit is used to determine, in response to a control event, a receiving end corresponding to the control event and a control instruction corresponding to the control event, wherein the receiving end is used to control a device state of a device corresponding to the receiving end to be an expected state according to the control instruction;
[0013] The sending unit is used to send the control instruction to the receiving end M times in sequence based on a one-way communication protocol;
[0014] The sending unit is further used to send the control instructions to the receiving end N times in sequence based on the unidirectional communication protocol if the interval after sending the control instruction for the Mth time reaches a preset time, and M is less than N.
[0015] In another aspect, an embodiment of the present application provides a computer device, the computer device comprising a processor and a memory:
[0016] The memory is used to store program code and transmit the program code to the processor;
[0017] The processor is used to execute the instruction transmission method described in the above aspects according to the instructions in the program code.
[0018] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the instruction transmission method described in the above aspects.
[0019] It can be seen from the above technical solution that for the scenario of control instruction transmission based on the one-way communication protocol, in response to the control event, the receiving end corresponding to the control event and the control instruction corresponding to the control event are first determined, wherein the receiving end is used to control the device state of the device corresponding to the receiving end to be the expected state according to the control instruction. Then, M control instructions can be sent to the receiving end in sequence based on the one-way communication protocol. If the interval time after sending the Mth control instruction reaches the preset time, the control instruction is continued to be sent to the receiving end in sequence N times based on the one-way communication protocol. Since in the scenario of control instruction transmission using the one-way communication protocol, the receiving end cannot return a response message indicating that the control instruction has been successfully received, in order to ensure the transmission success and the response speed at the same time, the present application provides an interval two-round repeated code transmission mechanism. Specifically, in the first round of repeated code transmission, M control instructions are sent in sequence, and the second round of repeated code transmission is performed after the preset time interval, and the number of repeated code transmissions in the first round is less than the number of repeated code transmissions in the second round. In this way, the transmission time of the first round of repeated code transmission is relatively short. If the receiving end can successfully receive the control instruction in the first round of repeated code transmission, it can control the device state to the expected state more quickly, thereby improving the response speed. Moreover, the mechanism of the second round of repeated code transmission makes it possible to increase the probability of successful transmission based on the N control instructions sent subsequently, even if the first round of repeated code transmission fails to be successfully transmitted. Based on this, it is conducive to improving the response speed, thereby improving the user experience, and at the same time, the two rounds of repeated code transmission are conducive to ensuring the success rate of transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 A flowchart of an instruction transmission method provided in an embodiment of the present application;
[0022] Figure 2 A schematic diagram of an instruction transmission process provided in an embodiment of the present application;
[0023] Figure 3 A structural diagram of an instruction transmission device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0025] RF433 is a wireless communication technology based on the 433MHz wireless operating frequency, which is widely used in the field of data communication. For example, in the control scenario of smart home, the control instructions can be transmitted to the receiving end of the smart home based on RF433 wireless communication technology to control the status of the smart home devices.
[0026] RF433 signal transmission distance is relatively long, usually up to 50 meters or even 100 meters, suitable for use in scenarios that require long-distance communication. In addition, compared with communication technologies such as Bluetooth, the cost is lower, and the power consumption of the chip corresponding to RF433 is relatively low, which can meet the scenarios with high requirements for battery life.
[0027] Affected by cost, power consumption and other factors, RF433 one-way communication technology is more common and widely used than two-way communication technology. Generally, the price of RF433 two-way communication chip is usually higher than that of one-way communication chip, which is about 1.5 to 2 times the price of one-way communication chip. This is because two-way communication chip requires additional hardware and complex communication protocols to support two-way communication function, which will increase the manufacturing cost of the chip. At the same time, two-way communication technology is relatively complex in design and development, which will also increase the cost.
[0028] However, since one-way communication technology can only perform one-way communication, the receiving end cannot return a response message to the sending end, so it is impossible to accurately determine whether the data is successfully transmitted. In addition, there will be certain signal interference during data transmission, making it difficult to ensure successful transmission. For example, since 433MHz is a public frequency, it may interfere with other wireless devices and affect the transmission quality. In addition, electromagnetic interference and metal structures will also have a certain impact on transmission, resulting in signal quality degradation or loss.
[0029] In this regard, the present application provides a command transmission method and related devices, which are conducive to improving the response speed, thereby improving the user experience. At the same time, two rounds of repeated coding are conducive to ensuring the transmission success rate.
[0030] The instruction transmission method provided in the embodiment of the present application can be implemented by a computer device, which can be a terminal device or a server, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. Terminal devices include but are not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, etc. The terminal device and the server can be directly or indirectly connected via wired or wireless communication, and this application does not impose any restrictions on this.
[0031] The specific examples are as follows:
[0032] Figure 1 A flowchart of a command transmission method provided in an embodiment of the present application is provided, and a terminal device as a transmitting end is used as the aforementioned computer device for illustration. The method includes S101-S103:
[0033] S101: In response to a control event, determine a receiving end corresponding to the control event and a control instruction corresponding to the control event.
[0034] Among them, the control event can be used to indicate the need to trigger data transmission to achieve the corresponding control purpose. Specifically, the sending end can respond to the control event and first determine the receiving end corresponding to the control event and the control instruction corresponding to the control event. Among them, the receiving end is used to control the device state of the device corresponding to the receiving end to the expected state according to the control instruction. That is, the control instruction is used to update the device state and is data that needs to be transmitted to the receiving end. Among them, the control instruction can be in the form of a control signal, for example.
[0035] It should be noted that the present application does not impose any limitation on the method for determining the control event. For ease of understanding, the present application provides the following method as an example:
[0036] In actual applications, users can flexibly adjust the device state of the device according to actual needs. Therefore, in a possible implementation, it is possible to respond to the control operation implemented by the user, and then determine the control event according to the control operation to trigger the subsequent steps. Based on this, the corresponding control event can be determined according to the user's needs. In this way, the control instruction is matched with the user's needs, which is conducive to improving the user experience.
[0037] The present application does not make any limitation on how to determine the control event according to the control operation. For ease of understanding, the present application provides the following methods as examples:
[0038] In some cases, the user may only want to change the device state of a certain device. For example, the control operation implemented by the user is used to instruct to adjust the device state of device A to the expected state corresponding to device A. Correspondingly, the receiving end corresponding to the control event can be the A receiving end corresponding to device A, and the control instruction needs to be transmitted to the A receiving end to adjust the device state of device A to the corresponding expected state.
[0039] In some other cases, the same transmitter is used to transmit data to multiple receivers corresponding to multiple devices, and the multiple devices may belong to the same scene (such as various smart home devices in the room). In order to simplify control and improve user experience, there may be an association mode between multiple devices belonging to the same scene. In the association mode, there is coupling between the device states of the multiple devices, that is, the change of the device state of one device may affect the device states of other devices and need to be changed accordingly.
[0040] Therefore, in another possible implementation, in response to a control operation performed by a user, it can be determined whether the control operation is used to indicate entering the association mode. If so, a control event for indicating that each device is adjusted to a preset state is generated according to the preset state of each device in the association mode. If not, the device indicated by the control operation to be adjusted and its expected state are determined. At the same time, it can also be determined whether the user has previously turned on the association mode. If the association mode has been turned on before, a control event for adjusting each device to meet the user's expectations is generated according to the device indicated by the control operation to be adjusted and its expected state, combined with the association mode.
[0041] S102: Sending M control instructions to the receiving end in sequence based on the one-way communication protocol.
[0042] S103: If the interval after sending the Mth control instruction reaches a preset time, send N control instructions to the receiving end in sequence based on the one-way communication protocol.
[0043] After determining the receiving end and the control instruction, the sending end can send M control instructions to the receiving end in sequence based on the one-way communication protocol, where M is a positive integer. And after the Mth control instruction is sent, the next round of code transmission is performed after a period of time. Specifically, if the interval after sending the Mth control instruction reaches the preset time, the sending end continues to send N control instructions to the receiving end in sequence based on the one-way communication protocol, where M is less than N and N is a positive integer. Usually, M can be 5 to 7, N can be 8 to 12, and the preset time X can be 3 seconds.
[0044] Based on this, an interval two-round repeated coding mechanism is provided. In the first round of repeated coding, a smaller number of M control instructions are sent in sequence, and in the second round of repeated coding, a larger number of N control instructions are sent in sequence. Based on this, if the receiving end can successfully receive the control instruction in the first round of repeated coding, the device state of the device can be controlled to the expected state more quickly, thereby improving the response speed. Moreover, the mechanism of the second round of repeated coding makes it possible to increase the probability of successful transmission based on the N control instructions sent subsequently, even if the first round of repeated coding fails to be successfully transmitted. Based on this, it is conducive to improving the response speed, thereby improving the user experience, and at the same time, the two rounds of repeated coding are conducive to ensuring the success rate of transmission.
[0045] In practical applications, due to the data transmission of the one-way communication protocol, the receiving end cannot return a response message indicating that the control instruction has been successfully received, and there will be certain signal interference during the data transmission process. Therefore, in order to increase the probability of successful transmission, the same control signal is repeatedly sent multiple times to increase the probability that the receiving end successfully receives the control signal. However, if the same control signal is repeated too many times, the efficiency of sending the next control signal will be affected. In this regard, the present application provides an interval two-round repeated coding mechanism, in which a small amount of control instructions are repeatedly sent in the first round, and a large amount of control instructions are repeatedly sent in the second round. In this way, for the next control signal, in the first round of repeated coding, it is only necessary to wait for a small amount of the previous control signal to be sent, which is conducive to improving the response efficiency.
[0046] For ease of understanding, the embodiment of the present application takes transmission based on the RF433 unidirectional communication protocol as an example, and the control instruction may be a 433 control signal. The following example description is provided:
[0047] Assuming that the probability of successful transmission of a single 433 control signal is p, in order to improve the transmission success rate of the 433 control signal, the success rates of the two rounds of repeated coding adopted in this application are respectively:
[0048] The transmission success rate of the first round of repeated code transmission M times:
[0049] 1-(1-p) M
[0050] The transmission success rate of the second round of repeated code transmission N times:
[0051] 1-(1-p) N
[0052] For example, assuming p = 0.5, M = 5, N = 10, we can calculate
[0053] The transmission success rate of the first round of repeated code transmission M times is 96.875%, and the transmission success rate of the second round of repeated code transmission N times is 99.902%. It can be seen that the increase in the number of code transmissions is very obvious for the improvement of the transmission success rate. Based on this, the first round of repeated code transmission in this application is small, which is conducive to improving the response efficiency. The second round of repeated code transmission is large, which is conducive to further guaranteeing the transmission success rate, especially for the situation where the first round of repeated code transmission M times all failed. Based on this, the coordinated optimization of response speed and transmission success rate is achieved.
[0054] It can be seen from the above technical solution that for the scenario of control instruction transmission based on the one-way communication protocol, in response to the control event, the receiving end corresponding to the control event and the control instruction corresponding to the control event are first determined, wherein the receiving end is used to control the device state of the device corresponding to the receiving end to be the expected state according to the control instruction. Then, M control instructions can be sent to the receiving end in sequence based on the one-way communication protocol. If the interval time after sending the Mth control instruction reaches the preset time, the control instruction is continued to be sent to the receiving end in sequence N times based on the one-way communication protocol. Since in the scenario of control instruction transmission using the one-way communication protocol, the receiving end cannot return a response message indicating that the control instruction has been successfully received, in order to ensure the transmission success and the response speed at the same time, the present application provides an interval two-round repeated code transmission mechanism. Specifically, in the first round of repeated code transmission, M control instructions are sent in sequence, and the second round of repeated code transmission is performed after the preset time interval, and the number of repeated code transmissions in the first round is less than the number of repeated code transmissions in the second round. In this way, the transmission time of the first round of repeated code transmission is relatively short. If the receiving end can successfully receive the control instruction in the first round of repeated code transmission, it can control the device state to the expected state more quickly, thereby improving the response speed. Moreover, the mechanism of the second round of repeated code transmission makes it possible to increase the probability of successful transmission based on the N control instructions sent subsequently, even if the first round of repeated code transmission fails to be successfully transmitted. Based on this, it is conducive to improving the response speed, thereby improving the user experience, and at the same time, the two rounds of repeated code transmission are conducive to ensuring the success rate of transmission.
[0055] It should be noted that the present application does not impose any limitation on how to send the control instruction M times and how to send the control instruction N times. For ease of understanding, the present application provides the following methods as examples:
[0056] If the number of receiving terminals is K, the number of control instructions is K, different receiving terminals correspond to different control instructions, the target receiving terminal is used to control the device state of the target device to the expected state according to the target control instruction, the target receiving terminal is one of the K receiving terminals, and the target control instruction is one of the K control instructions. Accordingly, in the specific implementation of the aforementioned S102:
[0057] First, the recorded state corresponding to the target device can be obtained, and the recorded state corresponding to the target device is used to indicate the current state corresponding to the target device. If the expected state corresponding to the target device is different from the recorded state corresponding to the target device, it indicates that the demand is to change the device state of the target device. At this time, the target control instruction can be determined as the first control instruction, and the target receiving end can be determined as the first receiving end. Accordingly, based on the one-way communication protocol, the first control instruction can be sent to the first receiving end M times in sequence.
[0058] It can be seen that based on the comparison between the expected state and the recorded state, the device state that needs to be changed is determined as the one that needs to be sent in the first round of repeated coding. This is conducive to timely changing the device state of the target state to the expected state and improving the response efficiency.
[0059] Correspondingly, in the specific implementation of the aforementioned S103, if the interval after sending the first control instruction for the Mth time reaches the preset time, based on the one-way communication protocol, the control instruction corresponding to the target receiving end is sent to the target receiving end N times in sequence. That is, in the first round of repeated code sending, only the first control instruction is sent, but in the second round of repeated code sending, all control instructions are sent. In this way, the first control instruction is guaranteed to be sent in time to improve the response speed of the state change demand. At the same time, it is guaranteed that all control instructions can be transmitted to the corresponding receiving end.
[0060] It should also be noted that the present application does not make any limitation on how to sequentially send the first control instruction M times to the first receiving end based on the one-way communication protocol, and how to sequentially send the control instruction corresponding to the target receiving end N times to the target receiving end based on the one-way communication protocol. For ease of understanding, the present application provides the following methods as examples to illustrate this one by one.
[0061] First, the following example is provided to illustrate how to send N control instructions corresponding to the target receiving end in sequence to the target receiving end based on a one-way communication protocol:
[0062] In a possible implementation, if the expected state corresponding to the target device is the same as the recorded state corresponding to the target device, it indicates that there is a need for state retention. At this time, the target control instruction can be determined as the second control instruction, and the target receiving end can be determined as the second receiving end. In this way, in the first round of repeated code transmission, there is no need to send such state retention control instructions to avoid affecting the timely transmission of the first control instruction.
[0063] Although the state of the second control instruction needs to be maintained, due to the characteristics of the one-way communication protocol, it is impossible to fully guarantee that the device is really in the recording state (that is, in the expected state). Therefore, in order to ensure accuracy, the second control instruction will continue to be coded in the second round of repeated coding. A priority coding method is also provided. Specifically, based on the one-way communication protocol, the first control instruction is sent N times in sequence to the first receiving end. In response to the completion of the sending of the first control instruction, the second control instruction is sent N times in sequence to the second receiving end. It can be seen that the first control instruction is sent first and then the second control instruction, that is, the priority of the first control instruction is higher than the second control instruction. Based on this, the timely sending of the first control instruction that needs to change the state is improved to improve the response speed. At the same time, it is guaranteed that the device corresponding to the second receiving end can also enter the expected state according to the second control instruction, thereby ensuring that the state maintenance requirement can also be met.
[0064] Secondly, the following example is provided for how to send the first control instruction M times in sequence to the first receiving end based on the one-way communication protocol:
[0065] In a possible implementation, if the number of first control instructions is T, T is a positive integer, different first control instructions correspond to different first receiving ends, and different first receiving ends are used to control different devices, then based on the unidirectional communication protocol, the first control instructions are sequentially sent to the first receiving end M times. In specific implementation:
[0066] The control priorities corresponding to the T first receiving terminals can be determined according to the device priority, and the control priorities are used to indicate the order of sending the corresponding first control instructions to the T first receiving terminals. Then, in response to the completion of sending the Mth first control instruction corresponding to the i-th first receiving terminal, the first control instruction corresponding to the i+1th first receiving terminal can be sent M times in sequence to the i+1th first receiving terminal based on the unidirectional communication protocol, where i is an integer greater than or equal to 1 and less than T.
[0067] Based on this, control instructions may be sent to multiple first receiving ends in sequence according to the order indicated by the control priority, so that the change of the device state of the device corresponding to each first receiving end is adapted in response to the control priority.
[0068] In actual applications, the device priority can be determined based on the user's perceived sensitivity to changes in device status. In this way, the control priority is adapted to the user experience, so that the subsequent changes in the device status of each device corresponding to the first receiving end are adapted to the user perception, which is conducive to improving the user experience.
[0069] In a possible implementation, in response to the completion of the Nth control instruction transmission, indicating that both rounds of repeated code transmission have been completed, the transmitting end can update the recorded state of the corresponding device of the receiving end to the expected state. Based on this, the transmitting end records the device state so as to subsequently determine whether it is the first control instruction or the second control instruction, thereby optimizing the data transmission strategy and improving efficiency.
[0070] For ease of understanding, the present application also provides Figure 2 A schematic diagram of a command transmission process is shown in Figure 2 In the example, the control instruction is the aforementioned 433 control signal as an example, specifically:
[0071] First, the sending host determines whether it is necessary to change the device status of the corresponding device on the receiving end. If necessary, it sends a 433 control signal M times in total.
[0072] Then, after Xs, that is, the aforementioned preset duration is X seconds, the 433 control signal continues to be sent, and is sent N times in total.
[0073] Finally, that is, after the Nth 433 control signal is sent, the sending host updates the device status of the corresponding device on the receiving end.
[0074] The sending end refers to the data sender in data communication, such as a remote control, a gateway, etc. The receiving end refers to the data receiver in data communication. For example, in a smart home, the receiving end can usually be a terminal device such as a light receiver, a curtain receiver, a window opener, etc.
[0075] It can be understood that it basically corresponds to the method embodiment, so the relevant parts can refer to the partial description of the method embodiment.
[0076] For ease of understanding, the embodiment of the present application still takes transmission based on the RF433 unidirectional communication protocol as an example, and the control instruction may be a 433 control signal. The following example description is also provided:
[0077] On the one hand, assuming that the transmission time of a single 433 control signal is t seconds, if the sending end needs to send control instructions to q receiving ends for one control event, that is:
[0078] When a single control instruction is repeated M times, the earliest response time for the qth device is M*t*(q-1)+t, and when a single instruction is repeated N times, the earliest response time for the qth device is N*t*(q-1)+t.
[0079] Usually, a single 433 signal takes about 8.8ms to 60ms to send. If we assume p = 0.5, M = 5, N = 10, t = 20ms, q = 10, we can get the following result based on calculation:
[0080] When the number of code transmissions is M, for the qth device, the earliest response time is 5*20*9+20=920ms. When the number of code transmissions is N, for the qth device, the earliest response time is 10*20*9+20=1820ms.
[0081] It can be seen that as the number of code transmissions increases, the time for all receiving ends to complete the response will increase, making the device response speed perceived by users slower. Therefore, the two-round code transmission mechanism of the present application is adopted, and the first round is also repeated code transmission, so the transmission success rate can be effectively improved. At the same time, the number of code transmissions is small, which is conducive to improving the response efficiency.
[0082] On the other hand, for a control event at the sending end, a control instruction needs to be sent to q receiving ends, that is:
[0083] When a single control instruction is repeated M times, for the qth device, the earliest response time is M*t*(q-1)+t.
[0084] If the first round of control fails, the earliest response time of the qth device is: M*t*q+X+M*t*(q-1)+t.
[0085] In practical applications, the best situation is that only one device needs to change its state in the first round, that is, the number of the aforementioned first control instructions is 1, and all instructions are sent in the second round.
[0086] For this, assuming p = 0.5, M = 5, N = 10, t = 20ms, q = 10, X = 3000ms, we can calculate:
[0087] For the qth device, the earliest response time is 20ms. For the first round of control failure, the resending time is 20+3000+5*20*9+20=3940ms.
[0088] The worst case is that all devices need to change their states in the first round, that is, the number of the aforementioned first control instructions is q, so all instructions need to be sent in the first round and all instructions are also sent in the second round.
[0089] For this, assuming p = 0.5, M = 5, N = 10, t = 20ms, q = 10, X = 3000ms, we can calculate:
[0090] For the qth device, the earliest response time is 5*20*9+20=920ms. For the first round of control failure, the resending time is 5*20*10+3000+5*20*9+20=4920.
[0091] Since the first round itself is a repeated code transmission mechanism, taking M=5 as an example, based on the above probability calculation, it can be known that there is a 96.875% probability of successful response in the first round of code transmission, thereby greatly reducing the response time, requiring only 20ms at least, thereby improving the response speed. Of course, there is a 3.125% probability that the first round of code transmission control fails, and retransmission is required in the second round to ensure the transmission success rate, but the probability of this situation is low. Therefore, the use of this application can improve the response efficiency for most situations.
[0092] Figure 3 This is a structural diagram of an instruction transmission device provided in an embodiment of the present application, wherein the device includes a determination unit 301 and a sending unit 302:
[0093] The determining unit 301 is used to determine, in response to a control event, a receiving end corresponding to the control event and a control instruction corresponding to the control event, wherein the receiving end is used to control a device state of a device corresponding to the receiving end to be an expected state according to the control instruction;
[0094] The sending unit 302 is used to send the control instruction to the receiving end M times in sequence based on a one-way communication protocol;
[0095] The sending unit 302 is further configured to send N times of the control instructions to the receiving end in sequence based on the unidirectional communication protocol if the interval after sending the Mth control instruction reaches a preset time, where M is less than N.
[0096] In a possible implementation, if the number of the receiving ends is K, the number of the control instructions is K, different receiving ends correspond to different control instructions, the target receiving end is used to control the device state of the target device to an expected state according to the target control instruction, the target receiving end is one of the K receiving ends, and the sending unit is further used to:
[0097] Acquire a record status corresponding to the target device, where the record status corresponding to the target device is used to indicate a current status corresponding to the target device;
[0098] If the expected state corresponding to the target device is different from the recorded state corresponding to the target device, determining the target control instruction as a first control instruction, and determining the target receiving end as a first receiving end;
[0099] Based on the one-way communication protocol, the first control instruction is sent to the first receiving end M times in sequence.
[0100] In a possible implementation manner, the sending unit is further configured to:
[0101] If the interval after sending the first control instruction for the Mth time reaches the preset time, based on the one-way communication protocol, the control instruction corresponding to the target receiving end is sent to the target receiving end N times in sequence.
[0102] In a possible implementation manner, the sending unit is further configured to:
[0103] If the expected state corresponding to the target device is the same as the recorded state corresponding to the target device, determining the target control instruction as a second control instruction, and determining the target receiving end as a second receiving end;
[0104] Based on the one-way communication protocol, sending the first control instruction to the first receiving end N times in sequence;
[0105] In response to completion of sending the first control instruction, sending the second control instruction N times in sequence to the second receiving end.
[0106] In a possible implementation manner, if the number of the first control instructions is T, different first control instructions correspond to different first receiving ends, and different first receiving ends are used to control different devices, the sending unit is further used to:
[0107] Determine, according to the device priority, control priorities corresponding to the T first receiving ends, where the control priorities are used to indicate the order in which the corresponding first control instructions are sent to the T first receiving ends;
[0108] In accordance with the order indicated by the control priority, in response to the completion of the sending of the Mth first control instruction corresponding to the i-th first receiving end, based on the unidirectional communication protocol, the first control instruction corresponding to the i+1th first receiving end is sent M times in sequence to the i+1th first receiving end, where i is an integer greater than or equal to 1 and less than T.
[0109] In a possible implementation manner, the device further includes an updating unit:
[0110] The updating unit is used to update the recorded state of the device corresponding to the receiving end to the expected state in response to the completion of sending the control instruction for the Nth time.
[0111] In a possible implementation manner, the determining unit is further configured to:
[0112] In response to a control operation performed by a user, the control event is determined according to the control operation.
[0113] It can be seen from the above technical solution that for the scenario of control instruction transmission based on the one-way communication protocol, in response to the control event, the receiving end corresponding to the control event and the control instruction corresponding to the control event are first determined, wherein the receiving end is used to control the device state of the device corresponding to the receiving end to be the expected state according to the control instruction. Then, M control instructions can be sent to the receiving end in sequence based on the one-way communication protocol. If the interval time after sending the Mth control instruction reaches the preset time, the control instruction is continued to be sent to the receiving end in sequence N times based on the one-way communication protocol. Since in the scenario of control instruction transmission using the one-way communication protocol, the receiving end cannot return a response message indicating that the control instruction has been successfully received, in order to ensure the transmission success and the response speed at the same time, the present application provides an interval two-round repeated code transmission mechanism. Specifically, in the first round of repeated code transmission, M control instructions are sent in sequence, and the second round of repeated code transmission is performed after the preset time interval, and the number of repeated code transmissions in the first round is less than the number of repeated code transmissions in the second round. In this way, the transmission time of the first round of repeated code transmission is relatively short. If the receiving end can successfully receive the control instruction in the first round of repeated code transmission, it can control the device state to the expected state more quickly, thereby improving the response speed. Moreover, the mechanism of the second round of repeated code transmission makes it possible to increase the probability of successful transmission based on the N control instructions sent subsequently, even if the first round of repeated code transmission fails to be successfully transmitted. Based on this, it is conducive to improving the response speed, thereby improving the user experience, and at the same time, the two rounds of repeated code transmission are conducive to ensuring the success rate of transmission.
[0114] In another aspect, an embodiment of the present application provides a computer device, the computer device comprising a processor and a memory:
[0115] The memory is used to store program code and transmit the program code to the processor;
[0116] The processor is used to execute the instruction transmission method provided in the above embodiment according to the instructions in the program code.
[0117] The computer device may include a terminal device or a server, and the aforementioned instruction transmission device may be configured in the computer device.
[0118] On the other hand, an embodiment of the present application further provides a storage medium, wherein the storage medium is used to store a computer program, and the computer program is used to execute the instruction transmission method provided in the above embodiment.
[0119] In addition, an embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the instruction transmission method provided in the above embodiment.
[0120] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium can be at least one of the following media: read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc., various media that can store program codes.
[0121] 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 units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0122] It should be noted that, in this article, relational terms such as "first" and "second", etc. (if any) are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0123] The above is a detailed introduction to an instruction transmission method and related devices provided by the embodiment of the present application. The principle and implementation method of the present application are described in detail using specific examples. The description of the above embodiments is only used to help understand the method of the present application. At the same time, for those skilled in the art, according to the method of the present application, there will be changes in the specific implementation method and application scope.
[0124] In summary, the content of this specification should not be understood as limiting the present application, and any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in this application should be included in the protection scope of this application. Moreover, based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations.
Claims
1. A command transmission method, It is characterized in that The method comprises: In response to a control event, determining a receiving end corresponding to the control event and a control instruction corresponding to the control event, wherein the receiving end is used to control a device state of a device corresponding to the receiving end to be an expected state according to the control instruction; Sending the control instruction to the receiving end sequentially M times based on a one-way communication protocol; If the interval after sending the control instruction for the Mth time reaches the preset time, the control instruction is sent to the receiving end N times in sequence based on the unidirectional communication protocol, and M is less than N.
2. The method according to claim 1, It is characterized in that If the number of the receiving ends is K, the number of the control instructions is K, different receiving ends correspond to different control instructions, the target receiving end is used to control the device state of the target device to be the expected state according to the target control instruction, the target receiving end is one of the K receiving ends, the target control instruction is one of the K control instructions, and the control instruction is sent to the receiving end M times in sequence based on the unidirectional communication protocol, including: Acquire a record status corresponding to the target device, where the record status corresponding to the target device is used to indicate a current status corresponding to the target device; If the expected state corresponding to the target device is different from the recorded state corresponding to the target device, determining the target control instruction as a first control instruction, and determining the target receiving end as a first receiving end; Based on the one-way communication protocol, the first control instruction is sent to the first receiving end M times in sequence.
3. The method according to claim 2, It is characterized in that If the interval after sending the control instruction for the Mth time reaches the preset time, sending the control instruction to the receiving end N times in sequence based on the one-way communication protocol includes: If the interval after sending the first control instruction for the Mth time reaches the preset time, based on the one-way communication protocol, the control instruction corresponding to the target receiving end is sent to the target receiving end N times in sequence.
4. The method according to claim 3, It is characterized in that The method further comprises: If the expected state corresponding to the target device is the same as the recorded state corresponding to the target device, determining the target control instruction as a second control instruction, and determining the target receiving end as a second receiving end; The step of sending control instructions corresponding to the target receiving end to the target receiving end N times in sequence based on the unidirectional communication protocol includes: Based on the one-way communication protocol, sending the first control instruction to the first receiving end N times in sequence; In response to completion of sending the first control instruction, sending the second control instruction N times in sequence to the second receiving end.
5. The method according to claim 2, It is characterized in that If the number of the first control instructions is T, different first control instructions correspond to different first receiving ends, and different first receiving ends are used to control different devices, the sending of the first control instructions to the first receiving ends M times in sequence based on the unidirectional communication protocol includes: Determine, according to the device priority, control priorities corresponding to the T first receiving ends, where the control priorities are used to indicate the order in which the corresponding first control instructions are sent to the T first receiving ends; In accordance with the order indicated by the control priority, in response to the completion of the sending of the Mth first control instruction corresponding to the i-th first receiving end, based on the unidirectional communication protocol, the first control instruction corresponding to the i+1th first receiving end is sent M times in sequence to the i+1th first receiving end, where i is an integer greater than or equal to 1 and less than T.
6. The method according to claim 1, It is characterized in that The method further comprises: In response to the Nth completion of sending the control instruction, the recorded state of the device corresponding to the receiving end is updated to the expected state.
7. The method according to any one of claims 1 to 6, It is characterized in that The control event is determined by: In response to a control operation performed by a user, the control event is determined according to the control operation.
8. A command transmission device, It is characterized in that The device comprises a determining unit and a sending unit: The determining unit is used to determine, in response to a control event, a receiving end corresponding to the control event and a control instruction corresponding to the control event, wherein the receiving end is used to control a device state of a device corresponding to the receiving end to be an expected state according to the control instruction; The sending unit is used to send the control instruction to the receiving end M times in sequence based on a one-way communication protocol; The sending unit is further used to send the control instructions to the receiving end N times in sequence based on the unidirectional communication protocol if the interval after sending the control instruction for the Mth time reaches a preset time, and M is less than N.
9. A computer device, It is characterized in that The computer device comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the method according to any one of claims 1 to 7 according to the instructions in the program code.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1 to 7.
