org.symbian.tools.wrttools/plugin.xml
changeset 376 5027709c9315
parent 375 d1edab2715d4
child 381 8620655754e5
--- a/org.symbian.tools.wrttools/plugin.xml	Mon Jun 14 17:16:31 2010 -0700
+++ b/org.symbian.tools.wrttools/plugin.xml	Tue Jun 15 11:52:19 2010 -0700
@@ -876,36 +876,6 @@
           smallicon="icons/main16.gif"
           contenttypes="org.eclipse.wst.jsdt.core.jsSource">
        <item
-             description="This function can be used as a callback in GetLocation and Trace calls to location service."
-             id="org.symbian.tools.wrttools.location"
-             label="Location callback">
-          <content>
-function locationUpdated(transactionId, code, result) {
-	if (result.ErrorCode == 0) {
-		var longitude = result.ReturnValue.Longitude; // Longitude estimate in degrees. The value range is [+180, -180].
-		var latitude = result.ReturnValue.Latitude; // Latitude estimate in degrees. The value range is [+90, -90].
-		var altitude = result.ReturnValue.Altitude; // Elevation estimate in meters relative to the WGS 84 datum.
-		var satelliteNumView = result.ReturnValue.SatelliteNumView; // Number of satellites currently in view.
-		var satelliteNumViewUsed = result.ReturnValue.SatelliteNumViewUsed; // Number of satellites used to obtain the location fix.
-		var horizontalSpeed = result.ReturnValue.HorizontalSpeed; // Horizontal speed estimate in meters per second. This is the speed of the device at the time the location fix was obtained.
-		var horizontalSpeedError = result.ReturnValue.HorizontalSpeedError; // Horizontal speed error in meters per second.
-		var trueCourse = result.ReturnValue.TrueCourse; // Current direction of movement in degrees in relation to true north.
-		var trueCourseError = result.ReturnValue.TrueCourseError; // TrueCourse error in degrees.
-		var magneticHeading = result.ReturnValue.MagneticHeading; // Current direction of movement in degrees in relation to magnetic north.
-		var magneticHeadingError = result.ReturnValue.MagneticHeadingError; // MagneticHeading error in degrees.
-		var heading = result.ReturnValue.Heading; // Current instantaneous direction of movement in degrees in relation to true north.
-		var headingError = result.ReturnValue.HeadingError; // Heading error in degrees.
-		var magneticCourse = result.ReturnValue.MagneticCourse; // Current instantaneous direction of movement in degrees in relation to magnetic north.
-		var magneticCourseError = result.ReturnValue.MagneticCourseError; // MagneticCourse error in degrees
-		// TODO Location information was received
-	} else {
-		var errorCode = result.ErrorCode;
-		var errorMessage = result.ErrorMessage;
-		// TODO Failed to retrieve location information
-	}
-}          </content>
-       </item>
-       <item
              description="Retrieves list of the contacts"
              id="org.symbian.tools.wrttools.contacts"
              label="Get contacts">
@@ -952,7 +922,7 @@
        <item
              description="Adds callback that will be notified of orientation chnages"
              id="org.symbian.tools.wrttools.contacts"
-             label="Add orientation callback">
+             label="Register orientation callback">
           <content>
 var sensors = device.getServiceObject("Service.Sensor", "ISensor");
 	var SensorParams = {
@@ -978,6 +948,36 @@
          </content>
        </item>
        <item
+             description="This function can be used as a callback in GetLocation and Trace calls to location service."
+             id="org.symbian.tools.wrttools.location"
+             label="Location callback">
+          <content>
+function locationUpdated(transactionId, code, result) {
+	if (result.ErrorCode == 0) {
+		var longitude = result.ReturnValue.Longitude; // Longitude estimate in degrees. The value range is [+180, -180].
+		var latitude = result.ReturnValue.Latitude; // Latitude estimate in degrees. The value range is [+90, -90].
+		var altitude = result.ReturnValue.Altitude; // Elevation estimate in meters relative to the WGS 84 datum.
+		var satelliteNumView = result.ReturnValue.SatelliteNumView; // Number of satellites currently in view.
+		var satelliteNumViewUsed = result.ReturnValue.SatelliteNumViewUsed; // Number of satellites used to obtain the location fix.
+		var horizontalSpeed = result.ReturnValue.HorizontalSpeed; // Horizontal speed estimate in meters per second. This is the speed of the device at the time the location fix was obtained.
+		var horizontalSpeedError = result.ReturnValue.HorizontalSpeedError; // Horizontal speed error in meters per second.
+		var trueCourse = result.ReturnValue.TrueCourse; // Current direction of movement in degrees in relation to true north.
+		var trueCourseError = result.ReturnValue.TrueCourseError; // TrueCourse error in degrees.
+		var magneticHeading = result.ReturnValue.MagneticHeading; // Current direction of movement in degrees in relation to magnetic north.
+		var magneticHeadingError = result.ReturnValue.MagneticHeadingError; // MagneticHeading error in degrees.
+		var heading = result.ReturnValue.Heading; // Current instantaneous direction of movement in degrees in relation to true north.
+		var headingError = result.ReturnValue.HeadingError; // Heading error in degrees.
+		var magneticCourse = result.ReturnValue.MagneticCourse; // Current instantaneous direction of movement in degrees in relation to magnetic north.
+		var magneticCourseError = result.ReturnValue.MagneticCourseError; // MagneticCourse error in degrees
+		// TODO Location information was received
+	} else {
+		var errorCode = result.ErrorCode;
+		var errorMessage = result.ErrorMessage;
+		// TODO Failed to retrieve location information
+	}
+}          </content>
+       </item>
+       <item
              description="Function that processes notifications from the orientation sensor"
              id="org.symbian.tools.wrttools.contacts"
              label="Orientation callback">
@@ -1002,5 +1002,78 @@
          </content>
        </item>
     </category>
+    <category
+          description="Snippets using PhoneGap APIs"
+          id="org.symbian.tools.wrttools.phonegapsnippets"
+          label="PhoneGap"
+          smallicon="icons/phonegap.png">
+       <item
+             description="Accepts accerelometer data"
+             id="org.symbian.tools.wrttools.phonegap.accererometer"
+             label="Accelerometer callback">
+          <content>
+function updateAcceleration(accel) {
+	var x = accel.x;
+	var y = accel.y;
+	var z = accel.z;
+	
+	// TODO process the data
+}
+          </content>
+       </item>
+       <item
+             description="Accepts contacts data"
+             id="org.symbian.tools.wrttools.phonegap.contacts"
+             label="Contacts callback">
+          <content>
+function displayContacts(contacts) {
+	for (var i=0; i &lt; contacts.length; i++) {
+		var contact = contacts[i];
+		var name = contact.name.formatted;
+		var phones = contact.name.phone; // Array of phone numbers
+		var name = contact.name.address;
+		
+		// TODO Insert your code here
+	}
+}
+          </content>
+       </item>
+       <item
+             description="Accepts location data"
+             id="org.symbian.tools.wrttools.phonegap.location"
+             label="Location callback">
+          <content>
+function updateLocation(position) {
+	var pt = position.coords;
+	var latitude = pt.latitude;
+	var longitude = pt.longitude;
+	var altitude = pt.altitude;
+	var heading = pt.heading;
+	var speed = pt.speed;
+
+	// TODO Insert your code here
+}
+          </content>
+       </item>
+       <item
+             description="Accepts orientation data"
+             id="org.symbian.tools.wrttools.phonegap.orientation"
+             label="Orientation callback">
+          <content>
+function updateOrientation(orientation) {
+	switch (orientation) {
+		case DisplayOrientation.PORTRAIT: break;
+		case DisplayOrientation.REVERSE_PORTRAIT: break;
+		case DisplayOrientation.LANDSCAPE_LEFT_UP: break;
+		case DisplayOrientation.LANDSCAPE_RIGHT_UP: break;
+		case DisplayOrientation.FACE_UP: break;
+		case DisplayOrientation.FACE_DOWN: break;
+	}
+
+	// TODO Insert your code here
+}
+          </content>
+       </item>
+    </category>
  </extension>
 </plugin>