diff --git a/desktop_software/README.mdown b/desktop_software/README.mdown index 6fbfcd8..662ef5e 100644 --- a/desktop_software/README.mdown +++ b/desktop_software/README.mdown @@ -4,7 +4,7 @@ This is the Desktop-side code base for the DeskAttendant project. Specifics -- -The daemon listens to the serial port where the Arduino is attached and will invoke the Sikuli script if the Arduino says to. Combined, the two sets of code mirror on the desktop the pause/run state that the Arduino is in at the time. +The shell script preps the given USB port and launches the python script. The python script listens to the serial port where the Arduino is attached and will apply changes to the three tracked applications, if they are running. In visual mode, a python script uses Sikuli to interact with applications via the GUI. In CLI mode, a different python script controls applications via shell commands. The end result is that the desktop applications are made to mirror the pause/run state that the Arduino is in at the time. How to use this code == diff --git a/desktop_software/ubuntu/README.mdown b/desktop_software/ubuntu/README.mdown index 5174baf..8f2bfc5 100644 --- a/desktop_software/ubuntu/README.mdown +++ b/desktop_software/ubuntu/README.mdown @@ -1,14 +1,16 @@ What's this? == -This is an Ubuntu-compatible daemon that listens for status changes from the Arduino and invokes the project's Sikuli script when appropriate. +desk_attendant.sh is a launcher for a python script that listens for status changes from the Arduino and applies those changes to tracked desktop apps as needed. If passed an optional '-v' argument, the python script called will use Sikuli to interact with the desktop apps via their GUIs. If omitted, the interaction is done via shell commands. -The Ubuntu daemon monitors the serial port of the attached Arduino for status information. When it sees that there has been an actionable status change (from "human present" to "human absent" or from "human absent" to "human present"), it launches one of the bundled Sikuli scripts to set desktop software to the appropriate run mode. +desk_attendant.py applies status changes via shell commands. It monitors the serial port of the attached Arduino for status information. When it sees that there has been an actionable status change (from "human present" to "human absent" or from "human absent" to "human present"), it invokes shell commands to set the tracked desktop applications (if running) to the appropriate run mode. -For example, if the daemon sees status going from "human present" to "human absent" it will launch the Sikuli script that pauses activities such as time tracking and music playing. +deskattendant.sikuli/deskattendant.py applies status changes via Sikuli, using openCV to detect click targets and using Sikuli libraries to click them. + +For example, if the daemon sees status going from "human present" to "human absent" it will pause activities such as time tracking and music playing. Invocation == -`desk_attendant.sh -p [port]` +`desk_attendant.sh -p PORT` e.g. diff --git a/desktop_software/ubuntu/desk_attendant.sh b/desktop_software/ubuntu/desk_attendant.sh index 5cb73f5..e93c793 100755 --- a/desktop_software/ubuntu/desk_attendant.sh +++ b/desktop_software/ubuntu/desk_attendant.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2012-2014 Robert W Igo +# Copyright 2012-2015 Robert W Igo # # bob@igo.name # http://bob.igo.name @@ -23,16 +23,18 @@ Usage() { echo "USAGE:" - echo `basename $0` "[-p port]" + echo `basename $0` "-p PORT [-v]" echo "-p: Serial port where your Arduino is attached" + echo "-v: interact with apps visually (using Sikuli); otherwise use CLI mode" echo "e.g." echo "$0 -p /dev/ttyUSB0" exit 4 } -while getopts "p:" FLAG ; do +while getopts "p:v:" FLAG ; do case "$FLAG" in p) port="$OPTARG";; + v) mode="visual";; *) Usage;; esac done @@ -56,5 +58,8 @@ stty -F $port raw ispeed $baud ospeed $baud time 3 min 1 -hupcl # NOTE: The paths used (or omitted) here must be compatible with your Sikuli installation and # with the location where you installed the deskattendant.sikuli directory. -#sikuli-ide -r /repos/DeskAttendant/desktop_software/sikuli/deskattendant.sikuli -args $port -python /repos/DeskAttendant/desktop_software/ubuntu/desk_attendant.py $port +if [ "$mode" == "visual" ]; then + sikuli-ide -r /repos/DeskAttendant/desktop_software/sikuli/deskattendant.sikuli -args $port +else + python /repos/DeskAttendant/desktop_software/ubuntu/desk_attendant.py $port +fi