~phablet-team/ofono/midori-support

« back to all changes in this revision

Viewing changes to plugins/hfp_hf_bluez5.c

  • Committer: Alfonso Sanchez-Beato
  • Date: 2015-09-28 08:10:59 UTC
  • mfrom: (6830.1.168)
  • mto: This revision was merged to the branch mainline in revision 6904.
  • Revision ID: alfonso.sanchez-beato@canonical.com-20150928081059-1o08e2a9pkit6ar6
* Update to upstream release 1.17
* Do not assert when the radio is unavailable (LP: #1490991)
* Fix crash when importing phonebook (LP: #1486004)
* Check only destination port when receiving push (LP: #1490673)
* Fix crash when retrying to close context (LP: #1492483)

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
        struct hfp_slc_info info;
70
70
        DBusMessage *msg;
71
71
        struct ofono_handsfree_card *card;
 
72
        unsigned int bcc_id;
72
73
};
73
74
 
74
75
static const char *none_prefix[] = { NULL };
372
373
{
373
374
        struct cb_data *cbd = user_data;
374
375
        ofono_handsfree_card_connect_cb_t cb = cbd->cb;
 
376
        struct ofono_handsfree_card *card = cbd->user;
 
377
        struct hfp *hfp = ofono_handsfree_card_get_data(card);
375
378
        struct ofono_error error;
376
379
 
 
380
        hfp->bcc_id = 0;
 
381
 
377
382
        decode_at_error(&error, g_at_result_final_response(result));
378
383
 
379
384
        cb(&error, cbd->data);
390
395
                        info->ag_features & HFP_AG_FEATURE_CODEC_NEGOTIATION) {
391
396
                struct cb_data *cbd = cb_data_new(cb, data);
392
397
 
393
 
                g_at_chat_send(info->chat, "AT+BCC", NULL, bcc_cb, cbd, g_free);
 
398
                cbd->user = card;
 
399
                hfp->bcc_id = g_at_chat_send(info->chat, "AT+BCC",
 
400
                                                none_prefix, bcc_cb,
 
401
                                                cbd, g_free);
394
402
                return;
395
403
        }
396
404
 
403
411
        ofono_handsfree_card_connect_sco(card);
404
412
}
405
413
 
 
414
static void hfp16_sco_connected_hint(struct ofono_handsfree_card *card)
 
415
{
 
416
        struct hfp *hfp = ofono_handsfree_card_get_data(card);
 
417
        struct hfp_slc_info *info = &hfp->info;
 
418
        struct cb_data *cbd;
 
419
        ofono_handsfree_card_connect_cb_t cb;
 
420
 
 
421
        /*
 
422
         * SCO has just been connected, probably initiated by the AG.
 
423
         * If we have any outstanding BCC requests, then lets cancel these
 
424
         * as they're no longer needed
 
425
         */
 
426
 
 
427
        if (hfp->bcc_id == 0)
 
428
                return;
 
429
 
 
430
        cbd = g_at_chat_get_userdata(info->chat, hfp->bcc_id);
 
431
        if (cbd == NULL)
 
432
                return;
 
433
 
 
434
        cb = cbd->cb;
 
435
        CALLBACK_WITH_SUCCESS(cb, cbd->data);
 
436
 
 
437
        /* cbd will be freed once cancel is processed */
 
438
        g_at_chat_cancel(info->chat, hfp->bcc_id);
 
439
        hfp->bcc_id = 0;
 
440
}
 
441
 
406
442
static struct ofono_handsfree_card_driver hfp16_hf_driver = {
407
 
        .name           = HFP16_HF_DRIVER,
408
 
        .probe          = hfp16_card_probe,
409
 
        .remove         = hfp16_card_remove,
410
 
        .connect        = hfp16_card_connect,
 
443
        .name                   = HFP16_HF_DRIVER,
 
444
        .probe                  = hfp16_card_probe,
 
445
        .remove                 = hfp16_card_remove,
 
446
        .connect                = hfp16_card_connect,
 
447
        .sco_connected_hint     = hfp16_sco_connected_hint,
411
448
};
412
449
 
413
450
static ofono_bool_t device_path_compare(struct ofono_modem *modem,
701
738
                return;
702
739
 
703
740
        dbus_message_iter_get_basic(&iter, &paired);
704
 
        if (paired == FALSE)
 
741
 
 
742
        if (paired == FALSE) {
 
743
                modem = ofono_modem_find(device_path_compare, (void *) path);
 
744
 
 
745
                if (modem != NULL) {
 
746
                        ofono_modem_remove(modem);
 
747
                        g_dbus_proxy_set_removed_watch(proxy, NULL, NULL);
 
748
                        g_dbus_proxy_set_property_watch(proxy, NULL, NULL);
 
749
                }
705
750
                return;
 
751
        }
706
752
 
707
753
        if (g_dbus_proxy_get_property(proxy, "UUIDs", &iter) == FALSE)
708
754
                return;