---
gatchat/gatserver.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index 80e6d45..1a8ac58 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -280,6 +280,53 @@ done:
return res;
}
+static GAtServerResult at_s5_cb(GAtServerRequestType type, GAtResult *result,
+ gpointer user_data)
+{
+ GAtServerResult res = G_AT_SERVER_RESULT_ERROR;
+ GAtServer *server = user_data;
+ GSList *text = NULL;
+ char buf[20];
+
+ if (type == G_AT_SERVER_REQUEST_TYPE_SET) {
+ GAtResultIter iter;
+ int val;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "S5="))
+ goto done;
+
+ if (!g_at_result_iter_next_number(&iter, &val))
+ goto done;
+
+ if (val < 0 || val > 127)
+ goto done;
+
+ server->v250.s5 = val;
+
+ res = G_AT_SERVER_RESULT_OK;
+ } else if (type == G_AT_SERVER_REQUEST_TYPE_QUERY) {
+ sprintf(buf, "%03d", server->v250.s5);
+ text = g_slist_append(NULL, buf);
+ g_at_server_send_info_text(server, text);
+
+ res = G_AT_SERVER_RESULT_OK;
+ } else if (type == G_AT_SERVER_REQUEST_TYPE_SUPPORT) {
+ sprintf(buf, "S5: (0-127)");
+ text = g_slist_append(NULL, buf);
+ g_at_server_send_info_text(server, text);
+
+ res = G_AT_SERVER_RESULT_OK;
+ }
+
+ if (text)
+ g_slist_free(text);
+
+done:
+ return res;
+}
+
static inline gboolean is_extended_command_prefix(const char c)
{
switch (c) {
@@ -939,6 +986,7 @@ static void at_notify_node_destroy(gpointer data)
static void basic_command_register(GAtServer *server)
{
g_at_server_register(server, "S3", at_s3_cb, server, NULL);
+ g_at_server_register(server, "S5", at_s5_cb, server, NULL);
}
GAtServer *g_at_server_new(GIOChannel *io)
--
1.6.6.1