Files
quectel-rgmii-toolkit/simpleadmin/www/cgi-bin/get_sms
iamromulan c9d0e45aa3 Merge @dr-dolomite 's for-merging branch
-Create new development-v2 branch to work on simpleadmin v2

-Merged @dr-dolomite work from:
2d197220a4

Co-Authored-By: Russel Yasol <73575327+dr-dolomite@users.noreply.github.com>
2024-05-03 15:47:01 -04:00

20 lines
473 B
Bash

#!/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\""
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