Sco hook using hfp

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
JaPe_4792901
Level 1
Level 1
5 sign-ins First reply posted First question asked

I am trying to use “wiced_bt_sco_hook.h” to hook into the stream of data from the phone to the headset, but I get a 0 as the pointer for the speaker input:

if(event == WICED_BT_SCO_HOOK_EVT_SPK_SAMPLES)

{

     WICED_BT_TRACE("Speaker input: %d, output: %d, count: %d, silenc: %d\n\r", hookcounter, p_data->spk_samples.p_input, p_data->spk_samples.p_output, p_data->spk_samples.sample_count, p_data->spk_samples.inserted_silence_len.value);

}

if(event == WICED_BT_SCO_HOOK_EVT_MIC_SAMPLES)

{

     WICED_BT_TRACE("MIC input: %d, output: %d, count: %d, silenc: %d\n\r", hookcounter, p_data->mic_samples.p_input, p_data->mic_samples.p_output, p_data->mic_samples.sample_count, p_data->mic_samples.inserted_silence_len.value);

}

In the hook callback, gives:

Speaker input: 0, output: 2549760, count: 120, silenc: 0

MIC input: 2549504, output: 2303804, count: 120, silenc: 0

Is this because I use a headset and not the speaker?

Are there any other ways of getting a pointer to the input buffer?

I have tried to use:

stream_interface_t* wiced_am_stream_get_intf(uint32_t stream_id, uint32_t inf_type);

from "wiced_audio_manager.h" but when I look in the c file the function has not yet been implemented.

I use:

  • CYW920721B2EVK-02
  • Eclipse with ModusToolBox v2.2.0
  • Bluetooth SDK version 2.8.0
  • A headset with microphone

/ Jacob

0 Likes
1 Solution
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

Are you playing audio or transferring voice on the phone side?

If you are playing music, please refer to the file audio_insert_audio.c and the function audio_insert_audio_i2s_aud_inject_callback. In the event I2S_AUD_INJECT_EVT_FILL_FIFO, you can get the audio data from the phone.

If you are transferring voice, for example, a phone call, then you can refer to the file audio_insert_sco.c and function

static void audio_insert_sco_hook_callback(wiced_bt_sco_hook_event_t event,

        wiced_bt_sco_hook_event_data_t *p_data).

View solution in original post

0 Likes
1 Reply
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

Are you playing audio or transferring voice on the phone side?

If you are playing music, please refer to the file audio_insert_audio.c and the function audio_insert_audio_i2s_aud_inject_callback. In the event I2S_AUD_INJECT_EVT_FILL_FIFO, you can get the audio data from the phone.

If you are transferring voice, for example, a phone call, then you can refer to the file audio_insert_sco.c and function

static void audio_insert_sco_hook_callback(wiced_bt_sco_hook_event_t event,

        wiced_bt_sco_hook_event_data_t *p_data).

0 Likes