static void connection_enabled (MMAtSerialPort *port, GMatchInfo *match_info, gpointer user_data) { MMModemHso *self = MM_MODEM_HSO (user_data); MMModemHsoPrivate *priv = MM_MODEM_HSO_GET_PRIVATE (self); char *str; str = g_match_info_fetch (match_info, 2); if (str[0] == '1') connect_pending_done (self); else if (str[0] == '3') { MMCallbackInfo *info = priv->connect_pending_data; if (info) { info->error = g_error_new_literal (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, "Call setup failed"); } connect_pending_done (self); } else if (str[0] == '0') { /* FIXME: disconnected. do something when we have modem status signals */ } g_free (str); }
static void query_network_error_code_done (MMAtSerialPort *port, GString *response, GError *error, gpointer user_data) { MMModemIcera *self = MM_MODEM_ICERA (user_data); MMModemIceraPrivate *priv = MM_MODEM_ICERA_GET_PRIVATE (self); MMCallbackInfo *info = priv->connect_pending_data; int nw_activation_err; /* If the modem has already been removed, return without * scheduling callback */ if (mm_callback_info_check_modem_removed (info)) return; if ((error == NULL) && g_str_has_prefix (response->str, "%IER: ")) { if (sscanf (response->str + 6, "%*d,%*d,%d", &nw_activation_err)) { /* 3GPP TS 24.008 Annex G error codes: * 27 - Unknown or missing access point name * 33 - Requested service option not subscribed */ if (nw_activation_err == 27 || nw_activation_err == 33) info->error = mm_mobile_error_for_code (MM_MOBILE_ERROR_GPRS_NOT_SUBSCRIBED); } } if (info->error == NULL) { /* Generic error since parsing the specific one didn't work */ info->error = g_error_new_literal (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, "Call setup failed"); } connect_pending_done (self); }
static void timeout_done (MMAtSerialPort *port, GString *response, GError *error, gpointer user_data) { connect_pending_done (MM_MODEM_ICERA (user_data)); }
static void timeout_done (MMModem *modem, GError *error, gpointer user_data) { if (modem) connect_pending_done (MM_MODEM_HSO (modem)); }
static void connection_enabled (MMAtSerialPort *port, GMatchInfo *match_info, gpointer user_data) { MMModemIcera *self = MM_MODEM_ICERA (user_data); MMAtSerialPort *primary; char *str; int status, cid, tmp; cid = mm_generic_gsm_get_cid (MM_GENERIC_GSM (self)); if (cid < 0) return; str = g_match_info_fetch (match_info, 1); g_return_if_fail (str != NULL); tmp = atoi (str); g_free (str); /* Make sure the unsolicited message's CID matches the current CID */ if (tmp != cid) return; str = g_match_info_fetch (match_info, 2); g_return_if_fail (str != NULL); status = atoi (str); g_free (str); switch (status) { case 0: /* Disconnected */ if (mm_modem_get_state (MM_MODEM (self)) >= MM_MODEM_STATE_CONNECTED) mm_modem_disconnect (MM_MODEM (self), icera_disconnect_done, NULL); break; case 1: /* Connected */ connect_pending_done (self); break; case 2: /* Connecting */ break; case 3: /* Call setup failure? */ primary = mm_generic_gsm_get_at_port (MM_GENERIC_GSM(self), MM_AT_PORT_FLAG_PRIMARY); g_assert (primary); /* Get additional error details */ mm_at_serial_port_queue_command (primary, "AT%IER?", 3, query_network_error_code_done, self); break; default: mm_warn ("Unknown Icera connect status %d", status); break; } }
void mm_modem_icera_cleanup (MMModemIcera *self) { MMModemIceraPrivate *priv = MM_MODEM_ICERA_GET_PRIVATE (self); /* Clear the pending connection if necessary */ connect_pending_done (self); g_free (priv->username); priv->username = NULL; g_free (priv->password); priv->password = NULL; }