See video tutorial
Created
September 14, 2010 10:06
-
-
Save thedod/578824 to your computer and use it in GitHub Desktop.
Crude BlueTooth cellular-theft alarm script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Just browse files on phone(s) via bluetooth to create connection, | |
# then run this script. Will beep if someone steals your phone. | |
#### Minimum allowed rssi (received signal strength information). | |
# Move the phone around the house, check the levels on the display, | |
# and decide what's the best value for your needs. | |
export MINRSSI="-30" | |
export CONS="`hcitool con | grep '<' | sed -e 's/^.*ACL //' -e 's/ .*$//' | tr -s [:space:] ' '`" | |
export NAMES="" | |
for CON in $CONS; do | |
if [ "$NAMES" ]; then | |
export NAMES="$NAMES\n" | |
fi | |
export NAMES="${NAMES}${CON} `hcitool name $CON`" | |
done | |
while [ 1 ] ; do | |
export STATUS="" | |
export ALARM="" | |
for CON in $CONS; do | |
export RSSI=`hcitool rssi $CON |sed -e 's/^.*: //'` | |
if [ -z "$RSSI" ] ; then | |
export STATUS="$CON (Off!)s\n$STATUS" | |
export ALARM=y | |
else | |
export STATUS="$CON ($RSSI)\n$STATUS" | |
if [ $RSSI -lt $MINRSSI ] ; then | |
export ALARM=y | |
fi | |
fi | |
done | |
clear | |
echo ======== Watching phone\(s\): ======== | |
echo $NAMES | |
echo "A phone with less rssi than ($MINRSSI) will trigger alarm. edit MINRSSI to change." | |
echo ==================================== | |
echo -n "$STATUS\r" | |
if [ "$ALARM" ] ; then | |
play -q -n synth 0.2 sin 440 gain -5 bend 0,440,.2 repeat 3 | |
fi | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment