~cyphermox/bluez/5.23

« back to all changes in this revision

Viewing changes to audio/manager.c

  • Committer: Package Import Robot
  • Author(s): Nobuhiro Iwamatsu
  • Date: 2012-01-24 05:35:09 UTC
  • mfrom: (1.5.11) (7.1.6 experimental)
  • Revision ID: package-import@ubuntu.com-20120124053509-uwpwqi783lz08wm3
Tags: 4.98-1
* New upstream release.
* Update debian/bluetooth-dbus.conf.
* Update debian/control.
  Add Multi-Arch: foreign to bluez.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
#include "../src/device.h"
54
54
 
55
55
#include "log.h"
56
 
#include "textfile.h"
57
56
#include "ipc.h"
58
57
#include "device.h"
59
58
#include "error.h"
64
63
#include "gateway.h"
65
64
#include "sink.h"
66
65
#include "source.h"
 
66
#include "avrcp.h"
67
67
#include "control.h"
68
68
#include "manager.h"
69
69
#include "sdpd.h"
117
117
        .sink           = TRUE,
118
118
        .source         = FALSE,
119
119
        .control        = TRUE,
120
 
        .socket         = TRUE,
121
 
        .media          = FALSE
 
120
        .socket         = FALSE,
 
121
        .media          = TRUE,
122
122
};
123
123
 
124
124
static struct audio_adapter *find_adapter(GSList *list,
219
219
                DBG("Found AV %s", uuid16 == AV_REMOTE_SVCLASS_ID ?
220
220
                                                        "Remote" : "Target");
221
221
                if (device->control)
222
 
                        control_update(device, uuid16);
 
222
                        control_update(device->control, uuid16);
223
223
                else
224
224
                        device->control = control_init(device, uuid16);
 
225
 
225
226
                if (device->sink && sink_is_active(device))
226
227
                        avrcp_connect(device);
227
228
                break;
508
509
                goto drop;
509
510
        }
510
511
 
511
 
        set_hfp_active(device, hfp_active);
 
512
        headset_set_hfp_active(device, hfp_active);
 
513
        headset_set_rfcomm_initiator(device, TRUE);
512
514
 
513
515
        if (headset_connect_rfcomm(device, chan) < 0) {
514
516
                error("headset_connect_rfcomm failed");
541
543
{
542
544
        struct audio_device *device = user_data;
543
545
 
544
 
        if (derr && dbus_error_is_set(derr))
 
546
        if (derr && dbus_error_is_set(derr)) {
545
547
                error("Access denied: %s", derr->message);
546
 
        else {
 
548
                gateway_set_state(device, GATEWAY_STATE_DISCONNECTED);
 
549
        } else {
547
550
                char ag_address[18];
548
551
 
549
552
                ba2str(&device->dst, ag_address);
588
591
                        goto drop;
589
592
        }
590
593
 
591
 
        if (gateway_is_connected(device)) {
 
594
        if (gateway_is_active(device)) {
592
595
                DBG("Refusing new connection since one already exists");
593
596
                goto drop;
594
597
        }
602
605
                                                gateway_auth_cb, device);
603
606
        if (perr < 0) {
604
607
                DBG("Authorization denied!");
605
 
                goto drop;
 
608
                gateway_set_state(device, GATEWAY_STATE_DISCONNECTED);
606
609
        }
607
610
 
608
611
        return;
775
778
        struct audio_device *audio_dev;
776
779
 
777
780
        adapter_get_address(adapter, &src);
778
 
        device_get_address(device, &dst);
 
781
        device_get_address(device, &dst, NULL);
779
782
 
780
783
        audio_dev = manager_get_device(&src, &dst, TRUE);
781
784
        if (!audio_dev) {
1170
1173
                        enabled.socket = TRUE;
1171
1174
                else if (g_str_equal(list[i], "Media"))
1172
1175
                        enabled.media = TRUE;
 
1176
 
1173
1177
        }
1174
1178
        g_strfreev(list);
1175
1179
 
1383
1387
                if (dev == device)
1384
1388
                        continue;
1385
1389
 
1386
 
                if (bacmp(&dev->src, &device->src))
 
1390
                if (device && bacmp(&dev->src, &device->src) != 0)
1387
1391
                        continue;
1388
1392
 
1389
1393
                if (!hs)
1403
1407
{
1404
1408
        GSList *l;
1405
1409
 
 
1410
        if (enable && !manager_allow_headset_connection(NULL)) {
 
1411
                DBG("Refusing enabling fast connectable");
 
1412
                return;
 
1413
        }
 
1414
 
1406
1415
        for (l = adapters; l != NULL; l = l->next) {
1407
1416
                struct audio_adapter *adapter = l->data;
1408
1417