CN108650666A - The method and its device of bluetooth bi-directional transfer of data - Google Patents

The method and its device of bluetooth bi-directional transfer of data Download PDF

Info

Publication number
CN108650666A
CN108650666A CN201810449038.5A CN201810449038A CN108650666A CN 108650666 A CN108650666 A CN 108650666A CN 201810449038 A CN201810449038 A CN 201810449038A CN 108650666 A CN108650666 A CN 108650666A
Authority
CN
China
Prior art keywords
data thread
transmission
bluetooth equipment
data
reception
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.)
Granted
Application number
CN201810449038.5A
Other languages
Chinese (zh)
Other versions
CN108650666B (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.)
Shenzhen Waterward Information Co Ltd
Original Assignee
Shenzhen Water World 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 Shenzhen Water World Co Ltd filed Critical Shenzhen Water World Co Ltd
Priority to CN201810449038.5A priority Critical patent/CN108650666B/en
Publication of CN108650666A publication Critical patent/CN108650666A/en
Application granted granted Critical
Publication of CN108650666B publication Critical patent/CN108650666B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • H04W8/02Processing of mobility data, e.g. registration information at HLR [Home Location Register] or VLR [Visitor Location Register]; Transfer of mobility data, e.g. between HLR, VLR or external networks
    • H04W8/08Mobility data transfer

Abstract

Present invention is disclosed a kind of method and its device of bluetooth bi-directional transfer of data, this method includes:Establish the reception data thread channel between the first bluetooth equipment and the second bluetooth equipment and transmission data thread channel;Judge whether to receive the instruction for carrying out bi-directional transfer of data;If, it then controls the reception data thread channel and transmission data thread channel and is carried out at the same time data transmission, the same bluetooth equipment to be carried out at the same time in this way to collect and transmission data, increase the compatibility of bluetooth equipment connection, and method is simple, it is of less demanding to hardware technology, realizing that same bluetooth equipment is carried out at the same time the on the basis of of collecting with transmission data and reduces cost.

Description

