summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlfonso Sanchez-Beato <alfonso.sanchez-beato@canonical.com>2014-12-09 13:34:38 +0100
committerDenis Kenzior <denkenz@gmail.com>2014-12-10 11:03:16 -0600
commit5210b85c221121a0153286ed08c355a1d3c9b328 (patch)
treee071c0591c16f04e486b0dae58e2dccc6102bb27 /src
parente6048f1dc16ae609b1b74cceafaa5b537f19119b (diff)
downloadofono-5210b85c221121a0153286ed08c355a1d3c9b328.tar.bz2
src: Implement RAT list property
Diffstat (limited to 'src')
-rw-r--r--src/radio-settings.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/radio-settings.c b/src/radio-settings.c
index d1b1cc1c..5d166cc9 100644
--- a/src/radio-settings.c
+++ b/src/radio-settings.c
@@ -26,6 +26,7 @@
#include <string.h>
#include <stdio.h>
#include <errno.h>
+#include <stdint.h>
#include <glib.h>
#include <gdbus.h>
@@ -48,6 +49,7 @@ struct ofono_radio_settings {
enum ofono_radio_band_gsm pending_band_gsm;
enum ofono_radio_band_umts pending_band_umts;
ofono_bool_t fast_dormancy_pending;
+ uint32_t available_rats;
const struct ofono_radio_settings_driver *driver;
void *driver_data;
struct ofono_atom *atom;
@@ -222,6 +224,23 @@ static DBusMessage *radio_get_properties_reply(DBusMessage *msg,
DBUS_TYPE_BOOLEAN, &value);
}
+ if (rs->available_rats) {
+ const char *rats_strs[OFONO_RADIO_ACCESS_MODE_LTE + 1];
+ const char **strs = rats_strs;
+ int str_i = 0;
+ size_t i, techs = sizeof(rats_strs)/sizeof(rats_strs[0]) - 1;
+
+ for (i = 0; i < techs; ++i)
+ if (rs->available_rats & (1 << i))
+ rats_strs[str_i++] =
+ radio_access_mode_to_string(i + 1);
+
+ rats_strs[str_i] = NULL;
+
+ ofono_dbus_dict_append_array(&dict, "AvailableTechnologies",
+ DBUS_TYPE_STRING, &strs);
+ }
+
dbus_message_iter_close_container(&iter, &dict);
return reply;
@@ -374,6 +393,32 @@ static void radio_send_properties_reply(struct ofono_radio_settings *rs)
__ofono_dbus_pending_reply(&rs->pending, reply);
}
+static void radio_available_rats_query_callback(const struct ofono_error *error,
+ unsigned int available_rats,
+ void *data)
+{
+ struct ofono_radio_settings *rs = data;
+
+ if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
+ rs->available_rats = available_rats;
+ else
+ DBG("Error while querying available rats");
+
+ radio_send_properties_reply(rs);
+}
+
+static void radio_query_available_rats(struct ofono_radio_settings *rs)
+{
+ /* Modem technology is not supposed to change, so one query is enough */
+ if (rs->driver->query_available_rats == NULL || rs->available_rats) {
+ radio_send_properties_reply(rs);
+ return;
+ }
+
+ rs->driver->query_available_rats(
+ rs, radio_available_rats_query_callback, rs);
+}
+
static void radio_fast_dormancy_query_callback(const struct ofono_error *error,
ofono_bool_t enable, void *data)
{
@@ -390,7 +435,7 @@ static void radio_fast_dormancy_query_callback(const struct ofono_error *error,
}
radio_set_fast_dormancy(rs, enable);
- radio_send_properties_reply(rs);
+ radio_query_available_rats(rs);
}
static void radio_query_fast_dormancy(struct ofono_radio_settings *rs)