From dc1dfedccc6cfa0205feecdbb5eb2c51d9aa3a4d Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C5=82awomir=20Demeszko?= Date: Mon, 22 Dec 2014 19:47:34 +0100 Subject: [PATCH] Making smsc number optional MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If smsc number is not provided before sending sms then operator's default stored on simcard will be used. Signed-off-by: SÅ‚awomir Demeszko --- commands-wms.c | 10 +++++++--- commands-wms.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/commands-wms.c b/commands-wms.c index 2e4e08f..345b812 100644 --- a/commands-wms.c +++ b/commands-wms.c @@ -612,12 +612,12 @@ cmd_wms_send_message_prepare(struct qmi_dev *qmi, struct qmi_request *req, struc unsigned char protocol_id = 0x00; unsigned char dcs = 0x00; - if (!_send.smsc || !*_send.smsc || !_send.target || !*_send.target) { + if (!_send.target || !*_send.target) { uqmi_add_error("Missing argument"); return QMI_CMD_EXIT; } - if (strlen(_send.smsc) > 16 || strlen(_send.target) > 16 || strlen(arg) > 160) { + if ((_send.smsc && strlen(_send.smsc) > 16) || strlen(_send.target) > 16 || strlen(arg) > 160) { uqmi_add_error("Argument too long"); return QMI_CMD_EXIT; } @@ -625,7 +625,11 @@ cmd_wms_send_message_prepare(struct qmi_dev *qmi, struct qmi_request *req, struc if (_send.flash) dcs |= 0x10; - cur += pdu_encode_number(cur, _send.smsc, true); + if (!_send.smsc || !*_send.smsc) + *(cur++) = 0; + else + cur += pdu_encode_number(cur, _send.smsc, true); + *(cur++) = first_octet; *(cur++) = 0; /* reference */ diff --git a/commands-wms.h b/commands-wms.h index 07191da..83e6614 100644 --- a/commands-wms.h +++ b/commands-wms.h @@ -14,7 +14,7 @@ " --get-message : Get SMS message at index \n" \ " --get-raw-message : Get SMS raw message contents at index \n" \ " --send-message : Send SMS message (use options below)\n" \ - " --send-message-smsc : SMSC number (required)\n" \ + " --send-message-smsc : SMSC number\n" \ " --send-message-target : Destination number (required)\n" \ " --send-message-flash: Send as Flash SMS\n" \ -- 2.25.1