Skip to content

Instantly share code, notes, and snippets.

@shirish47
Created May 25, 2016 05:10
Show Gist options
  • Save shirish47/1d1ac7cf200cd4634c0233da14cfdbb2 to your computer and use it in GitHub Desktop.
Save shirish47/1d1ac7cf200cd4634c0233da14cfdbb2 to your computer and use it in GitHub Desktop.
BLE central multiple launch
if(sState==NSETSERVICESTATE){
Serial.println("Going to locate service");
sState=DISCOVERINGSERVICE;
ble.gattClient().launchServiceDiscovery(chandle.connHandle, ServiceCallBack, CharacteristicCallBack, service1_uuid,chars_uuid1);
}else if(sState==FOUNDSERVICE && !ble.gattClient().isServiceDiscoveryActive()){
Serial.println(" Discovering Chars");
// if(charB1.cs==NSETCHARSTATE)
// {
// Serial.println("Searching CharB1.");
// charB1.cs=DISCOVERINGCHAR;
// ble.gattClient().launchServiceDiscovery(chandle.connHandle, ServiceCallBack, CharacteristicCallBack, service1_uuid,chars_uuid1);
// }else
if(charB2.cs==NSETCHARSTATE && charB1.cs==CHARFOUND && notifyset)
{
notifyset=false;
printchar(chars1);
delay(1000);
Serial.println("Searching CharB2.");
charB2.cs=DISCOVERINGCHAR;
ble.gattClient().launchServiceDiscovery(chandle.connHandle, ServiceCallBack2, CharacteristicCallBack2, service1_uuid,chars_uuid2);
}else if(charB3.cs==NSETCHARSTATE && charB2.cs==CHARFOUND)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment