Single-Click Send Waypoint
Provides an example of how a Waypoint can be send to the device using the
Waypoint data structure to generate the GPX. Much easier to use for websites
that don't produce their own GPX.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Garmin Display - Single-Click Waypoint Upload</title>
</head>
<script type="text/javascript" src="../prototype/prototype.js"> </script>
<script type="text/javascript" src="../garmin/device/GarminDeviceDisplay.js"> </script>
<script type="text/javascript">
function load() {
var display = new Garmin.DeviceDisplay("garminDisplay", {
pathKeyPairsArray: ["http://developer.garmin.com/","ee3934433a35ee348583236c2eeadbc1"],
unlockOnPageLoad: false, //delays unlocking to avoid authorization prompt until action
hideIfBrowserNotSupported: true,
showStatusElement: true, //provide minimal feedback
autoFindDevices: false, //it will search for devices upon action
findDevicesButtonText: "Upload Waypoint", //allows you to customize the action text
showCancelFindDevicesButton: false, //no need to cancel small data transfers
autoSelectFirstDevice: true, //pick the first device if several are found
autoReadData: false, //don't automatically read the tracks/etc
autoWriteData: true, //automatically write the data once devices found
showReadDataElement: false,
/*This is where the waypoint object is created and the necessary GPX is created.
* The plugin speaks GPX, but you (the developer) may not so simply use the
* Waypoint data structure to produce the GPX.
*/
getWriteData: function() {
var waypoint = new Garmin.WayPoint("37.828567", "-122.49875", null, "Geocache", "go find it...");
var factory = new Garmin.GpsDataFactory();
var gpx = factory.produceGpxString(null, [waypoint]);
return gpx;
},
afterFinishWriteToDevice: function() {
alert("Geocache saved successfully");
}
});
}
</script>
<body onload="load()">
<h2>Single-Click Waypoint Upload</h2>
<div id="garminDisplay"> </div>
</body>
</html>