| OLD | NEW | 
|     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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   383         case CONNMAN_NETWORK_ACTIVATION_STATE_ACTIVATING: |   383         case CONNMAN_NETWORK_ACTIVATION_STATE_ACTIVATING: | 
|   384                 return "activating"; |   384                 return "activating"; | 
|   385         case CONNMAN_NETWORK_ACTIVATION_STATE_NOT_ACTIVATED: |   385         case CONNMAN_NETWORK_ACTIVATION_STATE_NOT_ACTIVATED: | 
|   386                 return "not-activated"; |   386                 return "not-activated"; | 
|   387         case CONNMAN_NETWORK_ACTIVATION_STATE_PARTIALLY_ACTIVATED: |   387         case CONNMAN_NETWORK_ACTIVATION_STATE_PARTIALLY_ACTIVATED: | 
|   388                 return "partially-activated"; |   388                 return "partially-activated"; | 
|   389         } |   389         } | 
|   390         return NULL; |   390         return NULL; | 
|   391 } |   391 } | 
|   392  |   392  | 
|   393 static enum connman_network_activation_state string2activation_state( |  | 
|   394                 const char *state) |  | 
|   395 { |  | 
|   396         if (g_strcmp0(state, "unknown") == 0) |  | 
|   397                 return CONNMAN_NETWORK_ACTIVATION_STATE_UNKNOWN; |  | 
|   398         else if (g_strcmp0(state, "activated") == 0) |  | 
|   399                 return CONNMAN_NETWORK_ACTIVATION_STATE_ACTIVATED; |  | 
|   400         else if (g_strcmp0(state, "activating") == 0) |  | 
|   401                 return CONNMAN_NETWORK_ACTIVATION_STATE_ACTIVATING; |  | 
|   402         else if (g_strcmp0(state, "not-activated") == 0) |  | 
|   403                 return CONNMAN_NETWORK_ACTIVATION_STATE_NOT_ACTIVATED; |  | 
|   404         else if (g_strcmp0(state, "partially-activated") == 0) |  | 
|   405                 return CONNMAN_NETWORK_ACTIVATION_STATE_PARTIALLY_ACTIVATED; |  | 
|   406         return CONNMAN_NETWORK_ACTIVATION_STATE_UNKNOWN; |  | 
|   407 } |  | 
|   408  |  | 
|   409 static const char *network_technology2string( |   393 static const char *network_technology2string( | 
|   410         enum connman_network_cellular_technology technology) |   394         enum connman_network_cellular_technology technology) | 
|   411 { |   395 { | 
|   412         switch (technology) { |   396         switch (technology) { | 
|   413         case CONNMAN_NETWORK_TECHNOLOGY_1XRTT: |   397         case CONNMAN_NETWORK_TECHNOLOGY_1XRTT: | 
|   414                 return "1xRTT"; |   398                 return "1xRTT"; | 
|   415         case CONNMAN_NETWORK_TECHNOLOGY_EVDO: |   399         case CONNMAN_NETWORK_TECHNOLOGY_EVDO: | 
|   416                 return "EVDO"; |   400                 return "EVDO"; | 
 |   401         case CONNMAN_NETWORK_TECHNOLOGY_GSM: | 
 |   402                 return "GSM"; | 
|   417         case CONNMAN_NETWORK_TECHNOLOGY_GPRS: |   403         case CONNMAN_NETWORK_TECHNOLOGY_GPRS: | 
|   418                 return "GPRS"; |   404                 return "GPRS"; | 
|   419         case CONNMAN_NETWORK_TECHNOLOGY_EDGE: |   405         case CONNMAN_NETWORK_TECHNOLOGY_EDGE: | 
|   420                 return "EDGE"; |   406                 return "EDGE"; | 
|   421         case CONNMAN_NETWORK_TECHNOLOGY_UMTS: |   407         case CONNMAN_NETWORK_TECHNOLOGY_UMTS: | 
|   422                 return "UMTS"; |   408                 return "UMTS"; | 
|   423         case CONNMAN_NETWORK_TECHNOLOGY_HSPA: |   409         case CONNMAN_NETWORK_TECHNOLOGY_HSPA: | 
|   424                 return "HSPA"; |   410                 return "HSPA"; | 
|   425         case CONNMAN_NETWORK_TECHNOLOGY_HSPA_PLUS: |   411         case CONNMAN_NETWORK_TECHNOLOGY_HSPA_PLUS: | 
|   426                 return "HSPA+"; |   412                 return "HSPA+"; | 
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1557  * @service: service structure |  1543  * @service: service structure | 
|  1558  * @activation state: control interface |  1544  * @activation state: control interface | 
|  1559  * @err: if the activation failed a reason for the failure |  1545  * @err: if the activation failed a reason for the failure | 
|  1560  * |  1546  * | 
|  1561  * Set the activation state of the network |  1547  * Set the activation state of the network | 
|  1562  */ |  1548  */ | 
|  1563 void __connman_service_set_activation_state(struct connman_service *service, |  1549 void __connman_service_set_activation_state(struct connman_service *service, | 
|  1564         enum connman_network_activation_state activation_state, |  1550         enum connman_network_activation_state activation_state, | 
|  1565         enum connman_element_error err) |  1551         enum connman_element_error err) | 
|  1566 { |  1552 { | 
|  1567         struct connman_device *device; |  | 
|  1568  |  | 
|  1569         const char *state = activation_state2string(activation_state); |  1553         const char *state = activation_state2string(activation_state); | 
|  1570  |  1554  | 
|  1571         if (err != CONNMAN_ELEMENT_ERROR_UNKNOWN) { |  1555         if (err != CONNMAN_ELEMENT_ERROR_UNKNOWN) { | 
|  1572                 service->error = __connman_element_convert_error(err); |  1556                 service->error = __connman_element_convert_error(err); | 
|  1573                 __connman_service_indicate_state( |  1557                 __connman_service_indicate_state( | 
|  1574                                 service, |  1558                                 service, | 
|  1575                                 CONNMAN_SERVICE_STATE_ACTIVATION_FAILURE); |  1559                                 CONNMAN_SERVICE_STATE_ACTIVATION_FAILURE); | 
|  1576         } |  1560         } | 
|  1577  |  1561  | 
|  1578 »       if (service->cellular.activation_state != activation_state) { |  1562 »       service->cellular.activation_state = activation_state; | 
|  1579 »       »       service->cellular.activation_state = activation_state; |  | 
|  1580 »       »       if (activation_state == CONNMAN_NETWORK_ACTIVATION_STATE_ACTIVAT
      ED) { |  | 
|  1581 »       »       »       device = connman_service_get_device(service); |  | 
|  1582 »       »       »       if (device != NULL) |  | 
|  1583 »       »       »       »       __connman_device_set_modem_update_time(device); |  | 
|  1584 »       »       } |  | 
|  1585 »       »       __connman_storage_save_service(service); |  | 
|  1586 »       } |  | 
|  1587  |  | 
|  1588         /* NB: connman_dbus_send_property_changed logs msg on failure */ |  1563         /* NB: connman_dbus_send_property_changed logs msg on failure */ | 
|  1589         (void) connman_dbus_send_property_changed_variant(service->path, |  1564         (void) connman_dbus_send_property_changed_variant(service->path, | 
|  1590                 CONNMAN_SERVICE_INTERFACE, "Cellular.ActivationState", |  1565                 CONNMAN_SERVICE_INTERFACE, "Cellular.ActivationState", | 
|  1591                 DBUS_TYPE_STRING, &state); |  1566                 DBUS_TYPE_STRING, &state); | 
|  1592 } |  1567 } | 
|  1593  |  1568  | 
|  1594 /** |  1569 /** | 
|  1595  * __connman_service_set_operator_info: |  1570  * __connman_service_set_operator_info: | 
|  1596  * @service: service structure |  1571  * @service: service structure | 
|  1597  * @name: operator name |  1572  * @name: operator name | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1666  * @network_technology: e.g., GPRS, EDGE, HSPA, 1xRTT, EVDO, etc. |  1641  * @network_technology: e.g., GPRS, EDGE, HSPA, 1xRTT, EVDO, etc. | 
|  1667  * @roaming_state: e.g., Home, Roaming |  1642  * @roaming_state: e.g., Home, Roaming | 
|  1668  * |  1643  * | 
|  1669  * Set network technology and roaming status information for the service. |  1644  * Set network technology and roaming status information for the service. | 
|  1670  */ |  1645  */ | 
|  1671 void __connman_service_set_registration_info( |  1646 void __connman_service_set_registration_info( | 
|  1672                 struct connman_service *service, |  1647                 struct connman_service *service, | 
|  1673                 enum connman_network_cellular_technology network_technology, |  1648                 enum connman_network_cellular_technology network_technology, | 
|  1674                 enum connman_network_cellular_roaming_state roaming_state) |  1649                 enum connman_network_cellular_roaming_state roaming_state) | 
|  1675 { |  1650 { | 
|  1676 »       enum connman_network_cellular_technology otech = |  1651 »       const char *tech_str; | 
|  1677 »       »       »       service->cellular.network_technology; |  1652 »       const char *roam_str; | 
|  1678 »       enum connman_network_cellular_roaming_state oroam = |  | 
|  1679 »       »       »       service->cellular.roaming_state; |  | 
|  1680 »       const char *tech_str = network_technology2string(network_technology); |  | 
|  1681 »       const char *roam_str = roaming_state2string(roaming_state); |  | 
|  1682  |  1653  | 
|  1683 »       service->cellular.network_technology = network_technology; |  1654 »       if (network_technology != CONNMAN_NETWORK_TECHNOLOGY_UNKNOWN) { | 
|  1684 »       service->cellular.roaming_state = roaming_state; |  1655 »       »       tech_str = network_technology2string(network_technology); | 
|  1685 »       if (otech != network_technology && tech_str != NULL) { |  1656 »       »       if (service->cellular.network_technology != network_technology &
      & | 
|  1686 »       »       (void) connman_dbus_send_property_changed_variant( |  1657 »       »           tech_str != NULL) { | 
|  1687 »       »       »       »       service->path, |  1658 »       »       »       (void) connman_dbus_send_property_changed_variant( | 
|  1688 »       »       »       »       CONNMAN_SERVICE_INTERFACE, |  1659 »       »       »       »       »       service->path, | 
|  1689 »       »       »       »       "Cellular.NetworkTechnology", |  1660 »       »       »       »       »       CONNMAN_SERVICE_INTERFACE, | 
|  1690 »       »       »       »       DBUS_TYPE_STRING, &tech_str); |  1661 »       »       »       »       »       "Cellular.NetworkTechnology", | 
 |  1662 »       »       »       »       »       DBUS_TYPE_STRING, &tech_str); | 
 |  1663 »       »       } | 
 |  1664 »       »       service->cellular.network_technology = network_technology; | 
|  1691         } |  1665         } | 
|  1692 »       if (oroam != roaming_state && roam_str != NULL) { |  1666 »       if (roaming_state != CONNMAN_NETWORK_ROAMING_STATE_UNKNOWN) { | 
|  1693 »       »       (void) connman_dbus_send_property_changed_variant( |  1667 »       »       roam_str = roaming_state2string(roaming_state); | 
|  1694 »       »       »       »       service->path, |  1668 »       »       if (service->cellular.roaming_state != roaming_state && | 
|  1695 »       »       »       »       CONNMAN_SERVICE_INTERFACE, |  1669 »       »           roam_str != NULL) { | 
|  1696 »       »       »       »       "Cellular.RoamingState", |  1670 »       »       »       (void) connman_dbus_send_property_changed_variant( | 
|  1697 »       »       »       »       DBUS_TYPE_STRING, &roam_str); |  1671 »       »       »       »       »       service->path, | 
 |  1672 »       »       »       »       »       CONNMAN_SERVICE_INTERFACE, | 
 |  1673 »       »       »       »       »       "Cellular.RoamingState", | 
 |  1674 »       »       »       »       »       DBUS_TYPE_STRING, &roam_str); | 
 |  1675 »       »       } | 
 |  1676 »       »       service->cellular.roaming_state = roaming_state; | 
|  1698         } |  1677         } | 
|  1699 } |  1678 } | 
|  1700  |  1679  | 
|  1701 void connman_service_set_connectivity_state(struct connman_service *service, |  1680 void connman_service_set_connectivity_state(struct connman_service *service, | 
|  1702       enum connman_service_connectivity_state connectivity) |  1681       enum connman_service_connectivity_state connectivity) | 
|  1703 { |  1682 { | 
|  1704         enum connman_service_connectivity_state |  1683         enum connman_service_connectivity_state | 
|  1705                 oconnectivity = service->connectivity_state; |  1684                 oconnectivity = service->connectivity_state; | 
|  1706         const char *state_str = connectivity_state2string(connectivity); |  1685         const char *state_str = connectivity_state2string(connectivity); | 
|  1707  |  1686  | 
| (...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3802  |  3781  | 
|  3803         case CONNMAN_SERVICE_TYPE_CELLULAR: |  3782         case CONNMAN_SERVICE_TYPE_CELLULAR: | 
|  3804                 service->favorite = g_key_file_get_boolean(keyfile, |  3783                 service->favorite = g_key_file_get_boolean(keyfile, | 
|  3805                                 service->identifier, "Favorite", NULL); |  3784                                 service->identifier, "Favorite", NULL); | 
|  3806  |  3785  | 
|  3807                 autoconnect = g_key_file_get_boolean(keyfile, |  3786                 autoconnect = g_key_file_get_boolean(keyfile, | 
|  3808                                 service->identifier, "AutoConnect", &error); |  3787                                 service->identifier, "AutoConnect", &error); | 
|  3809                 if (error == NULL) |  3788                 if (error == NULL) | 
|  3810                         service->autoconnect = autoconnect; |  3789                         service->autoconnect = autoconnect; | 
|  3811                 g_clear_error(&error); |  3790                 g_clear_error(&error); | 
|  3812                 str = g_key_file_get_string(keyfile, |  | 
|  3813                                             service->identifier, |  | 
|  3814                                             "Cellular.ActivationState", NULL); |  | 
|  3815                 if (str != NULL) { |  | 
|  3816                         service->cellular.activation_state = |  | 
|  3817                                         string2activation_state(str); |  | 
|  3818                 } |  | 
|  3819                 break; |  3791                 break; | 
|  3820         default: |  3792         default: | 
|  3821                 break; |  3793                 break; | 
|  3822         } |  3794         } | 
|  3823  |  3795  | 
|  3824         str = g_key_file_get_string(keyfile, |  3796         str = g_key_file_get_string(keyfile, | 
|  3825                                 service->identifier, "Modified", NULL); |  3797                                 service->identifier, "Modified", NULL); | 
|  3826         if (str != NULL) { |  3798         if (str != NULL) { | 
|  3827                 g_time_val_from_iso8601(str, &service->modified); |  3799                 g_time_val_from_iso8601(str, &service->modified); | 
|  3828                 g_free(str); |  3800                 g_free(str); | 
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3959                                                         "Failure", NULL); |  3931                                                         "Failure", NULL); | 
|  3960                 } |  3932                 } | 
|  3961                 /* fall through */ |  3933                 /* fall through */ | 
|  3962         case CONNMAN_SERVICE_TYPE_CELLULAR: |  3934         case CONNMAN_SERVICE_TYPE_CELLULAR: | 
|  3963                 g_key_file_set_boolean(keyfile, service->identifier, |  3935                 g_key_file_set_boolean(keyfile, service->identifier, | 
|  3964                                         "Favorite", service->favorite); |  3936                                         "Favorite", service->favorite); | 
|  3965  |  3937  | 
|  3966                 if (service->favorite == TRUE) |  3938                 if (service->favorite == TRUE) | 
|  3967                         g_key_file_set_boolean(keyfile, service->identifier, |  3939                         g_key_file_set_boolean(keyfile, service->identifier, | 
|  3968                                         "AutoConnect", service->autoconnect); |  3940                                         "AutoConnect", service->autoconnect); | 
|  3969                 if (service->cellular.activation_state != |  | 
|  3970                     CONNMAN_NETWORK_ACTIVATION_STATE_UNKNOWN) |  | 
|  3971                         g_key_file_set_string( |  | 
|  3972                                 keyfile, |  | 
|  3973                                 service->identifier, |  | 
|  3974                                 "Cellular.ActivationState", |  | 
|  3975                                 activation_state2string( |  | 
|  3976                                         service->cellular.activation_state)); |  | 
|  3977                 break; |  3941                 break; | 
|  3978         default: |  3942         default: | 
|  3979                 break; |  3943                 break; | 
|  3980         } |  3944         } | 
|  3981  |  3945  | 
|  3982         str = g_time_val_to_iso8601(&service->modified); |  3946         str = g_time_val_to_iso8601(&service->modified); | 
|  3983         if (str != NULL) { |  3947         if (str != NULL) { | 
|  3984                 g_key_file_set_string(keyfile, service->identifier, |  3948                 g_key_file_set_string(keyfile, service->identifier, | 
|  3985                                                         "Modified", str); |  3949                                                         "Modified", str); | 
|  3986                 g_free(str); |  3950                 g_free(str); | 
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4089         service_list = NULL; |  4053         service_list = NULL; | 
|  4090  |  4054  | 
|  4091         g_hash_table_destroy(service_hash); |  4055         g_hash_table_destroy(service_hash); | 
|  4092         service_hash = NULL; |  4056         service_hash = NULL; | 
|  4093  |  4057  | 
|  4094         connman_storage_unregister(&service_storage); |  4058         connman_storage_unregister(&service_storage); | 
|  4095         connman_notifier_unregister(&service_notifier); |  4059         connman_notifier_unregister(&service_notifier); | 
|  4096  |  4060  | 
|  4097         dbus_connection_unref(connection); |  4061         dbus_connection_unref(connection); | 
|  4098 } |  4062 } | 
| OLD | NEW |