diff --git a/simpleadmin/script/sms.sh b/simpleadmin/script/sms.sh deleted file mode 100644 index 6a2af92..0000000 --- a/simpleadmin/script/sms.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# Check if the required parameters are provided -if [ "$#" -ne 2 ]; then - echo "Usage: $0 " - exit 1 -fi - -# Assign the provided parameters to variables -phone_number="$1" -message="$2" - -# Send the AT command to set the message format to text mode -echo -ne "AT+CMGF=1\r" > microcom -s /dev/ttyOUT2 -sleep 1 -echo -ne "AT+CNMI=2,1\r" > microcom /dev/ttyOUT2 -sleep 1 -echo -ne 'AT+CMGS="09938931024"\r' > microcom /dev/ttyOUT2 -sleep 1 - -# Send the message -echo -ne "$message" > microcom /dev/ttyOUT2 -echo -ne "\032" > microcom /dev/ttyOUT2 - -# Wait for the response -sleep 1 - -# Capture and output the response -runcmd=$(microcom /dev/ttyOUT2) -# echo "Content-type: text/plain" -echo "$runcmd" \ No newline at end of file diff --git a/simpleadmin/www/cgi-bin/get_sms b/simpleadmin/www/cgi-bin/get_sms deleted file mode 100644 index a341832..0000000 --- a/simpleadmin/www/cgi-bin/get_sms +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -SMS_FORMAT="AT+CMGF=1" -SMS_LIST="AT+CMGL=\"ALL\"" -send_at_command() { - local command="$1" - echo -en "$command\r\n" | microcom -t 2000 /dev/ttyOUT2 -} -send_at_command "$SMS_FORMAT" -runcmd=$(send_at_command "$SMS_LIST") - -echo "Content-type: text/plain" -echo "$runcmd" \ No newline at end of file diff --git a/simpleadmin/www/cgi-bin/send_sms b/simpleadmin/www/cgi-bin/send_sms index 2e8f316..cc70e4e 100644 --- a/simpleadmin/www/cgi-bin/send_sms +++ b/simpleadmin/www/cgi-bin/send_sms @@ -20,35 +20,12 @@ fi phone_number="$number" message_encoded="$msg" -phone_number="+86$phone_number" send_at_command() { local cmd=$1 - echo "Sending command: $cmd" >&2 - echo -en "$cmd\r" | microcom -t 1000 /dev/ttyOUT2 - sleep 2 - local response=$(microcom -t 1000 /dev/ttyOUT2) - echo "Response: $response" >&2 - echo "$response" + echo -en "$cmd\r" | microcom -t 100 /dev/ttyOUT2 } -send_at_command "AT+CMGF=1" -send_at_command "AT+CSCS=\"UCS2\"" - -encode_ucs2() { - local input="$1" - local output="" - local i - for ((i=0; i<${#input}; i++)); do - hex=$(printf "%04X" "'${input:$i:1}") - output="$output$hex" - done - echo "$output" -} - -phone_number_ucs2=$(encode_ucs2 "$phone_number") -ATCMD="AT+CMGS=\"$phone_number_ucs2\"" -send_at_command "$ATCMD" - -runcmd=$((echo -en "$message_encoded"; sleep 1; echo -en "\x1A") | microcom -t 1000 /dev/ttyOUT2) +send_at_command "AT+CMGS=\"$phone_number\","$Command"" +runcmd=$((echo -en "$message_encoded"; echo -en "\x1A") | microcom -t 500 /dev/ttyOUT2) echo "$runcmd" \ No newline at end of file diff --git a/simpleadmin/www/deviceinfo.html b/simpleadmin/www/deviceinfo.html index 07cbd01..985c3e1 100644 --- a/simpleadmin/www/deviceinfo.html +++ b/simpleadmin/www/deviceinfo.html @@ -51,9 +51,10 @@ - +