Data transmission method and device, storage medium and electronic equipment
By broadcasting probe frames in a device cluster and analyzing response frames to determine the transmission path, the problems of interrupted direct communication and low complexity of indirect communication between devices are solved, achieving more efficient data transmission.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- QINGDAO HAIER TECH
- Filing Date
- 2023-05-26
- Publication Date
- 2026-07-24
AI Technical Summary
When devices communicate via Wi-Fi, direct communication between devices is interrupted, and the pathfinding process for indirect communication is complex and has low accuracy.
When data transmission between devices reaches the retransmission condition, a probe frame carrying identification information is broadcast to the device cluster. The response frame is received and analyzed to determine the target transmission path, and the optimal path is selected for data transmission based on the transmission count parameter.
It simplifies the routing process for indirect communication between devices and improves the accuracy of transmission.
Smart Images

Figure CN116614858B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart home technology, and more specifically, to a data transmission method and apparatus, a storage medium and an electronic device. Background Technology
[0002] Currently, device A and device B communicate via Wi-Fi, sending data packets to each other via Wi-Fi.
[0003] Since Wi-Fi connectivity only supports point-to-point communication, devices A and B may be unable to communicate if they are in different rooms, resulting in communication interruption. Although indirect communication can be used in existing technologies, the pathfinding process for indirect communication is more complex and the accuracy is lower.
[0004] There are currently no effective solutions to the problems in related technologies, such as the inability to communicate directly after equipment transmission failure, the complexity of the pathfinding process for indirect communication, and the low accuracy. Summary of the Invention
[0005] This application provides a data transmission method and apparatus, storage medium and electronic device to at least solve the problems in the related art, such as the inability to communicate directly after a device transmission failure, the complexity of the routing process for indirect communication, and the low accuracy.
[0006] According to one embodiment of this application, a data transmission method is provided, comprising: when the data transmission between a first device and a second device reaches a retransmission condition, broadcasting a first probe frame to devices in the device cluster where the first device is located, excluding the second device, wherein the first probe frame carries first identification information of the first device and second identification information of the second device; receiving a first response frame corresponding to the first probe frame, wherein the first response frame carries transmission path information of the first probe frame, the transmission path information being used to indicate the address information of each path device traversed on the transmission path through which the first response frame is indirectly transmitted to the first device; determining a target transmission path through which the first response frame is indirectly transmitted from the second device to the first device based on a transmission count parameter matching the first response frame; and transmitting data to be sent to the second device based on the target transmission path.
[0007] In one exemplary embodiment, before broadcasting the first probe frame to devices in the device cluster where the first device is located, excluding the second device, the method further includes: determining the data packet loss rate and the number of transmissions corresponding to the transmission of the data to be sent from the first device to the second device; and determining, based on the data packet loss rate and the number of transmissions, whether the data transmission between the first device and the second device meets the retransmission condition.
[0008] In an exemplary embodiment, receiving a first response frame corresponding to the first probe frame includes: receiving a first response frame and starting a timer, wherein the duration of the timer corresponds to the maximum number of devices that the first device is allowed to directly connect to; and receiving first response frames transmitted through multiple transmission paths within the duration of the timer, wherein each first response frame corresponds to a different transmission path.
[0009] In one exemplary embodiment, transmitting data to be sent to the second device based on the target transmission path includes: determining the minimum transmission path among the plurality of transmission paths, and determining the minimum transmission path as the target transmission path, wherein the minimum transmission path is used to indicate the path through which the first response frame is indirectly transmitted to the first device via the fewest path devices; writing the target transmission path and the data to be sent into a data frame, and sending the data frame to the second device through the target transmission path.
[0010] In one exemplary embodiment, the method further includes: upon receiving a second probe frame sent by a third device, determining the probe sequence number and first frame type of the second probe frame, and determining third identification information carried in the second probe frame, wherein the third device is to send data to the device corresponding to the third identification information; determining a first comparison result between the probe sequence number and the probe sequence number recorded by the first device, a second comparison result between the first frame type and the frame type recorded by the first device, and a third comparison result between the third identification information and the first identification information; and determining a processing method for the second probe frame based on the first comparison result, the second comparison result, and the third comparison result.
[0011] In an exemplary embodiment, determining the processing method for the second probe frame based on the first comparison result, the second comparison result, and the third comparison result includes one of the following: discarding the second probe frame when the first comparison result indicates that the probe sequence number is consistent with the probe sequence number recorded by the first device, and the second comparison result indicates that the first frame type is consistent with the frame type recorded by the first device; responding to the second probe frame when the first result and the second result occur, wherein the first result includes: the third comparison result indicates that the third identification information is consistent with the first identification information; the second result includes at least one of the following: the first comparison result indicates that the probe sequence number is inconsistent with the probe sequence number recorded by the first device, and the second comparison result indicates that the first frame type is inconsistent with the frame type recorded by the first device; forwarding the second probe frame when the third result and the second result occur, wherein the third result includes: the third comparison result indicates that the third identification information is inconsistent with the first identification information.
[0012] In one exemplary embodiment, the method further includes: upon receiving a second response frame sent by a fourth device, determining a transmission count parameter of the second response frame; determining a fourth comparison result between the transmission count parameter of the second response frame and a preset threshold; and determining a processing method for the second response frame based on the fourth comparison result.
[0013] In one exemplary embodiment, determining the processing method for the second response frame based on the fourth comparison result includes: if the fourth comparison result indicates that the transmission count parameter of the second response frame is less than the preset threshold, writing the address information of the first device into the target field of the second response frame, and adding a preset value to the transmission count parameter of the second response frame, wherein the target field is used to indicate the transmission path of the second response frame; if the fourth comparison result indicates that the transmission count parameter of the second response frame is greater than or equal to the preset threshold, discarding the second response frame.
[0014] According to another embodiment of the embodiments of the present application, a data transmission device is further provided, including: a broadcast module, configured to broadcast a first detection frame to devices in the device cluster where the first device is located except the second device when the data transmission between the first device and the second device reaches the retransmission condition, where the first detection frame carries the first identification information of the first device and the second identification information of the second device; a receiving module, configured to receive a first response frame corresponding to the first detection frame, where the first response frame carries the transmission path information of the first detection frame, and the transmission path information is used to indicate the address information of each path device passed on the transmission path where the first response frame is indirectly transmitted to the first device; a determining module, configured to determine a target transmission path for the first response frame to be indirectly transmitted from the second device to the first device based on a transmission count parameter matching the first response frame; and a transmission module, configured to transmit the data to be sent to the second device based on the target transmission path.
[0015] According to another aspect of the embodiments of the present application, a computer-readable storage medium is further provided, where a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the above data transmission method when running.
[0016] According to another aspect of the embodiments of the present application, an electronic device is further provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the above processor executes the above data transmission method through the computer program.
[0017] In the embodiments of the present application, when the data transmission between the first device and the second device reaches the retransmission condition, a first detection frame is broadcast to devices in the device cluster where the first device is located except the second device, where the first detection frame carries the first identification information of the first device and the second identification information of the second device; a first response frame corresponding to the first detection frame is received, where the first response frame carries the transmission path information of the first detection frame, and the transmission path information is used to indicate the address information of each path device passed on the transmission path where the first response frame is indirectly transmitted to the first device; a target transmission path for the first response frame to be indirectly transmitted from the second device to the first device is determined based on a transmission count parameter matching the first response frame; the data to be sent is transmitted to the second device based on the target transmission path; by adopting the above technical solution, problems such as the inability to directly communicate after a device transmission failure, the complexity of the routing process for indirect communication, and low accuracy are solved. Description of the Drawings
[0018] The accompanying drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with this application, and are used together with the specification to explain the principles of this application.
[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0020] Figure 1 is a schematic diagram of the hardware environment of a data transmission method according to an embodiment of this application;
[0021] Figure 2 is a flowchart of a data transmission method according to an embodiment of this application;
[0022] Figure 3 is a schematic diagram of a data transmission method according to an embodiment of this application;
[0023] Figure 4 is a flowchart of a data transmission method according to an optional embodiment of this application;
[0024] Figure 5 is a structural block diagram of a data transmission device according to an embodiment of this application. Detailed implementation manners
[0025] To enable those skilled in the art of this technology to better understand the solutions of this application, the following will clearly and completely describe the technical solutions in the embodiments of this application in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts should fall within the scope of protection of this application.
[0026] It should be noted that the terms "first", "second", etc. in the specification, claims, and the above accompanying drawings of this application are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances, so that the embodiments of this application described here can be implemented in an order different from those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0027] According to one aspect of the embodiments of the present application, a data transmission method is provided. This data transmission method is widely applied to whole-house intelligent digital control application scenarios such as Smart Home, smart home, intelligent home device ecosystem, Intelligence House ecosystem, etc. Optionally, in this embodiment, the above data transmission method can be applied to, for example, Figure 1 the hardware environment composed of the terminal device 102 and the server 104 as shown. As Figure 1 shown, the server 104 is connected to the terminal device 102 through a network, and can be used to provide services (such as application services, etc.) for the terminal or the client installed on the terminal. A database can be set on the server or independently of the server to provide data storage services for the server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data operation services for the server 104.
[0028] The above network can include but is not limited to at least one of the following: wired network, wireless network. The above wired network can include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network. The above wireless network can include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal device 102 is not limited to being a PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projection device, smart TV, smart drying rack, smart curtain, smart audio and video, smart socket, smart speaker, smart sound box, smart fresh air device, smart kitchen and bathroom equipment, smart bathroom equipment, smart floor sweeping robot, smart window cleaning robot, smart mopping robot, smart air purification device, smart steam box, smart microwave oven, smart kitchen water heater, smart purifier, smart water dispenser, smart door lock, etc.
[0029] In this embodiment, a data transmission method is provided, which is applied to the first device. It should be noted that the above first device can be the above terminal device 102. Figure 2 is a flowchart of the data transmission method according to the embodiments of the present application. The process includes the following steps:
[0030] Step S202, when the data transmission between the first device and the second device reaches the retransmission condition, broadcast a first detection frame to devices in the device cluster where the first device is located except the second device, where the first detection frame carries the first identification information of the first device and the second identification information of the second device;
[0031] It should be noted that the above-mentioned second device is not limited to a PC, a mobile phone, a tablet computer, a smart air conditioner, etc.
[0032] The above-mentioned first device and the above-mentioned second device are located in the same wireless mesh network, and the above-mentioned first device and any device in the device cluster are located in the same wireless mesh network; when the data transmission between the first device and the second device reaches the retransmission condition, the above-mentioned first device sends a request message to the root node device in the above-mentioned wireless mesh network, where the above-mentioned request message is used to request to obtain a detection sequence number; receive the response message sent by the above-mentioned root node device to obtain the detection sequence number of the above-mentioned first detection frame.
[0033] Before broadcasting the first detection frame to devices in the device cluster where the above-mentioned first device is located except the above-mentioned second device, it further includes: writing the first identification information of the above-mentioned first device, the second identification information of the above-mentioned second device, and the detection sequence number of the above-mentioned first detection frame into the above-mentioned first detection frame.
[0034] Step S204, receive a first response frame corresponding to the first detection frame, where the first response frame carries transmission path information of the first detection frame, and the transmission path information is used to indicate address information of each path device passed through on the transmission path where the first response frame is indirectly transmitted to the first device;
[0035] It should be noted that when the second device receives the first detection frame forwarded by other devices in the device cluster, the second device sends a first response frame, where the first response frame includes: the address information of the second device, and sets the transmission count parameter of the first response frame to 0; when other devices in the device cluster receive the first response frame, determine whether the transmission count parameter of the first response frame is greater than a preset threshold; when other devices determine that the transmission count parameter of the first response frame is less than or equal to the preset threshold, write the address information of the other device into the first response frame, increment the transmission count parameter of the first response frame by one, and broadcast the updated first response frame until the first device receives the first response frame.
[0036] Step S206, based on the transmission count parameter matching the first response frame, determine the target transmission path for the first response frame to be indirectly transmitted from the second device to the first device;
[0037] Specifically, when the first device receives multiple first response frames, each time it receives a first response frame, if the count of the transmission count parameter of the received first response frame is smaller than the count of the previously recorded transmission count parameter, update the address information list, and thus the target transmission path can be obtained.
[0038] Step S208, transmit the data to be sent to the second device based on the target transmission path.
[0039] Since the target transmission path is the transmission path of the first response frame sent by the second device to the first device, the first device can transmit the data to be sent to the second device through the target transmission path.
[0040] Through the above steps, when the data transmission between the first device and the second device reaches the retransmission condition, broadcast a first detection frame to devices in the device cluster where the first device is located except the second device, where the first detection frame carries the first identification information of the first device and the second identification information of the second device; receive a first response frame corresponding to the first detection frame, where the first response frame carries the transmission path information of the first detection frame, and the transmission path information is used to indicate the address information of each path device passed on the transmission path where the first response frame is indirectly transmitted to the first device; determine the target transmission path of the first response frame indirectly transmitted from the second device to the first device based on the transmission count parameter matching the first response frame; transmit the data to be sent to the second device based on the target transmission path, which solves the problems in the related art that after a device transmission failure, direct communication is impossible, the path finding process for indirect communication is relatively complex, and the accuracy is relatively low.
[0041] In an exemplary embodiment, before step S202, the following steps need to be further executed:
[0042] Step 11: Determine the data packet loss rate and the number of transmissions corresponding to the transmission of the data to be sent from the first device to the second device;
[0043] Step 12: Determine whether the data transmission between the first device and the second device reaches the retransmission condition according to the data packet loss rate and the number of transmissions.
[0044] Specifically, the above step 1 can be determined by one of the following methods:
[0045] Obtain the data packet loss rate corresponding to the transmission of the data to be sent by the first device through the standard file node interface of linux or android; encapsulate the sequence number in the management frame of the data packet, and calculate the data packet loss rate corresponding to the transmission of the data to be sent by the first device according to the sequence number, where the data packet carries the data to be sent.
[0046] For example, in the case where the first device transmits the data to be sent to the second device for the first time, the sequence number of the data packet is 1; in the case where the first device transmits the data to be sent to the second device for the second time, the sequence number of the data packet is 2, and so on; determine the number of times the response data of the second device is received, and determine the data packet loss rate corresponding to the data transmitted by the first device according to the number of times the response data is received and the number of times the data transmitted by the first device.
[0047] Specifically, the above step 2 can be determined in the following manner:
[0048] 1 - p t > P m , where p is the packet loss rate, t represents the number of retry times, and P m is the preset success rate.
[0049] After each time the first device sends the data to be sent, determine the data packet loss rate corresponding to the data transmitted by the first device and the number of transmissions of the data transmitted by the first device; substitute the packet loss rate and the number of transmissions into the above formula. If the above formula holds, determine that the data transmission between the first device and the second device reaches the retransmission condition; if the above formula does not hold, determine that the data transmission between the first device and the second device does not reach the retransmission condition.
[0050] Optionally, the above step S206 and the above step S208 further include: receiving the first first response frame and starting a timer, where the timing duration of the timer has a corresponding relationship with the maximum number of devices allowed to be directly connected to the first device; receiving first response frames transmitted through multiple transmission paths within the timing duration, where each first response frame corresponds to a different transmission path; determining the minimum transmission path among the multiple transmission paths and determining the minimum transmission path as the target transmission path, where the minimum transmission path is used to indicate the path with the least number of each path device passed through on the transmission path where the first response frame is indirectly transmitted to the first device; writing the target transmission path and the data to be sent into a data frame, and sending the data frame to the second device through the target transmission path.
[0051] It can be understood that after the first device receives the first first response frame, a timer is started, where the timing duration of the timer has a corresponding relationship with the maximum number of devices allowed to be directly connected to the first device; the response frames received after the timing duration expires are directly discarded. Before the timing duration expires, each time a response frame is received, if the count of the transmission count parameter of the received first response frame is smaller than the count of the previously recorded transmission count parameter, the address information list is updated, and thus the target transmission path can be obtained.
[0052] It should be noted that the timing duration of the timer is determined in the following manner: determine the maximum number of devices allowed for the direct connection of the first device, calculate the product of the maximum number of devices and a preset value, and determine that the product is the timing duration.
[0053] Optionally, the above first device may also receive a probe frame sent by other devices in the device cluster. In the case where the first device receives a second probe frame sent by a third device, the first device may further perform the following steps:
[0054] Step 21: Determine the probe sequence number and the first frame type of the second probe frame, and determine the third identification information carried in the second probe frame, where the third device is to send data to the device corresponding to the third identification information;
[0055] Step 22: Determine the first comparison result between the probe sequence number and the probe sequence number recorded by the first device, the second comparison result between the first frame type and the frame type recorded by the first device, and determine the third comparison result between the third identification information and the first identification information;
[0056] Step 23: Determine the processing method for the second probe frame according to the first comparison result, the second comparison result, and the third comparison result.
[0057] It can be understood that the second probe frame sent by the above third device carries: the probe sequence number of the second probe frame, the frame type of the second probe frame, and the third identification information; in the case where the first device receives the second probe frame, determine whether the first device has received the second probe frame according to the above first comparison result, second comparison result, and third comparison result, and whether the target address information of the second probe frame is the first device, and determine the processing method for the second probe frame according to whether the first device has received the second probe frame and whether the target address information of the second probe frame is the first device.
[0058] It should be noted that in the case where the first device receives a probe frame, the received probe frame will be recorded to avoid repeated processing of the same probe frame.
[0059] Specifically, it includes the following three cases:
[0060] 1) In the case where the first comparison result indicates that the probe sequence number is consistent with the probe sequence number recorded by the first device, and the second comparison result indicates that the first frame type is consistent with the frame type recorded by the first device, discard the second probe frame;
[0061] It can be understood that when the first comparison result indicates that the detection serial number is consistent with the detection serial number recorded by the first device, and the second comparison result indicates that the first frame type is consistent with the frame type recorded by the first device, it means that the first device has received and processed the second detection frame. At this time, the second detection frame is directly discarded.
[0062] 2) In the case where the first result occurs and the second result occurs, respond to the second detection frame, where the first result includes: the third comparison result indicates that the third identification information is consistent with the first identification information; the second result includes at least one of the following: the first comparison result indicates that the detection serial number is inconsistent with the detection serial number recorded by the first device, and the second comparison result indicates that the first frame type is inconsistent with the frame type recorded by the first device.
[0063] It can be understood that when the third comparison result indicates that the third identification information is consistent with the first identification information, it means that the third device needs to determine the transmission path for the third device to transmit data to the first device; when the first comparison result indicates that the detection serial number is inconsistent with the detection serial number recorded by the first device, and / or the second comparison result indicates that the first frame type is inconsistent with the frame type recorded by the first device, it means that the first device has not received the second detection frame. Therefore, respond to the second detection frame.
[0064] 3) In the case where the third result occurs and the second result occurs, forward the second detection frame, where the third result includes: the third comparison result indicates that the third identification information is inconsistent with the first identification information.
[0065] It can be understood that when the third comparison result indicates that the third identification information is consistent with the first identification information, it means that the third device needs to determine the transmission path for the third device to transmit data to other devices, and the first device needs to forward the detection frame; when the first comparison result indicates that the detection serial number is inconsistent with the detection serial number recorded by the first device, and / or the second comparison result indicates that the first frame type is inconsistent with the frame type recorded by the first device, it means that the first device has not received the second detection frame. Therefore, forward the second detection frame.
[0066] Optionally, the above first device may also receive a response frame sent by other devices in the device cluster. For example, when the first device receives a second response frame sent by a fourth device, the first device may further perform the following steps:
[0067] Step 31: Determine the transmission count parameter of the second response frame;
[0068] Step 32: Determine the fourth comparison result between the transmission count parameter of the second response frame and a preset threshold;
[0069] Step 33: Determine the processing method for the second response frame according to the fourth comparison result.
[0070] It can be understood that the second response frame sent by the above-mentioned fourth device carries: the transmission count parameter of the second response frame; when the first device receives the second response frame, the processing method for the second response frame is determined according to the fourth comparison result between the transmission count parameter of the second response frame and a preset threshold.
[0071] Specifically:
[0072] 1) When the fourth comparison result indicates that the transmission count parameter of the second response frame is less than the preset threshold, write the address information of the first device in the target field of the second response frame, and add a preset value to the transmission count parameter of the second response frame, where the target field is used to indicate the transmission path of the second response frame;
[0073] It can be understood that if the transmission count parameter of the second response frame is less than the preset threshold, write the address information (such as the MAC address) of the first device in the target field of the second response frame, and add a preset value (such as 1, 2, etc.) to the value of the transmission count parameter.
[0074] 2) When the fourth comparison result indicates that the transmission count parameter of the second response frame is greater than or equal to the preset threshold, discard the second response frame.
[0075] It can be understood that if the transmission count parameter of the second response frame is greater than or equal to the preset threshold, in order to avoid too long transmission path, the second response frame is discarded.
[0076] Optionally, the above-mentioned first device may also receive response frames sent by other devices in the device cluster. For example, when the first device receives the second response frame sent by the fourth device, the first device may also perform the following steps:
[0077] Step 41: Determine the transmission count parameter of the second response frame and the response sequence number of the second response frame;
[0078] Step 42: Determine the fourth comparison result between the transmission count parameter of the second response frame and a preset threshold, and the fifth comparison result between the response sequence number of the second response frame and the response sequence number recorded by the first device;
[0079] Step 43: Determine the processing method for the second response frame according to the fourth comparison result and the fifth comparison result.
[0080] Specifically:
[0081] 1) When the fourth comparison result indicates that the transmission count parameter of the second response frame is less than the preset threshold, and the fifth comparison result indicates that the response sequence number of the second response frame is inconsistent with the response sequence number recorded by the first device, write the address information of the first device into the target field in the second response frame, and add a preset value to the transmission count parameter of the second response frame, where the target field is used to indicate the transmission path of the second response frame;
[0082] 2) When the fourth comparison result indicates that the transmission count parameter of the second response frame is greater than or equal to the preset threshold, and the fifth comparison result indicates that the response sequence number of the second response frame is inconsistent with the response sequence number recorded by the first device, discard the second response frame;
[0083] 3) When the fourth comparison result indicates that the transmission count parameter of the second response frame is greater than or equal to the preset threshold, and the fifth comparison result indicates that the response sequence number of the second response frame is consistent with the response sequence number recorded by the first device, discard the second response frame.
[0084] To better understand the process of the above data transmission method, the following further illustrates the implementation method flow of the above data transmission in combination with optional embodiments, but it is not used to limit the technical solutions of the embodiments of the present application.
[0085] In this embodiment, a data transmission method is provided. Figure 3 It is a schematic diagram of the data transmission method according to the embodiment of the present application. As Figure 3 shown, Node 1 (equivalent to the first device in the above embodiment) cannot communicate with Node 3 (equivalent to the second device in the above embodiment), resulting in a connection disconnection. At this time, it is necessary to find the transmission path of Node 1 → Node 2 → Node 3.
[0086] Figure 4 It is a flowchart of the data transmission method according to an optional embodiment of the present application. By Figure 4 the method in, determine the transmission path of Node 1 → Node 2 → Node 3. As Figure 4 shown, the specific steps are as follows:
[0087] Step S401: Node 1 repeatedly sends data to Node 3 t times;
[0088] Step S402: Node 1 sends a probe frame when the data transmission between Node 1 and Node 3 reaches the retransmission condition.
[0089] It should be noted that the data transmission between the node 1 and the node 3 is determined whether to reach the retransmission condition by the following method:
[0090] In the formula: 1 - p t > P m When it is satisfied, it is determined that the data transmission between the node 1 and the node 3 reaches the retransmission condition; otherwise, it is determined that the data transmission between the node 1 and the node 3 does not reach the retransmission condition, where p is the packet loss rate, t represents the number of retransmissions or the number of receiving nodes (the number of MACs of the specified receiving nodes in the packet), and P m is the preset success rate.
[0091] It should be noted that the packet loss rate is determined by one of the following methods: obtaining the packet loss rate through the standard file node interface of linux or android; encapsulating the sending sequence number in the management frame and calculating the packet loss rate according to the sending sequence number.
[0092] It should be noted that the probe frame includes: the unique network identifier of the node 1 and the unique network identifier of the node 3 (for example, MAC address), the sequence number of the probe frame, the frame type of the probe frame, the sequence number of the probe frame is requested by the node 1 from the root node device in the wireless mesh network, and the frame type is the broadcast request type;
[0093] Step S403: After any node receives the probe frame, determine the first comparison result between the probe sequence number and the probe sequence number recorded by the any node, the second comparison result between the frame type and the frame type recorded by the any node, and determine the third comparison result between the unique network identifier and the unique network identifier of the any node;
[0094] Step S404: Determine the processing method for the probe frame according to the first comparison result, the second comparison result and the third comparison result;
[0095] Specifically, when the first comparison result indicates that the probe sequence number is consistent with the recorded probe sequence number, and the second comparison result indicates that the frame type is consistent with the recorded frame type, the probe frame is discarded;
[0096] When the first result occurs and the second result occurs, respond to the probe frame, where the first result includes: the third comparison result indicates that the unique network identifier is consistent with the unique network identifier of the any node; the second result includes at least one of the following: the first comparison result indicates that the probe sequence number is inconsistent with the recorded probe sequence number, the second comparison result indicates that the frame type is inconsistent with the recorded frame type;
[0097] In the case where the third result occurs and the second result occurs, forward the second detection frame, where the third result includes: the third comparison result indicates that the unique network identifier is inconsistent with the unique network identifier of any node.
[0098] Step S405: In the case of determining to respond to the detection frame, write the MAC address of any node, the response sequence number of the response frame, and the value of the count field of the response frame in the response frame;
[0099] At this time, the value of the count field of the response frame is 0;
[0100] It should be noted that the maximum value of the count field is the maximum value of the number of directly connected devices. The response sequence number of the response frame is the same as the detection sequence number of the detection frame.
[0101] Step S406: In the case where any node receives the response frame, determine the fourth comparison result between the value of the count field of the response frame and the preset threshold, and the fifth comparison result between the response sequence number of the response frame and the response sequence number recorded by any node;
[0102] Step S407: Determine the processing method for the second response frame according to the fourth comparison result and the fifth comparison result;
[0103] Specifically:
[0104] 1) In the case where the fourth comparison result indicates that the value of the count field of the response frame is less than the preset threshold, and the fifth comparison result indicates that the response sequence number of the response frame is inconsistent with the response sequence number recorded by any node, write the address information of any node in the target field of the response frame, and add a preset value to the value of the count field of the response frame, where the target field is used to indicate the transmission path of the response frame;
[0105] 2) In the case where the fourth comparison result indicates that the value of the count field of the response frame is greater than or equal to the preset threshold, and the fifth comparison result indicates that the response sequence number of the response frame is inconsistent with the response sequence number recorded by any node, discard the response frame;
[0106] 3) In the case where the fourth comparison result indicates that the value of the count field of the response frame is greater than or equal to the preset threshold, and the fifth comparison result indicates that the response sequence number of the response frame is consistent with the response sequence number recorded by any node, discard the response frame.
[0107] Step S408: In the case where Node 1 receives the response frame, start a timer, and the timeout is the maximum value of the number of directly connected devices multiplied by 1 second;
[0108] Step S409: Determine if a timeout has occurred;
[0109] Step S410: The response frame received after the timeout is discarded directly.
[0110] Step S411: If there is no timeout, after each response frame is received, if the value of the count field of the received response frame is smaller than the value of the count field recorded previously, the address information list is updated, and the minimum transmission path can be obtained.
[0111] After obtaining the minimum transmission path, node 1 sends a relay frame, which includes the data to be sent and a list of MAC addresses. The relay frame is sent unicast. Upon receiving the packet, the node compares its own MAC address with the MAC address list and ensures that the sequence number is not equal to the original sequence number. If the match is found, the node broadcasts the packet once and records the sequence number of that relay packet.
[0112] The above embodiments solve the problems in the related technologies, such as the inability to communicate directly after a device transmission failure, the complexity of the pathfinding process for indirect communication, and the low accuracy.
[0113] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0114] Figure 5 This is a structural block diagram of a data transmission apparatus according to an embodiment of this application; as shown below. Figure 5 As shown, it includes:
[0115] The broadcast module 52 is used to broadcast a first probe frame to devices in the device cluster where the first device is located, excluding the second device, when the data transmission between the first device and the second device reaches the retransmission condition. The first probe frame carries the first identification information of the first device and the second identification information of the second device.
[0116] The receiving module 54 is used to receive a first response frame corresponding to the first probe frame, wherein the first response frame carries the transmission path information of the first probe frame, and the transmission path information is used to indicate the address information of each path device passed through on the transmission path through which the first response frame is indirectly transmitted to the first device.
[0117] The determining module 56 is used to determine the target transmission path from the second device to the first device based on the transmission count parameters that match the first response frame;
[0118] The transmission module 58 is used to transmit the data to be sent to the second device based on the target transmission path.
[0119] Using the above-described apparatus, when the data transmission between the first device and the second device reaches the retransmission condition, a first probe frame is broadcast to all devices in the device cluster where the first device is located, excluding the second device. The first probe frame carries first identification information of the first device and second identification information of the second device. A first response frame corresponding to the first probe frame is received. The first response frame carries transmission path information of the first probe frame, which indicates the address information of each path device along the transmission path through which the first response frame is indirectly transmitted to the first device. Based on the transmission count parameter matching the first response frame, the target transmission path through which the first response frame is indirectly transmitted from the second device to the first device is determined. Data to be sent is transmitted to the second device based on the target transmission path. This solves the problems in related technologies, such as the inability to communicate directly after a device transmission failure, the complexity of the pathfinding process for indirect communication, and low accuracy.
[0120] In an exemplary embodiment, the determining module 56 is configured to determine the data packet loss rate and the number of transmissions corresponding to the transmission of the data to be sent from the first device to the second device; and determine whether the data transmission between the first device and the second device meets the retransmission condition based on the data packet loss rate and the number of transmissions.
[0121] In an exemplary embodiment, the receiving module 54 is configured to receive a first response frame and start a timer, wherein the duration of the timer corresponds to the maximum number of devices that the first device is allowed to directly connect to; and within the duration of the timer, receive first response frames transmitted through multiple transmission paths, wherein each first response frame corresponds to a different transmission path.
[0122] In one exemplary embodiment, the transmission module 58 is configured to determine the minimum transmission path among the plurality of transmission paths, and determine the minimum transmission path as the target transmission path, wherein the minimum transmission path is used to indicate the path through which the first response frame is indirectly transmitted to the first device via the fewest path devices; write the target transmission path and the data to be sent into a data frame, and send the data frame to the second device through the target transmission path.
[0123] In an exemplary embodiment, the determining module 56 is configured to, upon receiving a second probe frame sent by a third device, determine the probe sequence number and first frame type of the second probe frame, and determine the third identification information carried in the second probe frame, wherein the third device is to send data to the device corresponding to the third identification information; determine a first comparison result between the probe sequence number and the probe sequence number recorded by the first device, a second comparison result between the first frame type and the frame type recorded by the first device, and a third comparison result between the third identification information and the first identification information; and determine a processing method for the second probe frame based on the first comparison result, the second comparison result, and the third comparison result.
[0124] In an exemplary embodiment, the determining module 56 is configured to perform one of the following: discarding the second probe frame when the first comparison result indicates that the probe sequence number is consistent with the probe sequence number recorded by the first device, and the second comparison result indicates that the first frame type is consistent with the frame type recorded by the first device; responding to the second probe frame when a first result occurs and a second result occurs, wherein the first result includes: the third comparison result indicates that the third identification information is consistent with the first identification information; the second result includes at least one of the following: the first comparison result indicates that the probe sequence number is inconsistent with the probe sequence number recorded by the first device, and the second comparison result indicates that the first frame type is inconsistent with the frame type recorded by the first device; forwarding the second probe frame when a third result occurs and a second result occurs, wherein the third result includes: the third comparison result indicates that the third identification information is inconsistent with the first identification information.
[0125] In an exemplary embodiment, the determining module 56 is configured to, upon receiving a second response frame sent by a fourth device, determine a transmission count parameter of the second response frame; determine a fourth comparison result between the transmission count parameter of the second response frame and a preset threshold; and determine a processing method for the second response frame based on the fourth comparison result.
[0126] In one exemplary embodiment, the determining module 56 is configured to perform one of the following: if the fourth comparison result indicates that the transmission count parameter of the second response frame is less than the preset threshold, write the address information of the first device into the target field of the second response frame, and add a preset value to the transmission count parameter of the second response frame, wherein the target field is used to indicate the transmission path of the second response frame; if the fourth comparison result indicates that the transmission count parameter of the second response frame is greater than or equal to the preset threshold, discard the second response frame.
[0127] Embodiments of this application also provide a storage medium including a stored program, wherein the program executes any of the methods described above when it is run.
[0128] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:
[0129] S1, when the data transmission between the first device and the second device reaches the retransmission condition, a first probe frame is broadcast to all devices in the device cluster where the first device is located except for the second device. The first probe frame carries the first identification information of the first device and the second identification information of the second device.
[0130] S2, receive a first response frame corresponding to the first probe frame, wherein the first response frame carries transmission path information of the first probe frame, and the transmission path information is used to indicate the address information of each path device that the first response frame passes through on the transmission path that is indirectly transmitted to the first device.
[0131] S3, based on the transmission count parameters that match the first response frame, determine the target transmission path from the second device to the first device indirectly transmitted from the second device;
[0132] S4, transmit the data to be sent to the second device based on the target transmission path.
[0133] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0134] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0135] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0136] S1, when the data transmission between the first device and the second device reaches the retransmission condition, a first probe frame is broadcast to all devices in the device cluster where the first device is located except for the second device. The first probe frame carries the first identification information of the first device and the second identification information of the second device.
[0137] S2, receive a first response frame corresponding to the first probe frame, wherein the first response frame carries transmission path information of the first probe frame, and the transmission path information is used to indicate the address information of each path device that the first response frame passes through on the transmission path that is indirectly transmitted to the first device.
[0138] S3, based on the transmission count parameters that match the first response frame, determine the target transmission path from the second device to the first device indirectly transmitted from the second device;
[0139] S4, transmit the data to be sent to the second device based on the target transmission path.
[0140] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0141] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0142] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0143] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A data transmission method, characterized in that, Applied to the first device, including: When the data transmission between the first device and the second device reaches the retransmission condition, a first probe frame is broadcast to all devices in the device cluster where the first device is located, excluding the second device. The first probe frame carries the first identification information of the first device and the second identification information of the second device. Receive a first response frame corresponding to the first probe frame, wherein the first response frame carries transmission path information of the first probe frame, and the transmission path information is used to indicate the address information of each path device traversed on the transmission path through which the first response frame is indirectly transmitted to the first device. Based on the transmission count parameters that match the first response frame, the target transmission path from the second device to the first device is determined. Data to be sent is transmitted to the second device based on the target transmission path; The method further includes: Upon receiving a second response frame sent by a fourth device, determine the transmission count parameter of the second response frame and the response sequence number of the second response frame; The fourth comparison result between the transmission count parameter of the second response frame and the preset threshold is determined, and the fifth comparison result between the response sequence number of the second response frame and the response sequence number recorded by the first device is determined. The processing method for the second response frame is determined based on the fourth comparison result and the fifth comparison result.
2. The data transmission method according to claim 1, characterized in that, Before broadcasting the first probe frame to devices in the device cluster where the first device resides, excluding the second device, the process also includes: Determine the packet loss rate and number of transmissions corresponding to the data to be sent from the first device to the second device; Based on the data packet loss rate and the number of transmissions, it is determined whether the data transmission between the first device and the second device meets the retransmission condition.
3. The data transmission method according to claim 1, characterized in that, Receiving a first response frame corresponding to the first probe frame includes: Receive the first response frame and start a timer, wherein the duration of the timer corresponds to the maximum number of devices that the first device is allowed to connect directly; Within the specified timing period, first response frames transmitted through multiple transmission paths are received, wherein each first response frame corresponds to a different transmission path.
4. The data transmission method according to claim 3, characterized in that, Transmitting the data to be sent to the second device based on the target transmission path includes: Among the plurality of transmission paths, a minimum transmission path is determined, and the minimum transmission path is determined as the target transmission path, wherein the minimum transmission path is used to indicate the path through which the first response frame is indirectly transmitted to the first device via the fewest path devices. The target transmission path and the data to be sent are written into a data frame, and the data frame is sent to the second device through the target transmission path.
5. The data transmission method according to claim 1, characterized in that, The method further includes: Upon receiving a second probe frame sent by a third device, the probe sequence number and first frame type of the second probe frame are determined, as well as the third identification information carried in the second probe frame, wherein the third device is to send data to the device corresponding to the third identification information; The system determines a first comparison result between the detection sequence number and the detection sequence number recorded by the first device, a second comparison result between the first frame type and the frame type recorded by the first device, and a third comparison result between the third identification information and the first identification information. The processing method for the second detection frame is determined based on the first comparison result, the second comparison result, and the third comparison result.
6. The data transmission method according to claim 5, characterized in that, The processing method for the second detection frame is determined based on the first comparison result, the second comparison result, and the third comparison result, including one of the following: If the first comparison result indicates that the detection sequence number is consistent with the detection sequence number recorded by the first device, and the second comparison result indicates that the first frame type is consistent with the frame type recorded by the first device, then the second detection frame is discarded. In the event of the first result and the second result, a response is made to the second probe frame, wherein the first result includes: the third comparison result indicates that the third identification information is consistent with the first identification information; the second result includes at least one of the following: the first comparison result indicates that the probe sequence number is inconsistent with the probe sequence number recorded by the first device, and the second comparison result indicates that the first frame type is inconsistent with the frame type recorded by the first device; If the third result occurs and the second result occurs, the second probe frame is forwarded, wherein the third result includes: the third comparison result indicates that the third identification information is inconsistent with the first identification information.
7. The data transmission method according to claim 1, characterized in that, The method further includes: Upon receiving a second response frame sent by a fourth device, determine the transmission count parameter of the second response frame; Determine the fourth comparison result between the transmission count parameter of the second response frame and the preset threshold; The processing method for the second response frame is determined based on the fourth comparison result.
8. The data transmission method according to claim 7, characterized in that, The processing method for the second response frame is determined based on the fourth comparison result, including: If the fourth comparison result indicates that the transmission count parameter of the second response frame is less than the preset threshold, the address information of the first device is written into the target field of the second response frame, and the transmission count parameter of the second response frame is added to the preset value, wherein the target field is used to indicate the transmission path of the second response frame; If the fourth comparison result indicates that the transmission count parameter of the second response frame is greater than or equal to the preset threshold, the second response frame is discarded.
9. A data transmission device, characterized in that, Applied to the first device, including: The broadcast module is used to broadcast a first probe frame to devices in the device cluster where the first device is located, excluding the second device, when the data transmission between the first device and the second device reaches the retransmission condition. The first probe frame carries the first identification information of the first device and the second identification information of the second device. The receiving module is configured to receive a first response frame corresponding to the first probe frame, wherein the first response frame carries transmission path information of the first probe frame, and the transmission path information is used to indicate the address information of each path device traversed on the transmission path through which the first response frame is indirectly transmitted to the first device. The determining module is used to determine the target transmission path from the second device to the first device based on the transmission count parameters that match the first response frame; The transmission module is used to transmit the data to be sent to the second device based on the target transmission path; The determining module is further configured to, upon receiving a second response frame sent by a fourth device, determine the transmission count parameter of the second response frame and the response sequence number of the second response frame; determine a fourth comparison result between the transmission count parameter of the second response frame and a preset threshold, and a fifth comparison result between the response sequence number of the second response frame and the response sequence number recorded by the first device; and determine the processing method for the second response frame based on the fourth comparison result and the fifth comparison result.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method according to any one of claims 1 to 8.
11. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 8 through the computer program.