The method and its device of bluetooth bi-directional transfer of data
Technical field
The present invention relates to the technical fields of communication, especially relate to the method and its dress of bluetooth bi-directional transfer of data It sets.
Background technology
The transmission of the data such as progress voice, word is usually needed between existing smart machine and smart machine, and general Carried out data transmission by the way of wireless transmission, wherein bluetooth with its technology it is low in energy consumption and transmission fast and flexible the advantages that, It is widely used in the transmission technology of smart machine, but in bluetooth module, same bluetooth serial ports data being collected and sending It cannot be carried out at the same time, i.e., cannot be carried out at the same time transmitted in both directions, cause data transmit-receive too slow in this way, on the other hand, some bluetooth moulds Block even same serial ports is only supported single to collect data or single transmission data.
Invention content
The main object of the present invention is to provide a kind of bluetooth transmitted in both directions for being carried out at the same time and collecting and send transmitted in both directions The method and its device of data.
The present invention proposes a kind of method of bluetooth bi-directional transfer of data, including:
It establishes the reception data thread channel between the first bluetooth equipment and the second bluetooth equipment and transmission data thread is logical Road;
Judge whether to receive the instruction for carrying out bi-directional transfer of data;
If so, the control reception data thread channel and transmission data thread channel are carried out at the same time data transmission.
Further, reception data thread channel and the hair established between the first bluetooth equipment and the second bluetooth equipment The step of sending data thread channel, including:
The reception data thread between first bluetooth equipment and second bluetooth equipment is respectively set and sends number According to thread;
Judge whether the identification code of first bluetooth equipment matches with the identification code of the second bluetooth equipment;
If matching, is established in the reception data thread and receive parallel interface, it is built-in in the transmission data thread It is vertical to send parallel interface, to be respectively formed the reception data thread channel and transmission data thread channel.
Further, the reception data thread channel includes at least two, and the reception data thread channel is at least wrapped Include two;The reception data thread channel established between the first bluetooth equipment and the second bluetooth equipment and transmission data thread The step of channel, including:
At least two be respectively set between first bluetooth equipment and second bluetooth equipment receive data thread With at least two transmission data threads;
Judge whether the identification code of first bluetooth equipment matches with the identification code of the second bluetooth equipment;
If matching, one-to-one reception parallel interface is established respectively in at least two reception data threads, One-to-one transmission parallel interface is established respectively in at least two transmission data threads, to be respectively formed at least two The reception data thread channel and at least two transmission data thread channels.
Further, the control reception data thread channel and transmission data thread channel are carried out at the same time data biography Before defeated step, including:
Judge whether the reception data thread channel and transmission data thread channel reach data transmission respectively Preset condition;
If it is not, then analyzing the abnormality in the reception data thread channel and/or transmission data thread channel;
The reception data thread channel and/or transmission data thread channel are repaired according to the abnormality.
Further, the analysis exception for receiving data thread channel and/or transmission data thread channel The step of state, including:
Judge whether the reception data thread and/or the transmission data thread are in active state respectively;
If being not at active state, the reception data thread channel and/or transmission data thread channel are judged In thread exception;
If being in active state, judge whether the reception parallel interface and/or the transmission parallel interface are located respectively In connection status;
If being not at connection status, the reception data thread channel and/or transmission data thread channel are judged It is abnormal in connection.
The present invention also provides a kind of devices of bluetooth bi-directional transfer of data, including:
Module is established, for establishing reception data thread channel and hair between the first bluetooth equipment and the second bluetooth equipment Send data thread channel;
First judgment module receives the instruction for carrying out bi-directional transfer of data for judging whether;
Transmission module controls the reception data thread when for judging to receive the instruction for carrying out bi-directional transfer of data Channel and transmission data thread channel are carried out at the same time data transmission.
Further, the module of establishing includes:
First setting submodule, for connecing between first bluetooth equipment and second bluetooth equipment to be respectively set Receive data thread and transmission data thread;
First matched sub-block, the identification code of identification code and the second bluetooth equipment for judging first bluetooth equipment Whether match;
First setting up submodule, the identification code of identification code and the second bluetooth equipment for judging first bluetooth equipment It when matching, is established in the reception data thread and receives parallel interface, established and sent parallel in the transmission data thread Interface, to be respectively formed the reception data thread channel and transmission data thread channel.
Further, the reception data thread channel includes at least two, and the reception data thread channel is at least wrapped Two are included, the module of establishing includes:
Second setting submodule, for being respectively set between first bluetooth equipment and second bluetooth equipment extremely Few two receive data thread and at least two transmission data threads;
Second matched sub-block, the identification code of identification code and the second bluetooth equipment for judging first bluetooth equipment Whether match;
Second setting up submodule, the identification code of identification code and the second bluetooth equipment for judging first bluetooth equipment When matching, one-to-one reception parallel interface is established respectively in at least two reception data threads, at least two One-to-one transmission parallel interface is established in the transmission data thread respectively, to be respectively formed at least two reception numbers According to thread channel and at least two transmission data thread channels.
Further, further include:
Second judgment module, for judging whether the reception data thread channel and the transmission data thread reach respectively To the preset condition of data transmission;
Analysis module, for judging that the reception data thread channel and the transmission data thread do not reach several respectively According to transmission preset condition when, analyze the abnormal shape for receiving data thread channel and/or transmission data thread channel State;
Repair module, for repairing the reception data thread channel and/or the transmission number according to the abnormality According to thread channel.
Further, analysis module includes:
First judging submodule, for judging whether are the reception data thread and/or the transmission data thread respectively In active state;
First decision sub-module, for judging that the reception data thread and/or the transmission data thread are not at work When jump state, judge that the reception data thread channel and/or transmission data thread channel are in thread exception;
Second judgment submodule, for judging that the reception data thread and/or the transmission data thread are in active When state, judge whether the reception parallel interface and/or the transmission parallel interface are in connection status respectively;
Second decision sub-module, for judging that the reception parallel interface and/or the transmission parallel interface are not at company When connecing state, it is abnormal to judge that the reception data thread channel and/or transmission data thread channel are in connection.
The method of bluetooth bi-directional transfer of data provided by the invention receives data thread channel by setting and sends number According to thread channel so that the same bluetooth equipment can be carried out at the same time by above-mentioned two channel to be collected and transmission data, is increased The compatibility of bluetooth equipment connection, and method is simple, of less demanding to hardware technology, realize the same bluetooth equipment simultaneously into Row is collected and reduces cost on the basis of transmission data.
Description of the drawings
Fig. 1 is the method schematic diagram of the method for one embodiment of the invention bluetooth bi-directional transfer of data;
Fig. 2 is the structural schematic diagram of the device of one embodiment of the invention bluetooth bi-directional transfer of data;
Fig. 3 is the structural schematic diagram that one embodiment of the invention establishes module;
Fig. 4 is the structural schematic diagram that another embodiment of the present invention establishes module;
Fig. 5 is the structural schematic diagram of one embodiment of the invention analysis module.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation describes.Obviously, described embodiment is only a part of the embodiment of the present invention, instead of all the embodiments.Base Embodiment in the present invention, those of ordinary skill in the art obtained without creative efforts it is all its His embodiment, shall fall within the protection scope of the present invention.
It is to be appreciated that the directional instruction (such as up, down, left, right, before and after ...) of institute is only used in the embodiment of the present invention In explaining relative position relation, motion conditions etc. under a certain particular pose (as shown in the picture) between each component, if should When particular pose changes, then directionality instruction also correspondingly changes correspondingly.
In addition, the description for being related to " first ", " second " etc. in the present invention is used for description purposes only, and should not be understood as referring to Show or imply its relative importance or implicitly indicates the quantity of indicated technical characteristic." first ", " are defined as a result, Two " feature can explicitly or implicitly include at least one of the features.In addition, the technical solution between each embodiment can To be combined with each other, but must can be implemented as basis with those of ordinary skill in the art, when the combination of technical solution occurs Conflicting or cannot achieve when, will be understood that the combination of this technical solution is not present, also not the present invention claims protection model Within enclosing.
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
Referring to Fig.1, the method for the bluetooth bi-directional transfer of data that one embodiment of the invention provides, including:
S1:Establish the reception data thread channel between the first bluetooth equipment and the second bluetooth equipment and transmission data thread Channel.
Above-mentioned first bluetooth equipment and the second bluetooth equipment can be to support smart mobile phone or earphone of Bluetooth function etc., this In step, the first bluetooth equipment establishes reception data thread channel and transmission between the first bluetooth equipment and the second bluetooth equipment Data thread channel, above-mentioned reception data thread channel transmission data thread channel is the channel that can carry out data transmission.
S2:Judge whether to receive the instruction for carrying out bi-directional transfer of data;
S3:If so, the control reception data thread channel and transmission data thread channel are carried out at the same time data transmission.
Specifically, the first bluetooth equipment judges whether to receive the instruction for carrying out bi-directional transfer of data, refers to if receiving this It enables, then controls above-mentioned reception data thread channel and transmission data thread channel and be carried out at the same time data transmission, by receiving and sending out Two passes are sent to complete transmitted in both directions so that the same bluetooth equipment, which can be carried out at the same time, to be collected and transmission data, is increased The compatibility of bluetooth equipment connection.
Further, above-mentioned steps S1 includes:
S10:Reception data thread and hair between first bluetooth equipment and second bluetooth equipment is respectively set Send data thread.
Above-mentioned reception data thread and transmission data thread are the minimum unit that program executes stream, are independently dispatched by system With the base unit of assignment, generally it is made of Thread Id, current instruction pointer (PC), container and storehouse.In this step, first is blue Reception data thread and transmission data between first bluetooth equipment and second bluetooth equipment is respectively set in tooth equipment Thread, and above-mentioned thread can be named to be different from other threads, when such as opening reception data thread, which is named as and is connect Data thread is received, when opening transmission data thread, which is named as transmission data thread.Further, it is being respectively set Before reception data thread and transmission data thread between first bluetooth equipment and second bluetooth equipment, first is blue Tooth equipment connects the second bluetooth equipment, and the first bluetooth equipment reads the MAC Address of the second bluetooth equipment, then the first bluetooth equipment The second bluetooth equipment information is got by above-mentioned MAC Address, and above-mentioned MAC Address is a kind of physical address, hardware address, is used for The position of the network equipment is defined, the MAC Address of the second bluetooth equipment is the position for defining the second bluetooth equipment, to pass through MAC Address can obtain the second bluetooth equipment information.Above-mentioned second bluetooth equipment information include the second bluetooth equipment title, The UUID etc. of location, port and protocol definition, above-mentioned agreement are the Bluetooth protocol of the first bluetooth equipment, in turn by the Bluetooth protocol It can determine which type of function the first bluetooth equipment has, the present invention is not intended to limit the type of Bluetooth protocol.Above-mentioned UUID is The abbreviation of Universally Unique Identifier (Universally Unique Identifier) is a kind of standard of software construction, each Bluetooth equipment corresponds to unique identification code.
S11:Judge whether the identification code of first bluetooth equipment matches with the identification code of the second bluetooth equipment;
S12:If matching, is established in the reception data thread and receive parallel interface, in the transmission data thread Interior foundation sends parallel interface, to be respectively formed the reception data thread channel and transmission data thread channel.
In above-mentioned steps S11, judge whether the identification code of the first bluetooth equipment matches with the identification code of the second bluetooth equipment Method include that the identification code of the first bluetooth equipment is sent to the second bluetooth equipment, the second bluetooth equipment by the first bluetooth equipment The identification code of first bluetooth equipment and the identification code of the second bluetooth equipment are compared, and comparing result is sent to the first indigo plant Tooth equipment is carried out confirming matching or mismatch by the first bluetooth equipment, if matching, the first bluetooth equipment is receiving data thread Interior foundation receives parallel interface, to formed it is above-mentioned can be with the reception data thread channel of transmission data, while by above-mentioned reception Data thread and reception parallel interface are deposited in the different zones of collection container, and similarly, the first bluetooth equipment is sending number Send parallel interface according to being established in thread, to formed it is above-mentioned can be with the transmission data thread channel of transmission data, while will be upper It states transmission data thread and sends parallel interface and deposit in the different zones of collection container, above-mentioned collection container is to deposit Device, register are the high speed depositing elements of limited storage capacity, they can be used to temporary instruction, data and address, above-mentioned parallel Interface can be standard parallel interface (Standard Parallel Port), can support the transmitted in both directions of data port.
When first bluetooth equipment and the second bluetooth equipment carry out data transmission, the first bluetooth equipment is by above-mentioned reception data Thread and corresponding reception parallel interface, transmission data thread and corresponding transmission parallel interface take from collection container Go out, then work, mistake occurs in logic when thus being avoided that data transmission, can not run.
In another embodiment, above-mentioned reception data thread channel includes at least two, above-mentioned reception data thread channel Including at least two, then step S1 includes:
S10’:At least two be respectively set between first bluetooth equipment and second bluetooth equipment receive data Thread and at least two transmission data threads;
S11’:Judge whether the identification code of first bluetooth equipment matches with the identification code of the second bluetooth equipment;
S12’:If matching, one-to-one receive parallel is established respectively in at least two reception data threads Interface, established respectively in at least two transmission data threads it is one-to-one send parallel interface, be respectively formed to Few two reception data thread channels and at least two transmission data thread channels.
It is each to receive one reception parallel interface of data thread correspondence establishment, each transmission data line in step S12 ' One transmission parallel interface of journey correspondence establishment.
It is understood that being not intended to limit for establishing above-mentioned transmission data thread channel and receiving data thread channel Number, can need according to user and the memory of the first bluetooth equipment is arranged in turn.
Further, before step S3, including:
S1’:Judge whether the reception data thread channel and transmission data thread channel reach data biography respectively Defeated preset condition.
Before the first bluetooth equipment sends and receivees data, above-mentioned reception data thread channel is judged respectively and sends number Whether can carry out data transmission according to thread channel, that is, judge whether above-mentioned two channel reaches default and can carry out data transmission Condition, above-mentioned preset condition is above-mentioned reception data thread and transmission data thread is in active state, and receives parallel interface It sends parallel interface and is in connection status, above-mentioned two channel reaches above-mentioned preset condition if judging, can just carry out data Transmission.Whether above-mentioned reception data thread and/or the transmission data thread in active state refer to whether above-mentioned thread is located In operating status or blocked state, blocked state here refers to that current task is in a kind of shape for waiting for and entering thread operation State.It is the parallel interface connection for referring to the first bluetooth equipment and the second bluetooth equipment that above-mentioned parallel interface, which is in connection status,.
S2’:If it is not, then analyzing the abnormal shape in the reception data thread channel and/or transmission data thread channel State.
If judging, above-mentioned reception data thread channel and transmission data thread channel do not reach preset condition, i.e., in explanation It states two channels and exception occurs, then the first device analysis above-mentioned reception data thread channel and/or the transmission data thread The abnormality in channel, so as to repair above-mentioned channel for above-mentioned abnormality.
Specifically, above-mentioned abnormality includes that thread is abnormal and connection is abnormal, analysis receive data thread channel and/or The step of abnormality in transmission data thread channel includes:
S20’:Judge whether the reception data thread and/or the transmission data thread are in active state respectively;
S21’:If being not at active state, the reception data thread channel and/or the transmission data thread are judged Channel is in thread exception;
S22’:If being in active state, judge that the reception parallel interface and/or the transmission parallel interface are respectively It is no to be in connection status;
S23’:If being not at connection status, the reception data thread channel and/or the transmission data thread are judged It is abnormal that channel is in connection.
It is received at data thread channel and/or transmission data thread channel by that in step S20 '-S23 ', can analyze In that exception, and then it can carry out and targetedly repair.
S3’:The reception data thread channel is repaired according to the abnormality and/or the transmission data thread is logical Road.
In this step, above-mentioned reception data thread channel is repaired according to above-mentioned abnormality and/or transmission data thread is logical The specific steps in road include:
When the reception data thread for receiving data thread channel is in disabled state, directly stop the thread, again One new reception data thread is set, is then established in new reception data thread and corresponding to be re-established a reception and connect parallel Mouthful;When the reception data thread for receiving data thread channel is in active state, and judge that receiving parallel interface is not at company When connecing state, equally stop the thread, resets a new reception data thread, then establish new reception data thread Interior correspondence re-establishes a reception parallel interface.
Similarly, it is identical as the reparation step for receiving data thread channel to repair step for transmission data thread channel, works as transmission When the transmission data thread in data thread channel is in disabled state, directly stop the thread, resets a new hair Data thread is sent, it is then corresponding in new transmission data thread to re-establish a transmission parallel interface;When transmission data thread When the transmission data thread in channel is in active state, and judge to send parallel interface when being not at connection status, it is same to stop The thread resets a new transmission data thread, and then correspondence re-establishes one in new transmission data thread Send parallel interface.
With reference to Fig. 2, the present invention also provides a kind of device of bluetooth bi-directional transfer of data, including the first bluetooth equipment and The second bluetooth equipment being connect with above-mentioned first bluetooth devices, the first bluetooth equipment include:
Module 100 is established, for establishing the reception data thread channel between the first bluetooth equipment and the second bluetooth equipment With transmission data thread channel.
Above-mentioned first bluetooth equipment and the second bluetooth equipment can be to support smart mobile phone or earphone of Bluetooth function etc., on State establish 100 equipment of module establish the reception data thread channel between the first bluetooth equipment and the second bluetooth equipment and send number According to thread channel, above-mentioned reception data thread channel transmission data thread channel is the channel that can carry out data transmission.
First judgment module 200 receives the instruction for carrying out bi-directional transfer of data for judging whether;
Transmission module 600 controls the reception data line when for judging to receive the instruction for carrying out bi-directional transfer of data Cheng Tongdao and transmission data thread channel are carried out at the same time data transmission.
Specifically, the first judgment module 200 judges whether to receive the instruction for carrying out bi-directional transfer of data, if receiving this Instruction, transmission module 600 then control above-mentioned reception data thread channel and transmission data thread channel and are carried out at the same time data transmission, By sending and receiving two passes to complete transmitted in both directions so that the same bluetooth equipment, which can be carried out at the same time, to be collected and send out Data are sent, the compatibility of bluetooth equipment connection is increased.
Further, with reference to Fig. 3, above-mentioned module 100 of establishing includes:
First setting submodule 110, for being respectively set between first bluetooth equipment and second bluetooth equipment Reception data thread and transmission data thread.
Above-mentioned reception data thread and transmission data thread are the minimum unit that program executes stream, are independently adjusted by system Degree and the base unit assigned, are generally made of Thread Id, current instruction pointer (PC), container and storehouse.In this step, first The reception data thread and hair that submodule 110 is respectively set between first bluetooth equipment and second bluetooth equipment are set Data thread is sent, and above-mentioned thread can be named to be different from other threads, when such as opening reception data thread, which is ordered The thread is named as transmission data thread by entitled reception data thread when opening transmission data thread.Further, One setting submodule 110 be respectively set reception data thread between first bluetooth equipment and second bluetooth equipment and Before transmission data thread, the first bluetooth equipment connects the second bluetooth equipment, then reads the MAC Address of the second bluetooth equipment, First bluetooth equipment gets the second bluetooth equipment information by above-mentioned MAC Address, above-mentioned MAC Address be a kind of physical address, Hardware address, for defining the position of the network equipment, the MAC Address of the second bluetooth equipment is i.e. for defining the second bluetooth equipment Position, to which the second bluetooth equipment information can be obtained by MAC Address.Above-mentioned second bluetooth equipment information is set including the second bluetooth Standby title, address, port and protocol definition UUID etc., above-mentioned agreement is the Bluetooth protocol of the first bluetooth equipment, by this Bluetooth protocol can determine which type of function the first bluetooth equipment has in turn, and the present invention is not intended to limit the class of Bluetooth protocol Type.Above-mentioned UUID is the abbreviation of Universally Unique Identifier (Universally Unique Identifier), is that a kind of software is built The standard of structure, each bluetooth equipment correspond to unique identification code.
First matched sub-block 111, the knowledge of identification code and the second bluetooth equipment for judging first bluetooth equipment Whether other code matches;
First setting up submodule 112, the knowledge of identification code and the second bluetooth equipment for judging first bluetooth equipment It when other code matching, is established in the reception data thread and receives parallel interface, established and send in the transmission data thread Parallel interface, to be respectively formed the reception data thread channel and transmission data thread channel.
Above-mentioned first matched sub-block 111 judges that the identification code of the first bluetooth equipment and the identification code of the second bluetooth equipment are No matching specifically includes, and the identification code of the first bluetooth equipment is sent to the second bluetooth equipment, the second bluetooth by the first bluetooth equipment Equipment compares the identification code of the first bluetooth equipment and the identification code of the second bluetooth equipment, and comparing result is sent to One bluetooth equipment is carried out confirming matching or mismatch by the first bluetooth equipment, if matching, the first setting up submodule 112 are connecing Receive data thread in establish receive parallel interface, to formed it is above-mentioned can be with the reception data thread channel of transmission data, simultaneously Above-mentioned reception data thread and reception parallel interface are deposited in the different zones of collection container, similarly, first establishes son Module 112 established in transmission data thread send parallel interface, to formed it is above-mentioned can be with the transmission data line of transmission data Cheng Tongdao, while above-mentioned transmission data thread and transmission parallel interface being deposited in the different zones of collection container, it is above-mentioned Collection container is register, and register is the high speed depositing element of limited storage capacity, they can be used to temporary instruction, data And address, above-mentioned parallel interface can be standard parallel interface (Standard Parallel Port), can support data port Transmitted in both directions.
When first bluetooth equipment and the second bluetooth equipment carry out data transmission, transmission module 600 is by above-mentioned reception data Thread and corresponding reception parallel interface, transmission data thread and corresponding transmission parallel interface take from collection container Go out, then work, mistake occurs in logic when thus being avoided that data transmission, can not run.
In another embodiment, with reference to Fig. 4, above-mentioned reception data thread channel includes at least two, above-mentioned reception data Thread channel includes at least two, and above-mentioned module 100 of establishing includes:
Second setting submodule 120, for being respectively set between first bluetooth equipment and second bluetooth equipment At least two receive data threads and at least two transmission data threads;
Second matched sub-block 121, the knowledge of identification code and the second bluetooth equipment for judging first bluetooth equipment Whether other code matches;
Second setting up submodule 122, the knowledge of identification code and the second bluetooth equipment for judging first bluetooth equipment When other code matching, one-to-one reception parallel interface is established respectively in at least two reception data threads, at least Established respectively in two transmission data threads it is one-to-one send parallel interface, to connect described in being respectively formed at least two Receive data thread channel and at least two transmission data thread channels.
It is each to receive one reception parallel interface of data thread correspondence establishment, each transmission data thread correspondence establishment one Send parallel interface.Lead to it is understood that being not intended to limit to establish above-mentioned transmission data thread channel and receive data thread The number in road, can need according to user and the memory of the first bluetooth equipment is arranged in turn.
Further, with reference to Fig. 2, the device of above-mentioned bluetooth bi-directional transfer of data further includes:
Second judgment module 300, for judging that the reception data thread channel and the transmission data thread are logical respectively Whether road reaches the preset condition of data transmission.
Before the first bluetooth equipment sends and receivees data, the second judgment module 300 judges above-mentioned reception data respectively Whether thread channel and transmission data thread channel can carry out data transmission, that is, judge above-mentioned two channel whether reach it is default can With the condition carried out data transmission, above-mentioned preset condition is that above-mentioned reception data thread and transmission data thread are in and enliven shape State, and receive parallel interface transmission parallel interface and be in connection status, if the second judgment module 300 judges that above-mentioned two channel is equal Reach above-mentioned preset condition, can just carry out data transmission.Whether above-mentioned reception data thread and/or the transmission data thread Refer to that whether above-mentioned thread in operating status or blocked state in active state, blocked state here refers to current task In a kind of state waited for into thread operation.Above-mentioned parallel interface be in connection status i.e. refer to the first bluetooth equipment and The parallel interface of second bluetooth equipment is connected to.
Analysis module 400, for judging that the reception data thread channel and the transmission data thread do not reach respectively To data transmission preset condition when, analyze and described receive the different of data thread channel and/or transmission data thread channel Normal state.
If the second judgment module 300 judges that above-mentioned reception data thread channel and transmission data thread channel do not reach pre- If condition, that is, illustrate that exception occurs in above-mentioned two channel, then 400 above-mentioned reception data thread channel of analysis module and/or institute The abnormality for stating transmission data thread channel, so as to repair above-mentioned channel for above-mentioned abnormality.
Specifically, above-mentioned abnormality includes that thread is abnormal and connection is abnormal, and with reference to Fig. 5, analysis module 400 includes:
First judging submodule 410, for judging that the reception data thread and/or the transmission data thread be respectively It is no to be in active state;
First decision sub-module 420, for judging that the reception data thread and/or the transmission data thread are not at When active state, judge that the reception data thread channel and/or transmission data thread channel are in thread exception;
Second judgment submodule 430 is lived for judging that the reception data thread and/or the transmission data thread are in When jump state, judge whether the reception parallel interface and/or the transmission parallel interface are in connection status respectively;
Second decision sub-module 440, for judging that the reception parallel interface and/or the transmission parallel interface are not at When connection status, it is abnormal to judge that the reception data thread channel and/or transmission data thread channel are in connection.
Pass through above-mentioned first judging submodule 410, the first decision sub-module 420, second judgment submodule 430 and second Decision sub-module 440, can analyze reception data thread channel and/or which kind of exception transmission data thread channel is in, into And it can carry out and targetedly repair.
Repair module 500, for repairing the reception data thread channel and/or the transmission according to the abnormality Data thread channel.
When the reception data thread for receiving data thread channel is in disabled state, directly stop the thread, again One new reception data thread is set, is then established in new reception data thread and corresponding to be re-established a reception and connect parallel Mouthful;When the reception data thread for receiving data thread channel is in active state, and judge that receiving parallel interface is not at company When connecing state, equally stop the thread, resets a new reception data thread, then establish new reception data thread Interior correspondence re-establishes a reception parallel interface.
Similarly, it is identical as the reparation step for receiving data thread channel to repair step for transmission data thread channel, works as transmission When the transmission data thread in data thread channel is in disabled state, directly stop the thread, resets a new hair Data thread is sent, it is then corresponding in new transmission data thread to re-establish a transmission parallel interface;When transmission data thread When the transmission data thread in channel is in active state, and judge to send parallel interface when being not at connection status, it is same to stop The thread resets a new transmission data thread, and then correspondence re-establishes one in new transmission data thread Send parallel interface.
In conclusion the method and device of bluetooth bi-directional transfer of data provided by the invention, logical by the way that data thread is arranged Road and transmission data thread channel so that the same bluetooth equipment can be carried out at the same time by above-mentioned two channel and collect and send out Data are sent, increase the compatibility of bluetooth equipment connection, and method is simple, it is of less demanding to hardware technology, realizing the same indigo plant Tooth equipment, which is carried out at the same time, to be collected and reduces cost on the basis of transmission data.
The foregoing is merely the preferred embodiment of the present invention, are not intended to limit the scope of the invention, every utilization Equivalent structure or equivalent flow shift made by description of the invention and accompanying drawing content is applied directly or indirectly in other correlations Technical field, be included within the scope of the present invention.

