コード例 #1
0
static void
emit_nsp_added_removed (NMDeviceWimax *self,
                        guint signum,
                        NMWimaxNsp *nsp,
                        gboolean recheck_available_connections)
{
	g_signal_emit (self, signals[signum], 0, nsp);
	g_object_notify (G_OBJECT (self), NM_DEVICE_WIMAX_NSPS);
	nm_device_emit_recheck_auto_activate (NM_DEVICE (self));
	if (recheck_available_connections)
		nm_device_recheck_available_connections (NM_DEVICE (self));
}
コード例 #2
0
static void
remove_all_nsps (NMDeviceWimax *self)
{
	NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self);

	set_current_nsp (self, NULL);

	while (priv->nsp_list) {
		NMWimaxNsp *nsp = NM_WIMAX_NSP (priv->nsp_list->data);

		priv->nsp_list = g_slist_remove (priv->nsp_list, nsp);
		emit_nsp_added_removed (self, NSP_REMOVED, nsp, FALSE);
		g_object_unref (nsp);
	}

	nm_device_recheck_available_connections (NM_DEVICE (self));
}
コード例 #3
0
static void
remove_outdated_nsps (NMDeviceWimax *self,
					  WIMAX_API_NSP_INFO_EX *nsp_list,
					  guint32 list_size)
{
	NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self);
	GSList *iter;
	GSList *to_remove = NULL;

	for (iter = priv->nsp_list; iter; iter = iter->next) {
		NMWimaxNsp *nsp = NM_WIMAX_NSP (iter->data);
		gboolean found = FALSE;
		int i;

		for (i = 0; i < list_size; i++) {
			WIMAX_API_NSP_INFO_EX *info = &nsp_list[i];

			if (!g_strcmp0 (nm_wimax_nsp_get_name (nsp), (char *) info->NSPName)) {
				found = TRUE;
				break;
			}
		}

		if (!found)
			to_remove = g_slist_prepend (to_remove, nsp);
	}

	for (iter = to_remove; iter; iter = iter->next) {
		NMWimaxNsp *nsp = NM_WIMAX_NSP (iter->data);

		emit_nsp_added_removed (self, NSP_REMOVED, nsp, FALSE);
		priv->nsp_list = g_slist_remove (priv->nsp_list, nsp);
		g_object_unref (nsp);
	}

	if (g_slist_length(to_remove) > 0)
	    nm_device_recheck_available_connections (NM_DEVICE (self));

	g_slist_free (to_remove);
}
コード例 #4
0
static void
set_mm_running (NMDeviceBt *self, gboolean running)
{
    NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (self);
    gboolean old_available;

    if (priv->mm_running == running)
        return;

    nm_log_dbg (LOGD_BT, "(%s): ModemManager now %s",
                nm_device_get_iface (NM_DEVICE (self)),
                running ? "available" : "unavailable");

    old_available = nm_device_is_available (NM_DEVICE (self));
    priv->mm_running = running;
    handle_availability_change (self, old_available, NM_DEVICE_STATE_REASON_MODEM_MANAGER_UNAVAILABLE);

    /* Need to recheck available connections whenever MM appears or disappears,
     * since the device could be both DUN and NAP capable and thus may not
     * change state (which rechecks available connections) when MM comes and goes.
     */
    if (priv->capabilities & NM_BT_CAPABILITY_DUN)
        nm_device_recheck_available_connections (NM_DEVICE (self));
}