[PATCH] mbm: poll SIM status when initializing
by Pekka.Pessi@nokia.com
From: Pekka Pessi <Pekka.Pessi(a)nokia.com>
---
plugins/mbm.c | 39 +++++++++++++++++++++++++++++++++++----
1 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/plugins/mbm.c b/plugins/mbm.c
index 864b0df..9e63005 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
+#include <string.h>
#include <glib.h>
#include <gatchat.h>
@@ -54,6 +55,8 @@ static const char *none_prefix[] = { NULL };
struct mbm_data {
GAtChat *modem_port;
GAtChat *data_port;
+ guint sim_poll;
+ guint sim_polled;
gboolean have_sim;
};
@@ -82,6 +85,10 @@ static void mbm_remove(struct ofono_modem *modem)
g_at_chat_unref(data->data_port);
g_at_chat_unref(data->modem_port);
+
+ if (data->sim_poll > 0)
+ g_source_remove(data->sim_poll);
+
g_free(data);
}
@@ -92,6 +99,8 @@ static void mbm_debug(const char *str, void *user_data)
ofono_info("%s %s", prefix, str);
}
+static gboolean init_simpin_check(gpointer user_data);
+
static void simpin_check(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
@@ -99,17 +108,40 @@ static void simpin_check(gboolean ok, GAtResult *result, gpointer user_data)
DBG("");
- /* Modem returns error if there is no SIM in slot */
+ /* Modem returns +CME ERROR: 10 if SIM is not ready. */
+ if (!ok && result->final_or_pdu &&
+ !strcmp(result->final_or_pdu, "+CME ERROR: 10") &&
+ data->sim_polled++ < 5) {
+ data->sim_poll =
+ g_timeout_add_seconds(1, init_simpin_check, modem);
+ return;
+ }
+
+ data->sim_polled = 0;
+
+ /* Modem returns ERROR if there is no SIM in slot. */
data->have_sim = ok;
ofono_modem_set_powered(modem, TRUE);
}
-static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
+static gboolean init_simpin_check(gpointer user_data)
{
struct ofono_modem *modem = user_data;
struct mbm_data *data = ofono_modem_get_data(modem);
+ data->sim_poll = 0;
+
+ g_at_chat_send(data->modem_port, "AT+CPIN?", cpin_prefix,
+ simpin_check, modem, NULL);
+
+ return FALSE;
+}
+
+static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+
DBG("");
if (!ok) {
@@ -117,8 +149,7 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
return;
}
- g_at_chat_send(data->modem_port, "AT+CPIN?", cpin_prefix,
- simpin_check, modem, NULL);
+ init_simpin_check(modem);
}
static void cfun_query(gboolean ok, GAtResult *result, gpointer user_data)
--
1.7.0.4
12 years
[PATCH 1/6] stk: Add Agent register/unregister methods and logic.
by Andrzej Zaborowski
The interface is mostly unchanged since
http://lists.ofono.org/pipermail/ofono/2010-June/003040.html
but Timeout property is removed and set to 10 minutes and an agent
disconnect sends a User Ended Session response. If no agent is
registered when the card sends a command for the UI, a User Ended
Session is sent back immediately. This has made the code a little
shorter. The "proactive session interaction with terminal display"
(TS 102.223 Section 6.9) is also more correctly implemented now.
This patch adds a skeleton that command implementations use in the
subsequent patches.
org.ofono.SimApplicationAgent
Methods
(int item, bool help) or GoBack/Terminate Menu(string title,
array{string} items, bool has_help, bool
soft_key_preferred, int default_item, bool is_main_menu)
Handles both Set Up Menu type of menu and Select Item
since they're similar. The agent can return GoBack or
Terminate if is_main_menu is False. The agent may
decide to release the display when it receives a main
menu request following an event other than a GoBack
response. default_item may be -1 meaning no default is
given.
Ok/GoBack/Terminate DisplayText(string text, bool
confirmation, bool urgent, bool navigation)
The UI should show the message, optionally asking the
user for confirmation. If navigation is false, the
returned value will have no effect. If confirmation is
false it is optional whether the user can clear the
message through MMI action (if so, the agent should
send a reply on user MMI action). Frames are not
supported currently. A low priority message should
only be shown when the screen is only used for idle
text display at the moment. A high priority message
should be shown when the screen is not used for other
high priority message such as low battery or incoming
call information. (Should there also be a "Screen busy"
reply so we can pass this information to SIM app, as
mandated by the spec?)
string/Back/Terminate/Help GetKey(string message, string charset,
bool help_available, bool single_key)
charset is one of:
"yesno" - response needs to be "yes" or "no"
"digit" - one of 0-9, *, #, +
"gsm" - only characters from the GSM SMS charset
"any" - UCS2 characters
single_key indicates that only characters from the device's
key faces are allowed (e.g. no "+" allowed if device only
has a basic keypad), and that the key should be returned
without being shown on screen or waiting for any kind of
user confirmation.
string/Back/Terminate/Help GetText(string message, string default,
string charset, byte min, byte max, bool
help_available, bool password)
charset is one of:
"digit" - one of 0-9, *, #, +
"gsm" - only characters from the GSM SMS charset
"any" - UCS2 characters
The returned string must be between min and max characters long.
The default value should be used as the initial value of the
text field being edited by user. If password is True, individual
characters entered must not be revealed on the screen, but
indication of new characters can be given, for example by
showing them as '*'.
void Cancel(void)
Cancels a method call in progress, usually due to
user taking too long to respond (timeout defined
by the SIM application or manufacturer defined) or
session termination or other events. No reply to
the cancelled call is expected.
void Release(void)
Agent is being released, possibly because of ofono
terminating, SimToolkit interface torn down or modem off.
Agent is unregistered, no UnregisterAgent call is
expected.
org.ofono.SimToolkit
Methods
void RegisterAgent(object)
void UnregisterAgent(object)
---
src/stk.c | 346 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 346 insertions(+), 0 deletions(-)
diff --git a/src/stk.c b/src/stk.c
index 556dc68..28a1beb 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -46,6 +46,28 @@ struct stk_timer {
time_t start;
};
+enum stk_agent_result {
+ STK_AGENT_RESULT_OK,
+ STK_AGENT_RESULT_HELP,
+ STK_AGENT_RESULT_BACK,
+ STK_AGENT_RESULT_TERMINATE,
+ STK_AGENT_RESULT_TIMEOUT,
+ STK_AGENT_RESULT_CANCEL,
+};
+
+struct stk_app_agent {
+ char *path;
+ char *bus;
+ DBusMessage *msg;
+ DBusPendingCall *call;
+ guint watch;
+ guint send_menu_source;
+ guint cmd_timeout;
+ void (*cmd_send)(struct ofono_stk *stk, DBusMessage *call);
+ void (*cmd_cb)(struct ofono_stk *stk, enum stk_agent_result result,
+ DBusMessage *reply);
+};
+
struct ofono_stk {
const struct ofono_stk_driver *driver;
void *driver_data;
@@ -57,6 +79,8 @@ struct ofono_stk {
struct stk_timer timers[8];
guint timers_source;
+ int timeout;
+ struct stk_app_agent *app_agent;
struct sms_submit_req *sms_submit_req;
char *idle_mode_text;
};
@@ -76,6 +100,11 @@ struct sms_submit_req {
#define ENVELOPE_RETRIES_DEFAULT 5
+#define OFONO_NAVIGATION_PREFIX OFONO_SERVICE ".Navigation"
+#define OFONO_NAVIGATION_GOBACK OFONO_NAVIGATION_PREFIX ".Back"
+#define OFONO_NAVIGATION_TERMINATED OFONO_NAVIGATION_PREFIX ".Terminated"
+#define OFONO_NAVIGATION_HELP OFONO_NAVIGATION_PREFIX ".Help"
+
static void envelope_queue_run(struct ofono_stk *stk);
static void timers_update(struct ofono_stk *stk);
@@ -255,8 +284,319 @@ static DBusMessage *stk_get_properties(DBusConnection *conn,
return reply;
}
+static void app_agent_request_send_cancel(struct stk_app_agent *agent)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ DBusMessage *message;
+
+ message = dbus_message_new_method_call(agent->bus, agent->path,
+ OFONO_SIM_APP_INTERFACE,
+ "Cancel");
+ if (message == NULL)
+ return;
+
+ dbus_message_set_no_reply(message, TRUE);
+
+ g_dbus_send_message(conn, message);
+}
+
+static void app_agent_request_end(struct stk_app_agent *agent)
+{
+ agent->cmd_send = NULL;
+ agent->cmd_cb = NULL;
+
+ if (agent->cmd_timeout) {
+ g_source_remove(agent->cmd_timeout);
+ agent->cmd_timeout = 0;
+ }
+
+ if (agent->msg) {
+ dbus_message_unref(agent->msg);
+ agent->msg = NULL;
+ }
+
+ if (agent->call) {
+ dbus_pending_call_cancel(agent->call);
+ dbus_pending_call_unref(agent->call);
+ agent->call = NULL;
+ }
+}
+
+static void app_agent_request_cancel(struct ofono_stk *stk)
+{
+ struct stk_app_agent *agent = stk->app_agent;
+
+ if (!agent)
+ return;
+
+ agent->cmd_cb(stk, STK_AGENT_RESULT_CANCEL, NULL);
+
+ app_agent_request_end(agent);
+
+ app_agent_request_send_cancel(agent);
+}
+
+static gboolean app_agent_request_timeout(gpointer user_data)
+{
+ struct ofono_stk *stk = user_data;
+ struct stk_app_agent *agent = stk->app_agent;
+
+ agent->cmd_timeout = 0;
+
+ agent->cmd_cb(stk, STK_AGENT_RESULT_TIMEOUT, NULL);
+
+ app_agent_request_end(agent);
+
+ app_agent_request_send_cancel(agent);
+
+ return FALSE;
+}
+
+static void app_agent_request_reply_handle(DBusPendingCall *call, void *data)
+{
+ struct ofono_stk *stk = data;
+ DBusError err;
+ DBusMessage *reply = dbus_pending_call_steal_reply(call);
+ enum stk_agent_result result = STK_AGENT_RESULT_OK;
+
+ dbus_error_init(&err);
+ if (dbus_set_error_from_message(&err, reply)) {
+ ofono_error("SimAppAgent %s replied with error %s, %s",
+ stk->app_agent ? stk->app_agent->path :
+ "(destroyed)", err.name, err.message);
+
+ if (g_str_has_prefix(err.name, OFONO_NAVIGATION_GOBACK))
+ result = STK_AGENT_RESULT_BACK;
+ else if (g_str_has_prefix(err.name, OFONO_NAVIGATION_HELP))
+ result = STK_AGENT_RESULT_HELP;
+ else
+ result = STK_AGENT_RESULT_TERMINATE;
+
+ dbus_error_free(&err);
+ }
+
+ if (stk->app_agent) {
+ stk->app_agent->cmd_cb(stk, result, reply);
+
+ app_agent_request_end(stk->app_agent);
+ }
+
+ dbus_message_unref(reply);
+}
+
+static gboolean app_agent_request_send(struct ofono_stk *stk,
+ struct stk_app_agent *agent)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+
+ /*
+ * The cmd_send callback needs to set the method name to
+ * something different than "Cancel".
+ */
+ agent->msg = dbus_message_new_method_call(agent->bus, agent->path,
+ OFONO_SIM_APP_INTERFACE,
+ "Cancel");
+ if (agent->msg == NULL) {
+ ofono_error("Couldn't make a DBusMessage");
+ return FALSE;
+ }
+
+ agent->cmd_send(stk, agent->msg);
+
+ if (dbus_connection_send_with_reply(conn,
+ agent->msg, &agent->call, INT_MAX) == FALSE ||
+ agent->call == NULL) {
+ dbus_message_unref(agent->msg);
+ agent->msg = NULL;
+
+ ofono_error("Couldn't send a method call");
+ return FALSE;
+ }
+
+ dbus_pending_call_set_notify(agent->call,
+ app_agent_request_reply_handle,
+ stk, NULL);
+
+ return TRUE;
+}
+
+static void app_agent_request_start(struct ofono_stk *stk,
+ void (*send)(struct ofono_stk *stk,
+ DBusMessage *call),
+ void (*cb)(struct ofono_stk *stk,
+ enum stk_agent_result result,
+ DBusMessage *reply),
+ int timeout)
+{
+ struct stk_app_agent *agent = stk->app_agent;
+
+ if (agent == NULL) {
+ cb(stk, STK_AGENT_RESULT_TERMINATE, NULL);
+
+ return;
+ }
+
+ if (agent->cmd_cb)
+ app_agent_request_cancel(stk);
+
+ agent->cmd_send = send;
+ agent->cmd_cb = cb;
+
+ app_agent_request_send(stk, agent);
+
+ /* Use the timeout value specified in the command, if any. */
+ if (timeout == 0)
+ timeout = stk->timeout * 1000;
+
+ if (timeout < 0)
+ return;
+
+ agent->cmd_timeout = g_timeout_add(timeout, app_agent_request_timeout,
+ stk);
+}
+
+static gboolean app_agent_send_menu(gpointer user_data)
+{
+ struct ofono_stk *stk = user_data;
+
+ stk->app_agent->send_menu_source = 0;
+
+ /* TODO */
+
+ return FALSE;
+}
+
+static void app_agent_request_cancel_no_agent(struct ofono_stk *stk,
+ struct stk_app_agent *agent)
+{
+ agent->cmd_cb(stk, STK_AGENT_RESULT_TERMINATE, NULL);
+
+ app_agent_request_end(agent);
+}
+
+static void app_agent_remove(struct ofono_stk *stk, struct stk_app_agent *agent)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+
+ if (agent->watch) {
+ DBusMessage *message;
+
+ g_dbus_remove_watch(conn, agent->watch);
+ agent->watch = 0;
+
+ if (agent->cmd_cb) {
+ app_agent_request_cancel_no_agent(stk, agent);
+
+ app_agent_request_send_cancel(agent);
+ }
+
+ message = dbus_message_new_method_call(agent->bus, agent->path,
+ OFONO_SIM_APP_INTERFACE,
+ "Release");
+ if (message) {
+ dbus_message_set_no_reply(message, TRUE);
+
+ g_dbus_send_message(conn, message);
+ }
+ } else {
+ if (agent->cmd_cb)
+ app_agent_request_cancel_no_agent(stk, agent);
+ }
+
+ if (agent->send_menu_source)
+ g_source_remove(agent->send_menu_source);
+
+ g_free(agent->path);
+ g_free(agent->bus);
+ g_free(agent);
+}
+
+static void app_agent_disconnect_cb(DBusConnection *conn, void *user_data)
+{
+ struct ofono_stk *stk = user_data;
+
+ ofono_debug("Agent exited without calling Unregister");
+
+ stk->app_agent->watch = 0;
+
+ app_agent_remove(stk, stk->app_agent);
+ stk->app_agent = NULL;
+}
+
+static struct stk_app_agent *app_agent_create(struct ofono_stk *stk,
+ const char *path,
+ const char *sender)
+{
+ struct stk_app_agent *agent = g_try_new0(struct stk_app_agent, 1);
+ DBusConnection *conn = ofono_dbus_get_connection();
+
+ if (!agent)
+ return NULL;
+
+ agent->path = g_strdup(path);
+ agent->bus = g_strdup(sender);
+
+ agent->watch = g_dbus_add_disconnect_watch(conn, sender,
+ app_agent_disconnect_cb,
+ stk, NULL);
+
+ agent->send_menu_source = g_timeout_add(0, app_agent_send_menu, stk);
+
+ return agent;
+}
+
+static DBusMessage *stk_register_agent(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct ofono_stk *stk = data;
+ const char *agent_path;
+
+ if (stk->app_agent)
+ return __ofono_error_busy(msg);
+
+ if (dbus_message_get_args(msg, NULL,
+ DBUS_TYPE_OBJECT_PATH, &agent_path,
+ DBUS_TYPE_INVALID) == FALSE)
+ return __ofono_error_invalid_args(msg);
+
+ stk->app_agent = app_agent_create(stk, agent_path,
+ dbus_message_get_sender(msg));
+ if (!stk->app_agent)
+ return __ofono_error_failed(msg);
+
+ return dbus_message_new_method_return(msg);
+}
+
+static DBusMessage *stk_unregister_agent(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct ofono_stk *stk = data;
+ const char *agent_path;
+ const char *agent_bus = dbus_message_get_sender(msg);
+
+ if (dbus_message_get_args(msg, NULL,
+ DBUS_TYPE_OBJECT_PATH, &agent_path,
+ DBUS_TYPE_INVALID) == FALSE)
+ return __ofono_error_invalid_args(msg);
+
+ if (!stk->app_agent)
+ return __ofono_error_failed(msg);
+
+ if (strcmp(stk->app_agent->path, agent_path))
+ return __ofono_error_failed(msg);
+ if (strcmp(stk->app_agent->bus, agent_bus))
+ return __ofono_error_failed(msg);
+
+ app_agent_remove(stk, stk->app_agent);
+ stk->app_agent = NULL;
+
+ return dbus_message_new_method_return(msg);
+}
+
static GDBusMethodTable stk_methods[] = {
{ "GetProperties", "", "a{sv}",stk_get_properties },
+ { "RegisterSimAppAgent", "o", "", stk_register_agent },
+ { "UnregisterSimAppAgent", "o", "", stk_unregister_agent },
{ }
};
@@ -687,6 +1027,11 @@ static void stk_unregister(struct ofono_atom *atom)
struct ofono_modem *modem = __ofono_atom_get_modem(atom);
const char *path = __ofono_atom_get_path(atom);
+ if (stk->app_agent) {
+ app_agent_remove(stk, stk->app_agent);
+ stk->app_agent = NULL;
+ }
+
if (stk->pending_cmd) {
stk_command_free(stk->pending_cmd);
stk->pending_cmd = NULL;
@@ -778,6 +1123,7 @@ void ofono_stk_register(struct ofono_stk *stk)
__ofono_atom_register(stk->atom, stk_unregister);
+ stk->timeout = 600; /* 10 minutes */
stk->envelope_q = g_queue_new();
}
--
1.7.1.86.g0e460.dirty
12 years
[PATCH] mbm: poll SIM status when initializing
by Pekka.Pessi@nokia.com
From: Pekka Pessi <Pekka.Pessi(a)nokia.com>
---
plugins/mbm.c | 28 ++++++++++++++++++++++++----
1 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/plugins/mbm.c b/plugins/mbm.c
index 864b0df..5058b7c 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
+#include <string.h>
#include <glib.h>
#include <gatchat.h>
@@ -92,6 +93,8 @@ static void mbm_debug(const char *str, void *user_data)
ofono_info("%s %s", prefix, str);
}
+static gboolean init_simpin_check(gpointer user_data);
+
static void simpin_check(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
@@ -99,17 +102,35 @@ static void simpin_check(gboolean ok, GAtResult *result, gpointer user_data)
DBG("");
- /* Modem returns error if there is no SIM in slot */
+ /* Modem returns +CME ERROR: 10 if SIM is not ready. */
+ if (!ok && result->final_or_pdu &&
+ !strcmp(result->final_or_pdu, "+CME ERROR: 10")) {
+ g_timeout_add_seconds(1, init_simpin_check, modem);
+ return;
+ }
+
+ /* Modem returns ERROR if there is no SIM in slot. */
data->have_sim = ok;
ofono_modem_set_powered(modem, TRUE);
}
-static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
+
+static gboolean init_simpin_check(gpointer user_data)
{
struct ofono_modem *modem = user_data;
struct mbm_data *data = ofono_modem_get_data(modem);
+ g_at_chat_send(data->modem_port, "AT+CPIN?", cpin_prefix,
+ simpin_check, modem, NULL);
+
+ return FALSE;
+}
+
+static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+
DBG("");
if (!ok) {
@@ -117,8 +138,7 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
return;
}
- g_at_chat_send(data->modem_port, "AT+CPIN?", cpin_prefix,
- simpin_check, modem, NULL);
+ init_simpin_check(modem);
}
static void cfun_query(gboolean ok, GAtResult *result, gpointer user_data)
--
1.7.0.4
12 years
[PATCH 0/6] Add oFono DUN emulator
by Zhenhua Zhang
Hi,
This series are the initial patches for ofono DUN emulator.
1. src/emulator.c handles emulator create, remove, enable, disable and etc..
2. plugins/dun_gw.c is the plugin similar to hfp.c. It's the interface with BlueZ serial DUN agent.
3. gatchat/test-emulator.c is the test case to test emulator without BlueZ interface.
Emulator driver is registered statically once ofonod starts up. It probes BlueZ adapter properties to create emulator on active modem that having GPRS interface.
Thanks,
Zhenhua
12 years
[PATCH 0/9] html text attribute patches
by Kristen Carlson Accardi
Changed from last version:
* incorporated feedback from latest review
* dropped invalid test from html text attributes unit test
Kristen Carlson Accardi (9):
stkutil: display text attributes as html
test-stkutil: add unit test for html text attributes
test-stkutil: add html attribute test for Display Text tests
test-stkutil: add html attribute tests for get_inkey_test
test-stkutil: add html attribute tests for get_input_test
test-stkutil: add html attribute tests for play_tone_test
test-stkutil: add html attribute test for setup_menu_test
test-stkutil: add html attribute test for select_item_test
test-stkutil: add html attribute tests for setup idle mode tests
src/stkutil.c | 225 +++++++++++++++
src/stkutil.h | 2 +
unit/test-stkutil.c | 765 ++++++++++++++++++++++++++++++++++++++++++++------
3 files changed, 900 insertions(+), 92 deletions(-)
12 years
[PATCH 1/3] Make fetch command function as external
by Yang Gu
---
Makefile.am | 1 +
drivers/atmodem/sim-poll.c | 55 +------------------------------------------
drivers/atmodem/stk.c | 51 ++++++++++++++++++++++++++++++++++++++++
drivers/atmodem/stk.h | 22 +++++++++++++++++
4 files changed, 76 insertions(+), 53 deletions(-)
create mode 100644 drivers/atmodem/stk.h
diff --git a/Makefile.am b/Makefile.am
index 24aa886..e256841 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -143,6 +143,7 @@ builtin_sources += $(gatchat_sources) \
drivers/atmodem/network-registration.c \
drivers/atmodem/sim.c \
drivers/atmodem/stk.c \
+ drivers/atmodem/stk.h \
drivers/atmodem/sim-poll.c \
drivers/atmodem/sim-poll.h \
drivers/atmodem/ussd.c \
diff --git a/drivers/atmodem/sim-poll.c b/drivers/atmodem/sim-poll.c
index f1a83e3..3f1a355 100644
--- a/drivers/atmodem/sim-poll.c
+++ b/drivers/atmodem/sim-poll.c
@@ -39,6 +39,7 @@
#include "atmodem.h"
#include "sim-poll.h"
+#include "stk.h"
struct sim_poll_data {
GAtChat *chat;
@@ -58,58 +59,6 @@ struct sim_poll_data {
static const char *csim_prefix[] = { "+CSIM:", NULL };
static gboolean sim_status_poll(gpointer user_data);
-static void sim_fetch_command(struct sim_poll_data *spd, int length);
-
-static void at_csim_fetch_cb(gboolean ok, GAtResult *result,
- gpointer user_data)
-{
- struct sim_poll_data *spd = user_data;
- GAtResultIter iter;
- const guint8 *response;
- gint rlen, len;
-
- if (!ok)
- return;
-
- g_at_result_iter_init(&iter, result);
-
- if (!g_at_result_iter_next(&iter, "+CSIM:"))
- return;
-
- if (!g_at_result_iter_next_number(&iter, &rlen))
- return;
-
- if (!g_at_result_iter_next_hexstring(&iter, &response, &len))
- return;
-
- if (rlen != len * 2 || len < 2)
- return;
-
- /* Check that SW1 indicates success */
- if (response[len - 2] != 0x90 && response[len - 2] != 0x91)
- return;
-
- if (response[len - 2] == 0x90 && response[len - 1] != 0)
- return;
-
- DBG("csim_fetch_cb: %i", len);
-
- ofono_stk_proactive_command_notify(spd->stk, len - 2, response);
-
- /* Can this happen? */
- if (response[len - 2] == 0x91)
- sim_fetch_command(spd, response[len - 1]);
-}
-
-static void sim_fetch_command(struct sim_poll_data *spd, int length)
-{
- char buf[64];
-
- snprintf(buf, sizeof(buf), "AT+CSIM=10,A0120000%02hhX", length);
-
- g_at_chat_send(spd->chat, buf, csim_prefix,
- at_csim_fetch_cb, spd, NULL);
-}
static void sim_status_poll_schedule(struct sim_poll_data *spd)
{
@@ -196,7 +145,7 @@ static void at_csim_status_cb(gboolean ok, GAtResult *result,
return;
/* We have a proactive command pending, FETCH it */
- sim_fetch_command(spd, response[len - 1]);
+ at_sim_fetch_command(spd->stk, response[len - 1]);
}
static gboolean sim_status_poll(gpointer user_data)
diff --git a/drivers/atmodem/stk.c b/drivers/atmodem/stk.c
index aede668..1283cca 100644
--- a/drivers/atmodem/stk.c
+++ b/drivers/atmodem/stk.c
@@ -38,6 +38,7 @@
#include "gatresult.h"
#include "atmodem.h"
+#include "stk.h"
struct stk_data {
GAtChat *chat;
@@ -45,6 +46,56 @@ struct stk_data {
static const char *csim_prefix[] = { "+CSIM:", NULL };
+static void csim_fetch_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct ofono_stk *stk = user_data;
+ GAtResultIter iter;
+ const guint8 *response;
+ gint rlen, len;
+
+ if (!ok)
+ return;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+CSIM:"))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &rlen))
+ return;
+
+ if (!g_at_result_iter_next_hexstring(&iter, &response, &len))
+ return;
+
+ if (rlen != len * 2 || len < 2)
+ return;
+
+ /* Check that SW1 indicates success */
+ if (response[len - 2] != 0x90 && response[len - 2] != 0x91)
+ return;
+
+ if (response[len - 2] == 0x90 && response[len - 1] != 0)
+ return;
+
+ DBG("csim_fetch_cb: %i", len);
+
+ ofono_stk_proactive_command_notify(stk, len - 2, response);
+
+ /* Can this happen? */
+ if (response[len - 2] == 0x91)
+ at_sim_fetch_command(stk, response[len - 1]);
+}
+
+void at_sim_fetch_command(struct ofono_stk *stk, int length)
+{
+ char buf[64];
+ struct stk_data *sd = ofono_stk_get_data(stk);
+
+ snprintf(buf, sizeof(buf), "AT+CSIM=10,A0120000%02hhX", length);
+ g_at_chat_send(sd->chat, buf, csim_prefix, csim_fetch_cb, stk, NULL);
+}
+
static void at_csim_envelope_cb(gboolean ok, GAtResult *result,
gpointer user_data)
{
diff --git a/drivers/atmodem/stk.h b/drivers/atmodem/stk.h
new file mode 100644
index 0000000..265ac2e
--- /dev/null
+++ b/drivers/atmodem/stk.h
@@ -0,0 +1,22 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2010 Intel Corporation. All rights reserved.
+ *
+ * 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
+ *
+ */
+
+void at_sim_fetch_command(struct ofono_stk *stk, int length);
--
1.7.0.4
12 years
[SMS D-Bus 00/23] Exports SMS over D-Bus and mis cleanups
by Inaky Perez-Gonzalez
From: Inaky Perez-Gonzalez <inaky.perez-gonzalez(a)intel.com>
Hi All
This patchset is the current state of my tree that changes the D-Bus
interface for SMS:
- adds object based management of SMS messages
- adds a cancelation operation for in-transit / pending messages
- holds messages waiting for acknoledgement (delivery report) -- this
is still not fully integrated with the code that was commited last
days (thus once the delivery arrives the message is not
automatically cleaned up as "confirmed").
- generates truly unique SMS message IDs using hashing of contents
and receiver address
- miscelaeous small cleanups / additions, carryover from a previous
submit that got neither not acked or no resolution was agreed upon
Please review and suggest what else needs to be done / changed.
Thx,
The following changes since commit 1fedd096a0ba2ce8625a9e4d1c2ce25bb8f6dfe4:
Marcel Holtmann (1):
Check sanity the MNC length value from the SIM card
are available in the git repository at:
git://gitorious.org/~inakypg/ofono/ofono-inakypg.git master
Patches follow for reviewing convenience.
Inaky Perez-Gonzalez (23):
documentation: add note about referencing standards
util.h: Add BUILD_BUG_ON() and friends for compile-time assert checking
smutil.h: add missing header file dependencies
write_file: make transaction-safe
doc: explain debugging options to -d, add a pointer in -h to manpage
SMS: introduce message ID API
introduce DECLARE_SMS_ADDR_STR()
export sms_assembly_encode_address
SMS: implement SHA256-based message IDs [incomplete]
sms: add doc about the extensions D-Bus API (not yet implemented)
struct tx_queue_entry: add fields and destructor
SMS: produce a unique, persistent name for in-transit messages
SMS: introduce bare state machine and transitions
SMS: export outgoing messages over D-Bus (skeleton)
SMS: split sms_send_message() into a D-Bus front end and an internal API
SMS: introduce wait-for-ack state and infrastructure
SMS: introduce sms_msg_cancel and its D-Bus wrapper
SMS: rename tx_queue_entry->msg to ->dbus_msg for clarity
SMS: Implement D-Bus SMS-MSG::GetProperties
SMS: send D-Bus SMS-MSG::ProperyChanged signals when message changes status
SMS: make D-Bus SendMessage and Cancel fully synchronous
SMS: set the SRR bit in outgoing PDUs if WFA is requested
sms_text_prepare: document @use_delivery_reports
HACKING | 10 +
Makefile.am | 5 +-
doc/ofonod.8 | 5 +-
doc/sms-api.txt | 94 ++++++++
doc/standards.txt | 8 +
src/main.c | 4 +-
src/sms.c | 512 +++++++++++++++++++++++++++++++++++-----
src/smsutil.c | 202 ++++++++++++++++-
src/smsutil.h | 125 ++++++++++
src/storage.c | 42 +++-
src/util.h | 28 +++
test/test-sms-msg-state-change | 24 ++
unit/test-sms-msg-id.c | 212 +++++++++++++++++
13 files changed, 1199 insertions(+), 72 deletions(-)
create mode 100644 doc/standards.txt
create mode 100755 test/test-sms-msg-state-change
create mode 100644 unit/test-sms-msg-id.c
12 years
problem when setting "VoiceNoReplyTimeout" property in call-forwarding
by s s
Hi all ,
In ofono call-forwarding use cases , i am trying to set
"VoiceNoReplyTimeout" property which is of type uint16 . below is the piece
of code
uint time_out=15;
GValue val=G_VALUE_INIT;
g_value_init(&val,G_TYPE_UINT);
GError *error=NULL;
g_value_set_uint(&val,time_out);
if(!dbus_g_proxy_call (proxy, "SetProperty", &error,
G_TYPE_STRING,"VoiceNoReplyTimeout", G_TYPE_VALUE,&val, G_TYPE_INVALID,
G_TYPE_INVALID))
{
g_print("failed\n %s ",error->message);
}
if i execute the above piece of code i am getting error ->"Invalid
arguments in method call"
i tried to look into the ofono soruce code , in that i tried to get the data
types what it is expecting , and i got with numbers 117 and 113
g_print("\n arg type %d %d \n"
,dbus_message_iter_get_arg_type(&var),DBUS_TYPE_UINT16)
when i checked the number references in DBus specification i found
UINT16 113 (ASCII 'q')
how to add an unint16 value to a GValue ?
12 years
Ofono in Maemo scratchbox--compilation failed.
by Arun Ravindran
Hi All,
I am trying to compile Ofono in Maemo Scratchbox SDK enviornment.
Here is the bootstrap-configure output:
-----------------------------------------------------------------------------------------------------------------------------------------------
[sbox-FREMANTLE_X86: ~/ofono] > ./bootstrap-configure
configure.ac: installing `./install-sh'
configure.ac: installing `./missing'
Makefile.am: installing `./compile'
Makefile.am: installing `./depcomp'
checking for a BSD-compatible install... /scratchbox/tools/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking for pkg-config... /scratchbox/tools/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for C/C++ restrict keyword... no
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking whether gcc and cc understand -c and -o together... yes
checking whether gcc accepts -fPIE... yes
checking for a BSD-compatible install... /scratchbox/tools/bin/install -c
checking for a sed that does not truncate output...
/scratchbox/tools/bin/sed
checking for gawk... (cached) gawk
checking build system type... i486-pc-linux-gnu
checking host system type... i486-pc-linux-gnu
checking for a sed that does not truncate output...
/scratchbox/tools/bin/sed
checking for grep that handles long lines and -e...
/scratchbox/tools/bin/grep
checking for egrep... /scratchbox/tools/bin/grep -E
checking for ld used by gcc...
/scratchbox/compilers/cs2007q3-glibc2.5-i486/i486-pc-linux-gnu/bin/ld
checking if the linker
(/scratchbox/compilers/cs2007q3-glibc2.5-i486/i486-pc-linux-gnu/bin/ld) is
GNU ld... yes
checking for
/scratchbox/compilers/cs2007q3-glibc2.5-i486/i486-pc-linux-gnu/bin/ld option
to reload object files... -r
checking for BSD-compatible nm... /scratchbox/compilers/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 98304
checking command to parse /scratchbox/compilers/bin/nm -B output from gcc
object... failed
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker
(/scratchbox/compilers/cs2007q3-glibc2.5-i486/i486-pc-linux-gnu/bin/ld)
supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating libtool
checking for BSD-compatible nm... (cached) /scratchbox/compilers/bin/nm -B
checking for signalfd in -lc... yes
checking for dlopen in -ldl... yes
checking for GLIB... yes
checking for DBUS... yes
checking for dbus_watch_get_unix_fd in -ldbus-1... yes
checking for dbus_connection_can_send_type in -ldbus-1... no
checking for UDEV... yes
checking for CAPNG... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating include/version.h
config.status: creating config.h
config.status: executing depfiles commands
-------------------------------------------------------------------
But while running make, i get the following error.
[sbox-FREMANTLE_X86: ~/ofono] > make
make --no-print-directory all-am
include/ofono
make[1]: include/ofono: Command not found
make[1]: *** [include/ofono/log.h] Error 127
make: *** [all] Error 2
----------------------------------------------------------------------------
What could be the reason? Could anyone help?
Regards
Arun
12 years
[PATCH 1/3] Make fetch command function as external
by Yang Gu
---
Makefile.am | 1 +
drivers/atmodem/sim-poll.c | 56 ++-----------------------------------------
drivers/atmodem/stk.c | 53 +++++++++++++++++++++++++++++++++++++++++
drivers/atmodem/stk.h | 22 +++++++++++++++++
4 files changed, 79 insertions(+), 53 deletions(-)
create mode 100644 drivers/atmodem/stk.h
diff --git a/Makefile.am b/Makefile.am
index 24aa886..e256841 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -143,6 +143,7 @@ builtin_sources += $(gatchat_sources) \
drivers/atmodem/network-registration.c \
drivers/atmodem/sim.c \
drivers/atmodem/stk.c \
+ drivers/atmodem/stk.h \
drivers/atmodem/sim-poll.c \
drivers/atmodem/sim-poll.h \
drivers/atmodem/ussd.c \
diff --git a/drivers/atmodem/sim-poll.c b/drivers/atmodem/sim-poll.c
index f1a83e3..f79d6df 100644
--- a/drivers/atmodem/sim-poll.c
+++ b/drivers/atmodem/sim-poll.c
@@ -39,6 +39,7 @@
#include "atmodem.h"
#include "sim-poll.h"
+#include "stk.h"
struct sim_poll_data {
GAtChat *chat;
@@ -58,58 +59,6 @@ struct sim_poll_data {
static const char *csim_prefix[] = { "+CSIM:", NULL };
static gboolean sim_status_poll(gpointer user_data);
-static void sim_fetch_command(struct sim_poll_data *spd, int length);
-
-static void at_csim_fetch_cb(gboolean ok, GAtResult *result,
- gpointer user_data)
-{
- struct sim_poll_data *spd = user_data;
- GAtResultIter iter;
- const guint8 *response;
- gint rlen, len;
-
- if (!ok)
- return;
-
- g_at_result_iter_init(&iter, result);
-
- if (!g_at_result_iter_next(&iter, "+CSIM:"))
- return;
-
- if (!g_at_result_iter_next_number(&iter, &rlen))
- return;
-
- if (!g_at_result_iter_next_hexstring(&iter, &response, &len))
- return;
-
- if (rlen != len * 2 || len < 2)
- return;
-
- /* Check that SW1 indicates success */
- if (response[len - 2] != 0x90 && response[len - 2] != 0x91)
- return;
-
- if (response[len - 2] == 0x90 && response[len - 1] != 0)
- return;
-
- DBG("csim_fetch_cb: %i", len);
-
- ofono_stk_proactive_command_notify(spd->stk, len - 2, response);
-
- /* Can this happen? */
- if (response[len - 2] == 0x91)
- sim_fetch_command(spd, response[len - 1]);
-}
-
-static void sim_fetch_command(struct sim_poll_data *spd, int length)
-{
- char buf[64];
-
- snprintf(buf, sizeof(buf), "AT+CSIM=10,A0120000%02hhX", length);
-
- g_at_chat_send(spd->chat, buf, csim_prefix,
- at_csim_fetch_cb, spd, NULL);
-}
static void sim_status_poll_schedule(struct sim_poll_data *spd)
{
@@ -196,7 +145,7 @@ static void at_csim_status_cb(gboolean ok, GAtResult *result,
return;
/* We have a proactive command pending, FETCH it */
- sim_fetch_command(spd, response[len - 1]);
+ at_sim_fetch_command(spd->chat, spd->stk, response[len - 1]);
}
static gboolean sim_status_poll(gpointer user_data)
@@ -317,3 +266,4 @@ void atmodem_poll_enable(struct ofono_modem *modem, GAtChat *chat)
sim_watch(sim_atom,
OFONO_ATOM_WATCH_CONDITION_REGISTERED, spd);
}
+
diff --git a/drivers/atmodem/stk.c b/drivers/atmodem/stk.c
index aede668..6058d69 100644
--- a/drivers/atmodem/stk.c
+++ b/drivers/atmodem/stk.c
@@ -38,6 +38,7 @@
#include "gatresult.h"
#include "atmodem.h"
+#include "stk.h"
struct stk_data {
GAtChat *chat;
@@ -45,6 +46,58 @@ struct stk_data {
static const char *csim_prefix[] = { "+CSIM:", NULL };
+static void csim_fetch_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ GAtChat *chat = cbd->cb;
+ struct ofono_stk *stk = cbd->data;
+ GAtResultIter iter;
+ const guint8 *response;
+ gint rlen, len;
+
+ if (!ok)
+ return;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+CSIM:"))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &rlen))
+ return;
+
+ if (!g_at_result_iter_next_hexstring(&iter, &response, &len))
+ return;
+
+ if (rlen != len * 2 || len < 2)
+ return;
+
+ /* Check that SW1 indicates success */
+ if (response[len - 2] != 0x90 && response[len - 2] != 0x91)
+ return;
+
+ if (response[len - 2] == 0x90 && response[len - 1] != 0)
+ return;
+
+ DBG("csim_fetch_cb: %i", len);
+
+ ofono_stk_proactive_command_notify(stk, len - 2, response);
+
+ /* Can this happen? */
+ if (response[len - 2] == 0x91)
+ at_sim_fetch_command(chat, stk, response[len - 1]);
+}
+
+void at_sim_fetch_command(GAtChat *chat, struct ofono_stk *stk, int length)
+{
+ char buf[64];
+ struct cb_data *cbd = cb_data_new(chat, stk);
+
+ snprintf(buf, sizeof(buf), "AT+CSIM=10,A0120000%02hhX", length);
+ g_at_chat_send(chat, buf, csim_prefix, csim_fetch_cb, cbd, g_free);
+}
+
static void at_csim_envelope_cb(gboolean ok, GAtResult *result,
gpointer user_data)
{
diff --git a/drivers/atmodem/stk.h b/drivers/atmodem/stk.h
new file mode 100644
index 0000000..6e998ac
--- /dev/null
+++ b/drivers/atmodem/stk.h
@@ -0,0 +1,22 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2010 Intel Corporation. All rights reserved.
+ *
+ * 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
+ *
+ */
+
+void at_sim_fetch_command(GAtChat *chat, struct ofono_stk *stk, int length);
--
1.7.0.4
12 years