CN105101061B - A method of Bluetooth communication is realized using AT order - Google Patents
A method of Bluetooth communication is realized using AT order Download PDFInfo
- Publication number
- CN105101061B CN105101061B CN201510483136.7A CN201510483136A CN105101061B CN 105101061 B CN105101061 B CN 105101061B CN 201510483136 A CN201510483136 A CN 201510483136A CN 105101061 B CN105101061 B CN 105101061B
- Authority
- CN
- China
- Prior art keywords
- bluetooth
- spp
- instruction
- target
- order
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The present invention provides a kind of method for realizing Bluetooth communication using AT order.The method for realizing Bluetooth communication using AT order includes: the pre-defined AT command set with SPP function, wherein the AT command set includes bluetooth equipment scan instruction, bluetooth equipment binding instruction, SPP link establishment instruction and SPP data transfer instruction;Bluetooth equipment around is scanned by the bluetooth equipment scan instruction, and generates bluetooth equipment list;The selection target bluetooth equipment in the bluetooth equipment list, and binding is attached with the target Bluetooth devices by bluetooth equipment binding instruction;By establishing SPP link between SPP link establishment instruction and the target Bluetooth devices;The transmission of SPP data is carried out by the SPP data transfer instruction and using the SPP link and the target Bluetooth devices.
Description
Technical field
The invention mainly relates to wireless communication techniques, particularly, are related to a kind of side that Bluetooth communication is realized using AT order
Method.
Background technique
With the continuous development of communication network, it is daily that the mobile terminal devices such as mobile phone and tablet computer have become people
Essential communications and entertainment tool in life.There is most of existing mobile terminal device bluetooth module to support bluetooth
Communication function;Serial port specification (Serial Port Profile, SPP) is a transport protocol subset of bluetooth protocol repertory,
Its mainly define two equities penetrate between establish Bluetooth communication connect required for basic operation.However, only having small portion at present
The problems such as point bluetooth module supports SPP function, and it is poor there is also ease for use.In view of this, it is necessary to provide one kind
The method of Bluetooth communication is simply and easily realized using AT order.
Summary of the invention
One of purpose of the invention is to provide a kind of utilization AT order realization bluetooth in order to solve the above problem
The method of communication.
The method provided by the invention for realizing Bluetooth communication using AT order, comprising: the pre-defined AT with SPP function
Instruction set, wherein the AT command set includes bluetooth equipment scan instruction, bluetooth equipment binding instruction, SPP link establishment instruction
With SPP data transfer instruction;Bluetooth equipment around is scanned by the bluetooth equipment scan instruction, and generates bluetooth and sets
Standby list;The selection target bluetooth equipment in the bluetooth equipment list, and by the bluetooth equipment binding instruction with it is described
Target Bluetooth devices are attached binding;By establishing SPP between SPP link establishment instruction and the target Bluetooth devices
Link;SPP data biography is carried out by the SPP data transfer instruction and using the SPP link and the target Bluetooth devices
It is defeated.
As a kind of improvement of the method provided by the invention for realizing Bluetooth communication using AT order, the AT command set is also
Including bluetooth module initialization directive, and the method also includes: by the bluetooth initialization directive to the bluetooth module
Carry out initialization process.
As a kind of improvement of the method provided by the invention for realizing Bluetooth communication using AT order, the bluetooth equipment is swept
Retouching instruction is that GTBSCAN is instructed, and is used to indicate bluetooth equipment around institute's even number bluetooth module scans and is given birth to according to scanning result
At corresponding bluetooth equipment list.
As a kind of improvement of the method provided by the invention for realizing Bluetooth communication using AT order, the bluetooth equipment is tied up
Fixed instruction includes that GTBBIND and GTBANS is instructed, and the GTBBIND and GTBANS instruction are respectively used to indicate the bluetooth
Module and target Bluetooth devices actively connect and are passively connected so that the bluetooth module and the target Bluetooth devices into
Row binding.
As it is provided by the invention using AT order realize Bluetooth communication method a kind of improvement, the bluetooth module with
The target Bluetooth devices connect and bind the verifying interaction that process further includes personal identifier.
As a kind of improvement of the method provided by the invention for realizing Bluetooth communication using AT order, the SPP link is built
Vertical instruction is that GTBCONN is instructed, and is used to indicate between the communication module and the target Bluetooth devices bound and establishes SPP chain
Road, the SPP link are used for transmission the Bluetooth communication data based on SPP agreement.
As a kind of improvement of the method provided by the invention for realizing Bluetooth communication using AT order, the SPP data are passed
Defeated instruction includes that GTBSEND is instructed, and is used to indicate the bluetooth module and passes through the SPP link and the target Bluetooth devices
Carry out the Bluetooth communication data transmission based on SPP agreement.
As a kind of improvement of the method provided by the invention for realizing Bluetooth communication using AT order, the AT command set is also
Including SPP link open command, the SPP link open command is GTBBREAK instruction, is used to indicate the bluetooth module
Disconnect the SPP link between the target Bluetooth devices.
As a kind of improvement of the method provided by the invention for realizing Bluetooth communication using AT order, the AT command set is also
It is instructed including print settings, the print settings instruction is that GTBREV is instructed, and is used to indicate the bluetooth equipment
Print settings is carried out to the SPP data from the target Bluetooth devices.
As a kind of improvement of the method provided by the invention for realizing Bluetooth communication using AT order, the AT command set is
Layer operation MMI layer of state machine is instructed by AT and the relevant interface of calling bluetooth protocol repertory is realized to the bluetooth mould downwards
Block carries out corresponding operation.
Compared to the prior art, Bluetooth communication method provided by the invention is mainly AT command set to provide for bluetooth module
The simple directly simulative serial port communication function based on bluetooth, calls above-mentioned AT command set real when carrying out Bluetooth communication
Instruction or data transmit-receive are now carried out by wireless simulation serial ports, so that bluetooth module can support SPP function, and had
Effect reduces the operation difficulty of bluetooth module.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment
Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for
For those of ordinary skill in the art, without creative efforts, it can also be obtained according to these attached drawings other
Attached drawing, in which:
Fig. 1 is the software frame schematic diagram of the method provided by the invention that Bluetooth communication is realized using AT order;
Fig. 2 is that a kind of process of method embodiment provided by the invention that Bluetooth communication is realized using AT order is illustrated
Figure.
Specific embodiment
In order to which the technical problems, technical solutions and beneficial effects solved by the present invention is more clearly understood, below in conjunction with
Accompanying drawings and embodiments, the present invention will be described in further detail.It should be appreciated that specific embodiment described herein is only used
To explain the present invention, it is not intended to limit the present invention.
AT command set is generally used for connection and communication between terminal device and terminal adapter, in mobile phone and base band
The fields such as module meaning is particularly important;Bluetooth communication method provided by the invention is mainly the AT for passing through definition and having SPP function
Instruction set realizes, above-mentioned AT command set can provide simple directly simulative serial port communication function based on bluetooth, in calling
Instruction or the transmitting-receiving of data can be realized by wireless simulation serial ports by stating AT command set, so that bluetooth module can prop up
SPP function is held, and the operation difficulty of bluetooth module is effectively reduced.
The technical solution provided for a better understanding of the invention is introduced provided by the invention real using AT order first below
The software frame of the method for existing Bluetooth communication, referring to Fig. 1, it realizes Bluetooth communication using AT order to be provided by the invention
The software frame schematic diagram of method.The software frame includes following several layers of from bottom to top:
1, base band (BASEBAND);
2, LMP Link Manager Protocol (Link Management Protocol, LMP) and logical link control and adaptation protocol
(Logical Link Control and Adaptation Protocol,L2CAP);
3, serial linear simulation protocol (RFCOMM) and Session Description Protocol (Session Description
Protocol);
4, human-machine interface layer (Man Machine Interface Layer, MMI Layer);
5, AT instruction level (AT CMD Layer).
It is provided by the invention to realize that the method for Bluetooth communication be by defining some tools in AT instruction level using AT order
There is the AT command set of SPP function, to complete the SPP function of bluetooth module, specifically, the AT instruction level can operate described
MMI layers of state machine and downwards call bluetooth protocol repertory relevant interface, and finally realize control bluetooth module initialization,
The operations such as scanning, binding, SPP link establishment and data transmit-receive.
The AT command set with SPP function mainly include GTBOPEN instruction, GTBSCAN instruction, GTBBIND instruction,
GTBANS instruction, GTBCONN instruction, GTBBREAK instruction, GTBSEND instruction, GTBREV instruction etc., below by way of shown in Fig. 2
Embodiment and combine its corresponding Bluetooth communication implementation method, come introduce in above-mentioned AT command set the definition of each instruction and
Effect.
Referring to Fig. 2, the method a kind of embodiment provided by the invention for realizing Bluetooth communication using AT order in fact
Flow diagram, the method for realizing Bluetooth communication using AT order mainly comprise the steps that
Step S1 instructs the initialization for carrying out bluetooth module by GTBOPEN;
The GTBOPEN instruction is mainly used for carrying out the initialization of bluetooth module, the initialization package of the bluetooth module
The offer of chip clock and power supply and enabling for the bluetooth module related peripherals control interface are provided.Step S1 execute at
After function, the enabled and initialization of the bluetooth module is just completed.
Step S2 is scanned bluetooth equipment around by GTBSCAN instruction;
The GTBSCAN instruction is mainly used for scanning surrounding bluetooth equipment and generates corresponding bluetooth equipment according to result
List.It specifically, can be by calling the GTBSCAN instruction come to surrounding after bluetooth module initialization is completed
Bluetooth equipment be scanned, and according to scanning result, corresponding bluetooth equipment list is can be generated in the bluetooth module.
Step S3, by GTBBIND instruction or GTBANS instruction to target Bluetooth devices carry out active connection or by
Dynamic connection;
The GTBBIND and GTBANS instruction is respectively used to actively connect and passively connect with target Bluetooth devices
It connects.In step s3, the bluetooth module selects current bluetooth equipment in the bluetooth equipment list, and by described
Perhaps the GTBANS instruction actively connect with the current foundation or passively connects GTBBIND.The bluetooth module and institute
State target Bluetooth devices connection procedure can also include personal identifier (Personal Identification Number,
PIN verifying interactive process), and after connection completion, the bluetooth module can be with the target Bluetooth devices successfully
Establish binding relationship.
Step S4 establishes SPP link with the target Bluetooth devices by GTBCONN instruction;
GTBCONN instruction is mainly used for establishing SPP link between the target Bluetooth devices bound.Specifically
Ground, after successfully being bound by step S3 and the target Bluetooth devices, the bluetooth module can be by described
SPP link is established between GTBCONN instruction and the target Bluetooth devices, the SPP link can be used to transmit to assist based on SPP
The Bluetooth communication data of view.
Step S5 is instructed by GTBSEND and is carried out data biography using the SPP link and the target Bluetooth devices
It is defeated;
The GTBSEND instruction is mainly used for carrying out the data transmission based on SPP agreement.In the bluetooth module and institute
State after SPP link establishment between target Bluetooth devices completes, the bluetooth equipment can be instructed by the GTBSEND to
The target Bluetooth devices send the Bluetooth communication data based on SPP agreement, wherein the Bluetooth communication data can pass through institute
It states SPP link to be transmitted, and it can be using ASC character string or the data format of HEX;Correspondingly, the bluetooth mould
Block can also receive the Bluetooth communication data that the target Bluetooth devices are sent by the SPP link.
The printing lattice for the Bluetooth communication data that the target Bluetooth devices are sent are arranged by GTBREV instruction by step S6
Formula;
The GTBREV instruction is mainly used for carrying out the print settings for the SPP data that opposite equip. transmission comes.?
Receive Bluetooth communication data based on SPP agreement that the target Bluetooth devices are sent by the SPP link (i.e.
SPP data) after, the bluetooth module can be instructed by the GTBREV and carry out layout to the Bluetooth communication data
Setting, and it is possible to further use the layout set to the indigo plant after print settings completion
Tooth communication data prints.
Step S7 instructs the SPP link disconnected between the target Bluetooth devices by GTBBREAK;
The GTBBREAK instruction is mainly used for disconnecting the SPP chain between the bluetooth module and the target Bluetooth devices
Road.Specifically, after the Bluetooth communication data transmission described based on SPP format is completed, the bluetooth module can pass through institute
It states GTBBREAK instruction and disconnects its SPP link between the target Bluetooth devices.
Come in fact it can be seen from the above description that Bluetooth communication method provided by the invention can use above-mentioned AT command set
The Bluetooth communication based on SPP agreement is carried out between existing bluetooth module and target Bluetooth devices.In a particular embodiment, the AT refers to
Collection is enabled to can further include some other complementary AT instruction, for carrying out other operations to the bluetooth module, than
As described in being also set up by GTBSNAME instruction the bluetooth title of bluetooth module, be arranged by GTBDEV instruction as described in bluetooth mould
Visibility of block etc..
Compared to the prior art, Bluetooth communication method provided by the invention is mainly AT command set to provide for bluetooth module
The simple directly simulative serial port communication function based on bluetooth, calls above-mentioned AT command set real when carrying out Bluetooth communication
Instruction or data transmit-receive are now carried out by wireless simulation serial ports, so that bluetooth module can support SPP function, and had
Effect reduces the operation difficulty of bluetooth module.
The above description is only an embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright description is applied directly or indirectly in other relevant technology necks
Domain is included within the scope of the present invention.
Claims (9)
1. a kind of method for realizing Bluetooth communication using AT order characterized by comprising
The pre-defined AT command set with SPP function, wherein the AT command set includes that bluetooth equipment scan instruction, bluetooth are set
Standby binding instruction, SPP link establishment instruction and SPP data transfer instruction, the AT command set are to instruct layer operation MMI by AT
The state machine of layer simultaneously calls the relevant interface of bluetooth protocol repertory to carry out corresponding operation to bluetooth module to realize downwards;
Bluetooth equipment around is scanned by the bluetooth equipment scan instruction, and generates bluetooth equipment list;
The selection target bluetooth equipment in the bluetooth equipment list, and pass through bluetooth equipment binding instruction and the target
Bluetooth equipment is attached binding;
By establishing SPP link between SPP link establishment instruction and the target Bluetooth devices;
SPP data biography is carried out by the SPP data transfer instruction and using the SPP link and the target Bluetooth devices
It is defeated.
2. the method according to claim 1 for realizing Bluetooth communication using AT order, which is characterized in that the AT command set
It further include bluetooth module initialization directive, and the method also includes: by the bluetooth module initialization directive to the indigo plant
Tooth module carries out initialization process.
3. the method according to claim 2 for realizing Bluetooth communication using AT order, which is characterized in that the bluetooth equipment
Scan instruction is GTBSCAN instruction, is used to indicate the bluetooth module scanning surrounding bluetooth equipment and according to scanning result life
At corresponding bluetooth equipment list.
4. the method according to claim 1 for realizing Bluetooth communication using AT order, which is characterized in that the bluetooth equipment
Binding instruction includes that GTBBIND and GTBANS is instructed, and the GTBBIND and GTBANS instruction are respectively used to indicate the indigo plant
Tooth module actively connect with target Bluetooth devices and passively be connected, so that the bluetooth module and the target Bluetooth devices
It is bound.
5. the method according to claim 4 for realizing Bluetooth communication using AT order, which is characterized in that the bluetooth module
It is interacted with the verifying that process further includes personal identifier that connects and binds of the target Bluetooth devices.
6. the method according to claim 1 for realizing Bluetooth communication using AT order, which is characterized in that the SPP link
Establishing instruction is that GTBCONN is instructed, and is used to indicate between the bluetooth module and the target Bluetooth devices bound and establishes SPP
Link, the SPP link are used for transmission the Bluetooth communication data based on SPP agreement.
7. the method according to claim 1 for realizing Bluetooth communication using AT order, which is characterized in that the SPP data
Transmission instruction includes that GTBSEND is instructed, and is used to indicate the bluetooth module and is set by the SPP link with the target Bluetooth
It is standby to carry out the Bluetooth communication data transmission based on SPP agreement.
8. the method according to claim 1 for realizing Bluetooth communication using AT order, which is characterized in that the AT command set
It further include SPP link open command, the SPP link open command is GTBBREAK instruction, is used to indicate the bluetooth mould
Block disconnects the SPP link between the target Bluetooth devices.
9. the method according to claim 1 for realizing Bluetooth communication using AT order, which is characterized in that the AT command set
It further include print settings instruction, the print settings instruction is that GTBREV is instructed, and is used to indicate the bluetooth mould
Block carries out print settings to the SPP data from the target Bluetooth devices.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510483136.7A CN105101061B (en) | 2015-08-07 | 2015-08-07 | A method of Bluetooth communication is realized using AT order |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510483136.7A CN105101061B (en) | 2015-08-07 | 2015-08-07 | A method of Bluetooth communication is realized using AT order |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105101061A CN105101061A (en) | 2015-11-25 |
CN105101061B true CN105101061B (en) | 2019-05-24 |
Family
ID=54580418
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510483136.7A Active CN105101061B (en) | 2015-08-07 | 2015-08-07 | A method of Bluetooth communication is realized using AT order |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105101061B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105978606B (en) * | 2016-07-22 | 2018-11-16 | 青岛海信电器股份有限公司 | Bluetooth equipment remote communication method, bluetooth equipment and client |
CN106385273B (en) * | 2016-09-13 | 2018-08-07 | 北京叮叮关爱科技有限公司 | Bluetooth communication based on response type and Bluetooth communication method |
CN109802705B (en) * | 2019-01-31 | 2021-07-06 | 慧翰微电子股份有限公司 | Automobile or industrial data transmission system based on BT5 |
CN111131591A (en) * | 2019-12-31 | 2020-05-08 | 中科创达软件股份有限公司 | Voice output device setting method, HF device, AG device, and storage medium |
CN113873483B (en) * | 2021-08-30 | 2023-04-28 | 宁波三星医疗电气股份有限公司 | Bluetooth module setting, checking and managing method of energy controller |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN201523406U (en) * | 2009-10-20 | 2010-07-07 | 中国华录集团有限公司 | Device using Bluetooth headset for dialing |
CN102025401A (en) * | 2009-09-11 | 2011-04-20 | 希姆通信息技术(上海)有限公司 | Method for realizing Bluetooth technology on wireless communication module |
CN201854280U (en) * | 2010-09-29 | 2011-06-01 | 东南大学 | Bluetooth-based RS232 data wireless forwarding device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7689168B2 (en) * | 2006-03-30 | 2010-03-30 | Sony Ericsson Mobile Communications Ab | Remote user interface for Bluetooth™ device |
-
2015
- 2015-08-07 CN CN201510483136.7A patent/CN105101061B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102025401A (en) * | 2009-09-11 | 2011-04-20 | 希姆通信息技术(上海)有限公司 | Method for realizing Bluetooth technology on wireless communication module |
CN201523406U (en) * | 2009-10-20 | 2010-07-07 | 中国华录集团有限公司 | Device using Bluetooth headset for dialing |
CN201854280U (en) * | 2010-09-29 | 2011-06-01 | 东南大学 | Bluetooth-based RS232 data wireless forwarding device |
Also Published As
Publication number | Publication date |
---|---|
CN105101061A (en) | 2015-11-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105101061B (en) | A method of Bluetooth communication is realized using AT order | |
CN103200615B (en) | A kind of method and device carrying out transfer of data in a communication network | |
CN103927654B (en) | A kind of mobile terminal contacts the means of communication, device and method of payment with POS | |
CN110050479A (en) | Handle the method and device of wireless spread-spectrum technology failure | |
US20130157566A1 (en) | Information processing terminal apparatus and method for controlling information processing terminal apparatus | |
CN202587118U (en) | Wireless fixed-line phone with WLAN access function | |
CN105657866A (en) | Mobile terminal and communication method of mobile terminal | |
CN108419226A (en) | A kind of method and bluetooth equipment connected between bluetooth equipment | |
CN106559086A (en) | Mobile terminal and wireless communications method | |
CN106658372A (en) | Low-power-consumption data transmission method and system, transmitting equipment, and receiving equipment | |
CN107171910A (en) | Intelligent home device and its with network method, router, intelligent domestic system | |
CN103052175B (en) | Mobile terminal and the application display method of mobile terminal | |
CN104159223A (en) | Identification method for relay communication user | |
CN101227362B (en) | Wireless personal area network access method | |
CN106030560A (en) | Automatic internet sharing | |
CN105993160A (en) | Method, apparatus, and computer readable medium for switching between lower energy and higher energy wireless communication techniques | |
CN101631371A (en) | Zero delay switching method of wireless access points | |
CN109392056A (en) | A kind of method, base station and the terminal of terminal access core net | |
CN104105218A (en) | Method and system for achieving Android system mobile phone hotspot WPS connection | |
CN103313292B (en) | Inter-system measuring method based on single baseband chip dual link framework | |
CN107182026A (en) | Information transferring method and device based on low-power consumption bluetooth | |
CN110324907A (en) | A kind of service bearer configuration method and device | |
JP2013046240A (en) | Radio communication device | |
CN103457640A (en) | Method and system for rapid data transmission and mobile terminals | |
CN107222937A (en) | A kind of data transmission method, device and terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |