1     
  2     if (typeof(DeviceInfo) != 'object')
  3         DeviceInfo = {};
  4     
  5     /**
  6      * This represents the PhoneGap API itself, and provides a global namespace for accessing
  7      * information about the state of PhoneGap.
  8      * @class
  9      */
 10     PhoneGap = {
 11         queue: {
 12             ready: true,
 13             commands: [],
 14             timer: null
 15         },
 16         _constructors: []
 17     };
 18     
 19     /**
 20      * Boolean flag indicating if the PhoneGap API is available and initialized.
 21      */
 22     PhoneGap.available = DeviceInfo.uuid != undefined;
 23     
 24     /**
 25      * Add an initialization function to a queue that ensures it will run and initialize
 26      * application constructors only once PhoneGap has been initialized.
 27      * @param {Function} func The function callback you want run once PhoneGap is initialized
 28      */
 29     PhoneGap.addConstructor = function(func) {
 30         var state = document.readyState;
 31         if (state != 'loaded' && state != 'complete')
 32             PhoneGap._constructors.push(func);
 33         else
 34             func();
 35     };
 36     (function() {
 37         var timer = setInterval(function() {
 38             var state = document.readyState;
 39             if (state != 'loaded' && state != 'complete')
 40                 return;
 41             clearInterval(timer);
 42             while (PhoneGap._constructors.length > 0) {
 43                 var constructor = PhoneGap._constructors.shift();
 44                 try {
 45                     constructor();
 46                 } catch(e) {
 47                     if (typeof(debug['log']) == 'function')
 48                         debug.log("Failed to run constructor: " + e.message);
 49                     else
 50                         alert("Failed to run constructor: " + e.message);
 51                 }
 52             }
 53         }, 1);
 54     })();
 55     
 56     
 57     /**
 58      * Execute a PhoneGap command in a queued fashion, to ensure commands do not
 59      * execute with any race conditions, and only run when PhoneGap is ready to
 60      * recieve them.
 61      * @param {String} command Command to be run in PhoneGap, e.g. "ClassName.method"
 62      * @param {String[]} [args] Zero or more arguments to pass to the method
 63      */
 64     PhoneGap.exec = function() {
 65         PhoneGap.queue.commands.push(arguments);
 66         if (PhoneGap.queue.timer == null)
 67             PhoneGap.queue.timer = setInterval(PhoneGap.run_command, 10);
 68     };
 69     /**
 70      * Internal function used to dispatch the request to PhoneGap.  This needs to be implemented per-platform to
 71      * ensure that methods are called on the phone in a way appropriate for that device.
 72      * @private
 73      */
 74     PhoneGap.run_command = function() {
 75     };
 76     
 77     /**
 78      * this represents the mobile device, and provides properties for inspecting the model, version, UUID of the
 79      * phone, etc.
 80      * @constructor
 81      */
 82     function Device() {
 83         this.available = PhoneGap.available;
 84         this.model     = null;
 85         this.version   = null;
 86         this.gap       = null;
 87         this.uuid      = null;
 88         try {
 89             if (window['DroidGap'] != undefined && window.DroidGap.exists()) {
 90                 this.available = true;
 91                 this.isAndroid = true;
 92                 this.uuid = window.DroidGap.getUuid();
 93                 this.gapVersion = window.DroidGap.getVersion();
 94             } else {          
 95                 this.model     = DeviceInfo.platform;
 96                 this.version   = DeviceInfo.version;
 97                 this.gap       = DeviceInfo.gap;
 98                 this.uuid      = DeviceInfo.uuid;
 99             }
100         } catch(e) {
101             this.available = false;
102         }
103     }
104     
105     PhoneGap.addConstructor(function() {
106         navigator.device = window.device = new Device();
107     });
108     
109     
110     
111     /**
112      * This class contains acceleration information
113      * @constructor
114      * @param {Number} x The force applied by the device in the x-axis.
115      * @param {Number} y The force applied by the device in the y-axis.
116      * @param {Number} z The force applied by the device in the z-axis.
117      */
118     function Acceleration(x, y, z) {
119     	/**
120     	 * The force applied by the device in the x-axis.
121     	 */
122     	this.x = x;
123     	/**
124     	 * The force applied by the device in the y-axis.
125     	 */
126     	this.y = y;
127     	/**
128     	 * The force applied by the device in the z-axis.
129     	 */
130     	this.z = z;
131     	/**
132     	 * The time that the acceleration was obtained.
133     	 */
134     	this.timestamp = new Date().getTime();
135     }
136     
137     /**
138      * This class specifies the options for requesting acceleration data.
139      * @constructor
140      */
141     function AccelerationOptions() {
142     	/**
143     	 * The timeout after which if acceleration data cannot be obtained the errorCallback
144     	 * is called.
145     	 */
146     	this.timeout = 10000;
147     }
148     
149     
150     /**
151      * This class provides access to device accelerometer data.
152      * @constructor
153      */
154     function Accelerometer() {
155     	/**
156     	 * The last known acceleration.
157     	 */
158     	this.lastAcceleration = null;
159     }
160     
161     /**
162      * Asynchronously aquires the current acceleration.
163      * @param {Function} successCallback The function to call when the acceleration
164      * data is available
165      * @param {Function} errorCallback The function to call when there is an error 
166      * getting the acceleration data.
167      * @param {AccelerationOptions} options The options for getting the accelerometer data
168      * such as timeout.
169      */
170     Accelerometer.prototype.getCurrentAcceleration = function(successCallback, errorCallback, options) {
171     	// If the acceleration is available then call success
172     	// If the acceleration is not available then call error
173     	
174     	// Created for iPhone, Iphone passes back _accel obj litteral
175     	if (typeof successCallback == "function") {
176     		var accel = new Acceleration(_accel.x,_accel.y,_accel.z);
177     		Accelerometer.lastAcceleration = accel;
178     		successCallback(accel);
179     	}
180     }
181     
182     /**
183      * Asynchronously aquires the acceleration repeatedly at a given interval.
184      * @param {Function} successCallback The function to call each time the acceleration
185      * data is available
186      * @param {Function} errorCallback The function to call when there is an error 
187      * getting the acceleration data.
188      * @param {AccelerationOptions} options The options for getting the accelerometer data
189      * such as timeout.
190      */
191     
192     Accelerometer.prototype.watchAcceleration = function(successCallback, errorCallback, options) {
193     	this.getCurrentAcceleration(successCallback, errorCallback, options);
194     	// TODO: add the interval id to a list so we can clear all watches
195      	var frequency = (options != undefined)? options.frequency : 10000;
196     	return setInterval(function() {
197     		navigator.accelerometer.getCurrentAcceleration(successCallback, errorCallback, options);
198     	}, frequency);
199     }
200     
201     /**
202      * Clears the specified accelerometer watch.
203      * @param {String} watchId The ID of the watch returned from #watchAcceleration.
204      */
205     Accelerometer.prototype.clearWatch = function(watchId) {
206     	clearInterval(watchId);
207     }
208     
209     PhoneGap.addConstructor(function() {
210         if (typeof navigator.accelerometer == "undefined") navigator.accelerometer = new Accelerometer();
211     });
212     
213     
214     
215     
216     /**
217      * This class provides access to the device media, interfaces to both sound and video
218      * @constructor
219      */
220     function Media(src) {
221     	this.src = src;
222     }
223     
224     Media.prototype.play = function() {
225     }
226     
227     Media.prototype.pause = function() {
228     }
229     
230     Media.prototype.stop = function() {
231     }
232     
233     
234     /**
235      * This class contains information about any Media errors.
236      * @constructor
237      */
238     function MediaError() {
239     	this.code = null,
240     	this.message = "";
241     }
242     
243     MediaError.MEDIA_ERR_ABORTED 		= 1;
244     MediaError.MEDIA_ERR_NETWORK 		= 2;
245     MediaError.MEDIA_ERR_DECODE 		= 3;
246     MediaError.MEDIA_ERR_NONE_SUPPORTED = 4;
247     
248     
249     //if (typeof navigator.audio == "undefined") navigator.audio = new Media(src);
250     
251     
252     /**
253      * This class provides access to the device camera.
254      * @constructor
255      */
256     function Camera() {
257     	
258     }
259     
260     /**
261      * 
262      * @param {Function} successCallback
263      * @param {Function} errorCallback
264      * @param {Object} options
265      */
266     Camera.prototype.getPicture = function(successCallback, errorCallback, options) {
267     	
268     }
269     
270     PhoneGap.addConstructor(function() {
271         if (typeof navigator.camera == "undefined") navigator.camera = new Camera();
272     });
273     
274     
275     
276     /**
277      * This class provides access to the device contacts.
278      * @constructor
279      */
280     function Contact() {
281     	this.name = "";
282     	this.phone = "";
283     	this.address = "";
284     }
285     
286     /**
287      * 
288      * @param {Object} successCallback
289      * @param {Object} errorCallback
290      * @param {Object} options
291      */
292     Contact.prototype.get = function(successCallback, errorCallback, options) {
293     	
294     }
295     
296     
297     function ContactManager() {
298     	// Dummy object to hold array of contacts
299     	this.contacts = [];
300     	this.timestap = new Date().getTime();
301     }
302     
303     ContactManager.prototype.get = function(successCallback, errorCallback, options) {
304     	// Interface
305     }
306     
307     PhoneGap.addConstructor(function() {
308         if (typeof navigator.ContactManager == "undefined") navigator.ContactManager = new ContactManager();
309     });
310     
311     
312     
313     /**
314      * This class exposes mobile phone interface controls to JavaScript, such as
315      * native tab and tool bars, etc.
316      * @constructor
317      */
318     function UIControls() {
319         this.tabBarTag = 0;
320         this.tabBarCallbacks = {};
321     }
322     
323     /**
324      * Create a native tab bar that can have tab buttons added to it which can respond to events.
325      */
326     UIControls.prototype.createTabBar = function() {};
327     
328     /**
329      * Show a tab bar.  The tab bar has to be created first.
330      * @param {Object} [options] Options indicating how the tab bar should be shown:
331      * - \c height integer indicating the height of the tab bar (default: \c 49)
332      * - \c position specifies whether the tab bar will be placed at the \c top or \c bottom of the screen (default: \c bottom)
333      */
334     UIControls.prototype.showTabBar = function(options) {};
335     
336     /**
337      * Hide a tab bar.  The tab bar has to be created first.
338      */
339     UIControls.prototype.hideTabBar = function(animate) {};
340     
341     /**
342      * Create a new tab bar item for use on a previously created tab bar.  Use ::showTabBarItems to show the new item on the tab bar.
343      *
344      * If the supplied image name is one of the labels listed below, then this method will construct a tab button
345      * using the standard system buttons.  Note that if you use one of the system images, that the \c title you supply will be ignored.
346      *
347      * <b>Tab Buttons</b>
348      *   - tabButton:More
349      *   - tabButton:Favorites
350      *   - tabButton:Featured
351      *   - tabButton:TopRated
352      *   - tabButton:Recents
353      *   - tabButton:Contacts
354      *   - tabButton:History
355      *   - tabButton:Bookmarks
356      *   - tabButton:Search
357      *   - tabButton:Downloads
358      *   - tabButton:MostRecent
359      *   - tabButton:MostViewed
360      * @param {String} name internal name to refer to this tab by
361      * @param {String} [title] title text to show on the tab, or null if no text should be shown
362      * @param {String} [image] image filename or internal identifier to show, or null if now image should be shown
363      * @param {Object} [options] Options for customizing the individual tab item
364      *  - \c badge value to display in the optional circular badge on the item; if null or unspecified, the badge will be hidden
365      */
366     UIControls.prototype.createTabBarItem = function(name, label, image, options) {};
367     
368     /**
369      * Update an existing tab bar item to change its badge value.
370      * @param {String} name internal name used to represent this item when it was created
371      * @param {Object} options Options for customizing the individual tab item
372      *  - \c badge value to display in the optional circular badge on the item; if null or unspecified, the badge will be hidden
373      */
374     UIControls.prototype.updateTabBarItem = function(name, options) {};
375     
376     /**
377      * Show previously created items on the tab bar
378      * @param {String} arguments... the item names to be shown
379      * @param {Object} [options] dictionary of options, notable options including:
380      *  - \c animate indicates that the items should animate onto the tab bar
381      * @see createTabBarItem
382      * @see createTabBar
383      */
384     UIControls.prototype.showTabBarItems = function(tabs, options) {};
385     
386     /**
387      * Manually select an individual tab bar item, or nil for deselecting a currently selected tab bar item.
388      * @param {String} tabName the name of the tab to select, or null if all tabs should be deselected
389      * @see createTabBarItem
390      * @see showTabBarItems
391      */
392     UIControls.prototype.selectTabBarItem = function(tab) {};
393     
394     /**
395      * Function called when a tab bar item has been selected.
396      * @param {Number} tag the tag number for the item that has been selected
397      */
398     UIControls.prototype.tabBarItemSelected = function(tag) {
399         if (typeof(this.tabBarCallbacks[tag]) == 'function')
400             this.tabBarCallbacks[tag]();
401     };
402     
403     /**
404      * Create a toolbar.
405      */
406     UIControls.prototype.createToolBar = function() {};
407     
408     /**
409      * Function called when a tab bar item has been selected.
410      * @param {String} title the title to set within the toolbar
411      */
412     UIControls.prototype.setToolBarTitle = function(title) {};
413     
414     PhoneGap.addConstructor(function() {
415         window.uicontrols = new UIControls();
416     });
417     
418     
419     
420     /**
421      * This class provides access to the debugging console.
422      * @constructor
423      */
424     function DebugConsole() {
425     }
426     
427     /**
428      * Utility function for rendering and indenting strings, or serializing
429      * objects to a string capable of being printed to the console.
430      * @param {Object|String} message The string or object to convert to an indented string
431      * @private
432      */
433     DebugConsole.prototype.processMessage = function(message) {
434         if (typeof(message) != 'object') {
435             return encodeURIComponent(message);
436         } else {
437             /**
438              * @function
439              * @ignore
440              */
441             function indent(str) {
442                 return str.replace(/^/mg, "    ");
443             }
444             /**
445              * @function
446              * @ignore
447              */
448             function makeStructured(obj) {
449                 var str = "";
450                 for (var i in obj) {
451                     try {
452                         if (typeof(obj[i]) == 'object') {
453                             str += i + ":\n" + indent(makeStructured(obj[i])) + "\n";
454                         } else {
455                             str += i + " = " + indent(String(obj[i])).replace(/^    /, "") + "\n";
456                         }
457                     } catch(e) {
458                         str += i + " = EXCEPTION: " + e.message + "\n";
459                     }
460                 }
461                 return str;
462             }
463             return encodeURIComponent("Object:\n" + makeStructured(message));
464         }
465     };
466     
467     /**
468      * Print a normal log message to the console
469      * @param {Object|String} message Message or object to print to the console
470      */
471     DebugConsole.prototype.log = function(message) {
472     };
473     
474     /**
475      * Print a warning message to the console
476      * @param {Object|String} message Message or object to print to the console
477      */
478     DebugConsole.prototype.warn = function(message) {
479     };
480     
481     /**
482      * Print an error message to the console
483      * @param {Object|String} message Message or object to print to the console
484      */
485     DebugConsole.prototype.error = function(message) {
486     };
487     
488     PhoneGap.addConstructor(function() {
489         window.debug = new DebugConsole();
490     });
491     
492     
493     
494     /**
495      * This class provides generic read and write access to the mobile device file system.
496      */
497     function File() {
498     	/**
499     	 * The data of a file.
500     	 */
501     	this.data = "";
502     	/**
503     	 * The name of the file.
504     	 */
505     	this.name = "";
506     }
507     
508     /**
509      * Reads a file from the mobile device. This function is asyncronous.
510      * @param {String} fileName The name (including the path) to the file on the mobile device. 
511      * The file name will likely be device dependant.
512      * @param {Function} successCallback The function to call when the file is successfully read.
513      * @param {Function} errorCallback The function to call when there is an error reading the file from the device.
514      */
515     File.prototype.read = function(fileName, successCallback, errorCallback) {
516     	
517     }
518     
519     /**
520      * Writes a file to the mobile device.
521      * @param {File} file The file to write to the device.
522      */
523     File.prototype.write = function(file) {
524     	
525     }
526     
527     PhoneGap.addConstructor(function() {
528         if (typeof navigator.file == "undefined") navigator.file = new File();
529     });
530     
531     
532     
533     /**
534      * This class provides access to device GPS data.
535      * @constructor
536      */
537     function Geolocation() {
538         /**
539          * The last known GPS position.
540          */
541         this.lastPosition = null;
542         this.lastError = null;
543         this.callbacks = {
544             onLocationChanged: [],
545             onError:           []
546         };
547     };
548     
549     /**
550      * Asynchronously aquires the current position.
551      * @param {Function} successCallback The function to call when the position
552      * data is available
553      * @param {Function} errorCallback The function to call when there is an error 
554      * getting the position data.
555      * @param {PositionOptions} options The options for getting the position data
556      * such as timeout.
557      */
558     Geolocation.prototype.getCurrentPosition = function(successCallback, errorCallback, options) {
559         var referenceTime = 0;
560         if (this.lastPosition)
561             referenceTime = this.lastPosition.timeout;
562         else
563             this.start(options);
564     
565         var timeout = 20000;
566         var interval = 500;
567         if (typeof(options) == 'object' && options.interval)
568             interval = options.interval;
569     
570         if (typeof(successCallback) != 'function')
571             successCallback = function() {};
572         if (typeof(errorCallback) != 'function')
573             errorCallback = function() {};
574     
575         var dis = this;
576         var delay = 0;
577         var timer = setInterval(function() {
578             delay += interval;
579     
580             if (typeof(dis.lastPosition) == 'object' && dis.lastPosition.timestamp > referenceTime) {
581                 successCallback(dis.lastPosition);
582                 clearInterval(timer);
583             } else if (delay >= timeout) {
584                 errorCallback();
585                 clearInterval(timer);
586             }
587         }, interval);
588     };
589     
590     /**
591      * Asynchronously aquires the position repeatedly at a given interval.
592      * @param {Function} successCallback The function to call each time the position
593      * data is available
594      * @param {Function} errorCallback The function to call when there is an error 
595      * getting the position data.
596      * @param {PositionOptions} options The options for getting the position data
597      * such as timeout and the frequency of the watch.
598      */
599     Geolocation.prototype.watchPosition = function(successCallback, errorCallback, options) {
600     	// Invoke the appropriate callback with a new Position object every time the implementation 
601     	// determines that the position of the hosting device has changed. 
602     	
603     	this.getCurrentPosition(successCallback, errorCallback, options);
604     	var frequency = 10000;
605             if (typeof(options) == 'object' && options.frequency)
606                 frequency = options.frequency;
607     	
608     	var that = this;
609     	return setInterval(function() {
610     		that.getCurrentPosition(successCallback, errorCallback, options);
611     	}, frequency);
612     };
613     
614     
615     /**
616      * Clears the specified position watch.
617      * @param {String} watchId The ID of the watch returned from #watchPosition.
618      */
619     Geolocation.prototype.clearWatch = function(watchId) {
620     	clearInterval(watchId);
621     };
622     
623     /**
624      * Called by the geolocation framework when the current location is found.
625      * @param {PositionOptions} position The current position.
626      */
627     Geolocation.prototype.setLocation = function(position) {
628         this.lastPosition = position;
629         for (var i = 0; i < this.callbacks.onLocationChanged.length; i++) {
630             var f = this.callbacks.onLocationChanged.shift();
631             f(position);
632         }
633     };
634     
635     /**
636      * Called by the geolocation framework when an error occurs while looking up the current position.
637      * @param {String} message The text of the error message.
638      */
639     Geolocation.prototype.setError = function(message) {
640         this.lastError = message;
641         for (var i = 0; i < this.callbacks.onError.length; i++) {
642             var f = this.callbacks.onError.shift();
643             f(message);
644         }
645     };
646     
647     PhoneGap.addConstructor(function() {
648         if (typeof navigator.geolocation == "undefined") navigator.geolocation = new Geolocation();
649     });
650     
651     
652     
653     /**
654      * This class provides access to native mapping applications on the device.
655      */
656     function Map() {
657     	
658     }
659     
660     /**
661      * Shows a native map on the device with pins at the given positions.
662      * @param {Array} positions
663      */
664     Map.prototype.show = function(positions) {
665     	
666     }
667     
668     PhoneGap.addConstructor(function() {
669         if (typeof navigator.map == "undefined") navigator.map = new Map();
670     });
671     
672     
673     
674     /**
675      * This class provides access to notifications on the device.
676      */
677     function Notification() {
678     	
679     }
680     
681     /**
682      * Open a native alert dialog, with a customizable title and button text.
683      * @param {String} message Message to print in the body of the alert
684      * @param {String} [title="Alert"] Title of the alert dialog (default: Alert)
685      * @param {String} [buttonLabel="OK"] Label of the close button (default: OK)
686      */
687     Notification.prototype.alert = function(message, title, buttonLabel) {
688         // Default is to use a browser alert; this will use "index.html" as the title though
689         alert(message);
690     };
691     
692     /**
693      * Start spinning the activity indicator on the statusbar
694      */
695     Notification.prototype.activityStart = function() {
696     };
697     
698     /**
699      * Stop spinning the activity indicator on the statusbar, if it's currently spinning
700      */
701     Notification.prototype.activityStop = function() {
702     };
703     
704     /**
705      * Causes the device to blink a status LED.
706      * @param {Integer} count The number of blinks.
707      * @param {String} colour The colour of the light.
708      */
709     Notification.prototype.blink = function(count, colour) {
710     	
711     };
712     
713     /**
714      * Causes the device to vibrate.
715      * @param {Integer} mills The number of milliseconds to vibrate for.
716      */
717     Notification.prototype.vibrate = function(mills) {
718     	
719     };
720     
721     /**
722      * Causes the device to beep.
723      * @param {Integer} count The number of beeps.
724      * @param {Integer} volume The volume of the beep.
725      */
726     Notification.prototype.beep = function(count, volume) {
727     	
728     };
729     
730     // TODO: of course on Blackberry and Android there notifications in the UI as well
731     
732     PhoneGap.addConstructor(function() {
733         if (typeof navigator.notification == "undefined") navigator.notification = new Notification();
734     });
735     
736     
737     
738     /**
739      * This class provides access to the device orientation.
740      * @constructor
741      */
742     function Orientation() {
743     	/**
744     	 * The last known orientation.
745     	 */
746     	this.lastOrientation = null;
747     }
748     
749     /**
750      * Asynchronously aquires the current orientation.
751      * @param {Function} successCallback The function to call when the orientation
752      * is known.
753      * @param {Function} errorCallback The function to call when there is an error 
754      * getting the orientation.
755      */
756     Orientation.prototype.getCurrentOrientation = function(successCallback, errorCallback) {
757     	// If the position is available then call success
758     	// If the position is not available then call error
759     }
760     
761     /**
762      * Asynchronously aquires the orientation repeatedly at a given interval.
763      * @param {Function} successCallback The function to call each time the orientation
764      * data is available.
765      * @param {Function} errorCallback The function to call when there is an error 
766      * getting the orientation data.
767      */
768     Orientation.prototype.watchOrientation = function(successCallback, errorCallback) {
769     	// Invoke the appropriate callback with a new Position object every time the implementation 
770     	// determines that the position of the hosting device has changed. 
771     	this.getCurrentPosition(successCallback, errorCallback);
772     	return setInterval(function() {
773     		navigator.orientation.getCurrentOrientation(successCallback, errorCallback);
774     	}, 10000);
775     }
776     
777     /**
778      * Clears the specified orientation watch.
779      * @param {String} watchId The ID of the watch returned from #watchOrientation.
780      */
781     Orientation.prototype.clearWatch = function(watchId) {
782     	clearInterval(watchId);
783     }
784     
785     PhoneGap.addConstructor(function() {
786         if (typeof navigator.orientation == "undefined") navigator.orientation = new Orientation();
787     });
788     
789     
790     
791     /**
792      * This class contains position information.
793      * @param {Object} lat
794      * @param {Object} lng
795      * @param {Object} acc
796      * @param {Object} alt
797      * @param {Object} altacc
798      * @param {Object} head
799      * @param {Object} vel
800      * @constructor
801      */
802     function Position(lat, lng, acc, alt, altacc, head, vel) {
803     	/**
804     	 * The latitude of the position.
805     	 */
806     	this.latitude = lat;
807     	/**
808     	 * The longitude of the position,
809     	 */
810     	this.longitude = lng;
811     	/**
812     	 * The accuracy of the position.
813     	 */
814     	this.accuracy = acc;
815     	/**
816     	 * The altitude of the position.
817     	 */
818     	this.altitude = alt;
819     	/**
820     	 * The altitude accuracy of the position.
821     	 */
822     	this.altitudeAccuracy = altacc;
823     	/**
824     	 * The direction the device is moving at the position.
825     	 */
826     	this.heading = head;
827     	/**
828     	 * The velocity with which the device is moving at the position.
829     	 */
830     	this.velocity = vel;
831     	/**
832     	 * The time that the position was obtained.
833     	 */
834     	this.timestamp = new Date().getTime();
835     }
836     
837     /**
838      * This class specifies the options for requesting position data.
839      * @constructor
840      */
841     function PositionOptions() {
842     	/**
843     	 * Specifies the desired position accuracy.
844     	 */
845     	this.enableHighAccuracy = true;
846     	/**
847     	 * The timeout after which if position data cannot be obtained the errorCallback
848     	 * is called.
849     	 */
850     	this.timeout = 10000;
851     }
852     
853     /**
854      * This class contains information about any GSP errors.
855      * @constructor
856      */
857     function PositionError() {
858     	this.code = null;
859     	this.message = "";
860     }
861     
862     PositionError.UNKNOWN_ERROR = 0;
863     PositionError.PERMISSION_DENIED = 1;
864     PositionError.POSITION_UNAVAILABLE = 2;
865     PositionError.TIMEOUT = 3;
866     
867     
868     
869     /**
870      * This class provides access to the device SMS functionality.
871      * @constructor
872      */
873     function Sms() {
874     
875     }
876     
877     /**
878      * Sends an SMS message.
879      * @param {Integer} number The phone number to send the message to.
880      * @param {String} message The contents of the SMS message to send.
881      * @param {Function} successCallback The function to call when the SMS message is sent.
882      * @param {Function} errorCallback The function to call when there is an error sending the SMS message.
883      * @param {PositionOptions} options The options for accessing the GPS location such as timeout and accuracy.
884      */
885     Sms.prototype.send = function(number, message, successCallback, errorCallback, options) {
886     	
887     }
888     
889     PhoneGap.addConstructor(function() {
890         if (typeof navigator.sms == "undefined") navigator.sms = new Sms();
891     });
892     
893     
894     
895     /**
896      * This class provides access to the telephony features of the device.
897      * @constructor
898      */
899     function Telephony() {
900     	
901     }
902     
903     /**
904      * Calls the specifed number.
905      * @param {Integer} number The number to be called.
906      */
907     Telephony.prototype.call = function(number) {
908     	
909     }
910     
911     PhoneGap.addConstructor(function() {
912         if (typeof navigator.telephony == "undefined") navigator.telephony = new Telephony();
913     });
914     
915     
916