diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-07-27 16:52:16 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-07-27 16:52:16 -0500 |
commit | cf86deeb828f83d094d10e2dc83b5a66be6d2462 (patch) | |
tree | 6a2acd16e144928c05b96386e776692b81cd6b81 | |
parent | 6f1ab8b6794333673fefc3d52f9b0388526a56cd (diff) | |
download | ofono-cf86deeb828f83d094d10e2dc83b5a66be6d2462.tar.bz2 |
netreg: Add MCC/MNC to NetworkRegistration
These are the same values as on the NetworkOperator interface for the
current operator. Just added for convenience.
-rw-r--r-- | doc/network-api.txt | 12 | ||||
-rw-r--r-- | src/network.c | 32 |
2 files changed, 44 insertions, 0 deletions
diff --git a/doc/network-api.txt b/doc/network-api.txt index ab18fa0b..9e8478c6 100644 --- a/doc/network-api.txt +++ b/doc/network-api.txt @@ -96,6 +96,18 @@ Properties string Mode [readonly] TODO: Agent based location signalling would be better. + string MobileCountryCode [readonly, optional] + + Contains the Mobile Country Code (MCC). This is + repeated here for convenience. It can also be obtained + from the NetworkOperator interface. + + string MobileNetworkCode [readonly, optional] + + Contains the Mobile Network Code (MNC). This is + repeated here for convenience. It can also be obtained + from the NetworkOperator interface. + string Technology [readonly, optional] Contains the technology of the current network. diff --git a/src/network.c b/src/network.c index c6410a8a..9fa9d032 100644 --- a/src/network.c +++ b/src/network.c @@ -776,6 +776,20 @@ static DBusMessage *network_get_properties(DBusConnection *conn, &technology); } + if (netreg->current_operator) { + if (netreg->current_operator->mcc[0] != '\0') { + const char *mcc = netreg->current_operator->mcc; + ofono_dbus_dict_append(&dict, "MobileCountryCode", + DBUS_TYPE_STRING, &mcc); + } + + if (netreg->current_operator->mnc[0] != '\0') { + const char *mnc = netreg->current_operator->mnc; + ofono_dbus_dict_append(&dict, "MobileNetworkCode", + DBUS_TYPE_STRING, &mnc); + } + } + operator = get_operator_display_name(netreg); ofono_dbus_dict_append(&dict, "Name", DBUS_TYPE_STRING, &operator); @@ -1299,6 +1313,24 @@ emit: "Name", DBUS_TYPE_STRING, &operator); + if (netreg->current_operator) { + if (netreg->current_operator->mcc[0] != '\0') { + const char *mcc = netreg->current_operator->mcc; + ofono_dbus_signal_property_changed(conn, path, + OFONO_NETWORK_REGISTRATION_INTERFACE, + "MobileCountryCode", + DBUS_TYPE_STRING, &mcc); + } + + if (netreg->current_operator->mnc[0] != '\0') { + const char *mnc = netreg->current_operator->mnc; + ofono_dbus_signal_property_changed(conn, path, + OFONO_NETWORK_REGISTRATION_INTERFACE, + "MobileNetworkCode", + DBUS_TYPE_STRING, &mnc); + } + } + notify_status_watches(netreg); } |