经过一周的调试与测试,所有代码均已经完成:
主要功能:
一套AT指令集;
AT + 指令 = 指令内容+\n
指示性指令:AT+Help=?\n
回复指令:
Available commands
------------------
Help : help information
RESET : Reset BLE:AT+RESET=?
VERSION : Query the version number of BLE:AT+VERSION=?
MAC : Set BLE's MAC address:AT+MAC=?
DISCONN : Disconnect BLE:AT+DISCONN=?
POWER : Set BLE transmission strength
NAME : Set the name of the BLE:AT+NAME=?
DeAdv : Delete some broadcast information
StarAdv : Turn on BLE radio:AT+StarAdv=?
BLEio : Set the output capacity of BLEIO
BLEConInt : Set the connection interval:AT+BLEConInt=?
BLEAdvInt : Set the broadcast interval:AT+BLEAdvInt=?
Mode : Set the working mode of BLE:AT+Mode=?
Scan : Turn on scanning:AT+Scan=?
MacDir : direct connection:AT+MacDir=123456
NameDir : direct connection:AT+NameDir=lsd1234
Notify : Open the notification:AT+Notify=N
//************************************************//
从机指令:
AT+RESET=?\n 复位指令 》》》进行复位操作 NVIC_SystemReset();
AT+MAC=?\n mac查询指令 》》》查询mac地址 aci_hal_write_config_data
AT+MAC=123456\n 设置MAC地址 》》》设置MAC地址 aci_hal_write_config_data
AT+StarAdv=?\n 开启广播指令 》》》开启蓝牙广播 aci_gap_set_discoverable
AT+NAME=?\n 查询蓝牙name
AT+NAME=123\n 设置蓝牙名字 aci_gatt_update_char_value
AT+BLEConInt=?\n 查询连接间隔 》》》查询连接间隔 aci_gap_set_discoverable
AT+BLEAdvInt=?\n 查询广播间隔 》》》查询广播间隔 aci_gap_set_discoverable
//************************************************//
主机指令:
AT+Mode=?\n 查询主从模式 》》查询主模式还是从模式
AT+Mode=4\n 设置为主模式 》》 aci_gap_init
AT+Scan= \n 开启扫描 》》开启扫描指令 aci_gap_start_general_discovery_proc
AT+MacDir=123456\n 》》设置想要连接的MAC地址 aci_gap_create_connection
AT+NameDir=STA\n 》》设置想要连接的名字 aci_gap_create_connection
AT+Notify=N\n 》》开启notify aci_gatt_write_char_desc
以上为主要的at命令,后面的是用到的函数。其实官方代码很规范的。大部分蓝牙命令都应用到了chat.c。一些关于服务的代码都放在了gatt_db.c;写的不规范的麻烦大家指正,谢谢,链接:https://github.com/Tangdabao/ST_ble
Sorry,忘记附上链接了,感谢版主提示,顺便不要脸的想要求版主帮我加上链接,回复可见。 |