AnsweredAssumed Answered

Can BleServDisc_FindService be uses in a Peripheral device ?

Question asked by Daniel Xiao on Mar 17, 2019
Latest reply on Mar 19, 2019 by Estephania Martinez

Hi,

In the sample project Wireless Uart, there is a section of code in wireless_uart.c like this:

//-------------------------

void BleApp_StateMachineHandler(deviceId_t peerDeviceId, uint8_t event)
{
uint16_t tempMtu = 0;

/* invalid client information */
if(gInvalidDeviceId_c == maPeerInformation[peerDeviceId].deviceId)
{
return;
}

switch (maPeerInformation[peerDeviceId].appState)
{
case mAppIdle_c:
{
if (event == mAppEvt_PeerConnected_c)
{
/* Let the central device initiate the Exchange MTU procedure*/
if (mGapRole == gGapCentral_c)
{
/* Moving to Exchange MTU State */
maPeerInformation[peerDeviceId].appState = mAppExchangeMtu_c;
GattClient_ExchangeMtu(peerDeviceId);
}
else
{
/* Moving to Service Discovery State*/
maPeerInformation[peerDeviceId].appState = mAppServiceDisc_c;

/* Start Service Discovery*/
BleServDisc_FindService(peerDeviceId,
gBleUuidType128_c,
(bleUuid_t*) &uuid_service_wireless_uart);
}
}
}
break;

//-------------------

 

It shows if the device is a Peripheral device, BleServDisc_FindService needs to be called. But from my point of view, BleServDisc_FindService is a API for Central device, not for Peripheral. 

So, why BleServDisc_FindService needs to be called here ?

 

B.R

Daniel Xiao

Outcomes