summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ofono.h8
-rw-r--r--src/sms.c21
-rw-r--r--src/stk.c8
3 files changed, 25 insertions, 12 deletions
diff --git a/src/ofono.h b/src/ofono.h
index f64f1492..f479cbd0 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -218,10 +218,10 @@ enum ofono_sms_submit_flag {
typedef void (*ofono_sms_txq_submit_cb_t)(gboolean ok, void *data);
-unsigned int __ofono_sms_txq_submit(struct ofono_sms *sms, GSList *list,
- unsigned int flags,
- ofono_sms_txq_submit_cb_t cb,
- void *data, ofono_destroy_func destroy);
+int __ofono_sms_txq_submit(struct ofono_sms *sms, GSList *list,
+ unsigned int flags, struct ofono_uuid *uuid,
+ ofono_sms_txq_submit_cb_t cb,
+ void *data, ofono_destroy_func destroy);
#include <ofono/sim.h>
#include <ofono/stk.h>
diff --git a/src/sms.c b/src/sms.c
index 5ecebd38..5ee031cf 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -1457,18 +1457,27 @@ void *ofono_sms_get_data(struct ofono_sms *sms)
return sms->driver_data;
}
-unsigned int __ofono_sms_txq_submit(struct ofono_sms *sms, GSList *list,
- unsigned int flags,
- ofono_sms_txq_submit_cb_t cb,
- void *data, ofono_destroy_func destroy)
+int __ofono_sms_txq_submit(struct ofono_sms *sms, GSList *list,
+ unsigned int flags,
+ struct ofono_uuid *uuid,
+ ofono_sms_txq_submit_cb_t cb,
+ void *data, ofono_destroy_func destroy)
{
- struct tx_queue_entry *entry = tx_queue_entry_new(list);
+ struct tx_queue_entry *entry;
+ entry = tx_queue_entry_new(list, flags, cb, data, destroy);
+ if (entry == NULL)
+ return -ENOMEM;
g_queue_push_tail(sms->txq, entry);
if (g_queue_get_length(sms->txq) == 1)
sms->tx_source = g_timeout_add(0, tx_next, sms);
- return entry->msg_id;
+ if (uuid)
+ memcpy(uuid, &entry->uuid, sizeof(*uuid));
+
+ /* TODO: If this is exported via D-Bus, signal MessageAdded */
+
+ return 0;
}
diff --git a/src/stk.c b/src/stk.c
index 63b1fd3a..6c64b77c 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -720,8 +720,12 @@ static gboolean handle_command_send_sms(const struct stk_command *cmd,
msg_list.data = (void *) &cmd->send_sms.gsm_sms;
msg_list.next = NULL;
- __ofono_sms_txq_submit(sms, &msg_list, 0, send_sms_submit_cb,
- stk->sms_submit_req, g_free);
+ if (__ofono_sms_txq_submit(sms, &msg_list, 0, NULL, send_sms_submit_cb,
+ stk->sms_submit_req, g_free) < 0) {
+ g_free(stk->sms_submit_req);
+ rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY;
+ return TRUE;
+ }
stk->cancel_cmd = send_sms_cancel;