Bluetooth AT Commands
Note
The Bluetooth AT Commands is disabled by default.
Refer to Configuring SDK (menuconfig) to enter CONFIG BT
settings, check Enable BT
to enable Bluetooth functionality, then check BLE Transfer Module
to activate the transfer module.
Only commands starting with AT+BTDEMO are supported before transfer module initialization. Other commands require transfer module initialization first.
AT+BTDEMO=transfer_module
Description
Initialize or deinitialize the transfer module.
Command
AT+BTDEMO=transfer_module,<op>
Response
OK
Parameters
<op>: Initialize or deinitialize transfer module.
0: Deinitialize transfer module.
1: Initialize transfer module.
AT+BTDEMO=transfer_module,get_name
Description
Get device name.
Command
AT+BTDEMO=transfer_module,get_name
Response
+BTDEMO:transfer_module,get_name,<name>
OK
Parameters
<name>: Device name.
AT+BTDEMO=transfer_module,set_name
Description
Set device name.
Command
AT+BTDEMO=transfer_module,set_name,<name>
Response
OK
Parameters
<name>: The device name to be set.
The length of device name should not exceed 40.
Note
This command only sets the device name. To modify the name in advertising data, use AT+BLEGAP=adv_data[,<data>]
before starting advertising.
AT+BTDEMO=transfer_module,get_uuid
Description
Get UUID.
Command
AT+BTDEMO=transfer_module,get_uuid,<attr>
Response
+BTDEMO:transfer_module,get_uuid,<attr>,<uuid>
OK
Parameters
<attr>: Attribute index.
0: Primary service.
1: Read characteristic.
2: Write characteristic.
3: Notify characteristic.
4: Indicate characteristic.
<uuid>: UUID of the attribute.
AT+BTDEMO=transfer_module,set_uuid
Description
Set UUID before initializing transfer module.
Command
AT+BTDEMO=transfer_module,set_uuid,<attr>,<uuid>
Response
OK
Parameters
<attr>: Attribute index.
0: Primary service.
1: Read characteristic.
2: Write characteristic.
3: Notify characteristic.
4: Indicate characteristic.
<uuid>: UUID to set.
Example
AT+BTDEMO=transfer_module,set_uuid,1,0xd005
OK
AT+BTDEMO=transfer_module,read_val
Description
Set read value for read characteristic.
Command
AT+BTDEMO=transfer_module,read_val,<length>,<data>
Response
OK
Parameters
<length>: Length of read value.
The maximum value is 30.
<data>: Hexadecimal read value without 0x prefix (e.g. 112233445566778899aabb).
AT+BLEGAP=addr
Description
Get BT MAC address.
Command
AT+BLEGAP=addr
Response
+BLEGAP:addr,<addr>(<addr_type>)
OK
Parameters
<addr>: Local address string (e.g. 00:11:22:33:44:55).
<addr_type>: Address type string.
public: Public address
random: Random address
public-id: Public identity address type
random-id: Random identity address type
AT+BLEGAP=rand_addr
Description
Set BT random address.
Command
AT+BLEGAP=rand_addr,<addr>[,<type>]
Response
+BLEGAP:rand_addr,<rand_addr>
OK
Parameters
<addr>: Random address to set.
Address string (e.g. 001122334455)
<type>: Address type.
0: Static random device address.
1: Non resolvable random device address.
2: Resolvable random device address.
<rand_addr>: Successfully set random address.
Address string (e.g. 00:11:22:33:44:55)
AT+BLEGAP=mtu_size
Description
Get MTU size.
Command
AT+BLEGAP=mtu_size,<conn_handle>
Response
+BLEGAP:mtu_size,<conn_handle>,<mtu_size>
OK
Parameters
<conn_handle>: Connection handle.
<mtu_size>: MTU size of the connection.
AT+BLEGAP=set_mtu
Description
Set MTU size before establishing connection.
Command
AT+BLEGAP=set_mtu,<mtu_size>
Response
OK
Parameters
<mtu_size>: MTU size value.
AT+BLEGAP=adv
Description
Start or stop advertising.
Command
AT+BLEGAP=adv,<op>[,<type>,<own_addr_type>,<filter_policy>[,<peer_addr_type>,<peer_addr>[,<interval_min>,<interval_max>,<channel_map>]]]
Response
OK
Parameters
<op>: Advertising option.
1: Start advertising.
0: Stop advertising.
<type>: Advertisement type.
0: Connectable undirected advertisement.
1: Connectable high duty cycle directed advertisement.
2: Scannable undirected advertisement.
3: Non-Connectable undirected advertisement.
4: Connectable low duty cycle directed advertisement.
<own_addr_type>: Local address type.
0: Public address.
1: Random address.
2: Public identity address type.
3: Radom identity address type.
<filter_policy>: Advertising filter policy.
0: Process scan and connection requests from any device.
1: Process connection requests from any device, scan requests only from whitelist.
2: Process scan requests from any device, connection requests only from whitelist.
3: Process scan and connection requests only from devices in the whitelist.
<peer_addr_type>: Peer address type.
0: Public address.
1: Random address.
2: Public identity address type.
3: Random identity address type.
<peer_addr>: Peer device address.
<interval_min>: Minimum advertising interval.
[0x20, 0x4000]
Minimum advertising interval = <interval_min> * 0.625 ms, range 20ms to 10.24s.
<interval_max>: Maximum advertising interval.
[0x20, 0x4000]
Maximum advertising interval = <interval_max> * 0.625 ms, range 20ms to 10.24s.
<channel_map>: Advertising channel map.
0x01: Advertisement channel 37.
0x02: Advertisement channel 38.
0x04: Advertisement channel 39.
0x07: All advertisement channel enabled.
AT+BLEGAP=get_adv_param
Description
Get advertising Parameters.
Command
AT+BLEGAP=get_adv_param
Response
+BLEGAP:get_adv_param,<type>,<own_addr_type>,<filter_policy>,<peer_addr_type>,<peer_addr>,<interval_min>,<interval_max>,<channel_map>
OK
Parameters
Refer to Parameters.
AT+BLEGAP=adv_data
Description
Set advertising data before starting advertising.
Command
AT+BLEGAP=adv_data[,<data>]
Response
OK
Parameters
<data>: Advertising data.
If <data> is not provided, the default advertising data will be used.
Example
AT+BLEGAP=adv_data,02010508095265616c74656b
OK
//02: Length of flags section
//01: Type is flags
//05: LE limited discoverable mode and BR/EDR not supported
//08: Length of local name section
//09: Type is complete local name
//5265616c74656b: ASCII value of the string "Realtek", used as the local name in the advertising data
AT+BLEGAP=scan
Description
Start or stop scanning.
Command
AT+BLEGAP=scan,<op>
Response
Start Scanning Response
OK
+BLEGAP:scan,<addr>,<event_type>,<rssi>,<adv_report_len>
Stop Scanning Response
OK
Parameters
<op>: Scan option
1: Start scanning.
0: Stop scanning.
<addr>: Advertising address
<event_type>: Advertising event type.
0: Connectable undirected advertising (ADV_IND)
1: Connectable directed advertising (ADV_DIRECT_IND)
2: Scannable undirected advertising (ADV_SCAN_IND)
3: Non-connectable undirected advertising (ADV_NONCONN_IND)
4: Scan response (SCAN_RSP)
<rssi>: RSSI.
[-127, 20], 127 indicates RSSI not available.
<adv_report_len>: Length of the advertising data.
AT+BLEGAP=scan_param
Description
Set scan parameters before starting to scan.
Command
AT+BLEGAP=scan_param[,<type>,<own_addr_type>,<filter_policy>,<duplicate_opt>[,<interval>,<window>]]
Response
OK
Parameters
<type>: Scan type.
0: Passive scan.
1: Active scan.
<own_addr_type>: Local address type.
0: Public address.
1: Random address.
2: Public identity address type.
3: Random identity address type.
<filter_policy>: Scan filter policy.
0: Accept all advertising packets except directed advertising packets not aimed at this device (Default).
1: Only accept advertising packets from devices in the whitelist. Directed advertising packets not aimed at this device will be ignored.
2: Accept all advertising packets except directed advertising packets whose initiator’s identity address is not aimed at this device.
3: Accept all advertising packets except directed advertising packets whose advertiser’s identity address is not in the whitelist and initiator’s identity address is not aimed at this device.
<duplicate_opt>: Scan duplicate filtering option.
0: Disable duplicate filtering.
1: Enable duplicate filtering.
2: Enable duplicate filtering, reset for each scanning period.
<interval>: Scan interval.
[0x4, 0x4000]
Scan interval = <interval> * 0.625 ms, range from 2.5ms to 10.24s.
<window>: Scan window.
[0x4, 0x4000]
Scan window = <window> * 0.625 ms, range from 2.5ms to 10.24s.
Note
The scan interval cannot be smaller than the scan window.
AT+BLEGAP=get_scan_param
Description
Get scan Parameters.
Command
AT+BLEGAP=get_scan_param
Response
+BLEGAP:get_scan_param,<scan_type>,<local_addr_type>,<filter_policy>,<duplicate_opt>,<interval>,<window>
OK
Parameters
Refer to Parameters.
AT+BLEGAP=scan_rsp
Description
Set scan response data before starting the scan.
Command
AT+BLEGAP=scan_rsp[,<data>]
Response
OK
Parameters
<data>: Scan response data.
If <data> is not provided, the default scan response data will be used.
Example
AT+BLEGAP=scan_rsp,03194000
OK
//03: Length of appearance section
//19: Advertising data type appearance
//4000: Appearance generic phone(0x0040)
AT+BLEGAP=conn
Description
Create a connection.
Command
AT+BLEGAP=conn,<peer_addr_type>,<peer_addr>[,<own_addr_type>, <filter_policy>[,<scan_interval>,<scan_window>,<conn_interval_min>,<conn_interval_max>,<conn_latency>,<supv_timeout>]]
Response
+BLEGAP:conn,<conn_handle>,<peer_device_addr>(<peer_device_addr_type>)
OK
Note
If the BLE connection is successfully established, the peer device will receive the following prompt:
[$]+BLEGAP:conn,<conn_handle>,<peer_device_addr>
Parameters
<peer_addr_type>: Peer address type.
0: Public address.
1: Random address.
2: Public identity address type.
3: Random identity address type.
<own_addr_type>: Local address type.
0: Public address.
1: Random address.
2: Public identity address type.
3: Random identity address type.
<filter_policy>: Connection filter policy.
0: Filter without whitelist.
1: Filter with whitelist.
<scan_interval>: Scan interval.
[0x4, 0x4000]
Scan interval = <scan_interval> * 0.625 ms, range from 2.5ms to 10.24s.
<scan_window>: Scan window.
[0x4, 0x4000]
Scan window = <scan_window> * 0.625 ms, range from 2.5ms to 10.24s.
Scan interval cannot be smaller than scan window.
<conn_interval_min>: Minimum connection interval.
[0x6, 0x0C80]
Minimum connection interval = <conn_interval_min> * 1.25 ms, range from 7.5ms to 4s.
<conn_interval_max>: Maximum connection interval.
[0x6, 0x0C80]
Maximum connection interval = <conn_interval_max> * 1.25 ms, range from 7.5ms to 4s.
<conn_latency>: Slave connection latency (number of connection events).
[0, 0x01F3]
<supv_timeout>: Supervision timeout for the LE link.
[0xa, 0x0C80]
Supervision timeout = <supv_timeout> * 10 ms, range from 100ms to 32s.
<conn_handle>: Connection handle.
<peer_device_addr>: Peer device address string, e.g. 00:11:22:33:44:55.
<peer_device_addr_type>: Peer device address type string.
public: Public address
random: Random address
public-id: Public identity address type
random-id: Random identity address type
Note
The scan interval cannot be smaller than the scan window.
Example
AT+BLEGAP=conn,0,701d080bdc77
+BLEGAP:conn,0,17,70:1D:08:0B:DC:77(public)
OK
//Peer device
[$]+BLEGAP:conn,23,00:E0:4C:87:22:3D(public)
AT+BLEGAP=disconn
Description
Terminate a connection.
Command
AT+BLEGAP=disconn,<conn_handle>
Response
OK
Note
If the BLE connection is terminated, the peer device will show the following prompt:
[$]+BLEGAP:disconn,<conn_handle>,<peer_addr>(<peer_addr_type>)
If the local device does not execute this command and its BLE connection is terminated, the local device will show the following prompt:
[$]+BLEGAP:disconn,<conn_handle>,<peer_addr>(<peer_addr_type>)
Parameters
<conn_handle>: Connection handle.
<peer_addr>: Peer device address string, e.g. 00:11:22:33:44:55.
<peer_addr_type>: Peer device address type string.
public: Public address
random: Random address
public-id: Public identity address type
random-id: Random identity address type
AT+BLEGAP=conn_info
Description
Get connection information.
Command
AT+BLEGAP=conn_info,<conn_handle>
Response
+BLEGAP:conn_info,<conn_handle>,<role>,<remote_addr>(<remote_addr_type>),<interval>,<latency>,<supv_timeout>,<tx_phy>,<rx_phy>
OK
Parameters
<conn_handle>: Connection handle.
<role>: Role of the device (Master or Slave).
<remote_addr>: Remote device address.
<interval>: Connection interval.
<latency>: Slave connection latency (number of connection events).
<supv_timeout>: LE link supervision timeout.
<tx_phy>: TX phy.
1: 1M
2: 2M
3: Coded
<rx_phy>: RX phy.
1: 1M
2: 2M
3: Coded
AT+BLEGAP=conn_update
Description
Update connection parameters when connection has been established.
Command
AT+BLEGAP=conn_update,<conn_handle>,<conn_interval_min>,<conn_interval_max>,<conn_latency>,<supv_timeout>
Response
OK
Parameters
<conn_handle>: Connection handle.
<conn_interval_min>: Minimum connection interval.
[0x6, 0x0C80]
Minimum connection interval = <conn_interval_min> * 1.25 ms, range from 7.5ms to 4s.
<conn_interval_max>: Maximum connection interval.
[0x6, 0x0C80]
Maximum connection interval = <conn_interval_max> * 1.25 ms, range from 7.5ms to 4s.
<conn_latency>: Slave connection latency (number of connection events).
[0, 0x01F3]
<supv_timeout>: LE link supervision timeout.
[0xa, 0x0C80]
Supervision timeout = <supv_timeout> * 10 ms, range from 100ms to 32s.
AT+BLEGAP=wl_add
Description
Add address to whitelist.
Command
AT+BLEGAP=wl_add,<addr_type>,<addr>
Response
OK
Parameters
<addr_type>: Remote Address type.
0: Public address.
1: Random address.
2: Public identity address type.
3: Random identity address type.
<addr>: Address to be added to the whitelist.
AT+BLEGAP=wl_remove
Description
Remove address from whitelist.
Command
AT+BLEGAP=wl_remove,<addr_type>,<addr>
Response
OK
Parameters
<addr_type>: Remote Address type.
0: Public address.
1: Random address.
2: Public identity address type.
3: Random identity address type.
<addr>: Address to be removed from whitelist.
AT+BLEGAP=wl_clear
Description
Clear whitelist.
Command
AT+BLEGAP=wl_clear
Response
OK
Parameters
None.
AT+BLEGAP=sec_param
Description
Configure security parameters.
Command
AT+BLEGAP=sec_param[,<io_cap>,<oob_data_flag>,<bond>,<mitm>,<sec_pair>,<use_fixed_key>,<fixed_key>,<sec_pair_only>,<auto_sec_req>]
Response
OK
Parameters
<io_cap>: Input/Output capabilities.
0: Display Only, no keyboard or Yes/No button.
1: Display and Yes/No button.
2: Keyboard Only, no display.
3: No input/output capabilities.
4: Keyboard and display.
<oob_data_flag>: OOB data flag.
Default is all 0.
<bond>: Bond flag.
<mitm>: MITM flag.
<sec_pair>: Secure pair flag.
<use_fixed_key>: Use a fixed key during pairing.
0: Disabled (default).
1: Enabled
<fixed_key>: Fixed key for MITM protection.
[0, 999999]
Default is 0.
<sec_pair_only>: Security pairing only flag.
<auto_sec_req>: Automatically send SMP security request on connection.
0: Disabled (default).
1: Enabled.
AT+BLEGAP=get_sec_param
Description
Get security Parameters.
Command
AT+BLEGAP=get_sec_param
Response
+BLEGAP:get_sec_param,<io_cap>,<oob_data_flag>,<bond>,<mitm>,<sec_pair>,<use_fixed_key>,<fixed_key>
OK
Parameters
Refer to Parameters.
AT+BLEGAP=sec
Description
Initiate the security progress.
Command
AT+BLEGAP=sec,[conn_handle]
Response
OK
Note
Upon successful completion of BLE pairing, both the local and remote devices will show the following prompt:
[$]+BLEGAP:authcmpl,<conn_hdl>,<sec_result>
If the peer device requires Just Works pairing confirmation during pairing, the peer device will show:
[$]+BLEGAP:pair_cfm,<conn_handle>
If a device requires entry of passkey during pairing, it will show:
[$]+BLEGAP:passkey_input,<conn_handle>
If a device displays a key during pairing, it will show:
[$]+BLEGAP:passkey_display,<conn_handle>,<passkey>
If a device requires entry of an OOB key during pairing, it will show:
[$]+BLEGAP:oobkey_input,<conn_handle>
Parameters
<conn_handle>: Connection handle.
<sec_result>:
0: Success.
1: Failure.
<passkey>: The key to enter.
AT+BLEGAP=pair_cfm
Description
Confirm just work paring indication.
Command
AT+BLEGAP=pair_cfm,<conn_handle>,<op>
Response
OK
Parameters
<conn_handle>: Connection handle.
<op>: Confirm pairing indication.
1: Accept.
2: Reject.
AT+BLEGAP=auth_key
Description
Enter the authentication passkey.
Command
AT+BLEGAP=auth_key,<conn_handle>,<passkey>
Response
OK
Parameters
<conn_handle>: Connection handle.
<passkey>: Authentication passkey.
[0, 999999]
AT+BLEGAP=auth_keycfm
Description
Confirm authentication passkey.
Command
AT+BLEGAP=auth_keycfm,<conn_handle>,<op>
Response
OK
Parameters
<conn_handle>: Connection handle.
<op>: Confirm authentication passkey.
1: Accept.
2: Reject.
AT+BLEGAP=auth_oob
Description
Enter oob data.
Command
AT+BLEGAP=auth_oob,<conn_handle>,<tk>
Response
OK
Parameters
<conn_handle>: Connection handle.
<tk>: OOB data.
AT+BLEGAP=bond_info
Description
Get bond information.
Command
AT+BLEGAP=bond_info
Response
+BLEGAP:bond_info,<idx_1>,<remote_addr_1>,<identity_addr_1>,<idx_2>,,<remote_addr_2>,<identity_addr_2>,…
OK
Parameters
<idx>: Index number of bonding information.
<remote_addr>: Remote device address.
<identity_addr>: Identity address of the remote device.
AT+BLEGAP=bond_del
Description
Delete bonding information.
Command
AT+BLEGAP=bond_del,<addr_type>,<addr>
Response
OK
Parameters
<addr_type>: Address type.
0: Public address.
1: Random address.
2: Public identity address type.
3: Random identity address type.
<addr>: Address to be deleted.
AT+BLEGAP=bond_clear
Description
Clear all bonding information.
Command
AT+BLEGAP=bond_clear
Response
OK
Parameters
None.
AT+BLEGAP=disc
Description
Discover services and characteristics.
Command
AT+BLEGATTC=disc,<conn_handle>,<discover_type>[,<start_handle>,<end_handle>,<uuid16/uuid128>]
Response
If <discover_type> is 0, the response is:
+BLEGATTC:disc,<discover_type>,<conn_handle>,<start_handle>,<end_handle>,<UUID>
OK
If <discover_type> is 1, the response is:
+BLEGATTC:disc,<discover_type>,<conn_handle>,<start_handle>,<end_handle>
OK
If <discover_type> is 2, the response is:
+BLEGATTC:disc,<discover_type>,<conn_handle>,<included_service_handle>,<start_handle>,<end_handle>,<UUID>
OK
If <discover_type> is 3, the response is:
+BLEGATTC:disc,<discover_type>,<conn_handle>,<characteristic_handle>,<properties>,<value_handle>,<UUID>
OK
If <discover_type> is 4, the response is:
+BLEGATTC:disc,<discover_type>,<conn_handle>,<characteristic_handle>,<properties>,<value_handle>,<UUID>
OK
If <discover_type> is 5, the response is:
+BLEGATTC:disc,<discover_type>,<conn_handle>,<descriptor_handle>,<UUID>
OK
Parameters
<conn_handle>: Connection handle.
<discover_type>: Discovery type.
0: Discover all primary services.
1: Discover primary services by service UUID.
2: Find included services.
3: Discover all characteristic of a service.
4: Discover characteristic by UUID.
5: Discover all characteristic descriptors.
<start_handle>: The start attribute handle of discovery range.
<end_handle>: The end attribute handle of discovery range.
<uuid16/uuid128>: UUID of the discovery target.
<included_service_handle>: Handle of the included service declaration.
<characteristic_handle>: Handle of the characteristic declaration.
<properties>: Characteristic properties.
<value_handle>: Handle of the characteristic value.
<descriptor_handle>: Handle of the characteristic descriptor.
Example
AT+BLEGATTC=disc,17,3,0x1,0xFFFF
+BLEGATTC:disc,3,17,0x0002,0x20,0x0003,2a05
+BLEGATTC:disc,3,17,0x0006,0x02,0x0007,2a00
+BLEGATTC:disc,3,17,0x0008,0x02,0x0009,2a01
+BLEGATTC:disc,3,17,0x000a,0x02,0x000b,2a04
+BLEGATTC:disc,3,17,0x000d,0x02,0x000e,d001
+BLEGATTC:disc,3,17,0x000f,0x0c,0x0010,d002
+BLEGATTC:disc,3,17,0x0011,0x10,0x0012,d003
+BLEGATTC:disc,3,17,0x0014,0x20,0x0015,d004
OK
AT+BLEGATTC=read
Description
Read characteristic value.
Command
AT+BLEGATTC=read,<conn_handle>,<type>[,…]
Response
If <type> is 0, the response is:
+BLEGATTC:read,<conn_handle>,<type>,<handle>,<length>,<data>
OK
If <type> is 1, the response is:
+BLEGATTC:read,<conn_handle>,<type>,<handle>,<length>,<data>
OK
If <type> is 3, the response is:
+BLEGATTC:read,<conn_handle>,<type>,<length>,<data>
OK
Note
If the GATT client successfully reads the characteristic value, the GATT server will show the following prompt:
[$]+BLEGATTS:read,<service_app_id>,<conn_handle>,<charac_index>
Parameters
<conn_handle>: Connection handle.
<type>: Read type.
0: Read characteristic value by handle, […] = <handle>.
1: Read characteristic by UUID, […] = <start_handle>,<end_handle>,<uuid16/uuid128>.
2: Read multiple characteristic values (not supported).
3: Read multiple variable characteristic values, […] = <handle_count>,<handles_arr_1>[,…].
<handle>: Attribute handle.
<length>: Length of the value read.
<data>: The value read, in hexadecimal without the 0x prefix.
<service_app_id>: Service application ID.
<charac_index>: Characteristic index.
Example
AT+BLEGATTC=read,17,0,0xc
+BLEGATTC:read,17,0,0x000e,10,0102030405060708090a //The read value is in hexadecimal
OK
// GATT server
[$]+BLEGATTS:read,12,23,2
AT+BLEGATTC=write
Description
Write characteristic value.
Command
AT+BLEGATTC=write,<conn_handle>,<type>,<handle>,<length>,<data>
Response
OK
Note
If the GATT client successfully writes the characteristic value, the GATT server will show the following prompt:
[$]+BLEGATTS:write,<service_app_id>,<conn_handle>,<charac_index>,<type>,<length>,<data>
You should use this command to enable/disable notifications/indications. The format is:
AT+BLEGATTC=write,17,0,0x17,2,0100
// 17: Connection handle
// 0: Write request type, must be 0
// 0x17: CCCD handle
// 2: Length of the data to be written, must be 2
// 0100: Data to be written, 0100 to enable notifications, 0200 to enable indications, 0000 to disable notifications/indications
Parameters
<conn_handle>: Connection handle.
<type>: Write type.
0: Write characteristic value request.
1: Write characteristic value without response.
2: Write characteristic value without response and with signed data.
<handle>: Attribute handle of peer device.
<length>:Length of the data to be written.
<data>: Data to be written, in hexadecimal without the 0x prefix, e.g. 0a0b.
<service_app_id>: Service application ID.
<len>: Data length.
<data>: Written data value, e.g. 0a0b
Example
AT+BLEGATTC=write,17,1,0x10,1,01
OK
// GATT server
[$]+BLEGATTS:write,12,23,4,1,1,01
AT+BLEGATTS=notify
Description
Send notification from GATT server.
Command
AT+BLEGATTS=notify,<conn_handle>,<service_app_id>,<charac_index>,<length>,<data>
Response
OK
Note
If the GATT server successfully sends a notification, the GATT client will show the following prompt:
[$]+BLEGATTC:notify,<conn_handle>,<value_handle>,<length>,<data>
Parameters
<conn_handle>: Connection handle.
<service_app_id>: Service application ID, fixed value 12.
<charac_index>: Characteristic index, fixed value 6.
<length>: Length of notification data.
<data>: Notification data, in hexadecimal without the 0x prefix, e.g. 0a0b
<value_handle>: Handle of the characteristic value.
Example
AT+BLEGATTS=notify,23,12,6,4,11223344
OK
// GATT client
[$]+BLEGATTC:notify,17,0x16,4,11223344
AT+BLEGATTS=indicate
Description
Send indication from GATT server.
Command
AT+BLEGATTS=indicate,<conn_handle>,<service_app_id>,<charac_index>,<length>,<data>
Response
OK
Note
If the GATT server successfully sends an indication, the GATT client will show the following prompt:
[$]+BLEGATTC:indicate,<conn_handle>,<value_handle>,<length>,<data>
Parameters
<conn_handle>: Connection handle.
<service_app_id>: Service application ID, fixed value 12.
<charac_index>: Characteristic index, fixed value 9.
<length>: Length of the indication data.
<data>: Indication data, in hexadecimal without the 0x prefix, e.g. 0a0b.
<value_handle>: Handle of the characteristic value.
Example
AT+BLEGATTS=indicate,23,12,9,4,44332211
OK
// GATT client
[$]+BLEGATTC:indicate,17,0x19,4,44332211
Bluetooth AT Error Code
Description
If an error occurs while executing an AT command, the response will be:
ERROR:<err_code>
Parameters
<err_code>: Bluetooth AT error code
<err_code> |
Description |
---|---|
1 |
Common failure |
2 |
Bluetooth stack not ready |
3 |
No memory |
4 |
OS operation error |
5 |
AT command parameter invalid |
6 |
AT command advertising length invalid |
7 |
No BLE connection error |
8 |
IRK not found error |
9 |
No bond error |
10 |
Bluetooth lower stack error |
11 |
Create BLE connection timeout |
12 |
Bluetooth AT command invalid |
13 |
Bluetooth AT command timeout |