【BLE】CC2541之indicate
我参考上面这篇文章,做了indicate试验,用char4,char7均已成功。
现在有个问题,例子是用从机和btool通讯。
我想用从机和主机通讯,那主机程序该如何写呢?
主机该如何接收呢?谢谢!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我参考上面这篇文章,做了indicate试验,用char4,char7均已成功。
现在有个问题,例子是用从机和btool通讯。
我想用从机和主机通讯,那主机程序该如何写呢?
主机该如何接收呢?谢谢!
谢谢!我看了,这个程序只在主机里有。
if ( ( pMsg->method == ATT_READ_RSP ) ||
( ( pMsg->method == ATT_ERROR_RSP ) &&
( pMsg->msg.errorRsp.reqOpcode == ATT_READ_REQ ) ) )
{
if ( pMsg->method == ATT_ERROR_RSP )
{
uint8 status = pMsg->msg.errorRsp.errCode;
LCD_WRITE_STRING_VALUE( "Read Error", status, 10, HAL_LCD_LINE_1 );
}
else
{
// After a successful read, display the read value
uint8 valueRead = pMsg->msg.readRsp.value[0];
LCD_WRITE_STRING_VALUE( "Read rsp:", valueRead, 10, HAL_LCD_LINE_1 );
NPI_PrintValue("Read rsp:",valueRead, 10);
}
simpleBLEProcedureInProgress = FALSE;
}
这一段是用来读的。
我要读从机的数据,从机发送用什么函数呢?请多指教。
else if ( ( pMsg->method == ATT_WRITE_RSP ) ||
( ( pMsg->method == ATT_ERROR_RSP ) &&
( pMsg->msg.errorRsp.reqOpcode == ATT_WRITE_REQ ) ) )
{
if ( pMsg->method == ATT_ERROR_RSP == ATT_ERROR_RSP )
{
uint8 status = pMsg->msg.errorRsp.errCode;
LCD_WRITE_STRING_VALUE( "Write Error", status, 10, HAL_LCD_LINE_1 );
}
else
{
// After a succesful write, display the value that was written and increment value
LCD_WRITE_STRING_VALUE( "Write sent:", simpleBLECharVal++, 10, HAL_LCD_LINE_1 );
}
simpleBLEProcedureInProgress = FALSE;
}
这个里面也没有写操作,只显示了一下。