Claims (10)

1. a kind of method of bluetooth bi-directional transfer of data, which is characterized in that including:
Establish the reception data thread channel between the first bluetooth equipment and the second bluetooth equipment and transmission data thread channel;
Judge whether to receive the instruction for carrying out bi-directional transfer of data;
If so, the control reception data thread channel and transmission data thread channel are carried out at the same time data transmission.
2. the method for bluetooth bi-directional transfer of data according to claim 1, which is characterized in that first bluetooth of establishing is set The step of standby reception data thread channel and transmission data thread channel between the second bluetooth equipment, including:
The reception data thread between first bluetooth equipment and second bluetooth equipment and transmission data line is respectively set Journey;
Judge whether the identification code of first bluetooth equipment matches with the identification code of the second bluetooth equipment;
If matching, is established in the reception data thread and receive parallel interface, hair is established in the transmission data thread Parallel interface is sent, to be respectively formed the reception data thread channel and transmission data thread channel.
3. the method for bluetooth bi-directional transfer of data according to claim 1, which is characterized in that the reception data thread is logical Road includes at least two, and the reception data thread channel includes at least two;It is described to establish the first bluetooth equipment and the second indigo plant The step of reception data thread channel between tooth equipment and transmission data thread channel, including:
At least two be respectively set between first bluetooth equipment and second bluetooth equipment receive data threads and extremely Few two transmission data threads;
Judge whether the identification code of first bluetooth equipment matches with the identification code of the second bluetooth equipment;
If matching, one-to-one reception parallel interface is established respectively in at least two reception data threads, extremely One-to-one transmission parallel interface is established in few two transmission data threads respectively, to be respectively formed described at least two Receive data thread channel and at least two transmission data thread channels.
4. the method for bluetooth bi-directional transfer of data according to claim 2 or 3, which is characterized in that connect described in the control Before the step of receipts data thread channel and transmission data thread channel are carried out at the same time data transmission, including:
Judge whether the reception data thread channel and transmission data thread channel reach the default of data transmission respectively Condition;
If it is not, then analyzing the abnormality in the reception data thread channel and/or transmission data thread channel;
The reception data thread channel and/or transmission data thread channel are repaired according to the abnormality.
5. the method for bluetooth bi-directional transfer of data according to claim 4, which is characterized in that the analysis reception number The step of according to the abnormality in thread channel and/or transmission data thread channel, including:
Judge whether the reception data thread and/or the transmission data thread are in active state respectively;
If being not at active state, judge that the reception data thread channel and/or transmission data thread channel are in Thread is abnormal;
If being in active state, judge the reception parallel interface and/or the transmission parallel interface whether in company respectively Connect state;
If being not at connection status, judge that the reception data thread channel and/or transmission data thread channel are in Connection is abnormal.
6. a kind of device of bluetooth bi-directional transfer of data, which is characterized in that including:
Module is established, for establishing the reception data thread channel between the first bluetooth equipment and the second bluetooth equipment and sending number According to thread channel;
First judgment module receives the instruction for carrying out bi-directional transfer of data for judging whether;
Transmission module controls the reception data thread channel when for judging to receive the instruction for carrying out bi-directional transfer of data It is carried out at the same time data transmission with transmission data thread channel.
7. the device of bluetooth bi-directional transfer of data as claimed in claim 6, which is characterized in that the module of establishing includes:
First setting submodule, for the reception number between first bluetooth equipment and second bluetooth equipment to be respectively set According to thread and transmission data thread;
First matched sub-block, whether the identification code of identification code and the second bluetooth equipment for judging first bluetooth equipment Matching;
First setting up submodule, for judging that the identification code of first bluetooth equipment is matched with the identification code of the second bluetooth equipment When, it is established in the reception data thread and receives parallel interface, established in the transmission data thread and send parallel interface, To be respectively formed the reception data thread channel and transmission data thread channel.
8. the device of bluetooth bi-directional transfer of data as claimed in claim 7, which is characterized in that the reception data thread channel Including at least two, the reception data thread channel includes at least two, and the module of establishing includes:
Second setting submodule, for being respectively set at least two between first bluetooth equipment and second bluetooth equipment A reception data thread and at least two transmission data threads;
Second matched sub-block, whether the identification code of identification code and the second bluetooth equipment for judging first bluetooth equipment Matching;
Second setting up submodule, for judging that the identification code of first bluetooth equipment is matched with the identification code of the second bluetooth equipment When, one-to-one reception parallel interface is established respectively in at least two reception data threads, described at least two One-to-one transmission parallel interface is established in transmission data thread respectively, to be respectively formed at least two reception data lines The transmission data threads of Cheng Tongdao and at least two channel.
9. the device of bluetooth bi-directional transfer of data as claimed in claim 8, which is characterized in that further include:
Second judgment module, for judging whether the reception data thread channel and the transmission data thread reach several respectively According to the preset condition of transmission;
Analysis module is passed for judging that the reception data thread channel and the transmission data thread do not reach data respectively When defeated preset condition, the abnormality for receiving data thread channel and/or transmission data thread channel is analyzed;
Repair module, for repairing the reception data thread channel and/or the transmission data line according to the abnormality Cheng Tongdao.
10. the device of bluetooth bi-directional transfer of data as claimed in claim 9, which is characterized in that analysis module includes:
First judging submodule, for judging whether the reception data thread and/or the transmission data thread are in respectively Active state;
First decision sub-module, for judging that the reception data thread and/or the transmission data thread are not at and enliven shape When state, judge that the reception data thread channel and/or transmission data thread channel are in thread exception;
Second judgment submodule, for judging that the reception data thread and/or the transmission data thread are in active state When, judge whether the reception parallel interface and/or the transmission parallel interface are in connection status respectively;
Second decision sub-module, for judging that the reception parallel interface and/or the transmission parallel interface are not at connection shape When state, it is abnormal to judge that the reception data thread channel and/or transmission data thread channel are in connection.
CN201810449038.5A 2018-05-11 2018-05-11 Method and device for Bluetooth two-way data transmission Active CN108650666B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810449038.5A CN108650666B (en) 2018-05-11 2018-05-11 Method and device for Bluetooth two-way data transmission

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810449038.5A CN108650666B (en) 2018-05-11 2018-05-11 Method and device for Bluetooth two-way data transmission

