mirror of git://git.sysmocom.de/ofono
src: Implement RAT list property
This commit is contained in:
parent
e6048f1dc1
commit
5210b85c22
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue