diff options
author | Brandon Bayer <bbayer@multitech.com> | 2015-10-26 14:58:43 -0500 |
---|---|---|
committer | Brandon Bayer <bbayer@multitech.com> | 2015-11-06 13:49:06 -0600 |
commit | be01eb8a87f1582b1c15ec4e09a9a66770da87c5 (patch) | |
tree | d2044a650d334dca4aa2efb2521e3ecf887ac86b /src/sms_send.c | |
parent | ab80a82e2e0f5ea7cdef0394f80e69b377fab779 (diff) | |
download | sms-utils-be01eb8a87f1582b1c15ec4e09a9a66770da87c5.tar.gz sms-utils-be01eb8a87f1582b1c15ec4e09a9a66770da87c5.tar.bz2 sms-utils-be01eb8a87f1582b1c15ec4e09a9a66770da87c5.zip |
feat: sms support for CE910-DUAL, DE910-DUAL, LE910-SVG0.0.8
- PDU is used for everything except LE910-SVG sending
- a bug in radio requires radio reboot to send more than 1 PDU sms
Diffstat (limited to 'src/sms_send.c')
-rw-r--r-- | src/sms_send.c | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/src/sms_send.c b/src/sms_send.c index 8ed7ebb..3933786 100644 --- a/src/sms_send.c +++ b/src/sms_send.c @@ -224,8 +224,25 @@ static int do_send(int fd, struct send_options *options, int argc, char **argv) printf("preparing for send...\n"); } + //LE910-SVG SMS SEND WORKAROUND + if (!strcmp(Global.core.model, "LE910-SVG")) { + log_info("setting text mode for LE910-SVG"); + tmp = atcmd_plus_cmgf_write(fd, SMS_TEXT_MODE); + if (tmp < 0) { + log_error("failed to set text mode for sending with LE910-SVG"); + return false; + } + } + if (options->cmgw_first) { - tmp = pdu_encode(buf, sizeof(buf), &pdu); + if (isCdmaTypeModel()) { + log_debug("using CDMA pdu encoding for cmgw"); + tmp = pdu_encode_cdma(buf, sizeof(buf), &pdu); + } + else { + log_debug("using GSM pdu encoding for cmgw"); + tmp = pdu_encode(buf, sizeof(buf), &pdu); + } if (tmp < 0) { log_error("pdu encode failed"); return false; @@ -235,7 +252,13 @@ static int do_send(int fd, struct send_options *options, int argc, char **argv) printf("writing message to memory\n"); } - mem_index = atcmd_plus_cmgw_write(fd, buf, pdu.msg_len); + //LE910-SVG SMS SEND WORKAROUND + if (!strcmp(Global.core.model, "LE910-SVG")) { + mem_index = atcmd_plus_cmgw_write_text(fd, NULL, SMS_ADDR_UNSPEC, NULL, pdu.user_data, pdu.user_data_len); + } + else { + mem_index = atcmd_plus_cmgw_write(fd, buf, pdu.msg_len); + } if (mem_index < 0) { log_error("write message to memory failed"); return false; @@ -275,14 +298,27 @@ static int do_send(int fd, struct send_options *options, int argc, char **argv) continue; } } else { - tmp = pdu_encode(buf, sizeof(buf), &pdu); + if (isCdmaTypeModel()) { + log_debug("using CDMA pdu encoding for cmgs"); + tmp = pdu_encode_cdma(buf, sizeof(buf), &pdu); + } + else { + log_debug("using GSM pdu encoding for cmgs"); + tmp = pdu_encode(buf, sizeof(buf), &pdu); + } if (tmp < 0) { printf("sending message to %s failed\n", argv[i]); failed++; continue; } - tmp = atcmd_plus_cmgs_write(fd, buf, pdu.msg_len); + //LE910-SVG SMS SEND WORKAROUND + if (!strcmp(Global.core.model, "LE910-SVG")) { + tmp = atcmd_plus_cmgs_write_text(fd, pdu.addr.addr, pdu.user_data, pdu.user_data_len); + } + else { + tmp = atcmd_plus_cmgs_write(fd, buf, pdu.msg_len); + } if (tmp < 0) { printf("sending message to %s failed\n", argv[i]); failed++; |