Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | STATE=$1 |
| 4 | shift |
| 5 | OPER=$* |
| 6 | |
| 7 | play() |
| 8 | { |
| 9 | canberra-gtk-play --file=$1 & |
| 10 | } |
| 11 | |
| 12 | |
| 13 | if [ "$STATE" = "START" ]; then |
| 14 | zenity --title="NFC operation" --info --text="$OPER" & |
| 15 | echo $! > nfc-status.pid |
| 16 | play /usr/share/sounds/ubuntu/stereo/system-ready.ogg |
| 17 | #espeak "NFC $OPER" |
| 18 | fi |
| 19 | |
| 20 | if [ "$STATE" = "SUCCESS" -o "$STATE" = "FAIL" ]; then |
| 21 | if [ -r nfc-status.pid ]; then |
| 22 | pid=`cat nfc-status.pid` |
| 23 | rm nfc-status.pid |
| 24 | if [ $pid -gt 0 ]; then |
| 25 | if ps -o command $pid | grep -q zenity; then |
| 26 | kill $pid |
| 27 | fi |
| 28 | fi |
| 29 | fi |
| 30 | fi |
| 31 | |
| 32 | if [ "$STATE" = "SUCCESS" ]; then |
| 33 | play /usr/share/sounds/freedesktop/stereo/complete.oga |
| 34 | #espeak "Success" |
| 35 | fi |
| 36 | |
| 37 | if [ "$STATE" = "FAIL" ]; then |
| 38 | play /usr/share/sounds/freedesktop/stereo/bell.oga |
| 39 | #espeak "Failed" |
| 40 | fi |