Wireless Communication Library Support Forum
Frameworks => Bluetooth Framework => Topic started by: OneEng on August 14, 2014, 07:02:46 PM
-
See the code below (using the Toshiba bluetooth stack):
First, start the discovery. After discovery starts attempt to stop discovery.
The code below captures the error and makes it invisible to the user. The discovery appears to work if you try again after termination, so the effect appears minimal (but annoying).
// terminate the discovery
void __fastcall TMTSBTTool::StopFindBtnClick(TObject *Sender)
{
int Rc;
if (wclBluetoothDiscovery->Active)
{
try
{
LstBx->Items->Insert(0,"Requesting terminate of discovery");
Rc = wclBluetoothDiscovery->Terminate();
LstBx->Items->Insert(0,"Termination Complete with return code = "+String(Rc));
if (Rc!=WCL_E_SUCCESS)
wclShowError(Rc);
}
catch(...)
{
// dont do anything since it seems to be a bug that doesn't have an effect
}
}
else
LstBx->Items->Insert(0,"Terminate requested, but discovery is not active.");
-
Hello,
WCL version and error message?
-
I am an idiot Mike.
I was causing it by accessing the Devices object in the bluetooth discover event when it was Null. Funny that the issue caused an exception in the terminate call though.
-
It happes with any of us :)
It is becasue OnDiscoveryComplete called from Terminate in this case.