CN106303907A - Bluetooth communication method and bluetooth communication device - Google Patents

Bluetooth communication method and bluetooth communication device Download PDF

Info

Publication number
CN106303907A
CN106303907A CN201510283901.0A CN201510283901A CN106303907A CN 106303907 A CN106303907 A CN 106303907A CN 201510283901 A CN201510283901 A CN 201510283901A CN 106303907 A CN106303907 A CN 106303907A
Authority
CN
China
Prior art keywords
bluetooth communication
described
data
according
target
Prior art date
Application number
CN201510283901.0A
Other languages
Chinese (zh)
Inventor
卢涛
Original Assignee
腾讯科技(深圳)有限公司
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 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Priority to CN201510283901.0A priority Critical patent/CN106303907A/en
Publication of CN106303907A publication Critical patent/CN106303907A/en

Links

Abstract

The embodiment of the present invention provides a kind of Bluetooth communication method, is connected comprising: set up Bluetooth communication with target Bluetooth communication equipment;When Bluetooth communication connects and disconnects, it is judged that whether Bluetooth communication connects is passive disconnection;And as Bluetooth communication is connected as passively disconnecting, then automatically recover to be connected with the Bluetooth communication of target Bluetooth communication equipment within the setting time.By repeatedly reconnecting, the Bluetooth communication method of the present invention and Bluetooth communication device ensure that what Bluetooth communication connected stablizes, communication efficiency is high.

Description

Bluetooth communication method and Bluetooth communication device

Technical field

The present invention relates to the communications field, particularly relate to a kind of Bluetooth communication method and Bluetooth communication device.

Background technology

In field of mobile equipment, existing Bluetooth technology is widely used.Up to the present, bluetooth Transfer rate can reach 1.8M/s~2.1M/s, after Android OS 4.3 version, also supports corresponding BLE (Bluetooth low energy, Bluetooth Low Energy agreement) technology, to reduce the energy consumption of Bluetooth communication.

But in existing Bluetooth Communication Technology, when Bluetooth communication equipment A is beyond Bluetooth communication equipment B's In the case of bluetooth join domain, the Bluetooth communication between Bluetooth communication equipment A and Bluetooth communication equipment B is even Connect and can be forced to disconnect, cause communication failure;Even if this Bluetooth communication equipment A sets subsequently back into Bluetooth communication In the bluetooth join domain of standby B, it is also desirable to user re-establishes this bluetooth by operation Bluetooth communication equipment A Communication connection could continue communication, operates relatively complicated, and communication efficiency is relatively low.

Summary of the invention

The embodiment of the present invention provides the Bluetooth communication method and Bluetooth communication device that a kind of communication efficiency is high;To solve Certainly existing Bluetooth communication method and the complex operation of Bluetooth communication device and the relatively low technology of communication efficiency Problem.

The embodiment of the present invention provides a kind of Bluetooth communication method, comprising:

Set up Bluetooth communication with target Bluetooth communication equipment to be connected;

When described Bluetooth communication connects and disconnects, it is judged that whether described Bluetooth communication connects is passive disconnection;With And

As described Bluetooth communication is connected as passively disconnecting, then automatically recover blue with described target within the setting time The Bluetooth communication of tooth communication equipment connects.

The embodiment of the present invention also provides for a kind of Bluetooth communication device, comprising:

Connection establishment module, is connected for setting up Bluetooth communication with described target Bluetooth communication equipment;

Judge module, for when described Bluetooth communication connects and disconnects, it is judged that whether described Bluetooth communication connects Disconnect for passive;And

Reconnect module, be connected as passively disconnecting for such as described Bluetooth communication, then the most extensive within the setting time It is connected with the Bluetooth communication of described target Bluetooth communication equipment again.

Compared to Bluetooth communication method and the Bluetooth communication device of prior art, the Bluetooth communication method of the present invention And by repeatedly reconnecting, Bluetooth communication device ensures that what Bluetooth communication connected stablizes, simple to operate and communication effect Rate is high;Solve existing Bluetooth communication method and the complex operation of Bluetooth communication device and communication efficiency Relatively low technical problem.

Accompanying drawing explanation

Fig. 1 is the flow chart of the first preferred embodiment of the Bluetooth communication method of the present invention;

Fig. 2 is the flow chart of step S1052 of the first preferred embodiment of the Bluetooth communication method of the present invention;

When Fig. 3 is step S1052 of the first preferred embodiment of the Bluetooth communication method of the present invention, target is blue The operational flowchart of tooth communication equipment;

Fig. 4 is the flow chart of the second preferred embodiment of the Bluetooth communication method of the present invention;

Fig. 5 is the flow chart of step S404 of the second preferred embodiment of the Bluetooth communication method of the present invention;

Fig. 6 is the flow chart of step S4042 of the second preferred embodiment of the Bluetooth communication method of the present invention

Fig. 7 is the structural representation of the first preferred embodiment of the Bluetooth communication device of the present invention;

Fig. 8 is the structural representation reconnecting module of the first preferred embodiment of the Bluetooth communication device of the present invention Figure;

Fig. 9 is the knot of the target Bluetooth communication equipment of the first preferred embodiment of the Bluetooth communication device of the present invention Structure schematic diagram;

Figure 10 is the structural representation of the second preferred embodiment of the Bluetooth communication device of the present invention;

Figure 11 is the transmission data transmission blocks of the second preferred embodiment of the Bluetooth communication device of the present invention Structural representation.

Detailed description of the invention

Refer to graphic, the most identical element numbers represents identical assembly, and the principle of the present invention is with reality The computing environment that Shi Yi is suitable illustrates.The following description is concrete based on the illustrated present invention Embodiment, it is not construed as limiting other specific embodiment that the present invention is the most detailed herein.

The Bluetooth communication method of the present invention may be provided in the Bluetooth communication device with Bluetooth function, this bluetooth Communicator includes but not limited to mobile phone, Intelligent flat, intelligent watch and intelligence accessories etc..This bluetooth is led to T unit can have a Bluetooth mobile equipment of bluetooth with another or bluetooth is fixed equipment and set up Bluetooth communication and be connected.

Refer to the flow chart of the first preferred embodiment of the Bluetooth communication method that Fig. 1, Fig. 1 are the present invention. The Bluetooth communication method of this preferred embodiment includes:

Step S101, the implementor name of search surrounding objects Bluetooth communication equipment, and determine one according to user operation Target Bluetooth communication equipment;

Step S102, sends pairing request to target Bluetooth communication equipment, and receives target Bluetooth communication equipment Pairing response;

Step S103, according to pairing response and Bluetooth communication protocol, generates Bluetooth communication client socket, And use this Bluetooth communication client socket, set up Bluetooth communication with target Bluetooth communication equipment and be connected;

Step S104, when Bluetooth communication connects and disconnects, it is judged that whether Bluetooth communication connects is passive disconnection; As Bluetooth communication is connected as passively disconnecting, then forward step S105 to;As Bluetooth communication is connected as actively disconnecting, Then forward step S106 to;

Step S105, recovers the Bluetooth communication with described target Bluetooth communication equipment even within the setting time automatically Connect;

Step S106, deletes Bluetooth communication client socket.

The idiographic flow of each step the following detailed description of the Bluetooth communication method of this preferred embodiment.

In step S101, the target that Bluetooth communication device search is positioned at around this target Bluetooth communication equipment is blue The implementor name of tooth communication equipment, this implementor name can be the title that target Bluetooth communication equipment carries, as equipment is compiled Number grade or user-defined title, such as Samsung 9100 or my wrist-watch etc..User is according to searching subsequently The implementor name of target Bluetooth communication equipment selectes a target Bluetooth communication equipment communicated, and then passes to step Rapid S102.

In step s 102, the target Bluetooth communication equipment that Bluetooth communication device determines to step S101 sends Pairing request, this pairing request is that Bluetooth communication device determines and carries out blue-teeth data with target Bluetooth communication equipment The request of communication.Target Bluetooth communication equipment, according to the pairing request received, generates pairing response, and will This pairing response sends to Bluetooth communication device, and Bluetooth communication device receives the pairing of target Bluetooth communication equipment Response.This pairing response refers to that target Bluetooth communication equipment agrees to that carrying out blue-teeth data with Bluetooth communication device leads to The response of letter.Then pass to step S103.

In step s 103, after Bluetooth communication device receives pairing response, according to default Bluetooth communication association View, such as RFCOMM agreement, generates Bluetooth communication client socket (Bluetooth Socket), and makes Set up Bluetooth communication by this Bluetooth communication client socket with corresponding target Bluetooth communication equipment to connect.

Step S101 may be used without its other party to the process of specifically setting up of the Bluetooth communication connection of step S103 Method, the difference of concrete Bluetooth communication establishment of connection method is not limiting as protection scope of the present invention.

In step S104, Bluetooth communication device can detect whether Bluetooth communication connection disconnects, connection here Disconnection includes actively disconnecting and passively disconnecting, and actively disconnects and refers to that user passes through operation and closes this Bluetooth communication Connect;Passive disconnection refers to that user is not through operation this Bluetooth communication of closedown and connects, but Bluetooth communication dress Put the bluetooth communications range that have left target Bluetooth communication equipment so that Bluetooth communication device cannot be blue with target Tooth communication equipment carries out data communication.Passive disconnection is often the unconscious behavior of user.

Disconnect as Bluetooth communication device detects that Bluetooth communication connects, then may proceed to judge that Bluetooth communication connection is No is passive disconnection, as Bluetooth communication is connected as passively disconnecting, forwards step S105 to, as Bluetooth communication connects Step S106 is then forwarded to for actively disconnecting.

In step S105, Bluetooth communication device detects Bluetooth communication to be connected as passively to disconnect, then setting Automatically recovering in time to be connected with the Bluetooth communication of target Bluetooth communication equipment, concrete Bluetooth communication connects to be built Cube method can comprise the following steps that

Step S1051, sends pairing request to target Bluetooth communication equipment, and receives target Bluetooth communication and set Standby pairing response;

Step S1052, according to pairing response and Bluetooth communication protocol, generates the socket of Bluetooth communication client Word, and use Bluetooth communication client socket, set up Bluetooth communication with target Bluetooth communication equipment and be connected. The accuracy of Bluetooth communication connection establishment can be improved by pairing request and arranging of pairing response.

According to default Bluetooth communication protocol, generate the step of Bluetooth communication client socket as in figure 2 it is shown, Fig. 2 is the flow chart of step S1052 of the first preferred embodiment of the Bluetooth communication method of the present invention.This step Rapid S1052 includes:

