From 703880eb75134fa5c76a376975deb478a69fb06e Mon Sep 17 00:00:00 2001 From: kutayboz Date: Wed, 7 Jun 2023 23:47:31 +0300 Subject: Changed the command list to a simplier one --- src/main.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 51fed38..6ebfcd2 100644 --- a/src/main.c +++ b/src/main.c @@ -9,9 +9,18 @@ int main() { - char *commandList[] = {"AT", "ATI", "AT+COPS?", "AT+COPS=?"}, - *infoCmdList[] = {"AT+CREG?", "AT+COPS?", "AT+CSQ", "AT+QLTS=1", - "AT+QNWINFO", "AT+QCSQ", "AT+QSPN", "AT+CCLK?"}, + char *commandList[] = {"AT", + "ATI", + "AT+QCFG=\"nwscanmode\"", + "AT+QCFG=\"iotopmode\"", + "AT+COPS?", + "AT+CREG?", + "AT+CSQ", + "AT+QLTS=1", + "AT+QNWINFO", + "AT+QCSQ", + "AT+QSPN", + "AT+CCLK?"}, serialFilePath[] = "/dev/serial0", *output; int serialPort, moduleStatus; @@ -56,16 +65,6 @@ int main() { printf("%s\n", output); } - for (idx = 0; idx < sizeof(infoCmdList) / sizeof(*infoCmdList); idx++) { - if (0 != querySerialPort(&output, serialPort, infoCmdList[idx])) { - printf("Error querySerialPort()\n"); - close(serialPort); - free(output); - return 1; - } - printf("%s\n", output); - } - close(serialPort); free(output); return 0; -- cgit v1.3