static uint8_t headset_generate_capability(struct audio_device *dev, codec_capabilities_t *codec) { pcm_capabilities_t *pcm; codec->seid = BT_A2DP_SEID_RANGE + 1; codec->transport = BT_CAPABILITIES_TRANSPORT_SCO; codec->type = BT_HFP_CODEC_PCM; codec->length = sizeof(*pcm); pcm = (void *) codec; pcm->sampling_rate = 8000; if (dev->headset) { if (headset_get_nrec(dev)) pcm->flags |= BT_PCM_FLAG_NREC; if (!headset_get_sco_hci(dev)) pcm->flags |= BT_PCM_FLAG_PCM_ROUTING; codec->configured = headset_is_active(dev); codec->lock = headset_get_lock(dev); } else { pcm->flags |= BT_PCM_FLAG_NREC; codec->configured = TRUE; codec->lock = 0; } return codec->length; }
static void get_properties_headset(struct media_transport *transport, DBusMessageIter *dict) { gboolean nrec, inband; const char *routing; nrec = headset_get_nrec(transport->device); dict_append_entry(dict, "NREC", DBUS_TYPE_BOOLEAN, &nrec); inband = headset_get_inband(transport->device); dict_append_entry(dict, "InbandRingtone", DBUS_TYPE_BOOLEAN, &inband); routing = headset_get_sco_hci(transport->device) ? "HCI" : "PCM"; dict_append_entry(dict, "Routing", DBUS_TYPE_STRING, &routing); }