I have installed the multi-role demo for stack 2.1 and I experienced some problem.
First, in the GAP_LINK_ESTABLISHED_EVENT handler,
the connection handle was not assigned, so I fixed that
case GAP_LINK_ESTABLISHED_EVENT:
{
if (pEvent->gap.hdr.status == SUCCESS)
{
LCD_WRITE_STRING("Connected!", LCD_PAGE3);
LCD_WRITE_STRING_VALUE("Connected to ", gapRoleNumLinks(GAPROLE_ACTIVE_LINKS) ,10, LCD_PAGE0);
connHandle = pEvent->linkCmpl.connectionHandle;
connecting_state = 0;
Then I noticed a problem when the time came to exchange the MTU.
I modified the function to find that the problem is that GATT_ExchangeMTU returns 0x01 aka FAILURE:
/*********************************************************************
* @fn SimpleBLECentral_startDiscovery
*
* @brief Start service discovery.
*
* @return none
*/
static void SimpleBLEMulti_startDiscovery(void)
{
attExchangeMTUReq_t req;
// Initialize cached handles
svcStartHdl = svcEndHdl = charHdl = 0;
discState = BLE_DISC_STATE_MTU;
// Discover GATT Server's Rx MTU size
req.clientRxMTU = maxPduSize - L2CAP_HDR_SIZE;
// ATT MTU size should be set to the minimum of the Client Rx MTU
// and Server Rx MTU values
bStatus_t status = GATT_ExchangeMTU(connHandle, &req, selfEntity);
LCD_WRITE_STRING_VALUE("exch mtu code ",status ,10, LCD_PAGE0);
}
Why would that be?
This is very frustrating, I had a lot of issues and was politely but with a lot of insistence asked to use the new multi-role demo for stack 2.1.
It is not perfect, cant complain about that, but doing so required me to spend a lot of time, and now I am stuck with this problem.