Simple class for HFPAudioGateway

Topics: Bluetooth - Widcomm/Broadcom, Samples
Oct 27, 2012 at 12:12 PM

Hello, my name is Luca, from Italy.

I'm working on a simple class to use the HFPAudioGateway profile.

Currently, the base class is almost complete and allows you to use your phone using AT commands, I need to resolve some problem with thread that hang class after disconnection.

The class has the following functions:

void AnswerCall()
int BatteryLevel()
void ConnectHFP(String deviceAddr)
void Dial(string number)
void DisconnectHFP()
string GetOperator()
void HangUp()
string IncomingCallNumber()
void Init(string Opt1, string OPt2)
int SignalLevel()
string TelephoneType()

and these events:


I'd like to know if when the class will be completed I can post it on this forum.

I also have another question: I have seen many posts about audio transfert from phone to computer, but I've not found any solutions, when I connect the phone and open the stream I just get the AT commands response, there is a way to get the audio too?

I'm testing my class on Widcomm Stack.



Oct 31, 2012 at 12:44 PM

That sound great Luca. I'm glad you are working on this.

If you're happy we can see if we can include your code in the library itself.  You can of course post the code here.


For audio. On the Widcomm stack their API has methods on the main connection classes to create a related audio connection. For instance on the RFCOMM class that we use for BluetoothClient there is method CRfCommPort::CreateAudioConnection. I've created the necessary mappings for that method in the native library but I haven't used them in the library itself. We can have a look at making that work!

Nov 5, 2012 at 12:25 PM
Edited Nov 5, 2012 at 12:26 PM

I've fix the class thread problem and now connection and disconnection on HFP works very well. I have to finish some events management in phone call and then the class will be distributed for test, I've also write a sample project to use phone on PC.

For audio connection, I do not know if the function you've implemented works on Widcomm, I sent an email to Broadcomm for information on unducumented function to transfer audio from the phone to the PC but I have not recve replay.

I saw that there is .net DLL. Net in the Widcomm driver package that has some features that affect the sound, the DLL is called wbtapiM.dll

Nov 5, 2012 at 9:43 PM

I'm testing function "RfcommPort_CreateAudioConnection" on 32feetWidcomm.dll.

I declare it with this piece of code:

internal static extern int RfcommPort_CreateAudioConnection(ref Object commPort, bool bIsClient, ref UInt16 audioHandle);

I don't know if it's correct, but I don't understand what type is commPort and if audioHandle is a real handle becuse I recive always 25 as return value. It's the same if I declare as IntPtr.