Block data parallel distribution method, device, computer equipment and storage medium
By dividing the data into slices for parallel transmission, it solves the time lag and delay problems when multiple 2.4GHz sub-devices transmit large volumes of data, improves transmission efficiency and reduces power consumption, and achieves faster data transmission and processing.
Patent Information
- Application Number
- CN202210405197.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-18
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2042-04-18
AI Technical Summary
In the fields of motion capture, sports rehabilitation and medical Internet of Things, multiple 2.4GHz sub-devices have time lags and delays when transmitting large blocks of data. The traditional blocking transmission method is inefficient and cannot effectively solve the waiting time when multiple devices transmit at the same time. question.
The block data parallel delivery method is used to divide the data into multiple fragments. The fragmented data is sent between the terminal and the sub-device through multicast state, and the next sub-device is polled immediately after receiving the verification result to avoid The non-transmission time loss of individual sub-devices enables parallel transmission.
Through the parallel transmission method, the overall cycle extension caused by the delay of individual sub-devices in the traditional transmission process is avoided, the data transmission efficiency is improved, the power consumption is reduced, and faster data transmission and processing are achieved.
Smart Images

Figure CN114760659B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of motion capture and data transmission, and in particular to a method, device, computer equipment and storage medium for parallel sending of block data. Background Art
[0002] In the fields of motion capture, sports rehabilitation, and medical Internet of Things, various sub-devices used in the above fields do not integrate complex protocols such as Bluetooth and WiFi internally, but use 2.4GHz point-to-point communication instead for the purpose of low power consumption and design cost.
[0003] If you need to transfer large blocks of data such as device firmware, files, pictures, etc. to multiple 2.4GHz sub-devices, since some data will be processed and stored internally by the device with time lags and delays, you can consider whether you can use parallel methods to transfer data to multiple devices at the same time to avoid unnecessary waiting caused by a single transmission. Summary of the invention
[0004] The object of the present invention is to provide a method, device, computer equipment and storage medium for parallel sending of block data.
[0005] To achieve the above purpose, the technical solution provided by the present invention is:
[0006] In a first aspect, a method for parallel sending of block data is provided, which is applied to data transmission between multiple sub-devices and a terminal, and includes the following steps:
[0007] Step 1: The terminal generates a block data sending request, and the child device Dev n When actively uploading heartbeat data to the terminal device regularly, the terminal will update the heartbeat reply to a block data sending request and send it to the child device;
[0008] Step 2, after ensuring that all sub-devices enter the multicast state, the terminal switches to the sending mode to enter the multicast state;
[0009] Step 3: The terminal sends the data to the sub-device Dev according to the order. n Send shard data Dev n Data k(n) When the terminal finishes sending the fragmented data, it needs to switch to the receiving mode and briefly last for RTimeOut to receive the child device Dev n The reply fragment data verification result Dev n Ack k(n) ;
[0010] Step 4, Sub-device Dev nCompare the fragment sequence number FragNum in the fragmented data with its own sequence number CurNum to determine whether they are consistent. At the same time, verify whether the checksum is correct, and check whether it is ready to write the fragmented data to the ROM. If all conditions are met, the sub-device Dev n needs to immediately switch to the sending mode to reply with the fragmented data verification result;
[0011] Step 5, when the terminal receives the fragmented data verification result from Dev n within the RTimeOut time, or when the RTimeOut time ends, it will switch back to the sending mode to perform the fragmented data distribution operation on the next sub-device Dev n+1 where n + 1 < N, if n + 1 = N, then it is Dev0;
[0012] Step 6, when the terminal polls the sub-device Dev n again, perform different operations according to the previous distribution result of Dev n Data k(n) :
[0013] If the terminal does not receive a legal Dev n Ack k(n) before the RTimeOut ends, or the verification result is a failure, then re-distribute Dev n Data k(n) this time;
[0014] If the terminal receives a legal DevnAck k(n) before the RTimeOut ends, and the verification result is a success, then start to distribute Dev n Datak (n)+1 .
[0015] In the above-mentioned step 1, the terminal will record the signal strength RSSI n when the sub-device Dev n last uploaded data. At this time, the sub-device Dev n is considered to enter the multicast state;
[0016] If the sub-device Dev n does not receive any fragmented data of the block data for a continuous BLTime in the multicast state, it will return to the normal connection state.
[0017] In the above-mentioned step 2, the signal strengths of the last communication of each sub-device Dev n will also be arranged from high to low.
[0018] In the above-mentioned step 4, the sub-device Dev nAt the same time, prepare to write the shard data to ROM, and will immediately start writing the shard data to ROM when the shard data verification result is replied.
[0019] Repeat steps 3 to 6 until the Dev n Data k(n) Data Reply Dev n Ack k(n) , and then complete the ROM writing, at this time the sub-device Dev n Block data shard data write address:
[0020] WriteAddr n =StartAddr n +DataSize
[0021] Then the sub-device Dev n All shard data transmission is completed;
[0022] Similarly, the terminal sends the completion Dev n Data k(n) After receiving the data, the Dev n Ack k(n) , and at this time:
[0023] ReadAddr n =DataAddr+DataSize
[0024] The terminal considers the child device Dev n When all fragmented data transmission is completed, both ends simultaneously recognize that all fragmented data transmission is completed, and Dev n Block data transfer is completed, sub-device Dev n Will switch back to normal connection state.
[0025] Determine the block data transmission status of all sub-devices. If the block data transmission of all sub-devices is completed, it is determined that the parallel sending of block data is completed, and the terminal will switch back to the normal connection state.
[0026] In a second aspect, the present invention provides a block data parallel delivery system, characterized in that it is applied to data transmission between multiple sub-devices and a terminal, and includes:
[0027] The sending request module is used by the terminal to generate block data sending requests, and the sub-device Dev n When actively uploading heartbeat data to the terminal device regularly, the terminal will update the heartbeat reply to a block data sending request and send it to the child device;
[0028] A first switching module, configured to switch the terminal to a sending mode to enter a multicast state after ensuring that all sub-devices enter a multicast state;
[0029] A sending module, for the terminal to send fragmented data Dev to the sub-device Dev in sequence n When the terminal finishes sending the fragmented data, it needs to switch to the receiving mode and last for a short time of RTimeOut to receive the verification result of the fragmented data replied by the sub-device Dev n Data k(n) When the terminal finishes sending the fragmented data, it needs to switch to the receiving mode and last for a short time of RTimeOut to receive the verification result of the fragmented data replied by the sub-device Dev n Ack n Ack k(n) ;
[0030] A comparison module, for the sub-device Dev to compare the fragment sequence number FragNum in the fragmented data with its own sequence number CurNum to determine whether they are consistent, and at the same time verify whether the checksum is correct, and check whether it is ready to write the fragmented data to the ROM. If all conditions are met, the sub-device Dev needs to immediately switch to the sending mode to reply the verification result of the fragmented data; n A comparison module, for the sub-device Dev to compare the fragment sequence number FragNum in the fragmented data with its own sequence number CurNum to determine whether they are consistent, and at the same time verify whether the checksum is correct, and check whether it is ready to write the fragmented data to the ROM. If all conditions are met, the sub-device Dev needs to immediately switch to the sending mode to reply the verification result of the fragmented data; n A second switching module, for the terminal to switch back to the sending mode to perform the operation of sending fragmented data to the next sub-device Dev when receiving the verification result of the fragmented data within the RTimeOut time, or when the RTimeOut time ends, where n + 1 < N, if n + 1 = N, then it is Dev0;
[0031] A polling module, for when the terminal polls the sub-device Dev again, to perform different operations according to the previous sending result of Dev n A second switching module, for the terminal to switch back to the sending mode to perform the operation of sending fragmented data to the next sub-device Dev when receiving the verification result of the fragmented data within the RTimeOut time, or when the RTimeOut time ends, where n + 1 < N, if n + 1 = N, then it is Dev0; n+1 A polling module, for when the terminal polls the sub-device Dev again, to perform different operations according to the previous sending result of Dev
[0032] A polling module, for when the terminal polls the sub-device Dev again, to perform different operations according to the previous sending result of Dev n When the terminal polls the sub-device Dev again, to perform different operations according to the previous sending result of Dev n Datak (n) When the terminal polls the sub-device Dev again, to perform different operations according to the previous sending result of Dev
[0033] If the terminal does not receive a legal Ack from Dev before the end of RTimeOut, or the verification result is a failure, then re-send Dev n Ack k(n) If the terminal does not receive a legal Ack from Dev before the end of RTimeOut, or the verification result is a failure, then re-send Dev n Data k(n) ;
[0034] If the terminal receives a legal Ack from Dev before the end of RTimeOut, and the verification result is a success, then start to send Datak n Ack k(n) If the terminal receives a legal Ack from Dev before the end of RTimeOut, and the verification result is a success, then start to send Datak n Datak (n)+1 .
[0035] In the said sending request module, the terminal will record the signal strength RSSI when the sub-device Dev last uploaded data n In the said sending request module, the terminal will record the signal strength RSSI when the sub-device Dev last uploaded datan , at this time the child device Dev n It is considered to enter the multicast state;
[0036] If the sub-device Dev n If no block data fragmentation data is received for a continuous BLTime in the multicast state, the connection will return to the normal state.
[0037] In the first switching module, each sub-device Dev n The signal strength of the last communication is arranged from high to low.
[0038] In the comparison module, the sub-device Dev n At the same time, prepare to write the shard data to ROM, and will immediately start writing the shard data to ROM when the shard data verification result is replied.
[0039] Repeat the work of the sending module, the comparison module, the second switching module and the polling module in sequence until the Dev n Data k(n) Data Reply Dev n Ack k(n) , and then complete the ROM writing, at this time the sub-device Dev n Block data shard data write address:
[0040] WriteAddr n =StartAddr n +DataSize
[0041] Then the sub-device Dev n All shard data transmission is completed;
[0042] Similarly, the terminal sends the completion Dev n Data k(n) After receiving the data, the Dev n Ack k(n) , and at this time:
[0043] ReadAddr n =DataAddr+DataSize
[0044] The terminal considers the child device Dev n When all fragmented data transmission is completed, both ends simultaneously recognize that all fragmented data transmission is completed, and Dev n Block data transfer is completed, sub-device Dev n Will switch back to normal connection state.
[0045] Determine the block data transmission status of all sub-devices. If the block data transmission of all sub-devices is completed, it is determined that the parallel sending of block data is completed, and the terminal will switch back to the normal connection state.
[0046] In a third aspect, the present invention provides a computer device, comprising a storage medium and a processor connected to the storage medium, wherein the storage medium is used to store a computer program, and the processor executes a block data parallel delivery method when running the computer program.
[0047] In a fourth aspect, the present invention provides a storage medium, which is a readable storage medium and is used to store a computer program. When the computer program is executed by a processor, a method for parallel delivery of execution block data is performed.
[0048] Compared with the prior art, the block data parallel sending method, device, computer equipment and storage medium of the present invention divide the sent block data into multiple fragmented data, and the content of the fragmented data sent each time is different according to the different fragmentation stages of different sub-devices; if the sub-device advances the timing of verification and replying the verification result after receiving the fragmented data to avoid the blockage caused by data processing and storage, after the terminal sends and quickly obtains the verification reply from the sub-device each time, it immediately polls the next target sub-device to try to send the corresponding fragmented data to it, thereby avoiding the increase of the sending cycle and consumption of the entire block data sending process due to the non-transmission time loss of individual sub-devices.
[0049] The present invention will become more apparent from the following description taken in conjunction with the accompanying drawings, which are used to illustrate embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 Shown is a flow chart of the method for parallel sending of block data of the present invention.
[0051] Figure 2 Shown is a sub-flow chart of an embodiment of the present invention.
[0052] Figure 3 FIG. 2 is another sub-flow chart of an embodiment of the present invention.
[0053] Figure 4 FIG. 2 is another sub-flow chart of an embodiment of the present invention.
[0054] Figure 5 Shown is a schematic diagram of the structure of the block data parallel sending system of the present invention.
[0055] Figure 6 Shown is a schematic diagram of an embodiment of a computer device of the present invention. DETAILED DESCRIPTION
[0056] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0057] The components of the embodiments of the present invention generally described and shown in the drawings herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0058] Hereinafter, the terms "including", "having" and their cognates used in various embodiments of the present invention are intended only to indicate specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components or combinations of the foregoing items.
[0059] In addition, when the present invention involves the terms "first", "second", "third", etc., they are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.
[0060] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present invention belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present invention.
[0061] In the traditional point-to-point or point-to-point one-to-many communication scheme, if there is a need to send large blocks of data in batches, such as common firmware upgrades, device images or other data, it is done in a one-to-one blocking manner on a point-to-point basis. As we all know, most of the sub-end devices of point-to-point communication are built with low-power, low-cost storage solutions and microcontroller solutions, which will cause large delays in data processing speed and data writing speed. If the traditional blocking method is still used to wait for one of the sub-devices to complete the transmission before transmitting to the next device, it will have a great impact on the efficiency of the large-scale transmission of the block of data. Based on this, a parallel polling method is proposed to transmit all devices independently in turn to eliminate the impact of the above delay on the overall transmission.
[0062] The implementation principle of the present invention is as follows: the block data to be sent is divided into multiple fragmented data, and the content of the fragmented data sent each time is different according to the different fragmentation stages of different sub-devices; if the sub-device advances the timing of verification and replying the verification result after receiving the fragmented data to avoid the blockage caused by data processing and storage, after the terminal sends and quickly obtains the verification reply from the sub-device each time, it immediately polls the next target sub-device to try to send the corresponding fragmented data to it, thereby avoiding the increase of the sending cycle and consumption of the entire block data sending process due to the non-transmission time loss of individual sub-devices.
[0063] The implementation method of the present invention is a single antenna, and the maximum number of sub-devices connected to the terminal is set to N. In the normal connection state, the sub-device is used as a transmitting mode and the terminal device is used as a receiving mode.
[0064] The present invention will be described in detail below with reference to embodiments:
[0065] First, the terminal obtains or generates block data, and the block data is cached in the terminal RAM storage medium, the storage address is DataAddr, and the block data size is DataSize.
[0066] In one embodiment, a method for parallel sending of block data is provided, which is applied to data transmission between multiple sub-devices and a terminal, and includes the following steps:
[0067] S001, the terminal generates a block data sending request, the sub-device Dev n When actively uploading heartbeat data to the terminal device regularly, the terminal will update the heartbeat reply to a block data sending request and send it to the child device;
[0068] S002, after ensuring that all sub-devices enter the multicast state, the terminal switches to the sending mode to enter the multicast state;
[0069] S003, the terminal sends the sub-device Dev n Send shard data Dev n Data k(n) When the terminal finishes sending the fragmented data, it needs to switch to the receiving mode and briefly last for RTimeOut to receive the child device Dev n The reply fragment data verification result Dev n Ack k(n) ;
[0070] S004, sub-device Dev n Compare the fragment number FragNum in the fragment data with its own serial number CurNum to determine whether they are consistent, and verify whether the checksum is correct, and check whether it is ready to write the fragment data to ROM. If all the conditions are met, the child device Devn It is necessary to immediately switch to the sending mode to reply the sharded data verification result;
[0071] S005, when the terminal receives the sharded data verification result of Dev within the RTimeOut time, or at the end of the RTimeOut time, it will switch back to the sending mode to perform the sharded data distribution operation for the next sub-device Dev n where n + 1 < N, if n + 1 = N, then it is Dev0; n+1
[0072] S006, when the terminal polls the sub-device Dev again n at that time, different operations will be performed according to the previous distribution result of Dev n Data k(n) :
[0073] If the terminal does not receive a legal Dev n Ack k(n) before the end of RTimeOut, or the verification result is a failure, then Dev n Data k(n) will be re-distributed this time;
[0074] If the terminal receives a legal Dev n Ack k(n) before the end of RTimeOut, and the verification result is a success, then start to distribute Dev n Datak (n)+1 .
[0075] Reference Figure 2 , S0011, the terminal will record the signal strength RSSI n when the sub-device Dev last uploaded data, at this time the sub-device Dev n is considered to enter the multicast state; n
[0076] S0012, if the sub-device Dev n does not receive any block data sharded data for a continuous BLTime in the multicast state, it will return to the normal connection state.
[0077] Specifically, when the terminal generates a block data distribution request (including block data size DataSize, block data checksum Sum, sharded data single shard size FragSize, total number of shards of sharded data FragCnt, multicast state communication frequency point CH bd ), when the sub-device Dev n regularly uploads heartbeat data to the terminal device actively, the terminal will update the heartbeat reply to a block data distribution request and send it to the sub-device. The sub-device Dev n When receiving a block data sending request, it will switch to receiving mode and set the receiving frequency to CH bd In this round of communication, the terminal will record the sub-device Dev n Signal strength RSSI when uploading data for the last time n At this time, the child device n can be considered to have entered the multicast state. If the child device Dev n If no block data fragmentation data is received for a continuous BLTime in the multicast state, the connection will return to the normal state.
[0078] refer to Figure 3 , S002, after ensuring that all sub-devices enter the multicast state, the terminal switches to the sending mode to enter the multicast state;
[0079] S0021, each sub-device Dev n The signal strength of the last communication is arranged from high to low.
[0080] Specifically, after ensuring that all devices (for example, no heartbeat data of any child device is received within a unit time) enter the multicast state, the terminal switches to the sending mode to enter the multicast state, and the communication frequency is always CH bd , the signal strength of the last communication of each sub-device is arranged from high to low. Starting from the sub-device Dev0 with the highest signal strength value, to Dev N-1 Finish.
[0081] In order, send the sub-device Dev n Send shard data Dev n Data k(n) (including fragment data content, fragment data size, fragment sequence number, fragment data checksum), the moment the terminal completes sending, it needs to switch to receiving mode and briefly last for RTimeOut time to receive the child device Dev n The reply fragment data verification result Dev n Ack k(n) (including the fragment sequence number, verification result, and the processing result of the previous fragment data package).
[0082] refer to Figure 4 , S004, sub-device Dev n Compare the fragment number FragNum in the fragment data with its own serial number CurNum to determine whether they are consistent, and verify whether the checksum is correct, and check whether it is ready to write the fragment data to ROM. If all the conditions are met, the child device Dev n You need to switch to the sending mode immediately to reply the shard data verification result.
[0083] S0041 Sub-device Dev nAt the same time, prepare to write the shard data to ROM, and will immediately start writing the shard data to ROM when the shard data verification result is replied.
[0084] Specifically, the sub-device Dev n Compare the fragment number FragNum in the fragment data with its own serial number CurNum to determine whether they are consistent, and verify whether the checksum is correct, and check whether it is ready to write the fragment data to ROM. If all the conditions are met, the sub-device must immediately switch to the sending mode to reply the fragment data verification result, and be ready to write the fragment data to ROM, and will immediately start writing the fragment data to ROM when replying the fragment data verification result. Set the sub-device Dev n The starting address of the ROM used to store block data is StartAddr n , the address WriteAddr where the shard data is currently written can be calculated n :
[0085] WriteAddr n =WriteAddr n '+FragSize n '
[0086] Where WriteAddr n 'For the child device Dev n The address where the last shard data was written. If it is the first shard data, WriteAddr n 'Equal to StartAddr n ;
[0087] FragSize n 'For the child device Dev n The size of the last fragmented data. If this is the first fragmented data, FragSize n ' is equal to 0;
[0088] If the sub-device is verifying the shard data, the following error message appears:
[0089] FragNum n =CurNum n -1
[0090] This indicates that the terminal did not receive the sequence number FragNum due to packet loss. n The sub-device is trying to retransmit the fragment data based on the verification result of the fragment data. n The shard data of the Rom write operation is performed, or the serial number FragNum has been completed nThe Rom write operation of the fragment data indicates that the sub-device has a serial number FragNum n The fragment data has been verified; or assuming that the serial number is FragNum n The fragmented data has failed verification; when the terminal retransmits the fragmented data, the sub-device must reply to the terminal again with the verification result corresponding to the fragmented data according to the above two situations.
[0091] FragSize n Can be based on:
[0092] FragSize n =(DataSize-(ReadAddr n -DataAddr)) / FragSize? FragSize:
[0093] DataSize % FragSize
[0094] Where ReadAddr n Send to Dev for terminal n The block data shard data offset address can be based on:
[0095] ReadAddr n =FragSize n '+ReadAddr n '
[0096] Where FragSize n 'For Dev n The size of the last fragment data. If this is the first time it is sent, this value is 0.
[0097] Where ReadAddr n 'Send to Dev for the terminal n The offset address of the last block data fragment. If this is the first time to send, this value is equal to DataAddr;
[0098] FragCnt n Can be based on:
[0099] FragCnt n =(ReadAddr n +DataSize%FragSize-DataAddr) / FragSize&0xFF
[0100] Repeat steps S003 to S006 in sequence until the analysis is completed. n Data k(n) Data Reply Dev nAck k(n) and complete ROM writing afterwards, at sub-device Dev n this end can be regarded as the end of all fragmented data transmissions; similarly, when the terminal finishes sending Dev n Data k(n) data and receives the reply Dev n Ack k(n) at the terminal end, it can be regarded as the end of all fragmented data transmissions of sub-device Dev n When both ends simultaneously recognize the end of all fragmented data transmissions, it can be determined that the block data transmission of sub-device Dev n ends, and sub-device Dev n will switch back to the normal connection state.
[0101] Determine the block data transmission status of all sub-devices. If the block data transmission of all sub-devices ends, it is determined that the parallel block data distribution is completed, and the terminal will switch back to the normal connection state.
[0102] It should be noted that when the S005 terminal receives the fragmented data verification result of Dev n within the RTimeOut time, or when the RTimeOut time ends, it will switch back to the sending mode to perform the fragmented data distribution operation for the next sub-device Dev n+1 where n + 1 < N, and if n + 1 = N, it is Dev0. The terminal's distribution logic and Dev n+1 's parsing and processing logic for fragmented data are exactly the same as those of S002 and S003.
[0103] When the terminal polls the sub-device Dev n again, different operations are performed according to the previous distribution result of Dev n Data k(n) :
[0104] · If the terminal does not receive a legal Dev n Ack k(n) before the RTimeOut ends, or the verification result among them is a failure, then re-distribute Dev n Data k(n) this time;
[0105] · If the terminal receives a legal Dev n Ack k(n) before the RTimeOut ends, and the verification result among them is a success, then start to distribute Dev n Data k(n)+1 ;
[0106] Repeat S003 - S006 in sequence until after parsing Dev nData k(n) Data Reply Dev n Ack k(n) , and then complete the ROM writing, at this time the sub-device Dev n Block data shard data write address:
[0107] WriteAddr n =StartAddr n +DataSize
[0108] Then in the child device Dev n This end can be regarded as the end of all fragmented data transmission. Similarly, the terminal completes the Dev n Data k(n) After receiving the data, the Dev n Ack k(n) , and at this time:
[0109] ReadAddr n =DataAddr+DataSize
[0110] Then the terminal can be regarded as a sub-device Dev n When all the fragmented data transmission is completed, both ends simultaneously recognize that all the fragmented data transmission is completed, and the Dev n Block data transfer is completed, sub-device Dev n Will switch back to normal connection state.
[0111] Determine the block data transmission status of all sub-devices. If the block data transmission of all sub-devices is completed, it can be determined that the parallel sending of block data is completed, and the terminal will switch back to the normal connection state.
[0112] refer to Figure 5 The present invention provides a block data parallel delivery system, which is characterized by being applied to data transmission between multiple sub-devices and terminals, and includes:
[0113] Send request module 1, used for the terminal to generate block data send request, sub-device Dev n When actively uploading heartbeat data to the terminal device regularly, the terminal will update the heartbeat reply to a block data sending request and send it to the child device;
[0114] A first switching module 2, configured to switch the terminal to a sending mode to enter a multicast state after ensuring that all sub-devices enter a multicast state;
[0115] Sending module 3, used for the terminal to send the sub-device Dev according to the order n Send shard data Dev n Data k(n)When the terminal finishes sending the fragmented data, it needs to switch to the receiving mode and last for a short time of RTimeOut to receive the fragmented data check result Dev n replied by the sub-device Dev n Ack k(n) ;
[0116] The comparison module 4 is used for the sub-device Dev n to compare the fragment sequence number FragNum in the fragmented data with its own sequence number CurNum to determine whether they are the same, and at the same time verify whether the checksum is correct, and check whether it is ready to write the fragmented data into the ROM. If all conditions are met, the sub-device Dev n needs to immediately switch to the sending mode to reply the fragmented data check result;
[0117] The second switching module 5 is used for the terminal to switch back to the sending mode to perform the fragmented data distribution operation on the next sub-device Dev n when receiving the fragmented data check result within the RTimeOut time, or when the RTimeOut time ends, where n + 1 < N, if n + 1 = N, then it is Dev0; n+1 Polling module 6 is used for when the terminal polls the sub-device Dev
[0118] again, different operations are performed according to the previous distribution result of Dev n : n Data k(n) If the terminal does not receive a legal Dev
[0119] Ack n before the end of RTimeOut, or the check result is a failure, then re-distribute Dev k(n) in this time n Data k(n) ;
[0120] If the terminal receives a legal Dev n Ack k(n) before the end of RTimeOut, and the check result is a success, then start to distribute Dev n Data k(n)+1 .
[0121] In the distribution request module, the terminal will record the signal strength RSSI n when the sub-device Dev uploads data for the last time n , at this time, the sub-device Dev n can be considered to enter the multicast state;
[0122] If the sub-device Dev nIf no block data fragmentation data is received for a continuous BLTime in the multicast state, the connection will return to the normal state.
[0123] In the first switching module, each sub-device Dev n The signal strength of the last communication is arranged from high to low.
[0124] In the comparison module, the sub-device Dev n At the same time, prepare to write the shard data to ROM, and will immediately start writing the shard data to ROM when the shard data verification result is replied.
[0125] Repeat the work of the sending module, the comparison module, the second switching module and the polling module in sequence until the Dev n Data k(n) Data Reply Dev n Ack k(n) , and then complete the ROM write, in the child device Dev n This end can be regarded as the end of all fragmented data transmission; similarly, the terminal completes the Dev n Data k(n) After receiving the data, the Dev n Ack k(n) , which can be regarded as a sub-device Dev on the terminal side n When all the fragmented data transmission is completed, both ends simultaneously recognize that all the fragmented data transmission is completed, and the sub-device Dev can be identified. n Block data transfer is completed, sub-device Dev n Will switch back to normal connection state.
[0126] Determine the block data transmission status of all sub-devices. If the block data transmission of all sub-devices is completed, it is determined that the parallel sending of block data is completed, and the terminal will switch back to the normal connection state.
[0127] refer to Figure 6 The present invention provides a computer device 100, the computer device 100 includes a storage medium 10 and a processor 30 connected to the storage medium 10, the storage medium 10 is used to store a computer program 30, and the processor 10 executes a block data parallel delivery method when running the computer program 30. In addition, the computer device of the present invention also includes an internal memory and a network interface.
[0128] refer to Figure 6The present invention provides a storage medium 10, which is a readable storage medium and is used to store a computer program 30. When the computer program 30 is executed by a processor 20, a method for parallel delivery of block data is executed. In addition, the computer device 100 of the present invention also includes an internal memory and a network interface.
[0129] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of rights of the present invention. Therefore, equivalent changes made according to the scope of the patent application of the present invention are still within the scope covered by the present invention.
Claims
1. A method for sending block data in parallel. It is characterized in that Applied to data transmission between multiple sub-devices and a terminal, including the following steps: Step 1: The terminal generates a block data sending request, and the child device Dev n When actively uploading heartbeat data to the terminal device regularly, the terminal will update the heartbeat reply to a block data sending request and send it to the child device; Step 2, after ensuring that all sub-devices enter the multicast state, the terminal switches to the sending mode to enter the multicast state; Step 3: The terminal sends the data to the sub-device Dev according to the order. n Send shard data Dev n Data k(n) When the terminal finishes sending the fragmented data, it needs to switch to the receiving mode and briefly last for RTimeOut to receive the child device Dev n The reply fragment data verification result Dev n Ack k(n) ; Step 4, Sub-device Dev n Compare the fragment number FragNum in the fragment data with its own serial number CurNum to determine whether they are consistent, and verify whether the checksum is correct, and check whether it is ready to write the fragment data to ROM. If all the conditions are met, the child device Dev n You need to switch to the sending mode immediately to reply the shard data verification result; Step 5, when the terminal receives the shard data verification result of Dev within the RTimeOut time, or when the RTimeOut time ends, it will switch back to the sending mode to perform the shard data distribution operation for the next sub-device Dev n , where n + 1 < N. If n + 1 = N, it is for Dev n+1 ; 0 Step 6: When the terminal polls the child device Dev again n When, according to the last Dev n Data k(n) Send results to perform different operations: If the terminal does not receive a valid Dev before RTimeOut ends, n Ack k(n) , or the verification result fails, then re-send the Dev n Data k(n) ; If the terminal receives a valid Dev before RTimeOut ends, n Ack k(n) , and the verification result is successful, then start sending Dev n Data k(n)+1 .
2. The method for parallel delivery of block data according to claim 1, It is characterized in that In step 1, the terminal records the sub-device Dev n Signal strength RSSI when uploading data for the last time n , at this time the child device Dev n It is considered to enter the multicast state; If the sub-device Dev n If no block data fragmentation data is received for a continuous BLTime in the multicast state, the connection will return to the normal state.
3. The method for parallel delivery of block data according to claim 1, It is characterized in that In step 2, each sub-device Dev n The signal strength of the last communication is arranged from high to low.
4. The method for parallel delivery of block data according to claim 1, It is characterized in that In step 4, the sub-device Dev n At the same time, prepare to write the shard data to ROM, and will start writing the shard data to ROM immediately when the shard data verification result is replied.
5. The method for parallel delivery of block data according to claim 1, It is characterized in that Repeat steps 3 to 6 until the Dev n Data k(n) Data Reply Dev n Ack k(n) , and then complete the ROM writing, at this time the sub-device Dev n Block data shard data write address: WriteAddr n =StartAddr n +DataSize Then the sub-device Dev n All shard data transmission is completed; Similarly, the terminal sends the completion Dev n Data k(n) After receiving the data, the Dev n Ack k(n) , and at this time: ReadAddr n =DataAddr+DataSize The terminal considers the child device Dev n When all fragment data transmission is completed, both ends simultaneously recognize that all fragment data transmission is completed, and Dev n Block data transfer is completed, sub-device Dev n Will switch back to normal connection state.
6. The method for parallel delivery of block data according to claim 5, It is characterized in that Determine the block data transmission status of all sub-devices. If the block data transmission of all sub-devices is completed, it is determined that the parallel sending of block data is completed, and the terminal will switch back to the normal connection state.
7. A block data parallel delivery system, It is characterized in that Applicable to data transmission between multiple sub-devices and terminals, including: The sending request module is used by the terminal to generate block data sending requests, and the sub-device Dev n When actively uploading heartbeat data to the terminal device regularly, the terminal will update the heartbeat reply to a block data sending request and send it to the child device; A first switching module, configured to switch the terminal to a sending mode to enter a multicast state after ensuring that all sub-devices enter a multicast state; The sending module is used for the terminal to send data to the sub-device Dev according to the sequence. n Send shard data Dev n Data k(n) When the terminal finishes sending the fragmented data, it needs to switch to the receiving mode and briefly last for RTimeOut to receive the child device Dev n The reply fragment data verification result Dev n Ack k(n) ; Comparison module for sub-device Dev n Compare the fragment number FragNum in the fragment data with its own serial number CurNum to determine whether they are consistent, and verify whether the checksum is correct, and check whether it is ready to write the fragment data to ROM. If all the conditions are met, the child device Dev n You need to switch to the sending mode immediately to reply the shard data verification result; The second switching module is used to switch back to the sending mode for the next sub-device Dev when the terminal receives the sharded data verification result within the RTimeOut time or when the RTimeOut time ends, where n + 1 < N. If n + 1 = N, it is for Dev n to perform the operation of sending down sharded data. n+1 0 ; The polling module is used when the terminal polls the child device Dev again n When, according to the last Dev n Data k(n) Send results to perform different operations: If the terminal does not receive a valid Dev before RTimeOut ends, n Ack k(n) , or the verification result fails, then re-send the Dev n Data k(n) ; If the terminal receives a valid Dev before RTimeOut ends, n Ack k(n) , and the verification result is successful, then start sending Dev n Data k(n)+1 .
8. The block data parallel delivery system according to claim 7, It is characterized in that In the request sending module, the terminal will record the sub-device Dev n Signal strength RSSI when uploading data for the last time n , at this time the child device Dev n It is considered to enter the multicast state; If the sub-device Dev n If no block data fragmentation data is received for a continuous BLTime in the multicast state, the connection will return to the normal state.
9. The block data parallel delivery system according to claim 7, It is characterized in that In the first switching module, each sub-device Dev n The signal strength of the last communication is arranged from high to low.
10. The block data parallel delivery system according to claim 7, It is characterized in that In the comparison module, the sub-device Dev n At the same time, prepare to write the shard data to ROM, and will start writing the shard data to ROM immediately when the shard data verification result is replied.
11. The block data parallel delivery system according to claim 7, It is characterized in that Repeat the work of the sending module, the comparison module, the second switching module and the polling module in sequence until the analysis is completed. n Data k(n) Data Reply Dev n Ack k(n) , and then complete the ROM writing, at this time the sub-device Dev n Block data shard data write address: WriteAddr n =StartAddr n +DataSize Then the sub-device Dev n All shard data transmission is completed; Similarly, the terminal sends the completion Dev n Data k(n) After receiving the data, the Dev n Ack k(n) , and at this time: ReadAddr n =DataAddr+DataSize The terminal considers the child device Dev n When all fragment data transmission is completed, both ends simultaneously recognize that all fragment data transmission is completed, and Dev n Block data transfer is completed, sub-device Dev n Will switch back to normal connection state.
12. The block data parallel delivery system according to claim 11, It is characterized in that Determine the block data transmission status of all sub-devices. If the block data transmission of all sub-devices is completed, it is determined that the parallel sending of block data is completed, and the terminal will switch back to the normal connection state.
13. A computer device, It is characterized in that The computer device includes a storage medium and a processor connected to the storage medium, the storage medium is used to store a computer program, and the processor executes the block data parallel sending method according to any one of claims 1 to 6 when running the computer program.
14. A storage medium, It is characterized in that The storage medium is a readable storage medium and is used to store a computer program. When the computer program is executed by a processor, the block data parallel sending method according to any one of claims 1 to 6 is executed.
