From b4d743a9ad8b623b56704ac5793e20938475ae0b Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Fri, 22 May 2015 10:47:43 +0100 Subject: [PATCH] make service discovery idempotent. --- btle/btle_discovery.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/btle/btle_discovery.cpp b/btle/btle_discovery.cpp index f9c634f..80bbbbf 100644 --- a/btle/btle_discovery.cpp +++ b/btle/btle_discovery.cpp @@ -30,6 +30,10 @@ ServiceDiscovery::launch(Gap::Handle_t connectionHandle, const UUID &matchingServiceUUIDIn, const UUID &matchingCharacteristicUUIDIn) { + if (isActive()) { + return BLE_ERROR_INVALID_STATE; + } + sdSingleton.serviceCallback = sc; sdSingleton.characteristicCallback = cc; sdSingleton.matchingServiceUUID = matchingServiceUUIDIn;