Step S201, Bluetooth communication device, according to pairing response, reads the general unique identifier that application is preset (UUID, Universally Unique Identifier), this application be arranged in Bluetooth communication device should With software, this application is preset with general unique identifier.Can strengthen by arranging general unique identifier The safety that Bluetooth communication connects.

Step S202, general unique identifier that Bluetooth communication device reads according to step S1051 and bluetooth Communication protocol, generates Bluetooth communication client socket.

Bluetooth communication client socket is wherein used to set up Bluetooth communication with corresponding target Bluetooth communication equipment Connect specifically, use the Bluetooth communication service of Bluetooth communication client socket and target Bluetooth communication equipment Device socket (BluetoothServerSocket) is set up Bluetooth communication and is connected.Wherein Bluetooth communication service device set Connect word by target Bluetooth communication equipment according to Bluetooth communication protocol generate, concrete generation process as it is shown on figure 3, When Fig. 3 is step S1052 of the first preferred embodiment of the Bluetooth communication method of the present invention, target Bluetooth leads to The operational flowchart of letter equipment.This generation process specifically includes:

Step S301, target Bluetooth communication equipment reads the general unique identifier that application is preset, and this is general only The general unique identifier that one identification code reads with Bluetooth communication device is identical.But in Bluetooth communication device Application software can be identical or different with the application in target Bluetooth communication equipment.

Step S302, target Bluetooth communication equipment according to step S301 read application preset general uniquely Identification code and Bluetooth communication protocol, generate described Bluetooth communication service device socket.So can be preferable Connected by Bluetooth communication and association gets up, i.e. same application on different Bluetooth devices can be led to easily Cross the connection of same Bluetooth communication to carry out data transmission.

So Bluetooth communication client socket of Bluetooth communication device is led to the bluetooth of target Bluetooth communication equipment Telecommunications services device socket has re-established Bluetooth communication connection.

It is connected as failed to set up Bluetooth communication with target Bluetooth communication equipment within the setting time, then deletes bluetooth Communication customer end socket.

In step s 106, Bluetooth communication device detects that Bluetooth communication is connected as active and disconnects, then delete indigo plant Tooth communication customer end socket.

The most i.e. complete the Bluetooth communication process of the Bluetooth communication method of this preferred embodiment.

By repeatedly reconnecting, the Bluetooth communication method of this preferred embodiment ensures that what Bluetooth communication connected stablizes, Simple to operate and communication efficiency is high.

Refer to the flow chart of the second preferred embodiment of the Bluetooth communication method that Fig. 4, Fig. 4 are the present invention. The Bluetooth communication method of this preferred embodiment includes:

Step S401, the implementor name of search surrounding objects Bluetooth communication equipment, and determine one according to user operation Target Bluetooth communication equipment;

Step S402, sends pairing request to target Bluetooth communication equipment, and receives target Bluetooth communication equipment Pairing response;

Step S403, according to pairing response and Bluetooth communication protocol, generates Bluetooth communication client socket, And use this Bluetooth communication client socket, set up Bluetooth communication with target Bluetooth communication equipment and be connected;

Step S404, is connected by Bluetooth communication and carries out data transmission;

Step S405, when Bluetooth communication connects and disconnects, it is judged that whether Bluetooth communication connects is passive disconnection; As Bluetooth communication is connected as passively disconnecting, then forward step S406 to;As Bluetooth communication is connected as actively disconnecting, Then forward step S407 to;

Step S406, recovers to be connected with the Bluetooth communication of target Bluetooth communication equipment within the setting time automatically;

Step S407, deletes Bluetooth communication client socket.

Step S401 of this preferred embodiment to step S403 and the first preferred embodiment step S101 extremely Description in step S103 is same or similar, specifically refers to the associated description in the first preferred embodiment.

In step s 404, the Bluetooth communication connection that Bluetooth communication device is set up by step S403 counts According to transmission.Concrete as it is shown in figure 5, the second preferred embodiment of Bluetooth communication method that Fig. 5 is the present invention The flow chart of step S404.This step S404 includes:

Step S4041, Bluetooth communication device is connected by Bluetooth communication, sends detection data to target Bluetooth Communication equipment, target Bluetooth communication equipment is according to the detection data genaration reply data received.Specifically, Target Bluetooth communication equipment generates reply data according to the byte length of detection data, such as the detection data of agreement Byte length be 4 bytes, then target Bluetooth communication equipment detect detection data byte length be 4 Individual byte (the first setting value), then generate reply data, the most do not generate reply data.

Step S4042, Bluetooth communication device is connected by Bluetooth communication, receives target Bluetooth communication equipment Reply data, and transfer data to target Bluetooth communication equipment according to the transmission of this reply data.According to answer number According to determining the transmission transmitting data, may further ensure that the stability that data are transmitted.

Refer to step S4042 of the second preferred embodiment of the Bluetooth communication method that Fig. 6, Fig. 6 are the present invention Flow chart.The process sending transmission data according to reply data comprises the steps that

Step S601, according to reply data, creates at least one signaling transmission channel and the transmission of at least one data Passage;

Transmission data are divided into the byte length order transmission number less than or equal to the second setting value by step S602 According to this and byte length is more than the communication transmitting data of the second setting value;

Step S603, by signaling transmission channel transmission order transmission data, is transmitted by data transmission channel Communication transmitting data.

