static void wmx_new_sdk_cb (struct wmxsdk *sdk, void *user_data) { NMDeviceWimax *self = NM_DEVICE_WIMAX (user_data); NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self); /* We only track one wmxsdk at a time because the WiMAX SDK is pretty stupid */ if (priv->sdk) { nm_log_dbg (LOGD_WIMAX, "(%s): WiMAX interface already known", sdk->ifname); return; } nm_log_dbg (LOGD_WIMAX, "(%s): new WiMAX interface (%s)", sdk->ifname, sdk->name); /* Now that we have an SDK, schedule an idle handler to start the device up */ priv->sdk = wmxsdk_ref (sdk); iwmx_sdk_set_callbacks(priv->sdk, wmx_state_change_cb, wmx_media_status_cb, wmx_connect_result_cb, wmx_scan_result_cb, wmx_removed_cb, self); iwmx_sdk_set_fast_reconnect_enabled (priv->sdk, 0); if (!priv->sdk_action_defer_id) priv->sdk_action_defer_id = g_idle_add (sdk_action_defer_cb, self); }
static void _schedule_connect_result(struct wmxsdk *wmxsdk, WIMAX_API_NETWORK_CONNECTION_RESP resp) { ConnectResultInfo *info; info = malloc(sizeof (*info)); if (!info) return; memset(info, 0, sizeof(*info)); info->wmxsdk = wmxsdk; info->result = resp; wmxsdk_ref(wmxsdk); g_idle_add(connect_result_handler, info); }
static void _schedule_media_status_change(struct wmxsdk *wmxsdk, WIMAX_API_MEDIA_STATUS media_status) { MediaStatusInfo *info; info = malloc(sizeof (*info)); if (!info) return; memset(info, 0, sizeof(*info)); info->wmxsdk = wmxsdk; info->media_status = media_status; wmxsdk_ref(wmxsdk); g_idle_add(media_status_change_handler, info); }
static void _schedule_state_change(struct wmxsdk *wmxsdk, WIMAX_API_DEVICE_STATUS new_status, WIMAX_API_DEVICE_STATUS old_status, WIMAX_API_STATUS_REASON reason) { StateChangeInfo *info; info = malloc(sizeof (*info)); if (!info) return; memset(info, 0, sizeof(*info)); info->wmxsdk = wmxsdk; info->new_status = new_status; info->old_status = old_status; info->reason = reason; wmxsdk_ref(wmxsdk); g_idle_add(state_change_handler, info); }
static void wmx_new_sdk_cb (struct wmxsdk *sdk, void *user_data) { NMDeviceWimax *self = NM_DEVICE_WIMAX (user_data); NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self); /* If we now have the SDK, schedule an idle handler to start the device up */ if (!priv->sdk) { priv->sdk = wmxsdk_ref (sdk); iwmx_sdk_set_callbacks(priv->sdk, wmx_state_change_cb, wmx_media_status_cb, wmx_connect_result_cb, wmx_scan_result_cb, wmx_removed_cb, self); iwmx_sdk_set_fast_reconnect_enabled (priv->sdk, 0); if (!priv->sdk_action_defer_id) priv->sdk_action_defer_id = g_idle_add (sdk_action_defer_cb, self); } }
static void _schedule_scan_result(struct wmxsdk *wmxsdk, WIMAX_API_NSP_INFO_EX *nsps, guint num_nsps) { ScanResultInfo *info; size_t nsps_size; int i, tmp; info = malloc(sizeof (*info)); if (!info) return; memset(info, 0, sizeof(*info)); info->wmxsdk = wmxsdk; nsps_size = num_nsps * sizeof (WIMAX_API_NSP_INFO_EX); info->nsps = malloc(nsps_size); memcpy(info->nsps, nsps, nsps_size); info->num_nsps = num_nsps; /* CAPI may report link quality as zero -- if it does check if it is a bug * by computing it based on CINR. If it is different, use the computed one. */ for (i = 0; i < num_nsps; i++) { WIMAX_API_NSP_INFO_EX *nsp = &info->nsps[i]; if (nsp->linkQuality == 0) { tmp = cinr_to_percentage(nsp->CINR - 10); if (tmp != nsp->linkQuality) nsp->linkQuality = tmp; } } wmxsdk_ref(wmxsdk); g_idle_add(scan_result_handler, info); }
static void _schedule_removed(struct wmxsdk *wmxsdk) { wmxsdk_ref(wmxsdk); g_idle_add(removed_handler, wmxsdk); }