#define MIN(a,b) (((a)<(b))?(a):(b))
#define CEILDIV(x,y) (((x) + (y) - 1) / (y))
+static struct qmi_wms_list_messages_request lmreq = {
+ QMI_INIT(storage_type, QMI_WMS_STORAGE_TYPE_UIM),
+ QMI_INIT(message_tag, QMI_WMS_MESSAGE_TAG_TYPE_MT_NOT_READ),
+};
+
+static struct qmi_wms_delete_request dmreq = {
+ QMI_INIT(memory_storage, QMI_WMS_STORAGE_TYPE_UIM),
+ QMI_INIT(message_mode, QMI_WMS_MESSAGE_MODE_GSM_WCDMA),
+};
+
+static struct qmi_wms_raw_read_request gmreq = {
+ QMI_INIT_SEQUENCE(message_memory_storage_id,
+ .storage_type = QMI_WMS_STORAGE_TYPE_UIM,
+ ),
+ QMI_INIT(message_mode, QMI_WMS_MESSAGE_MODE_GSM_WCDMA),
+};
+
+
+#define cmd_wms_storage_cb no_cb
+static enum qmi_cmd_result
+cmd_wms_storage_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ if (strcmp(arg, "sim") == 0) {
+ } else if (strcmp(arg, "me") == 0) {
+ qmi_set_ptr(&lmreq, storage_type, QMI_WMS_STORAGE_TYPE_NV);
+ qmi_set_ptr(&dmreq, memory_storage, QMI_WMS_STORAGE_TYPE_NV);
+ qmi_set_ptr(&gmreq, message_memory_storage_id.storage_type, QMI_WMS_STORAGE_TYPE_NV);
+ } else {
+ uqmi_add_error("Invalid value (sim or me)");
+ return QMI_CMD_EXIT;
+ }
+ return QMI_CMD_DONE;
+}
+
static void cmd_wms_list_messages_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
{
struct qmi_wms_list_messages_response res;
static enum qmi_cmd_result
cmd_wms_list_messages_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
{
- static struct qmi_wms_list_messages_request mreq = {
- QMI_INIT(storage_type, QMI_WMS_STORAGE_TYPE_UIM),
- QMI_INIT(message_tag, QMI_WMS_MESSAGE_TAG_TYPE_MT_NOT_READ),
- };
-
- qmi_set_wms_list_messages_request(msg, &mreq);
+ qmi_set_wms_list_messages_request(msg, &lmreq);
return QMI_CMD_REQUEST;
}
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;
+ dmreq.set.memory_index = 1;
+ dmreq.data.memory_index = id;
- qmi_set_wms_delete_request(msg, &mreq);
+ qmi_set_wms_delete_request(msg, &dmreq);
return QMI_CMD_REQUEST;
}
static enum qmi_cmd_result
cmd_wms_get_message_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
{
- static struct qmi_wms_raw_read_request mreq = {
- QMI_INIT_SEQUENCE(message_memory_storage_id,
- .storage_type = QMI_WMS_STORAGE_TYPE_UIM,
- ),
- QMI_INIT(message_mode, QMI_WMS_MESSAGE_MODE_GSM_WCDMA),
- };
char *err;
int id;
return QMI_CMD_EXIT;
}
- mreq.data.message_memory_storage_id.memory_index = id;
- qmi_set_wms_raw_read_request(msg, &mreq);
+ gmreq.data.message_memory_storage_id.memory_index = id;
+ qmi_set_wms_raw_read_request(msg, &gmreq);
return QMI_CMD_REQUEST;
}
*/
#define __uqmi_wms_commands \
+ __uqmi_command(wms_storage, storage, required, CMD_TYPE_OPTION), \
__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), \
#define wms_helptext \
" --list-messages: List SMS messages\n" \
+ " --storage <mem>: Messages storage (sim (default), me)\n" \
" --delete-message <id>: Delete SMS message at index <id>\n" \
+ " --storage <mem>: Messages storage (sim (default), me)\n" \
" --get-message <id>: Get SMS message at index <id>\n" \
+ " --storage <mem>: Messages storage (sim (default), me)\n" \
" --get-raw-message <id>: Get SMS raw message contents at index <id>\n" \
+ " --storage <mem>: Messages storage (sim (default), me)\n" \
" --send-message <data>: Send SMS message (use options below)\n" \
" --send-message-smsc <nr>: SMSC number\n" \
" --send-message-target <nr>: Destination number (required)\n" \