Transmission data include that byte length is less than or equal to the second setting value, and data are transmitted in the order such as 512KB etc. And byte length is more than the communication transmitting data of the second setting value.Order transmission data generally comprise data volume Less order data, and communication transmitting data generally comprises the communication data that data volume is bigger.Step S601 Creating multiple transmission channel, order transmission data and communication transmitting data use different transmission channels to carry out Data are transmitted, and owing to order transmission data are transmitted by special transmission channel, can preferably avoid The transmission of the communication transmitting data impact on order transmission data transmission.

Step S405 of this preferred embodiment to step S407 and the first preferred embodiment step S104 extremely Description in step S106 is same or similar, specifically refers to the associated description in the first preferred embodiment.

The most i.e. complete the Bluetooth communication process of the Bluetooth communication method of this preferred embodiment.

The Bluetooth communication method of this preferred embodiment is on the basis of the first preferred embodiment, by detection data And the setting of reply data further increases the stability of data transmission.Use different transmission to lead to simultaneously Road carries out the transmission of different types of data, can preferably avoid the shadow between the transmission of different types of data Ring.Further increase communication efficiency.

The present invention also provides for a kind of Bluetooth communication device, refer to the Bluetooth communication that Fig. 7, Fig. 7 are the present invention The structural representation of the first preferred embodiment of device.The Bluetooth communication device 70 of this preferred embodiment can use First preferred embodiment of above-mentioned Bluetooth communication method is implemented.This Bluetooth communication device 70 includes search Module 71, matching module 72, connection establishment module 73, judge module 74, reconnect module 75 and delete Module 76.Search module 71 for searching for the implementor name of surrounding objects Bluetooth communication equipment 77, and according to Family operation determines a target Bluetooth communication equipment;Matching module 72 is joined for sending to target Bluetooth communication equipment To request, and receive the pairing response of target Bluetooth communication equipment 77;Wherein target Bluetooth communication equipment 77 According to pairing request, generate pairing response;Connection establishment module 73 is for leading to according to pairing response and bluetooth Letter agreement, generates Bluetooth communication client socket, and uses Bluetooth communication client socket, with target Bluetooth communication equipment 77 is set up Bluetooth communication and is connected;Judge module 74 is used for when Bluetooth communication connects and disconnects, Whether judge that Bluetooth communication connects is passive disconnection;Reconnect module 75 to be connected as by dynamic circuit breaker for such as Bluetooth communication Open, then automatically recover to be connected with the Bluetooth communication of described target Bluetooth communication equipment within the setting time;Delete Module 76 is connected as actively disconnecting for such as Bluetooth communication, then delete Bluetooth communication client socket.Wherein This reconnects module 75 specifically for according to pairing response and Bluetooth communication protocol, generation Bluetooth communication client Socket, and use Bluetooth communication client socket, set up Bluetooth communication even with target Bluetooth communication equipment Connect.

Refer to the Bluetooth communication device that Fig. 8, Fig. 8 are the present invention the first preferred embodiment reconnect module Structural representation.This connection establishment module 75 includes that the first identification code reads unit 751, client socket Word signal generating unit 752 and connection establishment unit 753.First identification code reads unit 751 for according to joining To response, read the general unique identifier that application is preset;Client socket signal generating unit 752 is for root The general unique identifier preset according to application and Bluetooth communication protocol, generate Bluetooth communication client socket; Connection establishment unit 753 is for by the indigo plant of Bluetooth communication client socket Yu target Bluetooth communication equipment 77 Tooth communication server socket is set up Bluetooth communication and is connected;Wherein Bluetooth communication service device socket is blue by target Tooth communication equipment 77 generates according to Bluetooth communication protocol.

Refer to the target Bluetooth of the first preferred embodiment of the Bluetooth communication device that Fig. 9, Fig. 9 are the present invention The structural representation of communication equipment.This target Bluetooth communication equipment 77 include second identification code read unit 771, Server socket signal generating unit 772 and reply data signal generating unit 773.Second identification code reads unit 771 for reading the general unique identifier that application is preset;Server socket signal generating unit 772 is for root The general unique identifier preset according to application and Bluetooth communication protocol, generate Bluetooth communication service device socket; Reply data signal generating unit 773, equal to the first setting value is then given birth to for the byte length such as described detection data Become described reply data.

When the Bluetooth communication device 70 of this preferred embodiment uses, it is blue that search module 71 search is positioned at this target The implementor name of the target Bluetooth communication equipment around tooth communication equipment 77.User is according to the target Bluetooth searched The implementor name of communication equipment 77 selectes a target Bluetooth communication equipment 77 communicated.

Matching module 72 sends to match to the target Bluetooth communication equipment 77 that search module 71 determines and asks subsequently Asking, target Bluetooth communication equipment 77, according to the pairing request received, generates pairing response, and by this pairing Response sends to Bluetooth communication device 70, and matching module 72 receives the pairing of target Bluetooth communication equipment 77 should Answer.

Then, after matching module 72 receives pairing response, connection establishment module 73 is led to according to default bluetooth Letter agreement, generates Bluetooth communication client socket (Bluetooth Socket), and uses this Bluetooth communication visitor Family end socket is set up Bluetooth communication and is connected with corresponding target Bluetooth communication equipment 77.

