Wireless Communication Library Support Forum

Frameworks => Bluetooth Framework => Topic started by: mariluz.costa on February 08, 2016, 03:26:12 PM

Title: How to detect that my paired device is connected to HandsFreeService using WCL?
Post by: mariluz.costa on February 08, 2016, 03:26:12 PM
Hi,

I get a list of paired devices and I want to test for each of them which one is connected to wclBluetoothHandsFreeClient.
I tried with myWCLBluetoothDevice.GetConnected () but it seems to not return the expected information.
Does someone get an idea how doing that?

Mariluz
Title: Re: How to detect that my paired device is connected to HandsFreeService using WCL?
Post by: Mike Petrichenko on February 08, 2016, 04:02:42 PM
Hi,

You can simple compare device's address used in wclHandsFreeClient with each found device.
Title: Re: How to detect that my paired device is connected to HandsFreeService using WCL?
Post by: mariluz.costa on February 08, 2016, 05:58:51 PM
If I instantiate wclBluetoothHandsFreeClient it's empty of any device. It doesn't get the actual state of my BlueSoleil for example.

Imagine I start my application, then pair and connect a device.
I switch off my application. The device keeps its sates and belong connecting to BlueSoleil.
Thanks to you I know how to get paired devices, I want now to get connected one through my application when I switch It on. Is it possible?
Title: Re: How to detect that my paired device is connected to HandsFreeService using WCL?
Post by: Mike Petrichenko on February 08, 2016, 06:13:14 PM
If you cvonnected to device from your application then you must disconnect it in your application.
Unfortunately there is no common way to know which device is connected to which service. The only thing you can do is just check if device is connected to something (by calling GetConnected method).
And even there was a way to know that device is connected you can not disconnect it as all the information (handles etc) lost when you closes the app.
So make sure that you always disconnect your device when closing the app. As .NET uses garbage collector you must dispose all objects by your self (as they allocate hardware resources) when exiting the app.
Title: Re: How to detect that my paired device is connected to HandsFreeService using WCL?
Post by: mariluz.costa on February 11, 2016, 04:49:55 PM
I have understood.

Thank you for your reply.
Mariluz
Title: Re: How to detect that my paired device is connected to HandsFreeService using WCL?
Post by: Mike Petrichenko on February 11, 2016, 05:01:47 PM
You are welcome.