terrasync
var computeStatusText = func {
# first, check if the system is actually enabled
if (!getprop('/sim/terrasync/enabled'))
return "Downloading disabled";
# only happens if terrasync failed to activate, so
# indicates a problem
if (!getprop('/sim/terrasync/active'))
return "unable to start downloading";
var errCount = getprop('/sim/terrasync/error-count');
if (errCount > 0)
return "errors occurred during download";
# we need to suggest some remedial action here!
if (getprop('/sim/terrasync/stalled'))
return "Downloading has stalled. Check yuor network connection and settings";
if (getprop('/sim/terrasync/busy')) {
var kbytesSec = getprop('/sim/terrasync/transfer-rate-bytes-sec') / 1024;
return sprintf('Downloading: %dKB/sec', int(kbytesSec));
}
# we are enabled but not busy, so idle
return "Idle";
}
# timer function, update summary status string
var updateStatusText = func {
var s = computeStatusText();
setprop("/sim/gui/dialogs/terrasync/status", s);
}
# the TerraSync properties of interest are tied, so we can't use a
# listener. Let's poll while the dialog is open; not ideal but not
# a major problem.
var statusTimer = maketimer(0.4, updateStatusText);
statusTimer.start();
updateStatusText();
statusTimer.stop();
statusTimer = nil;
vboxhbox11message1.00.40.4centervboxtableleftfalseterrasync-enabledleft1