Subsequently determining whether that module 74 can detect whether Bluetooth communication connection disconnects, connection here disconnects and including actively Disconnect and passively disconnect, actively disconnecting and refer to that user passes through operation this Bluetooth communication of closedown and connects;By dynamic circuit breaker Open and refer to that user is not through operation and closes the connection of this Bluetooth communication, but Bluetooth communication device 70 have left mesh The bluetooth communications range of mark Bluetooth communication equipment 77 so that Bluetooth communication device 70 cannot be led to target Bluetooth Letter equipment 77 carries out data communication.Passive disconnection is often the unconscious behavior of user.

Disconnect as judge module 74 detects that Bluetooth communication connects, then judge module 74 may proceed to judge bluetooth Whether communication connection is passive disconnection, disconnects as detected Bluetooth communication to be connected as passively, then reconnects module 75 Automatically recover to be connected with the Bluetooth communication of target Bluetooth communication equipment within the setting time.Certainly here can be direct Use the Bluetooth communication service device socket of existing Bluetooth communication client socket and target Bluetooth communication equipment Word re-establishes Bluetooth communication and connects.

Wherein reconnect module 75 again to set up Bluetooth communication with target Bluetooth communication equipment and be connected and include following step Rapid:

Reconnect module 75 and send pairing request to target Bluetooth communication equipment, and receive target Bluetooth communication equipment Pairing response;The standard of Bluetooth communication connection establishment can be improved by pairing request and arranging of pairing response Really property.

Reconnect the first identification code reading unit 751 of module 75 according to pairing response, default the leading to of reading application With unique identifier (UUID, Universally Unique Identifier), this application is led to for being arranged on bluetooth Application software in T unit 70, is preset with general unique identifier in this application.By arrange general uniquely Identification code can strengthen the safety that Bluetooth communication connects.

The client socket signal generating unit 752 reconnecting module 75 reads unit 751 according to the first identification code The general unique identifier read and Bluetooth communication protocol, generate Bluetooth communication client socket.

Reconnecting module 75 uses Bluetooth communication client socket to build with corresponding target Bluetooth communication equipment 77 Vertical Bluetooth communication connects specifically, use Bluetooth communication client socket and target Bluetooth communication equipment 77 Bluetooth communication service device socket (BluetoothServerSocket) set up Bluetooth communication connect.Wherein blue Tooth communication server socket is generated according to Bluetooth communication protocol by target Bluetooth communication equipment 77, and this generated Journey specifically includes:

Target Bluetooth communication equipment 77 second identification code read unit 771 read application preset general uniquely Identification code, the general unique identifier that this general unique identifier reads with Bluetooth communication device 70 is identical.But It is that the application software in Bluetooth communication device 70 can be identical with the application in target Bluetooth communication equipment 77 or not With.

The server socket signal generating unit 772 of target Bluetooth communication equipment 77 reads single according to the second identification code What unit 771 read applies the general unique identifier and Bluetooth communication protocol preset, and generates described bluetooth and leads to Telecommunications services device socket.So preferably Bluetooth communication can be connected and association gets up, i.e. different blue Same application on tooth equipment can be carried out data transmission by the connection of same Bluetooth communication easily.

The so Bluetooth communication client socket of Bluetooth communication device 70 and target Bluetooth communication equipment 77 Bluetooth communication service device socket establishes Bluetooth communication and connects.

It is connected as failed to set up Bluetooth communication with target Bluetooth communication equipment within the setting time, then deletes bluetooth Communication customer end socket.

Disconnect as detected Bluetooth communication to be connected as actively, then removing module 76 deletes Bluetooth communication client set Connect word.

The most i.e. complete the Bluetooth communication process of the Bluetooth communication device 70 of this preferred embodiment.

The of the specific works principle of the Bluetooth communication device of this preferred embodiment and above-mentioned Bluetooth communication method Description in one preferred embodiment is same or similar, specifically refers to the first preferred of above-mentioned Bluetooth communication method Associated description in embodiment.

By repeatedly reconnecting, the Bluetooth communication device of this preferred embodiment ensures that what Bluetooth communication connected stablizes, Simple to operate and communication efficiency is high.

The structure of the second preferred embodiment that refer to the Bluetooth communication device that Figure 10, Figure 10 are the present invention is shown It is intended to.The Bluetooth communication device of this preferred embodiment can use the second preferred reality of above-mentioned Bluetooth communication method Execute example to implement.This Bluetooth communication device 100 also includes detecting number on the basis of the first preferred embodiment According to sending module 101 and transmission data transmission blocks 102, detection data transmission blocks 101 is for by indigo plant Tooth communicates to connect, and sends detection data to target Bluetooth communication equipment 77;Transmission data transmission blocks 102 is used In being connected by Bluetooth communication, receive the described reply data of target Bluetooth communication equipment 77, and according to response Data send transmission data;Wherein target Bluetooth communication equipment 77 is according to detection data genaration reply data.

Refer to the transmission number of the second preferred embodiment of the Bluetooth communication device that Figure 11, Figure 11 are the present invention Structural representation according to sending module.Transmission data transmission blocks 102 include transmission path establishing unit 111, Transmission data dividing unit 112 and data transmission unit 113;Transmission path establishing unit 111 is for root According to reply data, create at least one signaling transmission channel and at least one data transmission channel;Transmission data are drawn Subdivision 112 for being divided into the byte length order transmission number less than or equal to the second setting value by transmission data According to this and byte length is more than the communication transmitting data of the second setting value;Data transmission unit 113 is used for making to lead to Cross signaling transmission channel transmission order transmission data, transmit communication transmitting data by data transmission channel.

