~indicator-network-developers/ofono/trunk.packaging

« back to all changes in this revision

Viewing changes to plugins/gobi.c

  • Committer: Kalle Valo
  • Date: 2011-02-21 07:46:07 UTC
  • mfrom: (2738.1.2125)
  • Revision ID: kalle.valo@canonical.com-20110221074607-u4rocuj2p75kpht9
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
        if (channel == NULL)
107
107
                return NULL;
108
108
 
109
 
        syntax = g_at_syntax_new_gsmv1();
 
109
        syntax = g_at_syntax_new_gsm_permissive();
110
110
        chat = g_at_chat_new(channel, syntax);
111
111
        g_at_syntax_unref(syntax);
112
112
        g_io_channel_unref(channel);
126
126
        struct gobi_data *data = ofono_modem_get_data(modem);
127
127
 
128
128
        GAtResultIter iter;
129
 
        const char *state;
 
129
        const char *state, *tmp;
130
130
 
131
131
        if (data->sim == NULL)
132
132
                return;
136
136
        if (!g_at_result_iter_next(&iter, "$QCSIMSTAT:"))
137
137
                return;
138
138
 
139
 
        if (!g_at_result_iter_skip_next(&iter))
 
139
        if (!g_at_result_iter_next_unquoted_string(&iter, &tmp))
140
140
                return;
141
141
 
142
 
        if (!g_at_result_iter_next_unquoted_string(&iter, &state))
 
142
        /*
 
143
         * When receiving an unsolicited notification, the comma
 
144
         * is missing ($QCSIMSTAT: 1 SIM INIT COMPLETED). Handle
 
145
         * this gracefully.
 
146
         */
 
147
        if (g_str_has_prefix(tmp, "1 ") == TRUE)
 
148
                state = tmp + 2;
 
149
        else if (!g_at_result_iter_next_unquoted_string(&iter, &state))
143
150
                return;
144
151
 
145
152
        DBG("state %s", state);
244
251
 
245
252
        DBG("modem %p %s", modem, online ? "online" : "offline");
246
253
 
247
 
        if (cbd == NULL || data->chat == NULL)
 
254
        if (data->chat == NULL)
248
255
                goto error;
249
256
 
250
257
        if (g_at_chat_send(data->chat, command, NULL,
274
281
        DBG("%p", modem);
275
282
 
276
283
        ofono_phonebook_create(modem, 0, "atmodem", data->chat);
 
284
 
 
285
        ofono_sms_create(modem, OFONO_VENDOR_GOBI, "atmodem", data->chat);
277
286
}
278
287
 
279
288
static void gobi_post_online(struct ofono_modem *modem)
285
294
 
286
295
        ofono_netreg_create(modem, OFONO_VENDOR_GOBI, "atmodem", data->chat);
287
296
 
288
 
        ofono_sms_create(modem, OFONO_VENDOR_GOBI, "atmodem", data->chat);
289
297
        ofono_cbs_create(modem, OFONO_VENDOR_GOBI, "atmodem", data->chat);
290
298
        ofono_ussd_create(modem, OFONO_VENDOR_GOBI, "atmodem", data->chat);
291
299
 
299
307
        .remove         = gobi_remove,
300
308
        .enable         = gobi_enable,
301
309
        .disable        = gobi_disable,
302
 
        .set_online     = gobi_set_online,
 
310
        .set_online     = gobi_set_online,
303
311
        .pre_sim        = gobi_pre_sim,
304
312
        .post_sim       = gobi_post_sim,
305
 
        .post_online    = gobi_post_online,
 
313
        .post_online    = gobi_post_online,
306
314
};
307
315
 
308
316
static int gobi_init(void)