netreg: Add MCC/MNC to NetworkRegistration

These are the same values as on the NetworkOperator interface for the
current operator.  Just added for convenience.
This commit is contained in:
Denis Kenzior 2010-07-27 16:52:16 -05:00
parent 6f1ab8b679
commit cf86deeb82
2 changed files with 44 additions and 0 deletions

View File

@ -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.

View File

@ -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);
}