From: Daniel Wagner <daniel.wag...@bmw-carit.de> --- doc/dataconnectionmanager-api.txt | 7 ++++++ include/gprs.h | 1 + src/gprs.c | 40 +++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/doc/dataconnectionmanager-api.txt b/doc/dataconnectionmanager-api.txt index 510bd42..cb6b699 100644 --- a/doc/dataconnectionmanager-api.txt +++ b/doc/dataconnectionmanager-api.txt @@ -75,6 +75,13 @@ Properties array{object} PrimaryContexts [readonly] this value to off detaches the modem from the Packet Domain network. + string CurrentTechnology [readonly, optional] + + Contains the current technology used. + + The possible values are: "gsm", "edge", "umts", "hspa", + "lte" + Primary Data Context hierarchy ================= diff --git a/include/gprs.h b/include/gprs.h index a1cbcd9..44ccb09 100644 --- a/include/gprs.h +++ b/include/gprs.h @@ -48,6 +48,7 @@ struct ofono_gprs_driver { }; void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status); +void ofono_gprs_technology_notify(struct ofono_gprs *gprs, int technology); void ofono_gprs_detached_notify(struct ofono_gprs *gprs); int ofono_gprs_driver_register(const struct ofono_gprs_driver *d); diff --git a/src/gprs.c b/src/gprs.c index 11876e2..5feac38 100644 --- a/src/gprs.c +++ b/src/gprs.c @@ -66,6 +66,7 @@ struct ofono_gprs { ofono_bool_t powered; int status; int flags; + int technology; struct idmap *pid_map; unsigned int last_context_id; struct idmap *cid_map; @@ -879,6 +880,8 @@ static void gprs_attached_update(struct ofono_gprs *gprs) "Active", DBUS_TYPE_BOOLEAN, &value); } + + gprs->technology = -1; } path = __ofono_atom_get_path(gprs->atom); @@ -1007,6 +1010,14 @@ static DBusMessage *gprs_get_properties(DBusConnection *conn, value = gprs->powered; ofono_dbus_dict_append(&dict, "Powered", DBUS_TYPE_BOOLEAN, &value); + if (gprs->technology != -1) { + const char *technology = + registration_tech_to_string(gprs->technology); + + ofono_dbus_dict_append(&dict, "CurrentTechnology", + DBUS_TYPE_STRING, &technology); + } + dbus_message_iter_close_container(&iter, &dict); return reply; @@ -1302,6 +1313,24 @@ static GDBusSignalTable manager_signals[] = { { } }; +static void set_gprs_technology(struct ofono_gprs *gprs, int technology) +{ + const char *str_technology = + registration_tech_to_string(technology); + const char *path = __ofono_atom_get_path(gprs->atom); + DBusConnection *conn = ofono_dbus_get_connection(); + + gprs->technology = technology; + + if (gprs->technology == -1) + return; + + ofono_dbus_signal_property_changed(conn, path, + OFONO_DATA_CONNECTION_MANAGER_INTERFACE, + "CurrentTechnology", DBUS_TYPE_STRING, + &str_technology); +} + void ofono_gprs_detached_notify(struct ofono_gprs *gprs) { if (gprs->driver_attached == FALSE) @@ -1326,6 +1355,16 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status) gprs_attached_update(gprs); } +void ofono_gprs_technology_notify(struct ofono_gprs *gprs, int technology) +{ + /* If we are not attached, ignore */ + if (gprs->attached == FALSE) + return; + + if (gprs->technology != technology) + set_gprs_technology(gprs, technology); +} + void ofono_gprs_set_cid_range(struct ofono_gprs *gprs, unsigned int min, unsigned int max) { @@ -1602,6 +1641,7 @@ struct ofono_gprs *ofono_gprs_create(struct ofono_modem *modem, gprs->status = NETWORK_REGISTRATION_STATUS_UNKNOWN; gprs->netreg_status = NETWORK_REGISTRATION_STATUS_UNKNOWN; gprs->pid_map = idmap_new(MAX_CONTEXTS); + gprs->technology = -1; return gprs; } -- 1.6.6.1 _______________________________________________ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono