Can BleServDisc_FindService be uses in a Peripheral device ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can BleServDisc_FindService be uses in a Peripheral device ?

565 Views
xl_xmu
Contributor I

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

Labels (2)
0 Kudos
1 Reply

479 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

The example has the capabilities to set the device as a central or as a peripheral, you can connect two boards and one can act as a central and one as a peripheral, that it's the reason why both capabilities are added. 

Regards ,
Estephania 

0 Kudos