Data packet processing method and device, smart home equipment and storage medium
By obtaining network status information of smart home devices and gateways and dynamically adjusting packet processing parameters, the limitations of the MQTT-SN protocol in terms of data transmission efficiency and resource utilization are solved, and more efficient packet transmission and resource utilization are achieved.
Patent Information
- Application Number
- CN202411872439.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-25
AI Technical Summary
The MQTT-SN protocol has limitations in data transmission efficiency and network resource utilization.
By obtaining the current network status information between the smart home device and the gateway, dynamically determine the packet size, communication frequency and retransmission strategy, and processing the packets according to these parameters to improve transmission efficiency and resource utilization.
It improves the transmission efficiency of data packets, ensures full utilization of network resources, and improves data transmission performance under network state.
Smart Images

Figure CN119892540A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a data packet processing method, a data packet processing device, a smart home device and a computer-readable storage medium. Background Art
[0002] With the development of smart homes, more and more common home appliances, such as smart bulbs, thermostats, security systems, etc., are beginning to use wireless communication protocols for data exchange and control. The MQTT-SN (Message Queuing Telemetry Transport for Sensor Networks) protocol, as an optimized version of the MQTT (Message Queuing Telemetry Transport) protocol for sensor networks, is popular because of its low bandwidth requirements and low power consumption. However, in practical applications, the MQTT-SN protocol still has certain limitations in data transmission efficiency and network resource utilization. Summary of the invention
[0003] In view of the above problems, embodiments of the present invention are proposed to provide a data packet processing method, a data packet processing device, a smart home device and a computer-readable storage medium that overcome the above problems or at least partially solve the above problems.
[0004] In order to solve the above problem, an embodiment of the present invention discloses a data packet processing method, which is applied to a control system; the control system is deployed in a smart home device; the smart home device is connected to a gateway, and the method includes:
[0005] Acquire current network status information between the smart home device and the gateway;
[0006] Determine the current data packet size, current communication frequency and current retransmission strategy according to the current network status information;
[0007] Sending a data packet according to the current data packet size and the current communication frequency, and detecting whether an abnormality occurs when the data packet is sent;
[0008] When an exception occurs when the data packet is sent, the data packet is processed according to the current retransmission strategy.
[0009] Optionally, the current network status information includes: current network bandwidth information, current network delay information, current network load information, current network information strength and current packet loss rate; and determining the current data packet size, current communication frequency and current retransmission strategy according to the network status information includes:
[0010] Determine a current data packet size according to the current network bandwidth information and the current network delay information;
[0011] Determining a current communication frequency according to the current network load information and the current network delay information;
[0012] A current retransmission strategy is determined according to the current network information strength and the current packet loss rate.
[0013] Optionally, determining the current data packet size according to the current network bandwidth information and the current network delay information includes:
[0014] Acquire a network relationship; the network relationship is a relationship between network bandwidth information, network delay information and an optimal data packet size;
[0015] The current data packet size is determined according to the current network bandwidth information, the current network delay information and the network relationship.
[0016] Optionally, determining the current communication frequency according to the current network load information and the current network delay information includes:
[0017] Obtaining performance data of the smart home device;
[0018] A current communication frequency is determined according to the performance data, the current network load information and the current network delay information; the current communication frequency is an optimal communication frequency that satisfies the network load information and the current network delay information.
[0019] Optionally, determining a current retransmission strategy according to the current network information strength and the current packet loss rate includes:
[0020] Acquire multiple pre-stored retransmission strategies and strategy relationships;
[0021] According to the current network information strength, the current packet loss rate and the policy relationship, a current retransmission policy is determined from the multiple retransmission policies.
[0022] Optionally, the current retransmission strategy includes: a current number of retransmissions and a current retransmission priority; when an exception occurs when the data packet is sent, processing the data packet according to the current retransmission strategy includes:
[0023] When an exception occurs when the data packet is sent, obtaining the data type of the data packet;
[0024] Determining the current retransmission priority of the data packet according to the data type;
[0025] The data packet is retransmitted according to the current retransmission priority, and when the accumulated number of retransmissions of the data packet exceeds the current number of retransmissions, the retransmission of the data packet is stopped.
[0026] Optionally, the method further comprises:
[0027] When an abnormality occurs when the data packet is sent, determining an abnormal event corresponding to the abnormality, and uploading the abnormal event to a server;
[0028] The cause of the abnormality is determined through the first preset message and the second preset message, and abnormality reminder information corresponding to the cause of the abnormality is output.
[0029] Optionally, uploading the abnormal event to a server includes:
[0030] Obtaining abnormal information corresponding to the abnormal event;
[0031] The abnormal information is uploaded to the server through a publishing message message of a telemetry transmission protocol, so that the server stores the abnormal information.
[0032] Optionally, the acquiring current network status information between the smart home device and the gateway includes:
[0033] When it is detected that the smart home device is connected to the gateway for the first time through the telemetry transmission protocol, the current network status information between the smart home device and the gateway is obtained according to the broadcast function of the gateway.
[0034] The embodiment of the present invention further discloses a data packet processing device, which is applied to a control system; the control system is deployed in a smart home device; the smart home device is connected to a gateway, and the device includes:
[0035] An acquisition module, used to acquire current network status information between the smart home device and the gateway;
[0036] A first determination module, configured to determine a current data packet size, a current communication frequency, and a current retransmission strategy according to the current network status information;
[0037] A sending module, used to send a data packet according to the current data packet size and the current communication frequency, and detect whether an abnormality occurs when the data packet is sent;
[0038] A processing module is used to process the data packet according to the current retransmission strategy when an exception occurs when the data packet is sent.
[0039] Optionally, the current network status information includes: current network bandwidth information, current network delay information, current network load information, current network information strength and current packet loss rate; the first determination module includes:
[0040] A first determination submodule, configured to determine a current data packet size according to the current network bandwidth information and the current network delay information;
[0041] A second determination submodule, configured to determine a current communication frequency according to the current network load information and the current network delay information;
[0042] The third determination submodule is used to determine a current retransmission strategy according to the current network information strength and the current packet loss rate.
[0043] Optionally, the first determining submodule includes:
[0044] A first acquisition unit is used to acquire a network relationship; the network relationship is a relationship between network bandwidth information, network delay information and an optimal data packet size;
[0045] The first determining unit is used to determine the current data packet size according to the current network bandwidth information, the current network delay information and the network relationship.
[0046] Optionally, the second determining submodule includes:
[0047] A second acquisition unit, configured to acquire performance data of the smart home device;
[0048] The second determination unit is used to determine the current communication frequency according to the performance data, the current network load information and the current network delay information; the current communication frequency is the optimal communication frequency that satisfies the network load information and the current network delay information.
[0049] Optionally, the third determining submodule includes:
[0050] A third acquisition unit, used to acquire a plurality of pre-stored retransmission strategies and strategy relationships;
[0051] The third determining unit is used to determine the current retransmission strategy from the multiple retransmission strategies according to the current network information strength, the current packet loss rate and the strategy relationship.
[0052] Optionally, the current retransmission strategy includes: a current number of retransmissions and a current retransmission priority; and the processing module includes:
[0053] A first acquisition submodule, used for acquiring the data type of the data packet when an exception occurs when the data packet is sent;
[0054] a fourth determination submodule, configured to determine the current retransmission priority of the data packet according to the data type;
[0055] The retransmission submodule is used to retransmit the data packet according to the current retransmission priority, and stop retransmitting the data packet when the accumulated retransmission times of the data packet exceeds the current retransmission times.
[0056] Optionally, the device further comprises:
[0057] A second determination module is used to determine an abnormal event corresponding to the abnormality when an abnormality occurs when the data packet is sent, and upload the abnormal event to a server;
[0058] The third determination module is used to determine the abnormal cause through the first preset message and the second preset message, and output abnormal reminder information corresponding to the abnormal cause.
[0059] Optionally, the second determining module includes:
[0060] A second acquisition submodule is used to acquire abnormal information corresponding to the abnormal event;
[0061] The upload submodule is used to upload the abnormal information to the server through a publishing message message of the telemetry transmission protocol, so that the server stores the abnormal information.
[0062] Optionally, the acquisition module includes:
[0063] The third acquisition submodule is used to acquire the current network status information between the smart home device and the gateway according to the broadcast function of the gateway when it is detected that the smart home device is connected to the gateway for the first time through the telemetry transmission protocol.
[0064] The present invention also discloses a smart home device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned data packet processing method when executing the computer program.
[0065] The present invention also discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the data packet processing method as described above are implemented.
[0066] The embodiments of the present invention include the following advantages:
[0067] In an embodiment of the present invention, current network status information between a smart home device and a gateway is first obtained, and then a current data packet size, a current communication frequency, and a current retransmission strategy are determined according to the current network status information. A data packet is then sent according to the current data packet size and the current communication frequency, and it is detected whether an exception occurs when sending the data packet. When an exception occurs when sending the data packet, the data packet is processed according to the current retransmission strategy, so that the current data packet size, the current communication frequency, and the current retransmission strategy can be determined according to the current network status information, and the data packet is processed according to the current data packet size, the current communication frequency, and the current retransmission strategy, thereby improving the transmission efficiency of the data packet and making full use of network resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 is a flowchart of a method for processing a data packet provided by an embodiment of the present invention;
[0069] Figure 2 is a structural block diagram of a smart home device provided by an embodiment of the present invention;
[0070] Figure 3 It is a structural block diagram of a data packet processing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0071] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0072] In the related art, the MQTT-SN protocol still has certain limitations in data transmission efficiency and network resource utilization. The present invention provides a data packet processing method, the core concept of which is to first obtain the current network status information between the smart home device and the gateway, and then determine the current data packet size, current communication frequency and current retransmission strategy according to the current network status information, and then send the data packet according to the current data packet size and current communication frequency, and detect whether the data packet is sent abnormally. When an abnormality occurs during data packet sending, the data packet is processed according to the current retransmission strategy, so that the current data packet size, current communication frequency and current retransmission strategy can be determined according to the current network status information, and the data packet is processed according to the current data packet size, current communication frequency and current retransmission strategy, thereby improving the transmission efficiency of the data packet and making full use of network resources.
[0073] Reference Figure 1 , shows a flowchart of a method for processing a data packet provided by an embodiment of the present invention, the method is applied to a control system; the control system is deployed in a smart home device; the smart home device is connected to a gateway, and the method may specifically include the following steps:
[0074] Step 101: Acquire current network status information between the smart home device and the gateway.
[0075] In an embodiment of the present invention, a smart home device may be connected to a gateway, and a control system may be deployed in the smart home device, and the control system may obtain current network status information between the smart home device and the gateway. Figure 2 , which shows a block diagram of a smart home device provided by an embodiment of the present invention. In the present invention, the smart home device may include: smart light bulbs, smart doors and windows, smart home appliances, and smart speakers.
[0076] In one embodiment, obtaining current network status information between a smart home device and a gateway may include: when it is detected that the smart home device is connected to the gateway for the first time through a telemetry transmission protocol, obtaining the current network status information between the smart home device and the gateway according to a broadcast function of the gateway.
[0077] Specifically, the control system can detect the status of the smart home device in real time. When it is detected that the smart home device is connected to the gateway for the first time through the telemetry transmission protocol, the control system can use the status broadcast function of the gateway to obtain the current network status information between the smart home device and the gateway. In the present invention, the telemetry transmission protocol can be the MQTT-SN protocol. The network status information in the present invention may include: current network bandwidth information, current network delay information, current network load information, current network information strength, and current packet loss rate, etc.
[0078] MQTT-SN (Message Queuing Telemetry Transport for Sensor Networks) is a communication protocol designed specifically for sensor networks and is an extended version of the MQTT (Message Queuing Telemetry Transport) protocol. The MQTT-SN protocol is designed to solve problems such as low power consumption, low bandwidth, and high latency in sensor networks, and is suitable for resource-constrained devices and network environments. The main features of the MQTT-SN protocol are: Low power consumption: The MQTT-SN protocol is designed as a low-power communication protocol and is suitable for battery-powered sensor devices. The protocol supports sleep mode and wake-up mechanism, and the device can enter a low-power state when inactive to reduce energy consumption. Low bandwidth: The MQTT-SN protocol is designed as a low-bandwidth communication protocol and is suitable for network environments with limited bandwidth. The protocol uses a compact binary message format to reduce the overhead of data transmission and improve communication efficiency. High latency: The MQTT-SN protocol is designed as a high-latency communication protocol and is suitable for network environments with high latency. The protocol supports asynchronous communication and message retransmission mechanisms to ensure reliable data transmission even when the network is unstable. Gateway support: The MQTT-SN protocol bridges the MQTT protocol through a gateway to enable communication between the sensor network and the MQTT broker. The gateway is responsible for converting MQTT-SN messages to MQTT messages and converting MQTT messages to MQTT-SN messages. Simplified QoS support: The MQTT-SN protocol simplifies QoS (Quality of Service) support and provides three QoS levels: 0 (at most once), 1 (at least once), and 2 (exactly once). The choice of QoS level depends on the application scenario and network environment. Topic alias: The MQTT-SN protocol supports topic aliases to reduce the transmission overhead of topic names. Devices can register topic aliases when connecting, and subsequent messages can use aliases instead of topic names to reduce data transmission.
[0079] The working principle of the MQTT-SN protocol is as follows: Connection process: The device establishes a connection with the gateway and sends a CONNECT message containing information such as the device identifier, protocol version, and connection time. The gateway returns a CONNACK message to confirm that the connection is successful. Topic registration: The device registers a topic with the gateway and sends a REGISTER message containing the topic name and topic alias. The gateway returns a REGACK message to confirm that the topic registration is successful. Message publishing: The device publishes a message to the gateway and sends a PUBLISH message containing information such as the topic alias, QoS level, and message content. The gateway converts the message into an MQTT message and sends it to the MQTT agent. Message subscription: The device subscribes to a topic with the gateway and sends a SUBSCRIBE message containing the topic name and QoS level. The gateway returns a SUBACK message to confirm that the subscription is successful. The gateway sends a subscription request to the MQTT agent and converts the received message into an MQTT-SN message and sends it to the device. Message reception: The device receives the message sent by the gateway and processes the message content. The device can send a PUBACK message as needed to confirm that the message is successfully received. Disconnection: The device disconnects from the gateway and sends a DISCONNECT message. The gateway returns a DISCONNECT message to confirm that the disconnection is successful.
[0080] The application scenarios of the MQTT-SN protocol are: Smart home: In the smart home system, the MQTT-SN protocol is used to connect various sensor devices (such as temperature sensors, humidity sensors, light sensors, etc.) to achieve low-power, low-bandwidth communication and improve the energy efficiency and reliability of the system. Industrial Internet of Things: In the industrial Internet of Things system, the MQTT-SN protocol is used to connect various industrial sensor devices (such as pressure sensors, vibration sensors, temperature sensors, etc.) to achieve low-power, low-bandwidth communication and improve the stability and reliability of the system. Agricultural Internet of Things: In the agricultural Internet of Things system, the MQTT-SN protocol is used to connect various agricultural sensor devices (such as soil moisture sensors, meteorological sensors, water quality sensors, etc.) to achieve low-power, low-bandwidth communication and improve the energy efficiency and reliability of the system. Smart city: In the smart city system, the MQTT-SN protocol is used to connect various urban sensor devices (such as traffic sensors, environmental sensors, energy sensors, etc.) to achieve low-power, low-bandwidth communication and improve the energy efficiency and reliability of the system.
[0081] Step 102: Determine the current data packet size, current communication frequency and current retransmission strategy according to the current network status information.
[0082] In the embodiment of the present invention, after acquiring the current network status information, the control system can determine the current data packet size, the current communication frequency and the current retransmission strategy in real time according to the current network status information.
[0083] In one embodiment, the current network status information includes: current network bandwidth information, current network delay information, current network load information, current network information strength and current packet loss rate; based on the network status information, the current data packet size, current communication frequency and current retransmission strategy are determined, including: based on the current network bandwidth information and the current network delay information, the current data packet size is determined; based on the current network load information and the current network delay information, the current communication frequency is determined; based on the current network information strength and the current packet loss rate, the current retransmission strategy is determined.
[0084] Specifically, the current data packet size in the present invention can be determined by the control system based on the current network bandwidth information and the current network delay information, the current communication frequency can be determined by the control system based on the current network load information and the current network delay information, and the current retransmission strategy can be determined by the control system based on the current network information strength and the current packet loss rate.
[0085] In one embodiment, the current data packet size is determined based on the current network bandwidth information and the current network delay information, including: obtaining a network relationship; the network relationship is the relationship between the network bandwidth information, the network delay information and the optimal data packet size; and the current data packet size is determined based on the current network bandwidth information, the current network delay information and the network relationship.
[0086] Specifically, when determining the current data packet size, the network relationship can be obtained first, wherein the network relationship is the relationship between network bandwidth information, network delay information and the optimal data packet size, and the network relationship can be obtained by analyzing the historical network bandwidth information, the historical network delay information and the historical optimal data packet size using a preset machine learning algorithm. The control system then determines the current data packet size based on the current network bandwidth information, the current network delay information and the network relationship, and the current data packet size is the optimal data packet size that satisfies the current bandwidth information and the current network delay information, so that the optimal data packet size can be determined under the network conditions of different network bandwidth information and different network delay information, and the current data packet size can be dynamically adjusted.
[0087] For example, when the network bandwidth is large and the network delay is high, the current data packet size determined can be a larger data packet to improve transmission efficiency. When the network bandwidth is small or the network delay is high, the current data packet size determined can be a smaller data packet to reduce transmission delay.
[0088] In one embodiment, determining the current communication frequency based on the current network load information and the current network delay information may include: obtaining performance data of the smart home device; determining the current communication frequency based on the performance data, the current network load information and the current network delay information; the current communication frequency is the optimal communication frequency that satisfies the network load information and the current network delay information.
[0089] Specifically, the control system can detect network traffic and performance data of smart home devices in real time, obtain current performance data of smart home devices, and then determine the optimal current communication frequency based on the current performance data, current network load information, and current network delay information. The communication frequency is the optimal communication frequency that satisfies the current network load information and the current network delay information. The current communication frequency can be determined by a preset intelligent algorithm based on performance data, current network load information, and current network delay information. The preset intelligent algorithm is an intelligent algorithm trained in advance based on historical information.
[0090] For example, when the performance data is high, the network load is low, and the network delay is low, the communication frequency can be increased to improve the transmission efficiency. When the performance data is high, the network load is high, or the network delay is high, the communication frequency can be reduced to reduce network congestion. After determining the current communication frequency, the control system can control the data packet sending cycle through the timer to ensure that the data packet can be transmitted efficiently and reliably under different network conditions.
[0091] In the present invention, relevant data can be periodically extracted from the transmission history, and the preset intelligent algorithm can be optimized using the relevant data to improve the accuracy of the preset intelligent algorithm.
[0092] In one embodiment, determining the current retransmission strategy based on the current network information strength and the current packet loss rate may include: obtaining multiple pre-stored retransmission strategies and strategy relationships; determining the current retransmission strategy from multiple retransmission strategies based on the current network information strength, the current packet loss rate and the strategy relationship.
[0093] Specifically, the control system can first obtain multiple pre-stored retransmission strategies and strategy relationships, where the strategy relationship is the relationship between network information strength, packet loss rate and retransmission strategy, and then determine the current retransmission strategy from multiple retransmission strategies based on the current network information strength, current packet loss rate and strategy relationship.
[0094] For example, if the network signal is poor or the packet loss rate is high, the current retransmission strategy may be to use a longer backoff time for retransmission or to limit the number of retransmissions for retransmission, so as to avoid network congestion caused by excessive retransmissions.
[0095] Step 103, sending a data packet according to the current data packet size and the current communication frequency, and detecting whether an abnormality occurs when the data packet is sent.
[0096] In the embodiment of the present invention, after determining the current data packet size, current communication frequency and current retransmission strategy, the data packet can be sent according to the current data packet size and current communication frequency. When sending the data packet, whether the data packet is abnormal is detected in real time.
[0097] Step 104: When an exception occurs when the data packet is sent, process the data packet according to the current retransmission strategy.
[0098] In the embodiment of the present invention, whether an abnormality occurs in a data packet is detected in real time. When an abnormality occurs in a data packet, the data packet can be retransmitted according to the determined current vehicle.
[0099] In an embodiment of the present invention, the current retransmission strategy may include: the current number of retransmissions, the current retransmission priority; when an exception occurs when a data packet is sent, processing the data packet according to the current retransmission strategy, which may include: when an exception occurs when a data packet is sent, obtaining the data type of the data packet; determining the current retransmission priority of the data packet according to the data type; retransmitting the data packet according to the current retransmission priority, and stopping retransmitting the data packet when the cumulative number of retransmissions of the data packet exceeds the current number of retransmissions.
[0100] Specifically, when an abnormality is detected when a data packet is sent, the control system can first obtain the data type corresponding to the data packet with the abnormality, and then determine the priority corresponding to the data packet according to the data type and the preset priority relationship, the preset priority relationship is the relationship between the data type and the priority, and then retransmit the data packet with the abnormality in turn according to the priority of the data packet, to ensure that the data packet with high priority can be retransmitted multiple times in time, and the data packet with low priority can be retransmitted with a gradually extended backoff time, and when the cumulative number of retransmissions of the data packet reaches the current number of retransmissions determined, notify the retransmission of the data packet. For example: the current number of retransmissions determined is 10 times, that is, each data packet is retransmitted up to 10 times, when the cumulative number of retransmissions of a data packet reaches 11 times, the retransmission of the data packet can be stopped to avoid infinite retransmissions and cause network congestion.
[0101] In the present invention, when retransmitting abnormal data packets, multiple small data packets can be merged into a large data packet for data packets that have been lost multiple times. When the network status is good, the large data packet is retransmitted in a centralized manner, thereby improving efficiency.
[0102] In an embodiment of the present invention, the data packet processing method may further include: when an exception occurs when a data packet is sent, determining an abnormal event corresponding to the exception, and uploading the abnormal event to a server; determining the cause of the exception through a first preset message and a second preset message, and outputting abnormal reminder information corresponding to the cause of the exception.
[0103] Specifically, when an abnormality occurs when a data packet is sent, the control system may first determine an abnormal event corresponding to the abnormality, which may include: temperature exceeding a limit, smoke alarm, etc. The abnormal event is then uploaded to the server, and the cause of the abnormality is determined through the first preset message and the second preset message, and abnormal reminder information corresponding to the cause of the abnormality is output.
[0104] For example: when an exception occurs when sending a data packet, the specific cause of the packet loss is detected through the ACK (Acknowledgment) message and the PingReq / Resp message. If the smart home device fails to receive the ACK message after sending the data packet, the control system will first determine the cause of the exception (packet loss). PingReq / Resp messages are used to regularly detect whether the smart home device is online. If the Ping / Resp message is returned normally, it can be inferred that the exception may be caused by signal interference; if the Ping / Resp message is not received, it may be caused by the smart home device being offline. And determine the exception reminder information corresponding to the cause of the exception, and then output the exception reminder information, so that the user can be reminded and the user can handle the exception in time according to the exception reminder information.
[0105] ACK message, usually called confirmation message in Chinese. In the communication protocol, the ACK message is used to confirm that the receiver has successfully received a message or data packet. ACK message is one of the important mechanisms to ensure the reliability of communication, especially in scenarios where data integrity and order need to be guaranteed. The functions of ACK message are: Confirmation of reception: The receiver informs the sender that the message has been successfully received by sending an ACK message. Reliability guarantee: Through the ACK mechanism, the sender can confirm whether the message has arrived successfully, thereby avoiding message loss or duplication. Flow control: ACK message can be used to implement flow control to prevent the sender from sending too much data and causing the receiver to overload.
[0106] PingReq and PingResp messages are two types of messages in the MQTT protocol, which are used to maintain the connection status between the device and the gateway and detect whether the connection is still valid. These two messages are usually used in long connection scenarios to ensure that the connection is not interrupted due to network idleness. The advantages of PingReq / Resp messages are: Connection maintenance: By sending PingReq / Resp messages regularly, the connection is ensured not to be interrupted due to network idleness. Low overhead: PingReq / Resp messages are very lightweight and do not contain payload, which is suitable for resource-constrained devices. Simple and efficient: Simple implementation and can quickly detect the connection status.
[0107] In one embodiment, uploading the abnormal event to the server may include: obtaining abnormal information corresponding to the abnormal event; uploading the abnormal information to the server through a publishing message message of a telemetry transmission protocol, so that the server stores the abnormal information.
[0108] Specifically, when an abnormality occurs when a data packet is sent, the abnormal event corresponding to the abnormality can be determined first, and then the abnormal information corresponding to the abnormal event can be determined. The abnormal information may include: abnormal event type, abnormal time, environmental sensor data at the time of abnormality (such as temperature, humidity, gas concentration, etc.), the status of smart home devices and the network status, etc., and then the abnormal information is uploaded to the server through the release message message of the telemetry transmission protocol, so that the server stores the abnormal information. For example: upload these abnormal information to the server through the PUBLISH message of the MQTT-SN protocol, thereby reducing unnecessary communication.
[0109] The PUBLISH message is the core message type used to publish messages in the MQTT protocol. It allows clients (such as devices and applications) to send messages to servers.
[0110] In the embodiment of the present invention, the current network status information between the smart home device and the gateway is obtained; the current data packet size, the current communication frequency and the current retransmission strategy are determined according to the current network status information; the data packet is sent according to the current data packet size and the current communication frequency, and whether an abnormality occurs when the data packet is sent; when an abnormality occurs when the data packet is sent, the data packet is processed according to the current retransmission strategy. Therefore, the current data packet size, the current communication frequency and the current retransmission strategy can be determined according to the current network status information, and the data packet is processed according to the current data packet size, the current communication frequency and the current retransmission strategy, thereby improving the transmission efficiency of the data packet and making full use of network resources.
[0111] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0112] Reference Figure 3 , shows a structural block diagram of a data packet processing device provided by an embodiment of the present invention, the device is applied to a control system; the control system is deployed in a smart home device; the smart home device is connected to a gateway, and the device may specifically include the following modules:
[0113] The acquisition module 301 is used to acquire the current network status information between the smart home device and the gateway;
[0114] A first determination module 302, configured to determine a current data packet size, a current communication frequency, and a current retransmission strategy according to the current network status information;
[0115] The sending module 303 is used to send a data packet according to the current data packet size and the current communication frequency, and detect whether an abnormality occurs when the data packet is sent;
[0116] The processing module 304 is used to process the data packet according to the current retransmission strategy when an exception occurs when the data packet is sent.
[0117] In one embodiment, the current network status information includes: current network bandwidth information, current network delay information, current network load information, current network information strength and current packet loss rate; the first determination module 302 includes:
[0118] A first determination submodule, configured to determine a current data packet size according to the current network bandwidth information and the current network delay information;
[0119] A second determination submodule, configured to determine a current communication frequency according to the current network load information and the current network delay information;
[0120] The third determination submodule is used to determine a current retransmission strategy according to the current network information strength and the current packet loss rate.
[0121] In one embodiment, the first determining submodule includes:
[0122] A first acquisition unit is used to acquire a network relationship; the network relationship is a relationship between network bandwidth information, network delay information and an optimal data packet size;
[0123] The first determining unit is used to determine the current data packet size according to the current network bandwidth information, the current network delay information and the network relationship.
[0124] In one embodiment, the second determining submodule includes:
[0125] A second acquisition unit, configured to acquire performance data of the smart home device;
[0126] The second determination unit is used to determine the current communication frequency according to the performance data, the current network load information and the current network delay information; the current communication frequency is the optimal communication frequency that satisfies the network load information and the current network delay information.
[0127] In one embodiment, the third determining submodule includes:
[0128] A third acquisition unit, used to acquire a plurality of pre-stored retransmission strategies and strategy relationships;
[0129] The third determining unit is used to determine the current retransmission strategy from the multiple retransmission strategies according to the current network information strength, the current packet loss rate and the strategy relationship.
[0130] In one embodiment, the current retransmission strategy includes: the current number of retransmissions and the current retransmission priority; the processing module 304 includes:
[0131] A first acquisition submodule, used for acquiring the data type of the data packet when an exception occurs when the data packet is sent;
[0132] a fourth determination submodule, configured to determine the current retransmission priority of the data packet according to the data type;
[0133] The retransmission submodule is used to retransmit the data packet according to the current retransmission priority, and stop retransmitting the data packet when the accumulated retransmission times of the data packet exceeds the current retransmission times.
[0134] In one embodiment, the device further comprises:
[0135] A second determination module is used to determine an abnormal event corresponding to the abnormality when an abnormality occurs when the data packet is sent, and upload the abnormal event to a server;
[0136] The third determination module is used to determine the abnormal cause through the first preset message and the second preset message, and output abnormal reminder information corresponding to the abnormal cause.
[0137] In one embodiment, the second determining module includes:
[0138] A second acquisition submodule is used to acquire abnormal information corresponding to the abnormal event;
[0139] The upload submodule is used to upload the abnormal information to the server through a publishing message message of the telemetry transmission protocol, so that the server stores the abnormal information.
[0140] In one embodiment, the acquisition module 301 includes:
[0141] The third acquisition submodule is used to acquire the current network status information between the smart home device and the gateway according to the broadcast function of the gateway when it is detected that the smart home device is connected to the gateway for the first time through the telemetry transmission protocol.
[0142] In the implementation of the present invention, the acquisition module is used to obtain the current network status information between the smart home device and the gateway; the first determination module is used to determine the current data packet size, the current communication frequency and the current retransmission strategy according to the current network status information; the sending module is used to send the data packet according to the current data packet size and the current communication frequency, and detect whether an abnormality occurs when the data packet is sent; the processing module is used to process the data packet according to the current retransmission strategy when an abnormality occurs when the data packet is sent. Therefore, the current data packet size, the current communication frequency and the current retransmission strategy can be determined according to the current network status information, and the data packet can be processed according to the current data packet size, the current communication frequency and the current retransmission strategy, thereby improving the transmission efficiency of the data packet and making full use of network resources.
[0143] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0144] The embodiment of the present invention further provides a smart home device, including:
[0145] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned data packet processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0146] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned data packet processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0147] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0148] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0149] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0150] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0151] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0152] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0153] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used 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 terminal 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 terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0154] The data packet processing method, data packet processing device, smart home device and computer-readable storage medium provided by the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A data packet processing method, characterized in that: The method is applied to a control system; The control system is deployed in smart home devices; The smart home device is connected to a gateway, and the method comprises: Acquire current network status information between the smart home device and the gateway; Determine the current data packet size, current communication frequency and current retransmission strategy according to the current network status information; Sending a data packet according to the current data packet size and the current communication frequency, and detecting whether an abnormality occurs when the data packet is sent; When an exception occurs when the data packet is sent, the data packet is processed according to the current retransmission strategy.
2. The data packet processing method according to claim 1, characterized in that: The current network status information includes: current network bandwidth information, current network delay information, current network load information, current network information strength and current packet loss rate; the current data packet size, current communication frequency and current retransmission strategy are determined according to the network status information, including: Determine a current data packet size according to the current network bandwidth information and the current network delay information; Determining a current communication frequency according to the current network load information and the current network delay information; A current retransmission strategy is determined according to the current network information strength and the current packet loss rate.
3. The data packet processing method according to claim 2, characterized in that: The determining the current data packet size according to the current network bandwidth information and the current network delay information includes: Acquire a network relationship; the network relationship is a relationship between network bandwidth information, network delay information and an optimal data packet size; The current data packet size is determined according to the current network bandwidth information, the current network delay information and the network relationship.
4. The data packet processing method according to claim 2, characterized in that: The determining the current communication frequency according to the current network load information and the current network delay information includes: Obtaining performance data of the smart home device; A current communication frequency is determined according to the performance data, the current network load information and the current network delay information; the current communication frequency is an optimal communication frequency that satisfies the network load information and the current network delay information.
5. The data packet processing method according to claim 2, characterized in that: The determining a current retransmission strategy according to the current network information strength and the current packet loss rate includes: Acquire multiple pre-stored retransmission strategies and strategy relationships; According to the current network information strength, the current packet loss rate and the policy relationship, a current retransmission policy is determined from the multiple retransmission policies.
6. The data packet processing method according to claim 1, characterized in that: The current retransmission strategy includes: the current number of retransmissions and the current retransmission priority; when an exception occurs when the data packet is sent, processing the data packet according to the current retransmission strategy includes: When an exception occurs when the data packet is sent, obtaining the data type of the data packet; Determining the current retransmission priority of the data packet according to the data type; The data packet is retransmitted according to the current retransmission priority, and when the accumulated number of retransmissions of the data packet exceeds the current number of retransmissions, the retransmission of the data packet is stopped.
7. The data packet processing method according to claim 1, characterized in that: The method further comprises: When an abnormality occurs when the data packet is sent, determining an abnormal event corresponding to the abnormality, and uploading the abnormal event to a server; The cause of the abnormality is determined through the first preset message and the second preset message, and abnormality reminder information corresponding to the cause of the abnormality is output.
8. The data packet processing method according to claim 7, characterized in that: The uploading of the abnormal event to the server includes: Obtaining abnormal information corresponding to the abnormal event; The abnormal information is uploaded to the server through a publishing message message of a telemetry transmission protocol, so that the server stores the abnormal information.
9. The data packet processing method according to claim 1, characterized in that: The obtaining of current network status information between the smart home device and the gateway includes: When it is detected that the smart home device is connected to the gateway for the first time through the telemetry transmission protocol, the current network status information between the smart home device and the gateway is obtained according to the broadcast function of the gateway.
10. A data packet processing device, characterized in that: The device is applied to a control system; The control system is deployed in smart home devices; The smart home device is connected to a gateway, and the device comprises: An acquisition module, used to acquire current network status information between the smart home device and the gateway; A first determination module, configured to determine a current data packet size, a current communication frequency, and a current retransmission strategy according to the current network status information; A sending module, used to send a data packet according to the current data packet size and the current communication frequency, and detect whether an abnormality occurs when the data packet is sent; A processing module is used to process the data packet according to the current retransmission strategy when an exception occurs when the data packet is sent.
11. A smart home device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the data packet processing method according to any one of claims 1 to 9 are implemented.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data packet processing method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Power distribution Internet of Things system and method based on MQTT
CN112636462A
Edge cloud collaborative analysis-based energy scheduling system and control method
CN116668441A
Water dispenser control method and system based on Internet of Things
CN118138607A
Audio and video synchronous transmission optimization method and vehicle-cloud integrated end-to-end audio and video communication system
CN118573936A