951 } </content> |
951 } </content> |
952 </item> |
952 </item> |
953 <item |
953 <item |
954 class="org.symbian.tools.wrttools.util.SnippetInsertion" |
954 class="org.symbian.tools.wrttools.util.SnippetInsertion" |
955 description="Sends SMS message" |
955 description="Sends SMS message" |
956 id="org.symbian.tools.wrttools.contacts" |
956 id="org.symbian.tools.wrttools.dial" |
957 label="Send SMS message"> |
957 label="Send SMS message"> |
958 <content> |
958 <content> |
959 var phoneNumber = "+6505551214"; |
959 var phoneNumber = "+6505551214"; |
960 var text = "Sent from WRT application"; |
960 var text = "Sent from WRT application"; |
961 var messaging = device.getServiceObject("Service.Messaging", "IMessaging"); |
961 var messaging = device.getServiceObject("Service.Messaging", "IMessaging"); |
965 var errorMessage = result.ErrorMessage; |
965 var errorMessage = result.ErrorMessage; |
966 // TODO Cannot send SMS message |
966 // TODO Cannot send SMS message |
967 } |
967 } |
968 </content> |
968 </content> |
969 </item> |
969 </item> |
|
970 |
|
971 <item |
|
972 class="org.symbian.tools.wrttools.util.SnippetInsertion" |
|
973 description="Use this code to track battery status" |
|
974 id="org.symbian.tools.wrttools.battery" |
|
975 label="Watch battery status"> |
|
976 <content> |
|
977 function watchBatteryNotifications() { |
|
978 var sysInfo = device.getServiceObject("Service.SysInfo", "ISysInfo"); |
|
979 var result = sysInfo.ISysInfo.GetNotification( { |
|
980 Entity : "Battery", |
|
981 Key : "BatteryStrength" |
|
982 }, batteryUpdated); |
|
983 if (result.ErrorCode == 0) { |
|
984 var transactionId = result.TransactionID; |
|
985 // TODO Use this ID to cancel notifications |
|
986 } else { |
|
987 var message = result.ErrorMessage; |
|
988 // TODO Process error |
|
989 } |
|
990 } |
|
991 |
|
992 function batteryUpdated(tId, code, result) { |
|
993 if (result.ErrorCode == 0) { |
|
994 var batteryStatus = result.ReturnValue.Status; |
|
995 // TODO Process battery charge level |
|
996 } else { |
|
997 var message = result.ErrorMessage; |
|
998 // TODO Process error |
|
999 } |
|
1000 } |
|
1001 </content> |
|
1002 </item> |
970 <item |
1003 <item |
971 class="org.symbian.tools.wrttools.util.SnippetInsertion" |
1004 class="org.symbian.tools.wrttools.util.SnippetInsertion" |
972 description="Use this code to track acceleration, orientation or rotation changes" |
1005 description="Use this code to track acceleration, orientation or rotation changes" |
973 id="org.symbian.tools.wrttools.contacts" |
1006 id="org.symbian.tools.wrttools.sensor" |
974 label="Watch sensor notifications"> |
1007 label="Watch sensor notifications"> |
975 <content> |
1008 <content> |
976 // Call this function to add a callback that will be notified of orientation changes |
1009 // Call this function to add a callback that will be notified of orientation changes |
977 function watchSensorNotifications() { |
1010 function watchSensorNotifications() { |
978 var sensors = device.getServiceObject("Service.Sensor", "ISensor"); |
1011 var sensors = device.getServiceObject("Service.Sensor", "ISensor"); |