From bcb780500672dae89fc773c124b7fa8b5e01485d Mon Sep 17 00:00:00 2001 From: Fred Grott Date: Sun, 18 Jan 2009 16:00:53 -0600 Subject: [PATCH] one panel is user updates GPS other is automaic via pollling --- assets/gap.js | 11 +++++++++++ assets/index.html | 30 +++++++++++++++++++----------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/assets/gap.js b/assets/gap.js index 2115d76e..32ab5d67 100644 --- a/assets/gap.js +++ b/assets/gap.js @@ -22,6 +22,17 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* + * At times we have to do polling in javascript, that is have function run at a specified interval + * repeated times. However, certain function polling will reduce battery life thus + * each of those features should have its own user defined interval + * that our js reads in and uses with of course conservative value used + * is consumer has not set one or the user of this library has not set one. + * + * Timeout only runs function twice not repeated times and thus we use + * setInterval. This should correct problems with + * both GPS and Accelerometer readings on Android + */ try { $ // Test if it is already used diff --git a/assets/index.html b/assets/index.html index 32901678..da4b55da 100644 --- a/assets/index.html +++ b/assets/index.html @@ -16,9 +16,10 @@ initGap = function() { // Device.init() initializes OS-Device values Device.init(); - // Device.Location.callback = updateLocation sets to funciotn updateLocation so that lat and lon can be passed - Device.Location.callback = updateLocation; + + // Device.Location.init() to initalize location + Device.Location.init(); //Device.Acceleration.callback = updateAccel; } @@ -44,12 +45,18 @@ updateSettings = function() { $('uuid').value = Device.uuid; } -updateLocation = function(lat,lon) { - alert('lat=' + lat + ' lon=' + lon); +updateLocation = function(lat, lon) { + // updateLocatin based on user input + + $('lat').value = lat; $('lon').value = lon; + + + } + updateAccel = function(){ $('accelx').value = accelX; $('accely').value = accelY; @@ -70,7 +77,7 @@ addLoadEvent(initGap);