diff options
-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); } |