#!/bin/sh
# -*-Tcl-*- \
exec tclsh "$0" ${1+"$@"}
#
# Example stop script for gps-pocolibs on the gps-base RTK reference
#

set prefix	"/opt/openrobots"
set exec_prefix	"${prefix}"
set libdir	"${exec_prefix}/lib"
lappend auto_path ${libdir}

set h2		${exec_prefix}/bin/h2
set gps		${exec_prefix}/bin/gps-pocolibs
set gpsclient	${libdir}/genom/pocolibs/plugins/gps

try {
  package require genomix
  set g [genomix::localhost]

  $g load $gpsclient -i gps-base as gps

  gps::kill
  while {![catch {gps::genom_state}]} { after 200 }

  exec $h2 end
} on error e {
  catch { exec $h2 end }
  puts stderr $e
  exit 2
}
