diff --git a/docs/en/AT_Command_Examples/bluetooth_le_at_examples.rst b/docs/en/AT_Command_Examples/bluetooth_le_at_examples.rst index a20443a8..4df724c0 100644 --- a/docs/en/AT_Command_Examples/bluetooth_le_at_examples.rst +++ b/docs/en/AT_Command_Examples/bluetooth_le_at_examples.rst @@ -105,7 +105,7 @@ Below is an example of using two {IDF_TARGET_NAME} development boards, one as a - The address you obtain may be different from that in the above response. Keep yours handy as you will need it in one of the following steps. -.. only:: esp32 or esp32c3 or esp32c6 +.. only:: esp32 or esp32c3 #. {IDF_TARGET_NAME} Bluetooth LE server creates services. @@ -473,7 +473,7 @@ Below is an example of using two {IDF_TARGET_NAME} development boards, one as a OK - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 #. {IDF_TARGET_NAME} Bluetooth LE server creates services. @@ -564,7 +564,7 @@ Below is an example of using two {IDF_TARGET_NAME} development boards, one as a OK - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 #. {IDF_TARGET_NAME} Bluetooth LE client creates services. @@ -950,7 +950,7 @@ Below is an example of using two {IDF_TARGET_NAME} development boards, one as a - The address you obtain may be different from that in the above response. Keep yours handy as you will need it in one of the following steps. -.. only:: esp32 or esp32c3 or esp32c6 +.. only:: esp32 or esp32c3 #. {IDF_TARGET_NAME} Bluetooth LE server creates services. @@ -1232,24 +1232,26 @@ Below is an example of using two {IDF_TARGET_NAME} development boards, one as a If the {IDF_TARGET_NAME} Bluetooth LE server successfully receives the encryption request, message ``+BLESECREQ:0`` will be prompted on the {IDF_TARGET_NAME} Bluetooth LE server side. -#. {IDF_TARGET_NAME} Bluetooth LE server responds to the pairing request. +.. only:: esp32 or esp32c3 - Command: + #. {IDF_TARGET_NAME} Bluetooth LE server responds to the pairing request. - .. code-block:: none + Command: - AT+BLEENCRSP=0,1 + .. code-block:: none - Response: + AT+BLEENCRSP=0,1 - .. code-block:: none + Response: - OK + .. code-block:: none - Note: + OK + + Note: - - If the {IDF_TARGET_NAME} Bluetooth LE client successfully receives the pairing response, a 6-digit pairing code will generate on the {IDF_TARGET_NAME} Bluetooth LE client side. - - In this example, message ``+BLESECNTFYKEY:0,793718`` will be prompted on the {IDF_TARGET_NAME} Bluetooth LE client side. Pairing code is ``793718``. + - If the {IDF_TARGET_NAME} Bluetooth LE client successfully receives the pairing response, a 6-digit pairing code will generate on the {IDF_TARGET_NAME} Bluetooth LE client side. + - In this example, message ``+BLESECNTFYKEY:0,793718`` will be prompted on the {IDF_TARGET_NAME} Bluetooth LE client side. Pairing code is ``793718``. #. {IDF_TARGET_NAME} Bluetooth LE server replies pairing code. @@ -1329,7 +1331,7 @@ Below is an example of using two {IDF_TARGET_NAME} development boards, one as a OK -.. only:: esp32 or esp32c3 or esp32c6 +.. only:: esp32 or esp32c3 #. {IDF_TARGET_NAME} Bluetooth LE server creates services. @@ -1724,7 +1726,7 @@ The example shows how to establish SPP connection between an {IDF_TARGET_NAME} d OK -.. only:: esp32 or esp32c3 or esp32c6 +.. only:: esp32 or esp32c3 #. {IDF_TARGET_NAME} Bluetooth LE server creates services. @@ -1961,7 +1963,7 @@ This example shows how to establish a Bluetooth LE connection between the {IDF_T OK -.. only:: esp32 or esp32c3 or esp32c6 +.. only:: esp32 or esp32c3 #. {IDF_TARGET_NAME} Bluetooth LE server creates services. diff --git a/docs/en/AT_Command_Set/BLE_AT_Commands.rst b/docs/en/AT_Command_Set/BLE_AT_Commands.rst index 0182b0ac..2e29c4b7 100644 --- a/docs/en/AT_Command_Set/BLE_AT_Commands.rst +++ b/docs/en/AT_Command_Set/BLE_AT_Commands.rst @@ -24,9 +24,9 @@ Bluetooth® Low Energy AT Commands :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEDISCONN <cmd-BDISC>`: End Bluetooth LE connection. :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEDATALEN <cmd-BDLEN>`: Set Bluetooth LE data packet length. :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLECFGMTU <cmd-BMTU>`: Set Bluetooth LE MTU length. - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEGATTSSRVCRE <cmd-GSSRVCRE>`: Generic Attributes Server (GATTS) creates services. - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEGATTSSRVSTART <cmd-GSSRVSTART>`: GATTS starts services. - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEGATTSSRVSTOP <cmd-GSSRVSTOP>`: GATTS Stops Services. + :esp32 or esp32c3 : - :ref:`AT+BLEGATTSSRVCRE <cmd-GSSRVCRE>`: Generic Attributes Server (GATTS) creates services. + :esp32 or esp32c3 : - :ref:`AT+BLEGATTSSRVSTART <cmd-GSSRVSTART>`: GATTS starts services. + :esp32 or esp32c3 : - :ref:`AT+BLEGATTSSRVSTOP <cmd-GSSRVSTOP>`: GATTS Stops Services. :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEGATTSSRV <cmd-GSSRV>`: GATTS discovers services. :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEGATTSCHAR <cmd-GSCHAR>`: GATTS discovers characteristics. :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEGATTSNTFY <cmd-GSNTFY>`: Notify a client of the value of a characteristic value from the server. @@ -42,16 +42,16 @@ Bluetooth® Low Energy AT Commands :esp32 or esp32c3 or esp32c6: - :ref:`AT+SAVETRANSLINK <cmd-SAVET>`: Set whether to enter Bluetooth LE :term:`Passthrough Mode` on power-up. :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLESECPARAM <cmd-BLESMPPAR>`: Query/Set Bluetooth LE encryption parameters. :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEENC <cmd-BLEENC>`: Initiate Bluetooth LE encryption request. - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEENCRSP <cmd-BLEENCRSP>`: Respond to the pairing request from the peer device. + :esp32 or esp32c3 : - :ref:`AT+BLEENCRSP <cmd-BLEENCRSP>`: Respond to the pairing request from the peer device. :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEKEYREPLY <cmd-BLEKEYREPLY>`: Reply the key value to the peer device. :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLECONFREPLY <cmd-BLECONFREPLY>`: Reply the confirm value to the peer device in the legacy connection stage. :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEENCDEV <cmd-BLEENCDEV>`: Query bonded Bluetooth LE encryption device list. :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEENCCLEAR <cmd-BLEENCCLEAR>`: Clear Bluetooth LE encryption device list. :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLESETKEY <cmd-BLESETKEY>`: Set Bluetooth LE static pair key. - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEHIDINIT <cmd-BLEHIDINIT>`: Bluetooth LE Human Interface Device (HID) profile initialization. - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEHIDKB <cmd-BLEHIDKB>`: Send Bluetooth LE HID keyboard information. - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEHIDMUS <cmd-BLEHIDMUS>`: Send Bluetooth LE HID mouse information. - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEHIDCONSUMER <cmd-BLEHIDC>`: Send Bluetooth LE HID consumer information. + :esp32 or esp32c3 : - :ref:`AT+BLEHIDINIT <cmd-BLEHIDINIT>`: Bluetooth LE Human Interface Device (HID) profile initialization. + :esp32 or esp32c3 : - :ref:`AT+BLEHIDKB <cmd-BLEHIDKB>`: Send Bluetooth LE HID keyboard information. + :esp32 or esp32c3 : - :ref:`AT+BLEHIDMUS <cmd-BLEHIDMUS>`: Send Bluetooth LE HID mouse information. + :esp32 or esp32c3 : - :ref:`AT+BLEHIDCONSUMER <cmd-BLEHIDC>`: Send Bluetooth LE HID consumer information. - :ref:`AT+BLUFI <cmd-BLUFI>`: Start or Stop BluFi. - :ref:`AT+BLUFINAME <cmd-BLUFINAME>`: Query/Set BluFi device name. - :ref:`AT+BLUFISEND <cmd-BLUFISEND>`: Send user-customized data over BluFi. @@ -206,13 +206,13 @@ Introduction **Function:** - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: Query the Bluetooth LE Public Address. - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -226,14 +226,14 @@ Introduction **Response:** - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: +BLEADDR:<BLE_public_addr> OK - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -249,13 +249,13 @@ Introduction **Command:** - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: AT+BLEADDR=<addr_type>[,<random_addr>] - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -289,7 +289,7 @@ Introduction Example ^^^^^^^^ - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: @@ -297,7 +297,7 @@ Introduction AT+BLEADDR=1 // Set Random Device Address, Private Address AT+BLEADDR=0 // Set Public Device Address - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -699,7 +699,7 @@ Introduction AT+BLEADVPARAM=50,50,0,1,4,0,1,"12:34:45:78:66:88" // At this time, the MAC of the ESP device scanned by the BLE client is "c2:34:45:78:66:89". - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 Example ^^^^^^^^^^ @@ -887,7 +887,14 @@ Introduction Notes ^^^^^ - - If advertising parameters are NOT set by command :ref:`AT+BLEADVPARAM <cmd-BADVP>`\=<adv_parameter>, the default parameters will be used. + .. only:: esp32 or esp32c3 + + - If advertising parameters are NOT set by command :ref:`AT+BLEADVPARAM <cmd-BADVP>`\=<adv_parameter>, the default parameters will be used. + + .. only:: esp32c2 or esp32c6 + + - You must set the advertisement parameters using the :ref:`AT+BLEADVPARAM <cmd-BADVP>`\=<adv_parameter> command before advertisement is started. + - If advertising data is NOT set by command :ref:`AT+BLEADVDATA <cmd-BADVD>`\=<adv_data>, the advertising playload will be empty. - If advertising data is preset by command :ref:`AT+BLEADVDATA <cmd-BADVD>`\=<adv_data>, it will be overwritten by :ref:`AT+BLEADVDATAEX <cmd-BADVDEX>`\=<dev_name>,<uuid>,<manufacturer_data>,<include_power> and vice versa. - After the start of Bluetooth LE advertisement, if no connection is established, the advertisement will keep going on; if a connection is established, the advertisement will automatically end. @@ -895,10 +902,20 @@ Introduction Example ^^^^^^^^ - :: + .. only:: esp32 or esp32c3 - AT+BLEINIT=2 // Role: server - AT+BLEADVSTART + :: + + AT+BLEINIT=2 // Role: server + AT+BLEADVSTART + + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEINIT=2 // Role: server + AT+BLEADVPARAM=50,50,0,0,7,0,, + AT+BLEADVSTART .. _cmd-BADVSTOP: @@ -932,11 +949,22 @@ Introduction Example ^^^^^^^^ - :: + .. only:: esp32 or esp32c3 - AT+BLEINIT=2 // Role: server - AT+BLEADVSTART - AT+BLEADVSTOP + :: + + AT+BLEINIT=2 // Role: server + AT+BLEADVSTART + AT+BLEADVSTOP + + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEINIT=2 // Role: server + AT+BLEADVPARAM=50,50,0,0,7,0,, + AT+BLEADVSTART + AT+BLEADVSTOP .. _cmd-BCONN: @@ -1240,13 +1268,13 @@ Introduction **Command:** - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: AT+BLECFGMTU=<conn_index>,<mtu_size> - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -1261,14 +1289,14 @@ Introduction Parameters ^^^^^^^^^^ - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: - **<conn_index>**: index of Bluetooth LE connection. Range: [0,2]. - **<mtu_size>**: MTU length. Unit: byte. Range: [23,517]. - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -1277,7 +1305,7 @@ Introduction Notes ^^^^^ - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: @@ -1285,7 +1313,7 @@ Introduction - Only the client can call this command to set the length of MTU. - The actual length of MTU needs to be negotiated. The ``OK`` response only indicates an attempt to negotiate the length. The actual length may not be the value you set. Therefore, it is recommended to run command :ref:`AT+BLECFGMTU? <cmd-BMTU>` to query the actual length. - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -1295,7 +1323,7 @@ Introduction Example ^^^^^^^^ - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: @@ -1303,7 +1331,7 @@ Introduction AT+BLECONN=0,"24:0a:c4:09:34:23" AT+BLECFGMTU=0,300 - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -1311,7 +1339,7 @@ Introduction AT+BLECONN=0,"24:0a:c4:09:34:23" AT+BLECFGMTU=0 -.. only:: esp32 or esp32c3 or esp32c6 +.. only:: esp32 or esp32c3 .. _cmd-GSSRVCRE: @@ -1508,11 +1536,20 @@ Introduction Example ^^^^^^^^ - :: + .. only:: esp32 or esp32c3 - AT+BLEINIT=2 // Role: server - AT+BLEGATTSSRVCRE - AT+BLEGATTSSRV? + :: + + AT+BLEINIT=2 // Role: server + AT+BLEGATTSSRVCRE + AT+BLEGATTSSRV? + + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEINIT=2 // Role: server + AT+BLEGATTSSRV? .. _cmd-GSCHAR: @@ -1560,12 +1597,21 @@ Introduction Example ^^^^^^^^ - :: + .. only:: esp32 or esp32c3 - AT+BLEINIT=2 // Role: server - AT+BLEGATTSSRVCRE - AT+BLEGATTSSRVSTART - AT+BLEGATTSCHAR? + :: + + AT+BLEINIT=2 // Role: server + AT+BLEGATTSSRVCRE + AT+BLEGATTSSRVSTART + AT+BLEGATTSCHAR? + + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEINIT=2 // Role: server + AT+BLEGATTSCHAR? .. _cmd-GSNTFY: @@ -1610,16 +1656,30 @@ Introduction Example ^^^^^^^^ - :: + .. only:: esp32 or esp32c3 - AT+BLEINIT=2 // Role: server. - AT+BLEGATTSSRVCRE - AT+BLEGATTSSRVSTART - AT+BLEADVSTART // Start advertising. After the client is connected, it must be configured to receive notifications. - AT+BLEGATTSCHAR? // Query the characteristics which the client will be notified of. - // For example, to notify of 4-byte data using the 6th characteristic in the 3rd service, use the following command: - AT+BLEGATTSNTFY=0,3,6,4 - // After the symbol ">" shows, enter the 4-byte data, such as "1234". Then the data will be transmitted automatically. + :: + + AT+BLEINIT=2 // Role: server. + AT+BLEGATTSSRVCRE + AT+BLEGATTSSRVSTART + AT+BLEADVSTART // Start advertising. After the client is connected, it must be configured to receive notifications. + AT+BLEGATTSCHAR? // Query the characteristics which the client will be notified of. + // For example, to notify of 4-byte data using the 6th characteristic in the 3rd service, use the following command: + AT+BLEGATTSNTFY=0,3,6,4 + // After the symbol ">" shows, enter the 4-byte data, such as "1234". Then the data will be transmitted automatically. + + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEINIT=2 // Role: server. + AT+BLEADVPARAM=50,50,0,0,7,0,, + AT+BLEADVSTART // Start advertising. After the client is connected, it must be configured to receive notifications. + AT+BLEGATTSCHAR? // Query the characteristics which the client will be notified of. + // For example, to notify of 4-byte data using the 6th characteristic in the 3rd service, use the following command: + AT+BLEGATTSNTFY=0,3,6,4 + // After the symbol ">" shows, enter the 4-byte data, such as "1234". Then the data will be transmitted automatically. .. _cmd-GSIND: @@ -1664,16 +1724,30 @@ Introduction Example ^^^^^^^^ - :: + .. only:: esp32 or esp32c3 - AT+BLEINIT=2 // Role: server - AT+BLEGATTSSRVCRE - AT+BLEGATTSSRVSTART - AT+BLEADVSTART // Start advertising. After the client is connected, it must be configured to receive indications. - AT+BLEGATTSCHAR? // Query the characteristics which 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 the symbol ">" shows, input 4 bytes of data, such as "1234". Then the data will be transmitted automatically. + :: + + AT+BLEINIT=2 // Role: server + AT+BLEGATTSSRVCRE + AT+BLEGATTSSRVSTART + AT+BLEADVSTART // Start advertising. After the client is connected, it must be configured to receive indications. + AT+BLEGATTSCHAR? // Query the characteristics which 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 the symbol ">" shows, input 4 bytes of data, such as "1234". Then the data will be transmitted automatically. + + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEINIT=2 // Role: server + AT+BLEADVPARAM=50,50,0,0,7,0,, + AT+BLEADVSTART // Start advertising. After the client is connected, it must be configured to receive indications. + AT+BLEGATTSCHAR? // Query the characteristics which 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 the symbol ">" shows, input 4 bytes of data, such as "1234". Then the data will be transmitted automatically. .. _cmd-GSSETA: @@ -1689,9 +1763,17 @@ Introduction **Command:** - :: + .. only:: esp32 or esp32c3 + + :: + + AT+BLEGATTSSETATTR=<srv_index>,<char_index>,[<desc_index>],<length> - AT+BLEGATTSSETATTR=<srv_index>,<char_index>,[<desc_index>],<length> + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEGATTSSETATTR=<srv_index>,<char_index>,<length> **Response:** @@ -1712,7 +1794,10 @@ Introduction - **<srv_index>**: service's index. It can be queried with command :ref:`AT+BLEGATTSCHAR? <cmd-GSCHAR>`. - **<char_index>**: characteristic's index; it can be fetched with command :ref:`AT+BLEGATTSCHAR? <cmd-GSCHAR>`. - - **[<desc_index>]**: descriptor's index. + + .. only:: esp32c2 or esp32c6 + + - **[<desc_index>]**: descriptor's index. - If it is set, this command is used to set the value of the descriptor. - Otherwise, this command is used to set the value of the characteristic. @@ -1724,18 +1809,34 @@ Introduction - If the value of ``<length>`` is larger than the maximum length allowed, the setting will fail. The service table is defined in :project_file:`gatts_data.csv <components/customized_partitions/raw_data/ble_data/gatts_data.csv>`. + .. only:: esp32c2 or esp32c6 + + - The characteristic descriptor value cannot be set. + Example ^^^^^^^^ - :: + .. only:: esp32 or esp32c3 - AT+BLEINIT=2 // Role: server. - AT+BLEGATTSSRVCRE - AT+BLEGATTSSRVSTART - AT+BLEGATTSCHAR? - // For example, to set 1 byte of data of the 1st characteristic in the 1st service, use the following command: - AT+BLEGATTSSETATTR=1,1,,1 - // After the symbol ">" shows, input 1 byte of data, such as "8". Then the setting starts. + :: + + AT+BLEINIT=2 // Role: server. + AT+BLEGATTSSRVCRE + AT+BLEGATTSSRVSTART + AT+BLEGATTSCHAR? + // For example, to set 1 byte of data of the 1st characteristic in the 1st service, use the following command: + AT+BLEGATTSSETATTR=1,1,,1 + // After the symbol ">" shows, input 1 byte of data, such as "8". Then the setting starts. + + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEINIT=2 // Role: server. + AT+BLEGATTSCHAR? + // For example, to set 1 byte of data of the 1st characteristic in the 1st service, use the following command: + AT+BLEGATTSSETATTR=1,1,1 + // After the symbol ">" shows, input 1 byte of data, such as "8". Then the setting starts. .. _cmd-GCPRIMSRV: @@ -2285,20 +2386,36 @@ Introduction Example ^^^^^^^^ - :: + .. only:: esp32 or esp32c3 - AT+RESTORE - AT+BLEINIT=2 - AT+BLEGATTSSRVCRE - AT+BLEGATTSSRVSTART - AT+BLEADDR? - AT+BLESECPARAM=1,0,16,3,3 - AT+BLESETKEY=123456 - AT+BLEADVSTART - // Use your Bluetooth LE debugging app as a client to establish a Bluetooth LE connection with the {IDF_TARGET_NAME} - AT+BLEENC=0,3 + :: -.. only:: esp32 or esp32c3 or esp32c6 + AT+RESTORE + AT+BLEINIT=2 + AT+BLEGATTSSRVCRE + AT+BLEGATTSSRVSTART + AT+BLEADDR? + AT+BLESECPARAM=1,0,16,3,3 + AT+BLESETKEY=123456 + AT+BLEADVSTART + // Use your Bluetooth LE debugging app as a client to establish a Bluetooth LE connection with the {IDF_TARGET_NAME} + AT+BLEENC=0,3 + + .. only:: esp32c2 or esp32c6 + + :: + + AT+RESTORE + AT+BLEINIT=2 + AT+BLEADDR? + AT+BLESECPARAM=1,0,16,3,3 + AT+BLESETKEY=123456 + AT+BLEADVPARAM=50,50,0,0,7,0,, + AT+BLEADVSTART + // Use your Bluetooth LE debugging app as a client to establish a Bluetooth LE connection with the {IDF_TARGET_NAME} + AT+BLEENC=0,3 + +.. only:: esp32 or esp32c3 .. _cmd-BLEENCRSP: @@ -2598,7 +2715,7 @@ Introduction AT+BLESETKEY=123456 -.. only:: esp32 or esp32c3 or esp32c6 +.. only:: esp32 or esp32c3 .. _cmd-BLEHIDINIT: @@ -2949,6 +3066,7 @@ Notes - If you need to set BluFi name, please set it before command :ref:`AT+BLUFI=1 <cmd-BLUFI>`. Otherwise, it will use the default name ``BLUFI_DEVICE``. - The maximum length of BluFi name is 26 bytes. +- The Blufi APP can be downloaded from the app store. Example ^^^^^^^^ diff --git a/docs/en/AT_Command_Set/Basic_AT_Commands.rst b/docs/en/AT_Command_Set/Basic_AT_Commands.rst index 71f52977..ffe099a1 100644 --- a/docs/en/AT_Command_Set/Basic_AT_Commands.rst +++ b/docs/en/AT_Command_Set/Basic_AT_Commands.rst @@ -1546,7 +1546,7 @@ Query the RF TX Power. **Response:** -.. only:: esp32 or esp32c3 +.. only:: esp32 or esp32c3 or esp32c6 :: @@ -1565,7 +1565,7 @@ Set Command **Command:** -.. only:: esp32 or esp32c3 +.. only:: esp32 or esp32c3 or esp32c6 :: @@ -1631,26 +1631,44 @@ Parameters .. only:: esp32c3 - - **<ble_adv_power>**: RF TX Power of Bluetooth LE advertising. Range: [0,7]. - - - 0: -27 dBm - - 1: -24 dBm - - 2: -21 dBm - - 3: -18 dBm - - 4: -15 dBm - - 5: -12 dBm - - 6: -9 dBm - - 7: -6 dBm - - 8: -3 dBm - - 9: -0 dBm - - 10: 3 dBm - - 11: 6 dBm - - 12: 9 dBm - - 13: 12 dBm - - 14: 15 dBm - - 15: 18 dBm - -.. only:: esp32 or esp32c3 + - **<ble_adv_power>**: RF TX Power of Bluetooth LE advertising. Range: [0,15]. + + - 0: -24 dBm + - 1: -21 dBm + - 2: -18 dBm + - 3: -15 dBm + - 4: -12 dBm + - 5: -9 dBm + - 6: -6 dBm + - 7: -3 dBm + - 8: -0 dBm + - 9: 3 dBm + - 10: 6 dBm + - 11: 9 dBm + - 12: 12 dBm + - 13: 15 dBm + - 14: 18 dBm + - 15: 21 dBm + +.. only:: esp32c6 + + - **<ble_adv_power>**: RF TX Power of Bluetooth LE advertising. Range: [3,15]. + + - 3: -15 dBm + - 4: -12 dBm + - 5: -9 dBm + - 6: -6 dBm + - 7: -3 dBm + - 8: -0 dBm + - 9: 3 dBm + - 10: 6 dBm + - 11: 9 dBm + - 12: 12 dBm + - 13: 15 dBm + - 14: 18 dBm + - 15: 20 dBm + +.. only:: esp32 or esp32c3 or esp32c6 - **<ble_scan_power>**: RF TX Power of Bluetooth LE scanning. The parameters are the same as ``<ble_adv_power>``. - **<ble_conn_power>**: RF TX Power of Bluetooth LE connecting. The same as ``<ble_adv_power>``. diff --git a/docs/zh_CN/AT_Command_Examples/bluetooth_le_at_examples.rst b/docs/zh_CN/AT_Command_Examples/bluetooth_le_at_examples.rst index ca131997..531f3504 100644 --- a/docs/zh_CN/AT_Command_Examples/bluetooth_le_at_examples.rst +++ b/docs/zh_CN/AT_Command_Examples/bluetooth_le_at_examples.rst @@ -105,7 +105,7 @@ Bluetooth LE 客户端读写服务特征值 - 您查询到的地址可能与上述响应中的不同,请记住您的地址,下面的步骤中会用到。 -.. only:: esp32 or esp32c3 or esp32c6 +.. only:: esp32 or esp32c3 #. {IDF_TARGET_NAME} Bluetooth LE 服务端创建服务。 @@ -473,7 +473,7 @@ Bluetooth LE 客户端读写服务特征值 OK - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 #. {IDF_TARGET_NAME} Bluetooth LE 服务端创建服务。 @@ -564,7 +564,7 @@ Bluetooth LE 客户端读写服务特征值 OK - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 #. {IDF_TARGET_NAME} Bluetooth LE 客户端创建服务。 @@ -950,7 +950,7 @@ Bluetooth LE 连接加密 - 您查询到的地址可能与上述响应中的不同,请记住您的地址,下面的步骤中会用到。 -.. only:: esp32 or esp32c3 or esp32c6 +.. only:: esp32 or esp32c3 #. {IDF_TARGET_NAME} Bluetooth LE 服务端创建服务。 @@ -1232,24 +1232,26 @@ Bluetooth LE 连接加密 如果 {IDF_TARGET_NAME} Bluetooth LE 服务端成功接收到加密请求,{IDF_TARGET_NAME} Bluetooth LE 服务端则会提示 ``+BLESECREQ:0``。 -#. {IDF_TARGET_NAME} Bluetooth LE 服务端响应配对请求。 +.. only:: esp32 or esp32c3 - 命令: + #. {IDF_TARGET_NAME} Bluetooth LE 服务端响应配对请求。 - .. code-block:: none + 命令: - AT+BLEENCRSP=0,1 + .. code-block:: none - 响应: + AT+BLEENCRSP=0,1 - .. code-block:: none + 响应: - OK + .. code-block:: none - 说明: + OK + + 说明: - - 如果 {IDF_TARGET_NAME} Bluetooth LE 客户端成功收到配对响应,则 {IDF_TARGET_NAME} Bluetooth LE 客户端将会产生一个 6 位的配对码。 - - 在本例中,{IDF_TARGET_NAME} Bluetooth LE 客户端则会提示 ``+BLESECNTFYKEY:0,793718``。配对码为 ``793718``。 + - 如果 {IDF_TARGET_NAME} Bluetooth LE 客户端成功收到配对响应,则 {IDF_TARGET_NAME} Bluetooth LE 客户端将会产生一个 6 位的配对码。 + - 在本例中,{IDF_TARGET_NAME} Bluetooth LE 客户端则会提示 ``+BLESECNTFYKEY:0,793718``。配对码为 ``793718``。 #. {IDF_TARGET_NAME} Bluetooth LE 客户端回复配对码。 @@ -1329,7 +1331,7 @@ Bluetooth LE 连接加密 OK -.. only:: esp32 or esp32c3 or esp32c6 +.. only:: esp32 or esp32c3 #. {IDF_TARGET_NAME} Bluetooth LE 服务端创建服务。 @@ -1724,7 +1726,7 @@ Bluetooth LE 连接加密 OK -.. only:: esp32 or esp32c3 or esp32c6 +.. only:: esp32 or esp32c3 #. {IDF_TARGET_NAME} Bluetooth LE 服务端创建服务。 @@ -1961,7 +1963,7 @@ Bluetooth LE 连接加密 OK -.. only:: esp32 or esp32c3 or esp32c6 +.. only:: esp32 or esp32c3 #. {IDF_TARGET_NAME} Bluetooth LE 服务端创建服务。 diff --git a/docs/zh_CN/AT_Command_Set/BLE_AT_Commands.rst b/docs/zh_CN/AT_Command_Set/BLE_AT_Commands.rst index a0f41034..21552a80 100644 --- a/docs/zh_CN/AT_Command_Set/BLE_AT_Commands.rst +++ b/docs/zh_CN/AT_Command_Set/BLE_AT_Commands.rst @@ -24,9 +24,9 @@ Bluetooth® Low Energy AT 命令集 :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEDISCONN <cmd-BDISC>`:断开 Bluetooth LE 连接 :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEDATALEN <cmd-BDLEN>`:设置 Bluetooth LE 数据包长度 :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLECFGMTU <cmd-BMTU>`:设置 Bluetooth LE MTU 长度 - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEGATTSSRVCRE <cmd-GSSRVCRE>`:GATTS 创建服务 - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEGATTSSRVSTART <cmd-GSSRVSTART>`:GATTS 开启服务 - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEGATTSSRVSTOP <cmd-GSSRVSTOP>`:GATTS 停止服务 + :esp32 or esp32c3 : - :ref:`AT+BLEGATTSSRVCRE <cmd-GSSRVCRE>`:GATTS 创建服务 + :esp32 or esp32c3 : - :ref:`AT+BLEGATTSSRVSTART <cmd-GSSRVSTART>`:GATTS 开启服务 + :esp32 or esp32c3 : - :ref:`AT+BLEGATTSSRVSTOP <cmd-GSSRVSTOP>`:GATTS 停止服务 :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEGATTSSRV <cmd-GSSRV>`:GATTS 发现服务 :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEGATTSCHAR <cmd-GSCHAR>`:GATTS 发现服务特征 :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEGATTSNTFY <cmd-GSNTFY>`:服务器 notify 服务特征值给客户端 @@ -42,16 +42,16 @@ Bluetooth® Low Energy AT 命令集 :esp32 or esp32c3 or esp32c6: - :ref:`AT+SAVETRANSLINK <cmd-SAVET>`:设置 Bluetooth LE 开机 :term:`透传模式` 信息 :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLESECPARAM <cmd-BLESMPPAR>`:查询/设置 Bluetooth LE 加密参数 :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEENC <cmd-BLEENC>`:发起 Bluetooth LE 加密请求 - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEENCRSP <cmd-BLEENCRSP>`:回复对端设备发起的配对请求 + :esp32 or esp32c3 : - :ref:`AT+BLEENCRSP <cmd-BLEENCRSP>`:回复对端设备发起的配对请求 :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEKEYREPLY <cmd-BLEKEYREPLY>`:给对方设备回复密钥 :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLECONFREPLY <cmd-BLECONFREPLY>`:给对方设备回复确认结果(传统连接阶段) :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEENCDEV <cmd-BLEENCDEV>`:查询绑定的 Bluetooth LE 加密设备列表 :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLEENCCLEAR <cmd-BLEENCCLEAR>`:清除 Bluetooth LE 加密设备列表 :esp32 or esp32c3 or esp32c6 or esp32c2: - :ref:`AT+BLESETKEY <cmd-BLESETKEY>`:设置 Bluetooth LE 静态配对密钥 - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEHIDINIT <cmd-BLEHIDINIT>`:Bluetooth LE HID 协议初始化 - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEHIDKB <cmd-BLEHIDKB>`:发送 Bluetooth LE HID 键盘信息 - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEHIDMUS <cmd-BLEHIDMUS>`:发送 Bluetooth LE HID 鼠标信息 - :esp32 or esp32c3 or esp32c6: - :ref:`AT+BLEHIDCONSUMER <cmd-BLEHIDC>`:发送 Bluetooth LE HID consumer 信息 + :esp32 or esp32c3 : - :ref:`AT+BLEHIDINIT <cmd-BLEHIDINIT>`:Bluetooth LE HID 协议初始化 + :esp32 or esp32c3 : - :ref:`AT+BLEHIDKB <cmd-BLEHIDKB>`:发送 Bluetooth LE HID 键盘信息 + :esp32 or esp32c3 : - :ref:`AT+BLEHIDMUS <cmd-BLEHIDMUS>`:发送 Bluetooth LE HID 鼠标信息 + :esp32 or esp32c3 : - :ref:`AT+BLEHIDCONSUMER <cmd-BLEHIDC>`:发送 Bluetooth LE HID consumer 信息 - :ref:`AT+BLUFI <cmd-BLUFI>`:开启或关闭 BluFi - :ref:`AT+BLUFINAME <cmd-BLUFINAME>`:查询/设置 BluFi 设备名称 - :ref:`AT+BLUFISEND <cmd-BLUFISEND>`: 发送 BluFi 用户自定义数据 @@ -206,13 +206,13 @@ Bluetooth® Low Energy AT 命令集 **功能:** - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: 查询 Bluetooth LE 设备的公共地址 - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -226,14 +226,14 @@ Bluetooth® Low Energy AT 命令集 **响应:** - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: +BLEADDR:<BLE_public_addr> OK - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -249,13 +249,13 @@ Bluetooth® Low Energy AT 命令集 **命令:** - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: AT+BLEADDR=<addr_type>[,<random_addr>] - .. only:: esp322 + .. only:: esp32c2 or esp32c6 :: @@ -289,7 +289,7 @@ Bluetooth® Low Energy AT 命令集 示例 ^^^^ - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: @@ -297,7 +297,7 @@ Bluetooth® Low Energy AT 命令集 AT+BLEADDR=1 // 设置随机设备地址的私有地址 AT+BLEADDR=0 // 设置公共设备地址 - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -699,7 +699,7 @@ Bluetooth® Low Energy AT 命令集 AT+BLEADVPARAM=50,50,0,1,4,0,1,"12:34:45:78:66:88" // 此时 Bluetooth LE 客户端扫描到的 ESP 设备的 MAC 地址为 "c2:34:45:78:66:89" - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 示例 ^^^^^^ @@ -710,7 +710,7 @@ Bluetooth® Low Energy AT 命令集 AT+BLEADVPARAM=50,50,0,0,4,0,1,"12:34:45:78:66:88" AT+BLEADVPARAM=32,32,6,0,7,0,0,"62:34:45:78:66:88",1,3 - .. only:: esp32c3 or esp32c6 + .. only:: esp32c3 示例1 ^^^^^^ @@ -887,7 +887,14 @@ Bluetooth® Low Energy AT 命令集 说明 ^^^^ - - 若未使用命令 :ref:`AT+BLEADVPARAM <cmd-BADVP>`\=<adv_parameter> 设置广播参数,则使用默认广播参数。 + .. only:: esp32 or esp32c3 + + - 若未使用命令 :ref:`AT+BLEADVPARAM <cmd-BADVP>`\=<adv_parameter> 设置广播参数,则使用默认广播参数。 + + .. only:: esp32c2 or esp32c6 + + - 必须先使用命令 :ref:`AT+BLEADVPARAM <cmd-BADVP>`\=<adv_parameter> 在开启广播之前设置广播参数。 + - 若未使用命令 :ref:`AT+BLEADVDATA <cmd-BADVD>`\=<adv_data> 设置广播数据,则发送全 0 数据包。 - 若之前已经使用命令 :ref:`AT+BLEADVDATA <cmd-BADVD>`\=<adv_data> 设置过广播数据,则会被 :ref:`AT+BLEADVDATAEX <cmd-BADVDEX>`\=<dev_name>,<uuid>,<manufacturer_data>,<include_power> 设置的广播数据覆盖,相反,如果先使用 AT+BLEADVDATAEX,则会被 AT+BLEADVDATA 设置的广播数据覆盖。 - 开启 Bluetooth LE 广播后,如果没有建立 Bluetooth LE 连接,那么将会一直保持广播;如果建立了连接,则会自动结束广播。 @@ -895,10 +902,20 @@ Bluetooth® Low Energy AT 命令集 示例 ^^^^ - :: + .. only:: esp32 or esp32c3 - AT+BLEINIT=2 // 角色:服务器 - AT+BLEADVSTART + :: + + AT+BLEINIT=2 // 角色:服务器 + AT+BLEADVSTART + + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEINIT=2 // 角色:服务器 + AT+BLEADVPARAM=50,50,0,0,7,0,, + AT+BLEADVSTART .. _cmd-BADVSTOP: @@ -932,11 +949,22 @@ Bluetooth® Low Energy AT 命令集 示例 ^^^^ - :: + .. only:: esp32 or esp32c3 - AT+BLEINIT=2 // 角色:服务器 - AT+BLEADVSTART - AT+BLEADVSTOP + :: + + AT+BLEINIT=2 // 角色:服务器 + AT+BLEADVSTART + AT+BLEADVSTOP + + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEINIT=2 // 角色:服务器 + AT+BLEADVPARAM=50,50,0,0,7,0,, + AT+BLEADVSTART + AT+BLEADVSTOP .. _cmd-BCONN: @@ -1240,13 +1268,13 @@ Bluetooth® Low Energy AT 命令集 **命令:** - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: AT+BLECFGMTU=<conn_index>,<mtu_size> - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -1261,14 +1289,14 @@ Bluetooth® Low Energy AT 命令集 参数 ^^^^ - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: - **<conn_index>**:Bluetooth LE 连接号,范围:[0,2]。 - **<mtu_size>**:MTU 长度,单位:字节,范围:[23,517]。 - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -1277,7 +1305,7 @@ Bluetooth® Low Energy AT 命令集 说明 ^^^^ - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: @@ -1285,7 +1313,7 @@ Bluetooth® Low Energy AT 命令集 - 仅支持客户端运行本命令设置 MTU 的长度。 - MTU 的实际长度需要协商,响应 ``OK`` 只表示尝试协商 MTU 长度,因此设置长度不一定生效,建议调用 :ref:`AT+BLECFGMTU? <cmd-BMTU>` 查询实际 MTU 长度。 - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -1295,7 +1323,7 @@ Bluetooth® Low Energy AT 命令集 示例 ^^^^ - .. only:: esp32 or esp32c3 or esp32c6 + .. only:: esp32 or esp32c3 :: @@ -1303,7 +1331,7 @@ Bluetooth® Low Energy AT 命令集 AT+BLECONN=0,"24:0a:c4:09:34:23" AT+BLECFGMTU=0,300 - .. only:: esp32c2 + .. only:: esp32c2 or esp32c6 :: @@ -1311,7 +1339,7 @@ Bluetooth® Low Energy AT 命令集 AT+BLECONN=0,"24:0a:c4:09:34:23" AT+BLECFGMTU=0 -.. only:: esp32 or esp32c3 or esp32c6 +.. only:: esp32 or esp32c3 .. _cmd-GSSRVCRE: @@ -1508,11 +1536,20 @@ Bluetooth® Low Energy AT 命令集 示例 ^^^^ - :: + .. only:: esp32 or esp32c3 - AT+BLEINIT=2 // 角色:服务器 - AT+BLEGATTSSRVCRE - AT+BLEGATTSSRV? + :: + + AT+BLEINIT=2 // 角色:服务器 + AT+BLEGATTSSRVCRE + AT+BLEGATTSSRV? + + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEINIT=2 // 角色:服务器 + AT+BLEGATTSSRV? .. _cmd-GSCHAR: @@ -1560,12 +1597,21 @@ Bluetooth® Low Energy AT 命令集 示例 ^^^^ - :: + .. only:: esp32 or esp32c3 - AT+BLEINIT=2 // 角色:服务器 - AT+BLEGATTSSRVCRE - AT+BLEGATTSSRVSTART - AT+BLEGATTSCHAR? + :: + + AT+BLEINIT=2 // 角色:服务器 + AT+BLEGATTSSRVCRE + AT+BLEGATTSSRVSTART + AT+BLEGATTSCHAR? + + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEINIT=2 // 角色:服务器 + AT+BLEGATTSCHAR? .. _cmd-GSNTFY: @@ -1610,16 +1656,30 @@ Bluetooth® Low Energy AT 命令集 示例 ^^^^ - :: + .. only:: esp32 or esp32c3 - AT+BLEINIT=2 // 角色:服务器 - AT+BLEGATTSSRVCRE - AT+BLEGATTSSRVSTART - AT+BLEADVSTART // 开始广播,当 client 连接后,必须配置接收 notify - AT+BLEGATTSCHAR? // 查询允许 notify 客户端的特征 - // 例如,使用 3 号服务的 6 号特征 notify 长度为 4 字节的数据,使用如下命令: - AT+BLEGATTSNTFY=0,3,6,4 - // 提示 ">" 符号后,输入 4 字节的数据,如 "1234",然后数据自动传输 + :: + + AT+BLEINIT=2 // 角色:服务器 + AT+BLEGATTSSRVCRE + AT+BLEGATTSSRVSTART + AT+BLEADVSTART // 开始广播,当 client 连接后,必须配置接收 notify + AT+BLEGATTSCHAR? // 查询允许 notify 客户端的特征 + // 例如,使用 3 号服务的 6 号特征 notify 长度为 4 字节的数据,使用如下命令: + AT+BLEGATTSNTFY=0,3,6,4 + // 提示 ">" 符号后,输入 4 字节的数据,如 "1234",然后数据自动传输 + + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEINIT=2 // 角色:服务器 + AT+BLEADVPARAM=50,50,0,0,7,0,, + AT+BLEADVSTART // 开始广播,当 client 连接后,必须配置接收 notify + AT+BLEGATTSCHAR? // 查询允许 notify 客户端的特征 + // 例如,使用 3 号服务的 6 号特征 notify 长度为 4 字节的数据,使用如下命令: + AT+BLEGATTSNTFY=0,3,6,4 + // 提示 ">" 符号后,输入 4 字节的数据,如 "1234",然后数据自动传输 .. _cmd-GSIND: @@ -1664,16 +1724,30 @@ Bluetooth® Low Energy AT 命令集 示例 ^^^^ - :: + .. only:: esp32 or esp32c3 - AT+BLEINIT=2 // 角色:服务器 - AT+BLEGATTSSRVCRE - AT+BLEGATTSSRVSTART - AT+BLEADVSTART // 开始广播,当 client 连接后,必须配置接收 indication - AT+BLEGATTSCHAR? // 查询客户端可以接收 indication 的特征 - // 例如,使用 3 号服务的 7 号特征 indicate 长度为 4 字节的数据,命令如下: - AT+BLEGATTSIND=0,3,7,4 - // 提示 ">" 符号后,输入 4 字节的数据,如 "1234",然后数据自动传输 + :: + + AT+BLEINIT=2 // 角色:服务器 + AT+BLEGATTSSRVCRE + AT+BLEGATTSSRVSTART + AT+BLEADVSTART // 开始广播,当 client 连接后,必须配置接收 indication + AT+BLEGATTSCHAR? // 查询客户端可以接收 indication 的特征 + // 例如,使用 3 号服务的 7 号特征 indicate 长度为 4 字节的数据,命令如下: + AT+BLEGATTSIND=0,3,7,4 + // 提示 ">" 符号后,输入 4 字节的数据,如 "1234",然后数据自动传输 + + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEINIT=2 // 角色:服务器 + AT+BLEADVPARAM=50,50,0,0,7,0,, + AT+BLEADVSTART // 开始广播,当 client 连接后,必须配置接收 indication + AT+BLEGATTSCHAR? // 查询客户端可以接收 indication 的特征 + // 例如,使用 3 号服务的 7 号特征 indicate 长度为 4 字节的数据,命令如下: + AT+BLEGATTSIND=0,3,7,4 + // 提示 ">" 符号后,输入 4 字节的数据,如 "1234",然后数据自动传输 .. _cmd-GSSETA: @@ -1689,9 +1763,17 @@ Bluetooth® Low Energy AT 命令集 **命令:** - :: + .. only:: esp32 or esp32c3 + + :: + + AT+BLEGATTSSETATTR=<srv_index>,<char_index>,[<desc_index>],<length> - AT+BLEGATTSSETATTR=<srv_index>,<char_index>,[<desc_index>],<length> + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEGATTSSETATTR=<srv_index>,<char_index>,<length> **响应:** @@ -1712,7 +1794,10 @@ Bluetooth® Low Energy AT 命令集 - **<srv_index>**:服务序号,可运行 :ref:`AT+BLEGATTSCHAR? <cmd-GSCHAR>` 查询。 - **<char_index>**:服务特征的序号,可运行 :ref:`AT+BLEGATTSCHAR? <cmd-GSCHAR>` 查询。 - - **[<desc_index>]**:特征描述符序号: + + .. only:: esp32c2 or esp32c6 + + - **[<desc_index>]**:特征描述符序号: - 若填写,则设置描述符的值; - 若未填写,则设置特征值。 @@ -1724,18 +1809,34 @@ Bluetooth® Low Energy AT 命令集 - 如果 ``<length>`` 参数值大于支持的最大长度,则设置会失败。关于 service table,请见 :project_file:`gatts_data.csv <components/customized_partitions/raw_data/ble_data/gatts_data.csv>`。 + .. only:: esp32c2 or esp32c6 + + - 无法设置特征值描述符的值。 + 示例 ^^^^ - :: + .. only:: esp32 or esp32c3 - AT+BLEINIT=2 // 角色:服务器 - AT+BLEGATTSSRVCRE - AT+BLEGATTSSRVSTART - AT+BLEGATTSCHAR? - // 例如,向 1 号服务的 1 号特征写入长度为 1 字节的数据,命令如下: - AT+BLEGATTSSETATTR=1,1,,1 - // 提示 ">" 符号后,输入 1 字节的数据即可,例如 "8",然后设置开始 + :: + + AT+BLEINIT=2 // 角色:服务器 + AT+BLEGATTSSRVCRE + AT+BLEGATTSSRVSTART + AT+BLEGATTSCHAR? + // 例如,向 1 号服务的 1 号特征写入长度为 1 字节的数据,命令如下: + AT+BLEGATTSSETATTR=1,1,,1 + // 提示 ">" 符号后,输入 1 字节的数据即可,例如 "8",然后设置开始 + + .. only:: esp32c2 or esp32c6 + + :: + + AT+BLEINIT=2 // 角色:服务器 + AT+BLEGATTSCHAR? + // 例如,向 1 号服务的 1 号特征写入长度为 1 字节的数据,命令如下: + AT+BLEGATTSSETATTR=1,1,1 + // 提示 ">" 符号后,输入 1 字节的数据即可,例如 "8",然后设置开始 .. _cmd-GCPRIMSRV: @@ -2285,20 +2386,36 @@ Bluetooth® Low Energy AT 命令集 示例 ^^^^ - :: + .. only:: esp32 or esp32c3 - AT+RESTORE - AT+BLEINIT=2 - AT+BLEGATTSSRVCRE - AT+BLEGATTSSRVSTART - AT+BLEADDR? - AT+BLESECPARAM=1,0,16,3,3 - AT+BLESETKEY=123456 - AT+BLEADVSTART - // 使用 Bluetooth LE 调试 app 作为 client 与 {IDF_TARGET_NAME} 设备建立 Bluetooth LE 连接 - AT+BLEENC=0,3 + :: -.. only:: esp32 or esp32c3 or esp32c6 + AT+RESTORE + AT+BLEINIT=2 + AT+BLEGATTSSRVCRE + AT+BLEGATTSSRVSTART + AT+BLEADDR? + AT+BLESECPARAM=1,0,16,3,3 + AT+BLESETKEY=123456 + AT+BLEADVSTART + // 使用 Bluetooth LE 调试 app 作为 client 与 {IDF_TARGET_NAME} 设备建立 Bluetooth LE 连接 + AT+BLEENC=0,3 + + .. only:: esp32c2 or esp32c6 + + :: + + AT+RESTORE + AT+BLEINIT=2 + AT+BLEADDR? + AT+BLESECPARAM=1,0,16,3,3 + AT+BLESETKEY=123456 + AT+BLEADVPARAM=50,50,0,0,7,0,, + AT+BLEADVSTART + // 使用 Bluetooth LE 调试 app 作为 client 与 {IDF_TARGET_NAME} 设备建立 Bluetooth LE 连接 + AT+BLEENC=0,3 + +.. only:: esp32 or esp32c3 .. _cmd-BLEENCRSP: @@ -2598,7 +2715,7 @@ Bluetooth® Low Energy AT 命令集 AT+BLESETKEY=123456 -.. only:: esp32 or esp32c3 or esp32c6 +.. only:: esp32 or esp32c3 .. _cmd-BLEHIDINIT: @@ -2949,6 +3066,7 @@ Bluetooth® Low Energy AT 命令集 - 如需设置 BluFi 设备名称,请在运行 :ref:`AT+BLUFI=1 <cmd-BLUFI>` 命令前设置,否则将使用默认名称 ``BLUFI_DEVICE``。 - BluFi 设备名称最大长度为 26 字节。 +- Blufi APP 可以在应用商店中下载。 示例 ^^^^ diff --git a/docs/zh_CN/AT_Command_Set/Basic_AT_Commands.rst b/docs/zh_CN/AT_Command_Set/Basic_AT_Commands.rst index 19416edc..7add3c7d 100644 --- a/docs/zh_CN/AT_Command_Set/Basic_AT_Commands.rst +++ b/docs/zh_CN/AT_Command_Set/Basic_AT_Commands.rst @@ -1546,7 +1546,7 @@ **响应:** -.. only:: esp32 or esp32c3 +.. only:: esp32 or esp32c3 or esp32c6 :: @@ -1565,7 +1565,7 @@ **命令:** -.. only:: esp32 or esp32c3 +.. only:: esp32 or esp32c3 or esp32c6 :: @@ -1618,7 +1618,7 @@ .. only:: esp32 - - **<ble_adv_power>**:Bluetooth LE 广播的 RF TX Power。 + - **<ble_adv_power>**:Bluetooth LE 广播的 RF TX Power。取值范围为 [0,7]: - 0: 7 dBm - 1: 4 dBm @@ -1631,26 +1631,45 @@ .. only:: esp32c3 - - **<ble_adv_power>**:Bluetooth LE 广播的 RF TX Power。 - - - 0: -27 dBm - - 1: -24 dBm - - 2: -21 dBm - - 3: -18 dBm - - 4: -15 dBm - - 5: -12 dBm - - 6: -9 dBm - - 7: -6 dBm - - 8: -3 dBm - - 9: -0 dBm - - 10: 3 dBm - - 11: 6 dBm - - 12: 9 dBm - - 13: 12 dBm - - 14: 15 dBm - - 15: 18 dBm - -.. only:: esp32 or esp32c3 + - **<ble_adv_power>**:Bluetooth LE 广播的 RF TX Power。取值范围为 [0,15]: + + - 0: -24 dBm + - 1: -21 dBm + - 2: -18 dBm + - 3: -15 dBm + - 4: -12 dBm + - 5: -9 dBm + - 6: -6 dBm + - 7: -3 dBm + - 8: -0 dBm + - 9: 3 dBm + - 10: 6 dBm + - 11: 9 dBm + - 12: 12 dBm + - 13: 15 dBm + - 14: 18 dBm + - 15: 21 dBm + +.. only:: esp32c6 + + - **<ble_adv_power>**:Bluetooth LE 广播的 RF TX Power。取值范围为 [3,15]: + + - 3: -15 dBm + - 4: -12 dBm + - 5: -9 dBm + - 6: -6 dBm + - 7: -3 dBm + - 8: -0 dBm + - 9: 3 dBm + - 10: 6 dBm + - 11: 9 dBm + - 12: 12 dBm + - 13: 15 dBm + - 14: 18 dBm + - 15: 20 dBm + + +.. only:: esp32 or esp32c3 or esp32c6 - **<ble_scan_power>**:Bluetooth LE 扫描的 RF TX Power,参数取值同 ``<ble_adv_power>`` 参数。 - **<ble_conn_power>**:Bluetooth LE 连接的 RF TX Power,参数取值同 ``<ble_adv_power>`` 参数。