A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.espressif.com/projects/esp-at/en/latest/esp32/AT_Command_Set/BT_AT_Commands.html below:

Website Navigation


ESP32 Classic Bluetooth® AT Commands - ESP32

ESP32 Classic Bluetooth® AT Commands

[中文]

Introduction

ESP32 AT firmware supports Bluetooth® Core Specification Version 4.2.

Important

The default AT firmware does not support the AT commands listed on this page. If you need ESP32 to support Classic Bluetooth commands, you can compile the ESP-AT project by following the steps in Compile ESP-AT Project Locally documentation. In the project configuration during the fifth step, make the following selections (Each item below is independent. Choose it according to your needs):

AT+BTINIT: Classic Bluetooth Initialization Query Command

Function:

Query the initialization status of Classic Bluetooth.

Command:

Response:

If Classic Bluetooth is initialized, AT will return:

If Classic Bluetooth is not initialized, AT will return:

Set Command

Function:

Initialize or deinitialize Classic Bluetooth.

Command:

Response:

Parameter Notes Example AT+BTNAME: Query/Set Classic Bluetooth Device Name Query Command

Function:

Query the Classic Bluetooth device name.

Command:

Response:

Set Command

Function:

Set the Classic Bluetooth device name.

Command:

Response:

Parameter Notes Example AT+BTSCANMODE: Set Classic Bluetooth Scan Mode Set Command

Function:

Set the scan mode of Classic Bluetooth.

Command:

AT+BTSCANMODE=<scan_mode>

Response:

Parameter Example
AT+BTSCANMODE=2   // both discoverable and connectable
AT+BTSTARTDISC: Start Classic Bluetooth Discovery Set Command

Function:

Start Classic Bluetooth discovery.

Command:

AT+BTSTARTDISC=<inq_mode>,<inq_len>,<inq_num_rsps>

Response:

+BTSTARTDISC:<bt_addr>,<dev_name>,<major_dev_class>,<minor_dev_class>,<major_srv_class>,<rssi>

OK
Parameters Example
AT+BTINIT=1
AT+BTSCANMODE=2
AT+BTSTARTDISC=0,10,10
AT+BTSPPINIT: Classic Bluetooth SPP Profile Initialization Query Command

Function:

Query the initialization status of Classic Bluetooth SPP profile.

Command:

Response:

If Classic Bluetooth SPP profile is initialized, it will return:

If Classic Bluetooth SPP profile is not initialized, it will return:

Set Command

Function:

Initialize or deinitialize Classic Bluetooth SPP profile.

Command:

Response:

Parameter Example
AT+BTSPPINIT=1    // master
AT+BTSPPINIT=2    // slave
AT+BTSPPCONN: Query/Establish SPP Connection Query Command

Function:

Query Classic Bluetooth SPP connection.

Command:

Response:

+BTSPPCONN:<conn_index>,<remote_address>
OK

If the connection has not been established, AT will return:

Set Command

Function:

Establish the Classic Bluetooth SPP connection.

Command:

AT+BTSPPCONN=<conn_index>,<sec_mode>,<remote_address>

Response:

If the connection is established successfully, AT will return:

+BTSPPCONN:<conn_index>,<remote_address>

Otherwise, AT will return:

+BTSPPCONN:<conn_index>,-1
Parameters Example
AT+BTSPPCONN=0,0,"24:0a:c4:09:34:23"
AT+BTSPPDISCONN: End SPP Connection Execute Command

Function:

End the Classic Bluetooth SPP connection.

Command:

AT+BTSPPDISCONN=<conn_index>

Response:

If the command is successful, it will prompt:

+BTSPPDISCONN:<conn_index>,<remote_address>

If the command is fail, it will prompt:

Parameters Example AT+BTSPPSEND: Send Data to Remote Classic Bluetooth SPP Device Execute Command

Function:

Enter Classic Bluetooth SPP mode.

Command:

Response:

Set Command

Function:

Send data to the remote Classic Bluetooth SPP device.

Command:

AT+BTSPPSEND=<conn_index>,<data_len>

Response:

Parameters Notes Example
AT+BTSPPSEND=0,100
AT+BTSPPSEND
AT+BTSPPSTART: Start Classic Bluetooth SPP Profile Execute Command

Function:

Start Classic Bluetooth SPP profile.

Command:

Response:

Note Example AT+BTA2DPINIT: Classic Bluetooth A2DP Profile Initialization Query Command

Function:

Query the initialization status of Classic Bluetooth A2DP profile.

Command:

Response:

