#!/bin/bash

# Detect and print the signal level of the gc82 modem for "$COUNTER" 
# many times.
# This script is useful for searching  for a good spot in a weak area.

# Roger  roger@eskimo.com
# CVS: $Header: /home/roger/repository/bin/gc82sig.sh,v 1.3 2004/09/04 03:32:09 roger Exp $


# Variable Declarations
shopt -s -o nounset
declare -rx DEVICE="/dev/ttyS2"
declare -i COUNTER
declare -rx gsmctl="/usr/bin/gsmctl"

# Sanity Checks
if test ! -x "$gsmctl" ; then
	printf "$SCRIPT:$LINENO: the command $gsmctl is not available -\
	please install net-misc/gsmlib - abarting\n " >&2
fi

# Main
let COUNTER=0
{
while [ $COUNTER -lt 500 ]; do
	gsmctl -d $DEVICE sig
	# Uncomment the following to grab available operators too!
	#gsmctl -d /dev/ttyS2 op
	#printf "\n"
	let COUNTER=COUNTER+1
done
}

exit 0

