Author Topic: How to detect that my paired device is connected to HandsFreeService using WCL?  (Read 961 times)

Offline mariluz.costa

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
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

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
Hi,

You can simple compare device's address used in wclHandsFreeClient with each found device.

Offline mariluz.costa

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
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?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
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.

Offline mariluz.costa

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
I have understood.

Thank you for your reply.
Mariluz

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3055
  • Karma: 1000
    • Soft Service Company
You are welcome.

 

Sitemap 1 2 3 4 5 6 7 8 9