~ubuntu-branches/ubuntu/vivid/modemmanager/vivid-proposed

« back to all changes in this revision

Viewing changes to plugins/mm-modem-gobi-gsm.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2011-08-07 01:47:27 UTC
  • mfrom: (16.1.3 oneiric)
  • Revision ID: james.westby@ubuntu.com-20110807014727-ssze4jx65jrjltg9
Tags: 0.5-1
debian/rules: override dh_autoreconf in a nicer way so we don't have to
clean up manually afterwards.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "mm-callback-info.h"
25
25
#include "mm-modem-gsm-card.h"
26
26
#include "mm-at-serial-port.h"
 
27
#include "mm-modem-helpers.h"
27
28
 
28
29
static void modem_init (MMModem *modem_class);
29
30
static void modem_gsm_card_init (MMModemGsmCard *gsm_card_class);
56
57
/*****************************************************************************/
57
58
 
58
59
static void
 
60
get_act_request_done (MMAtSerialPort *port,
 
61
                      GString *response,
 
62
                      GError *error,
 
63
                      gpointer user_data)
 
64
{
 
65
    MMCallbackInfo *info = user_data;
 
66
    MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
 
67
    const char *p;
 
68
 
 
69
    /* If the modem has already been removed, return without
 
70
     * scheduling callback */
 
71
    if (mm_callback_info_check_modem_removed (info))
 
72
        return;
 
73
 
 
74
    if (error)
 
75
        info->error = g_error_copy (error);
 
76
    else {
 
77
        p = mm_strip_tag (response->str, "*CNTI:");
 
78
        p = strchr (p, ',');
 
79
        if (p)
 
80
            act = mm_gsm_string_to_access_tech (p + 1);
 
81
    }
 
82
 
 
83
    mm_callback_info_set_result (info, GUINT_TO_POINTER (act), NULL);
 
84
    mm_callback_info_schedule (info);
 
85
}
 
86
 
 
87
static void
 
88
get_access_technology (MMGenericGsm *modem,
 
89
                       MMModemUIntFn callback,
 
90
                       gpointer user_data)
 
91
{
 
92
    MMAtSerialPort *port;
 
93
    MMCallbackInfo *info;
 
94
 
 
95
    info = mm_callback_info_uint_new (MM_MODEM (modem), callback, user_data);
 
96
 
 
97
    port = mm_generic_gsm_get_best_at_port (modem, &info->error);
 
98
    if (!port) {
 
99
        mm_callback_info_schedule (info);
 
100
        return;
 
101
    }
 
102
 
 
103
    mm_at_serial_port_queue_command (port, "*CNTI=0", 3, get_act_request_done, info);
 
104
}
 
105
 
 
106
/*****************************************************************************/
 
107
 
 
108
static void
59
109
get_string_done (MMAtSerialPort *port,
60
110
                 GString *response,
61
111
                 GError *error,
118
168
static void
119
169
mm_modem_gobi_gsm_class_init (MMModemGobiGsmClass *klass)
120
170
{
 
171
    MMGenericGsmClass *gsm_class = MM_GENERIC_GSM_CLASS (klass);
 
172
 
 
173
    gsm_class->get_access_technology = get_access_technology;
121
174
}
122
175