diff options
author | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2023-01-06 17:52:09 +0200 |
---|---|---|
committer | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2023-01-06 19:13:55 +0200 |
commit | e8b95d56ac9e06c3dc55f2c6fc3b2e177f9b10b0 (patch) | |
tree | 6b16f8af8a6aa3f177f9f243f182e9e1d06c9919 /src | |
parent | cd38e2b12d6f13dfd03eed207aa7f262e00099f1 (diff) | |
download | sms-utils-e8b95d56ac9e06c3dc55f2c6fc3b2e177f9b10b0.tar.gz sms-utils-e8b95d56ac9e06c3dc55f2c6fc3b2e177f9b10b0.tar.bz2 sms-utils-e8b95d56ac9e06c3dc55f2c6fc3b2e177f9b10b0.zip |
[GP-1842] Refactoring - Renamed Verizon 3GPP2 detection functions
Renamed the functions to better represent their behavior and purpose.
Diffstat (limited to 'src')
-rw-r--r-- | src/atcmd.c | 18 | ||||
-rw-r--r-- | src/atcmd.h | 6 | ||||
-rw-r--r-- | src/pdu_decode.c | 4 | ||||
-rw-r--r-- | src/pdu_encode.c | 2 | ||||
-rw-r--r-- | src/sms_delete.c | 4 | ||||
-rw-r--r-- | src/sms_list.c | 6 | ||||
-rw-r--r-- | src/sms_send.c | 10 |
7 files changed, 26 insertions, 24 deletions
diff --git a/src/atcmd.c b/src/atcmd.c index 7c39313..0c4860a 100644 --- a/src/atcmd.c +++ b/src/atcmd.c @@ -878,7 +878,7 @@ int atcmd_plus_cpms_read(int fd, struct data_store *read_store, struct data_store *store; struct data_store *data_stores[] = {read_store, send_store, new_store}; - if (isCdmaTypeModel()) { + if (is_telit_3gpp2_format()) { data_stores_size = 2; } else { @@ -1006,7 +1006,7 @@ int atcmd_plus_cpms_write(int fd, const char *read_name, char buf[ATCMD_LINE_SIZE]; int tmp; - if (isCdmaTypeModel()) { + if (is_telit_3gpp2_format()) { atcmd_writeline(fd, "AT+CPMS=\"%s\",\"%s\"", read_name, send_name); } else @@ -1475,7 +1475,7 @@ static int sms_atcmd_init(int fd) } //Doesn't apply to CDMA type radios - if (!isCdmaTypeModel() && !msg_store_choice(&new_store, Global.core.msg_store_new)) { + if (!is_telit_3gpp2_format() && !msg_store_choice(&new_store, Global.core.msg_store_new)) { log_error("message storage location %s is not a choice", Global.core.msg_store_new); return -1; @@ -1543,7 +1543,8 @@ int sms_device_open(void) return fd; } -int is_vzw_lte(void) +/* Detect Telit LTE radios that use the 3GPP2 SMS format for Verizon */ +int is_telit_lte_vzw_3gpp2_format(void) { if (!strcmp(Global.core.model, "LE910-NA1")) { log_debug("Found LE910-NA1"); @@ -1558,8 +1559,8 @@ int is_vzw_lte(void) !strncmp(Global.core.model, "LE910-SV1", MODEL_LEN)); } -/* Detect LNA7/L4G1 radio with Verizon SIM */ -int is_quectel_dual_sms_format(void) +/* Detect LNA7/LNA7D/L4G1 radios with Verizon SIM that support both 3GPP and 3GPP2 */ +int is_quectel_dual_format(void) { if (!strncmp(Global.core.model, "EG95", MODEL_LEN) || !strncmp(Global.core.model, "EG25", MODEL_LEN)) @@ -1574,10 +1575,11 @@ int is_quectel_dual_sms_format(void) return 0; } -int isCdmaTypeModel() +/* Detect Telit LTE and CDMA radios that use the 3GPP2 SMS format for Verizon */ +int is_telit_3gpp2_format() { /* Test for possible dual firmware model */ - if (is_vzw_lte()) + if (is_telit_lte_vzw_3gpp2_format()) return 1; return (!strncmp(Global.core.model, "DE910-DUAL", MODEL_LEN) || diff --git a/src/atcmd.h b/src/atcmd.h index 28bc384..1f15e62 100644 --- a/src/atcmd.h +++ b/src/atcmd.h @@ -72,7 +72,7 @@ int atcmd_plus_cmgd_write(int fd, int index); int atcmd_plus_qcfg_write(int fd, int sms_format); -int isCdmaTypeModel(); +int is_telit_3gpp2_format(); #define STORE_NAME_LEN 2 #define STORE_NAME_SIZE (STORE_NAME_LEN + 1) @@ -121,8 +121,8 @@ int atcmd_plus_gmi_read(int fd); int atcmd_init(int fd, int read_timeout); int sms_device_close(int fd); int sms_device_open(void); -int is_vzw_lte(void); -int is_quectel_dual_sms_format(void); +int is_telit_lte_vzw_3gpp2_format(void); +int is_quectel_dual_format(void); int is_telit_model(void); int is_quectel_model(void); diff --git a/src/pdu_decode.c b/src/pdu_decode.c index 7f76ff5..9014162 100644 --- a/src/pdu_decode.c +++ b/src/pdu_decode.c @@ -237,7 +237,7 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu, int *nr_octe // CDMA 7-BIT ENCODING } else if (pdu->data_coding.general.alphabet == PDU_ALPHABET_CDMA_DEFAULT) { - if (is_vzw_lte()) { + if (is_telit_lte_vzw_3gpp2_format()) { // LE910-SVG stores data length as # of septets log_debug("counting PDU length byte as number of septets (LE910-SVG/LE910-SV1/LE910-NA1/VZW)"); *nr_octets = octets_from_septets(pdu->user_data_len); @@ -340,7 +340,7 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu, int *nr_octe } //Remove padded byte for data length of 7 characters if not LE910-SVG - if (!is_vzw_lte() && (pdu->user_data[i-1] == 0)) { + if (!is_telit_lte_vzw_3gpp2_format() && (pdu->user_data[i-1] == 0)) { log_debug("Removing padded char"); i--; pdu->user_data_len--; diff --git a/src/pdu_encode.c b/src/pdu_encode.c index d859543..34028a9 100644 --- a/src/pdu_encode.c +++ b/src/pdu_encode.c @@ -88,7 +88,7 @@ int pdu_encode_addr(char *pdu_str, size_t len, struct pdu_addr *addr, int smsc) int addr_len; int tmp; - if (isCdmaTypeModel()) { + if (is_telit_3gpp2_format()) { //CDMA length is # of bytes including address type //Ex: Type: 80 #: 9132074666 --> 80 19 23 70 64 66 => 6 bytes addr_len = 1; //1 byte for address type diff --git a/src/sms_delete.c b/src/sms_delete.c index 7bd50d0..e70ddc3 100644 --- a/src/sms_delete.c +++ b/src/sms_delete.c @@ -167,8 +167,8 @@ int sms_delete(int argc, char **argv) return false; } - // LNA7/L4G1 with Verizon SIM SMS 3GPP, 3GPP2 WORKAROUND - if (is_quectel_dual_sms_format()) { + // LNA7/LNA7D/L4G1 with Verizon SIM SMS 3GPP, 3GPP2 WORKAROUND + if (is_quectel_dual_format()) { int tmp; tmp = atcmd_plus_qcfg_write(fd, SMS_FORMAT_3GPP); if (tmp == 0) { diff --git a/src/sms_list.c b/src/sms_list.c index 3a3d395..7f246be 100644 --- a/src/sms_list.c +++ b/src/sms_list.c @@ -283,7 +283,7 @@ static int list_info_callback(char *buf, size_t len, void *data) msg = list_entry(list_info->msg_list.prev, typeof(*msg), list); if (msg->len > 0) { - if (isCdmaTypeModel()) { + if (is_telit_3gpp2_format()) { log_debug("using CDMA pdu decoding"); err = pdu_decode_cdma(buf, &msg->pdu); } @@ -499,8 +499,8 @@ int sms_list(int argc, char **argv) return false; } - // LNA7 with Verizon SIM SMS 3GPP, 3GPP2 WORKAROUND - if (is_quectel_dual_sms_format()) { + // LNA7/LNA7D/L4G1 with Verizon SIM SMS 3GPP, 3GPP2 WORKAROUND + if (is_quectel_dual_format()) { int tmp; tmp = atcmd_plus_qcfg_write(fd, SMS_FORMAT_3GPP); if (tmp == 0) { diff --git a/src/sms_send.c b/src/sms_send.c index 149ce1a..a95a0ca 100644 --- a/src/sms_send.c +++ b/src/sms_send.c @@ -225,7 +225,7 @@ static int do_send(int fd, struct send_options *options, int argc, char **argv) } //LE910-SVG SMS SEND WORKAROUND - if (is_vzw_lte()) { + if (is_telit_lte_vzw_3gpp2_format()) { log_info("setting text mode for Verizon LTE"); tmp = atcmd_plus_cmgf_write(fd, SMS_TEXT_MODE); if (tmp < 0) { @@ -235,7 +235,7 @@ static int do_send(int fd, struct send_options *options, int argc, char **argv) } if (options->cmgw_first) { - if (isCdmaTypeModel()) { + if (is_telit_3gpp2_format()) { log_debug("using CDMA pdu encoding for cmgw"); tmp = pdu_encode_cdma(buf, sizeof(buf), &pdu); } @@ -253,7 +253,7 @@ static int do_send(int fd, struct send_options *options, int argc, char **argv) } //LE910-SVG SMS SEND WORKAROUND - if (is_vzw_lte()) { + if (is_telit_lte_vzw_3gpp2_format()) { mem_index = atcmd_plus_cmgw_write_text(fd, NULL, SMS_ADDR_UNSPEC, NULL, pdu.user_data, pdu.user_data_len); } else { @@ -298,7 +298,7 @@ static int do_send(int fd, struct send_options *options, int argc, char **argv) continue; } } else { - if (isCdmaTypeModel()) { + if (is_telit_3gpp2_format()) { log_debug("using CDMA pdu encoding for cmgs"); tmp = pdu_encode_cdma(buf, sizeof(buf), &pdu); } @@ -313,7 +313,7 @@ static int do_send(int fd, struct send_options *options, int argc, char **argv) } //LE910-SVG SMS SEND WORKAROUND - if (is_vzw_lte()) { + if (is_telit_lte_vzw_3gpp2_format()) { tmp = atcmd_plus_cmgs_write_text(fd, pdu.addr.addr, pdu.user_data, pdu.user_data_len); } else { |