!
Example
6.2.23. AT+BLEGATTSSETATTR—GATTS Sets Characteristic
Commands
Response
Parameters
Note
Example
Espressif
A simple workflow is shown below. Users can refer to Section 9.5 BLE AT Examples for
more details.
AT+BLEINIT=2 // role: server
AT+BLEGATTSSRVCRE
AT+BLEGATTSSRVSTART
AT+BLEADVSTART // starts advertising. After the client is connected, it must be configured to
receive indications.
AT+BLEGATTSCHAR? // check for which characteristic the client can receive indications
// for example, to indicate 4 bytes of data using the 7th characteristic in the 3rd service, use
the following command:
AT+BLEGATTSIND=0,3,7,4
// after > shows, inputs 4 bytes of data, such as "1234"; then, the data will be transmitted
automatically
Set Command:
AT+BLEGATTSSETATTR=<srv_index>,<char_index>[,<desc_index>],<length>
Function: GATTS sets its characteristic (descriptor).
wrap return
>
after the command. Begin receiving serial data. When the requirement of data
length, determined by <length>, is met, the setting starts.
If the setting is successful, the system returns:
OK
<srv_index>: service's index; it can be fetched with command AT+BLEGATTSCHAR?
<char_index>: characteristic's index; it can be fetched with command AT+BLEGATTSCHAR?
[<desc_index>](Optional parameter): descriptor's index. If it is set, this command is used to
set the value of the descriptor; if it is not, this command is used to set the value of the
characteristic.
<length>: data length
If the <length> is larger than the maximum length allowed, the setting will fail.
A simple workflow is shown below. Users can refer to Section 9.5 BLE AT Examples for
more details.
AT+BLEINIT=2 // role: server
AT+BLEGATTSSRVCRE
AT+BLEGATTSSRVSTART
AT+BLEGATTSCHAR?
// for example, to set 4 bytes of data of the 1st characteristic in the 1st service, use the
following command:
AT+BLEGATTSSETATTR=1,1,,4
// after > shows, inputs 4 bytes of data, such as "1234"; then, the setting starts
54 97
!
/!
6. BLE-Related AT Commands
2019.06
Need help?
Do you have a question about the ESP32 and is the answer not in the manual?
Questions and answers