基础的要求
1. 设置广播参数为间隔1000ms,不停止
2. 添加广播消息,含01、03、09、FF TYPE
3. 设置蓝牙通信间隔参数为320ms、400ms、2、4000ms超时
3. 配置发射功率为较低
4. 配置GATT所有数据与原Nordic 配置一致
为了解决以上疑问,需要多看一些示例代码。目前还没有看到有价值的例程。但是可以查看代码中的API接口说明,多试几次,可以找到。
// 自定义的广播数据
uint8_t advData[] = {0x02, 0x01, 0x06, 0x03, 0x03, 0x30, 0xFF, 0x03, 0xFF, 0xAA, 0x55, 0x0B, 0x09, 0x53, 0x55, 0x4E, 0x4C, 0x41, 0x4E, 0x54, 0x30, 0x30, 0x31};//0x02 01 06 03 03 30 FF 03 FF AA 55 0B 09 53 55 4E 4C 41 4E 54 30 30 31
/**************************************************************************//**
* Bluetooth stack event handler.
* This overrides the dummy weak implementation.
*
* @param[in] evt Event coming from the Bluetooth stack.
*****************************************************************************/
void sl_bt_on_event(sl_bt_msg_t *evt)
{
sl_status_t sc;
static int cntt = 0;
bd_addr address;
uint8_t address_type;
switch (SL_BT_MSG_ID(evt->header)) {
// -------------------------------
// This event indicates the device has started and the radio is ready.
// Do not call any stack command before receiving this boot event!
case sl_bt_evt_system_boot_id:
// Extract unique ID from BT Address.
sc = sl_bt_system_get_identity_address(&address, &address_type);
app_assert_sta

本文详细描述了如何在蓝牙设备编程中设置广播参数(如1000ms间隔),添加包含特定消息的广播,配置通信间隔和发射功率,以及使用app_timer进行RSSI刷新。作者强调了理解和使用API接口的重要性,并提到了连接参数设置的注意事项。
最低0.47元/天 解锁文章
856

被折叠的 条评论
为什么被折叠?



