mirror of git://git.sysmocom.de/ofono
hfp_hf_bluez5: Implement sco_connected_hint
This commit is contained in:
parent
fdba39b8ed
commit
8d47f97106
|
@ -69,6 +69,7 @@ struct hfp {
|
||||||
struct hfp_slc_info info;
|
struct hfp_slc_info info;
|
||||||
DBusMessage *msg;
|
DBusMessage *msg;
|
||||||
struct ofono_handsfree_card *card;
|
struct ofono_handsfree_card *card;
|
||||||
|
unsigned int bcc_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *none_prefix[] = { NULL };
|
static const char *none_prefix[] = { NULL };
|
||||||
|
@ -372,8 +373,12 @@ static void bcc_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct cb_data *cbd = user_data;
|
struct cb_data *cbd = user_data;
|
||||||
ofono_handsfree_card_connect_cb_t cb = cbd->cb;
|
ofono_handsfree_card_connect_cb_t cb = cbd->cb;
|
||||||
|
struct ofono_handsfree_card *card = cbd->user;
|
||||||
|
struct hfp *hfp = ofono_handsfree_card_get_data(card);
|
||||||
struct ofono_error error;
|
struct ofono_error error;
|
||||||
|
|
||||||
|
hfp->bcc_id = 0;
|
||||||
|
|
||||||
decode_at_error(&error, g_at_result_final_response(result));
|
decode_at_error(&error, g_at_result_final_response(result));
|
||||||
|
|
||||||
cb(&error, cbd->data);
|
cb(&error, cbd->data);
|
||||||
|
@ -390,8 +395,10 @@ static void hfp16_card_connect(struct ofono_handsfree_card *card,
|
||||||
info->ag_features & HFP_AG_FEATURE_CODEC_NEGOTIATION) {
|
info->ag_features & HFP_AG_FEATURE_CODEC_NEGOTIATION) {
|
||||||
struct cb_data *cbd = cb_data_new(cb, data);
|
struct cb_data *cbd = cb_data_new(cb, data);
|
||||||
|
|
||||||
g_at_chat_send(info->chat, "AT+BCC", none_prefix, bcc_cb,
|
cbd->user = card;
|
||||||
cbd, g_free);
|
hfp->bcc_id = g_at_chat_send(info->chat, "AT+BCC",
|
||||||
|
none_prefix, bcc_cb,
|
||||||
|
cbd, g_free);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,11 +411,40 @@ static void hfp16_card_connect(struct ofono_handsfree_card *card,
|
||||||
ofono_handsfree_card_connect_sco(card);
|
ofono_handsfree_card_connect_sco(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void hfp16_sco_connected_hint(struct ofono_handsfree_card *card)
|
||||||
|
{
|
||||||
|
struct hfp *hfp = ofono_handsfree_card_get_data(card);
|
||||||
|
struct hfp_slc_info *info = &hfp->info;
|
||||||
|
struct cb_data *cbd;
|
||||||
|
ofono_handsfree_card_connect_cb_t cb;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SCO has just been connected, probably initiated by the AG.
|
||||||
|
* If we have any outstanding BCC requests, then lets cancel these
|
||||||
|
* as they're no longer needed
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (hfp->bcc_id == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
cbd = g_at_chat_get_userdata(info->chat, hfp->bcc_id);
|
||||||
|
if (cbd == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
cb = cbd->cb;
|
||||||
|
CALLBACK_WITH_SUCCESS(cb, cbd->data);
|
||||||
|
|
||||||
|
/* cbd will be freed once cancel is processed */
|
||||||
|
g_at_chat_cancel(info->chat, hfp->bcc_id);
|
||||||
|
hfp->bcc_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static struct ofono_handsfree_card_driver hfp16_hf_driver = {
|
static struct ofono_handsfree_card_driver hfp16_hf_driver = {
|
||||||
.name = HFP16_HF_DRIVER,
|
.name = HFP16_HF_DRIVER,
|
||||||
.probe = hfp16_card_probe,
|
.probe = hfp16_card_probe,
|
||||||
.remove = hfp16_card_remove,
|
.remove = hfp16_card_remove,
|
||||||
.connect = hfp16_card_connect,
|
.connect = hfp16_card_connect,
|
||||||
|
.sco_connected_hint = hfp16_sco_connected_hint,
|
||||||
};
|
};
|
||||||
|
|
||||||
static ofono_bool_t device_path_compare(struct ofono_modem *modem,
|
static ofono_bool_t device_path_compare(struct ofono_modem *modem,
|
||||||
|
|
Loading…
Reference in New Issue