Publications (2)

Publication Number Publication Date
CN108650666A true CN108650666A (en) 2018-10-12
CN108650666B CN108650666B (en) 2021-06-29

Family

ID=63754810

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810449038.5A Active CN108650666B (en) 2018-05-11 2018-05-11 Method and device for Bluetooth two-way data transmission

Country Status (1)

Country Link
CN (1) CN108650666B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109497627A (en) * 2018-12-26 2019-03-22 南昌与德软件技术有限公司 Electronic cigarette device, cigarette control blue-tooth device and electronic cigarette dating system
CN109525976A (en) * 2018-12-05 2019-03-26 深圳创维数字技术有限公司 With network method, system and readable storage medium storing program for executing

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050250536A1 (en) * 2002-01-26 2005-11-10 Guoshun Deng Method and system for wireless data communication in data processing system
CN105657646A (en) * 2016-01-29 2016-06-08 南京悦控智能科技有限公司 Bluetooth 4.0 based device-to-device big data communication method
CN106155687A (en) * 2016-07-04 2016-11-23 南京阿波罗机器人科技有限公司 A kind of wireless real time graphical based on bluetooth 4 is to controller programmed method
CN106685486A (en) * 2017-02-21 2017-05-17 深圳市富德康电子有限公司 Multi-user duplex talkback system and method based on Bluetooth
CN106792482A (en) * 2017-01-20 2017-05-31 深圳市慧闪科技有限责任公司 A kind of method and system for being used between two devices set up near-field communication
CN107580313A (en) * 2017-10-17 2018-01-12 燕山大学 With reference to bluetooth Beacon and the indoor locating system and its localization method of smart mobile phone

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050250536A1 (en) * 2002-01-26 2005-11-10 Guoshun Deng Method and system for wireless data communication in data processing system
CN105657646A (en) * 2016-01-29 2016-06-08 南京悦控智能科技有限公司 Bluetooth 4.0 based device-to-device big data communication method
CN106155687A (en) * 2016-07-04 2016-11-23 南京阿波罗机器人科技有限公司 A kind of wireless real time graphical based on bluetooth 4 is to controller programmed method
CN106792482A (en) * 2017-01-20 2017-05-31 深圳市慧闪科技有限责任公司 A kind of method and system for being used between two devices set up near-field communication
CN106685486A (en) * 2017-02-21 2017-05-17 深圳市富德康电子有限公司 Multi-user duplex talkback system and method based on Bluetooth
CN107580313A (en) * 2017-10-17 2018-01-12 燕山大学 With reference to bluetooth Beacon and the indoor locating system and its localization method of smart mobile phone

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109525976A (en) * 2018-12-05 2019-03-26 深圳创维数字技术有限公司 With network method, system and readable storage medium storing program for executing
CN109497627A (en) * 2018-12-26 2019-03-22 南昌与德软件技术有限公司 Electronic cigarette device, cigarette control blue-tooth device and electronic cigarette dating system

