/usr/lib/gpsman/gpsinfo.tcl is in gpsman 6.4.4.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | #
# This file is part of:
#
# gpsman --- GPS Manager: a manager for GPS receiver data
#
# Copyright (c) 1998-2013 Miguel Filgueiras migfilg@t-online.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.
#
# File: gpsinfo.tcl
# Last change: 6 October 2013
#
# Includes contributions by Brian Baulch (baulchb_AT_onthenet.com.au)
# marked "BSB contribution"
proc DisableGPS {} {
# change interface appearance when detecting that the receiver went offline
global RcW RcMenu GPSState GPSLabel COLOUR TXT SYMBOLIMAGE WConf
# state
set GPSState offline ; set GPSLabel $TXT(offline)
$RcW.frgps.bs.state configure -fg $COLOUR(offline)
$RcMenu entryconfigure 5 -image $SYMBOLIMAGE(diamond_red)
# device name can be changed
$RcMenu.dev entryconfigure 0 -state normal
$RcW.frgps.dev.dev configure -state normal
# baud rate cannot be changed
if { [winfo exists $RcW.frgps.dev.baud] } {
$RcMenu.dev entryconfigure 1 -state disabled
$RcW.frgps.dev.baud configure -state disabled
}
# cannot turn off or get/put items
foreach ix "6 7 8" {
$RcMenu entryconfigure $ix -state disabled
}
$RcW.frgps.bs.off configure -state disabled
foreach m "getbs putbs" {
foreach b $WConf(rec,$m) { $b configure -state disabled }
}
return
}
proc EnableGPS {} {
# change interface appearance when detecting that the receiver went on-line
global RcW RcMenu GPSState GPSLabel COLOUR ListInds TXT RECTYPES RECINFO \
MYGPS SYMBOLIMAGE WConf RecCanChgBaud
# state
set GPSState online ; set GPSLabel $TXT(online)
$RcW.frgps.bs.state configure -fg $COLOUR(online)
$RcMenu entryconfigure 5 -image $SYMBOLIMAGE(diamond_green)
# cannot change device name when in use
$RcMenu.dev entryconfigure 0 -state disabled
$RcW.frgps.dev.dev configure -state disabled
# baud rate can be changed if receiver supports that
if { [winfo exists $RcW.frgps.dev.baud] && $RecCanChgBaud } {
$RcMenu.dev entryconfigure 1 -state normal
$RcW.frgps.dev.baud configure -state normal
}
# can turn off and see get/put submenus
foreach ix "6 7 8" {
$RcMenu entryconfigure $ix -state normal
}
# disable all get/put buttons and submenu entries, then enable valid ones
foreach m "$RcMenu.gm $RcMenu.ptm" {
set l [$m index last]
for { set i 0 } { $i <= $l } { incr i } {
$m entryconfigure $i -state disabled
}
}
$RcW.frgps.bs.off configure -state normal
foreach m "getbs putbs" {
foreach b $WConf(rec,$m) { $b configure -state disabled }
}
# enable valid entries in those menus and the corresponding buttons
foreach i $RECTYPES {
if { $i != "GR" || $ListInds(GR) != "" } {
$RcW.frget.frget2.get$i configure -state normal
$RcMenu.gm entryconfigure $WConf(rec,getmn,$i) -state normal
}
# based on BSB contribution: no IC put button
if { $i != "IC" && $i != "LAP" && $ListInds($i) != "" } {
$RcW.frput.put$i configure -state normal
$RcMenu.ptm entryconfigure $WConf(rec,putmn,$i) -state normal
}
}
foreach i $RECINFO {
$RcW.frget.frget2.get$i configure -state normal
$RcMenu.gm entryconfigure $WConf(rec,getmn,$i) -state normal
}
InitGPS
return
}
proc CheckGPS {} {
# check connectivity to receiver
global GPSState GPSLabel COLOUR MESS TXT
SetCursor . watch
if { $GPSState == "offline" } {
GPSConnection EnableGPS
} else {
GPSConnection [list GMMessage $MESS(GPSok)] DisableGPS
}
set GPSLabel $TXT($GPSState)
ResetCursor .
return
}
proc TurnOff {} {
global GPSState COLOUR
GPSOff
DisableGPS
return
}
proc PutOnGPS {how wh} {
# put data into receiver
# $how in {all, select}, $wh in $RECTYPES
global ListInds RECTYPES MESS TXT
if { $wh == "LAP" } { return }
switch $how {
all {
set ixs $ListInds($wh)
}
select {
if { [set ixs [ChooseItems $wh]] == "" } {
return
}
}
}
switch $wh {
GR {
set gtypes [Delete $RECTYPES LAP]
set ts ""
foreach k $gtypes { lappend ts $TXT(name$k) }
while 1 {
set whs [GMChooseFrom many $MESS(putwhat) 6 $ts $gtypes]
if { [set i [lsearch -exact $whs GR]] != -1 } {
set whs [lreplace $whs $i $i]
set r 1
} else { set r 0 }
if { [llength $whs] > 1 } {
GMMessage $MESS(exportonly1)
} else { break }
}
# this only works for a single type
if { [set l [GRsElements $ixs $r $whs]] != "" } {
PutItemsOnGPS $whs $l
}
}
default {
PutItemsOnGPS $wh $ixs
}
}
return
}
proc PutItemsOnGPS {wh ixs} {
# put items of kind $wh (in $RECTYPES except GR and LAP) on receiver
# $ixs is list of indices
global MAX MESS TXT
if { [llength $ixs] > $MAX($wh) } {
GMMessage [format $MESS(toomany) $TXT(name$wh) $MAX($wh)]
return
}
PutGPS $wh $ixs
return
}
proc GetFromGPS {wh} {
# get data from receiver
# $wh in $RECTYPES
# if $wh==GR, select a single item type (in $RECTYPES except TR) to get
global RECTYPES
# BSB contribution
global MYGPS
if { $wh == "GR" } {
# based on BSB contribution: do not get ICs
if { $MYGPS != "Lowrance" } {
set not "TR"
} else { set not "IC TR" }
InputToGR $RECTYPES $not Ignore GetGPSIn Ignore receiver
} else {
GetGPS $wh
}
return
}
proc GPSChangeDevice {} {
# get device name from user and set global SERIALPORT
global SERIALPORT TXT
set old $SERIALPORT
if { [GMChooseParams $TXT(chgdev) SERIALPORT [list =$TXT(optDEFSPORT)]] \
== 0 } {
set SERIALPORT $old
}
return
}
|