TI中文支持网
TI专业的中文技术问题搜集分享网站

当外设与手机连接后,可以监测到每次“连接事件”是成功还是失败吗?

当外设与手机连接后,可以监测到每次“连接事件”是成功还是失败吗?

因为我不想等到发生“连接超时”(例如20s)后才知道断线了,我想在每次“连接事件”后,闪烁一次绿灯表示连接事件OK,若闪烁一次红灯表示连接事件失败。

如何实现?

YiKai Chen:

基本上就是在processGapStateChangeEvt 裡面的case GAPROLE_CONNECTED:/case GAPROLE_WAITING:裡面處理

Alvin Chen:

回复 YiKai Chen:

status_t GapInit_connect ( GAP_Peer_Addr_Types_tpeerAddrType,
uint8_t *pPeerAddress,
uint8_tphys,
uint16_ttimeout
)
Initiate connection with the specified peer device

Parameters
peerAddrType peer device's address type.
pPeerAddress peer device's address
phys PHY to try making connection on: shall be one from GapInit_InitPhy_t.
timeout If there is no chance to initiate a connection within timeout ms, this connect request will be canceled automatically. if timeout is 0, the initiator will keep trying to get a chance to make a connection until GapInit_cancelConnect is called.
Returns
SUCCESS
bleNotReady
bleInvalidRange
bleMemAllocError
bleAlreadyInRequestedMode
当你timeout 设置为0时会立刻返回在processGapStateChangeEvt

user5397061:

回复 Alvin Chen:

请问
1. 这个 GapInit_connect () 函数在哪个c文件里面?
2. 若按你说的把timeout设为0后,是不是当手机连接CC2640R2F后,按照约定的“连接时间”,CC2640R2F能将“连接事件”成功或失败的结果,通过某个回调函数通知用户程序吗?

Alvin Chen:

回复 user5397061:

请提供你的芯片型号以及SDK版本。

赞(0)
未经允许不得转载:TI中文支持网 » 当外设与手机连接后,可以监测到每次“连接事件”是成功还是失败吗?
分享到: 更多 (0)