Also Published As

Publication number Publication date
CN108650666B (en) 2021-06-29

Similar Documents

Publication Publication Date Title
CN113841339B (en) Service connection establishing method, bluetooth main device, chip and Bluetooth system
CN105260337B (en) A kind of automatic addressing method and system of single-chip microcomputer
US20130252656A1 (en) Method and apparatus to manage wireless direct access communication group
CN108488914A (en) Air-conditioner set, the operating method of air-conditioner set and device
CN101001177A (en) Single logical network interface for advanced load balancing and fail-over functionality
CN103281797A (en) Mobile terminal and method of transmitting business data by same
CN108650666A (en) The method and its device of bluetooth bi-directional transfer of data
CN105848235A (en) Communication control method and device
US20160219141A1 (en) Method and System for Generic and Secure Troubleshooting of Appliances Using Wireless and Mobile Network
CN108616887A (en) The network-building method and device of wireless multi-line system
CN105276776B (en) The control method and system of central air-conditioning module
US20170078135A1 (en) Network protocol configuration method and apparatus
CN110278577A (en) The sending control method and device of data
CN105429903A (en) Switch and configuration method
CN111107507B (en) LoRa equipment networking method suitable for geological disaster monitoring application
US20220417843A1 (en) Data communication system to serve a user equipment (ue) over a third generation partnership project (3gpp) network core
CN108702315A (en) Connection is established between two local devices for being connected to heterogeneous networks
CN102917370A (en) Method, device and system for determining corresponding near-end unit of far-end unit and far-end unit
CN103986692B (en) Data forwarding method and system based on wireless access point
CN107396408B (en) Method and system for recovering user service when communication link changes
JP3809437B2 (en) A method for exchanging parameters of a mobile communication system.
CN105722082A (en) Method for intelligent equipment to obtain operation network configuration by using access point function
CN107742518A (en) A kind of information processing method and electronic equipment
CN114143855A (en) Network automatic connection method and device
CN103179685A (en) Method and system for maintaining communication links

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
TR01 Transfer of patent right

Effective date of registration: 20210926

Address after: 518000 201, No.26, yifenghua Innovation Industrial Park, Xinshi community, Dalang street, Longhua District, Shenzhen City, Guangdong Province

Patentee after: Shenzhen waterward Information Co.,Ltd.

Address before: 518000, block B, huayuancheng digital building, 1079 Nanhai Avenue, Shekou, Nanshan District, Shenzhen City, Guangdong Province

Patentee before: SHENZHEN WATER WORLD Co.,Ltd.

TR01 Transfer of patent right