diff --git a/include/dbus.h b/include/dbus.h index 5ca9085f..5bf0505f 100644 --- a/include/dbus.h +++ b/include/dbus.h @@ -39,6 +39,8 @@ extern "C" { #define OFONO_CALL_VOLUME_INTERFACE OFONO_SERVICE ".CallVolume" #define OFONO_CBS_MANAGER_INTERFACE "org.ofono.CbsManager" #define OFONO_MESSAGE_WAITING_INTERFACE "org.ofono.MessageWaiting" +#define OFONO_NETWORK_REGISTRATION_INTERFACE "org.ofono.NetworkRegistration" +#define OFONO_NETWORK_OPERATOR_INTERFACE "org.ofono.NetworkOperator" #define OFONO_PHONEBOOK_INTERFACE "org.ofono.Phonebook" #define OFONO_RADIO_SETTINGS_INTERFACE "org.ofono.RadioSettings" #define OFONO_SIM_MANAGER_INTERFACE "org.ofono.SimManager" diff --git a/src/network.c b/src/network.c index 3da0da44..64178a41 100644 --- a/src/network.c +++ b/src/network.c @@ -37,9 +37,6 @@ #include "util.h" #include "storage.h" -#define NETWORK_REGISTRATION_INTERFACE "org.ofono.NetworkRegistration" -#define NETWORK_OPERATOR_INTERFACE "org.ofono.NetworkOperator" - #define NETWORK_REGISTRATION_FLAG_HOME_SHOW_PLMN 0x1 #define NETWORK_REGISTRATION_FLAG_ROAMING_SHOW_SPN 0x2 @@ -188,9 +185,8 @@ static void set_registration_mode(struct ofono_netreg *netreg, int mode) path = __ofono_atom_get_path(netreg->atom); ofono_dbus_signal_property_changed(conn, path, - NETWORK_REGISTRATION_INTERFACE, - "Mode", DBUS_TYPE_STRING, - &strmode); + OFONO_NETWORK_REGISTRATION_INTERFACE, + "Mode", DBUS_TYPE_STRING, &strmode); } static void register_callback(const struct ofono_error *error, void *data) @@ -366,10 +362,10 @@ static void network_operator_emit_available_operators(struct ofono_netreg *netre network_operator_populate_registered(netreg, &network_operators); ofono_dbus_signal_array_property_changed(conn, path, - NETWORK_REGISTRATION_INTERFACE, - "AvailableOperators", - DBUS_TYPE_OBJECT_PATH, - &network_operators); + OFONO_NETWORK_REGISTRATION_INTERFACE, + "AvailableOperators", + DBUS_TYPE_OBJECT_PATH, + &network_operators); g_strfreev(network_operators); } @@ -394,9 +390,10 @@ static void set_network_operator_status(struct network_operator_data *opd, status_str = network_operator_status_to_string(status); path = network_operator_build_path(netreg, opd->mcc, opd->mnc); - ofono_dbus_signal_property_changed(conn, path, NETWORK_OPERATOR_INTERFACE, - "Status", DBUS_TYPE_STRING, - &status_str); + ofono_dbus_signal_property_changed(conn, path, + OFONO_NETWORK_OPERATOR_INTERFACE, + "Status", DBUS_TYPE_STRING, + &status_str); } static void set_network_operator_techs(struct network_operator_data *opd, @@ -415,10 +412,9 @@ static void set_network_operator_techs(struct network_operator_data *opd, path = network_operator_build_path(netreg, opd->mcc, opd->mnc); ofono_dbus_signal_array_property_changed(conn, path, - NETWORK_REGISTRATION_INTERFACE, - "Technologies", - DBUS_TYPE_STRING, - &technologies); + OFONO_NETWORK_REGISTRATION_INTERFACE, + "Technologies", DBUS_TYPE_STRING, + &technologies); g_strfreev(technologies); } @@ -498,9 +494,9 @@ static void set_network_operator_name(struct network_operator_data *opd, operator = get_operator_display_name(netreg); ofono_dbus_signal_property_changed(conn, path, - NETWORK_REGISTRATION_INTERFACE, - "Operator", DBUS_TYPE_STRING, - &operator); + OFONO_NETWORK_REGISTRATION_INTERFACE, + "Operator", DBUS_TYPE_STRING, + &operator); } /* Don't emit when only operator name is reported */ @@ -509,7 +505,8 @@ static void set_network_operator_name(struct network_operator_data *opd, path = network_operator_build_path(netreg, opd->mcc, opd->mnc); - ofono_dbus_signal_property_changed(conn, path, NETWORK_OPERATOR_INTERFACE, + ofono_dbus_signal_property_changed(conn, path, + OFONO_NETWORK_OPERATOR_INTERFACE, "Name", DBUS_TYPE_STRING, &name); } @@ -543,18 +540,17 @@ static void set_network_operator_eons_info(struct network_operator_data *opd, if (oldname != newname && strcmp(oldname, newname)) { ofono_dbus_signal_property_changed(conn, path, - NETWORK_OPERATOR_INTERFACE, - "Name", DBUS_TYPE_STRING, - &newname); + OFONO_NETWORK_OPERATOR_INTERFACE, + "Name", DBUS_TYPE_STRING, &newname); if (opd == netreg->current_operator) { const char *npath = __ofono_atom_get_path(netreg->atom); const char *operator = get_operator_display_name(netreg); ofono_dbus_signal_property_changed(conn, npath, - NETWORK_REGISTRATION_INTERFACE, - "Operator", DBUS_TYPE_STRING, - &operator); + OFONO_NETWORK_REGISTRATION_INTERFACE, + "Operator", DBUS_TYPE_STRING, + &operator); } } @@ -570,9 +566,9 @@ static void set_network_operator_eons_info(struct network_operator_data *opd, if (oldinfo != newinfo && strcmp(oldinfo, newinfo)) ofono_dbus_signal_property_changed(conn, path, - NETWORK_OPERATOR_INTERFACE, - "AdditionalInformation", - DBUS_TYPE_STRING, &newinfo); + OFONO_NETWORK_OPERATOR_INTERFACE, + "AdditionalInformation", + DBUS_TYPE_STRING, &newinfo); } static DBusMessage *network_operator_get_properties(DBusConnection *conn, @@ -681,7 +677,8 @@ static gboolean network_operator_dbus_register(struct ofono_netreg *netreg, path = network_operator_build_path(netreg, opd->mcc, opd->mnc); - if (!g_dbus_register_interface(conn, path, NETWORK_OPERATOR_INTERFACE, + if (!g_dbus_register_interface(conn, path, + OFONO_NETWORK_OPERATOR_INTERFACE, network_operator_methods, network_operator_signals, NULL, opd, @@ -709,7 +706,7 @@ static gboolean network_operator_dbus_unregister(struct ofono_netreg *netreg, path = network_operator_build_path(netreg, opd->mcc, opd->mnc); return g_dbus_unregister_interface(conn, path, - NETWORK_OPERATOR_INTERFACE); + OFONO_NETWORK_OPERATOR_INTERFACE); } static DBusMessage *network_get_properties(DBusConnection *conn, @@ -868,7 +865,7 @@ static void set_registration_status(struct ofono_netreg *netreg, int status) netreg->status = status; ofono_dbus_signal_property_changed(conn, path, - NETWORK_REGISTRATION_INTERFACE, + OFONO_NETWORK_REGISTRATION_INTERFACE, "Status", DBUS_TYPE_STRING, &str_status); } @@ -888,9 +885,9 @@ static void set_registration_location(struct ofono_netreg *netreg, int lac) return; ofono_dbus_signal_property_changed(conn, path, - NETWORK_REGISTRATION_INTERFACE, - "LocationAreaCode", - DBUS_TYPE_UINT16, &dbus_lac); + OFONO_NETWORK_REGISTRATION_INTERFACE, + "LocationAreaCode", + DBUS_TYPE_UINT16, &dbus_lac); } static void set_registration_cellid(struct ofono_netreg *netreg, int ci) @@ -905,9 +902,8 @@ static void set_registration_cellid(struct ofono_netreg *netreg, int ci) return; ofono_dbus_signal_property_changed(conn, path, - NETWORK_REGISTRATION_INTERFACE, - "CellId", DBUS_TYPE_UINT32, - &dbus_ci); + OFONO_NETWORK_REGISTRATION_INTERFACE, + "CellId", DBUS_TYPE_UINT32, &dbus_ci); } static void set_registration_technology(struct ofono_netreg *netreg, int tech) @@ -922,9 +918,9 @@ static void set_registration_technology(struct ofono_netreg *netreg, int tech) return; ofono_dbus_signal_property_changed(conn, path, - NETWORK_REGISTRATION_INTERFACE, - "Technology", DBUS_TYPE_STRING, - &tech_str); + OFONO_NETWORK_REGISTRATION_INTERFACE, + "Technology", DBUS_TYPE_STRING, + &tech_str); } void __ofono_netreg_set_base_station_name(struct ofono_netreg *netreg, @@ -953,9 +949,9 @@ void __ofono_netreg_set_base_station_name(struct ofono_netreg *netreg, } ofono_dbus_signal_property_changed(conn, path, - NETWORK_REGISTRATION_INTERFACE, - "BaseStation", DBUS_TYPE_STRING, - &base_station); + OFONO_NETWORK_REGISTRATION_INTERFACE, + "BaseStation", DBUS_TYPE_STRING, + &base_station); } unsigned int __ofono_netreg_add_status_watch(struct ofono_netreg *netreg, @@ -1259,7 +1255,7 @@ emit: operator = get_operator_display_name(netreg); ofono_dbus_signal_property_changed(conn, path, - NETWORK_REGISTRATION_INTERFACE, + OFONO_NETWORK_REGISTRATION_INTERFACE, "Operator", DBUS_TYPE_STRING, &operator); @@ -1334,9 +1330,9 @@ void ofono_netreg_strength_notify(struct ofono_netreg *netreg, int strength) dbus_uint16_t strength = netreg->signal_strength; ofono_dbus_signal_property_changed(conn, path, - NETWORK_REGISTRATION_INTERFACE, - "Strength", DBUS_TYPE_UINT16, - &strength); + OFONO_NETWORK_REGISTRATION_INTERFACE, + "Strength", DBUS_TYPE_UINT16, + &strength); } } @@ -1452,9 +1448,9 @@ static void sim_spdi_read_cb(int ok, int length, int record, operator = get_operator_display_name(netreg); ofono_dbus_signal_property_changed(conn, path, - NETWORK_REGISTRATION_INTERFACE, - "Operator", DBUS_TYPE_STRING, - &operator); + OFONO_NETWORK_REGISTRATION_INTERFACE, + "Operator", DBUS_TYPE_STRING, + &operator); } } @@ -1517,9 +1513,9 @@ static void sim_spn_read_cb(int ok, int length, int record, operator = get_operator_display_name(netreg); ofono_dbus_signal_property_changed(conn, path, - NETWORK_REGISTRATION_INTERFACE, - "Operator", DBUS_TYPE_STRING, - &operator); + OFONO_NETWORK_REGISTRATION_INTERFACE, + "Operator", DBUS_TYPE_STRING, + &operator); } } @@ -1634,8 +1630,9 @@ static void netreg_unregister(struct ofono_atom *atom) } g_dbus_unregister_interface(conn, path, - NETWORK_REGISTRATION_INTERFACE); - ofono_modem_remove_interface(modem, NETWORK_REGISTRATION_INTERFACE); + OFONO_NETWORK_REGISTRATION_INTERFACE); + ofono_modem_remove_interface(modem, + OFONO_NETWORK_REGISTRATION_INTERFACE); } static void netreg_remove(struct ofono_atom *atom) @@ -1738,19 +1735,19 @@ void ofono_netreg_register(struct ofono_netreg *netreg) struct ofono_atom *sim_atom; if (!g_dbus_register_interface(conn, path, - NETWORK_REGISTRATION_INTERFACE, + OFONO_NETWORK_REGISTRATION_INTERFACE, network_registration_methods, network_registration_signals, NULL, netreg, NULL)) { ofono_error("Could not create %s interface", - NETWORK_REGISTRATION_INTERFACE); + OFONO_NETWORK_REGISTRATION_INTERFACE); return; } netreg->status_watches = __ofono_watchlist_new(g_free); - ofono_modem_add_interface(modem, NETWORK_REGISTRATION_INTERFACE); + ofono_modem_add_interface(modem, OFONO_NETWORK_REGISTRATION_INTERFACE); if (netreg->driver->registration_status) netreg->driver->registration_status(netreg,