[PATCH v2 1/2] bearer: replace mm_bearer_report_disconnection with mm_bearer_report_status
Ben Chan
benchan at chromium.org
Thu Sep 19 01:12:10 PDT 2013
This patch replaces mm_bearer_report_disconnection() with a more generic
mm_bearer_report_status(), which allows reporting a change of bearer
status other than MM_BEARER_STATUS_DISCONNECTED.
---
plugins/altair/mm-broadband-modem-altair-lte.c | 2 +-
plugins/huawei/mm-broadband-bearer-huawei.c | 2 +-
plugins/icera/mm-broadband-bearer-icera.c | 4 ++--
plugins/mbm/mm-broadband-bearer-mbm.c | 2 +-
plugins/novatel/mm-broadband-bearer-novatel-lte.c | 2 +-
plugins/option/mm-broadband-bearer-hso.c | 2 +-
src/mm-bearer-qmi.c | 13 +++++++------
src/mm-bearer.c | 10 +++++-----
src/mm-bearer.h | 6 +++---
src/mm-broadband-bearer.c | 13 +++++++------
10 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/plugins/altair/mm-broadband-modem-altair-lte.c b/plugins/altair/mm-broadband-modem-altair-lte.c
index 4fceff8..4082715 100644
--- a/plugins/altair/mm-broadband-modem-altair-lte.c
+++ b/plugins/altair/mm-broadband-modem-altair-lte.c
@@ -518,7 +518,7 @@ static void
bearer_list_report_disconnect_status_foreach (MMBearer *bearer,
gpointer *user_data)
{
- mm_bearer_report_disconnection (bearer);
+ mm_bearer_report_status (bearer, MM_BEARER_STATUS_DISCONNECTED);
}
static void
diff --git a/plugins/huawei/mm-broadband-bearer-huawei.c b/plugins/huawei/mm-broadband-bearer-huawei.c
index 233102f..9251622 100644
--- a/plugins/huawei/mm-broadband-bearer-huawei.c
+++ b/plugins/huawei/mm-broadband-bearer-huawei.c
@@ -653,7 +653,7 @@ mm_broadband_bearer_huawei_report_connection_status (MMBroadbandBearerHuawei *se
* handle network-initiated disconnection here. */
if (!connected) {
mm_dbg ("Disconnect bearer '%s'", mm_bearer_get_path (MM_BEARER (self)));
- mm_bearer_report_disconnection (MM_BEARER (self));
+ mm_bearer_report_status (MM_BEARER (self), MM_BEARER_STATUS_DISCONNECTED);
}
}
diff --git a/plugins/icera/mm-broadband-bearer-icera.c b/plugins/icera/mm-broadband-bearer-icera.c
index b7ea8df..1ad06ad 100644
--- a/plugins/icera/mm-broadband-bearer-icera.c
+++ b/plugins/icera/mm-broadband-bearer-icera.c
@@ -402,7 +402,7 @@ report_disconnect_status (MMBroadbandBearerIcera *self,
case MM_BROADBAND_BEARER_ICERA_CONNECTION_STATUS_DISCONNECTED:
if (!ctx) {
mm_dbg ("Received spontaneous %%IPDPACT disconnect");
- mm_bearer_report_disconnection (MM_BEARER (self));
+ mm_bearer_report_status (MM_BEARER (self), MM_BEARER_STATUS_DISCONNECTED);
break;
}
@@ -798,7 +798,7 @@ report_connect_status (MMBroadbandBearerIcera *self,
}
/* Just ensure we mark ourselves as being disconnected... */
- mm_bearer_report_disconnection (MM_BEARER (self));
+ mm_bearer_report_status (MM_BEARER (self), MM_BEARER_STATUS_DISCONNECTED);
return;
}
diff --git a/plugins/mbm/mm-broadband-bearer-mbm.c b/plugins/mbm/mm-broadband-bearer-mbm.c
index e4f9983..060526b 100644
--- a/plugins/mbm/mm-broadband-bearer-mbm.c
+++ b/plugins/mbm/mm-broadband-bearer-mbm.c
@@ -159,7 +159,7 @@ mm_broadband_bearer_mbm_report_connection_status (MMBroadbandBearerMbm *self,
dial_3gpp_context_complete_and_free (ctx);
} else {
/* Just ensure we mark ourselves as being disconnected... */
- mm_bearer_report_disconnection (MM_BEARER (self));
+ mm_bearer_report_status (MM_BEARER (self), MM_BEARER_STATUS_DISCONNECTED);
}
break;
}
diff --git a/plugins/novatel/mm-broadband-bearer-novatel-lte.c b/plugins/novatel/mm-broadband-bearer-novatel-lte.c
index 4681c6e..797daf0 100644
--- a/plugins/novatel/mm-broadband-bearer-novatel-lte.c
+++ b/plugins/novatel/mm-broadband-bearer-novatel-lte.c
@@ -130,7 +130,7 @@ poll_connection_ready (MMBaseModem *modem,
}
if (is_qmistatus_disconnected (result)) {
- mm_bearer_report_disconnection (MM_BEARER (bearer));
+ mm_bearer_report_status (MM_BEARER (bearer), MM_BEARER_STATUS_DISCONNECTED);
g_source_remove (bearer->priv->connection_poller);
bearer->priv->connection_poller = 0;
}
diff --git a/plugins/option/mm-broadband-bearer-hso.c b/plugins/option/mm-broadband-bearer-hso.c
index 7da13aa..b887dd6 100644
--- a/plugins/option/mm-broadband-bearer-hso.c
+++ b/plugins/option/mm-broadband-bearer-hso.c
@@ -408,7 +408,7 @@ mm_broadband_bearer_hso_report_connection_status (MMBroadbandBearerHso *self,
}
/* Just ensure we mark ourselves as being disconnected... */
- mm_bearer_report_disconnection (MM_BEARER (self));
+ mm_bearer_report_status (MM_BEARER (self), MM_BEARER_STATUS_DISCONNECTED);
return;
}
diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c
index 00d17c5..0458c9f 100644
--- a/src/mm-bearer-qmi.c
+++ b/src/mm-bearer-qmi.c
@@ -1186,13 +1186,14 @@ disconnect (MMBearer *_self,
/*****************************************************************************/
static void
-report_disconnection (MMBearer *self)
+report_status (MMBearer *self, MMBearerStatus status)
{
- /* Cleanup all connection related data */
- reset_bearer_connection (MM_BEARER_QMI (self), TRUE, TRUE);
+ if (status == MM_BEARER_STATUS_DISCONNECTED)
+ /* Cleanup all connection related data */
+ reset_bearer_connection (MM_BEARER_QMI (self), TRUE, TRUE);
- /* Chain up parent's report_disconection() */
- MM_BEARER_CLASS (mm_bearer_qmi_parent_class)->report_disconnection (self);
+ /* Chain up parent's report_status() */
+ MM_BEARER_CLASS (mm_bearer_qmi_parent_class)->report_status (self, status);
}
/*****************************************************************************/
@@ -1253,5 +1254,5 @@ mm_bearer_qmi_class_init (MMBearerQmiClass *klass)
bearer_class->connect_finish = connect_finish;
bearer_class->disconnect = disconnect;
bearer_class->disconnect_finish = disconnect_finish;
- bearer_class->report_disconnection = report_disconnection;
+ bearer_class->report_status = report_status;
}
diff --git a/src/mm-bearer.c b/src/mm-bearer.c
index 8c9a93c..3fdec62 100644
--- a/src/mm-bearer.c
+++ b/src/mm-bearer.c
@@ -974,17 +974,17 @@ mm_bearer_disconnect_force (MMBearer *self)
/*****************************************************************************/
static void
-report_disconnection (MMBearer *self)
+report_status (MMBearer *self, MMBearerStatus status)
{
/* In the generic bearer implementation we just need to reset the
* interface status */
- bearer_update_status (self, MM_BEARER_STATUS_DISCONNECTED);
+ bearer_update_status (self, status);
}
void
-mm_bearer_report_disconnection (MMBearer *self)
+mm_bearer_report_status (MMBearer *self, MMBearerStatus status)
{
- return MM_BEARER_GET_CLASS (self)->report_disconnection (self);
+ return MM_BEARER_GET_CLASS (self)->report_status (self, status);
}
static void
@@ -1160,7 +1160,7 @@ mm_bearer_class_init (MMBearerClass *klass)
object_class->finalize = finalize;
object_class->dispose = dispose;
- klass->report_disconnection = report_disconnection;
+ klass->report_status = report_status;
properties[PROP_CONNECTION] =
g_param_spec_object (MM_BEARER_CONNECTION,
diff --git a/src/mm-bearer.h b/src/mm-bearer.h
index cc71bfd..993b01e 100644
--- a/src/mm-bearer.h
+++ b/src/mm-bearer.h
@@ -92,8 +92,8 @@ struct _MMBearerClass {
GAsyncResult *res,
GError **error);
- /* Report disconnection */
- void (* report_disconnection) (MMBearer *bearer);
+ /* Report status of this bearer */
+ void (* report_status) (MMBearer *bearer, MMBearerStatus status);
};
GType mm_bearer_get_type (void);
@@ -123,6 +123,6 @@ gboolean mm_bearer_disconnect_finish (MMBearer *self,
void mm_bearer_disconnect_force (MMBearer *self);
-void mm_bearer_report_disconnection (MMBearer *self);
+void mm_bearer_report_status (MMBearer *self, MMBearerStatus status);
#endif /* MM_BEARER_H */
diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c
index f8f449d..b7e9389 100644
--- a/src/mm-broadband-bearer.c
+++ b/src/mm-broadband-bearer.c
@@ -1785,13 +1785,14 @@ disconnect (MMBearer *self,
/*****************************************************************************/
static void
-report_disconnection (MMBearer *self)
+report_status (MMBearer *self, MMBearerStatus status)
{
- /* Cleanup all connection related data */
- reset_bearer_connection (MM_BROADBAND_BEARER (self));
+ if (status == MM_BEARER_STATUS_DISCONNECTED)
+ /* Cleanup all connection related data */
+ reset_bearer_connection (MM_BROADBAND_BEARER (self));
- /* Chain up parent's report_disconection() */
- MM_BEARER_CLASS (mm_broadband_bearer_parent_class)->report_disconnection (self);
+ /* Chain up parent's report_status() */
+ MM_BEARER_CLASS (mm_broadband_bearer_parent_class)->report_status (self, status);
}
/*****************************************************************************/
@@ -2052,7 +2053,7 @@ mm_broadband_bearer_class_init (MMBroadbandBearerClass *klass)
bearer_class->connect_finish = connect_finish;
bearer_class->disconnect = disconnect;
bearer_class->disconnect_finish = disconnect_finish;
- bearer_class->report_disconnection = report_disconnection;
+ bearer_class->report_status = report_status;
klass->connect_3gpp = connect_3gpp;
klass->connect_3gpp_finish = detailed_connect_finish;
--
1.8.4
More information about the ModemManager-devel
mailing list