broadband-bearer: pass down CID to the 3GPP-specific disconnection logic

This commit is contained in:
Aleksander Morgado
2012-03-16 14:18:41 +01:00
parent 51956459dc
commit 93b4256fb6
3 changed files with 12 additions and 11 deletions

View File

@@ -345,6 +345,7 @@ disconnect_3gpp (MMBroadbandBearer *self,
MMAtSerialPort *primary, MMAtSerialPort *primary,
MMAtSerialPort *secondary, MMAtSerialPort *secondary,
MMPort *data, MMPort *data,
guint cid,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {

View File

@@ -1448,9 +1448,6 @@ cgact_primary_ready (MMBaseModem *modem,
g_error_free (error); g_error_free (error);
} }
/* Clear CID if we got any set */
if (ctx->self->priv->cid)
ctx->self->priv->cid = 0;
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
detailed_disconnect_context_complete_and_free (ctx); detailed_disconnect_context_complete_and_free (ctx);
} }
@@ -1482,9 +1479,6 @@ primary_flash_3gpp_ready (MMSerialPort *port,
/* Don't bother doing the CGACT again if it was done on a secondary port /* Don't bother doing the CGACT again if it was done on a secondary port
* or if not needed */ * or if not needed */
if (ctx->cgact_sent) { if (ctx->cgact_sent) {
/* Clear CID if we got any set */
if (ctx->self->priv->cid)
ctx->self->priv->cid = 0;
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
detailed_disconnect_context_complete_and_free (ctx); detailed_disconnect_context_complete_and_free (ctx);
return; return;
@@ -1533,6 +1527,7 @@ disconnect_3gpp (MMBroadbandBearer *self,
MMAtSerialPort *primary, MMAtSerialPort *primary,
MMAtSerialPort *secondary, MMAtSerialPort *secondary,
MMPort *data, MMPort *data,
guint cid,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
@@ -1549,9 +1544,8 @@ disconnect_3gpp (MMBroadbandBearer *self,
user_data); user_data);
/* If no specific CID was used, disable all PDP contexts */ /* If no specific CID was used, disable all PDP contexts */
ctx->cgact_command = ctx->cgact_command = (cid >= 0 ?
(MM_BROADBAND_BEARER (self)->priv->cid >= 0 ? g_strdup_printf ("+CGACT=0,%d", cid) :
g_strdup_printf ("+CGACT=0,%d", MM_BROADBAND_BEARER (self)->priv->cid) :
g_strdup_printf ("+CGACT=0")); g_strdup_printf ("+CGACT=0"));
/* If the primary port is connected (with PPP) then try sending the PDP /* If the primary port is connected (with PPP) then try sending the PDP
@@ -1663,8 +1657,12 @@ disconnect_3gpp_ready (MMBroadbandBearer *self,
res, res,
&error)) &error))
disconnect_failed (ctx, error); disconnect_failed (ctx, error);
else else {
/* Clear CID if we got any set */
if (ctx->self->priv->cid)
ctx->self->priv->cid = 0;
disconnect_succeeded (ctx); disconnect_succeeded (ctx);
}
} }
static void static void
@@ -1723,6 +1721,7 @@ disconnect (MMBearer *self,
primary, primary,
mm_base_modem_peek_port_secondary (modem), mm_base_modem_peek_port_secondary (modem),
MM_BROADBAND_BEARER (self)->priv->port, MM_BROADBAND_BEARER (self)->priv->port,
MM_BROADBAND_BEARER (self)->priv->cid,
(GAsyncReadyCallback) disconnect_3gpp_ready, (GAsyncReadyCallback) disconnect_3gpp_ready,
ctx); ctx);
break; break;

View File

@@ -100,6 +100,7 @@ struct _MMBroadbandBearerClass {
MMAtSerialPort *primary, MMAtSerialPort *primary,
MMAtSerialPort *secondary, MMAtSerialPort *secondary,
MMPort *data, MMPort *data,
guint cid,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean (* disconnect_3gpp_finish) (MMBroadbandBearer *self, gboolean (* disconnect_3gpp_finish) (MMBroadbandBearer *self,