added dedicated NR-CA SA parser

This commit is contained in:
Russel Yasol
2024-03-25 00:06:44 +08:00
parent b423866d0d
commit f58ccff0bf
4 changed files with 45 additions and 52 deletions

View File

@@ -16,8 +16,8 @@ fi
MYATCMD=$(printf '%b\n' "${atcmd//%/\\x}")
if [ -n "${MYATCMD}" ]; then
x=$(urldecode "$atcmd")
# Initialize wait time to 2 seconds
wait_time=2
# Initialize wait time to 1 second
wait_time=1000
while true; do
runcmd=$(echo -en "$x\r\n" | microcom -t $wait_time /dev/ttyOUT2)
# Check if "OK" or "ERROR" is present in the response

View File

@@ -0,0 +1,24 @@
#!/bin/bash
# This is a simple scrip that fetches the SMS messages from the device
SMS_MESSAGE_INDICATION="AT+CNMI=2,1"
SMS_FORMAT="AT+CMGF=1"
SMS_LIST="AT+CMGL=\"ALL\""
# Send the all the AT commands 1 by 1 with 2 seconds waiting time for each command
runcmd=$(echo -en "$SMS_MESSAGE_INDICATION\r\n" | microcom -t 1000 /dev/ttyOUT2)
runcmd=$(echo -en "$SMS_FORMAT\r\n" | microcom -t 1000 /dev/ttyOUT2)
while true; do
runcmd=$(echo -en "$SMS_LIST\r\n" | microcom -t 2000 /dev/ttyOUT2)
if [[ $runcmd =~ "OK" ]] || [[ $runcmd =~ "ERROR" ]]; then
break
fi
((wait_time++))
done
# Print the list of SMS messages as JSON plain text
echo "Content-type: text/plain"
echo ""
echo $runcmd