When the Bluetooth communication device 100 of this preferred embodiment uses, detection data transmission blocks 101 is by indigo plant Tooth communicate to connect, send detection data to target Bluetooth communication equipment 77, target Bluetooth communication equipment 77 Reply data signal generating unit 773 is according to the detection data genaration reply data received.Specifically, target is blue Tooth communication equipment 77 generates reply data according to the byte length of detection data, such as the word of the detection data of agreement Save a length of 4 bytes, then target Bluetooth communication equipment 77 detects that the byte length of detection data is 4 Individual byte (the first setting value), then generate reply data, the most do not generate reply data.

Transmission data transmission blocks 102 is connected by Bluetooth communication, receives answering of target Bluetooth communication equipment 77 Answer evidence, and transfer data to target Bluetooth communication equipment 77 according to the transmission of this reply data.According to answer number According to determining the transmission transmitting data, may further ensure that the stability that data are transmitted.

Transmission path establishing unit 111 creates at least one signaling transmission channel and the transmission of at least one data is logical Road;Transmission data are divided by transmission data dividing unit 112;Transmission data include that byte length is less than Equal to the second setting value, order transmission data and byte length such as 512KB etc. are more than the second setting value Communication transmitting data.Order transmission data generally comprise the order data that data volume is less, and communications number The communication data bigger according to generally comprising data volume.Data transmission unit 113 is transmitted by signaling transmission channel Order transmission data, transmit communication transmitting data by data transmission channel, owing to order transmission data are passed through Special transmission channel is transmitted, and can preferably avoid the transmission of communication transmitting data to order transmission number Impact according to transmission.

The specific works principle of the Bluetooth communication device 100 of this preferred embodiment and above-mentioned Bluetooth communication method The second preferred embodiment in description same or similar, specifically refer to the second of above-mentioned Bluetooth communication method Associated description in preferred embodiment.

The Bluetooth communication device of this preferred embodiment is on the basis of the first preferred embodiment, by detection data And the setting of reply data further increases the stability of data transmission.Use different transmission to lead to simultaneously Road carries out the transmission of different types of data, can preferably avoid the shadow between the transmission of different types of data Ring.Further increase communication efficiency.

Below by a specific embodiment, the Bluetooth communication method of the present invention and the concrete of Bluetooth communication device are described Operation principle.Wherein Bluetooth communication device is mobile phone, carries out the target Bluetooth communication equipment of Bluetooth communication therewith For intelligent watch.It comprises the following steps:

Step S1201, the implementor name of mobile phone A search target Bluetooth communication equipment around, then at mobile phone The implementor name of the A display all of target Bluetooth communication equipment searched of screen display: intelligent watch B, hands Machine C and panel computer D.

Step S1202, user selects intelligent watch B as setting up the target Bluetooth communication that Bluetooth communication connects Equipment.

Step S1203, mobile phone A sends pairing request to intelligent watch B, and intelligent watch B receives this and joins To request, and generate pairing response according to this pairing request;Mobile phone A receives the pairing of intelligent watch B subsequently Response.

Step S1204, after mobile phone A receives pairing response, reads the general unique identifier that application is preset UUID, and according to this UUID and default RFCOMM agreement, generate the socket of Bluetooth communication client Word BluetoothSocket.Intelligent watch B also reads the general unique identifier UUID that application is preset simultaneously, And according to UUID and default RFCOMM agreement, generate Bluetooth communication service end socket BluetoothServerSocket。

Step S1205, mobile phone A uses the Bluetooth communication of Bluetooth communication client socket and intelligent watch B Server socket is set up Bluetooth communication and is connected.

Step S1206, before data is transmitted, mobile phone A can send detection data to intelligent watch B, Intelligent watch B can send a reply data to mobile phone A according to these detection data.

Step S1207, after mobile phone A receives reply data, mobile phone A begins through Bluetooth communication and connects Carry out data transmission with intelligent watch B, when carrying out data transmission, order transmission data and communication transmitting data Different transmission channels is used to be transmitted.

Step S1208, in data transmission procedure, mobile phone A can detect whether Bluetooth communication connection disconnects, Disconnecting as Bluetooth communication connects, whether mobile phone A then can determine whether that this Bluetooth communication connects is passive disconnection; As this Bluetooth communication is connected as passively disconnecting, then forward step S1209 to, as this Bluetooth communication is connected as actively Disconnect, then forward step S1210 to.

Step S1209, mobile phone A reconnected once every 3 seconds, repeated to connect 20 times, as after 60 seconds Also do not set up connection, then delete Bluetooth communication client socket, terminate Bluetooth communication process.

Step S1210, owing to user actively disconnects, therefore mobile phone A directly deletes Bluetooth communication client End socket, terminates Bluetooth communication process.

By repeatedly reconnecting, Bluetooth communication method and the Bluetooth communication device of the present invention ensure that Bluetooth communication connects Stablize, communication efficiency is high;Solve the communication effect of existing Bluetooth communication method and Bluetooth communication device The technical problem that rate is relatively low.

