主题中讨论的其他器件:LAUNCHXL-CC26X2R1
工具与软件:
您好!
我将基于 simple_peripheral add connection-AOA 构建我自己的项目。 起初我使用了 HCI 接口、但它不起作用、 现在我打算使用 RTLSSRV API、因为我看到有人成功地实现了类似的功能。
例如:
我的版本如下:
SW: simplelink_cc13xx_cc26xx_sdk_5_40_00_40
硬件: LAUNCHXL-CC26X2R1 + BOOSTXL-AOA
以下是我的更改:
1.添加 RTLSSrv 初始化函数
void RTLSCoordinator_rtlsSrvlMsgCb(rtlsSrv_evt_t *pRtlsSrvEvt)
{
// Enqueue the message to switch context
BT_PRINT(("RTLS EVENT TYPE is %02x \r\n" ,pRtlsSrvEvt->evtType));
BT_DUMP_HEX(pRtlsSrvEvt->evtData,pRtlsSrvEvt->evtSize);
BT_PRINT(("\r\n"));
}
static void SimplePeripheral_taskFxn(UArg a0, UArg a1)
{
...
RTLSSrv_init(2);
RTLSSrv_register(RTLSCoordinator_rtlsSrvlMsgCb);
...
}
2.在.syscfg 中添加 BLE AOA 配置
3.连接至目标时、请使用 cmdCTERxCommand 和 cmdCTEEnableedCommand 函数。
static cmd_ack_t cmdCTERxCommand(uint8_t *s, uint16_t len, uint16_t id)
{
BT_PRINT(("cte ENABLE ! \r\n"));
conn_ctx_t *p_conn_ctx = mible_linkdb_get_info_by_conn_index(0);
if(p_conn_ctx == NULL)
return cmd_ack_invalid_param;
BT_DUMP_HEX(p_conn_ctx->connect.peer_addr,6);
uint8_t ant_pattern[] = {0,1,2};
#if(USE_RTLS_API)
uint8_t ret;
PIN_Handle status;
status = RTLSSrv_initAntArray(ant_pattern[0]);
if(status == NULL)
{
BT_PRINT(("set ant array error !"));
}
ret = RTLSSrv_setConnCteReceiveParams(p_conn_ctx->conn_handle,1,2,sizeof(ant_pattern),ant_pattern);
if(ret!= 0)
{
BT_PRINT(("set cte parms error !"));
}
ret = RTLSSrv_setCteSampleAccuracy(p_conn_ctx->conn_handle,1,1,1,1,0x11);
if(ret!= 0)
{
BT_PRINT(("set sample accuracy error !"));
}
#else
uint8_t ret = HCI_LE_SetConnectionCteReceiveParamsCmd(p_conn_ctx->conn_handle,1,2,sizeof(ant_pattern),ant_pattern);
/*Configure AoA receiver parameters */
if(ret!= 0)
{
BT_PRINT(("cte config error !"));
}
else
{
BT_PRINT(("cte config ok ! \r\n"));
}
#endif
BT_PRINT(("end,ok,return !"));
return cmd_ack_ok;
}
static cmd_ack_t cmdCTEEnabledCommand(uint8_t *s, uint16_t len, uint16_t id)
{
conn_ctx_t *p_conn_ctx = mible_linkdb_get_info_by_conn_index(0);
if(p_conn_ctx == NULL)
return cmd_ack_invalid_param;
BT_DUMP_HEX(p_conn_ctx->connect.peer_addr,6);
#if(USE_RTLS_API)
uint8_t ret = RTLSSrv_setConnCteRequestEnableCmd(p_conn_ctx->conn_handle,
1,
2,
10,
0);
if(ret!= 0)
{
BT_PRINT(("set cte enable error !"));
}
#else
uint8_t ret = HCI_LE_SetConnectionCteRequestEnableCmd(p_conn_ctx->conn_handle,1,2,10,0);
if(ret!= 0)
{
BT_PRINT(("cte request error !"));
}
else
{
BT_PRINT(("cte request enabled !"));
}
#endif
return cmd_ack_ok;
}
以下是它工作时的一些日志:
[13:41:58.029]发→◇AT+CTE_RX □ [13:41:58.032]收←◆cte ENABLE ! EB F2 E3 92 C6 84 end,ok,return ! OK MSG Event type is 91 !!!! hci message is FF [13:42:02.980]发→◇AT+CTE_ENABLE □ [13:42:02.983]收←◆EB F2 E3 92 C6 84 RTLS EVENT TYPE is 04 00 00 56 20 1A 00 OK
当 cmdCTEEnableedCommand 工作时、 RTLSCoordinator_rtlssSrvlMsgCb 将 抛出