CN107734002B - Bluetooth data receiving device and method thereof - Google Patents

Bluetooth data receiving device and method thereof Download PDF

Info

Publication number
CN107734002B
CN107734002B CN201710876722.7A CN201710876722A CN107734002B CN 107734002 B CN107734002 B CN 107734002B CN 201710876722 A CN201710876722 A CN 201710876722A CN 107734002 B CN107734002 B CN 107734002B
Authority
CN
China
Prior art keywords
data
receiving
receiving end
received
redundant
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710876722.7A
Other languages
Chinese (zh)
Other versions
CN107734002A (en
Inventor
王玲利
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xian Fast Auto Drive Co Ltd
Original Assignee
Xian Fast Auto Drive Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xian Fast Auto Drive Co Ltd filed Critical Xian Fast Auto Drive Co Ltd
Priority to CN201710876722.7A priority Critical patent/CN107734002B/en
Publication of CN107734002A publication Critical patent/CN107734002A/en
Application granted granted Critical
Publication of CN107734002B publication Critical patent/CN107734002B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Abstract

The invention discloses a receiving device and a method of Bluetooth data, which comprises a receiving end with a virtual serial port of Bluetooth equipment, wherein the receiving end reads all data in a buffer area, traverses from a first byte of the data to find a starting point of a first group of data, the first group of data and the data behind the first group of data are received data, calculates the length L of the received data, and the receiving end obtains redundant data by surplus data acquired by the receiving end according to the length K of a data packet, and stores the redundant data in a storage memory and receives the received data of other parts, wherein when the receiving end receives the data in the next round, the receiving end integrates the redundant data before the received data in the next round, the redundant data is stored by arranging the storage memory, and then when the next data is received, the redundant data is read together with the data in the buffer area, and the receiving integrity of the Bluetooth data is realized.

Description

Bluetooth data receiving device and method thereof
Technical Field
The invention belongs to the technical field of data transmission; relates to a method for receiving Bluetooth data by a receiving end; in particular to a receiving device of Bluetooth data; and also relates to a method for receiving the Bluetooth data.
Background
Since 2012 later, the operation of the bluetooth of the PC end can be performed by virtualizing the bluetooth into a serial port, which greatly facilitates the algorithm design of a programmer when the data acquisition requires the coexistence of the bluetooth and serial port operations, but also has a serious problem; the virtual serial ports that become of bluetooth promptly, when receiving data, can find that the condition of the fault often appears in the data received, lead to the data package incomplete, appear this kind of condition and bluetooth distributed buffer memory size and transmission rate have very big relation, also have the relation with the method that present receiving terminal received bluetooth data moreover.
At present, when a receiving end receives Bluetooth data, only a complete data packet is taken, and redundant data is discarded, so that the receiving speed of the data can be improved, but the problems of data fault, data error and confusion exist in the receiving of the Bluetooth data.
Disclosure of Invention
The invention provides a method for receiving Bluetooth data, which can ensure that data is not discarded when a Bluetooth virtual serial port and the Bluetooth data are received, and ensure the integrity of the data.
The invention also provides a receiving device of the Bluetooth data, which stores the redundant data by arranging a storage memory, then reads the redundant data together with the data of the buffer area when receiving the next data, receives the redundant data and realizes the integrity of the Bluetooth data reception.
The technical scheme of the invention is as follows: a method for receiving bluetooth data, comprising the steps of:
step 1, virtualizing a Bluetooth device at a receiving end into a serial port, and receiving all data of a buffer area by the serial port;
step 2, finding the starting point of the first group of data in the data, wherein the data after the starting point is received data, and the receiving end receives the data;
step 3, calculating the length L of the received data in step 2, and obtaining redundant data by calculating the remainder according to the length K of the data packet;
and 4, storing the redundant data, then receiving the data of the next round, and in the process of receiving the data of the next round, firstly receiving the redundant data and then receiving the received data of the next round.
Furthermore, the invention is characterized in that:
in step 2, the starting point of the first group of data is found in the data, specifically, each byte is traversed from the first byte of the data, and whether the data is the received first group of data is determined.
Wherein the judgment in step 2 is yes, the receiving end starts to receive the data after the first group of data.
If the judgment in the step 2 is not yes, the receiving end receives the redundant data in the previous data receiving process, and then receives the first group of data and the subsequent data.
In step 2, the receiving end integrates the redundant data before the first group of data, and then the receiving end starts to receive the data.
In the next round of data receiving process in step 4, the receiving end integrates the redundant data before the next round of received data, and then starts to receive data.
The invention also provides a Bluetooth data receiving device, which comprises a receiving end with a virtual serial port of Bluetooth equipment, wherein the receiving end reads all data in the buffer area, traverses from the first byte of the data to find the starting point of the first group of data, the first group of data and the data after the first group of data are received data, calculates the length L of the received data, and obtains redundant data by the receiving end by carrying out complementation on the received data according to the length K of a data packet, the receiving end stores the redundant data in a storage memory and receives the received data of other parts, and when the receiving end receives the data in the next round, the receiving end integrates the redundant data in front of the starting position of the received data in the next round.
Compared with the prior art, the method has the advantages that in the process of receiving the Bluetooth data by the receiving end, the length of the received data is processed, namely the length L of the received data is subjected to complementation according to the length K of the data packet to obtain redundant data smaller than K bits, the redundant data is stored, in the next round of data receiving process, the redundant data and the next round of received data are received together, the complete receiving of the data is realized, the data is not discarded, and the complete receiving of the data is realized.
Furthermore, a starting point of the first group of data is found in the data, a traversal mode is adopted, and whether the first group of data is received or not is judged from the first byte; since the data transmitted/received by bluetooth is in accordance with the protocol specification, it is possible to find the starting point of the received data from the data according to the protocol.
Furthermore, the receiving end can receive the redundant data of the previous round and the current received data together in the next round of data receiving process, or the redundant data of the previous round and the current received data are integrated and then received, so that the integrity of the data is realized.
The invention also has the following beneficial effects: the invention adds a memory for storing redundant data, and in the next round of received data, the receiving end reads the redundant data from the memory; the Bluetooth data receiving device avoids the loss of redundant data, achieves the receiving of the redundant data, and achieves the integrity of Bluetooth data receiving.
Drawings
FIG. 1 is a schematic flow diagram of the present invention;
fig. 2 is a schematic structural diagram of the present invention.
In the figure: 1 is a receiving end; 2 is a buffer area; and 3 is a storage memory.
Detailed Description
The technical solution of the present invention is further explained with reference to the accompanying drawings and specific embodiments.
The invention provides a method for receiving Bluetooth data, as shown in fig. 1, the method specifically comprises the following steps:
step 1, virtualizing a Bluetooth device of a receiving end into a serial port, wherein the receiving end is a PC end or other terminal equipment, and the receiving end receives all data of a data transmitting end buffer zone through the Bluetooth serial port.
Step 2, the receiving end finds the starting point of the first group of data from the data, the data after the starting point is the received data, namely the data which needs to be received in the data receiving process of the current round, and the receiving end receives the data; in the process, as the receiving end and the sending end both send/receive data through the Bluetooth protocol, the receiving end finds the starting point of the first group of data from the data according to the Bluetooth protocol, and traverses each byte from the first byte of the data and judges whether the byte is the received first group of data or not; when the judgment is yes, the receiving end starts to receive the data after the first group of data; when the judgment result is not yes, the receiving end firstly receives redundant data in the previous round of received data and then receives the first group of data and the data after the first group of data.
The first group of data is judged in step 2, because when the receiving end receives the data in the buffer area, it is first judged whether the received data of the current round is a new data transmission process, if not, the received data of the current round is a part of data in the middle of a complete data transmission process, and therefore the redundant data generated in the previous round needs to be received; if it is a new data transmission process, there is no upper round of data reception process.
And 3, the receiving end calculates the received data obtained in the step 2 and obtains redundant data by calculating the remainder according to the length of the data packet, wherein the length of the received data is L, the length of the data packet is K, the length of the data packet is the length of the data packet sent by the sending end each time, a length can be set for the receiving end, the length L of the received data is divided by the length of the data packet to obtain a divisor M and a remainder N, namely the received data comprises M received data packets and N bytes of redundant data, and the redundant data is not enough to form a complete received data packet, so the redundant data needs to be processed in the following mode.
Step 4, storing the redundant data in the step 3, wherein a receiving end can set a section of storage memory specially used for storing the redundant data in the memory; in the next round of data reception, the redundant data is received together with the next round of reception data. Specifically, in the next round of data receiving process, redundant data is merged before the received data obtained in the step 2 of the next round, then the merged data is used as the received data, and the calculation of the step 3 is performed, so that the whole data receiving work is completed in a circulating manner.
The embodiment of the invention is as follows:
example 1
The invention is explained by taking an example that a PC receiving end receives first round data sent by a sending end, wherein the length of a data packet is 16 bytes, and the specific operation is as follows
Firstly, the Bluetooth device at the PC receiving end is virtualized into a serial port, after the PC receiving end is connected with the sending end through Bluetooth, receiving 1500 bytes of data sent by the sending end, the PC receiving end finds the 50 th byte as the starting point of the first group of data through the Bluetooth protocol, wherein, the data of 1-49 bytes is invalid data sent by the sending end, so the received data of the first round is 1451 bytes of data in total from 50-1500, the length of the received data is 1451, and then, the length 16 of the data packet is complemented to obtain 90 complete data packets, 11 bytes of redundant data are remained, because 11 bytes of data are not enough for the length of one data packet, 11 bytes of redundant data are stored in a storage memory which is arranged in the PC receiving end and is specially used for storing the redundant data, and then the receiving end processes 90 complete data packets.
In the second round of data reception, the PC receiving end still receives 1500 bytes of data sent by the sending end, combines 11 bytes of redundant data of the previous round with the data of this time, and takes 16 bytes of the first group as the first group of data of this time reception, so the length of the received data of the second round is 1511, and then the length 16 of the data packet is subjected to remainder to obtain 94 complete data packets, and 7 bytes of redundant data remain, and then the storage memory is emptied and the 7 bytes of redundant data are stored in the storage memory.
And then the process is circulated until the receiving end of the PC receives all the data of the transmitting end.
Example 2
The invention takes the example that the PC receiving end receives the 6 th round of data sent by the sending end as an example for explanation, wherein the length of the data packet is 8 bytes, and the redundant data of 4 bytes is stored in the storage memory in the 5 th round of data receiving process; the specific operation is as follows:
a PC receiving end receives 992 bytes of data sent by a sending end in the 6 th data receiving in one data transmission process, firstly, 4 bytes of redundant data stored in a memory in the 5 th data receiving process are integrated to the initial position of received data, and the length of the obtained new received data is 1000; and then, the length 8 of the data packet is complemented to obtain 125 complete data packets, and no redundant data is generated in the current round, so that the PC receiving end directly receives the 125 complete data packets to complete the data receiving work of the 6 th round.
In the 7 th round of data receiving process, the PC receiving end receives 1002 bytes of data sent by the sending end, and since no redundant data is generated in the 6 th round of data receiving process, the length of the received data of the 7 th round of data receiving seed is 1000, and then the length 8 of the data packet is complemented to obtain 125 complete data packets and 2 bytes of redundant data, the redundant data is stored in the storage memory, and the PC receiving end processes the 125 complete data packets.
The invention also provides a Bluetooth data receiving device, as shown in fig. 2, which comprises a receiving end 1, wherein the receiving end 1 is a PC end or other receiving terminals, a Bluetooth device of the receiving end 1 is virtualized into a serial port, the receiving end 1 receives data in a buffer 2, the data in the buffer 2 is data sent outside by a sending end, the receiving end 1 and the sending end are directly read the data sent by the sending end from the buffer 2 after being connected through Bluetooth, the receiving end 1 needs further judgment and calculation after obtaining the data in the buffer 2, the receiving end 1 firstly judges whether the received data is the first round of data reception in the data transmission process, namely, each byte is traversed from the first byte according to a Bluetooth protocol, the starting point of data reception is found according to byte information, the data from the starting point and the data after the starting point are the received data of the current round, the length of the received data is L, the received data is complemented according to the length K of the data packet, the obtained divisor is M, the remainder is N, the M complete data packets and the N bytes of the redundant data are stored in a memory storage space of the receiving end, and the next round of the redundant data is stored in a next round of the next round, and the next round of redundant data is stored in the next round of the M, the redundant data is stored in the next round of the next round, and the redundant data, the redundant data is stored in the next round, the next round of the redundant data, and the redundant data, the redundant data is stored in the redundant data.

Claims (4)

1. A method for receiving bluetooth data, comprising the steps of:
step 1, virtualizing a Bluetooth device at a receiving end into a serial port, and receiving all data of a buffer area by the serial port;
step 2, finding the starting point of the first group of data in the data, wherein the data after the starting point is received data, and the receiving end receives the data; specifically, the method comprises the following steps: the receiving end finds the starting point of the first group of data from the data according to the Bluetooth protocol, traverses each byte from the first byte of the data, and judges whether the byte is the received first group of data; when the judgment is yes, the receiving end starts to receive the data after the first group of data; when the judgment is not yes, the receiving end firstly receives redundant data in the previous round of received data and then receives the first group of data and the data after the first group of data;
step 3, calculating the length L of the received data in step 2, and obtaining redundant data by calculating the remainder according to the length K of the data packet;
and 4, storing the redundant data, then receiving the data of the next round, and in the process of receiving the data of the next round, firstly receiving the redundant data and then receiving the received data of the next round.
2. The method for receiving bluetooth data according to claim 1, wherein in step 2, the receiving end integrates the redundant data before the first set of data, and then the receiving end starts receiving the data.
3. The method for receiving bluetooth data according to claim 1, wherein in the step 4, during the next round of data reception, the receiving end integrates redundant data before the next round of received data, and then starts receiving data.
4. A receiving device of Bluetooth data is characterized by comprising a receiving end (1) with a virtual serial port of Bluetooth equipment, wherein the receiving end (1) reads all data in a buffer area (2), the receiving end (1) traverses from a first byte of the data to find a starting point of a first group of data, the first group of data and the data behind the first group of data are received data, the receiving end (1) calculates the length L of the received data, and the receiving end (1) deduces the remainder of the received data according to the length K of a data packet to obtain redundant data, the receiving end (1) stores the redundant data in a storage memory (3) and receives the received data of other parts;
and when the receiving end (1) receives data in the next round, the redundant data is integrated before the initial position of the received data in the next round.
CN201710876722.7A 2017-09-25 2017-09-25 Bluetooth data receiving device and method thereof Active CN107734002B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710876722.7A CN107734002B (en) 2017-09-25 2017-09-25 Bluetooth data receiving device and method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710876722.7A CN107734002B (en) 2017-09-25 2017-09-25 Bluetooth data receiving device and method thereof

Publications (2)

Publication Number Publication Date
CN107734002A CN107734002A (en) 2018-02-23
CN107734002B true CN107734002B (en) 2020-07-17

Family

ID=61207956

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710876722.7A Active CN107734002B (en) 2017-09-25 2017-09-25 Bluetooth data receiving device and method thereof

Country Status (1)

Country Link
CN (1) CN107734002B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101447808A (en) * 2007-11-27 2009-06-03 中兴通讯股份有限公司 Bluetooth file transmission system
JP5170697B2 (en) * 2009-03-30 2013-03-27 Kddi株式会社 Bluetooth communication method and system
CN104135339A (en) * 2014-07-08 2014-11-05 福建联迪商用设备有限公司 Bluetooth low-power-consumption communication method, Bluetooth equipment and system
CN105900347A (en) * 2015-10-27 2016-08-24 深圳还是威健康科技有限公司 Bluetooth-based data transmission method and device
CN106162536A (en) * 2016-08-30 2016-11-23 韦嘉志 A kind of system of bluetooth data transmission
CN106571894A (en) * 2016-11-10 2017-04-19 深圳市民德电子科技股份有限公司 Bluetooth information sending and receiving methods

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120302169A1 (en) * 2011-05-25 2012-11-29 Sunrex Technology Corp. Bluetooth data transmission system and method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101447808A (en) * 2007-11-27 2009-06-03 中兴通讯股份有限公司 Bluetooth file transmission system
JP5170697B2 (en) * 2009-03-30 2013-03-27 Kddi株式会社 Bluetooth communication method and system
CN104135339A (en) * 2014-07-08 2014-11-05 福建联迪商用设备有限公司 Bluetooth low-power-consumption communication method, Bluetooth equipment and system
CN105900347A (en) * 2015-10-27 2016-08-24 深圳还是威健康科技有限公司 Bluetooth-based data transmission method and device
CN106162536A (en) * 2016-08-30 2016-11-23 韦嘉志 A kind of system of bluetooth data transmission
CN106571894A (en) * 2016-11-10 2017-04-19 深圳市民德电子科技股份有限公司 Bluetooth information sending and receiving methods

Also Published As

Publication number Publication date
CN107734002A (en) 2018-02-23

Similar Documents

Publication Publication Date Title
CN111654447B (en) Message transmission method and device
CN110572293B (en) Data message detection method, equipment and system
US7710973B2 (en) Error masking for data transmission using received data
KR101745456B1 (en) Ecu for transmitting large data in hil test environment, system including the same and method thereof
CN110505161B (en) Message processing method and device
CN105099938B (en) The determination method and apparatus of congestion window in network
CN110505123B (en) Packet loss rate calculation method, server and computer-readable storage medium
WO2017112260A1 (en) Technologies for sideband performance tracing of network traffic
EP4057576A1 (en) Packet encapsulating method and apparatus, and packet decapsulating method and apparatus
CN105162732B (en) Create the method, apparatus of ECP Extended Capabilities Port
CN103746966A (en) UDP-based upper-layer protocol and Ethernet MAC layer data transmission method
CN108173763B (en) Message processing method, device and system
CN107204924B (en) Link discovery method and device
EP3026856A1 (en) Gre packet encapsulation method, decapsulation method, and corresponding apparatuses
CN111224903A (en) Data transmission method, data transmission equipment and computer readable storage medium
JP6929946B2 (en) Data transmission method, device, transmitting end, receiving end and system
CN101667959A (en) Method and device for transmitting data in physical layer and data transmission system
CN111343109A (en) Data transmission method, device and related equipment
CN107734002B (en) Bluetooth data receiving device and method thereof
CN112737995B (en) Method, device and equipment for processing Ethernet frame and storage medium
US9544401B2 (en) Device and method for data communication using a transmission ring buffer
CN113852533A (en) Multi-channel data communication system and method and electronic equipment
CN103634229B (en) A kind of Inter-chip communication method and control device
CN112565105A (en) Method, device and equipment for reducing time-sensitive frame forwarding time delay
CN106817316B (en) Method, device and system for detecting path MTU

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant