none
How to test Bluetooth Headset/handsfree profile in WEC7/WEC2013? RRS feed

  • Question

  • Hi all,

    We have developed Bluetooth driver for custom module and able to test pairing, connection, and few profiles.

    We need to test the BT headset/handsfree (HS/HFP) profile.

    I have added the registry settings needed to enable audio gateway.

    Now the headset device is pairing with WinCE, using BTHSettings app. The HFP profile is being listed, and able to CONNECT.

    I have checked with BTAGCONFIG sample app, and seeing "success" prints for Enable and disable the Bluetooth audio, Set the volume of the microphone and the speaker etc.

    But I need to verify the functionality by listening to sound on headset. How to do this?

    Is there any sample app / file to do this?

    Thanks.

    Monday, June 15, 2015 11:08 AM

All replies

  • Monday, June 15, 2015 5:20 PM
    Moderator
  • Hi,

    I have seen the question that you pointed.

    But there is no HFP related (BT profile related, actually) tests in CETK tests.

    I referred the BT AG related links in another answer. (See that I have added the registry settings needed to enable audio gateway. in my qn). So, the Headset is being CONNECTED in BTHSettings app.

    But I need to listen to some sound on headset. How I can do that?

    • Edited by Keshava GN Tuesday, June 16, 2015 4:40 AM
    Tuesday, June 16, 2015 4:39 AM
  • Hi GNK,

    No sure what you are expecting as a test but you could use https://msdn.microsoft.com/en-us/library/ee495445.aspx and see if you can shadow the Bluetooth AG calls. 

    If you have a microphone on the device, you could place the headset earphone near it and try and detect sound that way.

    Sincerely,

    IoTGirl

    Tuesday, June 16, 2015 9:03 PM
    Moderator
  • Hi GNK,

    Could you answer the following questions?

    • Did you add btscosnd driver (SYSGEN_BTH_AUDIO) in your OS?
    • Do you have audio driver that supports PCM interface connected to the bluetooth module?

    To listen sound on Bluetooth headset, "audio driver for Bluetooth" is necessary (but this is not written in any MSDN document...).

    Regards,

    nbkw

    Wednesday, June 17, 2015 1:21 AM
  • Hello nbkw,

    1. Yes. SYSGEN_BTH_AUDIO is enabled.

    2. Can you please let me know how I can add audio driver that supports PCM interface connected to the Bluetooth module ?

    Thanks.

    Regards,

    Keshava

    Wednesday, June 17, 2015 5:36 AM
  • And, is it possible to test this profile, by playing an audio file? Is there a sample test application?
    Wednesday, June 17, 2015 6:45 AM
  • Hi Keshava,

    Thank you for your quick answer.

    The answer for 2. is "you have to develop the audio driver with PCM support by yourself."

    The below is a block diaglam about Bluetooth audio. The btscosnd driver sends audio data through data path (case 1), and the custom audio driver sends audio data through PCM interface (case 2).

    The case 2 requires development but audio quality will be good. But some bluetooth module requires customizations to use PCM. Please ask the bluetooth module vendor.

    The case 1 is easy to start, but it has some problem such as:

    • Some bluetooth module doesn't support sending audio data through data path (UART/USB).
    • Btscosnd driver cannot get the audio data from Waveform audio API if other audio driver exists.
    • You might hear fast-forwarding audio.

    Please let me know which is better for you.

    Regards,

    nbkw

    Wednesday, June 17, 2015 7:10 AM
  • Regarding audio application, please check "WINCE700\public\common\sdk\samples\audio".

    Regards,

    nbkw

    Wednesday, June 17, 2015 7:15 AM
  • Thanks nbkw, for quick reply. It's very useful.

    Case 1 is OK for me, as I just need to demonstrate the BT audio capability of my BT transport driver. I just need to test by listening to some audio over BT.

    Currently, I have enabled the AG registry entries, and device is being paired and CONNECTED with headset (using BTHSETTINGS app). Also, SYSGEN_BTH_AUDIO is enabled.

    Now what can be my next step to test the audio?

    Is it possible to test this profile, by playing an audio file? Is there a sample test application?

    Wednesday, June 17, 2015 7:17 AM
  • Hi nbkw,

    Is this related to case 1 (voice over HCI)??

    Thanks

    Wednesday, June 17, 2015 7:30 AM
  • Hi Keshava,

    The next step is here.

    1. Remove other audio drivers from your catalog and BSP.
    2. Rebuild the OS.
    3. Pair with headset and connect to it by btagconfig sample app ("btagconfig -audio on").
    4. Play audio files from Control Panel -> Volume and Sound -> Sound -> select and play sound.

    If you have a problem to play audio after the steps, please remove BTHSETTINGS app and retry pairing by control panel bluetooth setting. (Maybe BTHSETTINGS is not match the btscosnd driver registry settings.)

    Regards,

    nbkw

    Wednesday, June 17, 2015 7:53 AM
  • I will check this and let you know the result... Thanks, nbkw! :)
    Wednesday, June 17, 2015 8:08 AM
  • Hi nbkw,

    Whether I have to add any registry items for this ? Like.. audio (wav) related things..?

    So that the audio will be routed to BT instead of speakers?

    Wednesday, June 17, 2015 12:21 PM
  • Hi Keshava,

    Please confirm this registry is exist at first.

    [HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\AudioGateway]

      "MapAudioToPcmMode"=dword:0

    Reference: Audio Gateway Registry Settings (Compact 7)

    Then please watch debug messages of btscosnd driver related to WODM_BT_SCO_AUDIO_CONTROL WavIoControl message, and check whether the SCO connection is established successfully when you execute "btagconfig -audio on" command.

    Reference: Routing Audio to the Bluetooth Hardware (Windows CE 5.0)

    Please let me know the result.

    Regards,

    nbkw

    Wednesday, June 17, 2015 3:12 PM
  • Hi nbkw,

    I will check this and get back to you.

    BTW, If I do this, whether all the sounds that are being played on speakers (ie: sounds by music player/playwnd app) also will be redirected to BT?

    Thanks!

    Thursday, June 18, 2015 5:10 AM
  • Hi Keshava,

    You can switch the speaker and BT by DRVM_MAPPER_PREFERRED_SET message. The scenario is below.

    • Assume the speaker is "WAV1:" and btscosnd is "WAV2:". Normally sound is played on speaker.
    • When btscosnd establish the SCO connection, btscosnd should call "Code 1". The audio is redirected to BT.
    • When btscosnd disconnect the SCO, btscosnd should call "Code 2". The audio is redirected to speaker.
    // Redirect to BT : Code 1
    // (Please get CurDeviceID of btscosnd driver in advance, by waveOutGetDevCaps() or etc.)
    	Err = waveOutMessage((HWAVEOUT)WAVE_MAPPER,
    					DRVM_MAPPER_PREFERRED_SET,
    					CurDeviceID,
    					0);
    	Err = waveInMessage((HWAVEIN)WAVE_MAPPER,
    					DRVM_MAPPER_PREFERRED_SET,
    					CurDeviceID,
    					0
    					); 
    // Return to default(speaker) : Code 2
    	Err = waveOutMessage((HWAVEOUT)WAVE_MAPPER,
    					DRVM_MAPPER_PREFERRED_SET,
    					CurDeviceID,
    					(DWORD)-1);
    	Err = waveInMessage((HWAVEIN)WAVE_MAPPER,
    					DRVM_MAPPER_PREFERRED_SET,
    					CurDeviceID,
    					(DWORD)-1); 

    I hope this will help you.

    Regards,

    nbkw


    • Edited by nbkw Thursday, June 18, 2015 2:05 PM spelling mistake
    Thursday, June 18, 2015 7:40 AM
  • Hi nbkw,

    All your answers are really helpful.

    So, this (redirection of audio) is not taken care by default (or in btagconfig.exe), and we need to implement (in app) right?

    Regards,

    Keshava

    • Edited by Keshava GN Thursday, June 18, 2015 7:53 AM
    Thursday, June 18, 2015 7:53 AM
  • Hi Keshava,

    Yes, you are right.

    FYI, I implemented the redirection in btscosnd driver, because it was able to know whether Bluetooth audio (SCO) connection is established.

    Regards,

    nbkw
    Thursday, June 18, 2015 2:03 PM
  • Hi nbkw,

    Thanks.

    It would be helpful if you show me where did you add the above code to redirect to BT in btscosnd driver source code...so that I can test by adding the same.. :)

    Regards,

    Keshava

    Friday, June 19, 2015 5:26 AM
  • Hi Keshava,

    Please add the code to redirect to BT to InitSco() function (wavepdd.cxx). After the calling EstablishScoConnection() function is better.

    And please add the code to redirect the default to DeinitSco() function (wavepdd.cxx).

    Regards,

    nbkw
    Monday, June 22, 2015 4:10 AM
  • Hi Keshava,

    I had gone through your conversation and understood the fallowing Required sysgen variable to be enabled and application to be used.

    I have paired with headphones in WEC7/WEC2013, after that i want to listen audio over headset in WEC7/WEC2013.

    Did you test the audio over headset in WEC7/WEC2013 and is it working for you ?

    Could you please let me know the procedure how to use btagconfig.exe to enable audio?

    Thanks in Advance,

    Naresh

    Redpine Signals, Inc
    Hyderabad.


    Thursday, October 15, 2015 11:10 AM