All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gatserver: add AT&F command
@ 2011-03-24 10:03 Olivier Guiter
  2011-03-24 18:27 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Olivier Guiter @ 2011-03-24 10:03 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1993 bytes --]

---
 gatchat/gatserver.c |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index 57cc58e..8266ead 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -274,7 +274,8 @@ static gboolean get_result_value(GAtServer *server, GAtResult *result,
 	if (val < min || val > max)
 		return FALSE;
 
-	*value = val;
+	if (value)
+		*value = val;
 
 	return TRUE;
 }
@@ -464,10 +465,33 @@ static void at_c108_cb(GAtServer *server, GAtServerRequestType type,
 	at_template_cb(type, result, server, &server->v250.c108, "&D", 0, 2, 2);
 }
 
-static void at_z_cb(GAtServer *server, GAtServerRequestType type,
+static void at_f_cb(GAtServer *server, GAtServerRequestType type,
 			GAtResult *result, gpointer user_data)
 {
+	switch (type) {
+	case G_AT_SERVER_REQUEST_TYPE_SET:
+		if (!get_result_value(server, result, 0, 0, NULL)) {
+			g_at_server_send_final(server,
+						G_AT_SERVER_RESULT_ERROR);
+			return;
+		}
+		/* intentional fallback here */
 
+	case G_AT_SERVER_REQUEST_TYPE_COMMAND_ONLY:
+		/* default behavior on AT&F same as ATZ */
+		v250_settings_create(&server->v250);
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+
+	default:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR);
+		break;
+	}
+}
+
+static void at_z_cb(GAtServer *server, GAtServerRequestType type,
+			GAtResult *result, gpointer user_data)
+{
 	switch (type) {
 	case G_AT_SERVER_REQUEST_TYPE_COMMAND_ONLY:
 		v250_settings_create(&server->v250);
@@ -1134,6 +1158,7 @@ static void basic_command_register(GAtServer *server)
 	g_at_server_register(server, "&C", at_c109_cb, NULL, NULL);
 	g_at_server_register(server, "&D", at_c108_cb, NULL, NULL);
 	g_at_server_register(server, "Z", at_z_cb, NULL, NULL);
+	g_at_server_register(server, "&F", at_f_cb, NULL, NULL);
 }
 
 GAtServer *g_at_server_new(GIOChannel *io)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gatserver: add AT&F command
  2011-03-24 10:03 [PATCH] gatserver: add AT&F command Olivier Guiter
@ 2011-03-24 18:27 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2011-03-24 18:27 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 243 bytes --]

Hi Olivier,

On 03/24/2011 05:03 AM, Olivier Guiter wrote:
> ---
>  gatchat/gatserver.c |   29 +++++++++++++++++++++++++++--
>  1 files changed, 27 insertions(+), 2 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-24 18:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-24 10:03 [PATCH] gatserver: add AT&F command Olivier Guiter
2011-03-24 18:27 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.