Wireless Communication Library Support Forum

Frameworks => Bluetooth Framework => Topic started by: mariluz.costa on January 22, 2016, 04:24:38 PM

Title: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: mariluz.costa on January 22, 2016, 04:24:38 PM
Hi everyone,
I'm developing an application to make call from a PC but through bluetooth on my mobile iphone or androidphone.
I pair my device and then I connect it to a wclBluetoothHandsFreeClient.
Everything works fine.

My problems come when I try to disconnect the device.

I do something like my_wclBluetoothHandsFreeClient.Disconnect().
I tried my_wclBluetoothHandsFreeClient.AudioDisconnect() too!

Nothing works.

When I check my_wclBluetoothHandsFreeClient's state it appears as Disconnected. But my phone steel indicates a connection.
I cannot make a call with the mobile phone anymore but music can still be transferring to computer.

Does someone has an idea to disconnect correctly (properly) a device from any Hands Free service?

Thank you for your help!

Mariluz

Sorry for my bad english
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: Mike Petrichenko on January 22, 2016, 04:30:12 PM
Hi,

Which BlueSoleil version and WCL version do you use?

Also, does Audio connected in this time or it also can not disconnect event if Audio is not connected?
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: mariluz.costa on January 22, 2016, 05:39:40 PM
Thank you for your response.

My BlueSoleil version is 10.0.492.1 and WCL 6.14.8.0.

When I do my_wclBluetoothHandsFreeClient.Connect() I connect my device  on HandsfreeAudioGatewayServiceClass_UUID. But I see on BlueSoleil interface that Bluetooth Advanced Audio is connected too.

So when I disconnect using my_wclBluetoothHandsFreeClient.Disconnect() it is only HandsfreeAudioGatewayServiceClass_UUID that is disconnected.
The other still proceed, and I can see it on my phone and in the BlueSoleil interface.
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: Mike Petrichenko on January 22, 2016, 05:44:42 PM
Hello,

Yes, the problem has been reproduced. The BlueSoleil does not release second audio connection when primary connection is released. I am going to fix it. I will update you a little bit later with progress.
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: Mike Petrichenko on January 22, 2016, 06:37:45 PM
Hello,

Ok, the problem is that when you connect to your device BlueSoleil connects to its AVRCP profile by itself. To prevent this you have to disable "Advanced Audio..." service in BlueSoleil settings.

To do so open BlueSoleil properties, switch to Functions tab, select "Advanced Bluetooth Audio" from the list and change its status to "Disabled". I am not sure it is possible to do programmaticaly but I am looking for the way.
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: mariluz.costa on January 25, 2016, 11:52:15 AM
Thank you for your help Mike!

I hope you find a way to do it programmaticaly.

Mariluz
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: Mike Petrichenko on January 25, 2016, 12:44:55 PM
You are very welcome.

I will do all my best to find the way.
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: mariluz.costa on February 11, 2016, 04:48:23 PM
Hi Mike,

I discover another issue with this "can't disconnect completely my device". I can't unpair my device if I have not disconnected it first from all services.
Do you confirm? Maybe I don't do it the right way.

Mariluz
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: Mike Petrichenko on February 11, 2016, 05:01:26 PM
Hi,

Yes, that is correct, you can not unpair cause driver can not remove device's information.
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: mariluz.costa on February 12, 2016, 05:12:56 PM
Hi Mike,

You helped me with some issue and now I got another one I hop you can resolve too  :)
I got a serious problem with that lack of functionality of disconnected all services from Bluetooth, or even prevent connexion for some services.
I will try to explain.
We use a device (I will call it Hal) integrating Bluesoleil that doesn't provide a user interface to administrate Bluesoleil.
So we really need to deactivate all unused services and mostly those which are connected by bluesoleil itself, even we doesn't call a function to do that.

Here is a catastrophic scenario a user can experiment:
User switch on Hal, my application using WCL runs and the user paired his device and connected it.
Suddenly my application crashed. My application does all right disposes but I can't disconnect all services. And as I can't disconnect all services I can't unpaired user's device. So the user's device belongs paired and connected to BlueSoleil.
The user has run again my application. My application detects user's paired device. But I can't get which service is connected. And even I could, you explain to me that I could not get the handles. And all this situation is really bad. To work around it, I have to find a way to switch off the Bluetooth to kill that connection!

Mike I need a function to programmatically stop BlueSoleil to connect to its AVRCP profile by itself and even all other services I don't need or i need to programmatically switch off the Bluetooth or simply disconnect all services. This can help too.

Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: Mike Petrichenko on February 12, 2016, 05:50:10 PM
Hi,

The problem that there is no open API to control such BlueSoleil functions as disabling services. Any way I will think on it and may be find the way.
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: Mike Petrichenko on February 15, 2016, 10:47:31 AM
Hi,

It looks I found the way to disconnect all connected devices with BlueSoleil (this will not work with any other driver). I'll keep you updated.
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: Mike Petrichenko on February 15, 2016, 06:10:06 PM
Hi,

I have attached the WCL version with disables Advanced Audio service when you connect to HFP so now it should work as expected and do not "lock" connection when you disconnect from HFP. Please. test it on your side.

[attachment deleted by admin]
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: Mike Petrichenko on February 17, 2016, 05:55:45 AM
Hi,

It looks the way to find all connection is also found. Please test the version with AVRCP disabling. If it works then I will try to add the methods to disconnect already connected devices.
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: mariluz.costa on February 17, 2016, 02:54:10 PM
Hi Mike,

I have just tested your dll.
It's working for disconnect Advanced Audio service. But I discover that BlueSoleil connect himself to another service. I'm not sure of my translation, but this service's name sounds like "a/v remote control target bluetooth service".

So if you have time your second solution will be very appreciated :)

Thank you Mike!

Mariluz
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: Mike Petrichenko on February 17, 2016, 03:00:28 PM
Hi,

That was just a test solution. I am working on the way allows you to find all BS default running services and disconnect any of them. Should be ready closer to tonigh.
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: Mike Petrichenko on February 18, 2016, 03:23:22 PM
Hi,

Sorry for a little bit delay with update. I am having some problems with disconnecting already connected devices. As soon as I'll fix it i send you new version. I think just a few hours but probably one-two days.
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: mariluz.costa on February 22, 2016, 04:26:48 PM
Don't worry Mike.

Thank you for trying helping me.

Mariluz
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: Mike Petrichenko on February 24, 2016, 07:10:47 AM
Hello,

Please, try the attached version. Take a look on BluetoothDiscoveryDemo to find out how to control build-in Bluetooth services (BlueSoleil).

[attachment deleted by admin]
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: mariluz.costa on March 03, 2016, 03:32:56 PM
Hello Mike,
I just test your new solution helping me to disconnect all services from the Bluetooth device.
Sorry for the delay, I encountered some difficulties on other issues.

I test with my solution and then with your demo, and the result remains the same: only one service is disconnected, the one I registered. The others registered by BlueSoleil itself are not disconnected. I believed so hard that it could be possible. But it seems that BlueSoleil it's a kind of непослушный ребёнок and wont listen.

I hope you got another idea  :)

Mariluz
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: Mike Petrichenko on March 03, 2016, 03:38:45 PM
Hello,

I am not sure what you meant by "disconnecting" but current WCL version can only disable pre-defined (build-in) BlueSoleil services. There are few methods for that. Take a look on BluetoothDiscoveryDemo. WCL does nothing with already connected services except your application initiates the connection. And if so then your application must close the connection as well as it always must do for any hardware resource it allocated.

As I told it is more or lesss possible to find all existing connection (for BlueSoileil) and try to close them after discussing it with my developers we found that it is not reasonable and more it is even bad idea. Think what may happen if you connected to let say internet and then one of application decide to terminate it. Bad idea.

So all your application opened it must close. All what was opened by other applications must be closed by those applications.

However  to prevent connection to predefined services (AVRCP in your case) you can disable this default build-in service now by calling wclBluetoothRadio.StopServer() method (refer to the BluetoothDiscoveryDemo).
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: mariluz.costa on March 15, 2016, 03:24:36 PM
Hi Mike,
Sorry for my silence, I was sick.
I completely agree with you on all points.
And wclBluetoothRadio.StopServer() method is exactly what I was looking for. I just tested it and it works fine in my application.

Thank you for your precious help.

Mariluz
Title: Re: Can not disconnect completly my device from wclBluetoothHandsFreeClient
Post by: Mike Petrichenko on March 15, 2016, 04:02:40 PM
You are very welcome.