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