Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: src/device.c

Issue 6294001: Added support for GSM in the modemmgr plugin. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/flimflam.git@master
Patch Set: Add a string mapping for NETWORK_TECHNOLOGY_GSM Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/connman.h ('k') | src/service.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * 2 *
3 * Connection Manager 3 * Connection Manager
4 * 4 *
5 * Copyright (C) 2007-2009 Intel Corporation. All rights reserved. 5 * Copyright (C) 2007-2009 Intel Corporation. All rights reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 * 10 *
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 char *meid; 73 char *meid;
74 char *imei; 74 char *imei;
75 char *imsi; 75 char *imsi;
76 char *mdn; 76 char *mdn;
77 char *min; 77 char *min;
78 char *model_id; 78 char *model_id;
79 char *manufacturer; 79 char *manufacturer;
80 char *firmware_revision; 80 char *firmware_revision;
81 char *hardware_revision; 81 char *hardware_revision;
82 guint prl_version; 82 guint prl_version;
83 GTimeVal modem_update_time;
84 } cellular; 83 } cellular;
85 84
86 struct connman_device_driver *driver; 85 struct connman_device_driver *driver;
87 void *driver_data; 86 void *driver_data;
88 87
89 struct connman_network *network; /* current connected network */ 88 struct connman_network *network; /* current connected network */
90 GHashTable *networks; /* associated networks */ 89 GHashTable *networks; /* associated networks */
91 90
92 DBusMessage *pending; 91 DBusMessage *pending;
93 guint timeout; 92 guint timeout;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 return CONNMAN_SERVICE_TYPE_WIMAX; 215 return CONNMAN_SERVICE_TYPE_WIMAX;
217 case CONNMAN_DEVICE_TYPE_BLUETOOTH: 216 case CONNMAN_DEVICE_TYPE_BLUETOOTH:
218 return CONNMAN_SERVICE_TYPE_BLUETOOTH; 217 return CONNMAN_SERVICE_TYPE_BLUETOOTH;
219 case CONNMAN_DEVICE_TYPE_CELLULAR: 218 case CONNMAN_DEVICE_TYPE_CELLULAR:
220 return CONNMAN_SERVICE_TYPE_CELLULAR; 219 return CONNMAN_SERVICE_TYPE_CELLULAR;
221 } 220 }
222 221
223 return CONNMAN_SERVICE_TYPE_UNKNOWN; 222 return CONNMAN_SERVICE_TYPE_UNKNOWN;
224 } 223 }
225 224
226 void __connman_device_set_modem_update_time(struct connman_device *device)
227 {
228 g_get_current_time(&device->cellular.modem_update_time);
229 }
230
231 struct connman_ipconfig *connman_device_add_ipconfig( 225 struct connman_ipconfig *connman_device_add_ipconfig(
232 struct connman_device *device, enum connman_ipconfig_type type) 226 struct connman_device *device, enum connman_ipconfig_type type)
233 { 227 {
234 struct connman_ipconfig *ipconfig; 228 struct connman_ipconfig *ipconfig;
235 gchar name[32]; 229 gchar name[32];
236 int ix; 230 int ix;
237 231
238 /* XXX not unique if config's deleted */ 232 /* XXX not unique if config's deleted */
239 ix = ffs(~(device->configmask)); 233 ix = ffs(~(device->configmask));
240 if (ix == 0) { 234 if (ix == 0) {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &str); 407 dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &str);
414 } 408 }
415 409
416 static void append_ipconfig(DBusMessageIter *dict, void *arg) 410 static void append_ipconfig(DBusMessageIter *dict, void *arg)
417 { 411 {
418 struct connman_device *device = arg; 412 struct connman_device *device = arg;
419 413
420 __connman_ipconfig_foreach(device, append_ipconfig_path, dict); 414 __connman_ipconfig_foreach(device, append_ipconfig_path, dict);
421 } 415 }
422 416
423 /*
424 * Determine whether a GTimeVal represents a valid time.
425 * There actually are no invalid values, but we know that
426 * a time of [0, 0] should never occur in the context in which
427 * we are using GTimeVals.
428 */
429 static connman_bool_t __is_valid_time(GTimeVal *timeval)
430 {
431 return timeval->tv_sec != 0 || timeval->tv_usec != 0;
432 }
433
434 static DBusMessage *get_properties(DBusConnection *conn, DBusMessage *msg, 417 static DBusMessage *get_properties(DBusConnection *conn, DBusMessage *msg,
435 void *data) 418 void *data)
436 { 419 {
437 struct connman_device *device = data; 420 struct connman_device *device = data;
438 DBusMessage *reply; 421 DBusMessage *reply;
439 DBusMessageIter array, dict; 422 DBusMessageIter array, dict;
440 const char *str; 423 const char *str;
441 424
442 _DBG_DEVICE("conn %p", conn); 425 _DBG_DEVICE("conn %p", conn);
443 426
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 if (device->cellular.firmware_revision != NULL) 519 if (device->cellular.firmware_revision != NULL)
537 connman_dbus_dict_append_variant( 520 connman_dbus_dict_append_variant(
538 &dict, "Cellular.FirmwareRevision", 521 &dict, "Cellular.FirmwareRevision",
539 DBUS_TYPE_STRING, 522 DBUS_TYPE_STRING,
540 &device->cellular.firmware_revision); 523 &device->cellular.firmware_revision);
541 if (device->cellular.hardware_revision != NULL) 524 if (device->cellular.hardware_revision != NULL)
542 connman_dbus_dict_append_variant( 525 connman_dbus_dict_append_variant(
543 &dict, "Cellular.HardwareRevision", 526 &dict, "Cellular.HardwareRevision",
544 DBUS_TYPE_STRING, 527 DBUS_TYPE_STRING,
545 &device->cellular.hardware_revision); 528 &device->cellular.hardware_revision);
546 if (__is_valid_time(&device->cellular.modem_update_time)) {
547 str = g_time_val_to_iso8601(&device->cellular.modem_upda te_time);
548 if (str != NULL) {
549 connman_dbus_dict_append_variant(
550 &dict,
551 "Cellular.LastDeviceUpdate",
552 DBUS_TYPE_STRING,
553 &str);
554 }
555 }
556 connman_dbus_dict_append_variant( 529 connman_dbus_dict_append_variant(
557 &dict, "Cellular.PRLVersion", 530 &dict, "Cellular.PRLVersion",
558 DBUS_TYPE_UINT16, 531 DBUS_TYPE_UINT16,
559 &device->cellular.prl_version); 532 &device->cellular.prl_version);
560 } 533 }
561 534
562 switch (device->mode) { 535 switch (device->mode) {
563 case CONNMAN_DEVICE_MODE_UNKNOWN: 536 case CONNMAN_DEVICE_MODE_UNKNOWN:
564 case CONNMAN_DEVICE_MODE_TRANSPORT_IP: 537 case CONNMAN_DEVICE_MODE_TRANSPORT_IP:
565 break; 538 break;
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after
2285 g_clear_error(&error); 2258 g_clear_error(&error);
2286 break; 2259 break;
2287 } 2260 }
2288 2261
2289 configs = g_key_file_get_string_list(keyfile, identifier, "IPConfigs", 2262 configs = g_key_file_get_string_list(keyfile, identifier, "IPConfigs",
2290 &nconfigs, &error); 2263 &nconfigs, &error);
2291 if (error == NULL && configs != NULL) 2264 if (error == NULL && configs != NULL)
2292 device_load_ipconfigs(device, nconfigs, configs); 2265 device_load_ipconfigs(device, nconfigs, configs);
2293 g_strfreev(configs); 2266 g_strfreev(configs);
2294 g_clear_error(&error); 2267 g_clear_error(&error);
2295
2296 if (device->type == CONNMAN_DEVICE_TYPE_CELLULAR) {
2297 gchar *str;
2298 str = g_key_file_get_string(keyfile,
2299 identifier,
2300 "Cellular.LastDeviceUpdate", NULL);
2301 if (str != NULL) {
2302 g_time_val_from_iso8601(
2303 str,
2304 &device->cellular.modem_update_time);
2305 g_free(str);
2306 }
2307 }
2308 done: 2268 done:
2309 g_free(identifier); 2269 g_free(identifier);
2310 2270
2311 __connman_storage_close(ident, keyfile, FALSE); 2271 __connman_storage_close(ident, keyfile, FALSE);
2312 2272
2313 return 0; 2273 return 0;
2314 } 2274 }
2315 2275
2316 static int device_save(struct connman_device *device) 2276 static int device_save(struct connman_device *device)
2317 { 2277 {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2356 g_key_file_set_integer(keyfile, identifier, 2316 g_key_file_set_integer(keyfile, identifier,
2357 "BgscanSignalThreshold", device->signal_threshold); 2317 "BgscanSignalThreshold", device->signal_threshold);
2358 break; 2318 break;
2359 } 2319 }
2360 2320
2361 __connman_ipconfig_get_keys(device, 32, paths, &npaths); 2321 __connman_ipconfig_get_keys(device, 32, paths, &npaths);
2362 g_key_file_set_string_list(keyfile, identifier, "IPConfigs", 2322 g_key_file_set_string_list(keyfile, identifier, "IPConfigs",
2363 paths, npaths); 2323 paths, npaths);
2364 for (i = 0; i < npaths; i++) 2324 for (i = 0; i < npaths; i++)
2365 g_free((gpointer)paths[i]); 2325 g_free((gpointer)paths[i]);
2366
2367 if (device->type == CONNMAN_DEVICE_TYPE_CELLULAR) {
2368 if (__is_valid_time(&device->cellular.modem_update_time)) {
2369 gchar *str;
2370 str = g_time_val_to_iso8601(&device->cellular.modem_upda te_time);
2371 if (str != NULL) {
2372 g_key_file_set_string(
2373 keyfile,
2374 identifier,
2375 "Cellular.LastDeviceUpdate",
2376 str);
2377 }
2378 }
2379 }
2380 done: 2326 done:
2381 g_free(identifier); 2327 g_free(identifier);
2382 2328
2383 __connman_storage_close(ident, keyfile, TRUE); 2329 __connman_storage_close(ident, keyfile, TRUE);
2384 2330
2385 return 0; 2331 return 0;
2386 } 2332 }
2387 2333
2388 static struct connman_storage device_storage = { 2334 static struct connman_storage device_storage = {
2389 .name = "device", 2335 .name = "device",
(...skipping 10 matching lines...) Expand all
2400 connman_error("%s: failed to register storage", __func__); 2346 connman_error("%s: failed to register storage", __func__);
2401 return connman_driver_register(&device_driver); 2347 return connman_driver_register(&device_driver);
2402 } 2348 }
2403 2349
2404 void __connman_device_cleanup(void) 2350 void __connman_device_cleanup(void)
2405 { 2351 {
2406 connman_driver_unregister(&device_driver); 2352 connman_driver_unregister(&device_driver);
2407 connman_storage_unregister(&device_storage); 2353 connman_storage_unregister(&device_storage);
2408 dbus_connection_unref(connection); 2354 dbus_connection_unref(connection);
2409 } 2355 }
OLDNEW
« no previous file with comments | « src/connman.h ('k') | src/service.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698