Lines Matching refs:gw
103 struct gateway *gw = dev->gateway;
106 if (gw->state == new_state)
110 gw->state = new_state;
152 struct gateway *gw = dev->gateway;
159 g_io_channel_shutdown(gw->sco, TRUE, NULL);
160 g_io_channel_unref(gw->sco);
161 gw->sco = NULL;
172 struct gateway *gw = dev->gateway;
176 gw->sco = g_io_channel_ref(chan);
178 if (gw->sco_start_cb)
179 gw->sco_start_cb(dev, err, gw->sco_start_cb_data);
187 g_io_add_watch(gw->sco, G_IO_ERR | G_IO_HUP | G_IO_NVAL,
222 struct gateway *gw = dev->gateway;
228 if (gw->sco_start_cb)
229 gw->sco_start_cb(dev, err, gw->sco_start_cb_data);
233 if (!gw->agent) {
240 gw->rfcomm = g_io_channel_ref(chan);
242 ret = agent_sendfd(gw->agent, sk, newconnection_reply, dev);
244 if (!gw->msg)
248 reply = dbus_message_new_method_return(gw->msg);
250 reply = btd_error_failed(gw->msg, "Can't pass file descriptor");
257 if (gw->msg) {
259 reply = btd_error_failed(gw->msg, "Connect failed");
269 struct gateway *gw = dev->gateway;
337 if (gw->msg) {
338 DBusMessage *reply = btd_error_failed(gw->msg,
349 if (gw->sco_start_cb)
350 gw->sco_start_cb(dev, gerr, gw->sco_start_cb_data);
368 struct gateway *gw = au_dev->gateway;
371 if (!gw->agent)
378 gw->msg = dbus_message_ref(msg);
385 struct gateway *gw = device->gateway;
388 if (gw->rfcomm) {
389 sock = g_io_channel_unix_get_fd(gw->rfcomm);
392 g_io_channel_shutdown(gw->rfcomm, TRUE, NULL);
393 g_io_channel_unref(gw->rfcomm);
394 gw->rfcomm = NULL;
397 if (gw->sco) {
398 g_io_channel_shutdown(gw->sco, TRUE, NULL);
399 g_io_channel_unref(gw->sco);
400 gw->sco = NULL;
401 gw->sco_start_cb = NULL;
402 gw->sco_start_cb_data = NULL;
414 struct gateway *gw = device->gateway;
425 if (!gw->rfcomm)
450 struct gateway *gw = device->gateway;
468 value = state2str(gw->state);
481 struct gateway *gw = device->gateway;
485 if (gw->agent)
499 agent_exited, gw, NULL);
501 gw->agent = agent;
510 struct gateway *gw = device->gateway;
513 if (!gw->agent)
516 if (strcmp(gw->agent->name, dbus_message_get_sender(msg)) != 0)
524 if (strcmp(gw->agent->path, path) != 0)
527 g_dbus_remove_watch(device->conn, gw->agent->watch);
529 agent_free(gw->agent);
530 gw->agent = NULL;
605 struct gateway *gw = dev->gateway;
607 if (gw->sco)
610 gw->sco = g_io_channel_ref(io);
612 g_io_add_watch(gw->sco, G_IO_ERR | G_IO_HUP | G_IO_NVAL,
622 struct gateway *gw = dev->gateway;
625 if (gw->rfcomm == NULL)
628 if (!bt_io_accept(gw->rfcomm, rfcomm_connect_cb, dev, NULL, &err)) {
639 struct gateway *gw = dev->gateway;
643 if (!gw->rfcomm) {
644 gw->sco_start_cb = cb;
645 gw->sco_start_cb_data = user_data;
647 } else if (!gw->sco) {
648 gw->sco_start_cb = cb;
649 gw->sco_start_cb_data = user_data;
668 struct gateway *gw = dev->gateway;
670 if (!gw->rfcomm) {
671 gw->sco_start_cb = sco_cb;
672 gw->sco_start_cb_data = user_data;
690 struct gateway *gw = dev->gateway;
692 if (!gw || !gw->sco)
695 return g_io_channel_unix_get_fd(gw->sco);
700 struct gateway *gw = dev->gateway;
702 if (!gw || !gw->sco)
705 g_io_channel_shutdown(gw->sco, TRUE, NULL);
706 g_io_channel_unref(gw->sco);
707 gw->sco = NULL;
708 gw->sco_start_cb = NULL;
709 gw->sco_start_cb_data = NULL;