* [PATCH v2 1/4] doc: Add new STK Agent API to get digit response on single key press
2012-08-28 13:21 [PATCH v2 0/4] Immediate digit response Philippe Nunes
@ 2012-08-28 13:21 ` Philippe Nunes
2012-08-30 21:58 ` Denis Kenzior
2012-08-28 13:21 ` [PATCH v2 2/4] stkagent: Add new " Philippe Nunes
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Philippe Nunes @ 2012-08-28 13:21 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 864 bytes --]
---
doc/stk-api.txt | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/doc/stk-api.txt b/doc/stk-api.txt
index 471e5d6..6875354 100644
--- a/doc/stk-api.txt
+++ b/doc/stk-api.txt
@@ -193,6 +193,15 @@ Methods byte RequestSelection(string title, byte icon_id,
Possible Errors: [service].Error.SimToolkit.GoBack
[service].Error.SimToolkit.EndSession
+ string RequestQuickDigit(string alpha, byte icon_id)
+
+ Same as above but the entered digit shall not be
+ displayed and the response shall be sent immediately
+ after the key press. "+" is not allowed for user input.
+
+ Possible Errors: [service].Error.SimToolkit.GoBack
+ [service].Error.SimToolkit.EndSession
+
boolean RequestConfirmation(string alpha, byte icon_id)
Asks the agent to get confirmation from the user.
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v2 2/4] stkagent: Add new API to get digit response on single key press
2012-08-28 13:21 [PATCH v2 0/4] Immediate digit response Philippe Nunes
2012-08-28 13:21 ` [PATCH v2 1/4] doc: Add new STK Agent API to get digit response on single key press Philippe Nunes
@ 2012-08-28 13:21 ` Philippe Nunes
2012-08-30 22:00 ` Denis Kenzior
2012-08-28 13:21 ` [PATCH v2 3/4] stk: Ask for immediate digit response if specified by command qualifier Philippe Nunes
2012-08-28 13:21 ` [PATCH v2 4/4] test: Update with RequestQuickDigit API Philippe Nunes
3 siblings, 1 reply; 9+ messages in thread
From: Philippe Nunes @ 2012-08-28 13:21 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2081 bytes --]
---
src/stkagent.c | 32 ++++++++++++++++++++++++++++++++
src/stkagent.h | 5 +++++
2 files changed, 37 insertions(+)
diff --git a/src/stkagent.c b/src/stkagent.c
index 7c3f697..63b82f3 100644
--- a/src/stkagent.c
+++ b/src/stkagent.c
@@ -584,6 +584,38 @@ int stk_agent_request_digit(struct stk_agent *agent, const char *text,
return 0;
}
+int stk_agent_request_quick_digit(struct stk_agent *agent, const char *text,
+ const struct stk_icon_id *icon,
+ stk_agent_string_cb cb, void *user_data,
+ ofono_destroy_func destroy, int timeout)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+
+ agent->msg = dbus_message_new_method_call(agent->bus, agent->path,
+ OFONO_SIM_APP_INTERFACE,
+ "RequestQuickDigit");
+ if (agent->msg == NULL)
+ return -ENOMEM;
+
+ dbus_message_append_args(agent->msg,
+ DBUS_TYPE_STRING, &text,
+ DBUS_TYPE_BYTE, &icon->id,
+ DBUS_TYPE_INVALID);
+
+ if (dbus_connection_send_with_reply(conn, agent->msg, &agent->call,
+ timeout) == FALSE ||
+ agent->call == NULL)
+ return -EIO;
+
+ agent->user_cb = cb;
+ agent->user_data = user_data;
+ agent->user_destroy = destroy;
+
+ dbus_pending_call_set_notify(agent->call, get_digit_cb, agent, NULL);
+
+ return 0;
+}
+
static void get_key_cb(DBusPendingCall *call, void *data)
{
struct stk_agent *agent = data;
diff --git a/src/stkagent.h b/src/stkagent.h
index 6e267fc..f66f038 100644
--- a/src/stkagent.h
+++ b/src/stkagent.h
@@ -102,6 +102,11 @@ int stk_agent_request_digit(struct stk_agent *agent, const char *text,
stk_agent_string_cb cb, void *user_data,
ofono_destroy_func destroy, int timeout);
+int stk_agent_request_quick_digit(struct stk_agent *agent, const char *text,
+ const struct stk_icon_id *icon,
+ stk_agent_string_cb cb, void *user_data,
+ ofono_destroy_func destroy, int timeout);
+
int stk_agent_request_key(struct stk_agent *agent, const char *text,
const struct stk_icon_id *icon,
ofono_bool_t unicode_charset,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v2 2/4] stkagent: Add new API to get digit response on single key press
2012-08-28 13:21 ` [PATCH v2 2/4] stkagent: Add new " Philippe Nunes
@ 2012-08-30 22:00 ` Denis Kenzior
0 siblings, 0 replies; 9+ messages in thread
From: Denis Kenzior @ 2012-08-30 22:00 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2446 bytes --]
Hi Philippe,
On 08/28/2012 08:21 AM, Philippe Nunes wrote:
> ---
> src/stkagent.c | 32 ++++++++++++++++++++++++++++++++
> src/stkagent.h | 5 +++++
> 2 files changed, 37 insertions(+)
>
Patch has been applied, however...
> diff --git a/src/stkagent.c b/src/stkagent.c
> index 7c3f697..63b82f3 100644
> --- a/src/stkagent.c
> +++ b/src/stkagent.c
> @@ -584,6 +584,38 @@ int stk_agent_request_digit(struct stk_agent *agent, const char *text,
> return 0;
> }
>
> +int stk_agent_request_quick_digit(struct stk_agent *agent, const char *text,
> + const struct stk_icon_id *icon,
> + stk_agent_string_cb cb, void *user_data,
> + ofono_destroy_func destroy, int timeout)
The indentation is not in line with the coding standard item M4. I
amended this patch manually here and...
> +{
> + DBusConnection *conn = ofono_dbus_get_connection();
> +
> + agent->msg = dbus_message_new_method_call(agent->bus, agent->path,
> + OFONO_SIM_APP_INTERFACE,
> + "RequestQuickDigit");
> + if (agent->msg == NULL)
> + return -ENOMEM;
> +
> + dbus_message_append_args(agent->msg,
> + DBUS_TYPE_STRING,&text,
> + DBUS_TYPE_BYTE,&icon->id,
> + DBUS_TYPE_INVALID);
> +
> + if (dbus_connection_send_with_reply(conn, agent->msg,&agent->call,
> + timeout) == FALSE ||
> + agent->call == NULL)
> + return -EIO;
> +
> + agent->user_cb = cb;
> + agent->user_data = user_data;
> + agent->user_destroy = destroy;
> +
> + dbus_pending_call_set_notify(agent->call, get_digit_cb, agent, NULL);
> +
> + return 0;
> +}
> +
> static void get_key_cb(DBusPendingCall *call, void *data)
> {
> struct stk_agent *agent = data;
> diff --git a/src/stkagent.h b/src/stkagent.h
> index 6e267fc..f66f038 100644
> --- a/src/stkagent.h
> +++ b/src/stkagent.h
> @@ -102,6 +102,11 @@ int stk_agent_request_digit(struct stk_agent *agent, const char *text,
> stk_agent_string_cb cb, void *user_data,
> ofono_destroy_func destroy, int timeout);
>
> +int stk_agent_request_quick_digit(struct stk_agent *agent, const char *text,
> + const struct stk_icon_id *icon,
> + stk_agent_string_cb cb, void *user_data,
> + ofono_destroy_func destroy, int timeout);
> +
here
> int stk_agent_request_key(struct stk_agent *agent, const char *text,
> const struct stk_icon_id *icon,
> ofono_bool_t unicode_charset,
Regards,
-Denis
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 3/4] stk: Ask for immediate digit response if specified by command qualifier
2012-08-28 13:21 [PATCH v2 0/4] Immediate digit response Philippe Nunes
2012-08-28 13:21 ` [PATCH v2 1/4] doc: Add new STK Agent API to get digit response on single key press Philippe Nunes
2012-08-28 13:21 ` [PATCH v2 2/4] stkagent: Add new " Philippe Nunes
@ 2012-08-28 13:21 ` Philippe Nunes
2012-08-30 22:02 ` Denis Kenzior
2012-08-28 13:21 ` [PATCH v2 4/4] test: Update with RequestQuickDigit API Philippe Nunes
3 siblings, 1 reply; 9+ messages in thread
From: Philippe Nunes @ 2012-08-28 13:21 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1139 bytes --]
---
src/stk.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/stk.c b/src/stk.c
index 7a7bd75..38f2e18 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -1519,9 +1519,9 @@ static gboolean handle_command_get_inkey(const struct stk_command *cmd,
gboolean alphabet = (qualifier & (1 << 0)) != 0;
gboolean ucs2 = (qualifier & (1 << 1)) != 0;
gboolean yesno = (qualifier & (1 << 2)) != 0;
+ gboolean immediate = (qualifier & (1 << 3)) != 0;
/*
- * Note: immediate response and help parameter values are not
- * provided by current api.
+ * Note: help parameter value is not provided by current api.
*/
int err;
@@ -1545,6 +1545,11 @@ static gboolean handle_command_get_inkey(const struct stk_command *cmd,
&gi->icon_id, ucs2,
request_key_cb, stk, NULL,
timeout);
+ else if (immediate)
+ err = stk_agent_request_quick_digit(stk->current_agent,
+ text, &gi->icon_id,
+ request_key_cb, stk,
+ NULL, timeout);
else
err = stk_agent_request_digit(stk->current_agent, text,
&gi->icon_id, request_key_cb,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 4/4] test: Update with RequestQuickDigit API
2012-08-28 13:21 [PATCH v2 0/4] Immediate digit response Philippe Nunes
` (2 preceding siblings ...)
2012-08-28 13:21 ` [PATCH v2 3/4] stk: Ask for immediate digit response if specified by command qualifier Philippe Nunes
@ 2012-08-28 13:21 ` Philippe Nunes
2012-08-30 22:05 ` Denis Kenzior
3 siblings, 1 reply; 9+ messages in thread
From: Philippe Nunes @ 2012-08-28 13:21 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1616 bytes --]
---
| 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
--git a/test/test-stk-menu b/test/test-stk-menu
index a9f92e8..476d949 100755
--- a/test/test-stk-menu
+++ b/test/test-stk-menu
@@ -7,6 +7,27 @@ import dbus
import dbus.service
import dbus.mainloop.glib
+
+
+class _GetchUnix:
+ def __init__(self):
+ import tty, sys
+
+ def __call__(self):
+ import sys, tty, termios
+ fd = sys.stdin.fileno()
+ old_settings = termios.tcgetattr(fd)
+ try:
+ tty.setraw(sys.stdin.fileno())
+ ch = sys.stdin.read(1)
+ finally:
+ termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
+ return ch
+
+
+getch = _GetchUnix()
+
+
class GoBack(dbus.DBusException):
_dbus_error_name = "org.ofono.Error.GoBack"
@@ -127,6 +148,22 @@ class StkAgent(dbus.service.Object):
return key
@dbus.service.method("org.ofono.SimToolkitAgent",
+ in_signature="sy", out_signature="s")
+ def RequestQuickDigit(self, title, icon):
+ print "Title: (%s)" % (title)
+ print "Icon: (%d)" % (icon)
+ print "Single key press (t, b, 0-9,*,#)"
+ key = getch();
+
+ if key == 'b':
+ raise GoBack("User wishes to go back");
+ elif key == 't':
+ raise EndSession("User wishes to terminate session");
+ else:
+ print "."
+ return key
+
+ @dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="sy", out_signature="b")
def RequestConfirmation(self, title, icon):
print "Title: (%s)" % (title)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v2 4/4] test: Update with RequestQuickDigit API
2012-08-28 13:21 ` [PATCH v2 4/4] test: Update with RequestQuickDigit API Philippe Nunes
@ 2012-08-30 22:05 ` Denis Kenzior
0 siblings, 0 replies; 9+ messages in thread
From: Denis Kenzior @ 2012-08-30 22:05 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2321 bytes --]
Hi Philippe,
On 08/28/2012 08:21 AM, Philippe Nunes wrote:
> ---
> test/test-stk-menu | 37 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
>
Applying: test: Update with RequestQuickDigit API
/home/denkenz/ofono-master/.git/rebase-apply/patch:45: trailing whitespace.
print "Single key press (t, b, 0-9,*,#)"
/home/denkenz/ofono-master/.git/rebase-apply/patch:53: trailing whitespace.
print "."
fatal: 2 lines add whitespace errors.
Patch failed at 0001 test: Update with RequestQuickDigit API
> diff --git a/test/test-stk-menu b/test/test-stk-menu
> index a9f92e8..476d949 100755
> --- a/test/test-stk-menu
> +++ b/test/test-stk-menu
> @@ -7,6 +7,27 @@ import dbus
> import dbus.service
> import dbus.mainloop.glib
>
> +
> +
Why double empty line?
> +class _GetchUnix:
> + def __init__(self):
> + import tty, sys
> +
> + def __call__(self):
> + import sys, tty, termios
> + fd = sys.stdin.fileno()
> + old_settings = termios.tcgetattr(fd)
> + try:
> + tty.setraw(sys.stdin.fileno())
> + ch = sys.stdin.read(1)
> + finally:
> + termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
> + return ch
> +
> +
> +getch = _GetchUnix()
> +
> +
And again?
Also, are you sure we need to go this complicated. We already ignore
'hide_typing' elsewhere...
> class GoBack(dbus.DBusException):
> _dbus_error_name = "org.ofono.Error.GoBack"
>
> @@ -127,6 +148,22 @@ class StkAgent(dbus.service.Object):
> return key
>
> @dbus.service.method("org.ofono.SimToolkitAgent",
> + in_signature="sy", out_signature="s")
> + def RequestQuickDigit(self, title, icon):
> + print "Title: (%s)" % (title)
> + print "Icon: (%d)" % (icon)
> + print "Single key press (t, b, 0-9,*,#)"
> + key = getch();
> +
> + if key == 'b':
> + raise GoBack("User wishes to go back");
> + elif key == 't':
> + raise EndSession("User wishes to terminate session");
> + else:
> + print "."
> + return key
> +
> + @dbus.service.method("org.ofono.SimToolkitAgent",
> in_signature="sy", out_signature="b")
> def RequestConfirmation(self, title, icon):
> print "Title: (%s)" % (title)
Regards,
-Denis
^ permalink raw reply [flat|nested] 9+ messages in thread