7 years, 11 months ago.

NRF51822 Central service discovery with multiple characteristics.

Hi,

I have modified my code from BleCentralTest code in arduino_examples. I also have my blePheripherial device working fine with android app. I have made custom Service with 5 chars.. all works fine on android. I want to get BLECentral running properly. The thing is I launch serviceand characteristic discovery, I am only able to get just one chars on that service. when I attampt to discover other char after termination I only get the char that was previously discovered. code is quite big. So I could not post it completely.

this is part of main after target found and connected..

if(sState==NSETSERVICESTATE){ Serial.println("Going to locate service"); sState=DISCOVERINGSERVICE; ble.gattClient().launchServiceDiscovery(chandle.connHandle, ServiceCallBack, CharacteristicCallBack, service1_uuid,chars_uuid1); this works and I get chars working }else if(sState==FOUNDSERVICE && !ble.gattClient().isServiceDiscoveryActive()){ Serial.println(" Discovering Chars");

if(charB2.cs==NSETCHARSTATE && charB1.cs==CHARFOUND && notifyset) { Serial.println("Searching CharB2."); charB2.cs=DISCOVERINGCHAR; ble.gattClient().launchServiceDiscovery(chandle.connHandle, ServiceCallBack2, CharacteristicCallBack2, service1_uuid,chars_uuid2); this also works but I get same chars as first one.. :( }else if(charB3.cs==NSETCHARSTATE && charB2.cs==CHARFOUND) ..........................

Be the first to answer this question.