All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gatserver: add ATZ command
@ 2011-03-23 16:31 Olivier Guiter
  2011-03-23 20:02 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Olivier Guiter @ 2011-03-23 16:31 UTC (permalink / raw)
  To: ofono

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

---
 gatchat/gatserver.c |   53 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index 4a211ad..57cc58e 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -279,6 +279,24 @@ static gboolean get_result_value(GAtServer *server, GAtResult *result,
 	return TRUE;
 }
 
+static void v250_settings_create(struct v250_settings *v250)
+{
+	v250->s0 = 0;
+	v250->s3 = '\r';
+	v250->s4 = '\n';
+	v250->s5 = '\b';
+	v250->s6 = 2;
+	v250->s7 = 50;
+	v250->s8 = 2;
+	v250->s10 = 2;
+	v250->echo = TRUE;
+	v250->quiet = FALSE;
+	v250->is_v1 = TRUE;
+	v250->res_format = 0;
+	v250->c109 = 1;
+	v250->c108 = 0;
+}
+
 static void s_template_cb(GAtServerRequestType type, GAtResult *result,
 					GAtServer *server, char *sreg,
 					const char *prefix, int min, int max)
@@ -446,6 +464,22 @@ 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,
+			GAtResult *result, gpointer user_data)
+{
+
+	switch (type) {
+	case G_AT_SERVER_REQUEST_TYPE_COMMAND_ONLY:
+		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 inline gboolean is_extended_command_prefix(const char c)
 {
 	switch (c) {
@@ -1073,24 +1107,6 @@ static void server_resume(GAtServer *server)
 	g_at_io_set_read_handler(server->io, new_bytes, server);
 }
 
-static void v250_settings_create(struct v250_settings *v250)
-{
-	v250->s0 = 0;
-	v250->s3 = '\r';
-	v250->s4 = '\n';
-	v250->s5 = '\b';
-	v250->s6 = 2;
-	v250->s7 = 50;
-	v250->s8 = 2;
-	v250->s10 = 2;
-	v250->echo = TRUE;
-	v250->quiet = FALSE;
-	v250->is_v1 = TRUE;
-	v250->res_format = 0;
-	v250->c109 = 1;
-	v250->c108 = 0;
-}
-
 static void at_notify_node_destroy(gpointer data)
 {
 	struct at_command *node = data;
@@ -1117,6 +1133,7 @@ static void basic_command_register(GAtServer *server)
 	g_at_server_register(server, "S10", at_s10_cb, NULL, NULL);
 	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);
 }
 
 GAtServer *g_at_server_new(GIOChannel *io)
-- 
1.7.1


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

end of thread, other threads:[~2011-03-23 20:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-23 16:31 [PATCH] gatserver: add ATZ command Olivier Guiter
2011-03-23 20:02 ` 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.