* [PATCH 1/4] doc: Add AvailableTechnologies property
2014-12-09 12:34 [PATCH 0/4] Add AvailableTechnologies property to RadioSettings Alfonso Sanchez-Beato
@ 2014-12-09 12:34 ` Alfonso Sanchez-Beato
2014-12-09 12:34 ` [PATCH 2/4] include: Add method to list RATs to radio-settings Alfonso Sanchez-Beato
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Alfonso Sanchez-Beato @ 2014-12-09 12:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 804 bytes --]
This new property in org.ofono.RadioSettings interface will hold the
possible values for radio access technology for the modem.
---
doc/radio-settings-api.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/doc/radio-settings-api.txt b/doc/radio-settings-api.txt
index 9f9256f..03868a9 100644
--- a/doc/radio-settings-api.txt
+++ b/doc/radio-settings-api.txt
@@ -45,6 +45,11 @@ Properties string TechnologyPreference [readwrite]
"umts" Only UMTS used for radio access.
"lte" Only LTE used for radio access.
+ array{string} AvailableTechnologies [readonly, optional]
+
+ List of values for TechnologyPreference property
+ supported by the modem.
+
string GsmBand [readwrite, optional]
Frequency band in which the modem is allowed to
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/4] include: Add method to list RATs to radio-settings
2014-12-09 12:34 [PATCH 0/4] Add AvailableTechnologies property to RadioSettings Alfonso Sanchez-Beato
2014-12-09 12:34 ` [PATCH 1/4] doc: Add AvailableTechnologies property Alfonso Sanchez-Beato
@ 2014-12-09 12:34 ` Alfonso Sanchez-Beato
2014-12-09 12:34 ` [PATCH 3/4] src: Implement RAT list property Alfonso Sanchez-Beato
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Alfonso Sanchez-Beato @ 2014-12-09 12:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1509 bytes --]
---
include/radio-settings.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/include/radio-settings.h b/include/radio-settings.h
index 1d0ca3e..545a29d 100644
--- a/include/radio-settings.h
+++ b/include/radio-settings.h
@@ -35,6 +35,13 @@ enum ofono_radio_access_mode {
OFONO_RADIO_ACCESS_MODE_LTE = 3,
};
+#define OFONO_FLAG_RADIO_ACCESS_MODE_GSM \
+ (1 << (OFONO_RADIO_ACCESS_MODE_GSM - 1))
+#define OFONO_FLAG_RADIO_ACCESS_MODE_UMTS \
+ (1 << (OFONO_RADIO_ACCESS_MODE_UMTS - 1))
+#define OFONO_FLAG_RADIO_ACCESS_MODE_LTE \
+ (1 << (OFONO_RADIO_ACCESS_MODE_LTE - 1))
+
enum ofono_radio_band_gsm {
OFONO_RADIO_BAND_GSM_ANY,
OFONO_RADIO_BAND_GSM_850,
@@ -80,6 +87,11 @@ typedef void (*ofono_radio_settings_fast_dormancy_query_cb_t)(
ofono_bool_t enable,
void *data);
+typedef void (*ofono_radio_settings_available_rats_query_cb_t)(
+ const struct ofono_error *error,
+ unsigned int available_rats,
+ void *data);
+
struct ofono_radio_settings_driver {
const char *name;
int (*probe)(struct ofono_radio_settings *rs, unsigned int vendor,
@@ -107,6 +119,9 @@ struct ofono_radio_settings_driver {
ofono_bool_t enable,
ofono_radio_settings_fast_dormancy_set_cb_t,
void *data);
+ void (*query_available_rats)(struct ofono_radio_settings *rs,
+ ofono_radio_settings_available_rats_query_cb_t cb,
+ void *data);
};
int ofono_radio_settings_driver_register(
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/4] src: Implement RAT list property
2014-12-09 12:34 [PATCH 0/4] Add AvailableTechnologies property to RadioSettings Alfonso Sanchez-Beato
2014-12-09 12:34 ` [PATCH 1/4] doc: Add AvailableTechnologies property Alfonso Sanchez-Beato
2014-12-09 12:34 ` [PATCH 2/4] include: Add method to list RATs to radio-settings Alfonso Sanchez-Beato
@ 2014-12-09 12:34 ` Alfonso Sanchez-Beato
2014-12-09 12:34 ` [PATCH 4/4] test: Add AvailableTechnologies to list-modems Alfonso Sanchez-Beato
2014-12-10 17:07 ` [PATCH 0/4] Add AvailableTechnologies property to RadioSettings Denis Kenzior
4 siblings, 0 replies; 7+ messages in thread
From: Alfonso Sanchez-Beato @ 2014-12-09 12:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2797 bytes --]
---
src/radio-settings.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/src/radio-settings.c b/src/radio-settings.c
index d1b1cc1..5d166cc 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)
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/4] test: Add AvailableTechnologies to list-modems
2014-12-09 12:34 [PATCH 0/4] Add AvailableTechnologies property to RadioSettings Alfonso Sanchez-Beato
` (2 preceding siblings ...)
2014-12-09 12:34 ` [PATCH 3/4] src: Implement RAT list property Alfonso Sanchez-Beato
@ 2014-12-09 12:34 ` Alfonso Sanchez-Beato
2014-12-10 17:07 ` [PATCH 0/4] Add AvailableTechnologies property to RadioSettings Denis Kenzior
4 siblings, 0 replies; 7+ messages in thread
From: Alfonso Sanchez-Beato @ 2014-12-09 12:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 494 bytes --]
---
test/list-modems | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/list-modems b/test/list-modems
index b9f510a..a163791 100755
--- a/test/list-modems
+++ b/test/list-modems
@@ -40,7 +40,8 @@ for path, properties in modems:
"PreferredLanguages",
"PrimaryContexts",
"LockedPins",
- "Features"]:
+ "Features",
+ "AvailableTechnologies"]:
val = ""
for i in properties[key]:
val += i + " "
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 0/4] Add AvailableTechnologies property to RadioSettings
2014-12-09 12:34 [PATCH 0/4] Add AvailableTechnologies property to RadioSettings Alfonso Sanchez-Beato
` (3 preceding siblings ...)
2014-12-09 12:34 ` [PATCH 4/4] test: Add AvailableTechnologies to list-modems Alfonso Sanchez-Beato
@ 2014-12-10 17:07 ` Denis Kenzior
2014-12-12 11:28 ` Alfonso Sanchez-Beato
4 siblings, 1 reply; 7+ messages in thread
From: Denis Kenzior @ 2014-12-10 17:07 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1355 bytes --]
Hi Alfonso,
On 12/09/2014 06:34 AM, Alfonso Sanchez-Beato wrote:
> This patch series add the AvailableTechnologies property to the
> RadioSettings interface. Its purpose is to show the list of valid
> values for the TechnologyPreference property in the same interface.
> The use case is letting a UI show the possible RATs so the user cannot
> select an invalid value for a given modem.
>
> Alfonso Sanchez-Beato (4):
> doc: Add AvailableTechnologies property
> include: Add method to list RATs to radio-settings
> src: Implement RAT list property
> test: Add AvailableTechnologies to list-modems
>
> doc/radio-settings-api.txt | 5 +++++
> include/radio-settings.h | 15 +++++++++++++++
> src/radio-settings.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-
> test/list-modems | 3 ++-
> 4 files changed, 68 insertions(+), 2 deletions(-)
>
I went ahead and applied all four patches. However, I did tweak
include/radio-settings.h and src/radio-settings.c afterwards.
Mostly I changed radio_access_mode into a bit field and future-proofed
the implementation some. I think it is quite simpler now.
As a bonus I added a minimalistic radio_settings driver to phonesim and
caught one or two issues along the way.
If I broke something, please let me know.
Regards,
-Denis
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 0/4] Add AvailableTechnologies property to RadioSettings
2014-12-10 17:07 ` [PATCH 0/4] Add AvailableTechnologies property to RadioSettings Denis Kenzior
@ 2014-12-12 11:28 ` Alfonso Sanchez-Beato
0 siblings, 0 replies; 7+ messages in thread
From: Alfonso Sanchez-Beato @ 2014-12-12 11:28 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1576 bytes --]
On Wed, Dec 10, 2014 at 6:07 PM, Denis Kenzior <denkenz@gmail.com> wrote:
>
> Hi Alfonso,
>
>
> On 12/09/2014 06:34 AM, Alfonso Sanchez-Beato wrote:
>
>> This patch series add the AvailableTechnologies property to the
>> RadioSettings interface. Its purpose is to show the list of valid
>> values for the TechnologyPreference property in the same interface.
>> The use case is letting a UI show the possible RATs so the user cannot
>> select an invalid value for a given modem.
>>
>> Alfonso Sanchez-Beato (4):
>> doc: Add AvailableTechnologies property
>> include: Add method to list RATs to radio-settings
>> src: Implement RAT list property
>> test: Add AvailableTechnologies to list-modems
>>
>> doc/radio-settings-api.txt | 5 +++++
>> include/radio-settings.h | 15 +++++++++++++++
>> src/radio-settings.c | 47 ++++++++++++++++++++++++++++++
>> +++++++++++++++-
>> test/list-modems | 3 ++-
>> 4 files changed, 68 insertions(+), 2 deletions(-)
>>
>>
> I went ahead and applied all four patches. However, I did tweak
> include/radio-settings.h and src/radio-settings.c afterwards.
>
> Mostly I changed radio_access_mode into a bit field and future-proofed the
> implementation some. I think it is quite simpler now.
>
> As a bonus I added a minimalistic radio_settings driver to phonesim and
> caught one or two issues along the way.
>
> If I broke something, please let me know.
>
It worked fine with our driver, thanks. I've submitted a patch for a small
issue I found.
Br,
Alfonso
[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 2098 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread