mirror of git://git.sysmocom.de/ofono
Refactor: Remove MobileNetworkCodeLength property
Replaced by MNC/MCC properties which is more intuitive for use by external applications.
This commit is contained in:
parent
1e33e5339d
commit
9390dbaf31
|
@ -49,9 +49,21 @@ Properties string SubscriberIdentity [readonly, optional]
|
|||
|
||||
Contains the ISMI of the SIM, if available
|
||||
|
||||
uint8 MobileNetworkCodeLength [readonly, optional]
|
||||
uint16 MobileCountryCode [readonly, optional]
|
||||
|
||||
Contains the length of the MNC (2 or 3 digits)
|
||||
Contains the Mobile Country Code (MCC) of the home
|
||||
network (not to be confused with the currently
|
||||
registered network reported on NetworkRegistration
|
||||
interface) and is read directly from the SIM if
|
||||
available.
|
||||
|
||||
uint16 MobileNetworkCode [readonly, optional]
|
||||
|
||||
Contains the Mobile Network Code (MNC) of the home
|
||||
network (not to be confused with the currently
|
||||
registered network reported on NetworkRegistration
|
||||
interface) and is read directly from the SIM if
|
||||
available.
|
||||
|
||||
array{string} SubscriberNumbers [readwrite]
|
||||
|
||||
|
|
42
src/sim.c
42
src/sim.c
|
@ -286,9 +286,24 @@ static DBusMessage *sim_get_properties(DBusConnection *conn,
|
|||
ofono_dbus_dict_append(&dict, "SubscriberIdentity",
|
||||
DBUS_TYPE_STRING, &sim->imsi);
|
||||
|
||||
if (sim->mnc_length)
|
||||
ofono_dbus_dict_append(&dict, "MobileNetworkCodeLength",
|
||||
DBUS_TYPE_BYTE, &sim->mnc_length);
|
||||
if (sim->mnc_length) {
|
||||
char mcc[OFONO_MAX_MCC_LENGTH + 1];
|
||||
char mnc[OFONO_MAX_MNC_LENGTH + 1];
|
||||
const char *str;
|
||||
|
||||
strncpy(mcc, sim->imsi, OFONO_MAX_MCC_LENGTH);
|
||||
mcc[OFONO_MAX_MCC_LENGTH] = '\0';
|
||||
strncpy(mnc, sim->imsi + OFONO_MAX_MCC_LENGTH, sim->mnc_length);
|
||||
mnc[sim->mnc_length] = '\0';
|
||||
|
||||
str = mcc;
|
||||
ofono_dbus_dict_append(&dict, "MobileCountryCode",
|
||||
DBUS_TYPE_STRING, &str);
|
||||
|
||||
str = mnc;
|
||||
ofono_dbus_dict_append(&dict, "MobileNetworkCode",
|
||||
DBUS_TYPE_STRING, &str);
|
||||
}
|
||||
|
||||
own_numbers = get_own_numbers(sim->own_numbers);
|
||||
|
||||
|
@ -832,6 +847,9 @@ static void sim_ad_read_cb(int ok, int length, int record,
|
|||
DBusConnection *conn = ofono_dbus_get_connection();
|
||||
const char *path = __ofono_atom_get_path(sim->atom);
|
||||
int new_mnc_length;
|
||||
char mcc[OFONO_MAX_MCC_LENGTH + 1];
|
||||
char mnc[OFONO_MAX_MNC_LENGTH + 1];
|
||||
const char *str;
|
||||
|
||||
if (!ok)
|
||||
return;
|
||||
|
@ -846,10 +864,22 @@ static void sim_ad_read_cb(int ok, int length, int record,
|
|||
|
||||
sim->mnc_length = new_mnc_length;
|
||||
|
||||
strncpy(mcc, sim->imsi, OFONO_MAX_MCC_LENGTH);
|
||||
mcc[OFONO_MAX_MCC_LENGTH] = '\0';
|
||||
strncpy(mnc, sim->imsi + OFONO_MAX_MCC_LENGTH, sim->mnc_length);
|
||||
mnc[sim->mnc_length] = '\0';
|
||||
|
||||
str = mcc;
|
||||
ofono_dbus_signal_property_changed(conn, path,
|
||||
OFONO_SIM_MANAGER_INTERFACE,
|
||||
"MobileNetworkCodeLength",
|
||||
DBUS_TYPE_BYTE, &sim->mnc_length);
|
||||
OFONO_SIM_MANAGER_INTERFACE,
|
||||
"MobileCountryCode",
|
||||
DBUS_TYPE_STRING, &str);
|
||||
|
||||
str = mnc;
|
||||
ofono_dbus_signal_property_changed(conn, path,
|
||||
OFONO_SIM_MANAGER_INTERFACE,
|
||||
"MobileNetworkCode",
|
||||
DBUS_TYPE_STRING, &str);
|
||||
}
|
||||
|
||||
static gint service_number_compare(gconstpointer a, gconstpointer b)
|
||||
|
|
Loading…
Reference in New Issue