mirror of git://git.sysmocom.de/ofono
sms: Refactor __ofono_sms_txq_submit
This commit is contained in:
parent
63c8b720fe
commit
016f168f47
|
@ -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>
|
||||
|
|
21
src/sms.c
21
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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue