[OpenWrt-Devel] [PATCH uqmi] Add --delete-message for deleting SMS messages

Sławomir Demeszko s.demeszko at wireless-instruments.com
Tue Dec 2 11:26:36 EST 2014


Signed-off-by: Sławomir Demeszko <s.demeszko at wireless-instruments.com>
---
 commands-wms.c | 27 +++++++++++++++++++++++++++
 commands-wms.h |  2 ++
 2 files changed, 29 insertions(+)

diff --git a/commands-wms.c b/commands-wms.c
index da4aeaf..5f159ce 100644
--- a/commands-wms.c
+++ b/commands-wms.c
@@ -253,6 +253,33 @@ static void wms_decode_address(char *name, unsigned char *data, int len)
 	blobmsg_add_string_buffer(&status);
 }
 
+#define cmd_wms_delete_message_cb no_cb
+static enum qmi_cmd_result
+cmd_wms_delete_message_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+	char *err;
+	int id;
+
+	id = strtoul(arg, &err, 10);
+	if (err && *err) {
+		uqmi_add_error("Invalid message ID");
+		return QMI_CMD_EXIT;
+	}
+
+	static struct qmi_wms_delete_request mreq = {
+		QMI_INIT(memory_storage, QMI_WMS_STORAGE_TYPE_UIM),
+		QMI_INIT(message_mode, QMI_WMS_MESSAGE_MODE_GSM_WCDMA),
+	};
+
+	mreq.set.memory_index = 1;
+	mreq.data.memory_index = id;
+
+	qmi_set_wms_delete_request(msg, &mreq);
+
+	return QMI_CMD_REQUEST;
+}
+
+
 static void cmd_wms_get_message_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
 {
 	struct qmi_wms_raw_read_response res;
diff --git a/commands-wms.h b/commands-wms.h
index be27124..07191da 100644
--- a/commands-wms.h
+++ b/commands-wms.h
@@ -1,5 +1,6 @@
 #define __uqmi_wms_commands \
 	__uqmi_command(wms_list_messages, list-messages, no, QMI_SERVICE_WMS), \
+	__uqmi_command(wms_delete_message, delete-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), \
 	__uqmi_command(wms_send_message_smsc, send-message-smsc, required, CMD_TYPE_OPTION), \
@@ -9,6 +10,7 @@
 
 #define wms_helptext \
 		"  --list-messages:                  List SMS messages\n" \
+		"  --delete-message <id>:            Delete SMS message at index <id>\n" \
 		"  --get-message <id>:               Get SMS message at index <id>\n" \
 		"  --get-raw-message <id>:           Get SMS raw message contents at index <id>\n" \
 		"  --send-message <data>:            Send SMS message (use options below)\n" \
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list