# Getting the 3G signal strength value


Using chat

# sakis3g disconnect
Disconnected.
# chat -V -s '' 'AT+CSQ' 'OK' '' > /dev/ttyUSB0 < /dev/ttyUSB0
AT+CSQ
+CSQ: 19,99

OK
Using comgt

# sakis3g disconnect
Disconnected.
# comgt -d /dev/ttyUSB0 sig
Signal Quality: 19,99
Script with chat
# cat get_rssi
#!/bin/bash

ubp="/usr/bin"
ulsp="/usr/local/sbin"
device="/dev/ttyUSB0"
output="/dev/null"

$ulsp/sakis3g disconnect > $output

rssi=`printf "%.f\n" $(($ubp/chat -V -s '' 'AT+CSQ' 'OK' '' > $device < $device) 2>&1 | $ubp/grep CSQ: | $ubp/awk '{print $2}')`
echo "RSSI = $rssi"
echo -n "Quality = "
if [ $rssi -gt 25 ]; then
        echo "Excellent ( 25 < RSSI )"
elif [ $rssi -gt 19 ] && [ $rssi -le 25 ]; then
        echo "Good ( 19 < RSSI <= 25 )"
elif [ $rssi -gt 13 ] && [ $rssi -le 19 ]; then
        echo "Average ( 13 < RSSI <= 19 )"
elif [ $rssi -gt 7 ] && [ $rssi -le 13 ]; then
        echo "Low ( 7 < RSSI <= 13 )"
elif [ $rssi -gt 0 ] && [ $rssi -le 7 ]; then
        echo "Very low ( 0 < RSSI <= 7 )"
else
        echo "No signal"
fi

$ulsp/sakis3g connect --console > $output
# ./get_rssi
RSSI = 20
Quality = Good ( 19 < RSSI <= 25 )

No comments: