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

cc2640r2fmulti_role主机模式求助

谢谢你们抽空点进来看!

我使用multi_role例程,主机自动连接从机;主机扫描从机广播过程中,主机是通过什么数据判断自己需要连接的从机?

主机发送数据到从机过程需要对读写函数做出什么修改?求大神指点迷津

bool mr_doGattRw(uint8_t index)
{
bStatus_t status = FAILURE;
uint8_t Writebuf[20]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
// If characteristic has been discovered
if (discInfo[index].charHdl != 0)
{
// Do a read / write as long as no other read or write is in progress
if (doWrite)
{
// Do a write
attWriteReq_t req;

// Allocate GATT write request
req.pValue = GATT_bm_alloc(connHandleMap[index].connHandle, ATT_WRITE_REQ, 20, NULL);
// If successfully allocated
if (req.pValue != NULL)
{
// Fill up request
req.handle = discInfo[index].charHdl;
req.len = 20;
req.pValue = Writebuf;
req.sig = 0;
req.cmd = 0;

// Send GATT write to controller
status = GATT_WriteCharValue(connHandleMap[index].connHandle, &req, selfEntity);

// If not sucessfully sent
if ( status != SUCCESS )
{
// Free write request as the controller will not
GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ);
}
MY_UART_Send("10",3);
}
}
// Do a read
else
{
// Create read request…place in CSTACK
attReadReq_t req;

// Fill up read request
req.handle = discInfo[index].charHdl;

// Send read request. no need to free if unsuccessful since the request
// is only placed in CSTACK; not allocated
status = GATT_ReadCharValue(connHandleMap[index].connHandle, &req, selfEntity);
}

// If succesfully queued in controller
if (status == SUCCESS)
{
//Toggle read / write
doWrite = !doWrite;
}
}

return TRUE;
}

Viki Shi:

建议参考下这篇文档: blog.csdn.net/…/56070013

user5758795:

回复 Viki Shi:

从机不是我们提供,我应该向甲方要什么资料才可以识别呢?
还有现在我的蓝牙能连接到从机,但是无法通信

赞(0)
未经允许不得转载:TI中文支持网 » cc2640r2fmulti_role主机模式求助
分享到: 更多 (0)