[PATCH 3/4] Add: set_online and post_online methods to isimodem driver
by Pekka Pessi
---
drivers/isimodem/isimodem.c | 106 +++++++++++++++++++++++++++++++++++++++----
1 files changed, 97 insertions(+), 9 deletions(-)
diff --git a/drivers/isimodem/isimodem.c b/drivers/isimodem/isimodem.c
index 9a5e87e..0a3cc98 100644
--- a/drivers/isimodem/isimodem.c
+++ b/drivers/isimodem/isimodem.c
@@ -67,7 +67,8 @@ struct isi_data {
GPhonetLinkState linkstate;
unsigned interval;
int reported;
- int mtc_state;
+ ofono_bool_t online;
+ struct isi_cb_data *online_cbd;
};
static void report_powered(struct isi_data *isi, ofono_bool_t powered)
@@ -76,9 +77,27 @@ static void report_powered(struct isi_data *isi, ofono_bool_t powered)
ofono_modem_set_powered(isi->modem, isi->reported = powered);
}
-static void set_power_by_mtc_state(struct isi_data *isi, int state)
+static void report_online(struct isi_data *isi, ofono_bool_t online)
{
- switch (isi->mtc_state = state) {
+ struct isi_cb_data *cbd = isi->online_cbd;
+ ofono_modem_online_cb cb = cbd->cb;
+
+ isi->online_cbd = NULL;
+
+ if (isi->online == online)
+ CALLBACK_WITH_SUCCESS(cb, cbd->data);
+ else
+ CALLBACK_WITH_FAILURE(cb, cbd->data);
+
+ g_free(cbd);
+}
+
+static void set_power_by_mtc_state(struct isi_data *isi, int mtc_state)
+{
+ if (isi->online_cbd)
+ report_online(isi, mtc_state == MTC_NORMAL);
+
+ switch (mtc_state) {
case MTC_STATE_NONE:
case MTC_POWER_OFF:
case MTC_CHARGING:
@@ -88,9 +107,6 @@ static void set_power_by_mtc_state(struct isi_data *isi, int state)
case MTC_RF_INACTIVE:
case MTC_NORMAL:
- report_powered(isi, 1);
- break;
-
default:
report_powered(isi, 1);
}
@@ -155,7 +171,8 @@ static bool mtc_poll_query_cb(GIsiClient *client, const void *restrict data,
DBG("target modem state: %s (0x%02X)",
mtc_modem_state_name(msg[2]), msg[2]);
- set_power_by_mtc_state(isi, msg[1]);
+ if (msg[1] == msg[2])
+ set_power_by_mtc_state(isi, msg[1]);
return true;
}
@@ -179,7 +196,8 @@ static bool mtc_query_cb(GIsiClient *client, const void *restrict data,
DBG("target modem state: %s (0x%02X)",
mtc_modem_state_name(msg[2]), msg[2]);
- set_power_by_mtc_state(isi, msg[1]);
+ if (msg[1] == msg[2])
+ set_power_by_mtc_state(isi, msg[1]);
return true;
}
@@ -276,6 +294,7 @@ static int isi_modem_probe(struct ofono_modem *modem)
isi->ifname = ifname;
isi->link = link;
isi->client = g_isi_client_create(isi->idx, PN_MTC);
+ isi->reported = -1;
return 0;
}
@@ -293,6 +312,65 @@ static void isi_modem_remove(struct ofono_modem *modem)
g_free(isi);
}
+static bool mtc_state_cb(GIsiClient *client, const void *restrict data,
+ size_t len, uint16_t object, void *opaque)
+{
+ struct isi_cb_data *cbd = opaque;
+ struct ofono_modem *modem = cbd->user;
+ ofono_modem_online_cb cb = cbd->cb;
+ struct isi_data *isi = ofono_modem_get_data(modem);
+ const unsigned char *msg = data;
+
+ if (!msg) {
+ DBG("ISI client error: %d", g_isi_client_error(client));
+ goto err;
+ }
+
+ if (len < 3 || msg[0] != MTC_STATE_RESP)
+ return false;
+
+ DBG("cause: %s (0x%02X)", mtc_isi_cause_name(msg[1]), msg[1]);
+
+ if (msg[1] == MTC_OK) {
+ isi->online_cbd = cbd;
+ return true;
+ }
+
+err:
+ if (msg && msg[1] == MTC_ALREADY_ACTIVE)
+ CALLBACK_WITH_SUCCESS(cb, cbd->data);
+ else
+ CALLBACK_WITH_FAILURE(cb, cbd->data);
+
+ g_free(cbd);
+ return true;
+}
+
+static void isi_modem_online(struct ofono_modem *modem, ofono_bool_t online,
+ ofono_modem_online_cb cb, void *data)
+{
+ struct isi_data *isi = ofono_modem_get_data(modem);
+ const unsigned char req[] = {
+ MTC_STATE_REQ, online ? MTC_NORMAL : MTC_RF_INACTIVE, 0x00
+ };
+ struct isi_cb_data *cbd = isi_cb_data_new(modem, cb, data);
+
+ DBG("(%p) with %s", modem, isi->ifname);
+
+ if (!cbd)
+ goto error;
+
+ isi->online = online;
+
+ if (g_isi_request_make(isi->client, req, sizeof(req), MTC_TIMEOUT,
+ mtc_state_cb, cbd))
+ return;
+
+error:
+ g_free(cbd);
+ CALLBACK_WITH_FAILURE(cb, data);
+}
+
static void isi_modem_pre_sim(struct ofono_modem *modem)
{
struct isi_data *isi = ofono_modem_get_data(modem);
@@ -307,12 +385,20 @@ static void isi_modem_pre_sim(struct ofono_modem *modem)
static void isi_modem_post_sim(struct ofono_modem *modem)
{
struct isi_data *isi = ofono_modem_get_data(modem);
+
+ DBG("(%p) with %s", modem, isi->ifname);
+
+ ofono_phonebook_create(isi->modem, 0, "isimodem", isi->idx);
+}
+
+static void isi_modem_post_online(struct ofono_modem *modem)
+{
+ struct isi_data *isi = ofono_modem_get_data(modem);
struct ofono_gprs *gprs;
struct ofono_gprs_context *gc;
DBG("(%p) with %s", modem, isi->ifname);
- ofono_phonebook_create(isi->modem, 0, "isimodem", isi->idx);
ofono_netreg_create(isi->modem, 0, "isimodem", isi->idx);
ofono_sms_create(isi->modem, 0, "isimodem", isi->idx);
ofono_cbs_create(isi->modem, 0, "isimodem", isi->idx);
@@ -336,8 +422,10 @@ static struct ofono_modem_driver driver = {
.name = "isimodem",
.probe = isi_modem_probe,
.remove = isi_modem_remove,
+ .set_online = isi_modem_online,
.pre_sim = isi_modem_pre_sim,
.post_sim = isi_modem_post_sim,
+ .post_online = isi_modem_post_online,
};
static int isimodem_init(void)
--
1.6.3.3
10 years, 10 months
SMS delivery report
by Miettinen Pasi
Hi all,
My name is Pasi Miettinen. I have been working with SMS delivery report item
based on the TODO list. The work covers requesting of SMS report in the
DBus interface via SendMessage method by adding third parameter. If
parameter is TRUE status report is asked. Incoming status report is reported
also via DBus by sending signla called IncomingStatusreport. Status reports
of the concatenated messages are also supported. Internal oFono SMS
history is updated according status report results. This patch utilizes old style
msg_id (not hash). Concatenated messages have one internal msg_id that
relates to multiple TP-MR. If one MR-number is resulted to "delivery-failed",
the whole concatenated message is considered as failed and history is
updated using internal msg_id.
An initial set of patches follow for review.
Best regards,
Pasi Miettinen
10 years, 10 months
[PATCH]enable-modem.c
by Daniele Palmas
Hi,
here is the first simple example in c for enabling modem. This is my first time using glib, dbus and git so I hope not to have done too many mistakes... If you find it useful I can continue submitting the others I have,
Regards,
Daniele
test/enable-modem.c | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 116 insertions(+), 0 deletions(-)
diff --git a/test/enable-modem.c b/test/enable-modem.c
new file mode 100644
index 0000000..610b933
--- /dev/null
+++ b/test/enable-modem.c
@@ -0,0 +1,116 @@
+/*
+ * enable-modem.c
+ *
+ * Created on: 25/mag/2010
+ * Author: Daniele Palmas <daniele.palmas(a)telit.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "dbus/dbus-glib.h"
+
+#define OFONO_BUS_NAME "org.ofono"
+#define OFONO_MANAGER_INTERFACE "org.ofono.Manager"
+#define OFONO_MODEM_INTERFACE "org.ofono.Modem"
+
+#define MODEM_NAME_SIZE 32
+
+int main (int argc, char **argv)
+{
+ DBusGConnection *connection;
+ GError *error;
+ DBusGProxy *proxy;
+ int exitValue;
+
+ char modemName[MODEM_NAME_SIZE];
+ GHashTable *dict;
+ GValue varEnable = {0, };
+
+ g_type_init ();
+
+ connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+
+ if (connection == NULL)
+ {
+ g_printerr("Failed to open connection to bus: %s\n", error->message);
+ g_error_free (error);
+ exit (EXIT_FAILURE);
+ }
+
+ proxy = dbus_g_proxy_new_for_name (connection,
+ OFONO_BUS_NAME,
+ "/",
+ OFONO_MANAGER_INTERFACE);
+
+ if (!dbus_g_proxy_call (proxy, "GetProperties", &error, G_TYPE_INVALID, dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &dict, G_TYPE_INVALID))
+ {
+ if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION)
+ g_printerr ("Caught remote method exception %s: %s",
+ dbus_g_error_get_name (error),
+ error->message);
+ else
+ g_printerr ("Error: %s\n", error->message);
+
+ g_error_free (error);
+
+ exitValue = EXIT_FAILURE;
+ goto End;
+ } else {
+ GValue *value;
+ GPtrArray* modemArr;
+
+ value = (GValue *) g_hash_table_lookup(dict, "Modems");
+ modemArr = g_value_peek_pointer(value);
+
+ // I suppose that the desired device is the first in the list and name length is < MODEM_NAME_SIZE
+ strcpy(modemName, g_ptr_array_index(modemArr, 0));
+
+ g_ptr_array_free(modemArr, FALSE);
+ g_hash_table_destroy(dict);
+ }
+
+ g_object_unref (proxy);
+
+ proxy = dbus_g_proxy_new_for_name (connection,
+ OFONO_BUS_NAME,
+ modemName,
+ OFONO_MODEM_INTERFACE);
+
+ g_value_init (&varEnable, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&varEnable, TRUE);
+
+ if (!dbus_g_proxy_call (proxy, "SetProperty", &error, G_TYPE_STRING, "Powered", G_TYPE_VALUE, &varEnable, G_TYPE_INVALID, G_TYPE_INVALID))
+ {
+ if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION)
+ g_printerr ("Caught remote method exception %s: %s",
+ dbus_g_error_get_name (error),
+ error->message);
+ else
+ g_printerr ("Error: %s\n", error->message);
+
+ g_error_free (error);
+
+ exitValue = EXIT_FAILURE;
+ goto End;
+ }
+
+ exitValue = EXIT_SUCCESS;
+
+End:
+ g_object_unref (proxy);
+ exit(exitValue);
+}
+
10 years, 10 months
[PATCH 1/8] stk: Make parse_dataobj not consume extra data
by Yang Gu
---
src/stkutil.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 016bde9..fd5b7c6 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -2023,6 +2023,7 @@ static gboolean parse_dataobj(struct comprehension_tlv_iter *iter,
GSList *l;
va_list args;
gboolean minimum_set = TRUE;
+ struct comprehension_tlv_iter iter_old;
va_start(args, type);
@@ -2056,11 +2057,14 @@ static gboolean parse_dataobj(struct comprehension_tlv_iter *iter,
if (handler(iter, entry->data))
entry->parsed = TRUE;
+ comprehension_tlv_iter_copy(iter, &iter_old);
+
if (comprehension_tlv_iter_next(iter) == FALSE)
break;
}
}
+ comprehension_tlv_iter_copy(&iter_old, iter);
out:
for (l = entries; l; l = l->next) {
struct dataobj_handler_entry *entry = l->data;
@@ -2293,6 +2297,9 @@ static GSList *parse_item_list(struct comprehension_tlv_iter *iter)
struct stk_item item;
GSList *list = NULL;
+ if (comprehension_tlv_iter_next(iter) != TRUE)
+ return NULL;
+
if (comprehension_tlv_iter_get_tag(iter) != tag)
return NULL;
--
1.7.0.4
10 years, 10 months
[PATCH] Keep modem state consistent if sim is removed while online is being changed.
by Pekka Pessi
---
src/modem.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/modem.c b/src/modem.c
index 2cb3e50..0fa8a67 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -410,14 +410,16 @@ static void online_cb(const struct ofono_error *error, void *data)
struct ofono_modem *modem = data;
DBusMessage *reply;
- if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
+ if (error->type == OFONO_ERROR_TYPE_NO_ERROR &&
+ modem->modem_state == MODEM_STATE_OFFLINE)
reply = dbus_message_new_method_return(modem->pending);
else
reply = __ofono_error_failed(modem->pending);
__ofono_dbus_pending_reply(&modem->pending, reply);
- if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
+ if (error->type == OFONO_ERROR_TYPE_NO_ERROR &&
+ modem->modem_state == MODEM_STATE_OFFLINE)
modem_change_state(modem, MODEM_STATE_ONLINE);
}
@@ -433,7 +435,8 @@ static void offline_cb(const struct ofono_error *error, void *data)
__ofono_dbus_pending_reply(&modem->pending, reply);
- if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
+ if (error->type == OFONO_ERROR_TYPE_NO_ERROR &&
+ modem->modem_state == MODEM_STATE_ONLINE)
modem_change_state(modem, MODEM_STATE_OFFLINE);
}
--
1.6.3.3
10 years, 10 months
[PATCH 1/4] Add: Online property to modem
by Pekka Pessi
The online/offline state is changed with the new set_online() modem driver
method.
In order to track atoms, there are modem states as follows:
- OFONO_MODEM_STATE_POWER_OFF
- OFONO_MODEM_STATE_PRE_SIM
- OFONO_MODEM_STATE_OFFLINE
- OFONO_MODEM_STATE_ONLINE
Atoms are removed by modem core according to the state. Atoms are added with
driver methods pre_sim(), post_sim() and post_online().
---
include/modem.h | 12 ++++
src/modem.c | 194 +++++++++++++++++++++++++++++++++++++++++++------------
2 files changed, 164 insertions(+), 42 deletions(-)
diff --git a/include/modem.h b/include/modem.h
index d502640..69c7ad2 100644
--- a/include/modem.h
+++ b/include/modem.h
@@ -50,6 +50,8 @@ void ofono_modem_remove(struct ofono_modem *modem);
void ofono_modem_set_powered(struct ofono_modem *modem, ofono_bool_t powered);
ofono_bool_t ofono_modem_get_powered(struct ofono_modem *modem);
+ofono_bool_t ofono_modem_get_online(struct ofono_modem *modem);
+
void ofono_modem_set_name(struct ofono_modem *modem, const char *name);
int ofono_modem_set_string(struct ofono_modem *modem,
@@ -64,6 +66,9 @@ int ofono_modem_set_boolean(struct ofono_modem *modem,
const char *key, bool value);
bool ofono_modem_get_boolean(struct ofono_modem *modem, const char *key);
+typedef void (*ofono_modem_online_cb)(const struct ofono_error *error,
+ void *data);
+
struct ofono_modem_driver {
const char *name;
@@ -80,11 +85,18 @@ struct ofono_modem_driver {
/* Power down device */
int (*disable)(struct ofono_modem *modem);
+ /* Enable or disable cellular radio */
+ void (*set_online)(struct ofono_modem *modem, ofono_bool_t online,
+ ofono_modem_online_cb callback, void *data);
+
/* Populate the atoms available without SIM / Locked SIM */
void (*pre_sim)(struct ofono_modem *modem);
/* Populate the atoms that are available with SIM / Unlocked SIM*/
void (*post_sim)(struct ofono_modem *modem);
+
+ /* Populate the atoms available online */
+ void (*post_online)(struct ofono_modem *modem);
};
int ofono_modem_driver_register(const struct ofono_modem_driver *);
diff --git a/src/modem.c b/src/modem.c
index 04fba15..b52bcb0 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -49,10 +49,17 @@ enum ofono_property_type {
OFONO_PROPERTY_TYPE_BOOLEAN,
};
+enum ofono_modem_state {
+ OFONO_MODEM_STATE_POWER_OFF,
+ OFONO_MODEM_STATE_PRE_SIM,
+ OFONO_MODEM_STATE_OFFLINE,
+ OFONO_MODEM_STATE_ONLINE,
+};
+
struct ofono_modem {
char *path;
+ enum ofono_modem_state modem_state;
GSList *atoms;
- GSList *pre_sim_atoms;
struct ofono_watchlist *atom_watches;
GSList *interface_list;
unsigned int call_ids;
@@ -61,6 +68,8 @@ struct ofono_modem {
ofono_bool_t powered;
ofono_bool_t powered_pending;
guint timeout;
+ ofono_bool_t online;
+ ofono_bool_t online_pending;
GHashTable *properties;
struct ofono_sim *sim;
unsigned int sim_watch;
@@ -83,6 +92,7 @@ struct ofono_devinfo {
struct ofono_atom {
enum ofono_atom_type type;
+ enum ofono_modem_state modem_state;
void (*destruct)(struct ofono_atom *atom);
void (*unregister)(struct ofono_atom *atom);
void *data;
@@ -160,6 +170,7 @@ struct ofono_atom *__ofono_modem_add_atom(struct ofono_modem *modem,
atom = g_new0(struct ofono_atom, 1);
atom->type = type;
+ atom->modem_state = modem->modem_state;
atom->destruct = destruct;
atom->data = data;
atom->modem = modem;
@@ -275,7 +286,6 @@ struct ofono_atom *__ofono_modem_find_atom(struct ofono_modem *modem,
return NULL;
FIND_ATOM_IN_LIST(modem->atoms)
- FIND_ATOM_IN_LIST(modem->pre_sim_atoms);
return NULL;
}
@@ -301,7 +311,6 @@ void __ofono_modem_foreach_atom(struct ofono_modem *modem,
return;
FOREACH_ATOM_IN_LIST(modem->atoms)
- FOREACH_ATOM_IN_LIST(modem->pre_sim_atoms)
}
void __ofono_atom_free(struct ofono_atom *atom)
@@ -309,7 +318,6 @@ void __ofono_atom_free(struct ofono_atom *atom)
struct ofono_modem *modem = atom->modem;
modem->atoms = g_slist_remove(modem->atoms, atom);
- modem->pre_sim_atoms = g_slist_remove(modem->pre_sim_atoms, atom);
__ofono_atom_unregister(atom);
@@ -319,24 +327,139 @@ void __ofono_atom_free(struct ofono_atom *atom)
g_free(atom);
}
-static void remove_all_atoms(GSList **atoms)
+static void flush_atoms(struct ofono_modem *modem,
+ enum ofono_modem_state new_state)
{
- GSList *l;
+ GSList *l, *next;
struct ofono_atom *atom;
- for (l = *atoms; l; l = l->next) {
+ for (l = modem->atoms; l; l = next) {
atom = l->data;
+ next = l->next;
- __ofono_atom_unregister(atom);
+ if (atom->modem_state > new_state)
+ __ofono_atom_free(atom);
+ }
+}
- if (atom->destruct)
- atom->destruct(atom);
+static void modem_change_state(struct ofono_modem *modem,
+ enum ofono_modem_state new_state)
+{
+ struct ofono_modem_driver const *driver = modem->driver;
+ enum ofono_modem_state old_state = modem->modem_state;
+ ofono_bool_t new_online = new_state == OFONO_MODEM_STATE_ONLINE;
+
+ if (old_state == new_state)
+ return;
- g_free(atom);
+ if (new_online != modem->online) {
+ DBusConnection *conn = ofono_dbus_get_connection();
+ modem->online = new_online;
+ ofono_dbus_signal_property_changed(conn, modem->path,
+ OFONO_MODEM_INTERFACE, "Online",
+ DBUS_TYPE_BOOLEAN, &modem->online);
}
- g_slist_free(*atoms);
- *atoms = NULL;
+ modem->modem_state = new_state;
+
+ if (old_state > new_state)
+ flush_atoms(modem, new_state);
+
+ switch (new_state) {
+ case OFONO_MODEM_STATE_POWER_OFF:
+ modem->call_ids = 0;
+ break;
+
+ case OFONO_MODEM_STATE_PRE_SIM:
+ if (old_state < OFONO_MODEM_STATE_PRE_SIM) {
+ if (driver->pre_sim)
+ driver->pre_sim(modem);
+ } else if (old_state == OFONO_MODEM_STATE_ONLINE) {
+ if (driver->set_online)
+ driver->set_online(modem, 0, NULL, NULL);
+ }
+ break;
+
+ case OFONO_MODEM_STATE_OFFLINE:
+ if (old_state < OFONO_MODEM_STATE_OFFLINE) {
+ if (driver->post_sim)
+ driver->post_sim(modem);
+ __ofono_history_probe_drivers(modem);
+ __ofono_nettime_probe_drivers(modem);
+ }
+ break;
+
+ case OFONO_MODEM_STATE_ONLINE:
+ if (driver->post_online)
+ driver->post_online(modem);
+ break;
+ }
+}
+
+static void set_online_callback(const struct ofono_error *error,
+ void *data)
+{
+ struct ofono_modem *modem = data;
+ DBusMessage *reply = NULL;
+ ofono_bool_t online = modem->online_pending;
+
+ if (error && error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ reply = __ofono_error_failed(modem->pending);
+ online = modem->online;
+ } else if (online && modem->modem_state < OFONO_MODEM_STATE_OFFLINE) {
+ reply = __ofono_error_failed(modem->pending);
+ online = FALSE;
+ } else
+ reply = dbus_message_new_method_return(modem->pending);
+
+ __ofono_dbus_pending_reply(&modem->pending, reply);
+
+ modem->online_pending = online;
+
+ if (modem->online == online)
+ return;
+
+ if (online)
+ modem_change_state(modem, OFONO_MODEM_STATE_ONLINE);
+ else
+ modem_change_state(modem, OFONO_MODEM_STATE_OFFLINE);
+}
+
+static DBusMessage *set_property_online(struct ofono_modem *modem,
+ DBusMessage *msg,
+ DBusMessageIter *var)
+{
+ ofono_bool_t online;
+ const struct ofono_modem_driver *driver = modem->driver;
+
+ if (dbus_message_iter_get_arg_type(var) != DBUS_TYPE_BOOLEAN)
+ return __ofono_error_invalid_args(msg);
+
+ dbus_message_iter_get_basic(var, &online);
+
+ if (modem->online == online)
+ return dbus_message_new_method_return(msg);
+
+ if (!driver || !driver->set_online)
+ return __ofono_error_failed(msg);
+
+ if (modem->pending != NULL)
+ return __ofono_error_busy(msg);
+
+ modem->pending = dbus_message_ref(msg);
+ modem->online_pending = online;
+
+ driver->set_online(modem, online, set_online_callback, modem);
+
+ return NULL;
+}
+
+ofono_bool_t ofono_modem_get_online(struct ofono_modem *modem)
+{
+ if (modem == NULL)
+ return FALSE;
+
+ return modem->online;
}
static DBusMessage *modem_get_properties(DBusConnection *conn,
@@ -361,6 +484,9 @@ static DBusMessage *modem_get_properties(DBusConnection *conn,
OFONO_PROPERTIES_ARRAY_SIGNATURE,
&dict);
+ ofono_dbus_dict_append(&dict, "Online", DBUS_TYPE_BOOLEAN,
+ &modem->online);
+
ofono_dbus_dict_append(&dict, "Powered", DBUS_TYPE_BOOLEAN,
&modem->powered);
@@ -420,11 +546,8 @@ static int set_powered(struct ofono_modem *modem, ofono_bool_t powered)
return -EALREADY;
/* Remove the atoms even if the driver is no longer available */
- if (powered == FALSE) {
- remove_all_atoms(&modem->atoms);
- remove_all_atoms(&modem->pre_sim_atoms);
- modem->call_ids = 0;
- }
+ if (powered == FALSE)
+ modem_change_state(modem, OFONO_MODEM_STATE_POWER_OFF);
modem->powered_pending = powered;
@@ -502,6 +625,9 @@ static DBusMessage *modem_set_property(DBusConnection *conn,
dbus_message_iter_recurse(&iter, &var);
+ if (g_str_equal(name, "Online"))
+ return set_property_online(modem, msg, &var);
+
if (g_str_equal(name, "Powered") == TRUE) {
ofono_bool_t powered;
int err;
@@ -535,10 +661,8 @@ static DBusMessage *modem_set_property(DBusConnection *conn,
"Powered", DBUS_TYPE_BOOLEAN,
&powered);
- if (powered) {
- if (modem->driver->pre_sim)
- modem->driver->pre_sim(modem);
- }
+ if (powered)
+ modem_change_state(modem, OFONO_MODEM_STATE_PRE_SIM);
return NULL;
}
@@ -596,14 +720,10 @@ void ofono_modem_set_powered(struct ofono_modem *modem, ofono_bool_t powered)
"Powered", DBUS_TYPE_BOOLEAN,
&dbus_powered);
- if (powered) {
- if (modem->driver->pre_sim)
- modem->driver->pre_sim(modem);
- } else {
- remove_all_atoms(&modem->atoms);
- remove_all_atoms(&modem->pre_sim_atoms);
- modem->call_ids = 0;
- }
+ if (powered)
+ modem_change_state(modem, OFONO_MODEM_STATE_PRE_SIM);
+ else
+ modem_change_state(modem, OFONO_MODEM_STATE_POWER_OFF);
}
if (powering_down && powered == FALSE) {
@@ -1132,22 +1252,12 @@ static void modem_sim_ready(void *user, enum ofono_sim_state new_state)
switch (new_state) {
case OFONO_SIM_STATE_NOT_PRESENT:
- if (modem->pre_sim_atoms != NULL)
- remove_all_atoms(&modem->atoms);
+ modem_change_state(modem, OFONO_MODEM_STATE_PRE_SIM);
break;
case OFONO_SIM_STATE_INSERTED:
break;
case OFONO_SIM_STATE_READY:
- if (modem->pre_sim_atoms == NULL) {
- modem->pre_sim_atoms = modem->atoms;
- modem->atoms = NULL;
- }
-
- if (modem->driver->post_sim)
- modem->driver->post_sim(modem);
-
- __ofono_history_probe_drivers(modem);
- __ofono_nettime_probe_drivers(modem);
+ modem_change_state(modem, OFONO_MODEM_STATE_OFFLINE);
}
}
--
1.6.3.3
10 years, 10 months
Getting Modem properties using qt dbus programming -reg
by krishna k
Hi,
I am trying to implement application using qt dbus module, Which will call SetProperty with parameters QString, QVariant.
using dbus-send i am using the following command...
sudo dbus-send --system --type=method_call --print-reply --dest=org.ofono /phonesim0 org.ofono.Modem.SetProperty string:"Powered" variant:boolean:true
In the above command, According to my knowledge, I interpreted the things as below...
Type of bus : systembus
Type of call : method call
service name : org.ofono
object path : /phonesim0
Interface name : org.ofono.Modem
method name : SetProperty
which means ( "sv" -- string, variant)
I am trying the same thing using qt program...
QDBusConnection bus = QDBusConnection::systemBus();
QDBusInterface dbus_iface("org.ofono", "/phonesim0/operator/23402",
"org.ofono.Modem", bus);
bool value = true;
dbus_iface.call("SetProperty", QString("Powered"), QVariant(QVariant::Bool, &value));
I am getting output as below o/p..
QDBusMessage(type=Error, service="", error name="org.freedesktop.DBus.Error.UnknownMethod",
error message="Method "SetProperty" with signature "sb" on interface "org.ofono.Modem" doesn't exist
", signature="", contents=([]) )
Please find that "sb" which is analysed as "string and boolean" parameters.
Can any one suggest what is wrong with is piece of code...
regards,KK.
_________________________________________________________________
South Cinema This Decade
http://entertainment.in.msn.com/southcinemathisdecade/
10 years, 10 months
[PATCH 1/2] stk: Use sim bcd version
by Yang Gu
---
src/stkutil.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 016bde9..e39a77f 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -276,7 +276,7 @@ static gboolean parse_dataobj_address(struct comprehension_tlv_iter *iter,
addr->ton_npi = data[0];
addr->number = number;
- extract_bcd_number(data + 1, len - 1, addr->number);
+ sim_extract_bcd_number(data + 1, len - 1, addr->number);
return TRUE;
}
@@ -1012,7 +1012,7 @@ static gboolean parse_dataobj_dtmf_string(struct comprehension_tlv_iter *iter,
if (*dtmf == NULL)
return FALSE;
- extract_bcd_number(data, len, *dtmf);
+ sim_extract_bcd_number(data, len, *dtmf);
return TRUE;
}
--
1.7.0.4
10 years, 10 months
[PATCH] test-stkutil: Use gcc4.3 compatible initialisers.
by Andrzej Zaborowski
Reformat according to ideas on IRC.
---
unit/test-stkutil.c | 1375 +++++++++++++--------------------------------------
1 files changed, 356 insertions(+), 1019 deletions(-)
diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c
index 173ab2d..8117ec7 100644
--- a/unit/test-stkutil.c
+++ b/unit/test-stkutil.c
@@ -4769,21 +4769,11 @@ static struct setup_menu_test setup_menu_data_111 = {
.pdu_len = sizeof(setup_menu_111),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
- },
- .items[3] = {
- .id = 4,
- .text = "Item 4"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
+ { .id = 4, .text = "Item 4" },
}
};
@@ -4792,13 +4782,9 @@ static struct setup_menu_test setup_menu_data_112 = {
.pdu_len = sizeof(setup_menu_112),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu",
- .items[0] = {
- .id = 0x11,
- .text = "One"
- },
- .items[1] = {
- .id = 0x12,
- .text = "Two"
+ .items = {
+ { .id = 0x11, .text = "One" },
+ { .id = 0x12, .text = "Two" },
}
};
@@ -4813,125 +4799,37 @@ static struct setup_menu_test setup_menu_data_121 = {
.pdu_len = sizeof(setup_menu_121),
.qualifier = 0x00,
.alpha_id = "LargeMenu1",
- .items[0] = {
- .id = 0x50,
- .text = "Zero"
- },
- .items[1] = {
- .id = 0x4F,
- .text = "One"
- },
- .items[2] = {
- .id = 0x4E,
- .text = "Two"
- },
- .items[3] = {
- .id = 0x4D,
- .text = "Three"
- },
- .items[4] = {
- .id = 0x4C,
- .text = "Four"
- },
- .items[5] = {
- .id = 0x4B,
- .text = "Five"
- },
- .items[6] = {
- .id = 0x4A,
- .text = "Six"
- },
- .items[7] = {
- .id = 0x49,
- .text = "Seven"
- },
- .items[8] = {
- .id = 0x48,
- .text = "Eight"
- },
- .items[9] = {
- .id = 0x47,
- .text = "Nine"
- },
- .items[10] = {
- .id = 0x46,
- .text = "Alpha"
- },
- .items[11] = {
- .id = 0x45,
- .text = "Bravo"
- },
- .items[12] = {
- .id = 0x44,
- .text = "Charlie"
- },
- .items[13] = {
- .id = 0x43,
- .text = "Delta"
- },
- .items[14] = {
- .id = 0x42,
- .text = "Echo"
- },
- .items[15] = {
- .id = 0x41,
- .text = "Fox-trot"
- },
- .items[16] = {
- .id = 0x40,
- .text = "Black"
- },
- .items[17] = {
- .id = 0x3F,
- .text = "Brown"
- },
- .items[18] = {
- .id = 0x3E,
- .text = "Red"
- },
- .items[19] = {
- .id = 0x3D,
- .text = "Orange"
- },
- .items[20] = {
- .id = 0x3C,
- .text = "Yellow"
- },
- .items[21] = {
- .id = 0x3B,
- .text = "Green"
- },
- .items[22] = {
- .id = 0x3A,
- .text = "Blue"
- },
- .items[23] = {
- .id = 0x39,
- .text = "Violet"
- },
- .items[24] = {
- .id = 0x38,
- .text = "Grey"
- },
- .items[25] = {
- .id = 0x37,
- .text = "White"
- },
- .items[26] = {
- .id = 0x36,
- .text = "milli"
- },
- .items[27] = {
- .id = 0x35,
- .text = "micro"
- },
- .items[28] = {
- .id = 0x34,
- .text = "nano"
- },
- .items[29] = {
- .id = 0x33,
- .text = "pico"
+ .items = {
+ { .id = 0x50, .text = "Zero" },
+ { .id = 0x4F, .text = "One" },
+ { .id = 0x4E, .text = "Two" },
+ { .id = 0x4D, .text = "Three" },
+ { .id = 0x4C, .text = "Four" },
+ { .id = 0x4B, .text = "Five" },
+ { .id = 0x4A, .text = "Six" },
+ { .id = 0x49, .text = "Seven" },
+ { .id = 0x48, .text = "Eight" },
+ { .id = 0x47, .text = "Nine" },
+ { .id = 0x46, .text = "Alpha" },
+ { .id = 0x45, .text = "Bravo" },
+ { .id = 0x44, .text = "Charlie" },
+ { .id = 0x43, .text = "Delta" },
+ { .id = 0x42, .text = "Echo" },
+ { .id = 0x41, .text = "Fox-trot" },
+ { .id = 0x40, .text = "Black" },
+ { .id = 0x3F, .text = "Brown" },
+ { .id = 0x3E, .text = "Red" },
+ { .id = 0x3D, .text = "Orange" },
+ { .id = 0x3C, .text = "Yellow" },
+ { .id = 0x3B, .text = "Green" },
+ { .id = 0x3A, .text = "Blue" },
+ { .id = 0x39, .text = "Violet" },
+ { .id = 0x38, .text = "Grey" },
+ { .id = 0x37, .text = "White" },
+ { .id = 0x36, .text = "milli" },
+ { .id = 0x35, .text = "micro" },
+ { .id = 0x34, .text = "nano" },
+ { .id = 0x33, .text = "pico" },
}
};
@@ -4940,33 +4838,14 @@ static struct setup_menu_test setup_menu_data_122 = {
.pdu_len = sizeof(setup_menu_122),
.qualifier = 0x00,
.alpha_id = "LargeMenu2",
- .items[0] = {
- .id = 0xFF,
- .text = "1 Call Forward Unconditional"
- },
- .items[1] = {
- .id = 0xFE,
- .text = "2 Call Forward On User Busy"
- },
- .items[2] = {
- .id = 0xFD,
- .text = "3 Call Forward On No Reply"
- },
- .items[3] = {
- .id = 0xFC,
- .text = "4 Call Forward On User Not Reachable"
- },
- .items[4] = {
- .id = 0xFB,
- .text = "5 Barring Of All Outgoing Calls"
- },
- .items[5] = {
- .id = 0xFA,
- .text = "6 Barring Of All Outgoing Int Calls"
- },
- .items[6] = {
- .id = 0xF9,
- .text = "7 CLI Presentation"
+ .items = {
+ { .id = 0xFF, .text = "1 Call Forward Unconditional" },
+ { .id = 0xFE, .text = "2 Call Forward On User Busy" },
+ { .id = 0xFD, .text = "3 Call Forward On No Reply" },
+ { .id = 0xFC, .text = "4 Call Forward On User Not Reachable" },
+ { .id = 0xFB, .text = "5 Barring Of All Outgoing Calls" },
+ { .id = 0xFA, .text = "6 Barring Of All Outgoing Int Calls" },
+ { .id = 0xF9, .text = "7 CLI Presentation" },
}
};
@@ -4979,9 +4858,8 @@ static struct setup_menu_test setup_menu_data_123 = {
"facility) in order to give the user the opportunity "
"to choose one of these menu items at his own "
"discretion. Each item comprises a sh",
- .items[0] = {
- .id = 0x01,
- .text = "Y"
+ .items = {
+ { .id = 0x01, .text = "Y" }
}
};
@@ -4990,21 +4868,11 @@ static struct setup_menu_test setup_menu_data_211 = {
.pdu_len = sizeof(setup_menu_211),
.qualifier = 0x80,
.alpha_id = "Toolkit Menu",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
- },
- .items[3] = {
- .id = 4,
- .text = "Item 4"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
+ { .id = 4, .text = "Item 4" },
}
};
@@ -5013,21 +4881,11 @@ static struct setup_menu_test setup_menu_data_311 = {
.pdu_len = sizeof(setup_menu_311),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
- },
- .items[3] = {
- .id = 4,
- .text = "Item 4"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
+ { .id = 4, .text = "Item 4" },
},
.next_act = {
.list = { STK_COMMAND_TYPE_SEND_SMS,
@@ -5043,17 +4901,10 @@ static struct setup_menu_test setup_menu_data_411 = {
.pdu_len = sizeof(setup_menu_411),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.icon_id = {
.qualifier = STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY,
@@ -5071,17 +4922,10 @@ static struct setup_menu_test setup_menu_data_421 = {
.pdu_len = sizeof(setup_menu_421),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.icon_id = {
.qualifier = STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY,
@@ -5099,13 +4943,9 @@ static struct setup_menu_test setup_menu_data_511 = {
.pdu_len = sizeof(setup_menu_511),
.qualifier = 0x01,
.alpha_id = "Toolkit Menu",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
}
};
@@ -5114,17 +4954,10 @@ static struct setup_menu_test setup_menu_data_611 = {
.pdu_len = sizeof(setup_menu_611),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.text_attr = {
.len = 4,
@@ -5142,17 +4975,10 @@ static struct setup_menu_test setup_menu_data_612 = {
.pdu_len = sizeof(setup_menu_612),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu 2",
- .items[0] = {
- .id = 4,
- .text = "Item 4"
- },
- .items[1] = {
- .id = 5,
- .text = "Item 5"
- },
- .items[2] = {
- .id = 6,
- .text = "Item 6"
+ .items = {
+ { .id = 4, .text = "Item 4" },
+ { .id = 5, .text = "Item 5" },
+ { .id = 6, .text = "Item 6" },
}
};
@@ -5161,17 +4987,10 @@ static struct setup_menu_test setup_menu_data_621 = {
.pdu_len = sizeof(setup_menu_621),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.text_attr = {
.len = 4,
@@ -5189,17 +5008,10 @@ static struct setup_menu_test setup_menu_data_622 = {
.pdu_len = sizeof(setup_menu_622),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu 2",
- .items[0] = {
- .id = 4,
- .text = "Item 4"
- },
- .items[1] = {
- .id = 5,
- .text = "Item 5"
- },
- .items[2] = {
- .id = 6,
- .text = "Item 6"
+ .items = {
+ { .id = 4, .text = "Item 4" },
+ { .id = 5, .text = "Item 5" },
+ { .id = 6, .text = "Item 6" },
}
};
@@ -5212,17 +5024,10 @@ static struct setup_menu_test setup_menu_data_631 = {
.pdu_len = sizeof(setup_menu_631),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.text_attr = {
.len = 4,
@@ -5240,17 +5045,10 @@ static struct setup_menu_test setup_menu_data_632 = {
.pdu_len = sizeof(setup_menu_632),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu 2",
- .items[0] = {
- .id = 4,
- .text = "Item 4"
- },
- .items[1] = {
- .id = 5,
- .text = "Item 5"
- },
- .items[2] = {
- .id = 6,
- .text = "Item 6"
+ .items = {
+ { .id = 4, .text = "Item 4" },
+ { .id = 5, .text = "Item 5" },
+ { .id = 6, .text = "Item 6" },
}
};
@@ -5259,17 +5057,10 @@ static struct setup_menu_test setup_menu_data_641 = {
.pdu_len = sizeof(setup_menu_641),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.text_attr = {
.len = 4,
@@ -5287,17 +5078,10 @@ static struct setup_menu_test setup_menu_data_642 = {
.pdu_len = sizeof(setup_menu_642),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu 2",
- .items[0] = {
- .id = 4,
- .text = "Item 4"
- },
- .items[1] = {
- .id = 5,
- .text = "Item 5"
- },
- .items[2] = {
- .id = 6,
- .text = "Item 6"
+ .items = {
+ { .id = 4, .text = "Item 4" },
+ { .id = 5, .text = "Item 5" },
+ { .id = 6, .text = "Item 6" },
},
.text_attr = {
.len = 4,
@@ -5315,17 +5099,10 @@ static struct setup_menu_test setup_menu_data_643 = {
.pdu_len = sizeof(setup_menu_643),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu 3",
- .items[0] = {
- .id = 7,
- .text = "Item 7"
- },
- .items[1] = {
- .id = 8,
- .text = "Item 8"
- },
- .items[2] = {
- .id = 9,
- .text = "Item 9"
+ .items = {
+ { .id = 7, .text = "Item 7" },
+ { .id = 8, .text = "Item 8" },
+ { .id = 9, .text = "Item 9" },
}
};
@@ -5334,17 +5111,10 @@ static struct setup_menu_test setup_menu_data_651 = {
.pdu_len = sizeof(setup_menu_651),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.text_attr = {
.len = 4,
@@ -5362,17 +5132,10 @@ static struct setup_menu_test setup_menu_data_661 = {
.pdu_len = sizeof(setup_menu_661),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.text_attr = {
.len = 4,
@@ -5390,17 +5153,10 @@ static struct setup_menu_test setup_menu_data_671 = {
.pdu_len = sizeof(setup_menu_671),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.text_attr = {
.len = 4,
@@ -5418,17 +5174,10 @@ static struct setup_menu_test setup_menu_data_681 = {
.pdu_len = sizeof(setup_menu_681),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.text_attr = {
.len = 4,
@@ -5446,17 +5195,10 @@ static struct setup_menu_test setup_menu_data_691 = {
.pdu_len = sizeof(setup_menu_691),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.text_attr = {
.len = 4,
@@ -5474,17 +5216,10 @@ static struct setup_menu_test setup_menu_data_6101 = {
.pdu_len = sizeof(setup_menu_6101),
.qualifier = 0x00,
.alpha_id = "Toolkit Menu",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.text_attr = {
.len = 4,
@@ -5502,21 +5237,11 @@ static struct setup_menu_test setup_menu_data_711 = {
.pdu_len = sizeof(setup_menu_711),
.qualifier = 0x00,
.alpha_id = "ЗДРАВСТВУЙТЕ",
- .items[0] = {
- .id = 1,
- .text = "ЗДРАВСТВУЙТЕ1"
- },
- .items[1] = {
- .id = 2,
- .text = "ЗДРАВСТВУЙТЕ2"
- },
- .items[2] = {
- .id = 3,
- .text = "ЗДРАВСТВУЙТЕ3"
- },
- .items[3] = {
- .id = 4,
- .text = "ЗДРАВСТВУЙТЕ4"
+ .items = {
+ { .id = 1, .text = "ЗДРАВСТВУЙТЕ1" },
+ { .id = 2, .text = "ЗДРАВСТВУЙТЕ2" },
+ { .id = 3, .text = "ЗДРАВСТВУЙТЕ3" },
+ { .id = 4, .text = "ЗДРАВСТВУЙТЕ4" },
}
};
@@ -5525,13 +5250,9 @@ static struct setup_menu_test setup_menu_data_712 = {
.pdu_len = sizeof(setup_menu_712),
.qualifier = 0x00,
.alpha_id = "ЗДРАВСТВУЙТЕ",
- .items[0] = {
- .id = 0x11,
- .text = "ЗДРАВСТВУЙТЕ5"
- },
- .items[1] = {
- .id = 0x12,
- .text = "ЗДРАВСТВУЙТЕ6"
+ .items = {
+ { .id = 0x11, .text = "ЗДРАВСТВУЙТЕ5" },
+ { .id = 0x12, .text = "ЗДРАВСТВУЙТЕ6" },
}
};
@@ -5546,21 +5267,11 @@ static struct setup_menu_test setup_menu_data_811 = {
.pdu_len = sizeof(setup_menu_811),
.qualifier = 0x00,
.alpha_id = "工具箱单",
- .items[0] = {
- .id = 1,
- .text = "项目一"
- },
- .items[1] = {
- .id = 2,
- .text = "项目二"
- },
- .items[2] = {
- .id = 3,
- .text = "项目三"
- },
- .items[3] = {
- .id = 4,
- .text = "项目四"
+ .items = {
+ { .id = 1, .text = "项目一" },
+ { .id = 2, .text = "项目二" },
+ { .id = 3, .text = "项目三" },
+ { .id = 4, .text = "项目四" },
}
};
@@ -5569,13 +5280,9 @@ static struct setup_menu_test setup_menu_data_812 = {
.pdu_len = sizeof(setup_menu_812),
.qualifier = 0x00,
.alpha_id = "工具箱单",
- .items[0] = {
- .id = 0x11,
- .text = "一"
- },
- .items[1] = {
- .id = 0x12,
- .text = "二"
+ .items = {
+ { .id = 0x11, .text = "一" },
+ { .id = 0x12, .text = "二" },
}
};
@@ -5590,21 +5297,11 @@ static struct setup_menu_test setup_menu_data_911 = {
.pdu_len = sizeof(setup_menu_911),
.qualifier = 0x00,
.alpha_id = "80ル0",
- .items[0] = {
- .id = 1,
- .text = "80ル1"
- },
- .items[1] = {
- .id = 2,
- .text = "80ル2"
- },
- .items[2] = {
- .id = 3,
- .text = "80ル3"
- },
- .items[3] = {
- .id = 4,
- .text = "80ル4"
+ .items = {
+ { .id = 1, .text = "80ル1" },
+ { .id = 2, .text = "80ル2" },
+ { .id = 3, .text = "80ル3" },
+ { .id = 4, .text = "80ル4" },
}
};
@@ -5613,13 +5310,9 @@ static struct setup_menu_test setup_menu_data_912 = {
.pdu_len = sizeof(setup_menu_912),
.qualifier = 0x00,
.alpha_id = "80ル0",
- .items[0] = {
- .id = 0x11,
- .text = "80ル5"
- },
- .items[1] = {
- .id = 0x12,
- .text = "80ル6"
+ .items = {
+ { .id = 0x11, .text = "80ル5" },
+ { .id = 0x12, .text = "80ル6" },
}
};
@@ -6469,21 +6162,11 @@ static struct select_item_test select_item_data_111 = {
.pdu_len = sizeof(select_item_111),
.qualifier = 0x00,
.alpha_id = "Toolkit Select",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
- },
- .items[3] = {
- .id = 4,
- .text = "Item 4"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
+ { .id = 4, .text = "Item 4" },
}
};
@@ -6492,125 +6175,37 @@ static struct select_item_test select_item_data_121 = {
.pdu_len = sizeof(select_item_121),
.qualifier = 0x00,
.alpha_id = "LargeMenu1",
- .items[0] = {
- .id = 0x50,
- .text = "Zero"
- },
- .items[1] = {
- .id = 0x4F,
- .text = "One"
- },
- .items[2] = {
- .id = 0x4E,
- .text = "Two"
- },
- .items[3] = {
- .id = 0x4D,
- .text = "Three"
- },
- .items[4] = {
- .id = 0x4C,
- .text = "Four"
- },
- .items[5] = {
- .id = 0x4B,
- .text = "Five"
- },
- .items[6] = {
- .id = 0x4A,
- .text = "Six"
- },
- .items[7] = {
- .id = 0x49,
- .text = "Seven"
- },
- .items[8] = {
- .id = 0x48,
- .text = "Eight"
- },
- .items[9] = {
- .id = 0x47,
- .text = "Nine"
- },
- .items[10] = {
- .id = 0x46,
- .text = "Alpha"
- },
- .items[11] = {
- .id = 0x45,
- .text = "Bravo"
- },
- .items[12] = {
- .id = 0x44,
- .text = "Charlie"
- },
- .items[13] = {
- .id = 0x43,
- .text = "Delta"
- },
- .items[14] = {
- .id = 0x42,
- .text = "Echo"
- },
- .items[15] = {
- .id = 0x41,
- .text = "Fox-trot"
- },
- .items[16] = {
- .id = 0x40,
- .text = "Black"
- },
- .items[17] = {
- .id = 0x3F,
- .text = "Brown"
- },
- .items[18] = {
- .id = 0x3E,
- .text = "Red"
- },
- .items[19] = {
- .id = 0x3D,
- .text = "Orange"
- },
- .items[20] = {
- .id = 0x3C,
- .text = "Yellow"
- },
- .items[21] = {
- .id = 0x3B,
- .text = "Green"
- },
- .items[22] = {
- .id = 0x3A,
- .text = "Blue"
- },
- .items[23] = {
- .id = 0x39,
- .text = "Violet"
- },
- .items[24] = {
- .id = 0x38,
- .text = "Grey"
- },
- .items[25] = {
- .id = 0x37,
- .text = "White"
- },
- .items[26] = {
- .id = 0x36,
- .text = "milli"
- },
- .items[27] = {
- .id = 0x35,
- .text = "micro"
- },
- .items[28] = {
- .id = 0x34,
- .text = "nano"
- },
- .items[29] = {
- .id = 0x33,
- .text = "pico"
+ .items = {
+ { .id = 0x50, .text = "Zero" },
+ { .id = 0x4F, .text = "One" },
+ { .id = 0x4E, .text = "Two" },
+ { .id = 0x4D, .text = "Three" },
+ { .id = 0x4C, .text = "Four" },
+ { .id = 0x4B, .text = "Five" },
+ { .id = 0x4A, .text = "Six" },
+ { .id = 0x49, .text = "Seven" },
+ { .id = 0x48, .text = "Eight" },
+ { .id = 0x47, .text = "Nine" },
+ { .id = 0x46, .text = "Alpha" },
+ { .id = 0x45, .text = "Bravo" },
+ { .id = 0x44, .text = "Charlie" },
+ { .id = 0x43, .text = "Delta" },
+ { .id = 0x42, .text = "Echo" },
+ { .id = 0x41, .text = "Fox-trot" },
+ { .id = 0x40, .text = "Black" },
+ { .id = 0x3F, .text = "Brown" },
+ { .id = 0x3E, .text = "Red" },
+ { .id = 0x3D, .text = "Orange" },
+ { .id = 0x3C, .text = "Yellow" },
+ { .id = 0x3B, .text = "Green" },
+ { .id = 0x3A, .text = "Blue" },
+ { .id = 0x39, .text = "Violet" },
+ { .id = 0x38, .text = "Grey" },
+ { .id = 0x37, .text = "White" },
+ { .id = 0x36, .text = "milli" },
+ { .id = 0x35, .text = "micro" },
+ { .id = 0x34, .text = "nano" },
+ { .id = 0x33, .text = "pico" },
}
};
@@ -6619,33 +6214,15 @@ static struct select_item_test select_item_data_131 = {
.pdu_len = sizeof(select_item_131),
.qualifier = 0x00,
.alpha_id = "LargeMenu2",
- .items[0] = {
- .id = 0xFF,
- .text = "Call Forwarding Unconditional"
- },
- .items[1] = {
- .id = 0xFE,
- .text = "Call Forwarding On User Busy"
- },
- .items[2] = {
- .id = 0xFD,
- .text = "Call Forwarding On No Reply"
- },
- .items[3] = {
- .id = 0xFC,
- .text = "Call Forwarding On User Not Reachable"
- },
- .items[4] = {
- .id = 0xFB,
- .text = "Barring Of All Outgoing Calls"
- },
- .items[5] = {
- .id = 0xFA,
- .text = "Barring Of All Outgoing International Calls"
- },
- .items[6] = {
- .id = 0xF9,
- .text = "CLI Presentation"
+ .items = {
+ { .id = 0xFF, .text = "Call Forwarding Unconditional" },
+ { .id = 0xFE, .text = "Call Forwarding On User Busy" },
+ { .id = 0xFD, .text = "Call Forwarding On No Reply" },
+ { .id = 0xFC, .text = "Call Forwarding On User Not Reachable" },
+ { .id = 0xFB, .text = "Barring Of All Outgoing Calls" },
+ { .id = 0xFA,
+ .text = "Barring Of All Outgoing International Calls" },
+ { .id = 0xF9, .text = "CLI Presentation" },
}
};
@@ -6654,13 +6231,9 @@ static struct select_item_test select_item_data_141 = {
.pdu_len = sizeof(select_item_141),
.qualifier = 0x00,
.alpha_id = "Select Item",
- .items[0] = {
- .id = 0x11,
- .text = "One"
- },
- .items[1] = {
- .id = 0x12,
- .text = "Two"
+ .items = {
+ { .id = 0x11, .text = "One" },
+ { .id = 0x12, .text = "Two" },
}
};
@@ -6672,9 +6245,8 @@ static struct select_item_test select_item_data_151 = {
"may choose one. Each item comprises a short identifier (used "
"to indicate the selection) and a text string. Optionally the "
"SIM may include an alpha identifier. The alpha identifier i",
- .items[0] = {
- .id = 0x01,
- .text = "Y"
+ .items = {
+ { .id = 0x01, .text = "Y" },
}
};
@@ -6683,33 +6255,14 @@ static struct select_item_test select_item_data_161 = {
.pdu_len = sizeof(select_item_161),
.qualifier = 0x00,
.alpha_id = "0LargeMenu",
- .items[0] = {
- .id = 0xFF,
- .text = "1 Call Forward Unconditional"
- },
- .items[1] = {
- .id = 0xFE,
- .text = "2 Call Forward On User Busy"
- },
- .items[2] = {
- .id = 0xFD,
- .text = "3 Call Forward On No Reply"
- },
- .items[3] = {
- .id = 0xFC,
- .text = "4 Call Forward On User Not Reachable"
- },
- .items[4] = {
- .id = 0xFB,
- .text = "5 Barring Of All Outgoing Calls"
- },
- .items[5] = {
- .id = 0xFA,
- .text = "6 Barring Of All Outgoing Int Calls"
- },
- .items[6] = {
- .id = 0xF9,
- .text = "7 CLI Presentation"
+ .items = {
+ { .id = 0xFF, .text = "1 Call Forward Unconditional" },
+ { .id = 0xFE, .text = "2 Call Forward On User Busy" },
+ { .id = 0xFD, .text = "3 Call Forward On No Reply" },
+ { .id = 0xFC, .text = "4 Call Forward On User Not Reachable" },
+ { .id = 0xFB, .text = "5 Barring Of All Outgoing Calls" },
+ { .id = 0xFA, .text = "6 Barring Of All Outgoing Int Calls" },
+ { .id = 0xF9, .text = "7 CLI Presentation" },
}
};
@@ -6718,17 +6271,10 @@ static struct select_item_test select_item_data_211 = {
.pdu_len = sizeof(select_item_211),
.qualifier = 0x00,
.alpha_id = "Toolkit Select",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.next_act = {
.list = { STK_COMMAND_TYPE_SEND_SMS,
@@ -6743,17 +6289,10 @@ static struct select_item_test select_item_data_311 = {
.pdu_len = sizeof(select_item_311),
.qualifier = 0x00,
.alpha_id = "Toolkit Select",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.item_id = 0x02
};
@@ -6763,17 +6302,10 @@ static struct select_item_test select_item_data_411 = {
.pdu_len = sizeof(select_item_411),
.qualifier = 0x80,
.alpha_id = "Toolkit Select",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
}
};
@@ -6782,17 +6314,10 @@ static struct select_item_test select_item_data_511 = {
.pdu_len = sizeof(select_item_511),
.qualifier = 0x00,
.alpha_id = "Toolkit Select",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.icon_id = {
.qualifier = STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY,
@@ -6810,17 +6335,10 @@ static struct select_item_test select_item_data_521 = {
.pdu_len = sizeof(select_item_521),
.qualifier = 0x00,
.alpha_id = "Toolkit Select",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
},
.icon_id = {
.qualifier = STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY,
@@ -6838,17 +6356,10 @@ static struct select_item_test select_item_data_611 = {
.pdu_len = sizeof(select_item_611),
.qualifier = 0x03,
.alpha_id = "Toolkit Select",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
}
};
@@ -6857,17 +6368,10 @@ static struct select_item_test select_item_data_621 = {
.pdu_len = sizeof(select_item_621),
.qualifier = 0x01,
.alpha_id = "Toolkit Select",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
}
};
@@ -6876,13 +6380,9 @@ static struct select_item_test select_item_data_711 = {
.pdu_len = sizeof(select_item_711),
.qualifier = 0x04,
.alpha_id = "Toolkit Select",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
}
};
@@ -6891,17 +6391,10 @@ static struct select_item_test select_item_data_811 = {
.pdu_len = sizeof(select_item_811),
.qualifier = 0x00,
.alpha_id = "<TIME-OUT>",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
- },
- .items[2] = {
- .id = 3,
- .text = "Item 3"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
+ { .id = 3, .text = "Item 3" },
}
};
@@ -6910,13 +6403,9 @@ static struct select_item_test select_item_data_911 = {
.pdu_len = sizeof(select_item_911),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
},
.text_attr = {
.len = 4,
@@ -6933,13 +6422,9 @@ static struct select_item_test select_item_data_912 = {
.pdu_len = sizeof(select_item_912),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 2",
- .items[0] = {
- .id = 1,
- .text = "Item 3"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 4"
+ .items = {
+ { .id = 1, .text = "Item 3" },
+ { .id = 2, .text = "Item 4" },
}
};
@@ -6948,13 +6433,9 @@ static struct select_item_test select_item_data_921 = {
.pdu_len = sizeof(select_item_921),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
},
.text_attr = {
.len = 4,
@@ -6971,13 +6452,9 @@ static struct select_item_test select_item_data_922 = {
.pdu_len = sizeof(select_item_922),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 2",
- .items[0] = {
- .id = 1,
- .text = "Item 3"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 4"
+ .items = {
+ { .id = 1, .text = "Item 3" },
+ { .id = 2, .text = "Item 4" },
}
};
@@ -6986,13 +6463,9 @@ static struct select_item_test select_item_data_931 = {
.pdu_len = sizeof(select_item_931),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
},
.text_attr = {
.len = 4,
@@ -7009,13 +6482,9 @@ static struct select_item_test select_item_data_932 = {
.pdu_len = sizeof(select_item_932),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 2",
- .items[0] = {
- .id = 1,
- .text = "Item 3"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 4"
+ .items = {
+ { .id = 1, .text = "Item 3" },
+ { .id = 2, .text = "Item 4" },
}
};
@@ -7024,13 +6493,9 @@ static struct select_item_test select_item_data_941 = {
.pdu_len = sizeof(select_item_941),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
},
.text_attr = {
.len = 4,
@@ -7047,13 +6512,9 @@ static struct select_item_test select_item_data_942 = {
.pdu_len = sizeof(select_item_942),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 2",
- .items[0] = {
- .id = 1,
- .text = "Item 3"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 4"
+ .items = {
+ { .id = 1, .text = "Item 3" },
+ { .id = 2, .text = "Item 4" },
},
.text_attr = {
.len = 4,
@@ -7070,13 +6531,9 @@ static struct select_item_test select_item_data_943 = {
.pdu_len = sizeof(select_item_943),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 3",
- .items[0] = {
- .id = 1,
- .text = "Item 5"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 6"
+ .items = {
+ { .id = 1, .text = "Item 5" },
+ { .id = 2, .text = "Item 6" },
}
};
@@ -7085,13 +6542,9 @@ static struct select_item_test select_item_data_951 = {
.pdu_len = sizeof(select_item_951),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
},
.text_attr = {
.len = 4,
@@ -7108,13 +6561,9 @@ static struct select_item_test select_item_data_952 = {
.pdu_len = sizeof(select_item_952),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 2",
- .items[0] = {
- .id = 1,
- .text = "Item 3"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 4"
+ .items = {
+ { .id = 1, .text = "Item 3" },
+ { .id = 2, .text = "Item 4" },
},
.text_attr = {
.len = 4,
@@ -7131,13 +6580,9 @@ static struct select_item_test select_item_data_953 = {
.pdu_len = sizeof(select_item_953),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 3",
- .items[0] = {
- .id = 1,
- .text = "Item 5"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 6"
+ .items = {
+ { .id = 1, .text = "Item 5" },
+ { .id = 2, .text = "Item 6" },
}
};
@@ -7146,13 +6591,9 @@ static struct select_item_test select_item_data_961 = {
.pdu_len = sizeof(select_item_961),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
},
.text_attr = {
.len = 4,
@@ -7169,13 +6610,9 @@ static struct select_item_test select_item_data_962 = {
.pdu_len = sizeof(select_item_962),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 2",
- .items[0] = {
- .id = 1,
- .text = "Item 3"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 4"
+ .items = {
+ { .id = 1, .text = "Item 3" },
+ { .id = 2, .text = "Item 4" },
},
.text_attr = {
.len = 4,
@@ -7192,13 +6629,9 @@ static struct select_item_test select_item_data_963 = {
.pdu_len = sizeof(select_item_963),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 3",
- .items[0] = {
- .id = 1,
- .text = "Item 5"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 6"
+ .items = {
+ { .id = 1, .text = "Item 5" },
+ { .id = 2, .text = "Item 6" },
}
};
@@ -7207,13 +6640,9 @@ static struct select_item_test select_item_data_971 = {
.pdu_len = sizeof(select_item_971),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
},
.text_attr = {
.len = 4,
@@ -7230,13 +6659,9 @@ static struct select_item_test select_item_data_972 = {
.pdu_len = sizeof(select_item_972),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 2",
- .items[0] = {
- .id = 1,
- .text = "Item 3"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 4"
+ .items = {
+ { .id = 1, .text = "Item 3" },
+ { .id = 2, .text = "Item 4" },
},
.text_attr = {
.len = 4,
@@ -7253,13 +6678,9 @@ static struct select_item_test select_item_data_973 = {
.pdu_len = sizeof(select_item_973),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 3",
- .items[0] = {
- .id = 1,
- .text = "Item 5"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 6"
+ .items = {
+ { .id = 1, .text = "Item 5" },
+ { .id = 2, .text = "Item 6" },
}
};
@@ -7268,13 +6689,9 @@ static struct select_item_test select_item_data_981 = {
.pdu_len = sizeof(select_item_981),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
},
.text_attr = {
.len = 4,
@@ -7291,13 +6708,9 @@ static struct select_item_test select_item_data_982 = {
.pdu_len = sizeof(select_item_982),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 2",
- .items[0] = {
- .id = 1,
- .text = "Item 3"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 4"
+ .items = {
+ { .id = 1, .text = "Item 3" },
+ { .id = 2, .text = "Item 4" },
},
.text_attr = {
.len = 4,
@@ -7314,13 +6727,9 @@ static struct select_item_test select_item_data_983 = {
.pdu_len = sizeof(select_item_983),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 3",
- .items[0] = {
- .id = 1,
- .text = "Item 5"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 6"
+ .items = {
+ { .id = 1, .text = "Item 5" },
+ { .id = 2, .text = "Item 6" },
}
};
@@ -7329,13 +6738,9 @@ static struct select_item_test select_item_data_991 = {
.pdu_len = sizeof(select_item_991),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
},
.text_attr = {
.len = 4,
@@ -7352,13 +6757,9 @@ static struct select_item_test select_item_data_992 = {
.pdu_len = sizeof(select_item_992),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 2",
- .items[0] = {
- .id = 1,
- .text = "Item 3"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 4"
+ .items = {
+ { .id = 1, .text = "Item 3" },
+ { .id = 2, .text = "Item 4" },
},
.text_attr = {
.len = 4,
@@ -7375,13 +6776,9 @@ static struct select_item_test select_item_data_993 = {
.pdu_len = sizeof(select_item_993),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 3",
- .items[0] = {
- .id = 1,
- .text = "Item 5"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 6"
+ .items = {
+ { .id = 1, .text = "Item 5" },
+ { .id = 2, .text = "Item 6" },
}
};
@@ -7390,13 +6787,9 @@ static struct select_item_test select_item_data_9101 = {
.pdu_len = sizeof(select_item_9101),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 1",
- .items[0] = {
- .id = 1,
- .text = "Item 1"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 2"
+ .items = {
+ { .id = 1, .text = "Item 1" },
+ { .id = 2, .text = "Item 2" },
},
.text_attr = {
.len = 4,
@@ -7413,13 +6806,9 @@ static struct select_item_test select_item_data_9102 = {
.pdu_len = sizeof(select_item_9102),
.qualifier = 0x00,
.alpha_id = "Toolkit Select 2",
- .items[0] = {
- .id = 1,
- .text = "Item 3"
- },
- .items[1] = {
- .id = 2,
- .text = "Item 4"
+ .items = {
+ { .id = 1, .text = "Item 3" },
+ { .id = 2, .text = "Item 4" },
}
};
@@ -7428,17 +6817,10 @@ static struct select_item_test select_item_data_1011 = {
.pdu_len = sizeof(select_item_1011),
.qualifier = 0x00,
.alpha_id = "ЗДРАВСТВУЙТЕ",
- .items[0] = {
- .id = 1,
- .text = "ЗДРАВСТВУЙТЕ1"
- },
- .items[1] = {
- .id = 2,
- .text = "ЗДРАВСТВУЙТЕ2"
- },
- .items[2] = {
- .id = 3,
- .text = "ЗДРАВСТВУЙТЕ3"
+ .items = {
+ { .id = 1, .text = "ЗДРАВСТВУЙТЕ1" },
+ { .id = 2, .text = "ЗДРАВСТВУЙТЕ2" },
+ { .id = 3, .text = "ЗДРАВСТВУЙТЕ3" },
}
};
@@ -7447,17 +6829,10 @@ static struct select_item_test select_item_data_1021 = {
.pdu_len = sizeof(select_item_1021),
.qualifier = 0x00,
.alpha_id = "ЗДРАВСТВУЙТЕ",
- .items[0] = {
- .id = 1,
- .text = "ЗДРАВСТВУЙТЕ1"
- },
- .items[1] = {
- .id = 2,
- .text = "ЗДРАВСТВУЙТЕ2"
- },
- .items[2] = {
- .id = 3,
- .text = "ЗДРАВСТВУЙТЕ3"
+ .items = {
+ { .id = 1, .text = "ЗДРАВСТВУЙТЕ1" },
+ { .id = 2, .text = "ЗДРАВСТВУЙТЕ2" },
+ { .id = 3, .text = "ЗДРАВСТВУЙТЕ3" },
}
};
@@ -7466,17 +6841,10 @@ static struct select_item_test select_item_data_1031 = {
.pdu_len = sizeof(select_item_1031),
.qualifier = 0x00,
.alpha_id = "ЗДРАВСТВУЙТЕ",
- .items[0] = {
- .id = 1,
- .text = "ЗДРАВСТВУЙТЕ1"
- },
- .items[1] = {
- .id = 2,
- .text = "ЗДРАВСТВУЙТЕ2"
- },
- .items[2] = {
- .id = 3,
- .text = "ЗДРАВСТВУЙТЕ3"
+ .items = {
+ { .id = 1, .text = "ЗДРАВСТВУЙТЕ1" },
+ { .id = 2, .text = "ЗДРАВСТВУЙТЕ2" },
+ { .id = 3, .text = "ЗДРАВСТВУЙТЕ3" },
}
};
@@ -7485,21 +6853,11 @@ static struct select_item_test select_item_data_1111 = {
.pdu_len = sizeof(select_item_1111),
.qualifier = 0x00,
.alpha_id = "工具箱选择",
- .items[0] = {
- .id = 1,
- .text = "项目一"
- },
- .items[1] = {
- .id = 2,
- .text = "项目二"
- },
- .items[2] = {
- .id = 3,
- .text = "项目三"
- },
- .items[3] = {
- .id = 4,
- .text = "项目四"
+ .items = {
+ { .id = 1, .text = "项目一" },
+ { .id = 2, .text = "项目二" },
+ { .id = 3, .text = "项目三" },
+ { .id = 4, .text = "项目四" },
}
};
@@ -7508,17 +6866,10 @@ static struct select_item_test select_item_data_1211 = {
.pdu_len = sizeof(select_item_1211),
.qualifier = 0x00,
.alpha_id = "80ル0",
- .items[0] = {
- .id = 1,
- .text = "80ル1"
- },
- .items[1] = {
- .id = 2,
- .text = "80ル2"
- },
- .items[2] = {
- .id = 3,
- .text = "80ル3"
+ .items = {
+ { .id = 1, .text = "80ル1" },
+ { .id = 2, .text = "80ル2" },
+ { .id = 3, .text = "80ル3" },
}
};
@@ -7527,17 +6878,10 @@ static struct select_item_test select_item_data_1221 = {
.pdu_len = sizeof(select_item_1221),
.qualifier = 0x00,
.alpha_id = "81ル0",
- .items[0] = {
- .id = 1,
- .text = "81ル1"
- },
- .items[1] = {
- .id = 2,
- .text = "81ル2"
- },
- .items[2] = {
- .id = 3,
- .text = "81ル3"
+ .items = {
+ { .id = 1, .text = "81ル1" },
+ { .id = 2, .text = "81ル2" },
+ { .id = 3, .text = "81ル3" },
}
};
@@ -7546,17 +6890,10 @@ static struct select_item_test select_item_data_1231 = {
.pdu_len = sizeof(select_item_1231),
.qualifier = 0x00,
.alpha_id = "82ル0",
- .items[0] = {
- .id = 1,
- .text = "82ル1"
- },
- .items[1] = {
- .id = 2,
- .text = "82ル2"
- },
- .items[2] = {
- .id = 3,
- .text = "82ル3"
+ .items = {
+ { .id = 1, .text = "82ル1" },
+ { .id = 2, .text = "82ル2" },
+ { .id = 3, .text = "82ル3" },
}
};
@@ -8967,10 +8304,10 @@ static struct refresh_test refresh_data_121 = {
.pdu = refresh_121,
.pdu_len = sizeof(refresh_121),
.qualifier = 0x01,
- .file_list[0] = {
+ .file_list = {{
.len = 4,
.file = { 0x3F, 0x00, 0x2F, 0xE2 }
- }
+ }}
};
static struct refresh_test refresh_data_151 = {
--
1.7.1.86.g0e460.dirty
10 years, 10 months
[PATCH v4 1/2] atmodem: remove CGACT command
by Kalle Valo
It's enough that we shutdown PPP, no need to send CGACT after that.
Recommended by Denis.
---
drivers/atmodem/gprs-context.c | 51 +++++++++++++---------------------------
1 files changed, 16 insertions(+), 35 deletions(-)
diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index ba5f0c0..9b32d59 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -65,22 +65,6 @@ struct gprs_context_data {
void *cb_data; /* Callback data */
};
-static void at_cgact_down_cb(gboolean ok, GAtResult *result, gpointer user_data)
-{
- struct cb_data *cbd = user_data;
- ofono_gprs_context_cb_t cb = cbd->cb;
- struct ofono_gprs_context *gc = cbd->user;
- struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
- struct ofono_error error;
-
- if (ok)
- gcd->active_context = 0;
-
- decode_at_error(&error, g_at_result_final_response(result));
-
- cb(&error, cbd->data);
-}
-
static void ppp_connect(const char *interface, const char *ip,
const char *dns1, const char *dns2,
gpointer user_data)
@@ -104,13 +88,21 @@ static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
struct ofono_gprs_context *gc = user_data;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
- if (gcd->state == STATE_ENABLING) {
+ DBG("");
+
+ switch (gcd->state) {
+ case STATE_ENABLING:
CALLBACK_WITH_FAILURE(gcd->up_cb, NULL, FALSE, NULL,
NULL, NULL, NULL, gcd->cb_data);
- return;
+ break;
+ case STATE_DISABLING:
+ CALLBACK_WITH_SUCCESS(gcd->down_cb, gcd->cb_data);
+ break;
+ default:
+ ofono_gprs_context_deactivated(gc, gcd->active_context);
+ break;
}
- ofono_gprs_context_deactivated(gc, gcd->active_context);
gcd->active_context = 0;
gcd->state = STATE_IDLE;
}
@@ -227,25 +219,14 @@ static void at_gprs_deactivate_primary(struct ofono_gprs_context *gc,
ofono_gprs_context_cb_t cb, void *data)
{
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
- struct cb_data *cbd = cb_data_new(cb, data);
- char buf[64];
-
- if (!cbd)
- goto error;
-
- cbd->user = gc;
- snprintf(buf, sizeof(buf), "AT+CGACT=0,%u", id);
+ DBG("");
- if (g_at_chat_send(gcd->chat, buf, none_prefix,
- at_cgact_down_cb, cbd, g_free) > 0)
- return;
-
-error:
- if (cbd)
- g_free(cbd);
+ gcd->state = STATE_DISABLING;
+ gcd->down_cb = cb;
+ gcd->cb_data = data;
- CALLBACK_WITH_FAILURE(cb, data);
+ g_at_ppp_shutdown(gcd->ppp);
}
static int at_gprs_context_probe(struct ofono_gprs_context *gc,
10 years, 10 months