diff options
author | Denis Kenzior <denkenz@gmail.com> | 2011-11-04 15:13:24 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-11-04 15:13:24 -0500 |
commit | 42eabb6cc808b33fc36cc649e3bfe71845b908e8 (patch) | |
tree | d20c3e09625553c038663a334cd9096966fccb9d /src/cdma-connman.c | |
parent | 092acfde67ba725193b8391cd850774a8b77eeb9 (diff) | |
download | ofono-42eabb6cc808b33fc36cc649e3bfe71845b908e8.tar.bz2 |
cdma-connman: Refactor previous commit
Diffstat (limited to 'src/cdma-connman.c')
-rw-r--r-- | src/cdma-connman.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/cdma-connman.c b/src/cdma-connman.c index 518fcb5f..5b86fb9e 100644 --- a/src/cdma-connman.c +++ b/src/cdma-connman.c @@ -338,10 +338,9 @@ static void cdma_connman_settings_append_properties( dbus_message_iter_close_container(dict, &entry); } -static ofono_bool_t cdma_connman_netreg_is_registered(struct ofono_cdma_connman *cm) +static ofono_bool_t network_registered(struct ofono_cdma_connman *cm) { int status; - ofono_bool_t registered; struct ofono_modem *modem = __ofono_atom_get_modem(cm->atom); struct ofono_atom *atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_CDMA_NETREG); @@ -351,11 +350,17 @@ static ofono_bool_t cdma_connman_netreg_is_registered(struct ofono_cdma_connman return FALSE; cdma_netreg = __ofono_atom_get_data(atom); - status = ofono_cdma_netreg_get_status(cdma_netreg); + status = ofono_cdma_netreg_get_status(cdma_netreg); - registered = status == NETWORK_REGISTRATION_STATUS_REGISTERED; + switch (status) { + case NETWORK_REGISTRATION_STATUS_REGISTERED: + case NETWORK_REGISTRATION_STATUS_ROAMING: + return TRUE; + default: + break; + } - return registered; + return FALSE; } static DBusMessage *cdma_connman_get_properties(DBusConnection *conn, @@ -483,7 +488,7 @@ static DBusMessage *cdma_connman_set_property(DBusConnection *conn, cm->driver->deactivate == NULL) return __ofono_error_not_implemented(msg); - if (cdma_connman_netreg_is_registered(cm) == FALSE) + if (network_registered(cm) == FALSE) return __ofono_error_not_registered(msg); cm->pending = dbus_message_ref(msg); |