Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH 1/7] Fix Add check for return modem to avoid crash
@ 2010-03-31  9:50 Zhenhua Zhang
  2010-03-31  9:50 ` [PATCH 2/7] Add implementation for S3, S4, S5 command Zhenhua Zhang
  2010-03-31 13:41 ` [PATCH 1/7] Fix Add check for return modem to avoid crash Denis Kenzior
  0 siblings, 2 replies; 11+ messages in thread
From: Zhenhua Zhang @ 2010-03-31  9:50 UTC (permalink / raw)
  To: ofono

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

---
 plugins/modemconf.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/plugins/modemconf.c b/plugins/modemconf.c
index cf0ee8b..e30fce6 100644
--- a/plugins/modemconf.c
+++ b/plugins/modemconf.c
@@ -138,6 +138,10 @@ static struct ofono_modem *create_modem(GKeyFile *keyfile, const char *group)
 		return NULL;
 
 	modem = ofono_modem_create(group, driver);
+	if (!modem) {
+		g_free(driver);
+		return NULL;
+	}
 
 	for (i = 0; setup_helpers[i].driver; i++) {
 		if (!g_strcmp0(driver, setup_helpers[i].driver))
-- 
1.6.6.1


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

* [PATCH 2/7] Add implementation for S3, S4, S5 command
  2010-03-31  9:50 [PATCH 1/7] Fix Add check for return modem to avoid crash Zhenhua Zhang
@ 2010-03-31  9:50 ` Zhenhua Zhang
  2010-03-31  9:50   ` [PATCH 3/7] Add implementation for ATE and other basic command Zhenhua Zhang
  2010-03-31 13:41 ` [PATCH 1/7] Fix Add check for return modem to avoid crash Denis Kenzior
  1 sibling, 1 reply; 11+ messages in thread
From: Zhenhua Zhang @ 2010-03-31  9:50 UTC (permalink / raw)
  To: ofono

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

---
 gatchat/gatserver.c |  133 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 133 insertions(+), 0 deletions(-)

diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index f166df2..7d5c3c7 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -252,6 +252,130 @@ void g_at_server_send_info(GAtServer *server, const char *line, gboolean last)
 	send_common(server, buf, len);
 }
 
+static gboolean get_result_value(GAtServer *server, GAtResult *result,
+						const char *command,
+						int min, int max, int *value)
+{
+	GAtResultIter iter;
+	int val;
+	char prefix[10];
+
+	if (command[0] != 'S')
+		return FALSE;
+
+	sprintf(prefix, "%s=", command);
+
+	g_at_result_iter_init(&iter, result);
+
+	if (!g_at_result_iter_next(&iter, prefix))
+		return FALSE;
+
+	if (!g_at_result_iter_next_number(&iter, &val))
+		return FALSE;
+
+	if (val < min || val > max)
+		return FALSE;
+
+	*value = val;
+
+	return TRUE;
+}
+
+static void set_s_value(GAtServer *server, const char *prefix, int val)
+{
+	switch (prefix[1]) {
+	case '3':
+		server->v250.s3 = val;
+		break;
+	case '4':
+		server->v250.s4 = val;
+		break;
+	case '5':
+		server->v250.s5 = val;
+		break;
+	default:
+		break;
+	}
+}
+
+static int get_s_value(GAtServer *server, const char *prefix)
+{
+	int val = 0;
+
+	switch (prefix[1]) {
+	case '3':
+		val = server->v250.s3;
+		break;
+	case '4':
+		val = server->v250.s4;
+		break;
+	case '5':
+		val = server->v250.s5;
+		break;
+	default:
+		break;
+	}
+
+	return val;
+}
+
+static void s_template_cb(GAtServerRequestType type, GAtResult *result,
+					gpointer user_data, const char *prefix,
+					int min, int max)
+{
+	GAtServer *server = user_data;
+	char buf[20];
+	int val;
+
+	switch (type) {
+	case G_AT_SERVER_REQUEST_TYPE_SET:
+		if (!get_result_value(server, result, prefix, min, max, &val)) {
+			g_at_server_send_final(server,
+						G_AT_SERVER_RESULT_ERROR);
+			return;
+		}
+
+		set_s_value(server, prefix, val);
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+
+	case G_AT_SERVER_REQUEST_TYPE_QUERY:
+		val = get_s_value(server, prefix);
+		sprintf(buf, "%03d", val);
+		g_at_server_send_info(server, buf, TRUE);
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+
+	case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+		sprintf(buf, "%s: (%d-%d)", prefix, min, max);
+		g_at_server_send_info(server, buf, TRUE);
+		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_s3_cb(GAtServerRequestType type, GAtResult *result,
+					gpointer user_data)
+{
+	s_template_cb(type, result, user_data, "S3", 0, 127);
+}
+
+static void at_s4_cb(GAtServerRequestType type, GAtResult *result,
+					gpointer user_data)
+{
+	s_template_cb(type, result, user_data, "S4", 0, 127);
+}
+
+static void at_s5_cb(GAtServerRequestType type, GAtResult *result,
+					gpointer user_data)
+{
+	s_template_cb(type, result, user_data, "S5", 0, 127);
+}
+
 static inline gboolean is_extended_command_prefix(const char c)
 {
 	switch (c) {
@@ -947,6 +1071,13 @@ static void at_notify_node_destroy(gpointer data)
 	g_free(node);
 }
 
+static void basic_command_register(GAtServer *server)
+{
+	g_at_server_register(server, "S3", at_s3_cb, server, NULL);
+	g_at_server_register(server, "S4", at_s4_cb, server, NULL);
+	g_at_server_register(server, "S5", at_s5_cb, server, NULL);
+}
+
 GAtServer *g_at_server_new(GIOChannel *io)
 {
 	GAtServer *server;
@@ -985,6 +1116,8 @@ GAtServer *g_at_server_new(GIOChannel *io)
 				received_data, server,
 				(GDestroyNotify)read_watcher_destroy_notify);
 
+	basic_command_register(server);
+
 	return server;
 
 error:
-- 
1.6.6.1


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

* [PATCH 3/7] Add implementation for ATE and other basic command
  2010-03-31  9:50 ` [PATCH 2/7] Add implementation for S3, S4, S5 command Zhenhua Zhang
@ 2010-03-31  9:50   ` Zhenhua Zhang
  2010-03-31  9:50     ` [PATCH 4/7] Add Repeat last command support Zhenhua Zhang
  0 siblings, 1 reply; 11+ messages in thread
From: Zhenhua Zhang @ 2010-03-31  9:50 UTC (permalink / raw)
  To: ofono

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

---
 gatchat/gatserver.c |  162 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 158 insertions(+), 4 deletions(-)

diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index 7d5c3c7..5206a12 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -260,10 +260,10 @@ static gboolean get_result_value(GAtServer *server, GAtResult *result,
 	int val;
 	char prefix[10];
 
-	if (command[0] != 'S')
-		return FALSE;
-
-	sprintf(prefix, "%s=", command);
+	if (command[0] == 'S')
+		sprintf(prefix, "%s=", command);
+	else
+		strcpy(prefix, command);
 
 	g_at_result_iter_init(&iter, result);
 
@@ -376,6 +376,154 @@ static void at_s5_cb(GAtServerRequestType type, GAtResult *result,
 	s_template_cb(type, result, user_data, "S5", 0, 127);
 }
 
+static void set_v250_value(GAtServer *server, const char *prefix, int val)
+{
+	if (prefix[0] == '&') {
+		switch (prefix[1]) {
+		case 'C':
+			server->v250.c109 = val;
+			break;
+		case 'D':
+			server->v250.c108 = val;
+			break;
+		default:
+			break;
+		}
+	} else {
+		switch (prefix[0]) {
+		case 'E':
+			server->v250.echo = val;
+			break;
+		case 'Q':
+			server->v250.quiet = val;
+			break;
+		case 'V':
+			server->v250.is_v1 = val;
+			break;
+		case 'X':
+			server->v250.res_format = val;
+			break;
+		}
+	}
+}
+
+static int get_v250_value(GAtServer *server, const char *prefix)
+{
+	int val = 0;
+
+	if (prefix[0] == '&') {
+		switch (prefix[1]) {
+		case 'C':
+			val = server->v250.c109;
+			break;
+		case 'D':
+			val = server->v250.c108;
+			break;
+		default:
+			break;
+		}
+	} else {
+		switch (prefix[0]) {
+		case 'E':
+			val = server->v250.echo;
+			break;
+		case 'Q':
+			val = server->v250.quiet;
+			break;
+		case 'V':
+			val = server->v250.is_v1;
+			break;
+		case 'X':
+			val = server->v250.res_format;
+			break;
+		default:
+			break;
+		}
+	}
+
+	return val;
+}
+
+static void at_template_cb(GAtServerRequestType type, GAtResult *result,
+					gpointer user_data, const char *prefix,
+					int min, int max, int deftval)
+{
+	GAtServer *server = user_data;
+	char buf[20];
+	int val;
+
+	switch (type) {
+	case G_AT_SERVER_REQUEST_TYPE_SET:
+		if (!get_result_value(server, result, prefix, min, max, &val)) {
+			g_at_server_send_final(server,
+						G_AT_SERVER_RESULT_ERROR);
+			return;
+		}
+
+		set_v250_value(server, prefix, val);
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+
+	case G_AT_SERVER_REQUEST_TYPE_QUERY:
+		val = get_v250_value(server, prefix);
+		sprintf(buf, "%s: %d", prefix, val);
+		g_at_server_send_info(server, buf, TRUE);
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+
+	case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+		sprintf(buf, "%s: (%d-%d)", prefix, min, max);
+		g_at_server_send_info(server, buf, TRUE);
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+
+	case G_AT_SERVER_REQUEST_TYPE_COMMAND_ONLY:
+		set_v250_value(server, prefix, deftval);
+		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_e_cb(GAtServerRequestType type, GAtResult *result,
+					gpointer user_data)
+{
+	at_template_cb(type, result, user_data, "E", 0, 1, 1);
+}
+
+static void at_q_cb(GAtServerRequestType type, GAtResult *result,
+					gpointer user_data)
+{
+	at_template_cb(type, result, user_data, "Q", 0, 1, 0);
+}
+
+static void at_v_cb(GAtServerRequestType type, GAtResult *result,
+					gpointer user_data)
+{
+	at_template_cb(type, result, user_data, "V", 0, 1, 1);
+}
+
+static void at_x_cb(GAtServerRequestType type, GAtResult *result,
+					gpointer user_data)
+{
+	at_template_cb(type, result, user_data, "X", 0, 4, 4);
+}
+
+static void at_c109_cb(GAtServerRequestType type, GAtResult *result,
+					gpointer user_data)
+{
+	at_template_cb(type, result, user_data, "&C", 0, 1, 1);
+}
+
+static void at_c108_cb(GAtServerRequestType type, GAtResult *result,
+					gpointer user_data)
+{
+	at_template_cb(type, result, user_data, "&D", 0, 2, 2);
+}
+
 static inline gboolean is_extended_command_prefix(const char c)
 {
 	switch (c) {
@@ -1076,6 +1224,12 @@ static void basic_command_register(GAtServer *server)
 	g_at_server_register(server, "S3", at_s3_cb, server, NULL);
 	g_at_server_register(server, "S4", at_s4_cb, server, NULL);
 	g_at_server_register(server, "S5", at_s5_cb, server, NULL);
+	g_at_server_register(server, "E", at_e_cb, server, NULL);
+	g_at_server_register(server, "Q", at_q_cb, server, NULL);
+	g_at_server_register(server, "V", at_v_cb, server, NULL);
+	g_at_server_register(server, "X", at_x_cb, server, NULL);
+	g_at_server_register(server, "&C", at_c109_cb, server, NULL);
+	g_at_server_register(server, "&D", at_c108_cb, server, NULL);
 }
 
 GAtServer *g_at_server_new(GIOChannel *io)
-- 
1.6.6.1


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

* [PATCH 4/7] Add Repeat last command support
  2010-03-31  9:50   ` [PATCH 3/7] Add implementation for ATE and other basic command Zhenhua Zhang
@ 2010-03-31  9:50     ` Zhenhua Zhang
  2010-03-31  9:50       ` [PATCH 5/7] Fix echo command back even if don't process it Zhenhua Zhang
  0 siblings, 1 reply; 11+ messages in thread
From: Zhenhua Zhang @ 2010-03-31  9:50 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index 5206a12..4796b71 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -996,8 +996,13 @@ static void new_bytes(GAtServer *p)
 		}
 
 		case PARSER_RESULT_REPEAT_LAST:
-			/* TODO */
-			g_at_server_send_final(p, G_AT_SERVER_RESULT_ERROR);
+			p->cur_pos = 0;
+
+			if (p->last_line)
+				server_parse_line(p);
+			else
+				g_at_server_send_final(p,
+						G_AT_SERVER_RESULT_OK);
 			ring_buffer_drain(p->read_buf, p->read_so_far);
 			break;
 
-- 
1.6.6.1


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

* [PATCH 5/7] Fix echo command back even if don't process it
  2010-03-31  9:50     ` [PATCH 4/7] Add Repeat last command support Zhenhua Zhang
@ 2010-03-31  9:50       ` Zhenhua Zhang
  2010-03-31  9:50         ` [PATCH 6/7] Add test implementation to support SMS Zhenhua Zhang
  2010-03-31 13:40         ` [PATCH 5/7] Fix echo command back even if don't process it Denis Kenzior
  0 siblings, 2 replies; 11+ messages in thread
From: Zhenhua Zhang @ 2010-03-31  9:50 UTC (permalink / raw)
  To: ofono

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

---
 gatchat/gatserver.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index 4796b71..a47d46c 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -1050,19 +1050,19 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond,
 
 		read_count++;
 
+		if (rbytes == 0)
+			break;
+
+		if (server->v250.echo)
+			send_common(server, (char *)buf, rbytes);
+
 		/* Ignore incoming bytes when processing a command line */
 		if (server->processing_cmdline)
 			continue;
 
 		total_read += rbytes;
-
-		if (rbytes > 0) {
-			if (server->v250.echo)
-				send_common(server, (char *)buf, rbytes);
-
-			ring_buffer_write_advance(server->read_buf, rbytes);
-		}
-	} while (err == G_IO_ERROR_NONE && rbytes > 0 &&
+		ring_buffer_write_advance(server->read_buf, rbytes);
+	} while (err == G_IO_ERROR_NONE &&
 					read_count < server->max_read_attempts);
 
 	if (total_read > 0)
-- 
1.6.6.1


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

* [PATCH 6/7] Add test implementation to support SMS
  2010-03-31  9:50       ` [PATCH 5/7] Fix echo command back even if don't process it Zhenhua Zhang
@ 2010-03-31  9:50         ` Zhenhua Zhang
  2010-03-31  9:50           ` [PATCH 7/7] Add test implementation for CPBS Zhenhua Zhang
  2010-03-31 13:42           ` [PATCH 6/7] Add test implementation to support SMS Denis Kenzior
  2010-03-31 13:40         ` [PATCH 5/7] Fix echo command back even if don't process it Denis Kenzior
  1 sibling, 2 replies; 11+ messages in thread
From: Zhenhua Zhang @ 2010-03-31  9:50 UTC (permalink / raw)
  To: ofono

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

---
 gatchat/test-server.c |  177 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 177 insertions(+), 0 deletions(-)

diff --git a/gatchat/test-server.c b/gatchat/test-server.c
index 425e353..916198b 100644
--- a/gatchat/test-server.c
+++ b/gatchat/test-server.c
@@ -192,6 +192,175 @@ error:
 	g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR);
 }
 
+static void cpin_cb(GAtServerRequestType type, GAtResult *cmd, gpointer user)
+{
+	GAtServer *server = user;
+
+	switch (type) {
+	case G_AT_SERVER_REQUEST_TYPE_SET:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_QUERY:
+		g_at_server_send_info(server, "+CPIN: READY", TRUE);
+		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 cimi_cb(GAtServerRequestType type, GAtResult *cmd, gpointer user)
+{
+	GAtServer *server = user;
+
+	switch (type) {
+	case G_AT_SERVER_REQUEST_TYPE_COMMAND_ONLY:
+		g_at_server_send_info(server, "246813579", TRUE);
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+		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 csms_cb(GAtServerRequestType type, GAtResult *cmd, gpointer user)
+{
+	GAtServer *server = user;
+
+	switch (type) {
+	case G_AT_SERVER_REQUEST_TYPE_SET:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_QUERY:
+		g_at_server_send_info(server, "+CSMS: 0,1,1,1", TRUE);
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+		g_at_server_send_info(server, "+CSMS: (0)", TRUE);
+		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 cmgf_cb(GAtServerRequestType type, GAtResult *cmd, gpointer user)
+{
+	GAtServer *server = user;
+
+	switch (type) {
+	case G_AT_SERVER_REQUEST_TYPE_SET:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_QUERY:
+		g_at_server_send_info(server, "+CMGF: 0", TRUE);
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+		g_at_server_send_info(server, "+CMGF: (0,1)", TRUE);
+		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 cpms_cb(GAtServerRequestType type, GAtResult *cmd, gpointer user)
+{
+	GAtServer *server = user;
+	char buf[2048];
+
+	switch (type) {
+	case G_AT_SERVER_REQUEST_TYPE_SET:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_QUERY:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+		sprintf(buf, "+CPMS: (\"SM\",\"ME\"),(\"SM\",\"ME\"),(\"SM\")");
+		g_at_server_send_info(server, buf, TRUE);
+		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 cnmi_cb(GAtServerRequestType type, GAtResult *cmd, gpointer user)
+{
+	GAtServer *server = user;
+	char buf[2048];
+
+	switch (type) {
+	case G_AT_SERVER_REQUEST_TYPE_SET:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_QUERY:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+		sprintf(buf, "+CNMI: (0,1,2,3),(0,1),(0,1,2),(0),(0,1)");
+		g_at_server_send_info(server, buf, TRUE);
+		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 cscs_cb(GAtServerRequestType type, GAtResult *cmd, gpointer user)
+{
+	GAtServer *server = user;
+	char buf[2048];
+
+	switch (type) {
+	case G_AT_SERVER_REQUEST_TYPE_SET:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_QUERY:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+		sprintf(buf, "+CSCS: \"GSM\",\"IRA\",\"UCS2\"");
+		g_at_server_send_info(server, buf, TRUE);
+		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 cmgl_cb(GAtServerRequestType type, GAtResult *cmd, gpointer user)
+{
+	GAtServer *server = user;
+
+	switch (type) {
+	case G_AT_SERVER_REQUEST_TYPE_SET:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+		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 add_handler(GAtServer *server)
 {
 	g_at_server_set_debug(server, server_debug, "Server");
@@ -200,6 +369,14 @@ static void add_handler(GAtServer *server)
 	g_at_server_register(server, "+CGMR", cgmr_cb, server, NULL);
 	g_at_server_register(server, "+CGSN", cgsn_cb, server, NULL);
 	g_at_server_register(server, "+CFUN", cfun_cb, server, NULL);
+	g_at_server_register(server, "+CPIN", cpin_cb, server, NULL);
+	g_at_server_register(server, "+CIMI", cimi_cb, server, NULL);
+	g_at_server_register(server, "+CSMS", csms_cb, server, NULL);
+	g_at_server_register(server, "+CMGF", cmgf_cb, server, NULL);
+	g_at_server_register(server, "+CPMS", cpms_cb, server, NULL);
+	g_at_server_register(server, "+CNMI", cnmi_cb, server, NULL);
+	g_at_server_register(server, "+CSCS", cscs_cb, server, NULL);
+	g_at_server_register(server, "+CMGL", cmgl_cb, server, NULL);
 }
 
 static void server_destroy(gpointer user)
-- 
1.6.6.1


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

* [PATCH 7/7] Add test implementation for CPBS
  2010-03-31  9:50         ` [PATCH 6/7] Add test implementation to support SMS Zhenhua Zhang
@ 2010-03-31  9:50           ` Zhenhua Zhang
  2010-03-31 13:42             ` Denis Kenzior
  2010-03-31 13:42           ` [PATCH 6/7] Add test implementation to support SMS Denis Kenzior
  1 sibling, 1 reply; 11+ messages in thread
From: Zhenhua Zhang @ 2010-03-31  9:50 UTC (permalink / raw)
  To: ofono

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

---
 gatchat/test-server.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/gatchat/test-server.c b/gatchat/test-server.c
index 916198b..f170d88 100644
--- a/gatchat/test-server.c
+++ b/gatchat/test-server.c
@@ -361,6 +361,29 @@ static void cmgl_cb(GAtServerRequestType type, GAtResult *cmd, gpointer user)
 	}
 }
 
+static void cpbs_cb(GAtServerRequestType type, GAtResult *cmd, gpointer user)
+{
+	GAtServer *server = user;
+	char buf[2048];
+
+	switch (type) {
+	case G_AT_SERVER_REQUEST_TYPE_SET:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_QUERY:
+		g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+		break;
+	case G_AT_SERVER_REQUEST_TYPE_SUPPORT:
+		sprintf(buf, "+CPBS: (\"FD\",\"SM\",\"SN\")");
+		g_at_server_send_info(server, buf, TRUE);
+		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 add_handler(GAtServer *server)
 {
 	g_at_server_set_debug(server, server_debug, "Server");
@@ -377,6 +400,7 @@ static void add_handler(GAtServer *server)
 	g_at_server_register(server, "+CNMI", cnmi_cb, server, NULL);
 	g_at_server_register(server, "+CSCS", cscs_cb, server, NULL);
 	g_at_server_register(server, "+CMGL", cmgl_cb, server, NULL);
+	g_at_server_register(server, "+CPBS", cpbs_cb, server, NULL);
 }
 
 static void server_destroy(gpointer user)
-- 
1.6.6.1


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

* Re: [PATCH 5/7] Fix echo command back even if don't process it
  2010-03-31  9:50       ` [PATCH 5/7] Fix echo command back even if don't process it Zhenhua Zhang
  2010-03-31  9:50         ` [PATCH 6/7] Add test implementation to support SMS Zhenhua Zhang
@ 2010-03-31 13:40         ` Denis Kenzior
  1 sibling, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2010-03-31 13:40 UTC (permalink / raw)
  To: ofono

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

Hi Zhenhua,

> ---
>  gatchat/gatserver.c |   16 ++++++++--------
>  1 files changed, 8 insertions(+), 8 deletions(-)
> 

Patches 2-5 have been applied with some simplifications afterwards.

Regards,
-Denis

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

* Re: [PATCH 1/7] Fix Add check for return modem to avoid crash
  2010-03-31  9:50 [PATCH 1/7] Fix Add check for return modem to avoid crash Zhenhua Zhang
  2010-03-31  9:50 ` [PATCH 2/7] Add implementation for S3, S4, S5 command Zhenhua Zhang
@ 2010-03-31 13:41 ` Denis Kenzior
  1 sibling, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2010-03-31 13:41 UTC (permalink / raw)
  To: ofono

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

Hi Zhenhua,

> ---
>  plugins/modemconf.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)

I fixed in a slightly simpler way.

Regards,
-Denis

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

* Re: [PATCH 6/7] Add test implementation to support SMS
  2010-03-31  9:50         ` [PATCH 6/7] Add test implementation to support SMS Zhenhua Zhang
  2010-03-31  9:50           ` [PATCH 7/7] Add test implementation for CPBS Zhenhua Zhang
@ 2010-03-31 13:42           ` Denis Kenzior
  1 sibling, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2010-03-31 13:42 UTC (permalink / raw)
  To: ofono

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

Hi Zhenhua,

> ---
>  gatchat/test-server.c |  177
>  +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 177
>  insertions(+), 0 deletions(-)

Patch looks good and has been applied.

Thanks,
-Denis

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

* Re: [PATCH 7/7] Add test implementation for CPBS
  2010-03-31  9:50           ` [PATCH 7/7] Add test implementation for CPBS Zhenhua Zhang
@ 2010-03-31 13:42             ` Denis Kenzior
  0 siblings, 0 replies; 11+ messages in thread
From: Denis Kenzior @ 2010-03-31 13:42 UTC (permalink / raw)
  To: ofono

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

Hi Zhenhua,

> ---
>  gatchat/test-server.c |   24 ++++++++++++++++++++++++
>  1 files changed, 24 insertions(+), 0 deletions(-)

Patch looks good and has been applied.

Thanks,
-Denis

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

end of thread, other threads:[~2010-03-31 13:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-31  9:50 [PATCH 1/7] Fix Add check for return modem to avoid crash Zhenhua Zhang
2010-03-31  9:50 ` [PATCH 2/7] Add implementation for S3, S4, S5 command Zhenhua Zhang
2010-03-31  9:50   ` [PATCH 3/7] Add implementation for ATE and other basic command Zhenhua Zhang
2010-03-31  9:50     ` [PATCH 4/7] Add Repeat last command support Zhenhua Zhang
2010-03-31  9:50       ` [PATCH 5/7] Fix echo command back even if don't process it Zhenhua Zhang
2010-03-31  9:50         ` [PATCH 6/7] Add test implementation to support SMS Zhenhua Zhang
2010-03-31  9:50           ` [PATCH 7/7] Add test implementation for CPBS Zhenhua Zhang
2010-03-31 13:42             ` Denis Kenzior
2010-03-31 13:42           ` [PATCH 6/7] Add test implementation to support SMS Denis Kenzior
2010-03-31 13:40         ` [PATCH 5/7] Fix echo command back even if don't process it Denis Kenzior
2010-03-31 13:41 ` [PATCH 1/7] Fix Add check for return modem to avoid crash Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox