From cd38e2b12d6f13dfd03eed207aa7f262e00099f1 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Fri, 6 Jan 2023 16:57:35 +0200 Subject: [GP-1842] Refactoring - Fixed indentations This project uses tabs, not spaces. Make the indentation consistent. --- src/atcmd.c | 118 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 59 insertions(+), 59 deletions(-) (limited to 'src/atcmd.c') diff --git a/src/atcmd.c b/src/atcmd.c index b988a57..7c39313 100644 --- a/src/atcmd.c +++ b/src/atcmd.c @@ -873,17 +873,17 @@ int atcmd_plus_cpms_read(int fd, struct data_store *read_store, char *token; int tmp; int i; - int data_stores_size; + int data_stores_size; struct data_store *store; - struct data_store *data_stores[] = {read_store, send_store, new_store}; + struct data_store *data_stores[] = {read_store, send_store, new_store}; - if (isCdmaTypeModel()) { - data_stores_size = 2; - } - else { - data_stores_size = 3; - } + if (isCdmaTypeModel()) { + data_stores_size = 2; + } + else { + data_stores_size = 3; + } atcmd_writeline(fd, "AT+CPMS?"); tmp = atcmd_expect_line(fd, buf, sizeof(buf), "+CPMS: "); @@ -944,7 +944,7 @@ int atcmd_plus_cpms_test(int fd, struct store_locations *read_loc, int tmp; int i, j; - struct store_locations *locations[] = {read_loc, send_loc, new_loc}; + struct store_locations *locations[] = {read_loc, send_loc, new_loc}; struct store_locations *loc; atcmd_writeline(fd, "AT+CPMS=?"); @@ -1006,14 +1006,14 @@ int atcmd_plus_cpms_write(int fd, const char *read_name, char buf[ATCMD_LINE_SIZE]; int tmp; - if (isCdmaTypeModel()) { - atcmd_writeline(fd, "AT+CPMS=\"%s\",\"%s\"", read_name, send_name); - } - else - { - atcmd_writeline(fd, "AT+CPMS=\"%s\",\"%s\",\"%s\"", - read_name, send_name, new_name); - } + if (isCdmaTypeModel()) { + atcmd_writeline(fd, "AT+CPMS=\"%s\",\"%s\"", read_name, send_name); + } + else + { + atcmd_writeline(fd, "AT+CPMS=\"%s\",\"%s\",\"%s\"", + read_name, send_name, new_name); + } tmp = atcmd_expect_line(fd, buf, sizeof(buf), "OK"); if (tmp <= 0) { log_debug("expected OK but it was not received"); @@ -1224,15 +1224,15 @@ int atcmd_plus_gmm_read(int fd) int tmp; atcmd_writeline(fd, "AT+GMM"); - //Swallow extra "\r\n" - tmp = atcmd_readline(fd, buf, sizeof(buf)); + //Swallow extra "\r\n" + tmp = atcmd_readline(fd, buf, sizeof(buf)); if (tmp <= 0) { log_debug("expected \\r\\n but it was not received"); return -1; } - //Read model string - tmp = atcmd_readline(fd, buf, sizeof(buf)); + //Read model string + tmp = atcmd_readline(fd, buf, sizeof(buf)); if (tmp <= 0) { log_debug("expected model but it was not received"); return -1; @@ -1313,7 +1313,7 @@ int atcmd_plus_iccid_read(int fd) if (is_telit_model()) { command = "AT#CCID"; if (strstr(Global.core.model, "FN980")) { - command = "AT+ICCID"; + command = "AT+ICCID"; } } else if (is_quectel_model()) { command = "AT+QCCID"; @@ -1323,18 +1323,18 @@ int atcmd_plus_iccid_read(int fd) } atcmd_writeline(fd, command); - //Swallow extra "\r\n" - tmp = atcmd_readline(fd, buf, sizeof(buf)); + //Swallow extra "\r\n" + tmp = atcmd_readline(fd, buf, sizeof(buf)); if (tmp <= 0) { log_debug("expected \\r\\n but it was not received"); return -1; } - //Read iccid string - tmp = atcmd_readline(fd, buf, sizeof(buf)); + //Read iccid string + tmp = atcmd_readline(fd, buf, sizeof(buf)); if (tmp <= 0) { log_debug("expected ICCID but it was not received"); - /* Currently only LNA3 models will need the ICCID */ + /* Currently only LNA3 models will need the ICCID */ return -1; } @@ -1347,7 +1347,7 @@ int atcmd_plus_iccid_read(int fd) } else { log_debug("token is %s",token); } - tmp_buf = strrchr(token,' '); + tmp_buf = strrchr(token,' '); if (tmp_buf) { token = ++tmp_buf; log_debug("Found blank, incrementing tmp"); @@ -1421,19 +1421,19 @@ static int sms_atcmd_init(int fd) tmp = atcmd_plus_gmm_read(fd); if (tmp < 0) { - log_error("failed to read radio model"); + log_error("failed to read radio model"); return -1; } tmp = atcmd_plus_gmi_read(fd); if (tmp < 0) { - log_error("failed to read radio manufacturer"); + log_error("failed to read radio manufacturer"); return -1; } - tmp = atcmd_plus_iccid_read(fd); + tmp = atcmd_plus_iccid_read(fd); if (tmp < 0) { - log_error("failed to read SIM ICCID"); + log_error("failed to read SIM ICCID"); return -1; } @@ -1446,22 +1446,22 @@ static int sms_atcmd_init(int fd) memset(&send_store, 0, sizeof(send_store)); memset(&new_store, 0, sizeof(new_store)); - if (!strcmp(Global.core.model, "CE910-DUAL") || !strcmp(Global.core.model, "DE910-DUAL")) { - log_info("Changing message storage locations to ME for CE/DE910-DUAL"); - free(Global.core.msg_store_read); - free(Global.core.msg_store_send); - free(Global.core.pb_store); - Global.core.msg_store_read = strdup("ME"); - Global.core.msg_store_send = strdup("ME"); - Global.core.pb_store = strdup("ME"); - } + if (!strcmp(Global.core.model, "CE910-DUAL") || !strcmp(Global.core.model, "DE910-DUAL")) { + log_info("Changing message storage locations to ME for CE/DE910-DUAL"); + free(Global.core.msg_store_read); + free(Global.core.msg_store_send); + free(Global.core.pb_store); + Global.core.msg_store_read = strdup("ME"); + Global.core.msg_store_send = strdup("ME"); + Global.core.pb_store = strdup("ME"); + } atcmd_plus_cpms_test(fd, &read_store.choices, &send_store.choices, &new_store.choices); atcmd_plus_cpms_read(fd, &read_store.selected, &send_store.selected, &new_store.selected, Global.core.model); if (Global.core.msg_store_read && Global.core.msg_store_send && - Global.core.msg_store_new) { + Global.core.msg_store_new) { if (!msg_store_choice(&read_store, Global.core.msg_store_read)) { log_error("message storage location %s is not a choice", @@ -1474,7 +1474,7 @@ static int sms_atcmd_init(int fd) return -1; } - //Doesn't apply to CDMA type radios + //Doesn't apply to CDMA type radios if (!isCdmaTypeModel() && !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); @@ -1545,17 +1545,17 @@ int sms_device_open(void) int is_vzw_lte(void) { - if (!strcmp(Global.core.model, "LE910-NA1")) { - log_debug("Found LE910-NA1"); - /* Verizon Wireless SIM */ - if (strncmp(Global.core.iccid,"891480",6) == 0) { - log_debug("Found VZW SIM"); - return 1; - } - } - - return (!strncmp(Global.core.model, "LE910-SVG", MODEL_LEN) || - !strncmp(Global.core.model, "LE910-SV1", MODEL_LEN)); + if (!strcmp(Global.core.model, "LE910-NA1")) { + log_debug("Found LE910-NA1"); + /* Verizon Wireless SIM */ + if (strncmp(Global.core.iccid,"891480",6) == 0) { + log_debug("Found VZW SIM"); + return 1; + } + } + + return (!strncmp(Global.core.model, "LE910-SVG", MODEL_LEN) || + !strncmp(Global.core.model, "LE910-SV1", MODEL_LEN)); } /* Detect LNA7/L4G1 radio with Verizon SIM */ @@ -1576,12 +1576,12 @@ int is_quectel_dual_sms_format(void) int isCdmaTypeModel() { - /* Test for possible dual firmware model */ - if (is_vzw_lte()) - return 1; + /* Test for possible dual firmware model */ + if (is_vzw_lte()) + return 1; - return (!strncmp(Global.core.model, "DE910-DUAL", MODEL_LEN) || - !strncmp(Global.core.model, "CE910-DUAL", MODEL_LEN)); + return (!strncmp(Global.core.model, "DE910-DUAL", MODEL_LEN) || + !strncmp(Global.core.model, "CE910-DUAL", MODEL_LEN)); } int is_telit_model() -- cgit v1.2.3