Each functional unit in the embodiment of the present invention can be integrated in a processing module, it is also possible to is each Unit is individually physically present, it is also possible to two or more unit are integrated in a module.Above-mentioned integrated Module both can realize to use the form of hardware, it would however also be possible to employ the form of software function module realizes.Institute If stating integrated module using the form realization of software function module and as independent production marketing or use Time, it is also possible to it is stored in a computer read/write memory medium.Storage medium mentioned above can be Read only memory, disk or CD etc..Above-mentioned each device or system, can perform correlation method embodiment In method.

In sum, although the present invention is disclosed above with preferred embodiment, but above preferred embodiment is not In order to limit the present invention, those of ordinary skill in the art, without departing from the spirit and scope of the present invention, All can make various change and retouching, therefore protection scope of the present invention defines in the range of standard with claim.

Claims (14)

1. a Bluetooth communication method, it is characterised in that including:
Set up Bluetooth communication with target Bluetooth communication equipment to be connected;
When described Bluetooth communication connects and disconnects, it is judged that whether described Bluetooth communication connects is passive disconnection;With And
As described Bluetooth communication is connected as passively disconnecting, then automatically recover blue with described target within the setting time The Bluetooth communication of tooth communication equipment connects.
Bluetooth communication method the most according to claim 1, it is characterised in that described within the setting time Automatically the step recovering to be connected with the Bluetooth communication of described target Bluetooth communication equipment includes:
Send pairing request to described target Bluetooth communication equipment, and receive described target Bluetooth communication equipment Pairing response;Wherein said target Bluetooth communication equipment, according to described pairing request, generates described pairing response; And
According to described pairing response and Bluetooth communication protocol, generate Bluetooth communication client socket, and make By described Bluetooth communication client socket, recover to be connected with the Bluetooth communication of described target Bluetooth communication equipment.
Bluetooth communication method the most according to claim 2, it is characterised in that described according to described pairing Response and Bluetooth communication protocol, the step generating Bluetooth communication client socket includes:
According to described pairing response, read the general unique identifier that application is preset;And
The general unique identifier preset according to described application and Bluetooth communication protocol, generate described bluetooth and lead to Letter client socket.
Bluetooth communication method the most according to claim 2, it is characterised in that the described bluetooth of described use Communication customer end socket, the step recovering to be connected with the Bluetooth communication of described target Bluetooth communication equipment includes:
Use described Bluetooth communication client socket, take with the Bluetooth communication of described target Bluetooth communication equipment Business device socket is set up Bluetooth communication and is connected;
Wherein said Bluetooth communication service device socket is pre-according to described application by described target Bluetooth communication equipment If general unique identifier and Bluetooth communication protocol generate.
Bluetooth communication method the most according to claim 1, it is characterised in that described Bluetooth communication method Further comprise the steps of:
Sending detection data extremely described target Bluetooth communication equipment, described target Bluetooth communication equipment is according to described Detection data genaration reply data;And
Receive described reply data, and send transmission data according to described reply data.
Bluetooth communication method the most according to claim 5, it is characterised in that described according to described response Data send the step of transmission data and include:
Create at least one signaling transmission channel and at least one data transmission channel;
Described transmission data are divided into byte length less than or equal to the first setting value order transmission data and Byte length is more than the communication transmitting data of described second setting value;And
By described signaling transmission channel transmission described order transmission data, passed by described data transmission channel Defeated described communication transmitting data.
7. according to the arbitrary described Bluetooth communication method of claim 2-4, it is characterised in that described bluetooth is led to Letter method also includes:
As described Bluetooth communication is connected as actively disconnecting, then delete described Bluetooth communication client socket.
8. a Bluetooth communication device, it is characterised in that including:
Connection establishment module, is connected for setting up Bluetooth communication with described target Bluetooth communication equipment;
Judge module, for when described Bluetooth communication connects and disconnects, it is judged that whether described Bluetooth communication connects Disconnect for passive;And
Reconnect module, be connected as passively disconnecting for such as described Bluetooth communication, then the most extensive within the setting time It is connected with the Bluetooth communication of described target Bluetooth communication equipment again.
Bluetooth communication device the most according to claim 8, it is characterised in that described Bluetooth communication device Also include:
Matching module, for sending pairing request to described target Bluetooth communication equipment, and receives described target The pairing response of Bluetooth communication equipment;Wherein said target Bluetooth communication equipment is according to described pairing request, raw Become described pairing response;
Wherein said reconnect module specifically for, according to described pairing response and Bluetooth communication protocol, generate Bluetooth communication client socket, and use described Bluetooth communication client socket, recover and described target The Bluetooth communication of Bluetooth communication equipment connects.
Bluetooth communication device the most according to claim 9, it is characterised in that described in reconnect module bag Include:
First identification code reads unit, for according to described pairing response, read that application presets general uniquely Identification code;And
Client socket signal generating unit, for the general unique identifier preset according to described application and indigo plant Tooth communication protocol, generates described Bluetooth communication client socket.
11. Bluetooth communication device according to claim 9, it is characterised in that described in reconnect module bag Include:
Connection establishment unit, is used for using described Bluetooth communication client socket, leads to described target Bluetooth The Bluetooth communication service device socket of letter equipment is set up Bluetooth communication and is connected;
Wherein said Bluetooth communication service device socket is pre-according to described application by described target Bluetooth communication equipment If general unique identifier and Bluetooth communication protocol generate.
12. Bluetooth communication device according to claim 8, it is characterised in that described Bluetooth communication fills Put and also include:
Detection data transmission blocks, is used for sending detection data to described target Bluetooth communication equipment;Described mesh Mark Bluetooth communication equipment is according to described detection data genaration reply data;And
Transmission data transmission blocks, is used for receiving described reply data, and sends biography according to described reply data Transmission of data.
13. Bluetooth communication device according to claim 12, it is characterised in that described transmission data are sent out Module is sent to include:
Transmission path establishing unit is logical for creating at least one signaling transmission channel and the transmission of at least one data Road;
Transmission data dividing unit, sets less than or equal to first for described transmission data are divided into byte length The order transmission data of definite value and byte length are more than the communication transmitting data of described second setting value;And
Data transmission unit, for by described signaling transmission channel transmission described order transmission data, passing through Described data transmission channel transmits described communication transmitting data.
14. according to the arbitrary described Bluetooth communication device of claim 9-11, it is characterised in that described bluetooth Communicator also includes:
Removing module, is connected as actively disconnecting for such as described Bluetooth communication, then deletes described Bluetooth communication visitor Family end socket.
CN201510283901.0A 2015-05-28 2015-05-28 Bluetooth communication method and bluetooth communication device CN106303907A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510283901.0A CN106303907A (en) 2015-05-28 2015-05-28 Bluetooth communication method and bluetooth communication device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510283901.0A CN106303907A (en) 2015-05-28 2015-05-28 Bluetooth communication method and bluetooth communication device