If Classic Bluetooth A2DP profile is initialized, AT will return:

Otherwise, AT will return:

Set Command

Function:

Initialize or deinitialize Classic Bluetooth A2DP profile.

Command:

Response:

Parameters Example AT+BTA2DPCONN: Query/Establish A2DP Connection Query Command

Function:

Query Classic Bluetooth A2DP connection.

Command:

Response:

+BTA2DPCONN:<conn_index>,<remote_address>
OK

If the connection has not been established, AT will NOT return the parameter <conn_index> and <remote_address>.

Set Command

Function:

Establish the Classic Bluetooth A2DP connection.

Command:

AT+BTA2DPCONN=<conn_index>,<remote_address>

Response:

If the connection is established successfully, it will prompt the message below:

+BTA2DPCONN:<conn_index>,<remote_address>

Otherwise, it will return:

+BTA2DPCONN:<conn_index>,-1
Parameters Example
AT+BTA2DPCONN=0,0,0,"24:0a:c4:09:34:23"
AT+BTA2DPDISCONN: End A2DP Connection Execute Command

Function:

End the Classic Bluetooth A2DP connection.

Command:

AT+BTA2DPDISCONN=<conn_index>

Response:

+BTA2DPDISCONN:<conn_index>,<remote_address>
OK
Parameters Example AT+BTA2DPSRC: Query/Set the Audio File URL Query Command

Function:

Query the audio file URL.

Command:

Response:

+BTA2DPSRC:<url>,<type>
OK
Execute Command

Function:

Set the audio file URL.

Command:

AT+BTA2DPSRC=<conn_index>,<url>

Response:

Parameters Note Example
AT+BTA2DPSRC=0,"https://dl.espressif.com/dl/audio/ff-16b-2c-44100hz.mp3"
AT+BTA2DPSRC=0,"flash://spiffs/zhifubao.mp3"
AT+BTA2DPCTRL: Control the Audio Play Execute Command

Function:

Control the audio play.

Command:

AT+BTA2DPCTRL=<conn_index>,<ctrl>

Response:

Parameters Example
AT+BTA2DPCTRL=0,1  // start play audio
AT+BTSECPARAM: Query/Set the Classic Bluetooth Security Parameters Query Command

Function:

Query Classic Bluetooth security parameters.

Command:

Response:

+BTSECPARAM:<io_cap>,<pin_type>,<pin_code>
OK
Set Command

Function:

Set the Classic Bluetooth security parameters.

Command:

AT+BTSECPARAM=<io_cap>,<pin_type>,<pin_code>

Response:

Parameters Note Example AT+BTKEYREPLY: Input the Simple Pair Key Execute Command

Function:

Input the Simple Pair Key.

Command:

AT+BTKEYREPLY=<conn_index>,<Key>

Response:

Parameters Example AT+BTPINREPLY: Input the Legacy Pair PIN Code Execute Command

Function:

Input the Legacy Pair PIN Code.

Command:

AT+BTPINREPLY=<conn_index>,<Pin>

Response:

Parameters Example AT+BTSECCFM: Reply the Confirm Value to the Peer Device in the Legacy Connection Stage Execute Command

Function:

Reply the confirm value to the peer device in the legacy connection stage.

Command:

AT+BTSECCFM=<conn_index>,<accept>

Response:

Parameters Example AT+BTENCDEV: Query Classic Bluetooth Encryption Device List Query Command

Function:

Query the bound devices.

Command:

Response:

+BTENCDEV:<enc_dev_index>,<mac_address>
OK
Parameters Example AT+BTENCCLEAR: Clear Classic Bluetooth Encryption Device List Set Command

Function:

Remove a device from the security database list with a specific index.

Command:

AT+BTENCCLEAR=<enc_dev_index>

Response:

Execute Command

Function:

Remove all devices from the security database.

Command:

Response:

Parameter Example AT+BTCOD: Set Class of Devices Set Command

Function:

Set the Classic Bluetooth class of devices.

Command:

AT+BTCOD=<major>,<minor>,<service>

Response:

Parameters Example
AT+BTCOD=6,32,32   // the printer
AT+BTPOWER: Query/Set TX power of Classic Bluetooth Query Command

Function:

Query Classic Bluetooth tx power level.

Command:

Response:

+BTPOWER:<min_tx_power>,<max_tx_power>
OK
Set Command

Function:

Set the Classic Bluetooth tx power.

Command:

AT+BTPOWER=<min_tx_power>,<max_tx_power>

Response:

Parameters Example
AT+BTPOWER=5,6   // set Classic Bluetooth tx power.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4