Background technology
Development along with hardware technology, various mobile devices are influencing people's life, and smart mobile phone almost becomes the necessary article of people's daily life, MID now, small-sized panel computers etc. are also entering popular life, and Bluetooth function almost becomes the standard configuration of these mobile devices.Data transmission generally can be by the storage card transmission mutually between many equipment, bluetooth transmission and network delivery.The storage card transfer mode needs plug-in card, but some equipment is not supported external storage card, and some equipment plug storage card need be extracted battery and just can carry out.Lead to network mode, then depend on network quality, can't carry out in that no network environment is next, and when transmission large scale file, the transmission time can be longer.
Bluetooth technology is in continuous development, and the performance of bluetooth equipment is all improving constantly, and for example power consumption is more and more lower, and transmission speed is more and more faster.Along with the proposition of bluetooth 4.0 standards of upgrading, bluetooth applications will be more extensive.
But, present bluetooth but very loaded down with trivial details in operating process.All open under the visible situation in bluetooth, the existing mode of bluetooth swap file of using is: need 1 bluetooth equipment, enter the bluetooth interface, the search bluetooth equipment is chosen the equipment that will send then, connects, confirm that then matching code is correct, so far send at select File; Same the opposing party also needs same operation could return file, and this mode is operated too complex.
Along with the proposition of bluetooth 4.0 standards, because Bluetooth power consumption reduces greatly, increasing people will make bluetooth module be in holding state for a long time, a large amount of attachable terminals will occur like this when using bluetooth discovery.At this moment, if the terminal of selecting to connect makes a mistake, also will threaten the safety of data.
In mobile device, need a kind ofly can connect fast and the method for swap data by bluetooth for this reason.
Summary of the invention
Technical problem to be solved by this invention provides a kind of Bluetooth communication method, and Bluetooth communication equipment, can carry out transfer of data by bluetooth reliably rapidly, and operating process is convenient and swift.
For solving the problems of the technologies described above, the technical scheme of Bluetooth communication method of the present invention is, comprises the equipment that has bluetooth module, may further comprise the steps successively:
Steps A renames described equipment, makes in the title of described equipment to include specific character string;
Step B adopts the miscellaneous equipment that comprises same character string or corresponding character string in the bluetooth module search name;
Step C adopts bluetooth module that described equipment and the miscellaneous equipment that searches are connected;
Step D is with the miscellaneous equipment transmission data that connect;
Step e disconnects bluetooth and connects.
Another technical scheme of Bluetooth communication method of the present invention is, comprises the equipment that has bluetooth module, may further comprise the steps successively:
Step a renames described equipment, makes in the title of described equipment to include specific character string;
Step b when including miscellaneous equipment with same character string or corresponding character string sending the request that connects in receiving title, connects with this miscellaneous equipment;
Step c is with the miscellaneous equipment transmission data that connect;
Steps d disconnects bluetooth and connects.
The present invention also provides a kind of Bluetooth communication equipment, and its technical scheme is, comprises bluetooth module, adopts above-mentioned Bluetooth communication method to carry out Bluetooth communication.
The present invention makes the operating process of Bluetooth communication simplify greatly by adopting technique scheme, when guaranteeing reliability and fail safe, has improved the operating efficiency of blue-teeth data transmission.
Embodiment
The invention discloses a kind of Bluetooth communication method, comprise the equipment that has bluetooth module, as shown in Figure 1, may further comprise the steps successively:
Steps A renames described equipment, makes in the title of described equipment to include specific character string.When described equipment is named, perhaps name described equipment with system's automated manner, perhaps name described equipment in the User Defined mode, perhaps mode automatic by system and that User Defined combines is named described equipment.The mode that renames can be to add specific character string in original device name, added specific character string can be before original device name, also can be after original device name, can also be on the ad-hoc location among original device name, because the title that renames has comprised original device name, therefore can be convenient to User Recognition more like this.
Step B adopts the miscellaneous equipment that comprises same character string or corresponding character string in the bluetooth module search name.Described same character string or corresponding character string comprise the character string that data content is identical, and perhaps the identical character string of data format is perhaps passed through specific algorithm process gained result's the character string that data content is identical or data format is identical afterwards.For example, two equipment, title is respectively ABC and DEF.The character string that adds same data content just becomes 123ABC and 123DEF.Perhaps all add the current time, because the data of time may be different, but the data format of time is unified, for example the current time of device A BC is 12: 40: 35, the current time of equipment DEF is 12: 39: 28, their title just becomes 12-40-35ABC and 12-39-28DEF, and it has comprised the character string of same format.Again or, all add content before the title and seemed diverse data * * * * * * and ######, title is become * * * * * * ABC and ######DEF, and * * * * * * can obtain the result that data content is identical or form is identical with ###### through after a certain algorithm process.More than listed only be several examples, every data that can find corresponding relation by specific mode can be mated.
Step C adopts bluetooth module that described equipment and the miscellaneous equipment that searches are connected.
In described step B and step C, with comprising of searching the miscellaneous equipment with same character string or the name of corresponding character string show with tabulation, then by the user select with wherein which or which connect.Perhaps, if only search a miscellaneous equipment that comprises with same character string or the name of corresponding character string within a period of time, then automatic and this miscellaneous equipment connects.
Step D is with the miscellaneous equipment transmission data that connect.Transmission data mode or an equipment is to another equipment one-way transmission data, or bi-directional transfer of data between two equipment.
Among described step B and the step C, if searching a plurality of comprising with the miscellaneous equipment of same character string or the name of corresponding character string does not all connect with these miscellaneous equipments among the step C, then after step C, selected whether to connect with the miscellaneous equipment that is not connected by the user simultaneously, if the user selects, carry out step C and step afterwards thereof simultaneously again.
After the described step C, while repeating step B and step afterwards thereof.Namely when being connected with this miscellaneous equipment and transmitting data, repeat search comprises with the miscellaneous equipment of same character string or the name of corresponding character string and connects, transmits the step of data etc. again.Like this, described equipment can communicate with a plurality of miscellaneous equipments simultaneously.
Step e disconnects bluetooth and connects.
After the described step e, with the title reduction of described equipment.
The invention also discloses another kind of Bluetooth communication method, comprise the equipment that has bluetooth module, as shown in Figure 2, may further comprise the steps successively:
Step a renames described equipment, makes in the title of described equipment to include specific character string.When described equipment is named, perhaps name described equipment with system's automated manner, perhaps name described equipment in the User Defined mode, perhaps mode automatic by system and that User Defined combines is named described equipment.The mode that renames is to add specific character string in original device name.
Described same character string or corresponding character string comprise the character string that data content is identical, and perhaps the identical character string of data format is perhaps passed through specific algorithm process gained result's the character string that data content is identical or data format is identical afterwards.
Step b when including miscellaneous equipment with same character string or corresponding character string sending the request that connects in receiving title, connects with this miscellaneous equipment.
When comprising miscellaneous equipment with the name of same character string or corresponding character string and send the request that connects, this miscellaneous equipment is shown confirm whether agree to connect by the user then.Perhaps when comprising miscellaneous equipment with the name of same character string or corresponding character string and send the request that connects, described equipment automatically and this miscellaneous equipment connect.
Step c is with the miscellaneous equipment transmission data that connect.Transmission data mode or an equipment is to another equipment one-way transmission data, or bi-directional transfer of data between two equipment.
After the described step b, while repeating step b and step afterwards thereof.Namely when being connected with this miscellaneous equipment and transmitting data, duplicate responses is with the miscellaneous equipment search information of same character string or the name of corresponding character string and connect, transmit the step of data etc. again.
Steps d disconnects bluetooth and connects.
After the described steps d, with the title reduction of described equipment.
The invention also discloses a kind of Bluetooth communication equipment, comprise bluetooth module, described Bluetooth communication equipment adopts above-mentioned Bluetooth communication method to carry out Bluetooth communication.
The user searches a plurality of miscellaneous equipments possibly when using bluetooth to search for.And the present invention is by adopting the mode that bluetooth device name is made amendment, can filter out a lot of incoherent equipment targetedly, for example, specific crowd adds specific character string in title, can only select by search like this and have the equipment of these character strings to connect manually or automatically, thereby can improve operating efficiency and the accuracy of Bluetooth transmission.
The method of the invention is used for after as seen the equipment bluetooth is all opened, quick swap data between a plurality of users.
Bluetooth communication equipment can be named automatically by equipment, perhaps by the User Defined title, names the mode that combines that equipment is named automatically again or by user-defined domain equipment.Above naming method can be to add special authentication character before original device name.
The user selects will send or mutual data.
In the bluetooth discovery process, can determine that it is the object that carries out exchanges data by authentication character in the Authentication devices name;
By other equipment of bluetooth discovery, and set up server end SOCKET and monitor designated port, wait for that other equipment connect;
When searching the equipment that meets authentication, implementor name is presented in the optional swap data list of devices;
When the user selects an equipment, perhaps have only an equipment in the list of devices, then obtain the bluetooth MAC Address of this equipment, according to the port numbers of this address and appointment before, to server end SOCKET connection request is proposed;
SOCKET receives connection request when server end, and after confirm connecting, server end SOCKET can continue to monitor new connection, all obtains SOCKET and connects output stream and write data and connect both sides, monitors simultaneously to connect inlet flow.
When writing data, before each segment data, all can add one section check digit, comprise information such as data length, type, data have write and have added the preceding paragraph tail end identification information afterwards at the end, read check information when reading data earlier, obtain data content according to these information again and with data combinations, when reading the tail end sign, stop to read.
The prompting user sends and finishes, and the data that receive are shown.
The present invention adopts said method, compared with prior art, can realize following advantage:
Need not the user and do as manual search, selection equipment, confirm pairing etc. complicated operations, only need simply to click once to send to get final product.
Transmit and receive data and carry out simultaneously, need not a side and send the data that receive again afterwards by the opposing party's transmission, improved the efficient of swap data.
Can realize the exchanges data that two people are above.Select in the tradable list of devices any one equipment can with its swap data, and can carry out exchange with a plurality of equipment simultaneously.
The above only is the strength that is preferably of the present invention, be not in order to limit essence technology contents scope of the present invention, essence technology contents of the present invention is in the claim scope that is defined in application of broad sense, any technology entity or method that other people finish, if it is defined identical with the claim scope of application, also or a kind of change of equivalence, all will be regarded as being covered by among this claim scope.