[pulseaudio-discuss] bluetooth headset connection and disconnection status
Shinnosuke Suzuki
suzukisn at gmail.com
Tue May 1 01:00:42 UTC 2018
Hi,
> Thank you for your advice.
> I would like to use libpulse, but I couldn’t make it properly.
> So I use parec/pacat command.
> I'll get information from “pactl list cards”.
I could get status for bluetooth headset connection with pactl.
But pactl command seems to use exclusion control, when I use pact/parec to send/recv voice packet,
pactl command stops voice packet of pact/parec only while executing pactl command.
I confirmed parec pact and pactl with trace-cmd.
I would like to implement monitoring bluetooth connection during the voice call with bluetooth headset.
Is there any solution on this?
Do I have to use pa_context_get_card_info_list of libpulse?
Best Regards,
Shinnosuke Suzuki
> On Apr 15, 2018, at 16:58, Shinnosuke Suzuki <suzukisn at gmail.com> wrote:
>
> Hi,
>
>> You can use libpulse to query the bluetooth card status (and you could
>> use libpulse to also record and play audio - using parec and pacat
>> sounds quite hacky if you're writing a serious application).
>> pa_context_get_card_info_list() can be used to get the information
>> about all cards. If you see the headset in the list, then it's
>> connected.
>
> Thank you for your advice.
> I would like to use libpulse, but I couldn’t make it properly.
> So I use parec/pacat command.
> I'll get information from “pactl list cards”.
>
> Best Regards,
> Shinnosuke Suzuki
>
>> On Apr 8, 2018, at 18:38, Tanu Kaskinen <tanuk at iki.fi> wrote:
>>
>> On Tue, 2018-04-03 at 19:18 +0900, Shinnosuke Suzuki wrote:
>>> Hi,
>>>
>>> I am developing simple telephony app using pulseauio 11.1.
>>> I would like to get status for bluetooth headset connection and
>>> disconnection.
>>> Is there any way to get status for connection and disconnection for
>>> bluetooth headset?
>>> I write a telephony app in C with parec and pacat command to handle
>>> bluetooth headset.
>>> So I would like to judge whether app can connect call with bluetooth
>>> headset.
>>
>> You can use libpulse to query the bluetooth card status (and you could
>> use libpulse to also record and play audio - using parec and pacat
>> sounds quite hacky if you're writing a serious application).
>> pa_context_get_card_info_list() can be used to get the information
>> about all cards. If you see the headset in the list, then it's
>> connected.
>>
>> The documentation for libpulse is here:
>> https://freedesktop.org/software/pulseaudio/doxygen/index.html
>>
>> The card might not have the right profile active, but pulseaudio should
>> automatically switch to the HSP profile if you create a recording
>> stream with the media.role property set to "phone". In case of parec
>> that can be done by passing command line argument
>> --property=media.role=phone . You can also manually switch the profile
>> with pa_context_set_card_profile_by_name().
>>
>> You can get notifications when things change (e.g. a new card appears)
>> with the subscription API of libpulse.
>>
>> --
>> Tanu
>>
>> https://liberapay.com/tanuk
>> https://www.patreon.com/tanuk
>
More information about the pulseaudio-discuss
mailing list