summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-02-18 22:09:44 +0100
committerFelix Fietkau <nbd@openwrt.org>2013-02-18 22:09:44 +0100
commitc60216e121688a06eaadc7aebb59d4358a4e3bb3 (patch)
treec02d45891c92a2ee3e8760adbb77aacab0884680
parent3762cd81f82e39fac74c1b213f526dc7261aa845 (diff)
add a command for showing raw sms data
-rw-r--r--commands-wms.c19
-rw-r--r--commands-wms.h4
2 files changed, 22 insertions, 1 deletions
diff --git a/commands-wms.c b/commands-wms.c
index 74fb69a..16c2a3b 100644
--- a/commands-wms.c
+++ b/commands-wms.c
@@ -221,3 +221,22 @@ cmd_wms_get_message_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct
return QMI_CMD_REQUEST;
}
+
+
+static void cmd_wms_get_raw_message_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
+{
+ struct qmi_wms_raw_read_response res;
+ unsigned char *data;
+ int i, len = 0;
+ char *str;
+
+ qmi_parse_wms_raw_read_response(msg, &res);
+ data = (unsigned char *) res.data.raw_message_data.raw_data;
+ str = blobmsg_alloc_string_buffer(&status, "data", res.data.raw_message_data.raw_data_n * 3);
+ for (i = 0; i < res.data.raw_message_data.raw_data_n; i++) {
+ str += sprintf(str, " %02x" + (i ? 0 : 1), data[i]);
+ }
+ blobmsg_add_string_buffer(&status);
+}
+
+#define cmd_wms_get_raw_message_prepare cmd_wms_get_message_prepare
diff --git a/commands-wms.h b/commands-wms.h
index d63f7f2..cc4918f 100644
--- a/commands-wms.h
+++ b/commands-wms.h
@@ -1,8 +1,10 @@
#define __uqmi_wms_commands \
__uqmi_command(wms_list_messages, list-messages, no, QMI_SERVICE_WMS), \
- __uqmi_command(wms_get_message, get-message, required, QMI_SERVICE_WMS) \
+ __uqmi_command(wms_get_message, get-message, required, QMI_SERVICE_WMS), \
+ __uqmi_command(wms_get_raw_message, get-raw-message, required, QMI_SERVICE_WMS) \
#define wms_helptext \
" --list-messages: List SMS messages\n" \
" --get-message <id>: Get SMS message at index <id>\n" \
+ " --get-raw-message <id>: Get SMS raw message contents at index <id>\n" \