org.symbian.tools.wrttools/plugin.xml
changeset 376 5027709c9315
parent 375 d1edab2715d4
child 381 8620655754e5
equal deleted inserted replaced
375:d1edab2715d4 376:5027709c9315
   874           id="org.symbian.tools.wrttools.wrtsnippets"
   874           id="org.symbian.tools.wrttools.wrtsnippets"
   875           label="Symbian Web Runtime"
   875           label="Symbian Web Runtime"
   876           smallicon="icons/main16.gif"
   876           smallicon="icons/main16.gif"
   877           contenttypes="org.eclipse.wst.jsdt.core.jsSource">
   877           contenttypes="org.eclipse.wst.jsdt.core.jsSource">
   878        <item
   878        <item
   879              description="This function can be used as a callback in GetLocation and Trace calls to location service."
       
   880              id="org.symbian.tools.wrttools.location"
       
   881              label="Location callback">
       
   882           <content>
       
   883 function locationUpdated(transactionId, code, result) {
       
   884 	if (result.ErrorCode == 0) {
       
   885 		var longitude = result.ReturnValue.Longitude; // Longitude estimate in degrees. The value range is [+180, -180].
       
   886 		var latitude = result.ReturnValue.Latitude; // Latitude estimate in degrees. The value range is [+90, -90].
       
   887 		var altitude = result.ReturnValue.Altitude; // Elevation estimate in meters relative to the WGS 84 datum.
       
   888 		var satelliteNumView = result.ReturnValue.SatelliteNumView; // Number of satellites currently in view.
       
   889 		var satelliteNumViewUsed = result.ReturnValue.SatelliteNumViewUsed; // Number of satellites used to obtain the location fix.
       
   890 		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.
       
   891 		var horizontalSpeedError = result.ReturnValue.HorizontalSpeedError; // Horizontal speed error in meters per second.
       
   892 		var trueCourse = result.ReturnValue.TrueCourse; // Current direction of movement in degrees in relation to true north.
       
   893 		var trueCourseError = result.ReturnValue.TrueCourseError; // TrueCourse error in degrees.
       
   894 		var magneticHeading = result.ReturnValue.MagneticHeading; // Current direction of movement in degrees in relation to magnetic north.
       
   895 		var magneticHeadingError = result.ReturnValue.MagneticHeadingError; // MagneticHeading error in degrees.
       
   896 		var heading = result.ReturnValue.Heading; // Current instantaneous direction of movement in degrees in relation to true north.
       
   897 		var headingError = result.ReturnValue.HeadingError; // Heading error in degrees.
       
   898 		var magneticCourse = result.ReturnValue.MagneticCourse; // Current instantaneous direction of movement in degrees in relation to magnetic north.
       
   899 		var magneticCourseError = result.ReturnValue.MagneticCourseError; // MagneticCourse error in degrees
       
   900 		// TODO Location information was received
       
   901 	} else {
       
   902 		var errorCode = result.ErrorCode;
       
   903 		var errorMessage = result.ErrorMessage;
       
   904 		// TODO Failed to retrieve location information
       
   905 	}
       
   906 }          </content>
       
   907        </item>
       
   908        <item
       
   909              description="Retrieves list of the contacts"
   879              description="Retrieves list of the contacts"
   910              id="org.symbian.tools.wrttools.contacts"
   880              id="org.symbian.tools.wrttools.contacts"
   911              label="Get contacts">
   881              label="Get contacts">
   912           <content>
   882           <content>
   913 var contactService = device.getServiceObject("Service.Contact",
   883 var contactService = device.getServiceObject("Service.Contact",
   950           </content>
   920           </content>
   951        </item>
   921        </item>
   952        <item
   922        <item
   953              description="Adds callback that will be notified of orientation chnages"
   923              description="Adds callback that will be notified of orientation chnages"
   954              id="org.symbian.tools.wrttools.contacts"
   924              id="org.symbian.tools.wrttools.contacts"
   955              label="Add orientation callback">
   925              label="Register orientation callback">
   956           <content>
   926           <content>
   957 var sensors = device.getServiceObject("Service.Sensor", "ISensor");
   927 var sensors = device.getServiceObject("Service.Sensor", "ISensor");
   958 	var SensorParams = {
   928 	var SensorParams = {
   959 		SearchCriterion : "Orientation"
   929 		SearchCriterion : "Orientation"
   960 	};
   930 	};
   974 		var errorCode = result.ErrorCode;
   944 		var errorCode = result.ErrorCode;
   975 		var errorMessage = result.ErrorMessage;
   945 		var errorMessage = result.ErrorMessage;
   976 		// TODO Handle error
   946 		// TODO Handle error
   977 	}
   947 	}
   978          </content>
   948          </content>
       
   949        </item>
       
   950        <item
       
   951              description="This function can be used as a callback in GetLocation and Trace calls to location service."
       
   952              id="org.symbian.tools.wrttools.location"
       
   953              label="Location callback">
       
   954           <content>
       
   955 function locationUpdated(transactionId, code, result) {
       
   956 	if (result.ErrorCode == 0) {
       
   957 		var longitude = result.ReturnValue.Longitude; // Longitude estimate in degrees. The value range is [+180, -180].
       
   958 		var latitude = result.ReturnValue.Latitude; // Latitude estimate in degrees. The value range is [+90, -90].
       
   959 		var altitude = result.ReturnValue.Altitude; // Elevation estimate in meters relative to the WGS 84 datum.
       
   960 		var satelliteNumView = result.ReturnValue.SatelliteNumView; // Number of satellites currently in view.
       
   961 		var satelliteNumViewUsed = result.ReturnValue.SatelliteNumViewUsed; // Number of satellites used to obtain the location fix.
       
   962 		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.
       
   963 		var horizontalSpeedError = result.ReturnValue.HorizontalSpeedError; // Horizontal speed error in meters per second.
       
   964 		var trueCourse = result.ReturnValue.TrueCourse; // Current direction of movement in degrees in relation to true north.
       
   965 		var trueCourseError = result.ReturnValue.TrueCourseError; // TrueCourse error in degrees.
       
   966 		var magneticHeading = result.ReturnValue.MagneticHeading; // Current direction of movement in degrees in relation to magnetic north.
       
   967 		var magneticHeadingError = result.ReturnValue.MagneticHeadingError; // MagneticHeading error in degrees.
       
   968 		var heading = result.ReturnValue.Heading; // Current instantaneous direction of movement in degrees in relation to true north.
       
   969 		var headingError = result.ReturnValue.HeadingError; // Heading error in degrees.
       
   970 		var magneticCourse = result.ReturnValue.MagneticCourse; // Current instantaneous direction of movement in degrees in relation to magnetic north.
       
   971 		var magneticCourseError = result.ReturnValue.MagneticCourseError; // MagneticCourse error in degrees
       
   972 		// TODO Location information was received
       
   973 	} else {
       
   974 		var errorCode = result.ErrorCode;
       
   975 		var errorMessage = result.ErrorMessage;
       
   976 		// TODO Failed to retrieve location information
       
   977 	}
       
   978 }          </content>
   979        </item>
   979        </item>
   980        <item
   980        <item
   981              description="Function that processes notifications from the orientation sensor"
   981              description="Function that processes notifications from the orientation sensor"
   982              id="org.symbian.tools.wrttools.contacts"
   982              id="org.symbian.tools.wrttools.contacts"
   983              label="Orientation callback">
   983              label="Orientation callback">
  1000 	}
  1000 	}
  1001 }
  1001 }
  1002          </content>
  1002          </content>
  1003        </item>
  1003        </item>
  1004     </category>
  1004     </category>
       
  1005     <category
       
  1006           description="Snippets using PhoneGap APIs"
       
  1007           id="org.symbian.tools.wrttools.phonegapsnippets"
       
  1008           label="PhoneGap"
       
  1009           smallicon="icons/phonegap.png">
       
  1010        <item
       
  1011              description="Accepts accerelometer data"
       
  1012              id="org.symbian.tools.wrttools.phonegap.accererometer"
       
  1013              label="Accelerometer callback">
       
  1014           <content>
       
  1015 function updateAcceleration(accel) {
       
  1016 	var x = accel.x;
       
  1017 	var y = accel.y;
       
  1018 	var z = accel.z;
       
  1019 	
       
  1020 	// TODO process the data
       
  1021 }
       
  1022           </content>
       
  1023        </item>
       
  1024        <item
       
  1025              description="Accepts contacts data"
       
  1026              id="org.symbian.tools.wrttools.phonegap.contacts"
       
  1027              label="Contacts callback">
       
  1028           <content>
       
  1029 function displayContacts(contacts) {
       
  1030 	for (var i=0; i &lt; contacts.length; i++) {
       
  1031 		var contact = contacts[i];
       
  1032 		var name = contact.name.formatted;
       
  1033 		var phones = contact.name.phone; // Array of phone numbers
       
  1034 		var name = contact.name.address;
       
  1035 		
       
  1036 		// TODO Insert your code here
       
  1037 	}
       
  1038 }
       
  1039           </content>
       
  1040        </item>
       
  1041        <item
       
  1042              description="Accepts location data"
       
  1043              id="org.symbian.tools.wrttools.phonegap.location"
       
  1044              label="Location callback">
       
  1045           <content>
       
  1046 function updateLocation(position) {
       
  1047 	var pt = position.coords;
       
  1048 	var latitude = pt.latitude;
       
  1049 	var longitude = pt.longitude;
       
  1050 	var altitude = pt.altitude;
       
  1051 	var heading = pt.heading;
       
  1052 	var speed = pt.speed;
       
  1053 
       
  1054 	// TODO Insert your code here
       
  1055 }
       
  1056           </content>
       
  1057        </item>
       
  1058        <item
       
  1059              description="Accepts orientation data"
       
  1060              id="org.symbian.tools.wrttools.phonegap.orientation"
       
  1061              label="Orientation callback">
       
  1062           <content>
       
  1063 function updateOrientation(orientation) {
       
  1064 	switch (orientation) {
       
  1065 		case DisplayOrientation.PORTRAIT: break;
       
  1066 		case DisplayOrientation.REVERSE_PORTRAIT: break;
       
  1067 		case DisplayOrientation.LANDSCAPE_LEFT_UP: break;
       
  1068 		case DisplayOrientation.LANDSCAPE_RIGHT_UP: break;
       
  1069 		case DisplayOrientation.FACE_UP: break;
       
  1070 		case DisplayOrientation.FACE_DOWN: break;
       
  1071 	}
       
  1072 
       
  1073 	// TODO Insert your code here
       
  1074 }
       
  1075           </content>
       
  1076        </item>
       
  1077     </category>
  1005  </extension>
  1078  </extension>
  1006 </plugin>
  1079 </plugin>