Information transmission method, device, equipment and storage medium
By establishing neighbor relationships and detecting link status in IoT devices, the power consumption problem caused by traditional heartbeat packets is solved, and efficient link management and power saving in IoT devices are achieved.
Patent Information
- Application Number
- CN202211080052.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-05
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2042-09-05
AI Technical Summary
Traditional routing protocols continuously send heartbeat packets to IoT devices to confirm link status, resulting in excessive battery power consumption and inability to effectively manage the power consumption of IoT devices.
By establishing neighbor relationships between IoT devices, it detects whether the communication link is disconnected, and only sends data packets when the link is normal to avoid continuously sending heartbeat packets, thereby saving power consumption.
It realizes timely detection and processing of link disconnection in IoT devices without the need to continuously send heartbeat packets, avoiding information transmission failure and significantly saving power.
Smart Images

Figure CN115550419B
Abstract
Description
Technical Field
[0001] The present application relates to communication technology, and in particular to an information transmission method, device, equipment and storage medium. Background Art
[0002] Traditional routing protocols are used in Internet networks, and the nodes that mainly manage and forward routing link status information are routers. Dynamic routing protocols allow routers to automatically learn the routing link status information of other routers. If the link status of the router changes (such as the router goes offline), the link status of the router is distributed and transferred to other routers through the routing protocol, so that all routers have the routing link status information of the entire Internet network, which can be further used to generate the topology of the entire network and configure the routing table.
[0003] Here, whether the router is off the network is confirmed by continuously sending heartbeat packets plus aging time. However, the continuous sending of heartbeat packets has high requirements on power consumption, which is not a problem for routers that are specially plugged in. If the traditional routing protocol is directly applied to the network based on the Internet of Things (IOT) devices, the IOT device is the one that continuously sends the heartbeat packet. The IOT device may be a mobile phone, a tablet, a PC, etc. Since the IOT device is sensitive to battery power, if it is responsible for continuously sending heartbeat packets, it will cause a large amount of battery power consumption of the IOT device. Summary of the invention
[0004] The present application hopes to provide an information transmission method, apparatus, device and storage medium.
[0005] The technical solution of this application is implemented as follows:
[0006] In a first aspect, an information transmission method is provided, which is applied to a first Internet of Things device, and the method includes:
[0007] Establishing a neighbor relationship with the second IoT device;
[0008] Receive a second data packet sent by the second Internet of Things device; wherein the second data packet includes at least a second neighbor relationship table, a second sequence number, and a second link state, and the second link state is a first preset value, which is used to indicate that the communication link between the first Internet of Things device and the second Internet of Things device is normal;
[0009] Determine that the communication link with the second Internet of Things device is disconnected, and change the second link state in the second data packet corresponding to the second Internet of Things device from the first preset value to a second preset value, wherein when the second link state is the second preset value, it indicates that the communication link between the first Internet of Things device and the second Internet of Things device is disconnected;
[0010] When forwarding information is received, it is determined that the communication link is disconnected according to the second link status in the second data packet corresponding to the second Internet of Things device, and the second Internet of Things device is ignored; or, it is determined that the communication link is normal according to the second link status in the second data packet corresponding to the second Internet of Things device, and the forwarding information is forwarded to the second Internet of Things device.
[0011] In a second aspect, an information transmission device is provided, which is applied to a first Internet of Things device, and is characterized in that the device includes:
[0012] An establishing unit, configured to establish a neighbor relationship with a second IoT device;
[0013] A receiving unit, configured to receive a second data packet sent by the second Internet of Things device; wherein the second data packet includes at least a second neighbor relationship table, a second sequence number, and a second link state, and the second link state is a first preset value, which is used to indicate that the communication link between the first Internet of Things device and the second Internet of Things device is normal;
[0014] a changing unit, configured to determine that the communication link with the second Internet of Things device is disconnected, and change a second link state in a second data packet corresponding to the second Internet of Things device from the first preset value to a second preset value, wherein when the second link state is the second preset value, it indicates that the communication link between the first Internet of Things device and the second Internet of Things device is disconnected;
[0015] The processing unit is used to determine that the communication link is disconnected according to the second link state in the second data packet corresponding to the second Internet of Things device when receiving the forwarding information, and ignore the second Internet of Things device; or determine that the communication link is normal according to the second link state in the second data packet corresponding to the second Internet of Things device, and forward the forwarding information to the second Internet of Things device.
[0016] According to a third aspect, a first Internet of Things device is provided, comprising: a processor and a memory configured to store a computer program that can be run on the processor, wherein the processor is configured to execute the steps of the method of the first aspect when running the computer program.
[0017] According to a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program implements the steps of the method according to the first aspect when executed by a processor.
[0018] With the above technical solution, the neighbor relationship is established on the basis of successful communication. Whether the communication with the second IoT device is successful is detected to determine whether the communication link with the second IoT device is disconnected. In this way, there is no need to continuously send heartbeat packets, thereby saving power consumption. At the same time, the first IoT device can promptly learn whether the communication link between the two is disconnected by reading the second link status in the second data packet, thereby avoiding the situation where information is still forwarded to the second IoT device when the communication link is disconnected, resulting in failure of information sending. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A schematic diagram of a flow chart of an information transmission method provided in an embodiment of the present application;
[0020] Figure 2 A schematic diagram of establishing a neighbor relationship between a first Internet of Things device and a second Internet of Things device provided in an embodiment of the present application;
[0021] Figure 3 A schematic diagram of updating a first data packet and a second data packet after a first IoT device is disconnected from a second IoT device as an example of the present application;
[0022] Figure 4 A schematic diagram of updating a first data packet of a first IoT device as an example of the present application;
[0023] Figure 5 This is a schematic diagram of the first process of the link information updating method in an embodiment of the present application;
[0024] Figure 6 This is a schematic diagram of the second process of the link information updating method in an embodiment of the present application;
[0025] Figure 7 A schematic diagram of the structure of an information transmission device provided in an embodiment of the present application;
[0026] Figure 8 This is a schematic diagram of the composition structure of a first Internet of Things device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.
[0028] It should be noted that the application scenario of the present application is a networking network composed of multiple IoT devices, which includes two types of IoT devices. One is a device for receiving or sending information, namely the third IoT device mentioned below, which can also be called a non-core device (Non-Core Router, NR); the other is a device for generating, updating, and transmitting data packets, namely the first IoT device and the second IoT device mentioned below, which can also be called a core device (Designated Router, DR). The executor of the information transmission method provided in the present application can be any core device DR. The information transmission method of the present application is specifically described below with the first IoT device as the executor.
[0029] Figure 1 A flow chart of an information transmission method provided in an embodiment of the present application, which is applied to a first Internet of Things device.
[0030] like Figure 1 As shown, the detection method may specifically include:
[0031] Step 101: Establish a neighbor relationship with a second IoT device.
[0032] Specifically, a communication connection is established with the second Internet of Things device, and on the basis of the established communication connection, a neighbor relationship with the second Internet of Things device is established, so that the first Internet of Things device knows the second Internet of Things device, and the second Internet of Things device also knows the first Internet of Things device, that is, the first Internet of Things device and the second Internet of Things device can perceive each other and form a stable link.
[0033] Exemplarily, based on the TCP / IP protocol, a communication connection is established between the first IoT device and the second IoT device.
[0034] Figure 2 A schematic diagram of establishing a neighbor relationship between a first IoT device and a second IoT device is provided in an embodiment of the present application, such as Figure 2 As shown,
[0035] First, the first IoT device A1 sends a first Hello packet to the second IoT device B1, so that the second IoT device B1 parses the first Hello packet to obtain the first neighbor relationship table of the first IoT device A1 and the first IoT device A1 is in the init state, and the second IoT device B1 adds the first IoT device A1 to the second neighbor relationship table of the second IoT device B1, and when checking that the first neighbor relationship table of the first IoT device A1 does not include the second IoT device B1 (i.e., itself), the first IoT device A1 is changed from the init state to the 1way state;
[0036] Next, the first IoT device A1 receives the first HelloAck packet returned by the second IoT device B1, which indicates that the first IoT device A1 is in the 1way state.
[0037] Next, the first IoT device A1 receives the second Hello packet sent by the second IoT device B1, parses the second Hello packet, obtains the second neighbor relationship table of the second IoT device B1 and the first IoT device A1 is in the 1way state, the first IoT device A1 adds the second IoT device B1 to the first neighbor relationship table, and when checking that the second neighbor relationship table of the second IoT device B1 includes the first IoT device A1, changes the second IoT device B1 from the 1way state to the 2way state;
[0038] Next, the first IoT device A1 sends a second HelloAck packet to the second IoT device B1, indicating that the second IoT device B1 is in the 2way state;
[0039] Next, the first IoT device A1 sends a third Hello packet to the second IoT device B1, so that the second IoT device B1 parses the third Hello packet, obtains the first neighbor relationship table of the first IoT device A1 and the second IoT device B1 is in a 2way state, and when checking that the first neighbor relationship table of the first IoT device A1 includes the second IoT device B1, the first IoT device A1 is changed from a 1way state to a 2way state.
[0040] Finally, the first IoT device A1 receives the third HelloAck packet returned by the second IoT device B1, which is used to indicate that the first IoT device A1 is in the 2way state.
[0041] After the above information is synchronized, the first IoT device A1 and the second IoT device B1 can sense each other, forming a stable link. When both parties are in the 2way state, the sending of Hello packets is stopped, which can effectively control the number of packets sent and save resources.
[0042] Here, the first neighbor relationship table generated by the first IoT device may be composed of the IP address of the first IoT device and the IP address of the second IoT device. Correspondingly, the second neighbor relationship table generated by the second IoT device may be composed of the IP address of the second IoT device and the IP address of the first IoT device.
[0043] Step 102: Receive a second data packet sent by the second IoT device; wherein the second data packet includes at least a second neighbor relationship table, a second sequence number, and a second link status, and the second link status is a first preset value, which is used to indicate that the communication link between the first IoT device and the second IoT device is normal.
[0044] It should be noted that after the first IoT device establishes a neighbor relationship with the second IoT device, the second IoT device obtains a second neighbor relationship table, which is constructed by the link information of the communication link between the second IoT device and the first IoT device, and may be composed of the IP address of the second IoT device and the IP address of the first IoT device. The second IoT device then sets a second serial number and sets the second link state to a first preset value (such as 1) to indicate that the communication link between the second IoT device and the first IoT device is normal. Furthermore, the second IoT device generates a second data packet based on the second neighbor relationship table, the second serial number, the second link state, and the identification information of the second IoT device. Afterwards, the second IoT device sends the second data packet to the first IoT device, so that the first IoT device receives the second data packet of the second IoT device.
[0045] It should be noted that when the neighboring device of the second IoT device is added or reduced, the link formed by the second IoT device and its neighboring device changes. Each time a change occurs, the second IoT device indicates a link update by adding 1 to the second serial number.
[0046] Step 103: Determine that the communication link with the second Internet of Things device is disconnected, and change the second link state in the second data packet corresponding to the second Internet of Things device from the first preset value to a second preset value. When the second link state is the second preset value, it indicates that the communication link between the first Internet of Things device and the second Internet of Things device is disconnected.
[0047] It should be noted that when the communication link between the first IoT device and the second IoT device is not disconnected, it means that the first IoT device and the second IoT device are in a neighbor relationship, then the first IoT device can receive the second data packet sent by the second IoT device, and the second link state in the second data packet of the second IoT device is the first preset value (such as 1), indicating that the communication link between the first IoT device and the second IoT device is normal. When the communication link between the first IoT device and the second IoT device is disconnected, it means that the first IoT device and the second IoT device are no longer in a neighbor relationship, and the communication link between the first IoT device and the second IoT device needs to be disconnected. This application changes the second link state of the second IoT device from the first preset value to the second preset value (such as from 1 to 0) on the first IoT device side, which is used to indicate that the communication link between the first IoT device and the second IoT device is in a disconnected state, that is, the first IoT device cannot forward information through the second IoT device.
[0048] In some embodiments, the method further comprises:
[0049] Sending a first disconnection request to the second Internet of Things device;
[0050] Receive first confirmation information returned by the second Internet of Things device, used to confirm that the first disconnection request has been received;
[0051] Receiving a second disconnection request sent by the second Internet of Things device;
[0052] Sending second confirmation information to the second Internet of Things device to confirm that the second disconnection request has been received;
[0053] Disconnect the communication link with the second IoT device.
[0054] Here, when the first IoT device wants to disconnect the communication link between the two and the second IoT device, the first IoT device will send a first disconnection request to the second IoT device, so that after receiving the first disconnection request, the second IoT device returns a first confirmation message to the first IoT device to confirm that the first disconnection request has been received. At this time, although the first IoT device is ready to disconnect, the second IoT device may not be ready yet, and the second IoT device may still have unprocessed messages, so it can only send a first confirmation message to the first IoT device to inform the first IoT device that it has received the first disconnection request, but it cannot disconnect from the first IoT device for the time being. After a period of time, the second IoT device sends a second disconnection request to the first IoT device. After receiving the second disconnection request, the first IoT device sends a second confirmation message to the second IoT device to confirm that the second disconnection request has been received. At the same time, the first IoT device disconnects the communication link with the second IoT device, and the second IoT device disconnects the communication link with the first IoT device.
[0055] In addition, when the second IoT device wants to disconnect the communication link between the second IoT device and the first IoT device, in some embodiments, the method further includes:
[0056] receiving a third disconnection request sent by the second IoT device;
[0057] Sending third confirmation information to the second Internet of Things device to confirm that the third disconnection request has been received;
[0058] Sending a fourth disconnection request to the second Internet of Things device;
[0059] Receiving fourth confirmation information sent by the second Internet of Things device, used to confirm that the fourth disconnection request has been received;
[0060] Disconnect the communication link with the second IoT device.
[0061] Step 104: When the forwarding information is received, it is determined that the communication link is disconnected according to the second link status in the second data packet corresponding to the second Internet of Things device, and the second Internet of Things device is ignored; or, it is determined that the communication link is normal according to the second link status in the second data packet corresponding to the second Internet of Things device, and the forwarding information is forwarded to the second Internet of Things device.
[0062] In some embodiments, after establishing a neighbor relationship with the second IoT device, the method further includes:
[0063] Acquire link information of the communication link with the second Internet of Things device;
[0064] Constructing a first neighbor relationship table of the first Internet of Things device using the link information;
[0065] Setting a first serial number of the first IoT device;
[0066] Setting a first link state of the first Internet of Things device to a first preset value;
[0067] Using the first neighbor relationship table, the first sequence number, the first link state, and the identification information of the first IoT device (for example Figure 3 and Figure 4 denoted by RouteID), generating a first data packet of the first IoT device;
[0068] When it is determined that the communication link with the second Internet of Things device is disconnected, the method further includes: deleting the link information between the first Internet of Things device and the second Internet of Things device in the first neighbor relationship table, and adding 1 to the first sequence number.
[0069] It should be noted that when the neighboring device of the first IoT device is added or reduced, the link formed by the first IoT device and its neighboring device changes. Each time a change occurs, the first IoT device indicates a link update by adding 1 to the first serial number.
[0070] It should be noted that when the communication link between the first IoT device and the second IoT device is not disconnected, it means that the first IoT device and the second IoT device are in a neighbor relationship, and the first neighbor relationship table includes the link information of the communication link between the first IoT device and the second IoT device. When the communication link between the first IoT device and the second IoT device is disconnected, it means that the first IoT device and the second IoT device are no longer in a neighbor relationship, and the first IoT device needs to delete the link information of the communication link between the first IoT device and the second IoT device from the first neighbor relationship table. This application indicates the link update by adding 1 to the first sequence number.
[0071] In this regard, Figure 3 This is a schematic diagram of updating a first data packet and a second data packet after a first IoT device is disconnected from a second IoT device as exemplified in this application, such as Figure 3 As shown,
[0072] When the first IoT device A1 and the second IoT device B1 are in a neighbor relationship, the first serial number (SerialNum) in the first data packet of the first IoT device A1 is 3, and the first link state is 1, indicating that the communication link between the first IoT device A1 and the second IoT device B1 is normal. For example, the first link state can be represented by an effective value (available). Among them, the data packet can also be called a link state packet (Link State Packet, LSP1). The second serial number in the second data packet LSP2 of the second IoT device B1 received by the first IoT device A1 is 3, and the second link state is 1, indicating that the communication link between the second IoT device B1 and the first IoT device A1 is normal.
[0073] When the first IoT device A1 and the second IoT device B1 are no longer in a neighbor relationship, the first IoT device A1 needs to increase the first sequence number in the first data packet LSP1 composed of itself by 1, that is, change it to 4, and change the second link state in the second data packet LSP2 of the second IoT device B1 from 1 to 0, indicating that the communication link between the second IoT device B1 and the first IoT device A1 is disconnected. The first link state of the first IoT device does not change, and the second sequence number of the second IoT device does not change. In this regard, it should be noted that when the neighbor device of the second IoT device is added or reduced, the link between the second IoT device and its neighbor device changes. Each time a change occurs, the second IoT device indicates that the link has changed by increasing the second sequence number by 1. Therefore, when the first IoT device determines that the communication link with the second IoT device is disconnected, the second sequence number does not need to be updated on the first IoT device side, but on the second IoT device side, the second IoT device increases the second sequence number by 1 to indicate that its link is updated. It should also be noted that when the first link state of the first IoT device is the first preset value, it indicates that the communication link between the first IoT device and the second IoT device is normal. When the communication link between the first IoT device and the second IoT device is disconnected, it means that the first IoT device and the second IoT device are no longer in a neighbor relationship. Therefore, it is necessary to delete the link information of the communication link between the first IoT device and the second IoT device from the first neighbor relationship table without changing the first link state.
[0074] Correspondingly, when the second IoT device B1 is used as the execution subject, the second IoT device B1 will receive the first data packet LSP1 generated by the first IoT device A1. The first sequence number in the first data packet LSP1 is 3, and the first link state is 1, indicating that the communication link between the first IoT device A1 and the second IoT device B1 is normal. The second sequence number in the second data packet LSP2 of the second IoT device B1 is 3, and the second link state is 1, indicating that the communication link between the second IoT device B1 and the first IoT device A1 is normal.
[0075] When the first IoT device A1 and the second IoT device B1 are no longer neighbors, the second IoT device B1 needs to increase the second sequence number in the second data packet LSP2 by 1, i.e., change it to 4, and change the first link state in the first data packet LSP1 of the first IoT device A1 from 1 to 0, indicating that the communication link between the second IoT device B1 and the first IoT device A1 is disconnected. The second link state of the second IoT device does not change, and the first sequence number of the first IoT device does not change.
[0076] In some embodiments, the method further includes: establishing a neighbor relationship with a third Internet of Things device, so that the first neighbor relationship table also includes link information between the first Internet of Things device and the third Internet of Things device;
[0077] When it is determined that the communication link with the third Internet of Things device is disconnected, the link information including the first Internet of Things device and the third Internet of Things device in the first neighbor relationship table is deleted, and the first sequence number is increased by 1; when it is detected that the communication link with the new third Internet of Things device is normal, the link information between the first Internet of Things device and the new third Internet of Things device is added to the first neighbor relationship table, and the first sequence number is increased by 1.
[0078] It should be noted that the third IoT device is a non-core device NR, which can also be understood as an edge device, which is responsible for receiving or sending information and does not have the function of generating, forwarding or receiving link information. The third IoT device does not generate corresponding data packets.
[0079] In this regard, Figure 4 This is a schematic diagram of updating a first data packet of a first IoT device as exemplified in this application, such as Figure 4 As shown,
[0080] When the first Internet of Things device A1 is in a neighbor relationship with the third Internet of Things devices A2, A3, and A4 respectively, the first data packet LSP1 of the first Internet of Things device A1 includes link information of three links between the first Internet of Things device A1 and the third Internet of Things devices A2, A3, and A4 respectively. In the example, the first sequence number in the first data packet is 3, and the first link state is 1.
[0081] When the first IoT device A1 detects the addition of a new third IoT device A5, the link information between the first IoT device A1 and the new third IoT device A5 is added to the first neighbor relationship table, and the first sequence number is increased by 1, that is, 4, and the first link state is 1.
[0082] When the first IoT device A1 detects that the third IoT device A4 is offline, the link information between the first IoT device A1 and the third IoT device A4 is deleted from the first neighbor relationship table, and the first sequence number is increased by 1 again, that is, 5, and the first link state is 1.
[0083] With the above technical solution, the neighbor relationship is established on the basis of successful communication. Whether the communication with the second IoT device is successful is detected to determine whether the communication link with the second IoT device is disconnected. In this way, there is no need to continuously send heartbeat packets, thereby saving power consumption. At the same time, the first IoT device can promptly learn whether the communication link between the two is disconnected by reading the second link status in the second data packet, thereby avoiding the situation where information is still forwarded to the second IoT device when the communication link is disconnected, resulting in failure of information sending.
[0084] In actual applications, when the first IoT device is used as the execution subject, the neighboring devices of the first IoT device (including the second IoT device and the third IoT device) may change at any time, and may increase or decrease. In order to be able to update the first data packet and the second data packet in time, and synchronize the latest first data packet and the second data packet to the neighboring devices, when the first IoT device transmits information, it can quickly and accurately find the corresponding second IoT device to forward the information.
[0085] In this regard, the present application provides a link information updating method. Figure 5 Schematic diagram of the first process of the link information updating method in the embodiment of the present application. Figure 5 As shown, the link information updating method specifically includes:
[0086] Step 501: Establish a neighbor relationship with a second IoT device.
[0087] Step 502: Obtain link information of the communication link with the second Internet of Things device; construct a first neighbor relationship table of the first Internet of Things device using the link information; set a first serial number of the first Internet of Things device; set a first link state of the first Internet of Things device to a first preset value; and generate a first data packet of the first Internet of Things device using the first neighbor relationship table, the first serial number, the first link state, and the identification information of the first Internet of Things device.
[0088] Step 503: Receive a second data packet sent by the second IoT device; wherein the second data packet includes at least a second neighbor relationship table, a second sequence number, and a second link status, and the second link status is a first preset value, which is used to indicate that the communication link between the first IoT device and the second IoT device is normal.
[0089] Step 504: Save the first data packet and the received plurality of second data packets into a first storage space.
[0090] Step 505: Compare the first storage space with the second storage space to determine the target data packet stored in the first storage space but not in the second storage space; wherein the second storage space stores the data packet stored by the second IoT device.
[0091] Step 506: Send the target data packet to the second IoT device, so that the data packet stored in the second IoT device is the same as the data packet stored in the first IoT device.
[0092] It should be noted that the first IoT device includes two storage spaces, namely a first storage space and a second storage space. The first storage space is used to store a first data packet generated by the first IoT device itself and a second data packet received from the second IoT device. The second storage space is used to store all stored data packets returned by the second IoT device.
[0093] Exemplarily, if three second IoT devices are included, namely, second IoT device 1, second IoT device 2, and second IoT device 3, the first storage space of the first IoT device stores the first data packet, the second data packet of the second IoT device 1, the second data packet of the second IoT device 2, and the second data packet of the second IoT device 3; the second storage space of the first IoT device stores the first data packet corresponding to the second IoT device 1, and the second data packet of the second IoT device 1 is compared with the first storage space and the second storage space, and the first IoT device sends the second data packet of the second IoT device 2 and the second data packet of the second IoT device 3 to the second IoT device 1; the second storage space of the first IoT device stores the first data packet corresponding to the second IoT device 2 and the second data packet of the second IoT device 2, and the first storage space and the second storage space are compared, and the first IoT device sends the second data packet of the second IoT device 1 and the second data packet of the second IoT device 3 to the second IoT device 2; the second storage space of the first IoT device stores the first data packet corresponding to the second IoT device 3 and the second data packet of the second IoT device 3, and the first storage space and the second storage space are compared, and the first IoT device sends the second data packet of the second IoT device 1 and the second data packet of the second IoT device 2 to the second IoT device 3; in this way, the first IoT device, the second IoT device 1, the second IoT device 2, and the second IoT device 3 all store the same data packet.
[0094] In some embodiments, after sending the target data packet to the second IoT device, the method further includes:
[0095] receiving a stored data packet returned by the second IoT device;
[0096] The second storage space is updated using the stored data packet returned by the second IoT device.
[0097] Here, after the second storage space is updated, the data packets in the first storage space and the second storage space are made the same. When the neighbor device of the first IoT device changes again, the above link information updating steps are repeated, and finally the data packets in the first storage space and the second storage space are made the same.
[0098] In some embodiments, the method further comprises:
[0099] When the second neighbor relationship table of the second Internet of Things device is updated, receiving a new second data packet sent by the second Internet of Things device; wherein the new second data packet at least includes an updated second neighbor relationship table and an updated second sequence number;
[0100] When it is determined that the second sequence number of the second data packet is different from the updated second sequence number, the second data packet of the second Internet of Things device is updated using the new second data packet.
[0101] It should be noted that when the number of neighbor devices of the second IoT device increases or decreases, it indicates that the second neighbor relationship table of the second IoT device needs to be updated. After the second IoT device updates the second data packet generated by itself, it will actively send the new second data packet to the first IoT device, so that after the first IoT device receives the new second data packet, if the corresponding second data packet of the second IoT device is found according to the identification information in the new second data packet, and the second sequence number in the new second data packet is greater than the second sequence number in the original second data packet, the second data packet of the second IoT device is updated with the new second data packet, that is, the first storage space of the first IoT device is updated. Then, it is compared with the second storage space to achieve the purpose of the first storage space and the second storage space having the same data packet.
[0102] Based on the above embodiments, the present application also provides a link information updating method. Figure 6 Schematic diagram of the second process of the link information updating method in the embodiment of the present application. Figure 6 As shown, the link information updating method specifically includes:
[0103] Step 1: After the first IoT device and the second IoT device establish a neighbor relationship, both are in a 2way state and will no longer send hello packets, effectively controlling the sending of hello packets and saving resources.
[0104] Step 2: The first IoT device generates a first data packet, receives multiple second data packets generated by multiple second IoT devices, and stores the first data packet and multiple second data packets in the first storage space. At the same time, the first IoT device sends the first data packet to the target second IoT device, so that the first storage space of the target second IoT device stores the target second data packet and the first data packet, and then the first IoT device receives the stored target second data packet and the first data packet returned by the target second IoT device.
[0105] Step 3: Compare whether the data packets in the first storage space and the second storage space are the same.
[0106] Step 4: When it is determined that the data packets in the first storage space and the second storage space are different, the first IoT device sends the target data packet stored in the first storage space but not stored in the second storage space to the target second IoT device.
[0107] Step 5: The first IoT device receives the stored target data packet returned by the target second IoT device, and uses it to update the second storage space so that the data packets in the first storage space are the same as those in the second storage space.
[0108] Step 6: When it is determined that the data packets in the first storage space and the second storage space are the same, the first IoT device is in a FULL state.
[0109] When the neighbor device of the first IoT device changes again, steps 3 to 6 are repeated.
[0110] In order to implement the method of the embodiment of the present application, based on the same inventive concept, an information transmission device is also provided in the embodiment of the present application. Figure 7 A schematic diagram of the structure of an information transmission device provided in an embodiment of the present application is applied to a first Internet of Things device, such as Figure 7 As shown, the information transmission device 70 includes:
[0111] An establishing unit 701 is used to establish a neighbor relationship with a second IoT device;
[0112] The receiving unit 702 is used to receive a second data packet sent by the second Internet of Things device; wherein the second data packet includes at least a second neighbor relationship table, a second sequence number, and a second link state, and the second link state is a first preset value, which is used to indicate that the communication link between the first Internet of Things device and the second Internet of Things device is normal;
[0113] A changing unit 703 is configured to determine that the communication link with the second Internet of Things device is disconnected, and change a second link state in a second data packet corresponding to the second Internet of Things device from the first preset value to a second preset value, wherein when the second link state is the second preset value, it indicates that the communication link between the first Internet of Things device and the second Internet of Things device is disconnected;
[0114] The processing unit 704 is used to determine that the communication link is disconnected according to the second link state in the second data packet corresponding to the second Internet of Things device when receiving the forwarding information, and ignore the second Internet of Things device; or determine that the communication link is normal according to the second link state in the second data packet corresponding to the second Internet of Things device, and forward the forwarding information to the second Internet of Things device.
[0115] In some embodiments, the processing unit 704 is further configured to obtain link information of the communication link with the second IoT device;
[0116] Constructing a first neighbor relationship table of the first Internet of Things device using the link information;
[0117] Setting a first serial number of the first IoT device;
[0118] Setting a first link state of the first Internet of Things device to a first preset value;
[0119] Generate a first data packet of the first Internet of Things device by using the first neighbor relationship table, the first sequence number, the first link state, and the identification information of the first Internet of Things device;
[0120] When it is determined that the communication link with the second Internet of Things device is disconnected, the changing unit 703 is further used to delete the link information between the first Internet of Things device and the second Internet of Things device in the first neighbor relationship table, and increase the first sequence number by 1.
[0121] In some embodiments, the establishing unit 701 is further used to establish a neighbor relationship with a third Internet of Things device, so that the first neighbor relationship table also includes the link information between the first Internet of Things device and the third Internet of Things device; the changing unit 703 is further used to delete the link information between the first Internet of Things device and the third Internet of Things device in the first neighbor relationship table when it is determined that the communication link with the third Internet of Things device is disconnected, and increase the first sequence number by 1;
[0122] When it is detected that the communication link with the new third Internet of Things device is normal, the link information between the first Internet of Things device and the new third Internet of Things device is added to the first neighbor relationship table, and the first sequence number is increased by 1.
[0123] In some embodiments, the processing unit 704 is further configured to save the first data packet and the received plurality of second data packets to a first storage space;
[0124] Compare the first storage space with the second storage space to determine a target data packet stored in the first storage space but not stored in the second storage space; wherein the second storage space stores the data packet stored by the second IoT device;
[0125] The target data packet is sent to the second IoT device so that the data packet stored in the second IoT device is the same as the data packet stored in the first IoT device.
[0126] In some embodiments, the receiving unit 702 is further configured to receive a stored data packet returned by the second IoT device;
[0127] The second storage space is updated using the stored data packet returned by the second IoT device.
[0128] In some embodiments, the receiving unit 702 is further configured to receive a new second data packet sent by the second Internet of Things device when the second neighbor relationship table of the second Internet of Things device is updated; wherein the new second data packet at least includes the updated second neighbor relationship table and the updated second sequence number;
[0129] When it is determined that the second sequence number of the second data packet is different from the updated second sequence number, the second data packet of the second Internet of Things device is updated using the new second data packet.
[0130] In some embodiments, the changing unit 703 is further configured to send a first disconnection request to the second IoT device;
[0131] Receive first confirmation information returned by the second Internet of Things device, used to confirm that the first disconnection request has been received;
[0132] Receiving a second disconnection request sent by the second Internet of Things device;
[0133] Sending second confirmation information to the second Internet of Things device to confirm that the second disconnection request has been received;
[0134] Disconnect the communication link with the second IoT device.
[0135] The embodiment of the present application also provides another first Internet of Things device, Figure 8 A schematic diagram of a first IoT device structure provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, the first IoT device 80 includes: a processor 801 and a memory 802 configured to store a computer program that can be run on the processor;
[0136] The processor 801 is configured to execute the method steps in the aforementioned embodiment when running a computer program.
[0137] Of course, in practical applications, Figure 8 As shown, the various components in the first IoT device are coupled together via a bus system 803. It is understood that the bus system 803 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 803 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 8 Various buses are labeled as bus system 803.
[0138] In practical applications, the processor may be at least one of an application-specific integrated circuit (ASIC), a digital signal processing device (DSPD), a programmable logic device (PLD), a field-programmable gate array (FPGA), a controller, a microcontroller, and a microprocessor. It is understandable that for different devices, the electronic device used to implement the functions of the processor may also be other, and the embodiments of the present application do not specifically limit this.
[0139] The above-mentioned memory can be a volatile memory (volatile memory), such as a random access memory (RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (ROM), a flash memory, a hard disk (HDD) or a solid-state drive (SSD); or a combination of the above-mentioned types of memory, and provide instructions and data to the processor.
[0140] In an exemplary embodiment, the present application also provides a computer-readable storage medium for storing a computer program.
[0141] Optionally, the computer-readable storage medium can be applied to any one of the methods in the embodiments of the present application, and the computer program enables the computer to execute the corresponding processes implemented by the processor in each method in the embodiments of the present application. For the sake of brevity, they are not repeated here.
[0142] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0143] The units described above 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 distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0144] In addition, all functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units. A person of ordinary skill in the art may understand that all or part of the steps of implementing the above method embodiments may be completed by hardware related to program instructions, and the above program may be stored in a computer-readable storage medium, which, when executed, executes the steps of the above method embodiments; and the above storage medium includes various media that can store program codes, such as mobile storage devices, read-only memories (ROM), random access memories (RAM), magnetic disks or optical disks.
[0145] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0146] The features disclosed in several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0147] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0148] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. An information transmission method, applied to a first Internet of Things device, characterized in that: The method comprises: Establishing a neighbor relationship with the second IoT device; Receive a second data packet sent by the second Internet of Things device; wherein the second data packet includes at least a second neighbor relationship table, a second sequence number, and a second link state, and the second link state is a first preset value, which is used to indicate that the communication link between the first Internet of Things device and the second Internet of Things device is normal; wherein the second neighbor relationship table includes link information of the communication link between the second Internet of Things device and the first Internet of Things device, and the second sequence number is used to indicate a link update by adding 1 when the second Internet of Things device performs a link update; Determine that the communication link with the second Internet of Things device is disconnected, change the second link state in the second data packet corresponding to the second Internet of Things device from the first preset value to a second preset value, wherein when the second link state is the second preset value, it indicates that the communication link between the first Internet of Things device and the second Internet of Things device is disconnected; and delete the link information between the first Internet of Things device and the second Internet of Things device in the first neighbor relationship table of the first Internet of Things device, and increase the first serial number of the first Internet of Things device by 1; When the forwarding information is received, it is determined that the communication link is disconnected according to the second link status in the second data packet corresponding to the second Internet of Things device, and the second Internet of Things device is ignored; or, it is determined that the communication link is normal according to the second link status in the second data packet corresponding to the second Internet of Things device, and the forwarding information is forwarded to the second Internet of Things device.
2. The method according to claim 1, characterized in that After establishing a neighbor relationship with the second IoT device, the method further includes: Acquire link information of the communication link with the second Internet of Things device; Constructing a first neighbor relationship table of the first Internet of Things device using the link information; Setting a first serial number of the first IoT device; Setting a first link state of the first Internet of Things device to a first preset value; A first data packet of the first Internet of Things device is generated by using the first neighbor relationship table, the first sequence number, the first link state, and the identification information of the first Internet of Things device.
3. The method according to claim 2, characterized in that The method further includes: establishing a neighbor relationship with a third Internet of Things device, so that the first neighbor relationship table also includes link information between the first Internet of Things device and the third Internet of Things device; When it is determined that the communication link with the third Internet of Things device is disconnected, deleting the link information between the first Internet of Things device and the third Internet of Things device from the first neighbor relationship table, and increasing the first sequence number by 1; When it is detected that the communication link with the new third Internet of Things device is normal, the link information between the first Internet of Things device and the new third Internet of Things device is added to the first neighbor relationship table, and the first sequence number is increased by 1.
4. The method according to claim 2, characterized in that: The method further comprises: Saving the first data packet and the received plurality of second data packets to a first storage space; Compare the first storage space with the second storage space to determine a target data packet stored in the first storage space but not stored in the second storage space; wherein the second storage space stores the data packet stored by the second IoT device; The target data packet is sent to the second IoT device so that the data packet stored in the second IoT device is the same as the data packet stored in the first IoT device.
5. The method according to claim 4, characterized in that After sending the target data packet to the second IoT device, the method further includes: receiving a stored data packet returned by the second IoT device; The second storage space is updated using the stored data packet returned by the second IoT device.
6. The method according to claim 1, characterized in that The method further comprises: When the second neighbor relationship table of the second Internet of Things device is updated, receiving a new second data packet sent by the second Internet of Things device; wherein the new second data packet at least includes an updated second neighbor relationship table and an updated second sequence number; When it is determined that the second sequence number of the second data packet is different from the updated second sequence number, the second data packet of the second Internet of Things device is updated using the new second data packet.
7. The method according to claim 1, characterized in that The method further comprises: Sending a first disconnection request to the second Internet of Things device; Receive first confirmation information returned by the second Internet of Things device, used to confirm that the first disconnection request has been received; Receiving a second disconnection request sent by the second Internet of Things device; Sending second confirmation information to the second Internet of Things device to confirm that the second disconnection request has been received; Disconnect the communication link with the second IoT device.
8. An information transmission device, applied to a first Internet of Things device, characterized in that: The device comprises: An establishing unit, configured to establish a neighbor relationship with a second IoT device; A receiving unit, configured to receive a second data packet sent by the second Internet of Things device; wherein the second data packet at least includes a second neighbor relationship table, a second sequence number, and a second link state, and the second link state is a first preset value, which is used to indicate that the communication link between the first Internet of Things device and the second Internet of Things device is normal; wherein the second neighbor relationship table includes link information of the communication link between the second Internet of Things device and the first Internet of Things device, and the second sequence number is used to indicate a link update by adding 1 when the second Internet of Things device performs a link update; a changing unit, configured to determine that the communication link with the second Internet of Things device is disconnected, and change the second link state in the second data packet corresponding to the second Internet of Things device from the first preset value to a second preset value, wherein when the second link state is the second preset value, it indicates that the communication link between the first Internet of Things device and the second Internet of Things device is disconnected; and delete the link information between the first Internet of Things device and the second Internet of Things device in the first neighbor relationship table of the first Internet of Things device, and increase the first serial number of the first Internet of Things device by 1; The processing unit is used to determine that the communication link is disconnected according to the second link state in the second data packet corresponding to the second Internet of Things device when receiving the forwarding information, and ignore the second Internet of Things device; or determine that the communication link is normal according to the second link state in the second data packet corresponding to the second Internet of Things device, and forward the forwarding information to the second Internet of Things device.
9. A first Internet of Things device, characterized in that: The first IoT device comprises: a processor and a memory configured to store a computer program that can be run on the processor, Wherein, the processor is configured to execute the steps of the method according to any one of claims 1 to 7 when running the computer program.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
