diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-11-04 11:43:57 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-11-04 11:43:57 -0600 |
commit | 24a7d9a67394bb1c7d1438fd9b9011321f072605 (patch) | |
tree | 07b2f7c0c6002c6bebe513afedbcc88532a19a25 /src/network.c | |
parent | c63a0413cdc8f670818093b77da694d44dea29f7 (diff) | |
download | ofono-24a7d9a67394bb1c7d1438fd9b9011321f072605.tar.bz2 |
Fix: Handle the case where only PLMN name is given
HFP does not allow the use of register / unregister or scan for operator
functionality. It only allows the name of the operator to be given, not
even an MCC/MNC. Handle this situation inside netreg atom.
Diffstat (limited to 'src/network.c')
-rw-r--r-- | src/network.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/network.c b/src/network.c index e4f81a1e..87d5d586 100644 --- a/src/network.c +++ b/src/network.c @@ -386,6 +386,10 @@ static void set_network_operator_status(struct network_operator_data *opd, opd->status = status; + /* Don't emit for the case where only operator name is reported */ + if (opd->mcc[0] == '\0' && opd->mnc[0] == '\0') + return; + status_str = network_operator_status_to_string(status); path = network_operator_build_path(netreg, opd->mcc, opd->mnc); @@ -487,11 +491,6 @@ static void set_network_operator_name(struct network_operator_data *opd, if (opd->eons_info && opd->eons_info->longname) return; - path = network_operator_build_path(netreg, opd->mcc, opd->mnc); - - ofono_dbus_signal_property_changed(conn, path, NETWORK_OPERATOR_INTERFACE, - "Name", DBUS_TYPE_STRING, &name); - if (opd == netreg->current_operator) { const char *path = __ofono_atom_get_path(netreg->atom); @@ -502,6 +501,15 @@ static void set_network_operator_name(struct network_operator_data *opd, "Operator", DBUS_TYPE_STRING, &operator); } + + /* Don't emit when only operator name is reported */ + if (opd->mcc[0] == '\0' && opd->mnc[0] == '\0') + return; + + path = network_operator_build_path(netreg, opd->mcc, opd->mnc); + + ofono_dbus_signal_property_changed(conn, path, NETWORK_OPERATOR_INTERFACE, + "Name", DBUS_TYPE_STRING, &name); } static void set_network_operator_eons_info(struct network_operator_data *opd, @@ -1213,7 +1221,8 @@ static void current_operator_callback(const struct ofono_error *error, opd = network_operator_create(current); - if (!network_operator_dbus_register(netreg, opd)) { + if (opd->mcc[0] != '\0' && opd->mnc[0] != '\0' && + !network_operator_dbus_register(netreg, opd)) { g_free(opd); return; } @@ -1222,7 +1231,8 @@ static void current_operator_callback(const struct ofono_error *error, netreg->operator_list = g_slist_append(netreg->operator_list, opd); - network_operator_emit_available_operators(netreg); + if (opd->mcc[0] != '\0' && opd->mnc[0] != '\0') + network_operator_emit_available_operators(netreg); } else { /* We don't free this here because operator is registered */ /* Taken care of elsewhere */ |