From: Sławomir Demeszko Date: Mon, 22 Dec 2014 18:47:34 +0000 (+0100) Subject: Making smsc number optional X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=dc1dfedccc6cfa0205feecdbb5eb2c51d9aa3a4d;p=oweals%2Fuqmi.git Making smsc number optional 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 --- 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" \