base-bearer: port to use object logging
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
#include "mm-base-bearer.h"
|
#include "mm-base-bearer.h"
|
||||||
#include "mm-base-modem-at.h"
|
#include "mm-base-modem-at.h"
|
||||||
#include "mm-base-modem.h"
|
#include "mm-base-modem.h"
|
||||||
#include "mm-log.h"
|
#include "mm-log-object.h"
|
||||||
#include "mm-modem-helpers.h"
|
#include "mm-modem-helpers.h"
|
||||||
#include "mm-bearer-stats.h"
|
#include "mm-bearer-stats.h"
|
||||||
|
|
||||||
@@ -50,7 +50,10 @@
|
|||||||
#define BEARER_CONNECTION_MONITOR_INITIAL_TIMEOUT 30
|
#define BEARER_CONNECTION_MONITOR_INITIAL_TIMEOUT 30
|
||||||
#define BEARER_CONNECTION_MONITOR_TIMEOUT 5
|
#define BEARER_CONNECTION_MONITOR_TIMEOUT 5
|
||||||
|
|
||||||
G_DEFINE_TYPE (MMBaseBearer, mm_base_bearer, MM_GDBUS_TYPE_BEARER_SKELETON)
|
static void log_object_iface_init (MMLogObjectInterface *iface);
|
||||||
|
|
||||||
|
G_DEFINE_TYPE_EXTENDED (MMBaseBearer, mm_base_bearer, MM_GDBUS_TYPE_BEARER_SKELETON, 0,
|
||||||
|
G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init))
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CONNECTION_FORBIDDEN_REASON_NONE,
|
CONNECTION_FORBIDDEN_REASON_NONE,
|
||||||
@@ -172,14 +175,14 @@ load_connection_status_ready (MMBaseBearer *self,
|
|||||||
if (status == MM_BEARER_CONNECTION_STATUS_UNKNOWN) {
|
if (status == MM_BEARER_CONNECTION_STATUS_UNKNOWN) {
|
||||||
/* Only warn if not reporting an "unsupported" error */
|
/* Only warn if not reporting an "unsupported" error */
|
||||||
if (!g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED)) {
|
if (!g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED)) {
|
||||||
mm_warn ("checking if connected failed: %s", error->message);
|
mm_obj_warn (self, "checking if connected failed: %s", error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're being told that connection monitoring is unsupported, just
|
/* If we're being told that connection monitoring is unsupported, just
|
||||||
* ignore the error and remove the timeout. */
|
* ignore the error and remove the timeout. */
|
||||||
mm_dbg ("Connection monitoring is unsupported by the device");
|
mm_obj_dbg (self, "connection monitoring is unsupported by the device");
|
||||||
self->priv->load_connection_status_unsupported = TRUE;
|
self->priv->load_connection_status_unsupported = TRUE;
|
||||||
connection_monitor_stop (self);
|
connection_monitor_stop (self);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
@@ -188,7 +191,7 @@ load_connection_status_ready (MMBaseBearer *self,
|
|||||||
|
|
||||||
/* Report connection or disconnection */
|
/* Report connection or disconnection */
|
||||||
g_assert (status == MM_BEARER_CONNECTION_STATUS_CONNECTED || status == MM_BEARER_CONNECTION_STATUS_DISCONNECTED);
|
g_assert (status == MM_BEARER_CONNECTION_STATUS_CONNECTED || status == MM_BEARER_CONNECTION_STATUS_DISCONNECTED);
|
||||||
mm_dbg ("connection status loaded: %s", mm_bearer_connection_status_get_string (status));
|
mm_obj_dbg (self, "connection status loaded: %s", mm_bearer_connection_status_get_string (status));
|
||||||
mm_base_bearer_report_connection_status (self, status);
|
mm_base_bearer_report_connection_status (self, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,14 +287,14 @@ reload_stats_ready (MMBaseBearer *self,
|
|||||||
if (!MM_BASE_BEARER_GET_CLASS (self)->reload_stats_finish (self, &rx_bytes, &tx_bytes, res, &error)) {
|
if (!MM_BASE_BEARER_GET_CLASS (self)->reload_stats_finish (self, &rx_bytes, &tx_bytes, res, &error)) {
|
||||||
/* If reloading stats fails, warn about it and don't update anything */
|
/* If reloading stats fails, warn about it and don't update anything */
|
||||||
if (!g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED)) {
|
if (!g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED)) {
|
||||||
mm_warn ("Reloading stats failed: %s", error->message);
|
mm_obj_warn (self, "reloading stats failed: %s", error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're being told that reloading stats is unsupported, just ignore
|
/* If we're being told that reloading stats is unsupported, just ignore
|
||||||
* the error and update oly the duration timer. */
|
* the error and update oly the duration timer. */
|
||||||
mm_dbg ("Reloading stats is unsupported by the device");
|
mm_obj_dbg (self, "reloading stats is unsupported by the device");
|
||||||
self->priv->reload_stats_unsupported = TRUE;
|
self->priv->reload_stats_unsupported = TRUE;
|
||||||
rx_bytes = 0;
|
rx_bytes = 0;
|
||||||
tx_bytes = 0;
|
tx_bytes = 0;
|
||||||
@@ -414,7 +417,7 @@ bearer_update_status_connected (MMBaseBearer *self,
|
|||||||
* the bearer when ownership of the TTY is given back to MM. */
|
* the bearer when ownership of the TTY is given back to MM. */
|
||||||
if ((ipv4_config && mm_bearer_ip_config_get_method (ipv4_config) == MM_BEARER_IP_METHOD_PPP) ||
|
if ((ipv4_config && mm_bearer_ip_config_get_method (ipv4_config) == MM_BEARER_IP_METHOD_PPP) ||
|
||||||
(ipv6_config && mm_bearer_ip_config_get_method (ipv6_config) == MM_BEARER_IP_METHOD_PPP)) {
|
(ipv6_config && mm_bearer_ip_config_get_method (ipv6_config) == MM_BEARER_IP_METHOD_PPP)) {
|
||||||
mm_dbg ("PPP is required for connection, will ignore disconnection reports");
|
mm_obj_dbg (self, "PPP is required for connection, will ignore disconnection reports");
|
||||||
self->priv->ignore_disconnection_reports = TRUE;
|
self->priv->ignore_disconnection_reports = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,7 +454,7 @@ deferred_3gpp_unregistration_cb (MMBaseBearer *self)
|
|||||||
g_warn_if_fail (self->priv->reason_3gpp == CONNECTION_FORBIDDEN_REASON_UNREGISTERED);
|
g_warn_if_fail (self->priv->reason_3gpp == CONNECTION_FORBIDDEN_REASON_UNREGISTERED);
|
||||||
self->priv->deferred_3gpp_unregistration_id = 0;
|
self->priv->deferred_3gpp_unregistration_id = 0;
|
||||||
|
|
||||||
mm_dbg ("Forcing bearer disconnection, not registered in 3GPP network");
|
mm_obj_dbg (self, "forcing bearer disconnection, not registered in 3GPP network");
|
||||||
mm_base_bearer_disconnect_force (self);
|
mm_base_bearer_disconnect_force (self);
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
@@ -505,7 +508,7 @@ modem_3gpp_registration_state_changed (MMIfaceModem3gpp *modem,
|
|||||||
|
|
||||||
/* Modem is roaming and roaming not allowed, report right away */
|
/* Modem is roaming and roaming not allowed, report right away */
|
||||||
if (self->priv->reason_3gpp == CONNECTION_FORBIDDEN_REASON_ROAMING) {
|
if (self->priv->reason_3gpp == CONNECTION_FORBIDDEN_REASON_ROAMING) {
|
||||||
mm_dbg ("Bearer not allowed to connect, registered in roaming 3GPP network");
|
mm_obj_dbg (self, "bearer not allowed to connect, registered in roaming 3GPP network");
|
||||||
reset_deferred_unregistration (self);
|
reset_deferred_unregistration (self);
|
||||||
mm_base_bearer_disconnect_force (self);
|
mm_base_bearer_disconnect_force (self);
|
||||||
return;
|
return;
|
||||||
@@ -513,7 +516,7 @@ modem_3gpp_registration_state_changed (MMIfaceModem3gpp *modem,
|
|||||||
|
|
||||||
/* Modem is registered under emergency services only? */
|
/* Modem is registered under emergency services only? */
|
||||||
if (self->priv->reason_3gpp == CONNECTION_FORBIDDEN_REASON_EMERGENCY_ONLY) {
|
if (self->priv->reason_3gpp == CONNECTION_FORBIDDEN_REASON_EMERGENCY_ONLY) {
|
||||||
mm_dbg ("Bearer not allowed to connect, emergency services only");
|
mm_obj_dbg (self, "bearer not allowed to connect, emergency services only");
|
||||||
reset_deferred_unregistration (self);
|
reset_deferred_unregistration (self);
|
||||||
mm_base_bearer_disconnect_force (self);
|
mm_base_bearer_disconnect_force (self);
|
||||||
return;
|
return;
|
||||||
@@ -527,13 +530,13 @@ modem_3gpp_registration_state_changed (MMIfaceModem3gpp *modem,
|
|||||||
|
|
||||||
/* If the bearer is not connected, report right away */
|
/* If the bearer is not connected, report right away */
|
||||||
if (self->priv->status != MM_BEARER_STATUS_CONNECTED) {
|
if (self->priv->status != MM_BEARER_STATUS_CONNECTED) {
|
||||||
mm_dbg ("Bearer not allowed to connect, not registered in 3GPP network");
|
mm_obj_dbg (self, "bearer not allowed to connect, not registered in 3GPP network");
|
||||||
mm_base_bearer_disconnect_force (self);
|
mm_base_bearer_disconnect_force (self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, setup the new timeout */
|
/* Otherwise, setup the new timeout */
|
||||||
mm_dbg ("Connected bearer not registered in 3GPP network");
|
mm_obj_dbg (self, "connected bearer not registered in 3GPP network");
|
||||||
self->priv->deferred_3gpp_unregistration_id =
|
self->priv->deferred_3gpp_unregistration_id =
|
||||||
g_timeout_add_seconds (BEARER_DEFERRED_UNREGISTRATION_TIMEOUT,
|
g_timeout_add_seconds (BEARER_DEFERRED_UNREGISTRATION_TIMEOUT,
|
||||||
(GSourceFunc) deferred_3gpp_unregistration_cb,
|
(GSourceFunc) deferred_3gpp_unregistration_cb,
|
||||||
@@ -550,7 +553,7 @@ deferred_cdma_unregistration_cb (MMBaseBearer *self)
|
|||||||
g_warn_if_fail (self->priv->reason_cdma == CONNECTION_FORBIDDEN_REASON_UNREGISTERED);
|
g_warn_if_fail (self->priv->reason_cdma == CONNECTION_FORBIDDEN_REASON_UNREGISTERED);
|
||||||
self->priv->deferred_cdma_unregistration_id = 0;
|
self->priv->deferred_cdma_unregistration_id = 0;
|
||||||
|
|
||||||
mm_dbg ("Forcing bearer disconnection, not registered in CDMA network");
|
mm_obj_dbg (self, "forcing bearer disconnection, not registered in CDMA network");
|
||||||
mm_base_bearer_disconnect_force (self);
|
mm_base_bearer_disconnect_force (self);
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
@@ -592,7 +595,7 @@ modem_cdma_registration_state_changed (MMIfaceModemCdma *modem,
|
|||||||
|
|
||||||
/* Modem is roaming and roaming not allowed, report right away */
|
/* Modem is roaming and roaming not allowed, report right away */
|
||||||
if (self->priv->reason_cdma == CONNECTION_FORBIDDEN_REASON_ROAMING) {
|
if (self->priv->reason_cdma == CONNECTION_FORBIDDEN_REASON_ROAMING) {
|
||||||
mm_dbg ("Bearer not allowed to connect, registered in roaming CDMA network");
|
mm_obj_dbg (self, "bearer not allowed to connect, registered in roaming CDMA network");
|
||||||
reset_deferred_unregistration (self);
|
reset_deferred_unregistration (self);
|
||||||
mm_base_bearer_disconnect_force (self);
|
mm_base_bearer_disconnect_force (self);
|
||||||
return;
|
return;
|
||||||
@@ -606,13 +609,13 @@ modem_cdma_registration_state_changed (MMIfaceModemCdma *modem,
|
|||||||
|
|
||||||
/* If the bearer is not connected, report right away */
|
/* If the bearer is not connected, report right away */
|
||||||
if (self->priv->status != MM_BEARER_STATUS_CONNECTED) {
|
if (self->priv->status != MM_BEARER_STATUS_CONNECTED) {
|
||||||
mm_dbg ("Bearer not allowed to connect, not registered in CDMA network");
|
mm_obj_dbg (self, "bearer not allowed to connect, not registered in CDMA network");
|
||||||
mm_base_bearer_disconnect_force (self);
|
mm_base_bearer_disconnect_force (self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, setup the new timeout */
|
/* Otherwise, setup the new timeout */
|
||||||
mm_dbg ("Connected bearer not registered in CDMA network");
|
mm_obj_dbg (self, "connected bearer not registered in CDMA network");
|
||||||
self->priv->deferred_cdma_unregistration_id =
|
self->priv->deferred_cdma_unregistration_id =
|
||||||
g_timeout_add_seconds (BEARER_DEFERRED_UNREGISTRATION_TIMEOUT,
|
g_timeout_add_seconds (BEARER_DEFERRED_UNREGISTRATION_TIMEOUT,
|
||||||
(GSourceFunc) deferred_cdma_unregistration_cb,
|
(GSourceFunc) deferred_cdma_unregistration_cb,
|
||||||
@@ -701,14 +704,11 @@ disconnect_after_cancel_ready (MMBaseBearer *self,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (!MM_BASE_BEARER_GET_CLASS (self)->disconnect_finish (self, res, &error)) {
|
if (!MM_BASE_BEARER_GET_CLASS (self)->disconnect_finish (self, res, &error)) {
|
||||||
mm_warn ("Error disconnecting bearer '%s': '%s'. "
|
mm_obj_warn (self, "error disconnecting: %s; will assume disconnected anyway", error->message);
|
||||||
"Will assume disconnected anyway.",
|
|
||||||
self->priv->path,
|
|
||||||
error->message);
|
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mm_dbg ("Disconnected bearer '%s'", self->priv->path);
|
mm_obj_dbg (self, "disconnected bearer '%s'", self->priv->path);
|
||||||
|
|
||||||
/* Report disconnection to the bearer object using class method
|
/* Report disconnection to the bearer object using class method
|
||||||
* mm_bearer_report_connection_status. This gives subclass implementations a
|
* mm_bearer_report_connection_status. This gives subclass implementations a
|
||||||
@@ -730,9 +730,7 @@ connect_ready (MMBaseBearer *self,
|
|||||||
/* NOTE: connect() implementations *MUST* handle cancellations themselves */
|
/* NOTE: connect() implementations *MUST* handle cancellations themselves */
|
||||||
result = MM_BASE_BEARER_GET_CLASS (self)->connect_finish (self, res, &error);
|
result = MM_BASE_BEARER_GET_CLASS (self)->connect_finish (self, res, &error);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
mm_dbg ("Couldn't connect bearer '%s': '%s'",
|
mm_obj_dbg (self, "couldn't connect: '%s'", error->message);
|
||||||
self->priv->path,
|
|
||||||
error->message);
|
|
||||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
|
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
|
||||||
/* Will launch disconnection */
|
/* Will launch disconnection */
|
||||||
launch_disconnect = TRUE;
|
launch_disconnect = TRUE;
|
||||||
@@ -741,14 +739,14 @@ connect_ready (MMBaseBearer *self,
|
|||||||
}
|
}
|
||||||
/* Handle cancellations detected after successful connection */
|
/* Handle cancellations detected after successful connection */
|
||||||
else if (g_cancellable_is_cancelled (self->priv->connect_cancellable)) {
|
else if (g_cancellable_is_cancelled (self->priv->connect_cancellable)) {
|
||||||
mm_dbg ("Connected bearer '%s', but need to disconnect", self->priv->path);
|
mm_obj_dbg (self, "connected, but need to disconnect");
|
||||||
mm_bearer_connect_result_unref (result);
|
mm_bearer_connect_result_unref (result);
|
||||||
error = g_error_new (G_IO_ERROR, G_IO_ERROR_CANCELLED,
|
error = g_error_new (G_IO_ERROR, G_IO_ERROR_CANCELLED,
|
||||||
"Bearer got connected, but had to disconnect after cancellation request");
|
"Bearer got connected, but had to disconnect after cancellation request");
|
||||||
launch_disconnect = TRUE;
|
launch_disconnect = TRUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mm_dbg ("Connected bearer '%s'", self->priv->path);
|
mm_obj_dbg (self, "connected");
|
||||||
|
|
||||||
/* Update bearer and interface status */
|
/* Update bearer and interface status */
|
||||||
bearer_update_status_connected (
|
bearer_update_status_connected (
|
||||||
@@ -864,7 +862,7 @@ mm_base_bearer_connect (MMBaseBearer *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Connecting! */
|
/* Connecting! */
|
||||||
mm_dbg ("Connecting bearer '%s'", self->priv->path);
|
mm_obj_dbg (self, "connecting...");
|
||||||
self->priv->connect_cancellable = g_cancellable_new ();
|
self->priv->connect_cancellable = g_cancellable_new ();
|
||||||
bearer_update_status (self, MM_BEARER_STATUS_CONNECTING);
|
bearer_update_status (self, MM_BEARER_STATUS_CONNECTING);
|
||||||
bearer_reset_interface_stats (self);
|
bearer_reset_interface_stats (self);
|
||||||
@@ -936,7 +934,7 @@ handle_connect (MMBaseBearer *self,
|
|||||||
MM_BASE_BEARER_MODEM, &ctx->modem,
|
MM_BASE_BEARER_MODEM, &ctx->modem,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
mm_dbg ("User request to connect bearer '%s'", self->priv->path);
|
mm_obj_dbg (self, "user request to connect");
|
||||||
|
|
||||||
mm_base_modem_authorize (ctx->modem,
|
mm_base_modem_authorize (ctx->modem,
|
||||||
invocation,
|
invocation,
|
||||||
@@ -965,12 +963,12 @@ disconnect_ready (MMBaseBearer *self,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (!MM_BASE_BEARER_GET_CLASS (self)->disconnect_finish (self, res, &error)) {
|
if (!MM_BASE_BEARER_GET_CLASS (self)->disconnect_finish (self, res, &error)) {
|
||||||
mm_dbg ("Couldn't disconnect bearer '%s': %s", self->priv->path, error->message);
|
mm_obj_dbg (self, "couldn't disconnect: %s", error->message);
|
||||||
bearer_update_status (self, MM_BEARER_STATUS_CONNECTED);
|
bearer_update_status (self, MM_BEARER_STATUS_CONNECTED);
|
||||||
g_task_return_error (task, error);
|
g_task_return_error (task, error);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mm_dbg ("Disconnected bearer '%s'", self->priv->path);
|
mm_obj_dbg (self, "disconnected");
|
||||||
bearer_update_status (self, MM_BEARER_STATUS_DISCONNECTED);
|
bearer_update_status (self, MM_BEARER_STATUS_DISCONNECTED);
|
||||||
g_task_return_boolean (task, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
}
|
}
|
||||||
@@ -988,8 +986,7 @@ status_changed_complete_disconnect (MMBaseBearer *self,
|
|||||||
if (self->priv->status != MM_BEARER_STATUS_DISCONNECTED)
|
if (self->priv->status != MM_BEARER_STATUS_DISCONNECTED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mm_dbg ("Disconnected bearer '%s' after cancelling previous connect request",
|
mm_obj_dbg (self, "disconnected after cancelling previous connect request");
|
||||||
self->priv->path);
|
|
||||||
g_signal_handler_disconnect (self,
|
g_signal_handler_disconnect (self,
|
||||||
self->priv->disconnect_signal_handler);
|
self->priv->disconnect_signal_handler);
|
||||||
self->priv->disconnect_signal_handler = 0;
|
self->priv->disconnect_signal_handler = 0;
|
||||||
@@ -1038,7 +1035,7 @@ mm_base_bearer_disconnect (MMBaseBearer *self,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mm_dbg ("Disconnecting bearer '%s'", self->priv->path);
|
mm_obj_dbg (self, "disconnecting...");
|
||||||
|
|
||||||
/* If currently connecting, try to cancel that operation, and wait to get
|
/* If currently connecting, try to cancel that operation, and wait to get
|
||||||
* disconnected. */
|
* disconnected. */
|
||||||
@@ -1129,7 +1126,7 @@ handle_disconnect (MMBaseBearer *self,
|
|||||||
MM_BASE_BEARER_MODEM, &ctx->modem,
|
MM_BASE_BEARER_MODEM, &ctx->modem,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
mm_dbg ("User request to disconnect bearer '%s'", self->priv->path);
|
mm_obj_dbg (self, "user request to disconnect");
|
||||||
|
|
||||||
mm_base_modem_authorize (ctx->modem,
|
mm_base_modem_authorize (ctx->modem,
|
||||||
invocation,
|
invocation,
|
||||||
@@ -1160,9 +1157,7 @@ base_bearer_dbus_export (MMBaseBearer *self)
|
|||||||
self->priv->connection,
|
self->priv->connection,
|
||||||
self->priv->path,
|
self->priv->path,
|
||||||
&error)) {
|
&error)) {
|
||||||
mm_warn ("couldn't export BEARER at '%s': '%s'",
|
mm_obj_warn (self, "couldn't export to bus: %s", error->message);
|
||||||
self->priv->path,
|
|
||||||
error->message);
|
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1175,7 +1170,7 @@ base_bearer_dbus_unexport (MMBaseBearer *self)
|
|||||||
path = g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (self));
|
path = g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (self));
|
||||||
/* Only unexport if currently exported */
|
/* Only unexport if currently exported */
|
||||||
if (path) {
|
if (path) {
|
||||||
mm_dbg ("Removing from DBus bearer at '%s'", path);
|
mm_obj_dbg (self, "removing from bus");
|
||||||
g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (self));
|
g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1223,14 +1218,11 @@ disconnect_force_ready (MMBaseBearer *self,
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
if (!MM_BASE_BEARER_GET_CLASS (self)->disconnect_finish (self, res, &error)) {
|
if (!MM_BASE_BEARER_GET_CLASS (self)->disconnect_finish (self, res, &error)) {
|
||||||
mm_warn ("Error disconnecting bearer '%s': '%s'. "
|
mm_obj_warn (self, "error disconnecting: %s; will assume disconnected anyway", error->message);
|
||||||
"Will assume disconnected anyway.",
|
|
||||||
self->priv->path,
|
|
||||||
error->message);
|
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mm_dbg ("Disconnected bearer '%s'", self->priv->path);
|
mm_obj_dbg (self, "disconnected");
|
||||||
|
|
||||||
/* Report disconnection to the bearer object using class method
|
/* Report disconnection to the bearer object using class method
|
||||||
* mm_bearer_report_connection_status. This gives subclass implementations a
|
* mm_bearer_report_connection_status. This gives subclass implementations a
|
||||||
@@ -1247,7 +1239,7 @@ mm_base_bearer_disconnect_force (MMBaseBearer *self)
|
|||||||
self->priv->status == MM_BEARER_STATUS_DISCONNECTED)
|
self->priv->status == MM_BEARER_STATUS_DISCONNECTED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mm_dbg ("Forcing disconnection of bearer '%s'", self->priv->path);
|
mm_obj_dbg (self, "forcing disconnection");
|
||||||
|
|
||||||
/* If currently connecting, try to cancel that operation. */
|
/* If currently connecting, try to cancel that operation. */
|
||||||
if (self->priv->status == MM_BEARER_STATUS_CONNECTING) {
|
if (self->priv->status == MM_BEARER_STATUS_CONNECTING) {
|
||||||
@@ -1311,7 +1303,7 @@ mm_base_bearer_report_connection_status (MMBaseBearer *self,
|
|||||||
MMBearerConnectionStatus status)
|
MMBearerConnectionStatus status)
|
||||||
{
|
{
|
||||||
if ((status == MM_BEARER_CONNECTION_STATUS_DISCONNECTED) && self->priv->ignore_disconnection_reports) {
|
if ((status == MM_BEARER_CONNECTION_STATUS_DISCONNECTED) && self->priv->ignore_disconnection_reports) {
|
||||||
mm_dbg ("ignoring disconnection report for bearer '%s'", self->priv->path);
|
mm_obj_dbg (self, "ignoring disconnection report");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1320,6 +1312,17 @@ mm_base_bearer_report_connection_status (MMBaseBearer *self,
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static gchar *
|
||||||
|
log_object_build_id (MMLogObject *_self)
|
||||||
|
{
|
||||||
|
MMBaseBearer *self;
|
||||||
|
|
||||||
|
self = MM_BASE_BEARER (_self);
|
||||||
|
return g_strdup_printf ("bearer%u", self->priv->dbus_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_property (GObject *object,
|
set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
@@ -1352,6 +1355,8 @@ set_property (GObject *object,
|
|||||||
g_clear_object (&self->priv->modem);
|
g_clear_object (&self->priv->modem);
|
||||||
self->priv->modem = g_value_dup_object (value);
|
self->priv->modem = g_value_dup_object (value);
|
||||||
if (self->priv->modem) {
|
if (self->priv->modem) {
|
||||||
|
/* Set owner ID */
|
||||||
|
mm_log_object_set_owner_id (MM_LOG_OBJECT (self), mm_log_object_get_id (MM_LOG_OBJECT (self->priv->modem)));
|
||||||
/* Bind the modem's connection (which is set when it is exported,
|
/* Bind the modem's connection (which is set when it is exported,
|
||||||
* and unset when unexported) to the BEARER's connection */
|
* and unset when unexported) to the BEARER's connection */
|
||||||
g_object_bind_property (self->priv->modem, MM_BASE_MODEM_CONNECTION,
|
g_object_bind_property (self->priv->modem, MM_BASE_MODEM_CONNECTION,
|
||||||
@@ -1491,6 +1496,12 @@ dispose (GObject *object)
|
|||||||
G_OBJECT_CLASS (mm_base_bearer_parent_class)->dispose (object);
|
G_OBJECT_CLASS (mm_base_bearer_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
log_object_iface_init (MMLogObjectInterface *iface)
|
||||||
|
{
|
||||||
|
iface->build_id = log_object_build_id;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mm_base_bearer_class_init (MMBaseBearerClass *klass)
|
mm_base_bearer_class_init (MMBaseBearerClass *klass)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user