gboolean nm_device_bt_modem_removed (NMDeviceBt *self, NMModem *modem) { NMDeviceBtPrivate *priv; NMDeviceState state; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (NM_IS_DEVICE_BT (self), FALSE); g_return_val_if_fail (modem != NULL, FALSE); g_return_val_if_fail (NM_IS_MODEM (modem), FALSE); priv = NM_DEVICE_BT_GET_PRIVATE (self); if (modem != priv->modem) return FALSE; state = nm_device_get_state (NM_DEVICE (self)); nm_modem_device_state_changed (priv->modem, NM_DEVICE_STATE_DISCONNECTED, state, NM_DEVICE_STATE_REASON_USER_REQUESTED); g_object_unref (priv->modem); priv->modem = NULL; return TRUE; }
static void device_state_changed (NMDevice *device, NMDeviceState new_state, NMDeviceState old_state, NMDeviceStateReason reason) { NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device); if (priv->modem) nm_modem_device_state_changed (priv->modem, new_state, old_state, reason); }
static void device_state_changed (NMDevice *device, NMDeviceState new_state, NMDeviceState old_state, NMDeviceStateReason reason, gpointer user_data) { nm_modem_device_state_changed (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem, new_state, old_state, reason); }
static void real_deactivate_quickly (NMDevice *device) { NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device); priv->have_iface = FALSE; priv->connected = FALSE; if (priv->bt_type == NM_BT_CAPABILITY_DUN) { if (priv->modem) { nm_modem_deactivate_quickly (priv->modem, device); /* Since we're killing the Modem object before it'll get the * state change signal, simulate the state change here. */ nm_modem_device_state_changed (priv->modem, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_USER_REQUESTED); g_object_unref (priv->modem); priv->modem = NULL; } if (priv->type_proxy) { /* Don't ever pass NULL through dbus; rfcomm_iface * might happen to be NULL for some reason. */ if (priv->rfcomm_iface) { dbus_g_proxy_call_no_reply (priv->type_proxy, "Disconnect", G_TYPE_STRING, priv->rfcomm_iface, G_TYPE_INVALID); } g_object_unref (priv->type_proxy); priv->type_proxy = NULL; } } else if (priv->bt_type == NM_BT_CAPABILITY_NAP) { if (priv->type_proxy) { dbus_g_proxy_call_no_reply (priv->type_proxy, "Disconnect", G_TYPE_INVALID); g_object_unref (priv->type_proxy); priv->type_proxy = NULL; } } if (priv->dev_proxy) { g_object_unref (priv->dev_proxy); priv->dev_proxy = NULL; } if (priv->timeout_id) { g_source_remove (priv->timeout_id); priv->timeout_id = 0; } priv->bt_type = NM_BT_CAPABILITY_NONE; g_free (priv->rfcomm_iface); priv->rfcomm_iface = NULL; if (NM_DEVICE_CLASS (nm_device_bt_parent_class)->deactivate_quickly) NM_DEVICE_CLASS (nm_device_bt_parent_class)->deactivate_quickly (device); }