Publications (1)

Publication Number Publication Date
CN106303907A true CN106303907A (en) 2017-01-04

Family

ID=57635059

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510283901.0A CN106303907A (en) 2015-05-28 2015-05-28 Bluetooth communication method and bluetooth communication device

Country Status (1)

Country Link
CN (1) CN106303907A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108135033A (en) * 2017-12-19 2018-06-08 维沃移动通信有限公司 A kind of Bluetooth connecting method and mobile terminal

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1860827A2 (en) * 2006-05-24 2007-11-28 Broadcom Corporation Method and system for auto coexistence priority selection for a SCO link
CN101179301A (en) * 2006-11-09 2008-05-14 中兴通讯股份有限公司 Method of implementing automatic enrollment of bluetooth telephone terminal equipment
CN102832975A (en) * 2012-08-14 2012-12-19 华为终端有限公司 Data transmission method, data transmission device and terminal with touch screen
CN103517301A (en) * 2012-06-21 2014-01-15 中兴通讯股份有限公司 Bluetooth communication processing method and device
CN103561479A (en) * 2013-10-17 2014-02-05 东软熙康健康科技有限公司 Bluetooth device communication method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1860827A2 (en) * 2006-05-24 2007-11-28 Broadcom Corporation Method and system for auto coexistence priority selection for a SCO link
CN101179301A (en) * 2006-11-09 2008-05-14 中兴通讯股份有限公司 Method of implementing automatic enrollment of bluetooth telephone terminal equipment
CN103517301A (en) * 2012-06-21 2014-01-15 中兴通讯股份有限公司 Bluetooth communication processing method and device
CN102832975A (en) * 2012-08-14 2012-12-19 华为终端有限公司 Data transmission method, data transmission device and terminal with touch screen
CN103561479A (en) * 2013-10-17 2014-02-05 东软熙康健康科技有限公司 Bluetooth device communication method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108135033A (en) * 2017-12-19 2018-06-08 维沃移动通信有限公司 A kind of Bluetooth connecting method and mobile terminal

Similar Documents

Publication Publication Date Title
KR20140128039A (en) Method And Apparatus For Performing Communication Service
EP2203834B1 (en) Method and device for managing application data in a nfc system
RU2572615C2 (en) Method for wireless communication in local domain and terminal supporting same
US9426184B2 (en) Dockee-centric wireless docking
CN101247610A (en) Method, equipment and system for managing multi-short distance wireless technical communication
JP4902730B2 (en) Remote user interface on Bluetooth devices
KR20140143793A (en) Data redirection for universal serial bus devices
CN103298068B (en) Method and apparatus for finding device within a wireless communication network
US9264104B2 (en) Sharing of information common to two mobile device users over a near-field communication (NFC) link
JP6219501B2 (en) Access control for wireless docking
CN104283843A (en) User login method, device and system
US20100178937A1 (en) Method, System And Device For Grouping Mobile Instant Messaging Contact
JP6293874B2 (en) Wireless docking architecture
DE10220556B4 (en) Remote composition of messages for distributed applications
WO2013130887A2 (en) Integrated messaging
US9800565B2 (en) Method and apparatus of providing messaging service and callback feature to mobile stations
US9060069B2 (en) Apparatus and method for connecting with bluetooth devices in a terminal using audio channel
US20190281435A1 (en) Methods, systems, and devices for enabling multiple radio assisted discovery
EP3116199B1 (en) Wearable-device-based information delivery method and related device
CN102685210B (en) Wireless routing equipment, mobile terminal, management system and method
WO2015058514A1 (en) Nfc data transmission method and device, and terminal device
JP6104388B2 (en) Information processing method, priority information transmission method and apparatus
US9536247B2 (en) System and method for transmitting/receiving data by using a mobile communication terminal in a Zigbee PAN
WO2015024494A1 (en) Application sharing method and device
CN102801656B (en) To achieve instant messaging application state control method, apparatus and system for

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination