MMPort * mm_base_modem_get_best_data_port (MMBaseModem *self) { MMPort *port; port = mm_base_modem_peek_best_data_port (self); return (port ? g_object_ref (port) : NULL); }
static void connect_3gpp (MMBroadbandBearer *self, MMBroadbandModem *modem, MMPortSerialAt *primary, MMPortSerialAt *secondary, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { Connect3gppContext *ctx; MMPort *data; g_assert (primary != NULL); /* We need a net data port */ data = mm_base_modem_peek_best_data_port (MM_BASE_MODEM (modem), MM_PORT_TYPE_NET); if (!data) { g_simple_async_report_error_in_idle (G_OBJECT (self), callback, user_data, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND, "No valid data port found to launch connection"); return; } /* Setup connection context */ ctx = g_slice_new0 (Connect3gppContext); ctx->self = g_object_ref (self); ctx->modem = g_object_ref (modem); ctx->data = g_object_ref (data); ctx->result = g_simple_async_result_new (G_OBJECT (self), callback, user_data, connect_3gpp); ctx->cancellable = g_object_ref (cancellable); ctx->step = CONNECT_3GPP_CONTEXT_STEP_FIRST; g_assert (ctx->self->priv->connect_pending == NULL); g_assert (ctx->self->priv->disconnect_pending == NULL); /* Get correct dial port to use */ ctx->primary = get_dial_port (MM_BROADBAND_MODEM_HUAWEI (ctx->modem), ctx->data, primary); /* Run! */ connect_3gpp_context_step (ctx); }