AT Commands For BT
No | Command | Description |
F2501 | AT+BTINIT | Init Bluetooth service |
F2502 | AT+BTTERM | Stop Bluetooth service |
F2503 | AT+BTPOWER | Open/Close Bluetooth |
F2504 | AT+BTHOST | Get or Set host name |
F2505 | AT+BTSCAN | Scan BT devices |
F2506 | AT+BTPAIR | Pair with other BT device |
F2507 | AT+BTPAIRED | Get Paired BT devices |
F2508 | AT+BTUNPAIR | Unpair with the paired BT device |
F2509 | AT+BTOPPREG | OPP Register |
F2510 | AT+BTOPPSEND | OPP send file |
F2511 | +BTOPPRECVING | OPP receive file notification |
F2512 | AT+BTOPPACCEPT | OPP accept or refuse received file |
F2513 | AT+BTGATTREG | GATT register |
F2514 | AT+BTGATTCRESRV | GATT create service |
F2515 | AT+BTGATTCRECHAR | GATT create service characteristic |
F2516 | AT+BTGATTCRECHARDES | GATT create service characteristic description |
F2517 | AT+BTGATTSTARTSRV | GATT start/stop service |
F2518 | AT+BTGATTSTARTADV | GATT start advertisement |
F2519 | AT+BTGATTDELSRV | GATT delete service |
F2520 | +BTGATTCONN | GATT client connect status |
F2521 | +BTGATTWRIND | GATT receive client write request |
F2522 | AT+BTGATTWRCFM | GATT response to BTGATTWRIND |
F2523 | +BTGATTREADIND | GATT receive client read request |
F2524 | AT+BTGATTREADCFM | GATT response to BTGATTREADIND |
F2525 | AT+BTGATTNOTIFY | GATT send notification to client |
F2501 AT+BTINIT Init Bluetooth service
E) AT+BTINIT |
a) If init Bluetooth service successfully: OK b) If failed: ERROR |
Example |
AT+BTINIT OK |
NOTE
It must be the first of all the Bluetooth AT commands to be called.If we want to power on BT,
we should execute this command before we execute “AT+BTPOWER=1”.
F2502 AT+BTTERM Stop Bluetooth service
E) AT+BTINIT |
a) If stop Bluetooth service successfully: OK b) If failed: ERROR |
Example |
AT+BTTERM OK |
NOTE
It must be the last of all the Bluetooth AT commands to be called.If we want to power off BT,
we should execute this command before we execute “AT+BTPOWER=0”.
F2503 AT+BTPOWER Open/Close BT
T) AT+BTPOWER=? |
+BTPOWER: (0-1) OK |
R) AT+BTPOWER? |
+BTPOWER: <status> OK |
W) AT+BTPOWER=<flag> |
OK +BTPOWER: <status> or OK or ERROR |
<flag > | 1 Start BT Application 0 Stop BT Application |
<status> | 0 BT power is off 1 BT power is on |
Example |
AT+BTPOWER=? +BTPOWER: (0-1) OK AT+BTPOWER? +BTPOWER: 0 OK AT+BTPOWER=1 OK +BTPOWER: 1 |
F2504 AT+BTHOST Get or Set Host Name
R) AT+BTHOST? |
+BTHOST: <host_name>,<host mac addr> OK |
W) AT+BTHOST=<”btname”> |
OK or ERROR |
<btname> | new Bluetooth name string. Support Chinese characters. Max length 64 |
<host name> | Current Bluetooth host name. |
<host mac addr> |
Bluetooth mac address format(xx:xx:xx:xx:xx:xx), x(0-9,A-F) The default value is SIM7600_BT_xxxxxx(mac addr 3 lower bytes). |
Example |
AT+BTHOST? OK +BTHOST: MDM_Fluoride, 22:22:AE:4A:A2:E8 AT+BTHOST=”SIM8200_BT” OK |
F2505 AT+BTSCAN Scan BT Devices
T) AT+BTSCAN=? |
+BTSCAN: (0-1) OK |
W) AT+BTSCAN=<”doscan”> |
OK +BTSCAN: <scan status>,<BT name>,<Mac Addr>,<RSSI level> +BTSCAN: <scan status>,<BT name>,<Mac Addr>,<RSSI level> […]] +BTSCAN: 1 //scan end flag |
<doscan> |
0 stop scan 1 scan |
<scan status> | 0 scanning 1 scan ended |
<BT name> | The bluetooth name of remote device. |
<Mac Addr> | The bluetooth mac address of the remote device. |
<RSSI level> | the rssi level of the device |
Example |
AT+BTSCAN=? +BTSCAN: (0-1) OK AT+BTSCAN=1 OK +BTSCAN: 0, MiKettle, 78:11:DC:C0:E6:83, 173 +BTSCAN: 0, LE-Bose wei, 4C:87:5D:CA:4D:37, 175 +BTSCAN: 0,小米手机, 7C:D6:61:B8:68:D0, 179 +BTSCAN: 0, ofo, F7:51:3B:1F:AF:B5, 163 +BTSCAN: 1 |
F2806 AT+BTPAIR Pair With Other BT Device
T) AT+BTPAIR=? |
+BTPAIR: 0,(BT Address) Or +BTPAIR: 1,(0-1) OK |
W) AT+BTPAIR=0,”<Mac Addr>” |
OK +BTPAIRING: <device name>,<device mac>,<passkey> or +BTPAIR: 0 or ERROR |
W) AT+BTPAIR=1,<accept> |
OK +BTPAIR: <device name>,<device mac> or +BTPAIR: 0 or ERROR |
<Mac Addr> | The bluetooth mac address of the remote device. |
<device name> | The bluetooth name of connected device |
<device mac> | The bluetooth mac address of the connected device |
<passkey> | Random generate 6 numberic code |
<accept> |
0 reject 1 accept |
Example |
AT+BTPAIR=0,”12:31:31:23:12:31″ OK +BTPAIRING: Acer E380, 12:31:31:23:12:31, 412711 AT+BTPAIR=1,1 OK +BTPAIR: Acer E380, 12:31:31:23:12:31 |
NOTE
The URC “+BTPAIR: 0” indicates pairing failed.
F2507 AT+BTPAIRED Get Paired With BT Device
R) AT+BTPAIRED? |
OK +BTPAIRED: <index>,[<BT name>,<MAC addr>] |
<index> | The index of current bond device |
<BT name> | The bluetooth name of paired device |
<MAC addr> | The bluetooth mac address of the paired device |
Example |
AT+BTPAIRED? OK +BTPAIRED: 1, Acer E380, 12:31:31:23:12:31 |
F2508 AT+BTUNPAIR Unpair With the Other BT Device
T) AT+BTUNPAIR=? |
+BTUNPAIR: (BT Address) OK |
W) AT+BTUNPAIR=<paired index> |
+BTUNPAIR: <status> OK |
<Mac Addr> | The bluetooth mac address of the paired device. |
<status> |
0 fail 1 success |
Example |
AT+BTUNPAIR=”12:31:31:23:12:31″ +BTUNPAIR: 1 OK |
F2509 AT+BTOPPREG OPP Register
E) AT+BTOPPREG |
+BTOPPREG: <status> OK |
<status> |
0 fail 1 success |
Example |
AT+BTOPPREG +BTOPPREG: 1 OK |
F2510 AT+BTOPPSEND OPP send file
T) AT+BTOPPSEND=? |
+BTOPPSEND: (BT Address),(File Name) OK |
W) AT+BTOPPSEND=”<Mac Addr>”,<file name> |
OK +BTOPPSEND: <status> |
<Mac Addr> | The bluetooth mac address of the paired device. |
<file name> | The file name which you want to send |
<status> |
0 fail 1 success |
Example |
AT+BTOPPSEND=”12:31:31:23:12:31″,”IMG_20130110_004138.jpg” OK +BTOPPSEND: 1 |
F2511 +BTOPPRECVING OPP receive file notification
T) AT+BTSPPCONN=? | +BTOPPRECVING: <file name> |
<file name> | The received file name |
Example | +BTOPPRECVING: IMG_20130110_004138.jpg |
F2512 AT+BTOPPACCEPT OPP accept or refuse received file
T) AT+BTOPPACCEPT=? |
+BTOPPACCEPT: (0-1) OK |
T) AT+BTOPPACCEPT=<flag> |
OK +BTOPPRECEIVED: <result> |
<flag> |
1 Accept the received file 0 Refuse the received file |
<result> |
0 fail 1 success |
Example |
+BTOPPRECVING: IMG_20130110_004138.jpg AT+BTOPPACCEPT=1 OK +BTOPPRECEIVED: 1 |
F2513 AT+BTGATTREG GATT Register
T) AT+BTGATTREG=? |
+BTGATTREG: (0-1) OK |
R) AT+BTGATTREG? |
+BTGATTREG: <state> OK |
W) AT+BTGATTREG=<enable> |
OK +BTGATTREG: <state> or +BTGATTERR: <err> ERROR or ERROR |
<state> |
A numeric parameter that identifies the register status. 0 unregistered 1 registered |
<enable> |
A numeric parameter that identifies the register action. 0 enable to unregister 1 enable to register |
<err> | The error code, please refer to chapter 25.3.1 |
Example |
AT+BTGATTREG=? +BTGATTREG: (0-1) OK AT+BTGATTREG=1 OK +BTGATTREG: 1 AT+BTGATTREG? +BTGATTREG: 1 OK |
NOTE
It must be called before all commands about GATT connect and after AT+BTPOWER
F2514 AT+BTGATTCRESRV GATT Create Service
W) AT+BTGATTCRESRV=<uuid> |
OK +BTGATTCRESRV: <result>[,<0Xuuid>] or +BTGATTERR: <err> ERROR or ERROR |
<result> |
A numeric parameter that identifies the create result. 0 fail 1 success |
<uuid> | UUID of this service. A string with hex value. The length can only be 4 or 32. |
<err> | The error code, please refer to chapter 25.3.1 |
Example |
AT+BTGATTCRESRV=1166 OK +BTGATTCRESRV: 1,0X00000000000000000000000000001166 AT+BTGATTCRESRV=3132333435363738393 0616263646566 OK +BTGATTCRESRV: 1,0X31323334353637383930616263646566 |
NOTE
It must be called after AT+BTGATTREG
F2515 AT+BTGATTCRECHAR GATT Create Service Characteristic
W) AT+BTGATTCRECHAR=<uuid>,<property>,<permission> |
OK +BTGATTCRECHAR: <status>,<0Xuuid>,<handle> or +BTGATTERR: <err> ERROR or ERROR |
<result> |
A numeric parameter that identifies the create result. 0 fail 1 success |
<uuid> | UUID of this characteristic. A string with hex value. The length can only be 4 or 32. |
<property> | Properties of this characteristic. Refer to the following Table 1. |
<permission> | Permission of this characteristic. Refer to the following Table 1. |
<handle> | A numeric parameter. characteristic handle |
<err> | The error code, please refer to chapter 25.3.1 |
NOTE
The “*” before Properties and Permission represent not support now.
Table 1: Format Map of Properties and Permission
Properties Format Map | |
Default | 0 |
Broadcast | 1(0x01) |
Read | 2(0x02) |
Write without Response | 4(0x04) |
Write | 8(0x08) |
Notify | 16(0x10) |
Indicate | 32(0x20) |
Signed Write | 64(0x40) |
Extended Properties | 128(0x80) |
Permission Format Map | |
None | 0(0x0000) |
Read | 1(0x0001) |
ReadEncrypted | 2(0x0002) |
ReadEncryptedMitm | 4(0x0004) |
Write | 16(0x0010) |
WriteEncrypted | 32(0x0020) |
WriteEncryptedMitm | 64(0x0040) |
*WriteSigned | 128(0x0080) |
*WriteSignedMitm |
256(0x0100)
|
Example |
AT+BTGATTCRECHAR=1166,8,16 OK +BTGATTCRECHAR: 1,0X00000000000000000000000000001166,58 AT+BTGATTCRECHAR=313233343536373839 30616263646566,8,16 OK +BTGATTCRECHAR: 1,0X31323334353637383930616263646566,60 |
NOTE
It must be called after AT+BTGATTREG. And a maximum of 7 characteristics can be created.
F2516 AT+BTGATTCRECHARDES GATT create Service Characteristic Description
W)AT+BTGATTCRECHARDES =<uuid> |
OK +BTGATTCRECHARDES: <result>[,<0Xuuid>] or +BTGATTERR: <err> ERROR or ERROR |
<result> |
A numeric parameter that identifies the create result. 0 – fail 1 – success |
<uuid> |
UUID of this service characteristic description. A string with hex value. The length can only be 4 or 32. |
<err> | The error code, please refer to chapter 25.3.1 |
Example |
AT+BTGATTCRECHARDES=1166 OK +BTGATTCRECHARDES: 1,0X00000000000000000000000000001166 AT+BTGATTCRECHARDES=31323334353637 383930616263646566 OK +BTGATTCRECHARDES: 1,0X31323334353637383930616263646566 |
NOTE
This command usually follows +BTGATTCRECHAR command whose characteristic’s property is notify or indicate,
and the function of this command is to allow client to config whether accept the notification(indication) or not.
F2517 AT+BTGATTSTARTSRV GATT start/stop service
T) AT+BTGATTSTARTSRV=? |
+BTGATTSTARTSRV: (0-1) OK |
W) AT+BTGATTSTARTSRV=<st ate> |
OK +BTGATTSTARTSRV: <state> or +BTGATTERR: <err> ERROR or ERROR |
<state> |
A numeric parameter that identifies the start/stop service action. 0 stop 1 start |
<err> | The error code, please refer to chapter 25.3.1 |
Example |
AT+BTGATTSTARTSRV=? +BTGATTSTARTSRV: (0-1) OK AT+BTGATTSTARTSRV=1 OK +BTGATTSTARTSRV: 1 AT+BTGATTSTARTSRV=0 OK +BTGATTSTARTSRV: 0 |
NOTE
It must be called before all commands about GATT connect and after AT+BTGATTCRESRV
F2518 AT+BTGATTSTARTADV GATT start advertisement
T) AT+BTGATTSTARTADV=? |
+BTGATTSTARTADV: (0-1) OK |
W) AT+BTGATTSTARTADV=<st ate> |
OK +BTGATTSTARTADV: <state> or +BTGATTERR: <err> ERROR or ERROR |
<state> |
A numeric parameter that identifies the start/stop advertisement action. 0 stop 1 start |
<err> | The error code, please refer to chapter 25.3.1 |
Example |
AT+BTGATTSTARTADV=? +BTGATTSTARTADV: (0-1) OK AT+BTGATTSTARTADV=1 OK +BTGATTSTARTADV: 1 AT+BTGATTSTARTADV=0 OK +BTGATTSTARTADV: 0 |
F2519 AT+BTGATTDELSRV GATT delete service
W) AT+BTGATTDELSRV |
OK +BTGATTDELSRV: <result> or +BTGATTERR: <err> ERROR or ERROR |
<result> |
A numeric parameter that identifies the result. 0 fail 1 success |
<err> | The error code, please refer to chapter 25.3.1 |
Example |
AT+BTGATTDELSRV OK +BTGATTDELSRV: 1 |
NOTE
It must be called after AT+BTGATTCRESRV
F2520 +BTGATTCONN GATT client Connect Status
+BTGATTCONN: <state>,<address> |
<status> |
A numeric parameter that identifies the connect status. 1 connected 0 disconnected |
<address> | A string with hex value. the address of connected client. |
Example |
+BTGATTCONN: 1,65:A2:6C:E7:E8:BF +BTGATTCONN: 0,65:A2:6C:E7:E8:BF
|
F2521 +BTGATTWRIND GATT receive Client Write Request
+BTGATTWRIND: <handle>,<data> |
<handle> |
A string with hex value that identifies the characteristic handle, +BTGATTCRECHAR command response returns. |
<data> | A string with hex value. data to be written. |
Example | +BTGATTWRIND: 42,6162636465 |
F2522 AT+BTGATTWRCFM GATT response To BTGATTWRIND
W)AT+BTGATTWRCFM=<state> |
OK +BTGATTWRCFM: <result> or +BTGATTERR: <err> ERROR or ERROR |
<state> |
A numeric parameter that identifies the write action. 0 write successfully Other Not support |
<result> |
A numeric parameter that identifies the result. 0 fail 1 success |
<err> | The error code, please refer to chapter 25.3.1 |
Example |
+BTGATTWRIND: 42,6162636465 AT+BTGATTWRCFM=0 OK +BTGATTWRCFM: 1 |
NOTE
The command act as the response of +BTGATTWRIND,
if the module receives BTGATTWRIND without sending out this command, after a while the connection will be disconnected.
F2523 +BTGATTREADIND GATT receive Client Read Request
+BTGATTREADIND: <handle>,<is_long> |
<handle> |
A string with hex value that identifies the characteristic handle, +BTGATTCRECHAR command response returns. |
<is_long> |
A numeric parameter that identifies if there is a following request. 0 no following request 1 have following request |
Example | +BTGATTREADIND: 42,0 |
F2524 AT+BTGATTREADCFM GATT response To BTGATTREADIND
W) AT+BTGATTREADCFM=<state>,<data> |
OK +BTGATTREADCFM: <result> or +BTGATTERR: <err> ERROR or ERROR |
<state> |
A numeric parameter that identifies the read action. 0 read success Others not support, invalid parameter |
<data> | A string value. Data need to be read(max length is 90). |
<result> |
A numeric parameter that identifies the create result. 0 fail 1 success |
<err> | The error code, please refer to chapter 25.3.1 |
Example |
+BTGATTREADIND: 42,0 AT+BTGATTREADCFM=0,23456 OK +BTGATTREADCFM: 1 |
NOTE
The command act as the response of +BTGATTREADIND,
if the module receives BTGATTREADIND without sending out this command, after a while the connection will be disconnected.
F2525 AT+BTGATTNOTIFY GATT send Notification To Client
W) AT+BTGATTNOTIFY=<handle>,<data> |
OK +BTGATTNOTIFY: <result> or +BTGATTERR: <err> ERROR or ERROR |
<handle> |
A string with hex value that identifies the characteristic handle, +BTGATTCRECHAR command response returns. |
<data> | A string value. notify data to be send to client(max length is 20). |
<result> |
A numeric parameter that identifies the create result. 0 fail 1 success |
Example |
AT+BTGATTNOTIFY=58,456 OK +BTGATTNOTIFY: 1 |