In order to verify BLE-related functions, a series of AT CMDs are designed. All BLE AT CMDs start with AT+, followed by specific command and parameters. If the CMD is executed successfully, CMDRSP:OK is returned. If the CMD execution fails, CMDRSP:ERROR is returned.
0x02 : Resolvable Private Address,if no IRK use the public address
0x03 : Resolvable Private Address,if no IRK use the random address
param5
adv_type
0x00 : Legacy advertising
0x01 : Extended advertising
0x02 : Periodic advertising
param6
adv_properties(Bit number)
0 : Connectable advertising
1 : Scannable advertising
2 : Directed advertising
3 : High Duty Cycle Directed Connectable advertising
4 : Use legacy advertising PDUs
5 : Omit advertiser’s address from all PDUs(“anonymous advertising”)
6 : Include TxPower in the extended header of the advertising PDU
param7
Primary_Advertising_PHY
0x01 : Primary advertisement PHY is LE 1M
0x03 : Primary advertisement PHY is LE Coded
param8
Secondary_Advertising_PHY
0x01 : Secondary advertisement PHY is LE 1M
0x02 : Secondary advertisement PHY is LE 2M
0x03 : Secondary advertisement PHY is LE Coded
Test Case
Set the legacy advertising parameters:AT+BLEADVPARAM=7,120,160,0,0,3,1,1
Set the extended advertising parameters:AT+BLEADVPARAM=7,120,160,0,1,1,1,1
Set the periodic advertising parameters:AT+BLEADVPARAM=7,120,160,0,2,0,1,3
2.AT+BLEADVDATA
Function Description
Used to set the data used in advertising packets
CMD Format
AT+BLEADVDATA=param1,param2
param1
Advertising data, the data format is shown in Figure 1
param2
Advertising_Data_Length
Range: 0x00 to 0x1F
Figure 1. Advertising and Scan Response data format
The common AD type identifier values are defined in the table below:
Type Value
Description
0x01
«Flags»
0x02
«Incomplete List of 16-bit Service Class UUIDs»
0x03
«Complete List of 16-bit Service Class UUIDs»
0x04
«Incomplete List of 32-bit Service Class UUIDs»
0x05
«Complete List of 32-bit Service Class UUIDs»
0x06
«Incomplete List of 128-bit Service Class UUIDs»
0x07
«Complete List of 128-bit Service Class UUIDs»
0x08
«Shortened Local Name»
0x09
«Complete Local Name»
Test Case
AT+BLEADVDATA=0201060909373235365f424c45,D,in this advertising uses the AD type «Complete Local Name» ,referring to ASSIC code table,it can be seen that the Name is 7256_BLE.
3.AT+BLESCANRSPDATA
Function Description
Used to provide data used in Scanning Packets
CMD Format
AT+BLE=SETSCANRSPDATA=param1,param2
param1
Scan_Response_Data, the data format is shown in Figure 1
param2
Scan_Response_Data_Length
Range: 0x00 to 0x1F
Test Case
AT+BLESCANRSPDATA=0909373235365f424c45,A
4.AT+BLEPERADVDATA
Function Description
Used to set the data used in periodic advertising packets
CMD Format
AT+BLEPERADVDATA,param1,param2
param1
Periodic_Advertising_Data, the data format is shown in Figure 1
param2
Periodic_Advertising_Data_Length
Range: 0x00 to 0x1F
Test Case
AT+BLEPERADVDATA=0909373235365f424c45,A
5.AT+BLEADVENABLE
Function Description
Used to start or stop advertising
CMD Format
AT+BLEADVENABLE=param1
param1
Advertising_Enable
0x00 : Advertising is disabled
0x01 : Advertising is enabled
Test Case
Stop advertising:AT+BLEADVENABLE=0
Start advertising:AT+BLEADVENABLE=1
6.AT+BLE=SETSCANPARAM
Function Description
Used to set the scanning parameters
CMD Format
AT+BLESCANPARAM=param1,param2,param3,param4
param1
Own_Address_Type
0x00 : Public Device Address
0x01 : Random Device Address
0x02 : Resolvable Private Address,if no IRK use the public address
0x03 : Resolvable Private Address,if no IRK use the random address
param2
Scanning_PHYs
0x01 : Scan advertisements on the LE 1M PHY
0x04 : Scan advertisements on the LE Coded PHY
0x05 : Scan advertisements on the LE 1M PHY and Coded PHY