Revision: 201001 PDK_3.0.f
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 18 Jan 2010 21:02:57 +0200
changeset 27 02682e02e51f
parent 26 5d0ec8b709be
child 28 92cfb77afb61
Revision: 201001 Kit: 201003
serviceproviders/jsapi/platformservices/lib/platformservices.js
serviceproviders/jsapi/platformservices/src/calendar.js
serviceproviders/jsapi/platformservices/src/camera.js
serviceproviders/jsapi/platformservices/src/commlog.js
serviceproviders/jsapi/platformservices/src/contacts.js
serviceproviders/jsapi/platformservices/src/framework.js
serviceproviders/jsapi/platformservices/src/geolocation.js
serviceproviders/jsapi/platformservices/src/landmarks.js
serviceproviders/jsapi/platformservices/src/media.js
serviceproviders/jsapi/platformservices/src/messaging.js
serviceproviders/jsapi/platformservices/src/sensors.js
serviceproviders/jsapi/platformservices/src/sysinfo.js
serviceproviders/sapi_contacts_vpbk/contactservice/src/addcontactobserver.cpp
serviceproviders/sapi_contacts_vpbk/contactservice/src/singlecontact.cpp
serviceproviders/sapi_contacts_vpbk/group/contactprovider.mmp
serviceproviders/sapi_contacts_vpbk/inc/contactinterface.h
serviceproviders/sapi_contacts_vpbk/src/contactinterface.cpp
serviceproviders/sapi_landmarks/landmarksservice/inc/clandmarkdummyao.h
serviceproviders/sapi_landmarks/landmarksservice/src/clandmarkdummyao.cpp
serviceproviders/sapi_landmarks/src/landmarkinterface.cpp
serviceproviders/sapi_sensor/sensorservice/bwins/sensorserviceu.def
serviceproviders/sapi_sensor/sensorservice/eabi/sensorserviceu.def
serviceproviders/sapi_sensor/sensorservice/inc/sensorservice.h
serviceproviders/sapi_sensor/sensorservice/src/sensorservice.cpp
serviceproviders/sapi_sensor/src/sensorinterface.cpp
--- a/serviceproviders/jsapi/platformservices/lib/platformservices.js	Thu Dec 17 09:09:50 2009 +0200
+++ b/serviceproviders/jsapi/platformservices/lib/platformservices.js	Mon Jan 18 21:02:57 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -11,208 +11,40 @@
 *
 * Contributors:
 *
-* Description:  This is a top level bld file to generate all sapi libraries.
+* Description:  Defination of class CCalendarInterface
 *
 */
-
-function __device_calendar_descriptor(_1){
-this.interfaceName=_1.interfaceName;
-this.version=_1.version;
-};
-function __device_calendar_startEditor(_2,_3,_4){
-this.provider.startEditor(_2,_3,_4);
-};
-function __device_calendar_getList(_5,_6,_7){
-return this.provider.getList(_5,_6,_7);
-};
-function __device_calendar_add(_8){
-return this.provider.addEntry(_8);
-};
-function __device_calendar_update(_9){
-return this.provider.updateEntry(_9);
-};
-function __device_calendar_delete(_a){
-this.provider.deleteEntry(_a);
-};
-function __device_calendar_cancel(_b){
-this.provider.cancel(_b);
-};
-function __device_calendar(_c){
-this.provider=_c;
-this.interfaceName=_c.descriptor.interfaceName;
-this.version=_c.descriptor.version;
-this.startEditor=__device_calendar_startEditor;
-this.getList=__device_calendar_getList;
-this.addEntry=__device_calendar_add;
-this.updateEntry=__device_calendar_update;
-this.deleteEntry=__device_calendar_delete;
-this.cancel=__device_calendar_cancel;
-};
-var __device_calendar_service_entry={"name":null,"version":null,"proto":__device_calendar,"descriptor":__device_calendar_descriptor,"providers":[{"descriptor":__sp_calendar_descriptor,"instance":__sp_calendar_instance}]};
-function __device_camera_descriptor(_d){
-this.interfaceName=_d.interfaceName;
-this.version=_d.version;
-};
-function __device_camera_startCamera(_e,_f){
-return this.provider.startCamera(_e,_f);
-};
-function __device_camera_stopViewfinder(){
-this.provider.stopViewfinder();
-};
-function __device_camera_takePicture(_10){
-this.provider.takePicture(_10);
-};
-function __device_camera(_11){
-this.provider=_11;
-this.interfaceName=_11.descriptor.interfaceName;
-this.version=_11.descriptor.version;
-this.supportedMediaTypes=_11.supportedMediaTypes;
-this.supportedSizes=_11.supportedSizes;
-this.startCamera=__device_camera_startCamera;
-this.stopViewfinder=__device_camera_stopViewfinder;
-this.takePicture=__device_camera_takePicture;
-};
-var __device_camera_service_entry={"name":null,"version":null,"proto":__device_camera,"descriptor":__device_camera_descriptor,"providers":[{"descriptor":__sp_camera_descriptor,"instance":__sp_camera_instance}]};
-function __device_commlog_descriptor(_12){
-this.interfaceName=_12.interfaceName;
-this.version=_12.version;
-};
-function __device_commlog_getList(_13,_14,_15){
-return this.provider.getList(_13,_14,_15);
-};
-function __device_commlog_setNotification(_16,_17){
-return this.provider.setNotification(_16,_17);
-};
-function __device_commlog_cancelNotification(){
-return this.provider.cancelNotification();
-};
-function __device_commlog_cancel(_18){
-return this.provider.cancel(_18);
-};
-function __device_commlog_deleteLogEntry(_19){
-return this.provider.deleteLogEntry(_19);
-};
-function __device_commlog(_1a){
-this.provider=_1a;
-this.interfaceName=_1a.descriptor.interfaceName;
-this.version=_1a.descriptor.version;
-this.getList=__device_commlog_getList;
-this.setNotification=__device_commlog_setNotification;
-this.cancelNotification=__device_commlog_cancelNotification;
-this.cancel=__device_commlog_cancel;
-this.deleteLogEntry=__device_commlog_deleteLogEntry;
-};
-var __device_commlog_service_entry={"name":null,"version":null,"proto":__device_commlog,"descriptor":__device_commlog_descriptor,"providers":[{"descriptor":__sp_commlog_descriptor,"instance":__sp_commlog_instance}]};
-function __device_contacts_descriptor(_1b){
-this.interfaceName=_1b.interfaceName;
-this.version=_1b.version;
-};
-function __device_contacts_startEditor(_1c,_1d,_1e){
-return this.provider.startEditor(_1c,_1d,_1e);
-};
-function __device_contacts_getContacts(_1f,_20,_21,_22){
-return this.provider.getContacts(_1f,_20,_21,_22);
-};
-function __device_contacts_add(_23){
-return this.provider.addContact(_23);
-};
-function __device_contacts_update(_24){
-this.provider.updateContact(_24);
-};
-function __device_contacts_delete(id){
-this.provider.deleteContacts(id);
-};
-function __device_contacts_getContactInfo(id){
-return this.provider.getContactInfo(id);
-};
-function __device_contacts_addGroup(_27){
-return this.provider.addGroup(_27);
-};
-function __device_contacts_getGroups(_28,_29){
-return this.provider.getGroups(_28,_29);
-};
-function __device_contacts_deleteGroups(id){
-this.provider.deleteGroups(id);
-};
-function __device_contacts_addContactsToGroup(_2b,id){
-this.provider.addContactsToGroup(_2b,id);
-};
-function __device_contacts_getContactIds(_2d,_2e,_2f,_30){
-return this.provider.getContactIds(_2d,_2e,_2f,_30);
-};
-function __device_contacts_getGroupIds(_31,_32){
-return this.provider.getGroupIds(_31,_32);
-};
-function __device_contacts_removeContactsFromGroup(_33,id){
-this.provider.removeContactsFromGroup(_33,id);
-};
-function __device_contacts_cancel(_35){
-this.provider.cancel(_35);
-};
-function __device_contacts_updateGroup(_36){
-this.provider.updateGroup(_36);
-};
-function __device_contacts_getGroupInfo(_37){
-return this.provider.getGroupInfo(_37);
-};
-function __device_contacts(_38){
-this.provider=_38;
-this.interfaceName=_38.descriptor.interfaceName;
-this.version=_38.descriptor.version;
-this.SORT_ASCENDING=0;
-this.SORT_DESCENDING=1;
-this.startEditor=__device_contacts_startEditor;
-this.getContacts=__device_contacts_getContacts;
-this.addContact=__device_contacts_add;
-this.updateContact=__device_contacts_update;
-this.deleteContacts=__device_contacts_delete;
-this.getContactInfo=__device_contacts_getContactInfo;
-this.addGroup=__device_contacts_addGroup;
-this.getGroups=__device_contacts_getGroups;
-this.deleteGroups=__device_contacts_deleteGroups;
-this.addContactsToGroup=__device_contacts_addContactsToGroup;
-this.getContactIds=__device_contacts_getContactIds;
-this.getGroupIds=__device_contacts_getGroupIds;
-this.removeContactsFromGroup=__device_contacts_removeContactsFromGroup;
-this.cancel=__device_contacts_cancel;
-this.updateGroup=__device_contacts_updateGroup;
-this.getGroupInfo=__device_contacts_getGroupInfo;
-};
-var __device_contacts_service_entry={"name":null,"version":null,"proto":__device_contacts,"descriptor":__device_contacts_descriptor,"providers":[{"descriptor":__sp_contacts_descriptor,"instance":__sp_contacts_instance}]};
 var __device_debug_on__=true;
-var MISSING_ARG_ERR=1;
-var INVALID_ARG_ERR=2;
-var NOT_SUPPORTED_ERR=3;
 var event_completed=2;
 var event_cancelled=3;
 var __Service_Interface_Ver=1;
-var MapErrorCode={1016:100,1012:101,1010:102,1009:103,1005:104,1000:105,1011:106,1007:107,1003:1,1002:2};
-function __device_debug(_39){
-};
-function __device_handle_exception(e,_3b){
-__device_debug(_3b);
+var MapErrorCode={1016:100,1012:101,1010:102,1009:103,1005:104,1000:105,1011:106,1007:107,1003:1,1002:2,1004:3};
+function __device_debug(_1){
+};
+function __device_handle_exception(e,_3){
+__device_debug(_3);
 throw (e);
 };
-function __device_typeof(_3c){
-if(_3c==undefined){
+function __device_typeof(_4){
+if(_4==undefined){
 return "undefined";
 }
-if(_3c instanceof Object){
-if(_3c instanceof String){
+if(_4 instanceof Object){
+if(_4 instanceof String){
 return "String";
 }else{
-if(_3c instanceof Array){
+if(_4 instanceof Array){
 return "Array";
 }
 }
 }
-if(typeof _3c){
-if(typeof _3c=="object"){
-if(typeof _3c=="object"&&!_3c){
+if(typeof _4){
+if(typeof _4=="object"){
+if(typeof _4=="object"&&!_4){
 return "null";
 }
 }else{
-if(typeof _3c=="string"){
+if(typeof _4=="string"){
 return "string";
 }
 }
@@ -243,26 +75,26 @@
 }
 __device_services_inited=true;
 try{
-var _3d=device.getServiceObject("Service.ServiceRegistry","IService");
-var _3e={ServiceName:"Service.Calendar",InterfaceName:"IDataSource"};
-var _3f=_3d.IService.GetList(_3e);
-if(_3f.ErrorCode==0){
-var _40=_3f.ReturnValue;
-if(_40){
-var _41=_40.getNext();
-if(_41){
-var _42=_41.VersionList;
-var _43;
-for(_43 in _42){
-if(_42[_43]>__Service_Interface_Ver){
-__Service_Interface_Ver=_42[_43];
-}
-}
-}
-}
-_40.close();
-}
-_3d.close();
+var _5=device.getServiceObject("Service.ServiceRegistry","IService");
+var _6={ServiceName:"Service.Calendar",InterfaceName:"IDataSource"};
+var _7=_5.IService.GetList(_6);
+if(_7.ErrorCode==0){
+var _8=_7.ReturnValue;
+if(_8){
+var _9=_8.getNext();
+if(_9){
+var _a=_9.VersionList;
+var _b;
+for(_b in _a){
+if(_a[_b]>__Service_Interface_Ver){
+__Service_Interface_Ver=_a[_b];
+}
+}
+}
+}
+_8.close();
+}
+_5.close();
 }
 catch(e){
 __Service_Interface_Ver=1;
@@ -332,7 +164,7 @@
 function __device_get_descriptor(i){
 return new i.descriptor(new (i.providers[0].descriptor));
 };
-function __device_get_interface(s,_47,_48){
+function __device_get_interface(s,_f,_10){
 var i=s.interfaces;
 for(var d in i){
 if(i[d].name==null){
@@ -341,9 +173,9 @@
 if(i[d].name==undefined){
 continue;
 }
-if(i[d].name==_47){
-if(_48){
-if(i[d].version>=_48){
+if(i[d].name==_f){
+if(_10){
+if(i[d].version>=_10){
 return __device_get_implementation(i[d]);
 }
 }else{
@@ -353,23 +185,23 @@
 }
 return null;
 };
-function __device_service_load(_4b,_4c){
-var _4d=new DeviceException("dummy",0);
-if(_4b){
-if(typeof _4b!="string"){
-throw new DeviceException(_4d.INVALID_ARG_ERR,"nokia.device.load:Invalid type interfaceName");
-}
-}else{
-throw new DeviceException(_4d.MISSING_ARG_ERR,"nokia.device.load:interfaceName param expected");
-}
-if(_4c){
-if(typeof _4c!="number"){
-throw new DeviceException(_4d.INVALID_ARG_ERR,"nokia.device.load:Invalid type version");
+function __device_service_load(_13,_14){
+var _15=new DeviceException("dummy",0);
+if(_13){
+if(typeof _13!="string"){
+throw new DeviceException(_15.INVALID_ARG_ERR,"nokia.device.load:Invalid type interfaceName");
+}
+}else{
+throw new DeviceException(_15.MISSING_ARG_ERR,"nokia.device.load:interfaceName param expected");
+}
+if(_14){
+if(typeof _14!="number"){
+throw new DeviceException(_15.INVALID_ARG_ERR,"nokia.device.load:Invalid type version");
 }
 }
 __device_services_init();
 for(var s in __device_services){
-var i=__device_get_interface(__device_services[s],_4b,_4c);
+var i=__device_get_interface(__device_services[s],_13,_14);
 if(i!=null){
 return i;
 }
@@ -382,7 +214,7 @@
 i.version=d.version;
 };
 function __device_interface_list(s){
-var _53=new Array();
+var _1b=new Array();
 for(var i in s.interfaces){
 if(s.interfaces[i].name==null){
 __device_update_descriptor(s.interfaces[i]);
@@ -390,11 +222,11 @@
 if(s.interfaces[i].name==undefined){
 continue;
 }
-_53[i]=new Object();
-_53[i].name=s.interfaces[i].name;
-_53[i].version=s.interfaces[i].version;
-}
-return _53;
+_1b[i]=new Object();
+_1b[i].name=s.interfaces[i].name;
+_1b[i].version=s.interfaces[i].version;
+}
+return _1b;
 };
 function __device_service_descriptor(s){
 this.name=s.name;
@@ -412,8 +244,8 @@
 function __device_service_interfaces(){
 __device_services_init();
 for(var s in __device_services){
-var _58=__device_interface_list(__device_services[s]);
-return new __FWIter(_58);
+var _20=__device_interface_list(__device_services[s]);
+return new __FWIter(_20);
 }
 return null;
 };
@@ -443,273 +275,21 @@
 }
 }
 };
-var _infinity=Infinity;
-function PositionError(){
-this.UNKNOWN_ERROR=0;
-this.PERMISSION_DENIED=1;
-this.POSITION_UNAVAILABLE=2;
-this.TIMEOUT=3;
-this.code;
-this.message;
-};
-function Coordinates(){
-this.latitude=null;
-this.longitude=null;
-this.altitude=null;
-this.accuracy=null;
-this.altitudeAccuracy=null;
-this.heading=null;
-this.speed=null;
-};
-function Position(){
-this.coords=null;
-this.timestamp=null;
-};
-function PositionOptions(){
-this.enableHighAccuracy=null;
-this.timeout=null;
-this.maximumAge=null;
-};
-function TransIdCbMap(){
-this.TransactionID=null;
-this.success_callback=null;
-this.error_callback=null;
-};
-function __device_geolocation_descriptor(_5b){
-this.interfaceName=_5b.interfaceName;
-this.version=_5b.version;
-};
-function __device_geolocation_getCurrentPosition(_5c,_5d,_5e){
-return this.provider.getLocation(_5c,_5d,_5e);
-};
-function __device_geolocation_watchPosition(_5f,_60,_61){
-return this.provider.traceLocation(_5f,_60,_61);
-};
-function __device_geolocation_clearWatch(_62){
-this.provider.clearTrace(_62);
-};
-function __device_geolocation(_63){
-this.provider=_63;
-this.interfaceName=_63.descriptor.interfaceName;
-this.version=_63.descriptor.version;
-this.getCurrentPosition=__device_geolocation_getCurrentPosition;
-this.watchPosition=__device_geolocation_watchPosition;
-this.clearWatch=__device_geolocation_clearWatch;
-};
-var __device_geolocation_service_entry={"name":null,"version":null,"proto":__device_geolocation,"descriptor":__device_geolocation_descriptor,"providers":[{"descriptor":__sp_location_descriptor,"instance":__sp_location_instance}]};
-function __device_media_descriptor(_64){
-this.interfaceName=_64.interfaceName;
-this.version=_64.version;
-};
-function __device_media_getList(_65,_66,_67){
-return this.provider.getList(_65,_66,_67);
-};
-function __device_media_getThumbnail(_68,_69,_6a){
-return this.provider.getThumbnail(_68,_69,_6a);
-};
-function __device_media_addStreamUri(uri){
-return this.provider.addStreamUri(uri);
-};
-function __device_media_deleteStreamUri(uri){
-return this.provider.deleteStreamUri(uri);
-};
-function __device_media_cancel(_6d){
-this.provider.cancel(_6d);
-};
-function __device_media_refreshMediaDb(uri){
-this.provider.refreshMediaDb(uri);
-};
-function __device_media(_6f){
-this.provider=_6f;
-this.interfaceName=_6f.descriptor.interfaceName;
-this.version=_6f.descriptor.version;
-this.SORT_ASCENDING=0;
-this.SORT_DESCENDING=1;
-this.getList=__device_media_getList;
-this.getThumbnail=__device_media_getThumbnail;
-this.addStreamUri=__device_media_addStreamUri;
-this.deleteStreamUri=__device_media_deleteStreamUri;
-this.refreshMediaDb=__device_media_refreshMediaDb;
-this.cancel=__device_media_cancel;
-};
-var __device_media_service_entry={"name":null,"version":null,"proto":__device_media,"descriptor":__device_media_descriptor,"providers":[{"descriptor":__sp_media_descriptor,"instance":__sp_media_instance}]};
-function __device_messaging_descriptor(_70){
-this.interfaceName=_70.interfaceName;
-this.version=_70.version;
-};
-function __device_messaging_startEditor(_71){
-return this.provider.startEditor(_71);
-};
-function __device_messaging_getList(_72,_73,_74,_75,_76){
-return this.provider.getList(_72,_73,_74,_75,_76);
-};
-function __device_messaging_send(_77,_78,id,_7a){
-return this.provider.send(_77,_78,id,_7a);
-};
-function __device_messaging_setNotifier(_7b,_7c){
-return this.provider.setNotifier(_7b,_7c);
-};
-function __device_messaging_cancelNotifier(){
-return this.provider.cancelNotifier();
-};
-function __device_messaging_getMessage(id){
-return this.provider.getMessage(id);
-};
-function __device_messaging_delete(id){
-return this.provider.deleteMessage(id);
-};
-function __device_messaging_setStatus(id,_80){
-return this.provider.setStatus(id,_80);
-};
-function __device_messaging_cancel(_81){
-return this.provider.cancel(_81);
-};
-function __device_messaging(_82){
-this.provider=_82;
-this.interfaceName=_82.descriptor.interfaceName;
-this.version=_82.descriptor.version;
-this.SORT_ASCENDING=0;
-this.SORT_DESCENDING=1;
-this.SORT_BY_DATE=0;
-this.SORT_BY_SENDER=1;
-this.STATUS_READ=0;
-this.STATUS_UNREAD=1;
-this.startEditor=__device_messaging_startEditor;
-this.getList=__device_messaging_getList;
-this.send=__device_messaging_send;
-this.setNotifier=__device_messaging_setNotifier;
-this.cancelNotifier=__device_messaging_cancelNotifier;
-this.getMessage=__device_messaging_getMessage;
-this.deleteMessage=__device_messaging_delete;
-this.setStatus=__device_messaging_setStatus;
-this.cancel=__device_messaging_cancel;
-};
-var __device_messaging_service_entry={"name":null,"version":null,"proto":__device_messaging,"descriptor":__device_messaging_descriptor,"providers":[{"descriptor":__sp_messaging_descriptor,"instance":__sp_messaging_instance}]};
-var __device_sensors_service_entry={"name":null,"version":null,"proto":__device_sensors,"descriptor":__device_sensors_descriptor,"providers":[{"descriptor":__sp_sensors_descriptor,"instance":__sp_sensors_instance}]};
-function __device_sensors(_83){
-this.provider=_83;
-this.interfaceName=_83.descriptor.interfaceName;
-this.version=_83.descriptor.version;
-this.getChannels=__device_sensors_getChannels;
-this.startChannel=__device_sensors_setNotifier;
-this.stopChannel=__device_sensors_cancelNotifier;
-this.getScaleFactor=__device_sensors_getScaleFactor;
-};
-function __device_sensors_descriptor(_84){
-this.interfaceName=_84.interfaceName;
-this.version=_84.version;
-};
-function __device_sensors_getChannels(){
-return this.provider.getChannels();
-};
-function __device_sensors_setNotifier(_85,_86,_87){
-return this.provider.startChannel(_85,_86,_87);
-};
-function __device_sensors_cancelNotifier(_88){
-return this.provider.stopChannel(_88);
-};
-function __device_sensors_getScaleFactor(_89){
-return this.provider.getScaleFactor(_89);
-};
-var __device_sysinfo_service_entry={"name":null,"version":null,"proto":__device_sysinfo,"descriptor":__device_sysinfo_descriptor,"providers":[{"descriptor":__sp_sysinfo_descriptor,"instance":__sp_sysinfo_instance}]};
-function __device_sysinfo(_8a){
-this.provider=_8a;
-this.interfaceName=_8a.descriptor.interfaceName;
-this.version=_8a.descriptor.version;
-this.getChannelList=__device_channels_get;
-this.getChannel=__device_sysinfo_get;
-this.startChannel=__device_sysinfo_setNotifier;
-this.stopChannel=__device_sysinfo_cancelNotifier;
-this.cancel=__device_sysinfo_cancel;
-};
-function __device_sysinfo_descriptor(_8b){
-this.interfaceName=_8b.interfaceName;
-this.version=_8b.version;
-};
-function __device_channels_get(){
-return this.provider.getChannelList();
-};
-function __device_sysinfo_get(_8c,_8d,_8e){
-return this.provider.getChannel(_8c,_8d,_8e);
-};
-function __device_sysinfo_setNotifier(_8f,_90,_91,_92){
-return this.provider.startChannel(_8f,_90,_91,_92);
-};
-function __device_sysinfo_cancelNotifier(_93){
-return this.provider.stopChannel(_93);
-};
-function __device_sysinfo_cancel(id){
-return this.provider.cancel(id);
-};
-var __device_landmarks_service_entry={"name":null,"version":null,"proto":__device_landmarks,"descriptor":__device_landmarks_descriptor,"providers":[{"descriptor":__sp_landmarks_descriptor,"instance":__sp_landmarks_instance}]};
-function __device_landmarks(_95){
-this.provider=_95;
-this.interfaceName=_95.descriptor.interfaceName;
-this.version=_95.descriptor.version;
-this.startEditor=__device_landmarks_startEditor;
-this.getCategories=__device_landmarks_getCategories;
-this.getLandmarks=__device_landmarks_getLandmarks;
-this.addCategory=__device_landmarks_add_category;
-this.updateCategory=__device_landmarks_update_category;
-this.updateLandmark=__device_landmarks_update_landmark;
-this.addLandmark=__device_landmarks_add_landmark;
-this.deleteCategory=__device_landmarks_delete_category;
-this.deleteLandmark=__device_landmarks_delete_landmark;
-this.importLandmarks=__device_landmarks_import_landmarks;
-this.exportLandmarks=__device_landmarks_export_landmarks;
-this.organizeLandmarks=__device_landmarks_organize_landmarks;
-this.cancel=__device_landmarks_cancel;
-};
-function __device_landmarks_descriptor(_96){
-this.interfaceName=_96.interfaceName;
-this.version=_96.version;
-};
-function __device_landmarks_startEditor(_97,_98){
-this.provider.startEditor(_97,_98);
-};
-function __device_landmarks_getCategories(_99,_9a,_9b){
-return this.provider.getCategories(_99,_9a,_9b);
-};
-function __device_landmarks_getLandmarks(_9c,_9d,_9e){
-return this.provider.getLandmarks(_9c,_9d,_9e);
-};
-function __device_landmarks_add_category(_9f,_a0,_a1){
-return this.provider.addCategory(_9f,_a0,_a1);
-};
-function __device_landmarks_add_landmark(_a2,_a3,_a4){
-return this.provider.addLandmark(_a2,_a3,_a4);
-};
-function __device_landmarks_delete_category(_a5,_a6,_a7){
-return this.provider.deleteCategory(_a5,_a6,_a7);
-};
-function __device_landmarks_delete_landmark(_a8,_a9,_aa){
-return this.provider.deleteLandmark(_a8,_a9,_aa);
-};
-function __device_landmarks_update_landmark(_ab,_ac,_ad){
-return this.provider.updateLandmark(_ab,_ac,_ad);
-};
-function __device_landmarks_update_category(_ae,_af,_b0){
-return this.provider.updateCategory(_ae,_af,_b0);
-};
-function __device_landmarks_import_landmarks(_b1,_b2,_b3,_b4){
-return this.provider.importLandmarks(_b1,_b2,_b3,_b4);
-};
-function __device_landmarks_export_landmarks(_b5,_b6,_b7,_b8,_b9){
-return this.provider.exportLandmarks(_b5,_b6,_b7,_b8,_b9);
-};
-function __device_landmarks_organize_landmarks(_ba,_bb,_bc,_bd,_be){
-return this.provider.organizeLandmarks(_ba,_bb,_bc,_bd,_be);
-};
-function __device_landmarks_cancel(_bf){
-return this.provider.cancel(_bf);
-};
+var glob_obj=null;
+var temp_scb=null;
+var temp_ecb=null;
+glob_obj=new Object();
+glob_obj.glob_cb_arr=new Array();
+glob_obj.addToGlobalArray=addToGlobalArray;
+glob_obj.removeFromArray=removeFromArray;
+glob_obj.getFromArray=getFromArray;
 DeviceAPIError.prototype=new Error();
 DeviceAPIError.prototype.constructor=DeviceAPIError;
-function DeviceAPIError(_c0,_c1){
+function DeviceAPIError(_23,_24){
 this.toString=concatenate;
-this.code=_c0;
+this.code=_23;
 this.name="DeviceError";
-this.message=_c1;
+this.message=_24;
 this.MISSING_ARG_ERR=1;
 this.INVALID_ARG_ERR=2;
 this.NOT_SUPPORTED_ERR=3;
@@ -728,11 +308,11 @@
 };
 DeviceException.prototype=new Error();
 DeviceException.prototype.constructor=DeviceException;
-function DeviceException(_c2,_c3){
+function DeviceException(_25,_26){
 this.toString=concatenate;
-this.code=_c2;
+this.code=_25;
 this.name="DeviceException";
-this.message=_c3;
+this.message=_26;
 this.MISSING_ARG_ERR=1;
 this.INVALID_ARG_ERR=2;
 this.NOT_SUPPORTED_ERR=3;
@@ -752,16 +332,16 @@
 function concatenate(){
 return (this.name+": errcode: "+this.code+"\nline: "+this.lineNumber+"\nfileName: "+this.fileName+"\nerrmsg: "+this.message);
 };
-function splitErrorMessage(_c4){
-if(_c4.search(/:/)!=-1){
-if((_c4.split(":").length)==2){
-return _c4.split(":")[1];
-}
-if((_c4.split(":").length)>2){
-return _c4.split(":")[2];
-}
-}
-return _c4;
+function splitErrorMessage(_27){
+if(_27.search(/:/)!=-1){
+if((_27.split(":").length)==2){
+return _27.split(":")[1];
+}
+if((_27.split(":").length)>2){
+return _27.split(":")[2];
+}
+}
+return _27;
 };
 var __s60_start_and_wait_cb;
 function __s60_on_app_exit(){
@@ -774,1593 +354,1936 @@
 widget.onhide=null;
 widget.onshow=__s60_on_app_exit;
 };
-function __s60_start_and_wait(id,_c6,_c7){
-__s60_start_and_wait_cb=_c7;
+function __s60_start_and_wait(id,_29,_2a){
+__s60_start_and_wait_cb=_2a;
 widget.onhide=__s60_on_app_start;
-widget.openApplication(id,_c6);
+widget.openApplication(id,_29);
 };
 function __s60_api_not_supported(){
 throw (err_ServiceNotSupported);
 };
-function __s60_enumerate_object(_c8,_c9,_ca,_cb){
+function __s60_enumerate_object(_2b,_2c,_2d,_2e){
 var key;
-for(key in _c8){
-var _cd;
-if(_c9){
-_cd=_c9+"."+key;
-}else{
-_cd=key;
-}
-var _ce=_c8[key];
-if(typeof _ce=="object"){
-__s60_enumerate_object(_ce,_cd,_ca,_cb);
-}else{
-_ca(_cd,_ce,_cb);
-}
-}
-};
-var dataGetList=0;
-var isUpdate=0;
-function __sp_calendar_descriptor(){
-this.interfaceName="calendar";
+for(key in _2b){
+var _30;
+if(_2c){
+_30=_2c+"."+key;
+}else{
+_30=key;
+}
+var _31=_2b[key];
+if(typeof _31=="object"){
+__s60_enumerate_object(_31,_30,_2d,_2e);
+}else{
+_2d(_30,_31,_2e);
+}
+}
+};
+function removeFromArray(_32){
+for(i=0;i<(glob_obj.glob_cb_arr.length);i++){
+if(glob_obj.glob_cb_arr[i].transactionId==_32){
+glob_obj.glob_cb_arr.splice(i,1);
+}
+}
+};
+function addToGlobalArray(_33,sCb,_35){
+var obj=new Object();
+obj.success_cb=sCb;
+obj.transactionId=_33;
+obj.error_cb=_35;
+glob_obj.glob_cb_arr.push(obj);
+};
+function getFromArray(tid){
+var i;
+for(i=0;i<(glob_obj.glob_cb_arr.length);i++){
+if(glob_obj.glob_cb_arr[i].transactionId==tid){
+return glob_obj.glob_cb_arr[i];
+}
+}
+if(temp_scb){
+var obj=new Object();
+obj.success_cb=temp_scb;
+obj.error_cb=temp_ecb;
+temp_ecb=temp_scb=null;
+return obj;
+}
+return null;
+};
+var __device_landmarks_service_entry={"name":null,"version":null,"proto":__device_landmarks,"descriptor":__device_landmarks_descriptor,"providers":[{"descriptor":__sp_landmarks_descriptor,"instance":__sp_landmarks_instance}]};
+function __device_landmarks(_3a){
+this.provider=_3a;
+this.interfaceName=_3a.descriptor.interfaceName;
+this.version=_3a.descriptor.version;
+this.startEditor=__device_landmarks_startEditor;
+this.getCategories=__device_landmarks_getCategories;
+this.getLandmarks=__device_landmarks_getLandmarks;
+this.addCategory=__device_landmarks_add_category;
+this.updateCategory=__device_landmarks_update_category;
+this.updateLandmark=__device_landmarks_update_landmark;
+this.addLandmark=__device_landmarks_add_landmark;
+this.deleteCategory=__device_landmarks_delete_category;
+this.deleteLandmark=__device_landmarks_delete_landmark;
+this.importLandmarks=__device_landmarks_import_landmarks;
+this.exportLandmarks=__device_landmarks_export_landmarks;
+this.organizeLandmarks=__device_landmarks_organize_landmarks;
+this.cancel=__device_landmarks_cancel;
+};
+function __device_landmarks_descriptor(_3b){
+this.interfaceName=_3b.interfaceName;
+this.version=_3b.version;
+};
+function __device_landmarks_startEditor(_3c,_3d){
+this.provider.startEditor(_3c,_3d);
+};
+function __device_landmarks_getCategories(_3e,_3f,_40){
+return this.provider.getCategories(_3e,_3f,_40);
+};
+function __device_landmarks_getLandmarks(_41,_42,_43){
+return this.provider.getLandmarks(_41,_42,_43);
+};
+function __device_landmarks_add_category(_44,_45,_46){
+return this.provider.addCategory(_44,_45,_46);
+};
+function __device_landmarks_add_landmark(_47,_48,_49){
+return this.provider.addLandmark(_47,_48,_49);
+};
+function __device_landmarks_delete_category(_4a,_4b,_4c){
+return this.provider.deleteCategory(_4a,_4b,_4c);
+};
+function __device_landmarks_delete_landmark(_4d,_4e,_4f){
+return this.provider.deleteLandmark(_4d,_4e,_4f);
+};
+function __device_landmarks_update_landmark(_50,_51,_52){
+return this.provider.updateLandmark(_50,_51,_52);
+};
+function __device_landmarks_update_category(_53,_54,_55){
+return this.provider.updateCategory(_53,_54,_55);
+};
+function __device_landmarks_import_landmarks(_56,_57,_58,_59){
+return this.provider.importLandmarks(_56,_57,_58,_59);
+};
+function __device_landmarks_export_landmarks(_5a,_5b,_5c,_5d,_5e){
+return this.provider.exportLandmarks(_5a,_5b,_5c,_5d,_5e);
+};
+function __device_landmarks_organize_landmarks(_5f,_60,_61,_62,_63){
+return this.provider.organizeLandmarks(_5f,_60,_61,_62,_63);
+};
+function __device_landmarks_cancel(_64){
+return this.provider.cancel(_64);
+};
+var err_missing_argument=1003;
+var err_bad_argument=1002;
+var err_ServiceNotSupported=1004;
+var err_InvalidService_Argument=1000;
+function convertFromPS2JS(_65){
+var _66=new DeviceAPIError(0,"dummy");
+var _67;
+switch(_65){
+case 1016:
+_67=_66.TIMEOUT_ERR;
+break;
+case 1012:
+_67=_66.DATA_NOT_FOUND_ERR;
+break;
+case 1010:
+_67=_66.DATA_ALREADY_EXISTS_ERR;
+break;
+case 1009:
+_67=_66.SERVICE_BUSY_ERR;
+break;
+case 1005:
+_67=_66.SERVICE_IN_USE_ERR;
+break;
+default:
+_67=1001;
+}
+return _67;
+};
+function __sp_landmarks_descriptor(){
+this.interfaceName="landmarks";
 if(window.__Service_Interface_Ver){
 this.version=__Service_Interface_Ver;
 }else{
 this.version=1;
 }
 };
-function __sp_calendar_entry_time(_cf,end,_d1){
-if(_cf){
-var st=new Date(_cf);
-this.begin=st;
-}
-if(end){
-var en=new Date(end);
-this.end=en;
-}
-if(_d1){
-var al=new Date(_d1);
-this.alarm=al;
-}
-};
-function __sp_calendar_isInputValid(_d5){
-if(_d5){
-if(_d5.id){
-if(typeof (_d5.id)!="string"){
-return false;
-}
-}
-if(_d5.type){
-if((typeof (_d5.type)!="string")||!__sp_calendar_entry_types.match(_d5.type)){
-return false;
-}
-}
-if(_d5.text){
-if(typeof (_d5.text)!="string"){
-return false;
-}
-}
-if(_d5.range){
-if(typeof (_d5.range)!="object"){
-return false;
-}
-if(_d5.range.begin){
-if(typeof (_d5.range.begin)!="object"){
-return false;
-}
-}
-if(_d5.range.end){
-if(typeof (_d5.range.end)!="object"){
-return false;
-}
-}
-}
-if(_d5.summary){
-if(typeof (_d5.summary)!="string"){
-return false;
-}
-}
-if(_d5.description){
-if(typeof (_d5.description)!="string"){
-return false;
-}
-}
-if(_d5.status){
-if(typeof (_d5.status)!="string"){
-return false;
-}
-}
-if(_d5.location){
-if(typeof (_d5.location)!="string"){
-return false;
-}
-}
-if(_d5.priority){
-if(typeof (_d5.priority)!="number"){
-return false;
-}
-}
-if(_d5.instanceStartTime){
-if(typeof (_d5.instanceStartTime)!="object"){
-return false;
-}
-}
-if(_d5.exceptionDates){
-if(typeof (_d5.exceptionDates)!="object"){
-return false;
-}
-}
-if(_d5.time){
-if(typeof _d5.time!="object"){
-return false;
-}
-if(_d5.time.begin){
-if(typeof (_d5.time.begin)!="object"){
-return false;
-}
-if(_d5.time.begin=="Invalid Date"){
-return false;
-}
-try{
-(_d5.time.begin).getTime();
-}
-catch(e){
-return false;
-}
-}
-if(_d5.time.end){
-if(typeof (_d5.time.end)!="object"){
-return false;
-}
-if(_d5.time.end=="Invalid Date"){
-return false;
-}
-try{
-(_d5.time.end).getTime();
-}
-catch(e){
-return false;
-}
-}
-if(_d5.time.begin&&_d5.time.end){
-if(_d5.time.begin>_d5.time.end){
-return false;
-}
-}
-if(_d5.time.alarm){
-if(typeof (_d5.time.alarm)!="object"){
-return false;
-}
-try{
-(_d5.time.alarm).getTime();
-}
-catch(e){
-return false;
-}
-}
-}
-if(_d5.repeatRule){
-if(typeof _d5.repeatRule!="object"){
-return false;
-}
-if(_d5.repeatRule.frequency){
-if(typeof (_d5.repeatRule.frequency)!="string"){
-return false;
-}
-}
-if(_d5.repeatRule.startDate){
-if(typeof (_d5.repeatRule.startDate)!="object"){
-return false;
-}
-if((_d5.repeatRule.startDate)=="Invalid Date"){
-return false;
-}
-try{
-(_d5.repeatRule.startDate).getTime();
-}
-catch(e){
-return false;
-}
-}
-if(_d5.repeatRule.untilDate){
-if(typeof (_d5.repeatRule.untilDate)!="object"){
-return false;
-}
-if((_d5.repeatRule.untilDate)=="Invalid Date"){
-return false;
-}
+function __sp_landmarks_instance(){
+this.descriptor=new __sp_landmarks_descriptor();
+this.startEditor=__sp_landmarks_startEditor;
+this.getCategories=__sp_landmarks_category_getList;
+this.getCategoriesCb=__sp_landmarks_category_getList_cb;
+this.addCategory=__sp_landmarks_category_add;
+this.addCategoryCb=__sp_landmarks_category_add_cb;
+this.updateCategory=__sp_landmarks_category_update;
+this.updateCategoryCb=__sp_landmarks_category_update_cb;
+this.deleteCategory=__sp_landmarks_category_delete;
+this.deleteCategoryCb=__sp_landmarks_category_delete_cb;
+this.getLandmarks=__sp_landmarks_getList;
+this.getLandmarksCb=__sp_landmarks_getList_cb;
+this.addLandmark=__sp_landmarks_add;
+this.addLandmarkCb=__sp_landmarks_add_cb;
+this.updateLandmark=__sp_landmarks_update;
+this.updateLandmarkCb=__sp_landmarks_update_cb;
+this.deleteLandmark=__sp_landmarks_delete;
+this.deleteLandmarkCb=__sp_landmarks_delete_cb;
+this.importLandmarks=__sp_landmarks_import;
+this.importLandmarksCb=__sp_landmarks_import_cb;
+this.exportLandmarks=__sp_landmarks_export;
+this.exportLandmarksCb=__sp_landmarks_export_cb;
+this.organizeLandmarks=__sp_landmarks_organize;
+this.organizeLandmarksCb=__sp_landmarks_organize_cb;
+this.temporarySCb=null;
+this.temporaryECb=null;
+this.cancel=__sp_landmarks_cancel;
 try{
-(_d5.repeatRule.untilDate).getTime();
-}
-catch(e){
-return false;
-}
-}
-if(_d5.repeatRule.startDate&&_d5.repeatRule.untilDate){
-if(_d5.repeatRule.startDate>_d5.repeatRule.untilDate){
-return false;
-}
-}
-if(_d5.repeatRule.interval){
-if(typeof (_d5.repeatRule.interval)!="number"){
-return false;
-}
-}
-if(_d5.repeatRule.month){
-if(typeof (_d5.repeatRule.month)!="number"){
-return false;
-}
-}
-if(_d5.repeatRule.weekDays){
-if(typeof (_d5.repeatRule.weekDays)!="object"){
-return false;
-}
-}
-if(_d5.repeatRule.daysOfMonth){
-if(typeof (_d5.repeatRule.daysOfMonth)!="object"){
-return false;
-}
-}
-if(_d5.repeatRule.monthDates){
-if(typeof (_d5.repeatRule.monthDates)!="object"){
-return false;
-}
-}
-}
-}
-return true;
-};
-function __sp_calendar_getList_repeatRule(_d6){
-var _d7;
-switch(_d6.Type){
-case 1:
-_d7="daily";
-this.frequency=_d7.toString();
-break;
-case 2:
-_d7="weekly";
-this.frequency=_d7.toString();
-break;
-case 3:
-_d7="monthly";
-this.frequency=_d7.toString();
-break;
-case 4:
-_d7="yearly";
-this.frequency=_d7.toString();
-break;
-default:
-throw new DeviceException(err_bad_argument,"Calendar: Repeat Rule Type is Invalid");
-}
-if(_d6.StartDate){
-this.startDate=new Date(_d6.StartDate);
-}
-if(_d6.UntilDate){
-this.untilDate=new Date(_d6.UntilDate);
-}
-if(_d6.Interval){
-this.interval=_d6.Interval;
-}
-if(_d6.DaysInWeek){
-this.weekDays=[];
-for(var a in _d6.DaysInWeek){
-if(_d6.DaysInWeek[a]==6){
-_d6.DaysInWeek[a]=0;
-}else{
-_d6.DaysInWeek[a]=_d6.DaysInWeek[a]+1;
-}
-this.weekDays.push(_d6.DaysInWeek[a]);
-}
-}
-if(_d6.Month){
-this.month=_d6.Month;
-}
-if(_d6.DaysOfMonth){
-if(_d6.DaysOfMonth.Day){
-if(_d6.DaysOfMonth.Day==6){
-_d6.DaysOfMonth.Day=0;
-}else{
-_d6.DaysOfMonth.Day=_d6.DaysOfMonth.Day+1;
-}
-this.daysOfMonth.day=_d6.DaysOfMonth.Day;
-}
-if(_d6.DaysOfMonth.WeekNum){
-this.daysOfMonth.weekInMonth=_d6.DaysOfMonth.WeekNum;
-}
-}
-if(_d6.MonthDays){
-this.monthDates=[];
-for(var i=0;i<_d6.MonthDays.length;i++){
-this.monthDates.push(_d6.MonthDays[i]-1);
-}
-}
-};
-function __sp_device_calendar_entry(_da){
-if(_da.id){
-this.id=_da.id;
-}
-if(_da.type){
-this.type=_da.Type;
-}
-if(_da.Summary){
-this.summary=_da.Summary;
-}
-if(_da.Description){
-this.description=_da.Description;
-}
-if(_da.Location){
-this.location=_da.Location;
-}
-if(_da.InstanceStartTime){
-this.instanceStartTime=_da.InstanceStartTime;
-}
-if(_da.Priority>=0||_da.Priority<=255){
-this.priority=_da.Priority;
-}
-if(_da.Status){
-this.status=_da.Status;
-}
-if(_da.ExDates){
-this.exceptionDates=_da.ExDates;
-}
-if(_da.RepeatRule){
-this.repeatRule=new __sp_calendar_getList_repeatRule(_da.RepeatRule);
-}
-if(dataGetList==0){
-this.time=new __sp_calendar_entry_time(_da.InstanceStartTime,_da.InstanceEndTime,_da.AlarmTime);
-}else{
-this.time=new __sp_calendar_entry_time(_da.StartTime,_da.EndTime,_da.AlarmTime);
-}
-};
-function __sp_daysOfMonth_build(_db){
-if(_db.day){
-if(_db.day==0){
-_db.day=6;
-}else{
-_db.day=_db.day-1;
-}
-this.Day=_db.day;
-}
-if(_db.weekInMonth){
-this.WeekNum=_db.weekInMonth;
-}
-};
-function __sp_calendar_addEntry_repeatRule(_dc,str){
-try{
-if(!(_dc.frequency)){
-throw new DeviceException(MISSING_ARG_ERR,"Calendar: addEntry: frequency is missing");
-}else{
-var _de=_dc.frequency;
-switch(_de){
-case "daily":
-this.Type=1;
-break;
-case "weekly":
-this.Type=2;
-break;
-case "monthly":
-this.Type=3;
-break;
-case "yearly":
-this.Type=4;
-break;
-default:
-throw new DeviceException(err_bad_argument,"Calendar: "+str+" Repeat Rule Type is Invalid");
-}
-if(_dc.startDate){
-this.StartDate=_dc.startDate;
-}
-if(_dc.untilDate){
-this.UntilDate=_dc.untilDate;
-}
-if(_dc.interval){
-this.Interval=_dc.interval;
-}
-if(_dc.weekDays){
-this.DaysInWeek=[];
-for(var a in _dc.weekDays){
-if(_dc.weekDays[a]==0){
-_dc.weekDays[a]=6;
-}else{
-_dc.weekDays[a]=_dc.weekDays[a]-1;
-}
-this.DaysInWeek.push(_dc.weekDays[a]);
-}
-}
-if(_dc.month){
-this.Month=_dc.month;
-}
-if(_dc.monthDates){
-this.MonthDays=[];
-for(var i=0;i<_dc.monthDates.length;i++){
-this.MonthDays.push(_dc.monthDates[i]-1);
-}
-}
-if(_dc.daysOfMonth){
-this.DaysOfMonth=new Array();
-for(var a in _dc.daysOfMonth){
-var _e1=new __sp_daysOfMonth_build(_dc.daysOfMonth[a]);
-(this.DaysOfMonth).push(_e1);
-}
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_calendar_addEntry_repeatRule: "+e);
-}
-};
-function __sp_calendar_entry(_e2,str){
-try{
-if(_e2.type){
-this.Type=_e2.type;
-}
-if(_e2.id){
-this.id=_e2.id;
-if(isUpdate){
-if(_e2.time){
-if(_e2.time.begin){
-this.StartTime=_e2.time.begin;
-}
-if(_e2.time.end){
-this.EndTime=_e2.time.end;
-}
-}
-}
-}
-if(_e2.instanceStartTime){
-this.InstanceStartTime=_e2.instanceStartTime;
-}
-if(_e2.description){
-this.Description=_e2.description;
-}else{
-if(isUpdate&&(_e2.description==null)){
-this.Description=" ";
-}
-}
-if(_e2.summary){
-this.Summary=_e2.summary;
-}else{
-if(isUpdate&&(_e2.summary==null)){
-this.Summary=" ";
-}
-}
-if(_e2.location){
-this.Location=_e2.location;
-}else{
-if(isUpdate&&(_e2.location==null)){
-this.Location=" ";
-}
-}
-if(_e2.priority){
-if((_e2.priority<0)||(_e2.priority>255)){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: "+str+" Priority is Invalid");
-}else{
-this.Priority=_e2.priority;
-}
-}else{
-if(isUpdate&&(_e2.priority==null)){
-this.Priority=0;
-}
-}
-if(_e2.status){
-if(this.Type=="ToDo"){
-this.Status="Todo"+_e2.status;
-}else{
-this.Status=_e2.status;
-}
-}else{
-if(isUpdate&&(_e2.status==null)){
-this.Status="Tentative";
-}
-}
-if(_e2.exceptionDates){
-this.ExDates=_e2.exceptionDates;
-}
-if(_e2.repeatRule){
-this.RepeatRule=new __sp_calendar_addEntry_repeatRule(_e2.repeatRule,str);
-}
-if(_e2.type!=undefined&&_e2.type!=null){
-if(typeof this.Type!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: "+str+" Type is not a string");
-}
-switch(this.Type){
-case "Meeting":
-if(_e2.time){
-if(_e2.time.begin){
-this.StartTime=_e2.time.begin;
-}
-if(_e2.time.end){
-this.EndTime=_e2.time.end;
-}
-}
-break;
-case "Reminder":
-case "Anniversary":
-if(_e2.time){
-if(_e2.time.begin){
-this.StartTime=_e2.time.begin;
-}
-}
-break;
-case "ToDo":
-if(_e2.time){
-if(_e2.time.end){
-this.EndTime=_e2.time.end;
-}
-}
-break;
-case "DayEvent":
-if(_e2.time){
-if(_e2.time.begin){
-this.StartTime=_e2.time.begin;
-}
-}
-break;
-default:
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: "+str+" Type is Invalid");
-}
-}
-if(_e2.time){
-if(_e2.time.alarm){
-this.AlarmTime=_e2.time.alarm;
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_calendar_entry: "+e);
-}
-};
-function __sp_calendar_iterator_get_next(){
-var _e4=this.iter.getNext();
-if(typeof _e4=="undefined"){
-return null;
-}
-var _e5=new __sp_device_calendar_entry(_e4);
-_e4.close();
-return _e5;
-};
-function __sp_calendar_iterator(_e6){
-this.iter=_e6;
-this.next=__sp_calendar_iterator_get_next;
-};
-var CALENDAR_APP_ID=268458241;
-function __sp_calendar_startEditor(_e7,_e8,_e9){
-try{
-if(!_e7){
-throw new DeviceException(MISSING_ARG_ERR,"Calendar: startEditor: callback is missing");
-}else{
-if(typeof _e7!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: startEditor: callback is invalid");
-}
-}
-if(_e9){
-if(typeof _e9!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: startEditor: error callback is invalid");
-}
-}
-if(_e8==null||_e8==undefined){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: startEditor: entry is invalid");
-}
-var _ea=function(_eb,_ec,_ed){
-var _ee=null;
-_e7(_ee);
-if(_ec!=event_cancelled){
-var _ee=null;
-if(_ed.ReturnValue){
-_ee=new __sp_calendar_iterator(_ed.ReturnValue);
-}
-_e7(_ee);
-}
-if(_ed.ErrorCode!=0){
-switch(_ed.ErrorCode){
-case MISSING_ARG_ERR:
-case INVALID_ARG_ERR:
-case NOT_SUPPORTED_ERR:
-if(_ed.ErrorMessage){
-var _ef=splitErrorMessage(_ed.ErrorMessage);
-throw new DeviceException(MapErrorCode[_ed.ErrorCode],"Calendar: startEditor: "+_ef);
-}else{
-throw new DeviceException(MapErrorCode[_ed.ErrorCode],"Calendar: startEditor: Operation Failed");
-}
-break;
-default:
-_e9(new DeviceException(MapErrorCode[_ed.ErrorCode],"Calendar: startEditor: Operation Failed"));
-}
-}
-};
-__s60_start_and_wait(CALENDAR_APP_ID,"",_ea);
-return 0;
+this.so=device.getServiceObject("Service.Landmarks","IDataSource");
 }
 catch(e){
-__device_handle_exception(e,"__sp_calendar_startEditor: "+e);
-}
-};
-var __sp_calendar_entry_types="MeetingReminderToDoAnniversaryDayEvent";
-function __sp_calendar_getList(_f0,_f1,_f2){
-try{
-if(_f1){
-if(typeof _f1!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: getList: match is invalid");
-}
-if(_f1.id){
-dataGetList=1;
-if(typeof _f1.id!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: getList: match is invalid");
-}
-}else{
-dataGetList=0;
-}
-}
-if(!_f0){
-throw new DeviceException(MISSING_ARG_ERR,"Calendar: getList: callback is missing");
-}else{
-if(typeof _f0!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: getList: callback is invalid");
-}
-}
-if(_f2){
-if(typeof _f2!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: getList: error callback is invalid");
-}
-if(_f2==undefined||_f2==null){
-throw new DeviceException(MISSING_ARG_ERR,"Calendar: getList: error callback is missing");
-}
-}
-var _f3=function(_f4,_f5,_f6){
-if(_f6.ErrorCode!=0){
-_f2(new DeviceException(_f6.ErrorCode,"Calendar: getList: Operation Failed"));
-return;
-}
-if(_f5!=event_cancelled){
-var _f7=null;
-if(_f6.ReturnValue){
-_f7=new __sp_calendar_iterator(_f6.ReturnValue);
-}
-_f0(_f7);
-}
-};
-var _f8={};
-modifyObjectBaseProp(_f8);
-_f8.Type="IncludeAll";
-if(_f1){
-if(_f1.id){
-_f8.id=_f1.id;
-}
-if((_f1.type)&&__sp_calendar_entry_types.match(_f1.type)){
-_f8.Type=_f1.type;
-}else{
-if((_f1.type)&&typeof _f1.type!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: getList: match is invalid");
-}
-}
-if(_f1.range){
-if(_f1.range.begin){
-if(typeof (_f1.range.begin)!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: getList: match is invalid");
-}else{
-if((_f1.range.begin)=="Invalid Date"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: getList: match is invalid");
-}else{
-_f8.StartRange=_f1.range.begin;
-}
-}
-}
-if(_f1.range.end){
-if(typeof (_f1.range.end)!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: getList: match is invalid");
-}else{
-if((_f1.range.end)=="Invalid Date"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: getList: match is invalid");
-}else{
-_f8.EndRange=_f1.range.end;
-}
-}
-}
-if((_f1.range.begin)&&(_f1.range.end)){
-if((_f1.range.begin)>(_f1.range.end)){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: getList: match is invalid");
-}
-}
-}
-if(_f1.text){
-if(typeof (_f1.text)!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: getList: match is invalid");
-}else{
-_f8.SearchText=_f1.text;
-}
-}
-}
-var _f9={};
-modifyObjectBaseProp(_f9);
-_f9.Type="CalendarEntry";
-_f9.Filter=_f8;
-var _fa=this.so.IDataSource.GetList(_f9,_f3);
-if(_f9){
-delete _f9.Type;
-delete _f9.Filter;
-}
-if(_fa.ErrorCode!=0){
-switch(_fa.ErrorCode){
-case MISSING_ARG_ERR:
-case INVALID_ARG_ERR:
-case NOT_SUPPORTED_ERR:
-if(_fa.ErrorMessage){
-var _fb=splitErrorMessage(_fa.ErrorMessage);
-throw new DeviceException(MapErrorCode[_fa.ErrorCode],"Calendar: getList: "+_fb);
-}else{
-throw new DeviceException(MapErrorCode[_fa.ErrorCode],"Calendar: getList: Operation Failed");
-}
-break;
-default:
-_f2(new DeviceException(MapErrorCode[_fa.ErrorCode],"Calendar: getList: Operation Failed"));
-}
-}
-return _fa.TransactionID;
-}
-catch(e){
-__device_handle_exception(e,"sp_calendar_getList: "+e);
-}
-};
-function __sp_calendar_add(_fc){
-if(_fc){
-if(typeof _fc!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: addEntry: calendarEntry param is invalid");
-}
-if(_fc.id){
-_fc.id=undefined;
-}
-if(!_fc.type||!_fc.time){
-throw new DeviceException(MISSING_ARG_ERR,"Calendar: addEntry: mandatory param missing");
-}else{
-if(typeof _fc.type!="string"||typeof _fc.time!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: addEntry: mandatory param missing");
-}
-}
-if((_fc.type!="ToDo")&&!_fc.time.begin){
-throw new DeviceException(MISSING_ARG_ERR,"Calendar: addEntry: mandatory param StartTime missing");
-}
-if(!_fc.time.end&&(_fc.type=="ToDo"||_fc.type=="Meeting")){
-throw new DeviceException(MISSING_ARG_ERR,"Calendar: addEntry: mandatory param EndTime missing");
-}
-if(_fc.time.end&&_fc.time.alarm){
-if(_fc.time.end<_fc.time.alarm){
-throw new DeviceException(NOT_SUPPORTED_ERR,"Calendar: addEntry: alarm time greater than end time:Not supported");
-}
-}
-if(_fc.type=="ToDo"){
-if(_fc.status==0){
-if(typeof (_fc.status)!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: addEntry: mandatory param missing");
-}
-}
-}
-if(_fc.repeatRule){
-if(typeof _fc.repeatRule!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: addEntry: repeatRule param type is invalid");
-}
-if(!_fc.repeatRule.frequency||_fc.repeatRule.frequency==null){
-throw new DeviceException(MISSING_ARG_ERR,"Calendar: addEntry: mandatory param Frequency missing");
-}
-}
-var _fd=__sp_calendar_isInputValid(_fc);
-if(!_fd){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: addEntry: calendarEntry param is invalid");
-}
-}else{
-throw new DeviceException(MISSING_ARG_ERR,"Calendar: addEntry: mandatory param missing");
-}
-try{
-var str="addEntry:";
-var _ff={};
-modifyObjectBaseProp(_ff);
-_ff.Type="CalendarEntry";
-_ff.Item=new __sp_calendar_entry(_fc,str);
-var _100=this.so.IDataSource.Add(_ff);
-if(_ff){
-delete _ff.Type;
-delete _ff.Item;
-}
-var _101="Operation Failed";
-if(_100.ErrorMessage){
-_101=splitErrorMessage(_100.ErrorMessage);
-}
-if(_100.ErrorCode!=0){
-throw new DeviceException(MapErrorCode[_100.ErrorCode],"Calendar: addEntry: Operation Failed");
-return;
-}else{
-var _102=_100.ReturnValue;
-return _102;
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_calendar_add: "+e);
-}
-};
-function __sp_calendar_update(_103){
-isUpdate=1;
-if(_103){
-if(typeof _103!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: updateEntry: calendarEntry param is invalid");
-}
-if(!_103.id){
-throw new DeviceException(MISSING_ARG_ERR,"Calendar: updateEntry: mandatory param - Id missing");
-}
-if(_103.repeatRule){
-if(typeof _103.repeatRule!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: updateEntry: repeatRule param type is invalid");
-}
-if((_103.repeatRule.frequency==null||_103.repeatRule.frequency==undefined)){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: updateEntry: repeatRule param type is invalid");
-}
-if(_103.repeatRule.startDate&&(_103.repeatRule.startDate==null||_103.repeatRule.startDate==undefined)){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: updateEntry: repeatRule param type is invalid");
-}
-if(_103.repeatRule.untilDate&&(_103.repeatRule.untilDate==null||_103.repeatRule.untilDate==undefined)){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: updateEntry: repeatRule param type is invalid");
-}
-}
-if(_103.time){
-if(_103.time.end&&_103.time.alarm){
-if(_103.time.alarm>_103.time.end){
-throw new DeviceException(NOT_SUPPORTED_ERR,"Calendar: updateEntry: alarm time greater than end time is not supported");
-}
-}
-}
-var _104=__sp_calendar_isInputValid(_103);
-if(!_104){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: updateEntry: calendarEntry param is invalid");
-}
-}else{
-throw new DeviceException(MISSING_ARG_ERR,"Calendar: updateEntry: mandatory param missing");
-}
-try{
-var str="updateEntry:";
-var _106={};
-modifyObjectBaseProp(_106);
-_106.Type="CalendarEntry";
-_106.Item=new __sp_calendar_entry(_103,str);
-isUpdate=0;
-var _107=this.so.IDataSource.Add(_106);
-if(_106){
-delete _106.Type;
-delete _106.Item;
-}
-var _108="Operation Failed";
-if(_107.ErrorMessage){
-_108=splitErrorMessage(_107.ErrorMessage);
-}
-if(_107.ErrorCode!=0){
-throw new DeviceException(MapErrorCode[_107.ErrorCode],"Calendar: addEntry: Operation Failed");
-return;
-}else{
-var _109=_107.ReturnValue;
-return _109;
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_calendar_add: "+e);
-}
-};
-function __sp_calendar_delete(data){
-try{
-if(data){
-if(typeof data!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: deleteEntry: data is invalid");
-}
-if(!data.id){
-throw new DeviceException(MISSING_ARG_ERR,"Calendar: deleteEntry: id is missing");
-}
-var _10b=__sp_calendar_isInputValid(data);
-if(!_10b){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: deleteEntry: delete data is invalid");
-}
-}else{
-throw new DeviceException(MISSING_ARG_ERR,"Calendar: deleteEntry: data is missing");
-}
-var _10c={};
-modifyObjectBaseProp(_10c);
-_10c.Type="CalendarEntry";
-_10c.Data={};
-modifyObjectBaseProp(_10c.Data);
-_10c.Data.IdList=[];
-var list=[data.id];
-_10c.Data.IdList=list;
-if(data.range){
-if(data.range.begin){
-_10c.Data.StartRange=data.range.begin;
-}
-if(data.range.end){
-_10c.Data.EndRange=data.range.end;
-}
-}
-var rval=this.so.IDataSource.Delete(_10c);
-if(_10c){
-delete _10c.Type;
-delete _10c.Data.IdList;
-delete _10c.Data.StartRange;
-delete _10c.Data.EndRange;
-}
-if(list){
-delete list.id;
-}
-if(rval.ErrorCode!=0){
-if(rval.ErrorMessage){
-var _10f=splitErrorMessage(rval.ErrorMessage);
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Calendar: deleteEntry: "+_10f);
-}else{
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Calendar: deleteEntry: Operation Failed");
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_calendar_delete: "+e);
-}
-};
-function __sp_calendar_cancel(_110){
-try{
-if(!_110||_110==null||_110==undefined){
-throw new DeviceException(MISSING_ARG_ERR,"Calendar: cancel: id is missing");
-}
-if(_110){
-if(typeof _110!="number"){
-throw new DeviceException(INVALID_ARG_ERR,"Calendar: cancel: id is missing");
-}
-}
-var _111={};
-modifyObjectBaseProp(_111);
-_111.TransactionID=_110;
-var _112=this.so.IDataSource.Cancel(_111);
-if(_111){
-delete _111.TransactionID;
-}
-if(_112.ErrorCode!=0){
-if(_112.ErrorMessage){
-var _113=splitErrorMessage(_112.ErrorMessage);
-throw new DeviceException(MapErrorCode[_112.ErrorCode],"Calendar: cancel: "+_113);
-}else{
-throw new DeviceException(MapErrorCode[_112.ErrorCode],"Calendar: cancel: Operation Failed");
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_calendar_cancel: "+e);
-}
-};
-function __sp_calendar_instance(){
-this.descriptor=new __sp_calendar_descriptor();
-this.startEditor=__sp_calendar_startEditor;
-this.getList=__sp_calendar_getList;
-this.addEntry=__sp_calendar_add;
-this.updateEntry=__sp_calendar_update;
-this.deleteEntry=__sp_calendar_delete;
-this.cancel=__sp_calendar_cancel;
-this.so=null;
-try{
-this.so=device.getServiceObject("Service.Calendar","IDataSource");
-}
-catch(e){
-__device_handle_exception(e,"Calendar service not available");
-}
-};
-function __sp_camera_descriptor(){
-this.interfaceName="camera";
-if(window.__Service_Interface_Ver){
-this.version=__Service_Interface_Ver;
-}else{
-this.version=1;
-}
-};
-var __sp_camera_start_date;
-var CAMERA_APP_ID=270501242;
-function __sp_startCamera(_114,_115){
-if(_114==null){
-throw new DeviceException(MISSING_ARG_ERR,"Camera:startCamera:callback is missing");
-}
-if(_114==undefined){
-throw new DeviceException(INVALID_ARG_ERR,"Camera:startCamera:callback is a non-function");
-}
-if(typeof (_114)!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Camera:startCamera:callback is a non-function");
-}
-if(_115){
-if(typeof _115!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Camera:startCamera:callback is invalid");
-}
-}
-var _116=function(){
-var _117=function(arg1,arg2,arg3){
-var it=arg3.ReturnValue;
-var item;
-var _11d=[];
-if(arg3.ErrorCode!=0){
-_115(new DeviceException(arg3.ErrorCode,"Camera:startCamera: Operation Failed"));
-return;
-}
-if((item=it.getNext())!=undefined){
-var d=new Date(Date.parse(item.FileDate));
-if(d>__sp_camera_start_date){
-var _11f={};
-modifyObjectBaseProp(_11f);
-var _120=item.FileNameAndPath.replace(/\\/g,"/");
-var _121="file:///";
-var _122="";
-_122=_122.concat(_121,_120);
-_11f.uri=_122;
-var _123={};
-_123.height=item.XPixels;
-_123.width=item.YPixels;
-_123.type=item.MimeType;
-_11f.format=_123;
-_11d.unshift(_11f);
-if(_123){
-}
-}
-}
-var _124=0;
-var _125=0;
-_114(_11d);
-};
-try{
-var mso=device.getServiceObject("Service.MediaManagement","IDataSource");
-}
-catch(e){
-__device_handle_exception(e,"media service not available : "+e);
-}
-var _127={};
-modifyObjectBaseProp(_127);
-_127.Type="FileInfo";
-_127.Filter={};
-modifyObjectBaseProp(_127.Filter);
-_127.Filter.FileType="Image";
-_127.Sort={};
-modifyObjectBaseProp(_127.Sort);
-_127.Sort.Key="FileDate";
-_127.Sort.Order="Descending";
-try{
-var rval=mso.IDataSource.GetList(_127,_117);
-}
-catch(error){
-__device_handle_exception(error,"media service GetList failed: "+error);
-}
-};
-__sp_camera_start_date=new Date();
-__s60_start_and_wait(CAMERA_APP_ID,"",_116);
-var _129=0;
-return _129;
-};
-function __sp_supportedSizes(){
-try{
-var _12a=device.getServiceObject("Service.SysInfo","ISysInfo");
-}
-catch(e){
-__device_handle_exception(e,"SysInfo Service not available : "+e);
-}
-var _12b={};
-modifyObjectBaseProp(_12b);
-_12b.Entity="Camera";
-_12b.Key="CameraProperties";
-try{
-var rval=_12a.ISysInfo.GetInfo(_12b);
-if(_12b){
-delete _12b.Entity;
-delete _12b.Key;
-}
-}
-catch(error){
-__device_handle_exception(error,"Camera : Failed to fetch supported size Info: "+error);
-}
-var _12d=rval.ReturnValue;
-var _12e=[];
-var _12f=[];
-_12e=_12d.ResolutionList;
-for(var i=0;i<_12e.length;i++){
-var _131="";
-_131=_131.concat(_12e[i].height,"X",_12e[i].width);
-_12f.push(_131);
-}
-return _12f;
-};
-function __sp_supportedMediaTypes(){
-try{
-var _132=device.getServiceObject("Service.SysInfo","ISysInfo");
-}
-catch(e){
-__device_handle_exception(e,"SysInfo Service not available : "+e);
-}
-var _133={};
-modifyObjectBaseProp(_133);
-_133.Entity="Camera";
-_133.Key="CameraProperties";
-try{
-var rval=_132.ISysInfo.GetInfo(_133);
-if(_133){
-delete _133.Entity;
-delete _133.Key;
-}
-}
-catch(error){
-__device_handle_exception(error,"Camera :Failed to fetch supported media type Info: "+error);
-}
-var _135=rval.ReturnValue;
-var _136=[];
-_136=_135.MimeTypeList;
-return _136;
-};
-function __sp_camera_instance(){
-this.descriptor=new __sp_camera_descriptor();
-this.supportedMediaTypes=__sp_supportedMediaTypes();
-this.supportedSizes=__sp_supportedSizes();
-this.startCamera=__sp_startCamera;
-this.stopViewfinder=__s60_api_not_supported;
-this.takePicture=__s60_api_not_supported;
-};
-var invoker_notification;
-var error=new DeviceException(0,"dummy");
-function __sp_commlog_descriptor(){
-this.interfaceName="commlog";
-if(window.__Service_Interface_Ver){
-this.version=__Service_Interface_Ver;
-}else{
-this.version=1;
-}
-};
-var __sp_commlog_type_constants={"call":0,"sms":3};
-var __sp_commlog_constants={"received":0,"missed":5,"outgoing":1};
-var __sp_commlog_constants_output={"Received":0,"Missed":5,"Outgoing":1};
-var __notifArr=new Array();
-var __notifCount=0;
-__Notification.prototype=new Object();
-__Notification.prototype.constructor=__Notification;
-function __Notification(_137,_138){
-this.connectionId=_137;
-this.callback=_138;
-};
-var __nofLogs;
-function __get_const_string(def,val){
-var i;
-for(i in def){
-if(def[i]==val){
-return i;
-}
-}
+__device_handle_exception(e,"Landmarks service not available");
+}
+};
+var __SP_CATEGORY_MIN_LOCAL_ID=16;
+var __sp_category_list=[{id:1,globalId:3000,name:"Accommodation"},{id:2,globalId:6000,name:"Businesses"},{id:3,globalId:9000,name:"Telecommunications"},{id:4,globalId:12000,name:"Education"},{id:5,globalId:15000,name:"Entertainment"},{id:6,globalId:18000,name:"Food and drink"},{id:7,globalId:21000,name:"Geographical locations"},{id:8,globalId:24000,name:"Outdoor activities"},{id:9,globalId:27000,name:"People"},{id:10,globalId:30000,name:"Public services"},{id:11,globalId:33000,name:"Places of worship"},{id:12,globalId:36000,name:"Shopping"},{id:13,globalId:39000,name:"Sightseeing"},{id:14,globalId:42000,name:"Sports"},{id:15,globalId:45000,name:"Transport"}];
+function __sp_landmarks_category_iterator(_68){
+this.iter=_68;
+this.next=__sp_landmarks_category_iterator_get_next;
+this.hasNext=__sp_landmarks_category_iterator_has_next;
+this.hasElement=false;
+this.catItem=null;
+this.close=__sp_landmarks_category_close;
+};
+function __sp_landmarks_category_close(){
+this.iter.close();
+};
+function __sp_landmarks_category_iterator_has_next(){
+if(this.hasElement){
+if(this.catItem!==null){
+return true;
+}else{
+return false;
+}
+}else{
+this.catItem=this.iter.getNext();
+this.hasElement=true;
+if(typeof this.catItem=="undefined"){
+this.catItem=null;
+return false;
+}else{
+return true;
+}
+}
+};
+function __sp_landmarks_category_iterator_get_next(){
+if(this.hasElement){
+var _69=new Object();
+_69=this.catItem;
+this.catItem=this.iter.getNext();
+if(typeof (this.catItem)=="undefined"){
+this.catItem=null;
+}
+return new __sp_device_category_obj(_69);
+}else{
+this.catItem=this.iter.getNext();
+if(typeof this.catItem=="undefined"){
+this.hasElement=true;
+this.catItem=null;
 return null;
-};
-function __get_const_val(def,str){
-if(def[str]!=undefined){
-return def[str];
-}
-return null;
-};
-function __device_commlog_item(_13e){
-if(!_13e){
-return null;
-}
-var evt={};
-evt.type=__get_const_string(__sp_commlog_type_constants,_13e.EventType);
-if(evt.type==null||evt.type==undefined){
+}else{
+this.hasElement=true;
+var _6a=new Object();
+_6a=this.lmItem;
+this.catItem=this.iter.getNext();
+if(typeof (this.catItem)=="undefined"){
+this.catItem=null;
+}
+return new __sp_device_category_obj(_6a);
+}
+}
+};
+function __sp_landmarks_iterator(_6b){
+this.iter=_6b;
+this.next=__sp_landmarks_iterator_get_next;
+this.hasNext=__sp_landmarks_iterator_has_next;
+this.hasElement=false;
+this.lmItem=null;
+this.close=__sp_landmarks_landmarkitem_close;
+};
+function __sp_landmarks_landmarkitem_close(){
+this.iter.close();
+};
+function __sp_device_landmark_location_obj(_6c){
+this.longitude=(_6c.Longitude==undefined)?null:_6c.Longitude;
+this.latitude=(_6c.Latitude==undefined)?null:_6c.Latitude;
+if(_6c.Altitude){
+this.altitude=_6c.Altitude;
+}
+if(_6c.HAccuracy){
+this.hAccuracy=_6c.HAccuracy;
+}
+if(_6c.VAccuracy){
+this.vAccuracy=_6c.VAccuracy;
+}
+};
+function __sp_landmark_position_obj(_6d){
+if((_6d.longitude!==undefined)&&(_6d.longitude!==null)&&(_6d.longitude!=="")){
+this.Longitude=_6d.longitude;
+}
+if((_6d.latitude!==undefined)&&(_6d.latitude!==null)&&(_6d.latitude!=="")){
+this.Latitude=_6d.latitude;
+}
+};
+function __sp_landmark_position_obj_fromJS_2LIW(_6e){
+var _6f=new DeviceAPIError(0,"dummy");
+if(typeof (_6e)!="object"){
+throw new DeviceAPIError(_6f.INVALID_ARG_ERR,"position must be of type object");
+}
+var _70=false;
+var _71=false;
+if((_6e.longitude!==undefined)&&(_6e.longitude!==null)&&(_6e.longitude!=="")){
+this.Longitude=_6e.longitude;
+_70=true;
+}
+if((_6e.latitude!==undefined)&&(_6e.latitude!==null)&&(_6e.latitude!=="")){
+this.Latitude=_6e.latitude;
+_71=true;
+}
+if(!(_70&&_71)){
+throw new DeviceAPIError(_6f.MISSING_ARG_ERR,"missing position field");
+}
+if(_6e.altitude){
+this.Altitude=_6e.altitude;
+}
+if(_6e.hAccuracy){
+this.HAccuracy=_6e.hAccuracy;
+}
+if(_6e.vAccuracy){
+this.VAccuracy=_6e.vAccuracy;
+}
+};
+function __sp_landmark_bounded_area_obj(_72){
+var _73=new DeviceAPIError(0,"dummy");
+var _74=false;
+var _75=false;
+if((_72.coordinate1!==undefined)&&(_72.coordinate1!==null)&&(_72.coordinate1!=="")){
+if(typeof (_72.coordinate1)!="object"){
+throw new DeviceAPIError(_73.INVALID_ARG_ERR,"coordinate1 must be an object");
+}else{
+var _76=false;
+var _77=false;
+if((_72.coordinate1.latitude!==undefined)&&(_72.coordinate1.latitude!==null)&&(_72.coordinate1.latitude!=="")){
+this.NorthLatitude=_72.coordinate1.latitude;
+_76=true;
+}
+if((_72.coordinate1.longitude!==undefined)&&(_72.coordinate1.longitude!==null)&&(_72.coordinate1.longitude!=="")){
+this.EastLongitude=_72.coordinate1.longitude;
+_77=true;
+}
+if(!(_76&&_77)){
+throw new DeviceAPIError(_73.MISSING_ARG_ERR,"missing position field");
+}
+_74=true;
+}
+}
+if((_72.coordinate2!==undefined)&&(_72.coordinate2!==null)&&(_72.coordinate2!=="")){
+if(typeof (_72.coordinate2)!="object"){
+throw new DeviceAPIError(_73.INVALID_ARG_ERR,"coordinate2 must be an object");
+}else{
+var _76=false;
+var _77=false;
+if((_72.coordinate2.latitude!==undefined)&&(_72.coordinate2.latitude!==null)&&(_72.coordinate2.latitude!=="")){
+this.SouthLatitude=_72.coordinate2.latitude;
+_76=true;
+}
+if((_72.coordinate2.longitude!==undefined)&&(_72.coordinate2.longitude!==null)&&(_72.coordinate2.longitude!=="")){
+this.WestLongitude=_72.coordinate2.longitude;
+_77=true;
+}
+if(!(_76&&_77)){
+throw new DeviceAPIError(_73.MISSING_ARG_ERR,"missing position field");
+}
+_75=true;
+}
+}
+if(!(_74&&_75)){
+throw new DeviceAPIError(_73.MISSING_ARG_ERR,"missing position field");
+}
+};
+function __sp_device_landmark_address_obj(_78){
+if(_78.Street){
+this.street=_78.Street;
+}
+if(_78.City){
+this.city=_78.City;
+}
+if(_78.state){
+this.state=_78.state;
+}
+if(_78.AreaCode){
+this.postalCode=_78.AreaCode;
+}
+if(_78.Country){
+this.country=_78.Country;
+}
+if(_78.BuildingName){
+this.building=_78.BuildingName;
+}
+if(_78.Telephone){
+this.phone=_78.Telephone;
+}
+};
+function __sp_landmark_address_obj(_79){
+var _7a=new DeviceAPIError(0,"dummy");
+if(typeof (_79)!="object"){
+throw new DeviceAPIError(_7a.MISSING_ARG_ERR,"address must be of type object");
+}
+if(_79.street!==undefined){
+if(_79.street===null){
+this.Street="";
+}else{
+this.Street=_79.street;
+}
+}
+if(_79.city!==undefined){
+if(_79.city===null){
+this.City="";
+}else{
+this.City=_79.city;
+}
+}
+if(_79.state!==undefined){
+if(_79.state===null){
+this.state="";
+}else{
+this.state=_79.state;
+}
+}
+if(_79.postalCode!==undefined){
+if(_79.postalCode===null){
+this.AreaCode="";
+}else{
+this.AreaCode=_79.postalCode;
+}
+}
+if(_79.country!==undefined){
+if(_79.country===null){
+this.Country="";
+}else{
+this.Country=_79.country;
+}
+}
+if(_79.building!==undefined){
+if(_79.building===null){
+this.BuildingName="";
+}else{
+this.BuildingName=_79.building;
+}
+}
+if(_79.phone!==undefined){
+if(_79.phone===null){
+this.Telephone="";
+}else{
+this.Telephone=_79.phone;
+}
+}
+};
+function __sp_add_category_ids_for_names(_7b){
+var _7c=new DeviceAPIError(0,"dummy");
+var _7d=new Array();
+for(var i in _7b){
+if((_7b[i]!==undefined)&&(_7b[i]!=="")&&(_7b[i]!==null)){
+if(typeof (_7b[i])!="string"){
+throw new DeviceAPIError(_7c.INVALID_ARG_ERR,"category should be of type string");
+}else{
+_7d.push(_7b[i].toString());
+}
+}
+}
+return _7d;
+};
+function __sp_get_category_ids_for_names(_7f){
+var _80=new DeviceAPIError(0,"dummy");
+var _81=new Array();
+var _82=0;
+for(var i in _7f){
+if(typeof (_7f[i])!="string"){
+throw new DeviceAPIError(_80.INVALID_ARG_ERR,"category should be of type string");
+}
+for(var ii in __sp_category_list){
+if(__sp_category_list[ii].name.toLowerCase()==_7f[i].toLowerCase()){
+_81.push(__sp_category_list[ii].id.toString());
+_82=1;
+}
+}
+if(_82==0){
 return null;
 }
-evt.phoneNumber=_13e.PhoneNumber;
-if(evt.phoneNumber==null||evt.phoneNumber==undefined||evt.phoneNumber.length==0){
-evt.phoneNumber="private number";
-}
-evt.time=_13e.EventTime;
-evt.flag=(_13e.Direction==undefined)?null:__get_const_string(__sp_commlog_constants_output,_13e.Direction);
-evt.summary=_13e.Description;
-evt.logId=Number(_13e.id);
-evt.contactName=_13e.RemoteParty;
-if(!evt.contactName){
-evt.contactName=evt.phoneNumber;
-}
-return evt;
-};
-function __sp_commlog_iterator_get_next(){
-if(typeof __nofLogs=="number"){
-if(__nofLogs<=0){
-return null;
-}
-__nofLogs=__nofLogs-1;
-}
-if((typeof this.buffer=="object")&&(this.buffer!=null)){
-var b1=this.buffer;
-this.buffer=null;
-var _141=new __device_commlog_item(b1);
-return _141;
-}else{
-var _142;
-if(this.iter!=undefined&&this.iter!=null){
-_142=this.iter.getNext();
-}
-if(typeof _142=="undefined"){
-return null;
-}
-var rval=new __device_commlog_item(_142);
-_142.close();
-return rval;
-}
-};
-function __sp_commlog_iterator_has_next(){
-if(this.iter!=undefined&&this.iter!=null){
-this.buffer=this.iter.getNext();
-}
-if((typeof this.buffer=="object")&&(this.buffer!=null)){
+_82=0;
+}
+return _81;
+};
+function __sp_device_landmark_obj(_85){
+this.landmarkId=_85.id;
+if(_85.LandmarkName){
+this.name=_85.LandmarkName;
+}
+if(_85.LandmarkDesc){
+this.description=_85.LandmarkDesc;
+}
+if(_85.CoverageRadius){
+this.coverageRadius=_85.CoverageRadius;
+}
+if(_85.LandmarkPosition){
+this.position=new __sp_device_landmark_location_obj(_85.LandmarkPosition);
+}
+if(_85.CategoryInfo){
+this.categoryIds=_85.CategoryInfo;
+}
+if(_85.LandmarkFields){
+this.address=new __sp_device_landmark_address_obj(_85.LandmarkFields);
+}
+};
+function __sp_landmarks_addLocality(add){
+var _87=new DeviceAPIError(0,"dummy");
+if(typeof (add)!="object"){
+throw new DeviceAPIError(_87.INVALID_ARG_ERR,"address should be of type object");
+}
+if((add.street!==undefined)&&(add.street!==null)&&(add.street!=="")){
+this.Street=add.street;
+}
+if((add.city!==undefined)&&(add.city!==null)&&(add.city!=="")){
+this.City=add.city;
+}
+if((add.state!==undefined)&&(add.state!==null)&&(add.state!=="")){
+this.state=add.state;
+}
+if((add.postalCode!==undefined)&&(add.postalCode!==null)&&(add.postalCode!=="")){
+this.AreaCode=add.postalCode;
+}
+if((add.country!==undefined)&&(add.country!==null)&&(add.country!=="")){
+this.Country=add.country;
+}
+if((add.building!==undefined)&&(add.building!==null)&&(add.building!=="")){
+this.BuildingName=add.building;
+}
+if((add.phone!==undefined)&&(add.phone!==null)&&(add.phone!=="")){
+this.Telephone=add.phone;
+}
+};
+function __sp_landmarks_addPosition(pos){
+var _89=new DeviceAPIError(0,"dummy");
+if(typeof (pos)!="object"){
+throw new DeviceAPIError(_89.INVALID_ARG_ERR,"position should be of type object");
+}
+if((pos.longitude!==undefined)&&(pos.longitude!==null)&&(pos.longitude!=="")){
+this.Longitude=pos.longitude;
+}
+if((pos.latitude!==undefined)&&(pos.latitude!==null)&&(pos.latitude!=="")){
+this.Latitude=pos.latitude;
+}
+if((pos.altitude!==undefined)&&(pos.altitude!==null)&&(pos.altitude!=="")){
+this.Altitude=pos.altitude;
+}
+if((pos.hAccuracy!==undefined)&&(pos.hAccuracy!==null)&&(pos.hAccuracy!=="")){
+this.HAccuracy=pos.hAccuracy;
+}
+if((pos.vAccuracy!==undefined)&&(pos.vAccuracy!==null)&&(pos.vAccuracy!=="")){
+this.VAccuracy=pos.vAccuracy;
+}
+};
+function __sp_landmarks_addLmObject(lm){
+var _8b=false;
+var _8c=new DeviceAPIError(0,"dummy");
+if((lm.name!==undefined)&&(lm.name!==null)&&(lm.name!=="")){
+this.LandmarkName=lm.name;
+}
+if((lm.description!==undefined)&&(lm.description!==null)&&(lm.description!=="")){
+this.LandmarkDesc=lm.description;
+}
+if((lm.position!==undefined)&&(lm.position!==null)&&(lm.position!=="")){
+this.LandmarkPosition=new __sp_landmarks_addPosition(lm.position);
+_8b=true;
+}
+if((lm.coverageRadius!==undefined)&&(lm.coverageRadius!==null)&&(lm.coverageRadius!=="")){
+if(_8b){
+this.CoverageRadius=lm.coverageRadius;
+}else{
+throw new DeviceAPIError(_8c.MISSING_ARG_ERR,"missing position");
+}
+}
+if((lm.categoryIds!==undefined)&&(lm.categoryIds!==null)&&(lm.categoryIds!=="")){
+if(typeof (lm.categoryIds)!="object"){
+throw new DeviceAPIError(_8c.INVALID_ARG_ERR,"categoryids should be of type object");
+}
+this.CategoryInfo=__sp_add_category_ids_for_names(lm.categoryIds);
+if(!this.CategoryInfo){
+throw new DeviceAPIError(_8c.MISSING_ARG_ERR,"invalid category");
+}
+}
+if((lm.address!==undefined)&&(lm.address!==null)&&(lm.address!=="")){
+this.LandmarkFields=new __sp_landmarks_addLocality(lm.address);
+}
+this.dummyField="dummyfield";
+};
+function __sp_landmark_obj(_8d,str){
+var _8f=new DeviceAPIError(0,"dummy");
+if(_8d.name!==undefined){
+if(_8d.name===null){
+this.LandmarkName="";
+}else{
+this.LandmarkName=_8d.name;
+}
+}
+if((_8d.landmarkId===undefined)||(_8d.landmarkId===null)||(_8d.landmarkId==="")){
+throw new DeviceAPIError(_8f.MISSING_ARG_ERR,"for updating; id must be supplied");
+}else{
+this.id=_8d.landmarkId;
+}
+if(_8d.description!==undefined){
+if(_8d.description===null){
+this.LandmarkDesc="";
+}else{
+this.LandmarkDesc=_8d.description;
+}
+}
+if(_8d.position){
+this.LandmarkPosition=new __sp_landmark_position_obj_fromJS_2LIW(_8d.position);
+}
+if(_8d.coverageRadius){
+this.CoverageRadius=_8d.coverageRadius;
+}
+if(_8d.categories){
+this.CategoryInfo=__sp_get_category_ids_for_names(_8d.categories);
+if(!this.CategoryInfo){
+throw new DeviceError("Landmarks: "+str+"Category is invalid",err_bad_argument);
+}
+}
+if(_8d.address){
+this.LandmarkFields=new __sp_landmark_address_obj(_8d.address);
+}
+this.temp="dummy";
+};
+function __sp_landmarks_iterator_has_next(){
+if(this.hasElement){
+if(this.lmItem!==null){
 return true;
 }else{
 return false;
 }
-};
-function __sp_commlog_iterator_close(){
-};
-function __sp_commlog_iterator(_144){
-this.iter=_144;
-this.buffer=null;
-this.next=__sp_commlog_iterator_get_next;
-this.hasNext=__sp_commlog_iterator_has_next;
-this.close=__sp_commlog_iterator_close;
-this.nofLogs=__nofLogs;
-};
-function __sp_commlog_getList(_145,_146,_147){
-if(_145==null||_145==undefined){
-throw new DeviceException(error.MISSING_ARG_ERR,"CommLog:getList:callback is Required");
-}else{
-if(typeof _145!="function"){
-throw new DeviceException(error.INVALID_ARG_ERR,"CommLog:getList:Invalid Callback");
-}
-}
-if(_147){
-if(typeof (_147)!="function"){
-throw new DeviceException(error.INVALID_ARG_ERR,"CommLog: getList: ErrorCallback is invalid");
-}
-}
-if(_146!=null&&_146!=undefined){
-if(typeof _146!="object"||__device_typeof(_146)=="Array"){
-throw new DeviceException(error.INVALID_ARG_ERR,"CommLog: getList: Match is not an object");
-}
-if(_146.type!=null&&_146.type!=undefined){
-if(typeof _146.type!="string"){
-throw new DeviceException(error.INVALID_ARG_ERR,"CommLog: getList: Type is not a string");
-}
-}
-if(_146.flag!=null&&_146.flag!=undefined){
-if(typeof _146.flag!="string"){
-throw new DeviceException(error.INVALID_ARG_ERR,"CommLog: getList: Flag is not a string");
-}
-if(_146.type){
-if(_146.type.toLowerCase()=="sms"&&_146.flag.toLowerCase()=="missed"){
-if(_147){
-setTimeout(function(){
-_147(new DeviceException(error.DATA_OUT_OF_RANGE_ERR,"commlogs: getList: Missed is not supported for sms"));
-},1000);
+}else{
+this.lmItem=this.iter.getNext();
+this.hasElement=true;
+if(typeof this.lmItem=="undefined"){
+this.lmItem=null;
+return false;
+}else{
+return true;
+}
+}
+};
+function __sp_landmarks_iterator_get_next(){
+if(this.hasElement){
+var _90=new Object();
+_90=this.lmItem;
+this.lmItem=this.iter.getNext();
+if(typeof (this.lmItem)=="undefined"){
+this.lmItem=null;
+}
+return new __sp_device_landmark_obj(_90);
+}else{
+this.lmItem=this.iter.getNext();
+if(typeof this.lmItem=="undefined"){
+this.hasElement=true;
+this.lmItem=null;
+return null;
+}else{
+this.hasElement=true;
+var _91=new Object();
+_91=this.lmItem;
+this.lmItem=this.iter.getNext();
+if(typeof (this.lmItem)=="undefined"){
+this.lmItem=null;
+}
+return new __sp_device_landmark_obj(_91);
+}
+}
+};
+function __sp_category_obj(_92){
+if(_92.name){
+this.CategoryName=_92.name;
+}
+if(_92.categoryId){
+this.id=_92.categoryId;
+}
+};
+function __sp_device_category_obj(_93){
+this.categoryId=_93.id;
+this.name=_93.CategoryName;
+};
+var LANDMARKS_APP_ID=270501282;
+function __sp_landmarks_startEditor(_94,_95,_96){
+error=new DeviceAPIError(0,"dummy");
+if((_94===undefined)||(_94===null)||(_94==="")){
+throw new DeviceAPIError(error.MISSING_ARG_ERR,"StartEditor:Missing Success Callback");
+}
+if((typeof _94)!="function"){
+throw new DeviceAPIError(error.INVALID_ARG_ERR,"StartEditor:Success Callback must be of type function");
+}
+if(_95!==undefined){
+if((_95!==null)&&(_95!=="")){
+throw new DeviceAPIError(error.NOT_SUPPORTED_ERR,"startEditor:landmark item is not supported");
+}
+}
+if((_96!==undefined)&&(_96!==null)&&(_96!=="")){
+if((typeof _96)!="function"){
+throw new DeviceAPIError(error.INVALID_ARG_ERR,"StartEditor:error callback must be of type function");
+}
+}
+var _97=270501282;
+var _98;
+function __s60_on_app_exit(){
+window.xwidget.onshow=null;
+if(_98){
+_98();
+}
+};
+var _99=function(_9a,_9b,_9c){
+_94(_9a,_9b,_9c);
+};
+__s60_start_and_wait(_97,"",_99);
+};
+function __sp_landmarks_category_getList_cb(_9d,_9e,_9f){
+var _a0;
+var _a1;
+var _a2;
+if(this.temporarySCb){
+_a1=this.temporarySCb;
+_a2=this.temporaryECb;
+this.temporarySCb=null;
+this.temporaryECb=null;
+}else{
+_a0=glob_obj.getFromArray(_9d);
+if(_a0){
+_a1=_a0.success_cb;
+_a2=_a0.error_cb;
+}else{
+alert("Landmarks: __sp_landmarks_category_getList_cb: Callback not found ");
 return;
-}else{
-throw new DeviceError("commlogs: getList: Missed is not supported for sms",error.DATA_OUT_OF_RANGE_ERR);
-}
-}
-}
-}
-if(_146.nofLogs!=null&&_146.nofLogs!=undefined){
-if(typeof _146.nofLogs!="number"){
-throw new DeviceException(error.INVALID_ARG_ERR,"CommLog: getList: nofLogs is invalid");
-}
-}
-}
+}
+}
+var _a3=null;
+if(_9f.ErrorCode||(_9e==4)){
+var _a4=convertFromPS2JS(_9f.ErrorCode);
+var _a5=new DeviceAPIError(_a4,_9f.ErrorMessage);
+if(_a2){
+_a2(_a5);
+}
+}else{
+if(_9f.ReturnValue){
+_a3=new __sp_landmarks_category_iterator(_9f.ReturnValue);
+_a1(_a3);
+}
+}
+glob_obj.removeFromArray(_9d);
+};
+function __sp_landmarks_category_getList(_a6,_a7,_a8){
+try{
+var _a9=new DeviceAPIError(0,"dummy");
+if((_a6===undefined)||(_a6==="")||(_a6===null)){
+throw new DeviceAPIError(_a9.MISSING_ARG_ERR,"callback is missing");
+}
+if(typeof (_a6)!="function"){
+throw new DeviceAPIError(_a9.INVALID_ARG_ERR,"invalid callback argument");
+}
+var _aa=false;
+if((_a8!==undefined)&&(_a8!==null)&&(_a8!=="")){
+if(typeof (_a8)!="function"){
+throw new DeviceAPIError(_a9.INVALID_ARG_ERR,"invalid error callback argument");
+}else{
+_aa=true;
+}
+}
+var _ab=new Object();
+modifyObjectBaseProp(_ab);
+_ab.Type="Category";
+if((_a7!==undefined)&&(_a7!==null)&&(_a7!=="")){
+if(typeof (_a7)!="string"){
+throw new DeviceAPIError(_a9.INVALID_ARG_ERR,"name must be a string");
+}
+}
+if(_a7){
+_ab.Filter=new Object();
+modifyObjectBaseProp(_ab.Filter);
+_ab.Filter.CategoryName=_a7;
+_ab.Filter.PreviousMatchesOnly=false;
+}
+this.temporarySCb=_a6;
+this.temporaryECb=_a8;
+var _ac=this.so.IDataSource.GetList(_ab,this.getCategoriesCb);
+if(_ac.TransactionID){
+glob_obj.addToGlobalArray(_ac.TransactionID,_a6,_a8);
+}
+if(_ac.ErrorCode!=0){
+switch(_ac.ErrorCode){
+case 1003:
+throw new DeviceAPIError(_a9.MISSING_ARG_ERR,_ac.ErrorMessage);
+break;
+case 1002:
+throw new DeviceAPIError(_a9.INVALID_ARG_ERR,_ac.ErrorMessage);
+break;
+case 1004:
+throw new DeviceAPIError(_a9.NOT_SUPPORTED_ERR,_ac.ErrorMessage);
+break;
+case 1000:
+throw new DeviceAPIError(_a9.INVALID_ARG_ERR,_ac.ErrorMessage);
+break;
+default:
+throw new DeviceAPIError(-101,"unknown error message");
+}
+}
+return _ac.TransactionID;
+}
+catch(e){
+throw e;
+}
+};
+function __sp_landmarks_category_add_cb(_ad,_ae,_af){
+var _b0;
+var _b1;
+var _b2;
+if(this.temporarySCb){
+category_cb=this.temporarySCb;
+_b2=this.temporaryECb;
+this.temporarySCb=null;
+this.temporaryECb=null;
+}else{
+_b0=glob_obj.getFromArray(_ad);
+if(_b0){
+_b1=_b0.success_cb;
+_b2=_b0.error_cb;
+}else{
+alert("Landmarks: __sp_landmarks_category_add_cb: Callback not found ");
+return;
+}
+}
+var id=null;
+if(_ae==4||_af.ErrorCode){
+var _b4=convertFromPS2JS(_af.ErrorCode);
+var _b5=new DeviceAPIError(_b4,_af.ErrorMessage);
+if(_b2){
+_b2(_b5);
+}
+}else{
+if(_af.ReturnValue){
+id=_af.ReturnValue;
+}
+_b1(id);
+}
+glob_obj.removeFromArray(_ad);
+};
+function __sp_landmarks_category_add(_b6,_b7,_b8){
+try{
+var _b9=new DeviceAPIError(0,"dummy");
+var _ba=true;
+if(_b6===undefined){
+throw new DeviceAPIError(_b9.MISSING_ARG_ERR,"AddSucessCallback is missing");
+}else{
+if(((_b6===null)||(_b6===""))&&(typeof (_b6)!="number")){
+throw new DeviceAPIError(_b9.MISSING_ARG_ERR,"AddSucessCallback is missing");
+}else{
+if(typeof (_b6)!="function"){
+throw new DeviceAPIError(_b9.INVALID_ARG_ERR,"invalid AddSucessCallback argument");
+}
+}
+}
+if(_b7===undefined||_b7===null){
+throw new DeviceAPIError(_b9.MISSING_ARG_ERR,"CategoryItem is missing");
+}else{
+if(typeof (_b7)!=="object"){
+throw new DeviceAPIError(_b9.INVALID_ARG_ERR,"invalid CategoryItem argument");
+}
+}
+if((_b8!=undefined)){
+if((!_b8)&&(typeof (_b8)!="number")){
+_ba=false;
+}else{
+if((typeof (_b8)!="function")){
+throw new DeviceAPIError(_b9.INVALID_ARG_ERR,"invalid ErrorCallback callback");
+}
+}
+}else{
+_ba=false;
+}
+var _bb=new Object();
+modifyObjectBaseProp(_bb);
+_bb.Type="Category";
+_bb.Data=new __sp_category_obj(_b7);
+this.temporarySCb=_b6;
+this.temporaryECb=_b8;
+var _bc=this.so.IDataSource.Add(_bb,this.addCategoryCb);
+if(_bc.TransactionID){
+glob_obj.addToGlobalArray(_bc.TransactionID,_b6,_b8);
+}
+if(_bc.ErrorCode!=0){
+switch(_bc.ErrorCode){
+case err_missing_argument:
+throw new DeviceAPIError(_b9.MISSING_ARG_ERR,_bc.ErrorMessage);
+break;
+case err_bad_argument:
+throw new DeviceAPIError(_b9.INVALID_ARG_ERR,_bc.ErrorMessage);
+break;
+case err_ServiceNotSupported:
+throw new DeviceAPIError(_b9.NOT_SUPPORTED_ERR,_bc.ErrorMessage);
+break;
+case err_InvalidService_Argument:
+throw new DeviceAPIError(_b9.INVALID_ARG_ERR,_bc.ErrorMessage);
+break;
+default:
+throw new DeviceAPIError(-101,"unknown error message");
+}
+}
+return _bc.TransactionID;
+}
+catch(e){
+throw e;
+}
+};
+function __sp_landmarks_add_cb(_bd,_be,_bf){
+var id=null;
+var _c1;
+var _c2;
+var _c3;
+if(this.temporarySCb){
+category_cb=this.temporarySCb;
+_c3=this.temporaryECb;
+this.temporarySCb=null;
+this.temporaryECb=null;
+}else{
+_c1=glob_obj.getFromArray(_bd);
+if(_c1){
+_c2=_c1.success_cb;
+_c3=_c1.error_cb;
+}else{
+alert("Landmarks: __sp_landmarks_add_cb: Callback not found ");
+return;
+}
+}
+if(_be==4||_bf.ErrorCode){
+var _c4=convertFromPS2JS(_bf.ErrorCode);
+var _c5=new DeviceAPIError(_c4,_bf.ErrorMessage);
+if(_c3){
+_c3(_c5);
+}
+}else{
+if(_bf.ReturnValue){
+id=_bf.ReturnValue;
+}
+_c2(id);
+}
+glob_obj.removeFromArray(_bd);
+};
+function __sp_landmarks_add(_c6,_c7,_c8){
 try{
-var _148={};
-modifyObjectBaseProp(_148);
-_148.Type="Log";
-_148.Filter={};
-modifyObjectBaseProp(_148.Filter);
-if(_146){
-if(_146.type){
-var _149;
-_149=__get_const_val(__sp_commlog_type_constants,_146.type.toLowerCase());
-if(_149!=undefined){
-_148.Filter.EventType=_149;
-}else{
-if(_147){
-setTimeout(function(){
-_147(new DeviceException(error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: Type is out of range"));
-},1000);
+var _c9=new DeviceAPIError(0,"dummy");
+var _ca=true;
+if(_c6===undefined){
+throw new DeviceAPIError(_c9.MISSING_ARG_ERR,"AddSucessCallback is missing");
+}else{
+if(((_c6===null)||(_c6===""))&&(typeof (_c6)!="number")){
+throw new DeviceAPIError(_c9.MISSING_ARG_ERR,"AddSucessCallback is missing");
+}else{
+if(typeof (_c6)!="function"){
+throw new DeviceAPIError(_c9.INVALID_ARG_ERR,"invalid AddSucessCallback argument");
+}
+}
+}
+if((_c7===undefined)||(_c7===null)||(_c7==="")){
+throw new DeviceAPIError(_c9.MISSING_ARG_ERR,"LandmarkItem is missing");
+}else{
+if(typeof (_c7)!=="object"){
+throw new DeviceAPIError(_c9.INVALID_ARG_ERR,"invalid LandmarkItem argument");
+}
+}
+if((_c8!=undefined)){
+if((!_c8)&&(typeof (_c8)!="number")){
+_ca=false;
+}else{
+if((typeof (_c8)!="function")){
+throw new DeviceAPIError(_c9.INVALID_ARG_ERR,"invalid ErrorCallback callback");
+}
+}
+}else{
+_ca=false;
+}
+var str="addLandmark: ";
+var _cc=new Object();
+modifyObjectBaseProp(_cc);
+_cc.Type="Landmark";
+_cc.Data=new __sp_landmarks_addLmObject(_c7);
+this.temporarySCb=_c6;
+this.temporaryECb=_c8;
+var _cd=this.so.IDataSource.Add(_cc,this.addLandmarkCb);
+if(_cd.TransactionID){
+glob_obj.addToGlobalArray(_cd.TransactionID,_c6,_c8);
+}
+if(_cd.ErrorCode!=0){
+switch(_cd.ErrorCode){
+case err_missing_argument:
+throw new DeviceAPIError(_c9.MISSING_ARG_ERR,_cd.ErrorMessage);
+break;
+case err_bad_argument:
+throw new DeviceAPIError(_c9.INVALID_ARG_ERR,_cd.ErrorMessage);
+break;
+case err_ServiceNotSupported:
+throw new DeviceAPIError(_c9.NOT_SUPPORTED_ERR,_cd.ErrorMessage);
+break;
+case err_InvalidService_Argument:
+throw new DeviceAPIError(_c9.INVALID_ARG_ERR,_cd.ErrorMessage);
+break;
+default:
+throw new DeviceAPIError(-101,"unknown error message");
+}
+}
+return _cd.TransactionID;
+}
+catch(e){
+throw e;
+}
+};
+function __sp_landmarks_delete_cb(_ce,_cf,_d0){
+var _d1;
+var _d2;
+var _d3;
+if(this.temporarySCb){
+category_cb=this.temporarySCb;
+_d2=this.temporaryECb;
+this.temporarySCb=null;
+this.temporaryECb=null;
+}else{
+_d3=glob_obj.getFromArray(_ce);
+if(_d3){
+_d1=_d3.success_cb;
+_d2=_d3.error_cb;
+}else{
+alert("Landmarks: __sp_landmarks_delete_cb: Callback not found ");
 return;
-}else{
-throw new DeviceException(error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: Type is out of range");
-}
-}
-}
-if(_146.nofLogs!=null&&_146.nofLogs!=undefined){
-if((_146.nofLogs<0)||(_146.nofLogs!=(_146.nofLogs|0))){
-if(_147){
-setTimeout(function(){
-_147(new DeviceException(error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: nofLogs is out of range"));
-},1000);
+}
+}
+if(_cf==4||_d0.ErrorCode){
+var _d4=convertFromPS2JS(_d0.ErrorCode);
+var _d5=new DeviceAPIError(_d4,_d0.ErrorMessage);
+if(_d2){
+_d2(_d5);
+}
+}else{
+_d1();
+}
+glob_obj.removeFromArray(_ce);
+};
+function __sp_landmarks_delete(_d6,_d7,_d8){
+try{
+var _d9=new DeviceAPIError(0,"dummy");
+var _da=true;
+if(_d6===undefined){
+throw new DeviceAPIError(_d9.MISSING_ARG_ERR,"SucessCallback is missing");
+}else{
+if(((_d6===null)||(_d6===""))&&(typeof (_d6)!="number")){
+throw new DeviceAPIError(_d9.MISSING_ARG_ERR,"SucessCallback is missing");
+}else{
+if(typeof (_d6)!="function"){
+throw new DeviceAPIError(_d9.INVALID_ARG_ERR,"invalid SucessCallback argument");
+}
+}
+}
+if(_d7===undefined||_d7===null){
+throw new DeviceAPIError(_d9.MISSING_ARG_ERR,"landmarkId is missing");
+}else{
+if(typeof (_d7)!=="string"){
+throw new DeviceAPIError(_d9.INVALID_ARG_ERR,"invalid landmarkId argument");
+}
+}
+if((_d8!=undefined)){
+if((!_d8)&&(typeof (_d8)!="number")){
+_da=false;
+}else{
+if((typeof (_d8)!="function")){
+throw new DeviceAPIError(_d9.INVALID_ARG_ERR,"invalid ErrorCallback callback");
+}
+}
+}else{
+_da=false;
+}
+var _db=new Object();
+modifyObjectBaseProp(_db);
+_db.Type="Landmark";
+_db.Data=new Object();
+modifyObjectBaseProp(_db.Data);
+_db.Data.id=_d7;
+this.temporarySCb=_d6;
+this.temporaryECb=_d8;
+var _dc=this.so.IDataSource.Delete(_db,this.deleteLandmarkCb);
+if(_dc.TransactionID){
+glob_obj.addToGlobalArray(_dc.TransactionID,_d6,_d8);
+}
+if(_dc.ErrorCode!=0){
+switch(_dc.ErrorCode){
+case err_missing_argument:
+throw new DeviceAPIError(_d9.MISSING_ARG_ERR,_dc.ErrorMessage);
+break;
+case err_bad_argument:
+throw new DeviceAPIError(_d9.INVALID_ARG_ERR,_dc.ErrorMessage);
+break;
+case err_ServiceNotSupported:
+throw new DeviceAPIError(_d9.NOT_SUPPORTED_ERR,_dc.ErrorMessage);
+break;
+case err_InvalidService_Argument:
+throw new DeviceAPIError(_d9.INVALID_ARG_ERR,_dc.ErrorMessage);
+break;
+default:
+throw new DeviceAPIError(-101,"unknown error message");
+}
+}
+return _dc.TransactionID;
+}
+catch(e){
+throw e;
+}
+};
+function __sp_landmarks_update_cb(_dd,_de,_df){
+var _e0;
+var _e1;
+var _e2;
+if(this.temporarySCb){
+category_cb=this.temporarySCb;
+_e1=this.temporaryECb;
+this.temporarySCb=null;
+this.temporaryECb=null;
+}else{
+_e2=glob_obj.getFromArray(_dd);
+if(_e2){
+_e0=_e2.success_cb;
+_e1=_e2.error_cb;
+}else{
+alert("Landmarks: __sp_landmarks_update_cb: Callback not found ");
 return;
-}else{
-throw new DeviceException(error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: nofLogs is out of range");
-}
-}
-__nofLogs=_146.nofLogs;
-}
-if(_146.flag){
-var _14a;
-_14a=__get_const_val(__sp_commlog_constants,_146.flag.toLowerCase());
-if(_14a!=undefined){
-_148.Filter.Direction=_14a;
-}else{
-if(_147){
-setTimeout(function(){
-_147(new DeviceException(error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: Flag is out of range"));
-},1000);
-}else{
-throw new DeviceException(error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: Flag is out of range");
-}
-}
-}
-if(_146.phoneNumber!=null&&_146.phoneNumber!=undefined){
-if(_146.phoneNumber!=""){
-_148.Filter.PhoneNumber=_146.phoneNumber;
-}
-}
-if(_146.contactName!=null&&_146.contactName!=undefined){
-if(_146.contactName!=""){
-_148.Filter.RemoteParty=_146.contactName;
-}
-}
-if(_146.startTime!=null&&_146.startTime!=undefined){
-_148.Filter.StartTime=_146.startTime;
-}
-if(_146.endTime!=null&&_146.endTime!=undefined){
-_148.Filter.EndTime=_146.endTime;
-}
-}
-var _14b=function(arg1,arg2,arg3){
-var _14f=_145;
-var _150=_147;
+}
+}
+if(_de==4||_df.ErrorCode){
+var _e3=convertFromPS2JS(_df.ErrorCode);
+var _e4=new DeviceAPIError(_e3,_df.ErrorMessage);
+if(_e1){
+_e1(_e4);
+}
+}else{
+_e0();
+}
+glob_obj.removeFromArray(_dd);
+};
+function __sp_landmarks_update(_e5,_e6,_e7){
+try{
+var _e8=new DeviceAPIError(0,"dummy");
+var _e9=true;
+if(_e5===undefined){
+throw new DeviceAPIError(_e8.MISSING_ARG_ERR,"SuccessCallback is missing");
+}else{
+if(((_e5===null)||(_e5===""))&&(typeof (_e5)!="number")){
+throw new DeviceAPIError(_e8.MISSING_ARG_ERR,"SuccessCallback is missing");
+}else{
+if(typeof (_e5)!="function"){
+throw new DeviceAPIError(_e8.INVALID_ARG_ERR,"invalid SuccessCallback argument");
+}
+}
+}
+if(_e6===undefined||_e6===null||_e6===""){
+throw new DeviceAPIError(_e8.MISSING_ARG_ERR,"LandmarkItem is missing");
+}else{
+if(typeof (_e6)!=="object"){
+throw new DeviceAPIError(_e8.INVALID_ARG_ERR,"invalid LandmarkItem argument");
+}
+}
+if((_e7!=undefined)){
+if((!_e7)&&(typeof (_e7)!="number")){
+_e9=false;
+}else{
+if((typeof (_e7)!="function")){
+throw new DeviceAPIError(_e8.INVALID_ARG_ERR,"invalid ErrorCallback callback");
+}
+}
+}else{
+_e9=false;
+}
+var str="updateLandmark: ";
+var _eb=new Object();
+modifyObjectBaseProp(_eb);
+_eb.Type="Landmark";
+_eb.Data=new __sp_landmark_obj(_e6,str);
+this.temporarySCb=_e5;
+this.temporaryECb=_e7;
+var _ec=this.so.IDataSource.Add(_eb,this.updateLandmarkCb);
+if(_ec.TransactionID){
+glob_obj.addToGlobalArray(_ec.TransactionID,_e5,_e7);
+}
+if(_ec.ErrorCode!=0){
+switch(_ec.ErrorCode){
+case err_missing_argument:
+throw new DeviceAPIError(_e8.MISSING_ARG_ERR,_ec.ErrorMessage);
+break;
+case err_bad_argument:
+throw new DeviceAPIError(_e8.INVALID_ARG_ERR,_ec.ErrorMessage);
+break;
+case err_ServiceNotSupported:
+throw new DeviceAPIError(_e8.NOT_SUPPORTED_ERR,_ec.ErrorMessage);
+break;
+case err_InvalidService_Argument:
+throw new DeviceAPIError(_e8.INVALID_ARG_ERR,_ec.ErrorMessage);
+break;
+default:
+throw new DeviceAPIError(-101,"unknown error message");
+}
+}
+return _ec.TransactionID;
+}
+catch(e){
+throw e;
+}
+};
+function __sp_landmarks_category_update_cb(_ed,_ee,_ef){
+var _f0;
+var _f1;
+var _f2;
+if(this.temporarySCb){
+category_cb=this.temporarySCb;
+_f1=this.temporaryECb;
+this.temporarySCb=null;
+this.temporaryECb=null;
+}else{
+_f2=glob_obj.getFromArray(_ed);
+if(_f2){
+_f0=_f2.success_cb;
+_f1=_f2.error_cb;
+}else{
+alert("Landmarks: __sp_landmarks_category_update_cb: Callback not found ");
+return;
+}
+}
+if(_ee==4||_ef.ErrorCode){
+var _f3=convertFromPS2JS(_ef.ErrorCode);
+var _f4=new DeviceAPIError(_f3,_ef.ErrorMessage);
+if(_f1){
+_f1(_f4);
+}
+}else{
+_f0();
+}
+glob_obj.removeFromArray(_ed);
+};
+function __sp_landmarks_category_update(_f5,_f6,_f7){
+try{
+var _f8=new DeviceAPIError(0,"dummy");
+var _f9=true;
+if(_f5===undefined){
+throw new DeviceAPIError(_f8.MISSING_ARG_ERR,"SucessCallback is missing");
+}else{
+if(((_f5===null)||(_f5===""))&&(typeof (_f5)!="number")){
+throw new DeviceAPIError(_f8.MISSING_ARG_ERR,"SucessCallback is missing");
+}else{
+if(typeof (_f5)!="function"){
+throw new DeviceAPIError(_f8.INVALID_ARG_ERR,"invalid SucessCallback argument");
+}
+}
+}
+if(_f6===undefined||_f6===null||_f6===""){
+throw new DeviceAPIError(_f8.MISSING_ARG_ERR,"CategoryItem is missing");
+}else{
+if(typeof (_f6)!=="object"){
+throw new DeviceAPIError(_f8.INVALID_ARG_ERR,"invalid CategoryItem argument");
+}
+}
+if((_f6.categoryId===undefined)||(_f6.categoryId===null)||(_f6.categoryId==="")){
+throw new DeviceAPIError(_f8.MISSING_ARG_ERR,"categoryId is missing");
+}
+if(typeof (_f6.categoryId)!="string"){
+throw new DeviceAPIError(_f8.INVALID_ARG_ERR,"category Id must be a string");
+}
+if((_f7!=undefined)){
+if((!_f7)&&(typeof (_f7)!="number")){
+_f9=false;
+}else{
+if((typeof (_f7)!="function")){
+throw new DeviceAPIError(_f8.INVALID_ARG_ERR,"invalid ErrorCallback callback");
+}
+}
+}else{
+_f9=false;
+}
+var _fa=new Object();
+modifyObjectBaseProp(_fa);
+_fa.Type="Category";
+_fa.Data=new __sp_category_obj(_f6);
+this.temporarySCb=_f5;
+this.temporaryECb=_f7;
+var _fb=this.so.IDataSource.Add(_fa,this.updateCategoryCb);
+if(_fb.TransactionID){
+glob_obj.addToGlobalArray(_fb.TransactionID,_f5,_f7);
+}
+if(_fb.ErrorCode!=0){
+switch(_fb.ErrorCode){
+case err_missing_argument:
+throw new DeviceAPIError(_f8.MISSING_ARG_ERR,_fb.ErrorMessage);
+break;
+case err_bad_argument:
+throw new DeviceAPIError(_f8.INVALID_ARG_ERR,_fb.ErrorMessage);
+break;
+case err_ServiceNotSupported:
+throw new DeviceAPIError(_f8.NOT_SUPPORTED_ERR,_fb.ErrorMessage);
+break;
+case err_InvalidService_Argument:
+throw new DeviceAPIError(_f8.INVALID_ARG_ERR,_fb.ErrorMessage);
+break;
+default:
+throw new DeviceAPIError(-101,"unknown error message");
+}
+}
+return _fb.TransactionID;
+}
+catch(e){
+throw e;
+}
+};
+function __sp_landmarks_category_delete_cb(_fc,_fd,_fe){
+var _ff;
+var _100;
+var _101;
+if(this.temporarySCb){
+category_cb=this.temporarySCb;
+_100=this.temporaryECb;
+this.temporarySCb=null;
+this.temporaryECb=null;
+}else{
+_101=glob_obj.getFromArray(_fc);
+if(_101){
+_ff=_101.success_cb;
+_100=_101.error_cb;
+}else{
+alert("Landmarks: __sp_landmarks_category_delete_cb: Callback not found ");
+return;
+}
+}
+if(_fd==4||_fe.ErrorCode){
+var _102=convertFromPS2JS(_fe.ErrorCode);
+var _103=new DeviceAPIError(_102,_fe.ErrorMessage);
+if(_100){
+_100(_103);
+}
+}else{
+_ff();
+}
+glob_obj.removeFromArray(_fc);
+};
+function __sp_landmarks_category_delete(_104,_105,_106){
+try{
+var _107=new DeviceAPIError(0,"dummy");
+var _108=true;
+if(_104===undefined){
+throw new DeviceAPIError(_107.MISSING_ARG_ERR,"SucessCallback is missing");
+}else{
+if(((_104===null)||(_104===""))&&(typeof (_104)!="number")){
+throw new DeviceAPIError(_107.MISSING_ARG_ERR,"SucessCallback is missing");
+}else{
+if(typeof (_104)!="function"){
+throw new DeviceAPIError(_107.INVALID_ARG_ERR,"invalid SucessCallback argument");
+}
+}
+}
+if(_105===undefined||_105===null){
+throw new DeviceAPIError(_107.MISSING_ARG_ERR,"categoryId is missing");
+}else{
+if(typeof (_105)!=="string"){
+throw new DeviceAPIError(_107.INVALID_ARG_ERR,"invalid categoryId argument");
+}
+}
+if((_106!=undefined)){
+if((!_106)&&(typeof (_106)!="number")){
+_108=false;
+}else{
+if((typeof (_106)!="function")){
+throw new DeviceAPIError(_107.INVALID_ARG_ERR,"invalid ErrorCallback callback");
+}
+}
+}else{
+_108=false;
+}
+var _109=new Object();
+modifyObjectBaseProp(_109);
+_109.Type="Category";
+_109.Data=new Object();
+modifyObjectBaseProp(_109.Data);
+_109.Data.id=_105;
+this.temporarySCb=_104;
+this.temporaryECb=_106;
+var rval=this.so.IDataSource.Delete(_109,this.deleteCategoryCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_104,_106);
+}
+if(rval.ErrorCode!=0){
+switch(rval.ErrorCode){
+case err_missing_argument:
+throw new DeviceAPIError(_107.MISSING_ARG_ERR,rval.ErrorMessage);
+break;
+case err_bad_argument:
+throw new DeviceAPIError(_107.INVALID_ARG_ERR,rval.ErrorMessage);
+break;
+case err_ServiceNotSupported:
+throw new DeviceAPIError(_107.NOT_SUPPORTED_ERR,rval.ErrorMessage);
+break;
+case err_InvalidService_Argument:
+throw new DeviceAPIError(_107.INVALID_ARG_ERR,rval.ErrorMessage);
+break;
+default:
+throw new DeviceAPIError(-101,"unknown error message");
+}
+}
+return rval.TransactionID;
+}
+catch(e){
+throw e;
+}
+};
+function __sp_landmarks_getList_cb(arg1,arg2,arg3){
 var iter=null;
-var _152=null;
-if(arg3.ErrorCode!=0){
-if(arg3.ErrorMessage){
-_152=splitErrorMessage(arg3.ErrorMessage);
-}else{
-_152="operation failed";
-}
-if(_150){
-setTimeout(function(){
-_150(new DeviceException(MapErrorCode[arg3.ErrorCode],"Commlog: getList: "+_152));
-},1000);
+var _10f;
+var _110;
+var _111;
+if(this.temporarySCb){
+category_cb=this.temporarySCb;
+_110=this.temporaryECb;
+this.temporarySCb=null;
+this.temporaryECb=null;
+}else{
+_111=glob_obj.getFromArray(arg1);
+if(_111){
+_10f=_111.success_cb;
+_110=_111.error_cb;
+}else{
+alert("Landmarks: __sp_landmarks_getList_cb: Callback not found ");
 return;
 }
+}
+if(arg3.ErrorCode||(arg2==4)){
+var _112=convertFromPS2JS(arg3.ErrorCode);
+var _113=new DeviceAPIError(_112,arg3.ErrorMessage);
+if(_110){
+_110(_113);
+}
 }else{
 if(arg3.ReturnValue){
-iter=new __sp_commlog_iterator(arg3.ReturnValue);
-}
-}
-if(arg2!=event_cancelled){
-_14f(iter);
-}
-};
-var _153=this.so.IDataSource.GetList(_148,_14b);
-if(_148.Filter){
-delete _148.Filter.Direction;
-delete _148.Filter.EventType;
-delete _148.Filter.PhoneNumber;
-}
-if(_148){
-delete _148.Filter;
-delete _148.Type;
-}
-if(_153.ErrorCode!=0){
-var _154="operation failed";
-if(_153.ErrorMessage){
-_154=splitErrorMessage(_153.ErrorMessage);
-}
-switch(MapErrorCode[_153.ErrorCode]){
-case error.INVALID_ARG_ERR:
-case error.MISSING_ARG_ERR:
-case error.NOT_SUPPORTED_ERR:
-throw new DeviceException(MapErrorCode[_153.ErrorCode],"CommLog:getList:"+_154);
+iter=new __sp_landmarks_iterator(arg3.ReturnValue);
+}
+_10f(iter);
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_landmarks_getList(_114,_115,_116){
+try{
+var _117=new DeviceAPIError(0,"dummy");
+var _118=false;
+var _119=false;
+var _11a=false;
+if((_114===undefined)||(_114===null)||(_114==="")){
+throw new DeviceAPIError(_117.MISSING_ARG_ERR,"SucessCallback is missing");
+}
+if(typeof (_114)!="function"){
+throw new DeviceAPIError(_117.INVALID_ARG_ERR,"invalid SucessCallback argument");
+}
+if((_116!==undefined)&&(_116!=="")&&(_116!==null)){
+if((typeof (_116)!="function")){
+throw new DeviceAPIError(_117.INVALID_ARG_ERR,"invalid error callback");
+}else{
+_118=true;
+}
+}
+var _11b=new Object();
+modifyObjectBaseProp(_11b);
+_11b.Type="Landmark";
+_11b.Filter=new Object();
+if((_115===undefined)||(_115===null)||(_115==="")){
+_11b.Filter.dummy="dummy";
+}else{
+if(typeof (_115)=="string"){
+_11b.Filter.LandmarkName=_115;
+}else{
+if(typeof (_115)!="object"){
+throw new DeviceAPIError(_117.INVALID_ARG_ERR,"invalid match criteria");
+}else{
+if((_115.name!==undefined)&&(_115.name!==null)&&(_115.name!=="")){
+_11b.Filter.LandmarkName=_115.name;
+}
+if((_115.description!==undefined)&&(_115.description!==null)&&(_115.description!=="")){
+_11b.Filter.LandmarkDesc=_115.description;
+}
+if((_115.categoryId!==undefined)&&(_115.categoryId!==null)&&(_115.categoryId!=="")){
+_11b.Filter.categoryId=_115.categoryId;
+}
+if((_115.position!==undefined)&&(_115.position!==null)&&(_115.position!=="")){
+if(typeof (_115.position)!="object"){
+throw new DeviceAPIError(_117.INVALID_ARG_ERR,"position must be an object");
+}else{
+_11b.Filter.LandmarkPosition=new __sp_landmark_position_obj(_115.position);
+}
+}
+if((_115.coverageRadiusUsed!==undefined)&&(_115.coverageRadiusUsed!==null)&&(_115.coverageRadiusUsed!=="")){
+if(typeof (_115.coverageRadiusUsed)!="number"){
+throw new DeviceAPIError(_117.INVALID_ARG_ERR,"coverageRadiusUsed should be number");
+}else{
+_11b.Filter.CoverageRadiusOption=_115.coverageRadiusUsed;
+}
+}
+if((_115.searchRadius!==undefined)&&(_115.searchRadius!==null)&&(_115.searchRadius!=="")){
+if(typeof (_115.searchRadius)!="number"){
+throw new DeviceAPIError(_117.INVALID_ARG_ERR,"searchRadius should be number");
+}else{
+_11b.Filter.MaximumDistance=_115.searchRadius;
+}
+}
+if((_115.area!==undefined)&&(_115.area!==null)&&(_115.area!=="")){
+if(typeof (_115.area)!="object"){
+throw new DeviceAPIError(_117.INVALID_ARG_ERR,"area must be an object");
+}else{
+_11b.Filter.BoundedArea=new __sp_landmark_bounded_area_obj(_115.area);
+}
+}
+}
+}
+}
+this.temporarySCb=_114;
+this.temporaryECb=_116;
+var rval=this.so.IDataSource.GetList(_11b,this.getLandmarksCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_114,_116);
+}
+if(rval.ErrorCode!=0){
+switch(rval.ErrorCode){
+case 1003:
+throw new DeviceAPIError(_117.MISSING_ARG_ERR,rval.ErrorMessage);
+break;
+case 1002:
+throw new DeviceAPIError(_117.INVALID_ARG_ERR,rval.ErrorMessage);
+break;
+case 1004:
+throw new DeviceAPIError(_117.NOT_SUPPORTED_ERR,rval.ErrorMessage);
+break;
+case 1000:
+throw new DeviceAPIError(_117.INVALID_ARG_ERR,rval.ErrorMessage);
 break;
 default:
-if(_147){
-_147(new DeviceException(MapErrorCode[_153.ErrorCode],"CommLog:getList:"+_154));
-return;
-}else{
-throw new DeviceException(MapErrorCode[_153.ErrorCode],"CommLog:getList:"+_154);
-}
-}
-}
-return _153.TransactionID;
+throw new DeviceAPIError(-101,"unknown error message");
+}
+}
+return rval.TransactionID;
 }
 catch(e){
-__device_handle_exception(e,"__sp_commlog_Input_validation: "+e);
-}
-};
-function __sp_commlog_setNotification(_155,_156){
-if(!_155){
-throw new DeviceException(error.MISSING_ARG_ERR,"CommLog:setNotification:callback is missing");
-}
-if(typeof _155!="function"){
-throw new DeviceException(error.INVALID_ARG_ERR,"CommLog:setNotification:callback is invalid");
-}
-if(_156){
-if(typeof (_156)!="function"){
-throw new DeviceException(error.INVALID_ARG_ERR,"CommLog: setNotification: ErrorCallback is invalid");
-}
-}
-invoker_notification=function(arg1,arg2,arg3){
-var _15a=_155;
-var _15b=_156;
-var _15c=null;
-if(arg3.ErrorCode!=0){
-if(arg3.ErrorMessage){
-_15d=splitErrorMessage(arg3.ErrorMessage);
-}else{
-_15d="operation failed";
-}
-if(_15b){
-_15b(new DeviceException(MapErrorCode[arg3.ErrorCode],"CommLog: getList: "+_15d));
+throw e;
+}
+};
+function __sp_landmarks_import_cb(arg1,arg2,arg3){
+var iter=null;
+var _121;
+var _122;
+var _123;
+if(this.temporarySCb){
+category_cb=this.temporarySCb;
+_122=this.temporaryECb;
+this.temporarySCb=null;
+this.temporaryECb=null;
+}else{
+_123=glob_obj.getFromArray(arg1);
+if(_123){
+_121=_123.success_cb;
+_122=_123.error_cb;
+}else{
+alert("Landmarks: __sp_landmarks_import_cb: Callback not found ");
 return;
 }
+}
+if(arg2==4||arg3.ErrorCode){
+var _124=convertFromPS2JS(arg3.ErrorCode);
+var _125=new DeviceAPIError(_124,arg3.ErrorMessage);
+if(_122){
+_122(_125);
+}
 }else{
 if(arg3.ReturnValue){
-_15c=new __device_commlog_item(arg3.ReturnValue);
-}
-}
-if(arg2!=event_cancelled){
-for(i in __notifArr){
-if(arg1==__notifArr[i].connectionId){
-var _15e=__notifArr[i];
-break;
-}
-}
-if(_15e){
-_15e.callback(_15c);
-}
-}
-};
-for(i in __notifArr){
-var _15f=__notifArr[i];
-__notifArr.splice(i,1);
-__notifCount=__notifArr.length;
-this.so.IDataSource.Cancel({TransactionID:_15f.connectionId});
-break;
-}
-var _160={};
-modifyObjectBaseProp(_160);
-_160.Type="Log";
-_160.Filter={DelayTime:0};
-var _161=this.so.IDataSource.RequestNotification(_160,invoker_notification);
-__notifArr[__notifCount++]=new __Notification(_161.TransactionID,_155);
-if(_160){
-delete _160.Type;
-}
-if(_161.ErrorCode!=0){
-var _15d="operation failed";
-if(_161.ErrorMessage){
-_15d=splitErrorMessage(_161.ErrorMessage);
-}
-switch(MapErrorCode[_161.ErrorCode]){
-case error.INVALID_ARG_ERR:
-case error.MISSING_ARG_ERR:
-case error.NOT_SUPPORTED_ERR:
-throw new DeviceException(MapErrorCode[_161.ErrorCode],"CommLog:setNotification:"+_15d);
+iter=new __sp_landmarks_iterator(arg3.ReturnValue);
+}
+_121(iter);
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_landmarks_import(_126,_127,_128,_129){
+try{
+var _12a=new DeviceAPIError(0,"dummy");
+var _12b=true;
+if(_126===undefined){
+throw new DeviceAPIError(_12a.MISSING_ARG_ERR,"LandmarksItrCallback is missing");
+}else{
+if(((_126===null)||(_126===""))&&(typeof (_126)!="number")){
+throw new DeviceAPIError(_12a.MISSING_ARG_ERR,"LandmarksItrCallback is missing");
+}else{
+if(typeof (_126)!="function"){
+throw new DeviceAPIError(_12a.INVALID_ARG_ERR,"invalid LandmarksItrCallback argument");
+}
+}
+}
+if(_127===undefined||_127===null){
+throw new DeviceAPIError(_12a.MISSING_ARG_ERR,"sourceFileUri is missing");
+}else{
+if(typeof (_127)!=="string"){
+throw new DeviceAPIError(_12a.INVALID_ARG_ERR,"invalid sourceFileUri argument");
+}
+}
+if(_128===undefined||_128===null){
+throw new DeviceAPIError(_12a.MISSING_ARG_ERR,"mimetype is missing");
+}else{
+if(typeof (_128)!=="string"){
+throw new DeviceAPIError(_12a.INVALID_ARG_ERR,"invalid mimetype argument");
+}
+}
+if((_129!=undefined)){
+if((!_129)&&(typeof (_129)!="number")){
+_12b=false;
+}else{
+if((typeof (_129)!="function")){
+throw new DeviceAPIError(_12a.INVALID_ARG_ERR,"invalid ErrorCallback callback");
+}
+}
+}else{
+_12b=false;
+}
+var _12c=new Object();
+modifyObjectBaseProp(_12c);
+_12c.Type="Landmark";
+_12c.Data=new Object();
+modifyObjectBaseProp(_12c.Data);
+if(_127.slice(0,7)=="file://"){
+_127=_127.slice(7);
+}else{
+if(_127.slice(0,8)=="file:///"){
+_127=_127.slice(8);
+}else{
+throw new DeviceAPIError(_12a.INVALID_ARG_ERR,"sourceFileUri is not in URI format");
+}
+}
+while(_127.search("/")!=-1){
+_127=_127.replace("/","\\");
+}
+_12c.Data.SourceFile=_127;
+_12c.Data.MimeType=_128;
+this.temporarySCb=_126;
+this.temporaryECb=_129;
+var rval=this.so.IDataSource.Import(_12c,this.importLandmarksCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_126,_129);
+}
+if(rval.ErrorCode!=0){
+switch(rval.ErrorCode){
+case err_missing_argument:
+throw new DeviceAPIError(_12a.MISSING_ARG_ERR,rval.ErrorMessage);
+break;
+case err_bad_argument:
+throw new DeviceAPIError(_12a.INVALID_ARG_ERR,rval.ErrorMessage);
+break;
+case err_ServiceNotSupported:
+throw new DeviceAPIError(_12a.NOT_SUPPORTED_ERR,rval.ErrorMessage);
+break;
+case err_InvalidService_Argument:
+throw new DeviceAPIError(_12a.INVALID_ARG_ERR,rval.ErrorMessage);
 break;
 default:
-if(_156){
-setTimeout(function(){
-_156(new DeviceException(MapErrorCode[_161.ErrorCode],"CommLog:setNotification:"+_15d));
-},1000);
-}else{
-throw new DeviceException(MapErrorCode[_161.ErrorCode],"CommLog:setNotification:"+_15d);
-}
-}
-}
-};
-function __sp_commlog_cancelNotification(){
-for(i in __notifArr){
-if(__notifArr[i].connectionId){
-var _162=__notifArr[i];
-__notifArr.splice(i,1);
-__notifCount=__notifArr.length;
-break;
-}
-}
-if(_162){
-var _163=this.so.IDataSource.Cancel({TransactionID:_162.connectionId});
-if(_163.ErrorCode!=0){
-var _164="operation failed";
-if(_163.ErrorMessage){
-_164=splitErrorMessage(_163.ErrorMessage);
-}
-}
-}
-};
-function __sp_commlog_cancel(_165){
-if(!_165){
-throw new DeviceException(error.MISSING_ARG_ERR,"CommLog:cancel:transactionId is missing");
-}
-if(typeof _165!="number"){
-throw new DeviceException(error.INVALID_ARG_ERR,"CommLog:cancel:transactionId is invalid");
-}
-var _166=this.so.IDataSource.Cancel({TransactionID:_165});
-if(_166.ErrorCode!=0){
-var _167="operation failed";
-if(_166.ErrorMessage){
-_167=splitErrorMessage(_166.ErrorMessage);
-}
-throw new DeviceException(MapErrorCode[_166.ErrorCode],"CommLog:cancel:"+_167);
-}
-};
-function __sp_commlog_deleteLogEntry(_168){
-if(_168==null||_168==undefined){
-throw new DeviceException(error.MISSING_ARG_ERR,"CommLog:deleteLogEntry:logId is missing");
-}
-if(typeof _168!="number"){
-throw new DeviceException(error.INVALID_ARG_ERR,"CommLog:deleteLogEntry:logId is invalid");
-}
-var _169={};
-modifyObjectBaseProp(_169);
-_169.Type="Log";
-_169.Data={id:_168.toString()};
-modifyObjectBaseProp(_169.Data);
-var _16a=this.so.IDataSource.Delete(_169);
-if(_16a.ErrorCode!=0){
-var _16b="operation failed";
-if(_16a.ErrorMessage){
-_16b=splitErrorMessage(_16a.ErrorMessage);
-}
-throw new DeviceException(MapErrorCode[_16a.ErrorCode],"CommLog:deleteLogEntry:"+_16b);
-}
-};
-function __sp_commlog_instance(){
-this.descriptor=new __sp_commlog_descriptor();
-this.getList=__sp_commlog_getList;
-this.setNotification=__sp_commlog_setNotification;
-this.cancelNotification=__sp_commlog_cancelNotification;
-this.cancel=__sp_commlog_cancel;
-this.deleteLogEntry=__sp_commlog_deleteLogEntry;
+throw new DeviceAPIError(-101,"unknown error message");
+}
+}
+return rval.TransactionID;
+}
+catch(e){
+throw e;
+}
+};
+function __sp_landmarks_export_cb(arg1,arg2,arg3){
+var _131;
+var _132;
+var _133;
+if(this.temporarySCb){
+category_cb=this.temporarySCb;
+_132=this.temporaryECb;
+this.temporarySCb=null;
+this.temporaryECb=null;
+}else{
+_133=glob_obj.getFromArray(arg1);
+if(_133){
+_131=_133.success_cb;
+_132=_133.error_cb;
+}else{
+alert("Landmarks: __sp_landmarks_export_cb: Callback not found ");
+return;
+}
+}
+if(arg2==4||arg3.ErrorCode){
+var _134=convertFromPS2JS(arg3.ErrorCode);
+var _135=new DeviceAPIError(_134,arg3.ErrorMessage);
+if(_132){
+_132(_135);
+}
+}else{
+_131();
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_landmarks_export(_136,_137,_138,_139,_13a){
 try{
-this.so=device.getServiceObject("Service.Logging","IDataSource");
+var _13b=new DeviceAPIError(0,"dummy");
+var _13c=true;
+if(_136===undefined){
+throw new DeviceAPIError(_13b.MISSING_ARG_ERR,"SuccessCallback is missing");
+}else{
+if(((_136===null)||(_136===""))&&(typeof (_136)!="number")){
+throw new DeviceAPIError(_13b.MISSING_ARG_ERR,"SuccessCallback is missing");
+}else{
+if(typeof (_136)!="function"){
+throw new DeviceAPIError(_13b.INVALID_ARG_ERR,"invalid SuccessCallback argument");
+}
+}
+}
+if(_137===undefined||_137===null){
+throw new DeviceAPIError(_13b.MISSING_ARG_ERR,"landmarkIdList is missing");
+}else{
+if(typeof (_137)!=="object"){
+throw new DeviceAPIError(_13b.INVALID_ARG_ERR,"invalid landmarkIdList argument");
+}
+}
+if(_138===undefined||_138===null){
+throw new DeviceAPIError(_13b.MISSING_ARG_ERR,"destFileUri is missing");
+}else{
+if(typeof (_138)!=="string"){
+throw new DeviceAPIError(_13b.INVALID_ARG_ERR,"invalid destFileUri argument");
+}
+}
+if(_139===undefined||_139===null){
+throw new DeviceAPIError(_13b.MISSING_ARG_ERR,"mimetype is missing");
+}else{
+if(typeof (_139)!=="string"){
+throw new DeviceAPIError(_13b.INVALID_ARG_ERR,"invalid mimetype argument");
+}
+}
+if((_13a!=undefined)){
+if((!_13a)&&(typeof (_13a)!="number")){
+_13c=false;
+}else{
+if((typeof (_13a)!="function")){
+throw new DeviceAPIError(_13b.INVALID_ARG_ERR,"invalid ErrorCallback callback");
+}
+}
+}else{
+_13c=false;
+}
+var _13d=new Object();
+modifyObjectBaseProp(_13d);
+_13d.Type="Landmark";
+_13d.Data=new Object();
+modifyObjectBaseProp(_13d.Data);
+if(_138.slice(0,7)=="file://"){
+_138=_138.slice(7);
+}else{
+if(_138.slice(0,8)=="file:///"){
+_138=_138.slice(8);
+}else{
+throw new DeviceAPIError(_13b.INVALID_ARG_ERR,"destFileUri is not in URI format");
+}
+}
+while(_138.search("/")!=-1){
+_138=_138.replace("/","\\");
+}
+_13d.Data.DestinationFile=_138;
+_13d.Data.IdList=_137;
+_13d.Data.MimeType=_139;
+this.temporarySCb=_136;
+this.temporaryECb=_13a;
+var rval=this.so.IDataSource.Export(_13d,this.exportLandmarksCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_136,_13a);
+}
+if(rval.ErrorCode!=0){
+switch(rval.ErrorCode){
+case err_missing_argument:
+throw new DeviceAPIError(_13b.MISSING_ARG_ERR,rval.ErrorMessage);
+break;
+case err_bad_argument:
+throw new DeviceAPIError(_13b.INVALID_ARG_ERR,rval.ErrorMessage);
+break;
+case err_ServiceNotSupported:
+throw new DeviceAPIError(_13b.NOT_SUPPORTED_ERR,rval.ErrorMessage);
+break;
+case err_InvalidService_Argument:
+throw new DeviceAPIError(_13b.INVALID_ARG_ERR,rval.ErrorMessage);
+break;
+default:
+throw new DeviceAPIError(-101,"unknown error message");
+}
+}
+return rval.TransactionID;
 }
 catch(e){
-this.so=null;
-__device_handle_exception(e,"commlog service not available");
-}
-};
-nokia.device.contacts.SORT_ASCENDING=0;
-nokia.device.contacts.SORT_DESCENDING=1;
-var SORT_ASCENDING=0;
-var SORT_DESCENDING=1;
-function __sp_contacts_descriptor(){
-this.interfaceName="contacts";
-if(window.__Service_Interface_Ver){
-this.version=__Service_Interface_Ver;
-}else{
-this.version=1;
-}
-};
-function __s60_enumerate_contact_object(_16c,_16d,func,_16f){
+throw e;
+}
+};
+function __sp_landmarks_organize_cb(arg1,arg2,arg3){
+var _142;
+var _143;
+if(this.temporarySCb){
+category_cb=this.temporarySCb;
+_143=this.temporaryECb;
+this.temporarySCb=null;
+this.temporaryECb=null;
+}else{
+CbObj=glob_obj.getFromArray(arg1);
+if(CbObj){
+_142=CbObj.success_cb;
+_143=CbObj.error_cb;
+}else{
+alert("Landmarks: __sp_landmarks_organize_cb: Callback not found ");
+return;
+}
+}
+if(arg2==4||arg3.ErrorCode){
+var _144=convertFromPS2JS(arg3.ErrorCode);
+var _145=new DeviceAPIError(_144,arg3.ErrorMessage);
+if(_143){
+_143(_145);
+}
+}else{
+_142();
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_landmarks_organize(_146,_147,_148,_149,_14a){
 try{
-var key;
-for(key in _16c){
-var _171;
-if(_16d){
-_171=_16d+"."+key;
-}else{
-_171=key;
-}
-var _172=_16c[key];
-if(_172 instanceof Array){
-func(_171,_172,_16f);
-}else{
-if(_172 instanceof Date){
-func(_171,_172,_16f);
-}else{
-if(typeof _172=="object"){
-__s60_enumerate_contact_object(_172,_171,func,_16f);
-}else{
-func(_171,_172,_16f);
-}
-}
+var _14b=new DeviceAPIError(0,"dummy");
+var _14c=true;
+if(_146===undefined){
+throw new DeviceAPIError(_14b.MISSING_ARG_ERR,"SuccessCallback is missing");
+}else{
+if(((_146===null)||(_146===""))&&(typeof (_146)!="number")){
+throw new DeviceAPIError(_14b.MISSING_ARG_ERR,"SuccessCallback is missing");
+}else{
+if(typeof (_146)!="function"){
+throw new DeviceAPIError(_14b.INVALID_ARG_ERR,"invalid SuccessCallback argument");
+}
+}
+}
+if(_147===undefined||_147===null){
+throw new DeviceAPIError(_14b.MISSING_ARG_ERR,"landmarkIdList is missing");
+}else{
+if(typeof (_147)!=="object"){
+throw new DeviceAPIError(_14b.INVALID_ARG_ERR,"invalid LandmarkItem argument");
+}
+}
+if(_148===undefined||_148===null){
+throw new DeviceAPIError(_14b.MISSING_ARG_ERR,"categoryId is missing");
+}else{
+if(typeof (_148)!=="string"){
+throw new DeviceAPIError(_14b.INVALID_ARG_ERR,"invalid categoryId argument");
+}
+}
+if(_149===undefined||_149===null){
+_149=true;
+}else{
+if(typeof (_149)!=="boolean"){
+throw new DeviceAPIError(_14b.INVALID_ARG_ERR,"invalid associate argument");
+}
+}
+if((_14a!=undefined)){
+if((!_14a)&&(typeof (_14a)!="number")){
+_14c=false;
+}else{
+if((typeof (_14a)!="function")){
+throw new DeviceAPIError(_14b.INVALID_ARG_ERR,"invalid ErrorCallback callback");
+}
+}
+}else{
+_14c=false;
+}
+var _14d=new Object();
+modifyObjectBaseProp(_14d);
+_14d.Type="Landmark";
+_14d.Data=new Object();
+modifyObjectBaseProp(_14d.Data);
+_14d.Data.id=_148;
+_14d.Data.IdList=_147;
+if(_149){
+_14d.OperationType="Associate";
+}else{
+_14d.OperationType="Disassociate";
+}
+this.temporarySCb=_146;
+this.temporaryECb=_14a;
+var rval=this.so.IDataSource.Organise(_14d,this.organizeLandmarksCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_146,_14a);
+}
+if(rval.ErrorCode!=0){
+switch(rval.ErrorCode){
+case err_missing_argument:
+throw new DeviceAPIError(_14b.MISSING_ARG_ERR,rval.ErrorMessage);
+break;
+case err_bad_argument:
+throw new DeviceAPIError(_14b.INVALID_ARG_ERR,rval.ErrorMessage);
+break;
+case err_ServiceNotSupported:
+throw new DeviceAPIError(_14b.NOT_SUPPORTED_ERR,rval.ErrorMessage);
+break;
+case err_InvalidService_Argument:
+throw new DeviceAPIError(_14b.INVALID_ARG_ERR,rval.ErrorMessage);
+break;
+default:
+throw new DeviceAPIError(-101,"unknown error message");
+}
+}
+return rval.TransactionID;
+}
+catch(e){
+throw e;
+}
+};
+function __sp_landmarks_cancel(_14f){
+try{
+var _150=new DeviceAPIError(0,"dummy");
+if((_14f===undefined)||(_14f===null)||(_14f==="")){
+throw new DeviceAPIError(_150.MISSING_ARG_ERR,"transactionId is missing");
+}
+if(typeof (_14f)!="number"){
+throw new DeviceAPIError(_150.INVALID_ARG_ERR,"invalid transactionId argument");
+}
+if(_14f<0){
+throw new DeviceAPIError(_150.DATA_NOT_FOUND_ERR,"non-existent transactionId");
+}
+var _151=new Object();
+modifyObjectBaseProp(_151);
+_151.TransactionID=_14f;
+var rval=this.so.IDataSource.Cancel(_151);
+if(rval.ErrorCode!=0){
+switch(rval.ErrorCode){
+case err_missing_argument:
+throw new DeviceAPIError(_150.MISSING_ARG_ERR,rval.ErrorMessage);
+break;
+case err_bad_argument:
+throw new DeviceAPIError(_150.INVALID_ARG_ERR,rval.ErrorMessage);
+break;
+case err_ServiceNotSupported:
+throw new DeviceAPIError(_150.NOT_SUPPORTED_ERR,rval.ErrorMessage);
+break;
+case err_InvalidService_Argument:
+throw new DeviceAPIError(_150.INVALID_ARG_ERR,rval.ErrorMessage);
+break;
+default:
+throw new DeviceAPIError(-101,"unknown error message");
 }
 }
 }
@@ -2368,1957 +2291,78 @@
 throw e;
 }
 };
-function __sp_contact_extract(name,_174,_175){
-switch(name){
-case "name.last":
-_175.LastName={};
-modifyObjectBaseProp(_175.LastName);
-_175.LastName.Label="Last name";
-_175.LastName.Value=_174;
-break;
-case "name.first":
-_175.FirstName={};
-modifyObjectBaseProp(_175.FirstName);
-_175.FirstName.Label="First name";
-_175.FirstName.Value=_174;
-break;
-case "name.middle":
-_175.MiddleName={};
-modifyObjectBaseProp(_175.MiddleName);
-_175.MiddleName.Label="Middle name";
-_175.MiddleName.Value=_174;
-break;
-case "name.prefix":
-_175.Prefix={};
-modifyObjectBaseProp(_175.Prefix);
-_175.Prefix.Label="Prefix";
-_175.Prefix.Value=_174;
-break;
-case "name.suffix":
-_175.Suffix={};
-modifyObjectBaseProp(_175.Suffix);
-_175.Suffix.Label="Suffix";
-_175.Suffix.Value=_174;
-break;
-case "tel.land":
-_175.LandPhoneGen={};
-modifyObjectBaseProp(_175.LandPhoneGen);
-_175.LandPhoneGen.Label="Landline";
-_175.LandPhoneGen.Value=_174;
-break;
-case "tel.mobile":
-_175.MobilePhoneGen={};
-modifyObjectBaseProp(_175.MobilePhoneGen);
-_175.MobilePhoneGen.Label="Mobile";
-_175.MobilePhoneGen.Value=_174;
-break;
-case "tel.video":
-_175.VideoNumberGen={};
-modifyObjectBaseProp(_175.VideoNumberGen);
-_175.VideoNumberGen.Label="Video";
-_175.VideoNumberGen.Value=_174;
-break;
-case "tel.fax":
-_175.FaxNumberGen={};
-modifyObjectBaseProp(_175.FaxNumberGen);
-_175.FaxNumberGen.Label="Fax";
-_175.FaxNumberGen.Value=_174;
-break;
-case "tel.voip":
-_175.VOIPGen={};
-modifyObjectBaseProp(_175.VOIPGen);
-_175.VOIPGen.Label="Voip";
-_175.VOIPGen.Value=_174;
-break;
-case "tel.home.land":
-_175.LandPhoneHome={};
-modifyObjectBaseProp(_175.LandPhoneHome);
-_175.LandPhoneHome.Label="Home Landline";
-_175.LandPhoneHome.Value=_174;
-break;
-case "tel.home.mobile":
-_175.MobilePhoneHome={};
-modifyObjectBaseProp(_175.MobilePhoneHome);
-_175.MobilePhoneHome.Label="Home Mobile";
-_175.MobilePhoneHome.Value=_174;
-break;
-case "tel.home.video":
-_175.VideoNumberHome={};
-modifyObjectBaseProp(_175.VideoNumberHome);
-_175.VideoNumberHome.Label="Home Video";
-_175.VideoNumberHome.Value=_174;
-break;
-case "tel.home.fax":
-_175.FaxNumberHome={};
-modifyObjectBaseProp(_175.FaxNumberHome);
-_175.FaxNumberHome.Label="Home Fax";
-_175.FaxNumberHome.Value=_174;
-break;
-case "tel.home.voip":
-_175.VOIPHome={};
-modifyObjectBaseProp(_175.VOIPHome);
-_175.VOIPHome.Label="Home Voip";
-_175.VOIPHome.Value=_174;
-break;
-case "tel.work.land":
-_175.LandPhoneWork={};
-modifyObjectBaseProp(_175.LandPhoneWork);
-_175.LandPhoneWork.Label="Work Landline";
-_175.LandPhoneWork.Value=_174;
-break;
-case "tel.work.mobile":
-_175.MobilePhoneWork={};
-modifyObjectBaseProp(_175.MobilePhoneWork);
-_175.MobilePhoneWork.Label="Work Mobile";
-_175.MobilePhoneWork.Value=_174;
-break;
-case "tel.work.video":
-_175.VideoNumberWork={};
-modifyObjectBaseProp(_175.VideoNumberWork);
-_175.VideoNumberWork.Label="Work Video";
-_175.VideoNumberWork.Value=_174;
-break;
-case "tel.work.fax":
-_175.FaxNumberWork={};
-modifyObjectBaseProp(_175.FaxNumberWork);
-_175.FaxNumberWork.Label="Work Fax";
-_175.FaxNumberWork.Value=_174;
-break;
-case "tel.work.voip":
-_175.VOIPWork={};
-modifyObjectBaseProp(_175.VOIPWork);
-_175.VOIPWork.Label="Work Voip";
-_175.VOIPWork.Value=_174;
-break;
-case "address.street":
-_175.AddrStreetGen={};
-modifyObjectBaseProp(_175.AddrStreetGen);
-_175.AddrStreetGen.Label="Street Address";
-_175.AddrStreetGen.Value=_174;
-break;
-case "address.local":
-_175.AddrLocalGen={};
-modifyObjectBaseProp(_175.AddrLocalGen);
-_175.AddrLocalGen.Label="City";
-_175.AddrLocalGen.Value=_174;
-break;
-case "address.region":
-_175.AddrRegionGen={};
-modifyObjectBaseProp(_175.AddrRegionGen);
-_175.AddrRegionGen.Label="State/Province";
-_175.AddrRegionGen.Value=_174;
-break;
-case "address.code":
-_175.AddrPostCodeGen={};
-modifyObjectBaseProp(_175.AddrPostCodeGen);
-_175.AddrPostCodeGen.Label="Postal code";
-_175.AddrPostCodeGen.Value=_174;
-break;
-case "address.country":
-_175.AddrCountryGen={};
-modifyObjectBaseProp(_175.AddrCountryGen);
-_175.AddrCountryGen.Label="Country";
-_175.AddrCountryGen.Value=_174;
-break;
-case "address.email":
-_175.EmailGen={};
-modifyObjectBaseProp(_175.EmailGen);
-_175.EmailGen.Label="EMail";
-_175.EmailGen.Value=_174;
-break;
-case "address.uri":
-_175.URLGen={};
-modifyObjectBaseProp(_175.URLGen);
-_175.URLGen.Label="Website";
-_175.URLGen.Value=_174;
-break;
-case "address.home.street":
-_175.AddrStreetHome={};
-modifyObjectBaseProp(_175.AddrStreetHome);
-_175.AddrStreetHome.Label="Home Address";
-_175.AddrStreetHome.Value=_174;
-break;
-case "address.home.local":
-_175.AddrLocalHome={};
-modifyObjectBaseProp(_175.AddrLocalHome);
-_175.AddrLocalHome.Label="City";
-_175.AddrLocalHome.Value=_174;
-break;
-case "address.home.region":
-_175.AddrRegionHome={};
-modifyObjectBaseProp(_175.AddrRegionHome);
-_175.AddrRegionHome.Label="State/Province";
-_175.AddrRegionHome.Value=_174;
-break;
-case "address.home.code":
-_175.AddrPostCodeHome={};
-modifyObjectBaseProp(_175.AddrPostCodeHome);
-_175.AddrPostCodeHome.Label="Postal code";
-_175.AddrPostCodeHome.Value=_174;
-break;
-case "address.home.country":
-_175.AddrCountryHome={};
-modifyObjectBaseProp(_175.AddrCountryHome);
-_175.AddrCountryHome.Label="Country";
-_175.AddrCountryHome.Value=_174;
-break;
-case "address.home.email":
-_175.EmailHome={};
-modifyObjectBaseProp(_175.EmailHome);
-_175.EmailHome.Label="Home EMail";
-_175.EmailHome.Value=_174;
-break;
-case "address.home.uri":
-_175.URLHome={};
-modifyObjectBaseProp(_175.URLHome);
-_175.URLHome.Label="Home Website";
-_175.URLHome.Value=_174;
-break;
-case "address.work.street":
-_175.AddrStreetWork={};
-modifyObjectBaseProp(_175.AddrStreetWork);
-_175.AddrStreetWork.Label="Work Address";
-_175.AddrStreetWork.Value=_174;
-break;
-case "address.work.local":
-_175.AddrLocalWork={};
-modifyObjectBaseProp(_175.AddrLocalWork);
-_175.AddrLocalWork.Label="City";
-_175.AddrLocalWork.Value=_174;
-break;
-case "address.work.region":
-_175.AddrRegionWork={};
-modifyObjectBaseProp(_175.AddrRegionWork);
-_175.AddrRegionWork.Label="State/Province";
-_175.AddrRegionWork.Value=_174;
-break;
-case "address.work.code":
-_175.AddrPostCodeWork={};
-modifyObjectBaseProp(_175.AddrPostCodeWork);
-_175.AddrPostCodeWork.Label="Postal code";
-_175.AddrPostCodeWork.Value=_174;
-break;
-case "address.work.country":
-_175.AddrCountryWork={};
-modifyObjectBaseProp(_175.AddrCountryWork);
-_175.AddrCountryWork.Label="Country";
-_175.AddrCountryWork.Value=_174;
-break;
-case "address.work.email":
-_175.EmailWork={};
-modifyObjectBaseProp(_175.EmailWork);
-_175.EmailWork.Label="Work EMail";
-_175.EmailWork.Value=_174;
-break;
-case "address.work.uri":
-_175.URLWork={};
-modifyObjectBaseProp(_175.URLWork);
-_175.URLWork.Label="Work Website";
-_175.URLWork.Value=_174;
-break;
-case "company.name":
-_175.CompanyName={};
-modifyObjectBaseProp(_175.CompanyName);
-_175.CompanyName.Label="Company";
-_175.CompanyName.Value=_174;
-break;
-case "company.title":
-_175.JobTitle={};
-modifyObjectBaseProp(_175.JobTitle);
-_175.JobTitle.Label="Title";
-_175.JobTitle.Value=_174;
-break;
-case "id":
-_175.id=_174;
-break;
-case "notes":
-_175.Note={};
-modifyObjectBaseProp(_175.Note);
-_175.Note.Label="Note";
-_175.Note.Value=_174;
-break;
-case "anniversary":
-_175.Anniversary={};
-modifyObjectBaseProp(_175.Anniversary);
-_175.Anniversary.Label="Anniversary";
-_175.Anniversary.Value=_174;
-break;
-case "birthday":
-_175.Date={};
-modifyObjectBaseProp(_175.Date);
-_175.Date.Label="BirthDay";
-_175.Date.Value=_174;
-break;
-case "nickName":
-_175.SecondName={};
-modifyObjectBaseProp(_175.SecondName);
-_175.SecondName.Label="NickName";
-_175.SecondName.Value=_174;
-break;
-case "photo":
-_175.CallerObjImg={};
-modifyObjectBaseProp(_175.CallerObjImg);
-_175.CallerObjImg.Label="CallerObjImg";
-_175.CallerObjImg.Value=_174;
-break;
-case "xspid":
-_175.IMPP={};
-modifyObjectBaseProp(_175.IMPP);
-_175.IMPP.Label="IMPP";
-_175.IMPP.Value=_174;
-break;
-}
-};
-function __s60_enumerate_build_contact_object(_176,_177,func,_179){
-var key;
-for(key in _176){
-var _17b;
-if(_177){
-_17b=_177+"."+key;
-}else{
-_17b=key;
-}
-var _17c=_176[key];
-if(_17b=="IMPP"){
-func(_17b,_17c,_179);
-}
-if(typeof _17c=="object"){
-__s60_enumerate_build_contact_object(_17c,_17b,func,_179);
-}else{
-func(_17b,_17c,_179);
-}
-}
-};
-function __sp_device_contact_extract(name,_17e,_17f){
-if(name=="id"){
-_17f.id=_17e;
-return;
-}
-if(!name.match(".Value")){
-return;
-}
-try{
-if(name.match("IMPP.Value.0")){
-_17f.xspid=[];
-}
-if(name.match("Name")){
-if(name.match("CompanyName")){
-if(!_17f.company){
-_17f.company={};
-}
-}else{
-if(!_17f.name){
-_17f.name={};
-}
-}
-}else{
-if(name.match("Phone")||name.match("Number")||name.match("VOIP")||name.match("Voip")){
-if(!_17f.tel){
-_17f.tel={};
-}
-if(name.match("Home")){
-if(!_17f.tel.home){
-_17f.tel.home={};
-}
-}else{
-if(name.match("Work")){
-if(!_17f.tel.work){
-_17f.tel.work={};
-}
-}
-}
-}else{
-if(name.match("Addr")||name.match("Email")||name.match("URL")){
-if(!_17f.address){
-_17f.address={};
-}
-if(name.match("Home")){
-if(!_17f.address.home){
-_17f.address.home={};
-}
-}else{
-if(name.match("Work")){
-if(!_17f.address.work){
-_17f.address.work={};
-}
-}
-}
-}else{
-if(name.match("JobTitle")){
-if(!_17f.company){
-_17f.company={};
-}
-}
-}
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_device_contact_extract: "+e);
-}
-if(name.match("IMPP.Value")){
-var _180=name.split(".");
-var _181=_180[2];
-if(_181!=undefined){
-_17f.xspid[_180[2]]=_17e;
-return;
-}
-}
-switch(name){
-case "LastName.Value":
-_17f.name.last=_17e;
-break;
-case "FirstName.Value":
-_17f.name.first=_17e;
-break;
-case "MiddleName.Value":
-_17f.name.middle=_17e;
-break;
-case "Prefix.Value":
-_17f.name.prefix=_17e;
-break;
-case "Suffix.Value":
-_17f.name.suffix=_17e;
-break;
-case "LandPhoneGen.Value":
-_17f.tel.land=_17e;
-break;
-case "MobilePhoneGen.Value":
-_17f.tel.mobile=_17e;
-break;
-case "VideoNumberGen.Value":
-_17f.tel.video=_17e;
-break;
-case "FaxNumberGen.Value":
-_17f.tel.fax=_17e;
-break;
-case "VOIPGen.Value":
-_17f.tel.voip=_17e;
-break;
-case "LandPhoneHome.Value":
-_17f.tel.home.land=_17e;
-break;
-case "MobilePhoneHome.Value":
-_17f.tel.home.mobile=_17e;
-break;
-case "VideoNumberHome.Value":
-_17f.tel.home.video=_17e;
-break;
-case "FaxNumberHome.Value":
-_17f.tel.home.fax=_17e;
-break;
-case "VoipHome.Value":
-_17f.tel.home.voip=_17e;
-break;
-case "LandPhoneWork.Value":
-_17f.tel.work.land=_17e;
-break;
-case "MobilePhoneWork.Value":
-_17f.tel.work.mobile=_17e;
-break;
-case "VideoNumberWork.Value":
-_17f.tel.work.video=_17e;
-break;
-case "FaxNumberWork.Value":
-_17f.tel.work.fax=_17e;
-break;
-case "VoipWork.Value":
-_17f.tel.work.voip=_17e;
-break;
-case "AddrStreetGen.Value":
-_17f.address.street=_17e;
-break;
-case "AddrLocalGen.Value":
-_17f.address.local=_17e;
-break;
-case "AddrRegionGen.Value":
-_17f.address.region=_17e;
-break;
-case "AddrPostCodeGen.Value":
-_17f.address.code=_17e;
-break;
-case "AddrCountryGen.Value":
-_17f.address.country=_17e;
-break;
-case "EmailGen.Value":
-_17f.address.email=_17e;
-break;
-case "URLGen.Value":
-_17f.address.uri=_17e;
-break;
-case "AddrStreetHome.Value":
-_17f.address.home.street=_17e;
-break;
-case "AddrLocalHome.Value":
-_17f.address.home.local=_17e;
-break;
-case "AddrRegionHome.Value":
-_17f.address.home.region=_17e;
-break;
-case "AddrPostCodeHome.Value":
-_17f.address.home.code=_17e;
-break;
-case "AddrCountryHome.Value":
-_17f.address.home.country=_17e;
-break;
-case "EmailHome.Value":
-_17f.address.home.email=_17e;
-break;
-case "URLHome.Value":
-_17f.address.home.uri=_17e;
-break;
-case "AddrStreetWork.Value":
-_17f.address.work.street=_17e;
-break;
-case "AddrLocalWork.Value":
-_17f.address.work.local=_17e;
-break;
-case "AddrRegionWork.Value":
-_17f.address.work.region=_17e;
-break;
-case "AddrPostCodeWork.Value":
-_17f.address.work.code=_17e;
-break;
-case "AddrCountryWork.Value":
-_17f.address.work.country=_17e;
-break;
-case "EmailWork.Value":
-_17f.address.work.email=_17e;
-break;
-case "URLWork.Value":
-_17f.address.work.uri=_17e;
-break;
-case "CompanyName.Value":
-_17f.company.name=_17e;
-break;
-case "JobTitle.Value":
-_17f.company.title=_17e;
-break;
-case "Note.Value":
-_17f.notes=_17e;
-break;
-case "Anniversary.Value":
-_17f.anniversary=_17e;
-break;
-case "Date.Value":
-_17f.birthday=_17e;
-break;
-case "SecondName.Value":
-_17f.nickName=_17e;
-break;
-case "CallerObjImg.Value":
-_17f.photo=_17e;
-break;
-default:
-}
-};
-function __sp_device_contact_build(_182,_183){
-__s60_enumerate_build_contact_object(_182,null,__sp_device_contact_extract,_183);
-};
-function __sp_contact_iterator_get_next(){
-var _184=this.iter.getNext();
-if(typeof _184=="undefined"){
-return null;
-}
-var rval={};
-__sp_device_contact_build(_184,rval);
-_184.close();
-return rval;
-};
-function __sp_contact_iterator(_186){
-this.iter=_186;
-this.next=__sp_contact_iterator_get_next;
-};
-function __s60_enumerate_group_object(_187,func,_189){
-var key;
-for(key in _187){
-var _18b=key;
-var _18c=_187[key];
-func(_18b,_18c,_189);
-}
-};
-function __sp_device_groupinfo_extract(name,_18e,_18f){
-if(_18f.group==undefined){
-_18f.group={};
-}
-if(name=="id"){
-_18f.group.groupId=_18e;
-}else{
-if(name=="GroupLabel"){
-_18f.group.groupName=_18e;
-}else{
-if(name=="Contents"){
-_18f.contents=_18e;
-}
-}
-}
-return;
-};
-function __sp_device_groupinfo_build(_190,_191){
-__s60_enumerate_group_object(_190,__sp_device_groupinfo_extract,_191);
-};
-function __sp_device_group_extract(name,_193,_194){
-if(name=="id"){
-_194.groupId=_193;
-return;
-}
-if(name=="GroupLabel"){
-_194.groupName=_193;
-return;
-}
-};
-function __sp_device_group_build(_195,_196){
-__s60_enumerate_object(_195,null,__sp_device_group_extract,_196);
-};
-function __sp_group_iterator_get_next(){
-var _197=this.iter.getNext();
-if(typeof _197=="undefined"){
-return null;
-}
-var rval={};
-__sp_device_group_build(_197,rval);
-_197.close();
-return rval;
-};
-function __sp_group_iterator(_199){
-this.iter=_199;
-this.next=__sp_group_iterator_get_next;
-};
-var CONTACTS_APP_ID=270486734;
-function __sp_contacts_startEditor(_19a,_19b,_19c){
-if(!_19a){
-throw new DeviceException(MISSING_ARG_ERR,"Contacts: StartEditor:Missing Success Callback");
-}
-if((typeof _19a)!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: StartEditor:Invalid Success Callback");
-}
-if((_19b)==null){
-_19b={};
-}
-if((typeof _19b)=="undefined"){
-_19b={};
-}
-if((_19b)==undefined){
-_19b={};
-}
-if((typeof _19b)!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: StartEditor:Invalid Contact Data");
-}
-if(_19c){
-if((typeof _19c)!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts :StartEditor:Invalid Error Callback");
-}
-}
-var _19d=function(arg1,arg2,arg3){
-var iter=null;
-_19a(iter);
-};
-__s60_start_and_wait(CONTACTS_APP_ID,"",_19d);
-return 0;
-};
-function __sp_contacts_getContacts(_1a2,_1a3,_1a4,_1a5){
-var _1a6={};
-modifyObjectBaseProp(_1a6);
-_1a6.Type="Contact";
-if(_1a3){
-_1a6.Filter={};
-modifyObjectBaseProp(_1a6.Filter);
-_1a6.Filter.SearchVal=_1a3;
-}
-if(_1a4){
-_1a6.Sort={};
-modifyObjectBaseProp(_1a6.Sort);
-if(typeof _1a4=="number"){
-if(_1a4==SORT_ASCENDING||_1a4==SORT_ASCENDING){
-_1a6.Sort.Order="Ascending";
-}else{
-if(_1a4==SORT_DESCENDING||_1a4==SORT_DESCENDING){
-_1a6.Sort.Order="Descending";
-}else{
-_1a6.Sort.Order=_1a4;
-}
-}
-}else{
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: getContacts: callback is invalid");
-}
-}
-try{
-if(!_1a2){
-throw new DeviceException(MISSING_ARG_ERR,"Contacts: getContacts: callback is missing");
-}else{
-if(typeof _1a2!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: getContacts: callback is invalid");
-}
-}
-if(_1a5){
-if(typeof (_1a5)!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: getContacts: ErrorCallback is invalid");
-}
-}
-var _1a7=function(arg1,arg2,arg3){
-var iter=null;
-var _1ac=_1a5;
-if(arg3.ReturnValue){
-iter=new __sp_contact_iterator(arg3.ReturnValue);
-}else{
-if(arg3.ErrorCode!=0){
-var _1ad;
-if(arg3.ErrorMessage){
-_1ad=splitErrorMessage(arg3.ErrorMessage);
-}else{
-_1ad="Operation Failed";
-}
-_1ac(new DeviceException(MapErrorCode[arg3.ErrorCode],"Contacts: getContacts: "+_1ad));
-return;
-}
-}
-_1a2(iter);
-};
-var rval=this.so.IDataSource.GetList(_1a6,_1a7);
-if(_1a6.Sort){
-delete _1a6.Sort.Order;
-}
-if(_1a6.Filter){
-delete _1a6.Filter.SearchVal;
-}
-if(_1a6){
-delete _1a6.Type;
-delete _1a6.Filter;
-delete _1a6.Sort;
-}
-if(rval.ErrorCode!=0){
-var _1af=mappingVerification(rval.ErrorCode);
-if(_1af){
-switch(MapErrorCode[rval.ErrorCode]){
-case MISSING_ARG_ERR:
-case INVALID_ARG_ERR:
-case NOT_SUPPORTED_ERR:
-if(rval.ErrorMessage){
-var _1b0=splitErrorMessage(rval.ErrorMessage);
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContacts: ");
-}else{
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContacts:Operation Failed");
-}
-break;
-default:
-_1a2(iter);
-}
-}else{
-_1a2(iter);
-}
-}
-return rval.TransactionID;
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_getContacts: "+e);
-}
-};
-function __sp_contacts_add(_1b1){
-var _1b2={};
-modifyObjectBaseProp(_1b2);
-__s60_enumerate_contact_object(_1b1,null,__sp_contact_extract,_1b2);
-var _1b3={};
-modifyObjectBaseProp(_1b3);
-_1b3.Type="Contact";
-_1b3.Data=_1b2;
-try{
-if(_1b2.id){
-throw new DeviceException(NOT_SUPPORTED_ERR,"Contacts: addContact: Id Not Supported");
-}
-var _1b4=this.so.IDataSource.Add(_1b3);
-if(_1b2){
-delete _1b2.id;
-}
-if(_1b3){
-delete _1b3.Type;
-delete _1b3.Data;
-}
-var _1b5=_1b4["ReturnValue"];
-if(_1b4.ErrorCode!=0){
-var _1b6=mappingVerification(_1b4.ErrorCode);
-if(_1b4.ErrorMessage){
-var _1b7=splitErrorMessage(_1b4.ErrorMessage);
-if(_1b6){
-throw new DeviceException(MapErrorCode[_1b4.ErrorCode],"Contacts: addContact: "+_1b7);
-}else{
-throw new DeviceException(_1b4.ErrorCode,"Contacts: addContact: "+_1b7);
-}
-}else{
-if(_1b6){
-throw new DeviceException(MapErrorCode[_1b4.ErrorCode],"Contacts: addContact: Operation Failed");
-}else{
-throw new DeviceException(_1b4.ErrorCode,"Contacts: addContact: Operation Failed");
-}
-}
-}
-return _1b5;
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_addContact: "+e);
-}
-};
-function __sp_contacts_update(_1b8){
-try{
-if(!(_1b8&&_1b8.id)){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: updateContact: contact is missing");
-}
-var _1b9={};
-modifyObjectBaseProp(_1b9);
-__s60_enumerate_contact_object(_1b8,null,__sp_contact_extract,_1b9);
-if(typeof _1b9.id!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: updateContact: Invalid id type");
-}
-if(_1b9.id==undefined){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: updateContact: Invalid id type");
-}
-var _1ba={};
-modifyObjectBaseProp(_1ba);
-_1ba.Type="Contact";
-_1ba.Data=_1b9;
-var _1bb=this.so.IDataSource.Add(_1ba);
-if(_1b9){
-delete _1b9.id;
-}
-if(_1ba){
-delete _1ba.Type;
-delete _1ba.Data;
-}
-if(_1bb.ErrorCode!=0){
-var _1bc=mappingVerification(_1bb.ErrorCode);
-if(_1bb.ErrorMessage){
-var _1bd=splitErrorMessage(_1bb.ErrorMessage);
-if(_1bc){
-throw new DeviceException(MapErrorCode[_1bb.ErrorCode],"Contacts: updateContact: "+_1bd);
-}else{
-throw new DeviceException(_1bb.ErrorCode,"Contacts: updateContact: "+_1bd);
-}
-}else{
-if(_1bc){
-throw new DeviceException(MapErrorCode[_1bb.ErrorCode],"Contacts: updateContact: Operation Failed");
-}else{
-throw new DeviceException(_1bb.ErrorCode,"Contacts: updateContact: Operation Failed");
-}
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_updateContact: "+e);
-}
-};
-function __sp_contacts_delete(id){
-__device_debug("sp_contacts_delete id: "+id);
-var _1bf={};
-modifyObjectBaseProp(_1bf);
-if(id==undefined){
-throw new DeviceException(MISSING_ARG_ERR,"Contacts: deleteContacts: idlist is missing");
-}
-if(typeof id=="object"){
-_1bf.IdList=id;
-}else{
-_1bf.IdList=[];
-_1bf.IdList[0]=id;
-}
-var _1c0={};
-modifyObjectBaseProp(_1c0);
-_1c0.Type="Contact";
-_1c0.Data=_1bf;
-try{
-var _1c1=this.so.IDataSource.Delete(_1c0);
-if(_1bf){
-delete _1bf.IdList;
-}
-if(_1c0){
-delete _1c0.Type;
-delete _1c0.Data;
-}
-if(_1c1.ErrorCode!=0){
-var _1c2=mappingVerification(_1c1.ErrorCode);
-if(_1c1.ErrorMessage){
-var _1c3=splitErrorMessage(_1c1.ErrorMessage);
-if(_1c2){
-throw new DeviceException(MapErrorCode[_1c1.ErrorCode],"Contacts: deleteContacts: "+_1c3);
-}else{
-throw new DeviceException(_1c1.ErrorCode,"Contacts: deleteContacts: "+_1c3);
-}
-}else{
-if(_1c2){
-throw new DeviceException(MapErrorCode[_1c1.ErrorCode],"Contacts: deleteContacts: Operation Failed");
-}else{
-throw new DeviceException(_1c1.ErrorCode,"Contacts: deleteContacts: Operation Failed");
-}
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_deleteContacts: "+e);
-}
-};
-function __sp_contacts_get(id){
-var _1c5={};
-modifyObjectBaseProp(_1c5);
-_1c5.Type="Contact";
-if(id==null){
-throw new DeviceException(MISSING_ARG_ERR,"Contacts: getContactInfo: callback is missing");
-}
-_1c5.Filter={};
-modifyObjectBaseProp(_1c5.Filter);
-_1c5.Filter.id=id;
-try{
-var rval=this.so.IDataSource.GetList(_1c5);
-if(_1c5.Filter){
-delete _1c5.Filter.id;
-}
-if(_1c5){
-delete _1c5.Type;
-delete _1c5.Filter;
-}
-if(rval){
-if(rval.ErrorCode!=0){
-var _1c7=mappingVerification(rval.ErrorCode);
-if(rval.ErrorMessage){
-var _1c8=splitErrorMessage(rval.ErrorMessage);
-if(_1c7){
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactInfo: "+_1c8);
-}else{
-throw new DeviceException(rval.ErrorCode,"Contacts: getContactInfo: "+_1c8);
-}
-}else{
-if(_1c7){
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactInfo: Operation Failed");
-}else{
-throw new DeviceException(rval.ErrorCode,"Contacts: getContactInfo: Operation Failed");
-}
-}
-}
-var _1c9={};
-modifyObjectBaseProp(_1c9);
-var _1ca=rval.ReturnValue.getNext();
-__sp_device_contact_build(_1ca,_1c9);
-return _1c9;
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_getContactInfo:"+e);
-}
-};
-function __sp_contacts_addGroup(_1cb){
-var _1cc={};
-modifyObjectBaseProp(_1cc);
-_1cc.GroupLabel=_1cb;
-if(typeof (_1cc.GroupLabel)==null){
-throw new DeviceException(MISSING_ARG_ERR,"Contacts: addGroups: callback is missing");
-}
-if((typeof _1cc.GroupLabel)=="undefined"){
-throw new DeviceException(MISSING_ARG_ERR,"addGroup:Group Data Needed");
-}
-if((_1cc.GroupLabel)==undefined){
-throw new DeviceException(MISSING_ARG_ERR,"addGroup:Group Data Needed");
-}
-var _1cd={};
-modifyObjectBaseProp(_1cd);
-_1cd.Type="Group";
-_1cd.Data=_1cc;
-try{
-var _1ce=this.so.IDataSource.Add(_1cd);
-if(_1cc){
-delete _1cc.GroupLabel;
-}
-if(_1cd){
-delete _1cd.Type;
-delete _1cd.Data;
-}
-var _1cf=_1ce["ReturnValue"];
-if(_1ce.ErrorCode!=0){
-var _1d0=mappingVerification(_1ce.ErrorCode);
-if(_1ce.ErrorMessage){
-var _1d1=splitErrorMessage(_1ce.ErrorMessage);
-if(_1d0){
-throw new DeviceException(MapErrorCode[_1ce.ErrorCode],"Contacts: addGroup: "+_1d1);
-}else{
-throw new DeviceException(_1d1,_1ce.ErrorCode,"Contacts: addGroup: ");
-}
-}else{
-if(_1d0){
-throw new DeviceException(MapErrorCode[_1ce.ErrorCode],"Contacts: addGroup: Operation Failed");
-}else{
-throw new DeviceException(_1ce.ErrorCode,"Contacts: addGroup: Operation Failed");
-}
-}
-}
-return _1cf;
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_addGroup: "+e);
-}
-};
-function __sp_contacts_getGroups(_1d2,_1d3){
-var _1d4={};
-modifyObjectBaseProp(_1d4);
-_1d4.Type="Group";
-try{
-if(!_1d2){
-throw new DeviceException(MISSING_ARG_ERR,"Contacts: getGroups: callback is missing");
-}else{
-if(typeof _1d2!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: getGroups: callback is invalid");
-}
-}
-if(_1d3){
-if(typeof (_1d3)!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: getGroups: ErrorCallback is invalid");
-}
-}
-var _1d5=function(arg1,arg2,arg3){
-var iter=null;
-var _1da=_1d3;
-iter=arg3.ReturnValue;
-if(arg3.ReturnValue){
-iter=new __sp_group_iterator(arg3.ReturnValue);
-}else{
-if(arg3.ErrorCode!=0){
-var _1db;
-if(arg3.ErrorMessage){
-_1db=splitErrorMessage(arg3.ErrorMessage);
-}else{
-_1db="Operation Failed";
-}
-_1da(new DeviceException(_1db,MapErrorCode[arg3.ErrorCode],"Contacts: getGroups:"));
-return;
-}
-}
-_1d2(iter);
-};
-var rval=this.so.IDataSource.GetList(_1d4,_1d5);
-if(_1d4){
-delete _1d4.Type;
-}
-if(rval.ErrorCode!=0){
-var _1dd=mappingVerification(result.ErrorCode);
-if(_1dd){
-switch(MapErrorCode[rval.ErrorCode]){
-case MISSING_ARG_ERR:
-case INVALID_ARG_ERR:
-case NOT_SUPPORTED_ERR:
-if(rval.ErrorMessage){
-var _1de=splitErrorMessage(rval.ErrorMessage);
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroups: "+_1de);
-}else{
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroups: Operation Failed");
-}
-break;
-default:
-_1d2(iter);
-}
-}else{
-_1d2(iter);
-}
-}
-return rval.TransactionID;
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_getGroups: "+e);
-}
-};
-function __sp_contacts_deleteGroups(id){
-var _1e0={};
-modifyObjectBaseProp(_1e0);
-var _1e1=[];
-if(typeof id=="object"){
-var i=0;
-for(var val in id){
-_1e1[i]=id[val];
-i++;
-}
-}else{
-_1e1[0]=id;
-}
-_1e0.IdList=[];
-_1e0.IdList=_1e1;
-var _1e4={};
-modifyObjectBaseProp(_1e4);
-_1e4.Type="Group";
-_1e4.Data=_1e0;
-try{
-var _1e5=this.so.IDataSource.Delete(_1e4);
-if(_1e5.ErrorCode!=0){
-var _1e6=mappingVerification(_1e5.ErrorCode);
-if(_1e5.ErrorMessage){
-var _1e7=splitErrorMessage(_1e5.ErrorMessage);
-if(_1e6){
-throw new DeviceException(MapErrorCode[_1e5.ErrorCode],"Contacts: deleteGroups: "+_1e7);
-}else{
-throw new DeviceException(_1e5.ErrorCode,"Contacts: deleteGroups: "+_1e7);
-}
-}else{
-if(_1e6){
-throw new DeviceException(MapErrorCode[_1e5.ErrorCode],"Contacts: deleteGroups: Operation Failed");
-}else{
-throw new DeviceException(_1e5.ErrorCode,"Contacts: deleteGroups: Operation Failed");
-}
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_deleteGroups: "+e);
-}
-};
-function __sp_contacts_addContactsToGroup(_1e8,id1){
-try{
-var _1ea={};
-modifyObjectBaseProp(_1ea);
-var _1eb=false;
-_1ea.Type="Group";
-var map={};
-modifyObjectBaseProp(map);
-var _1ed=[];
-if(typeof id1=="object"){
-var i=0;
-for(var val in id1){
-_1ed[i]=id1[val];
-i++;
-}
-}else{
-_1ed[0]=id1;
-}
-map.IdList=_1ed;
-_1eb=true;
-delete _1ed.index;
-if(_1e8!=undefined){
-map.id=_1e8;
-_1eb=true;
-}
-if(_1eb){
-_1ea.Data=map;
-}
-_1ea.OperationType="Associate";
-var _1f0=this.so.IDataSource.Organise(_1ea);
-if(map){
-delete map.id;
-delete map.IdList;
-}
-if(_1ea){
-delete _1ea.Data;
-delete _1ea.OperationType;
-delete _1ea.Type;
-}
-if(_1f0.ErrorCode!=0){
-var _1f1=mappingVerification(_1f0.ErrorCode);
-if(_1f0.ErrorMessage){
-var _1f2=splitErrorMessage(_1f0.ErrorMessage);
-if(_1f1){
-throw new DeviceException(MapErrorCode[_1f0.ErrorCode],"Contacts: addContactsToGroup: "+_1f2);
-}else{
-throw new DeviceException(_1f0.ErrorCode,"Contacts: addContactsToGroup: "+_1f2);
-}
-}else{
-if(_1f1){
-throw new DeviceException(MapErrorCode[_1f0.ErrorCode],"Contacts: addContactsToGroup: Operation Failed");
-}else{
-throw new DeviceException(_1f0.ErrorCode,"Contacts: addContactsToGroup: Operation Failed");
-}
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_addContactsToGroup: "+e);
-}
-};
-function __sp_contacts_getContactIds(_1f3,_1f4,_1f5,_1f6){
-var _1f7={};
-var _1f8=_1f6;
-modifyObjectBaseProp(_1f7);
-_1f7.Type="Contact";
-if(_1f4){
-_1f7.Filter={};
-modifyObjectBaseProp(_1f7.Filter);
-_1f7.Filter.SearchVal=_1f4;
-}
-if(_1f5){
-_1f7.Sort={};
-modifyObjectBaseProp(_1f7.Sort);
-if(typeof _1f5=="number"){
-if(_1f5==SORT_ASCENDING){
-_1f7.Sort.Order="Ascending";
-}else{
-if(_1f5==SORT_DESCENDING){
-_1f7.Sort.Order="Descending";
-}else{
-_1f7.Sort.Order=_1f5;
-}
-}
-}else{
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: getContactIds: callback is missing");
-}
-}
-try{
-if(!_1f3){
-throw new DeviceException(MISSING_ARG_ERR,"Contacts: getContactIds: callback is missing");
-}else{
-if(typeof _1f3!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: getContactIds: callback is invalid");
-}
-}
-if(_1f6){
-if(typeof (_1f6)!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: getContactIds: ErrorCallback is invalid");
-}
-}
-var _1f9=function(arg1,arg2,arg3){
-var item=null;
-var _1fe=null;
-var _1ff=_1f6;
-var id=null;
-if(arg3["ReturnValue"]!=undefined){
-item=arg3["ReturnValue"];
-id=item["IdList"];
-_1fe=[];
-_1fe=id;
-delete _1fe.index;
-}else{
-if(arg3.ErrorCode!=0){
-var _201;
-if(arg3.ErrorMessage){
-_201=splitErrorMessage(arg3.ErrorMessage);
-}else{
-_201="Operation Failed";
-}
-_1ff(new DeviceException(MapErrorCode[arg3.ErrorCode],"Contacts: getContactIds:"+_201));
-return;
-}
-}
-_1f3(_1fe);
-};
-var rval=this.so.IDataSource.GetIds(_1f7,_1f9);
-if(rval.ErrorCode!=0){
-var _203=mappingVerification(rval.ErrorCode);
-if(_203){
-switch(MapErrorCode[rval.ErrorCode]){
-case MISSING_ARG_ERR:
-case INVALID_ARG_ERR:
-case NOT_SUPPORTED_ERR:
-if(rval.ErrorMessage){
-var _204=splitErrorMessage(rval.ErrorMessage);
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactIds: "+_204);
-}else{
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactIds: Operation Failed");
-}
-break;
-default:
-_1f3(idList);
-}
-}else{
-_1f3(idList);
-}
-}
-return rval.TransactionID;
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_getContactIds: "+e);
-}
-};
-function __sp_contacts_getGroupIds(_205,_206){
-var _207={};
-modifyObjectBaseProp(_207);
-_207.Type="Group";
-try{
-if(!_205){
-throw new DeviceException(MISSING_ARG_ERR,"Contacts: getGroupIds: callback is missing");
-}else{
-if(typeof _205!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: getGroupIds: callback is invalid");
-}
-}
-if(_206){
-if(typeof (_206)!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: getGroupIds: ErrorCallback is invalid");
-}
-}
-var _208=function(arg1,arg2,arg3){
-var _20c=_206;
-var item=null;
-var _20e=[];
-if(arg3.ReturnValue){
-item=arg3["ReturnValue"];
-arg3.ReturnValue.close();
-var id=item["IdList"];
-_20e=id;
-}else{
-if(arg3.ErrorCode!=0){
-var _210;
-if(rval.ErrorMessage){
-_210=splitErrorMessage(rval.ErrorMessage);
-}else{
-_210="Operation Failed";
-}
-_20c(new DeviceException(MapErrorCode[arg3.ErrorCode],"Contacts: getGroupIds:"+_210));
-return;
-}
-}
-_205(_20e);
-delete _20e.index;
-};
-var rval=this.so.IDataSource.GetIds(_207,_208);
-if(_207){
-delete _207.Type;
-}
-if(rval.ErrorCode!=0){
-var _212=mappingVerification(rval.ErrorCode);
-if(_212){
-switch(rval.ErrorCode){
-case MISSING_ARG_ERR:
-case INVALID_ARG_ERR:
-case NOT_SUPPORTED_ERR:
-if(rval.ErrorMessage){
-var _213=splitErrorMessage(rval.ErrorMessage);
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupIds: "+_213);
-}else{
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupIds: Operation Failed");
-}
-break;
-default:
-_205(idList);
-}
-}else{
-_205(idList);
-}
-}
-return rval.TransactionID;
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_getGroupIds: "+e);
-}
-};
-function __sp_contacts_removeContactsFromGroup(_214,id){
-try{
-var _216={};
-modifyObjectBaseProp(_216);
-var _217=false;
-_216.Type="Group";
-var map={};
-if(id!=undefined){
-var _219=[];
-if(typeof id=="object"){
-var i=0;
-for(var val in id){
-_219[i]=id[val];
-i++;
-}
-}else{
-_219[0]=id;
-}
-map.IdList=_219;
-_217=true;
-}
-if(_214!=undefined){
-map.id=_214;
-_217=true;
-}
-if(_217){
-_216.Data=map;
-}
-_216.OperationType="Disassociate";
-var _21c=this.so.IDataSource.Organise(_216);
-if(map){
-delete map.IdList;
-}
-if(_216){
-delete _216.Data;
-delete _216.OperationType;
-delete _216.Type;
-}
-if(_21c.ErrorCode!=0){
-var _21d=mappingVerification(_21c.ErrorCode);
-if(_21c.ErrorMessage){
-var _21e=splitErrorMessage(_21c.ErrorMessage);
-if(_21d){
-throw new DeviceException(MapErrorCode[_21c.ErrorCode],"Contacts: removeContactsFromGroup: "+_21e);
-}else{
-throw new DeviceException(_21c.ErrorCode,"Contacts: removeContactsFromGroup: "+_21e);
-}
-}else{
-if(_21d){
-throw new DeviceException(MapErrorCode[_21c.ErrorCode],"Contacts: removeContactsFromGroup: Operation Failed");
-}else{
-throw new DeviceException(_21c.ErrorCode,"Contacts: removeContactsFromGroup: Operation Failed");
-}
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_removeContactsFromGroup: "+e);
-}
-};
-function __sp_contacts_cancel(_21f){
-try{
-var _220={};
-if((_21f)==null){
-throw new DeviceException(MISSING_ARG_ERR,"Contacts: cancel: "+_221);
-}
-if((_21f)==undefined){
-throw new DeviceException(MISSING_ARG_ERR,"Contacts: cancel: "+_221);
-}
-if((typeof _21f)=="undefined"){
-throw new DeviceException(MISSING_ARG_ERR,"Contacts: cancel: "+_221);
-}
-if(((typeof _21f)!="number")||(_21f<=0)){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: cancel: "+_221);
-}
-modifyObjectBaseProp(_220);
-_220.TransactionID=_21f;
-var _222=this.so.IDataSource.Cancel(_220);
-if(_220){
-delete _220.TransactionID;
-}
-var _223=_222["ErrorCode"];
-if(_223!=0){
-var _224=mappingVerification(_222.ErrorCode);
-if(_222["ErrorMessage"]){
-var _221=splitErrorMessage(_222.ErrorMessage);
-if(_224){
-throw new DeviceException(MapErrorCode[_223],"Contacts: cancel: "+_221);
-}else{
-throw new DeviceException(_223,"Contacts: cancel: "+_221);
-}
-}else{
-if(_224){
-throw new DeviceException(MapErrorCode[_223],"Contacts: cancel: Operation Failed");
-}else{
-throw new DeviceException(_223,"Contacts: cancel: Operation Failed");
-}
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_cancel: "+e);
-}
-};
-function __sp_contacts_updateGroup(_225){
-if(!(_225)){
-throw new DeviceException(MISSING_ARG_ERR,"updateGroup:Invalid Group Data");
-}
-if((typeof _225)!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"updateGroup:Invalid Group Data");
-}
-try{
-var _226={};
-modifyObjectBaseProp(_226);
-_226.Type="Group";
-var _227={};
-modifyObjectBaseProp(_227);
-if(_225!=undefined){
-if(_225.groupId!=undefined){
-_227["id"]=_225.groupId;
-}else{
-throw new DeviceException(MISSING_ARG_ERR,"Contacts: updateGroup: Id input is mandatory");
-}
-if(_225.groupName!=undefined){
-_227["GroupLabel"]=_225.groupName;
-}
-}
-_226.Data=_227;
-var _228=this.so.IDataSource.Add(_226);
-if(_227){
-delete _227.prototype;
-}
-if(_226){
-delete _226.Data;
-delete _226.Type;
-}
-if(_228.ErrorCode!=0){
-var _229=mappingVerification(_228.ErrorCode);
-if(_228.ErrorMessage){
-var _22a=splitErrorMessage(_228.ErrorMessage);
-if(_229){
-throw new DeviceException(MapErrorCode[_228.ErrorCode],"Contacts: updateGroup: "+_22a);
-}else{
-throw new DeviceException(_228.ErrorCode,"Contacts: updateGroup: "+_22a);
-}
-}else{
-if(_229){
-throw new DeviceException(MapErrorCode[_228.ErrorCode],"Contacts: updateGroup: Operation Failed");
-}else{
-throw new DeviceException(_228.ErrorCode,"Contacts: updateGroup: Operation Failed");
-}
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_updateGroup: "+e);
-}
-};
-function __sp_contacts_getGroupInfo(_22b){
-try{
-var _22c={};
-modifyObjectBaseProp(_22c);
-_22c.Type="Group";
-_22c.Filter={};
-modifyObjectBaseProp(_22c.Filter);
-if(_22b==undefined){
-throw new DeviceException(MISSING_ARG_ERR,"Contacts: getGroupInfo: Id input is mandatory");
-}
-if((typeof _22b)!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Contacts: getGroupInfo: Id input is mandatory");
-}
-_22c.Filter.id=_22b;
-var rval=this.so.IDataSource.GetList(_22c);
-if(_22c.Filter){
-delete _22c.Filter.id;
-}
-if(_22c){
-delete _22c.Filter;
-delete _22c.Type;
-}
-if(rval){
-if(rval.ErrorCode!=0){
-var _22e=mappingVerification(rval.ErrorCode);
-if(rval.ErrorMessage){
-var _22f=splitErrorMessage(rval.ErrorMessage);
-if(_22e){
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupInfo: "+_22f);
-}else{
-throw new DeviceException(rval.ErrorCode,"Contacts: getGroupInfo: "+_22f);
-}
-}else{
-if(_22e){
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupInfo: Operation Failed");
-}else{
-throw new DeviceException(rval.ErrorCode,"Contacts: getGroupInfo: Operation Failed");
-}
-}
-}else{
-var _230={};
-modifyObjectBaseProp(_230);
-var _231=rval.ReturnValue.getNext();
-__sp_device_groupinfo_build(_231,_230);
-return _230;
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_contacts_getGroupInfo:"+e);
-}
-};
-function mappingVerification(_232){
-if(_232===1016||_232===1012||_232===1010||_232===1009||_232===1005||_232===1000||_232===1011||_232===1007||_232===1003||_232===1002){
-return true;
-}else{
-return false;
-}
-};
-function __sp_contacts_instance(){
-this.descriptor=new __sp_contacts_descriptor();
-this.startEditor=__sp_contacts_startEditor;
-this.getContacts=__sp_contacts_getContacts;
-this.addContact=__sp_contacts_add;
-this.updateContact=__sp_contacts_update;
-this.deleteContacts=__sp_contacts_delete;
-this.getContactInfo=__sp_contacts_get;
-this.addGroup=__sp_contacts_addGroup;
-this.getGroups=__sp_contacts_getGroups;
-this.deleteGroups=__sp_contacts_deleteGroups;
-this.addContactsToGroup=__sp_contacts_addContactsToGroup;
-this.getContactIds=__sp_contacts_getContactIds;
-this.getGroupIds=__sp_contacts_getGroupIds;
-this.removeContactsFromGroup=__sp_contacts_removeContactsFromGroup;
-this.cancel=__sp_contacts_cancel;
-this.updateGroup=__sp_contacts_updateGroup;
-this.getGroupInfo=__sp_contacts_getGroupInfo;
-try{
-this.so=device.getServiceObject("Service.Contact","IDataSource");
-}
-catch(e){
-__device_handle_exception(e,"Contacts service not available "+e);
-}
-};
-function PositionError(){
-this.UNKNOWN_ERROR=0;
-this.PERMISSION_DENIED=1;
-this.POSITION_UNAVAILABLE=2;
-this.TIMEOUT=3;
-this.code;
-this.message;
-};
-function Coordinates(){
-this.latitude=null;
-this.longitude=null;
-this.altitude=null;
-this.accuracy=null;
-this.altitudeAccuracy=null;
-this.heading=null;
-this.speed=null;
-};
-function Position(){
-this.coords=null;
-this.timestamp=null;
-};
-function PositionOptions(){
-this.enableHighAccuracy;
-this.timeout;
-this.maximumAge;
-};
-var __sp_location_trace_transactionId=-1;
-function __sp_location_handle_error(_233,_234,_235){
-if((_233!=undefined)&&(typeof _233=="function")&&(_233!=null)){
-var _236=new PositionError();
-if((-21)==_234){
-_236.code=_236.PERMISSION_DENIED;
-_236.message="permission denied";
-}else{
-if((-33)==_234){
-_236.code=_236.TIMEOUT;
-_236.message="request timed out";
-}else{
-_236.code=_236.UNKNOWN_ERROR;
-_236.message="UnKnown Error";
-}
-}
-_233(_236);
-}else{
-var _236=new PositionError();
-_236.code=_236.UNKNOWN_ERROR;
-_236.message="UnKnown Error";
-throw _236;
-}
-};
-function __sp_location_descriptor(){
-this.interfaceName="geolocation";
-if(window.__Service_Interface_Ver){
-this.version=__Service_Interface_Ver;
-}else{
-this.version=1;
-}
-};
-var obj;
-function __sp_getLocation(_237,_238,_239){
-var _23a=this;
-var _23b=function(arg1,arg2,arg3){
-var _23f=_237;
-var _240=_238;
-if(arg3.ErrorCode){
-__sp_location_handle_error(_240,arg3.ErrorCode,arg3.ErrorMessage);
-return;
-}else{
-var _241=new Coordinates();
-_241.longitude=(arg3.ReturnValue.Longitude==undefined)?null:arg3.ReturnValue.Longitude;
-_241.latitude=(arg3.ReturnValue.Latitude==undefined)?null:arg3.ReturnValue.Latitude;
-_241.altitude=(arg3.ReturnValue.Altitude==undefined)?null:arg3.ReturnValue.Altitude;
-_241.accuracy=(arg3.ReturnValue.HorizontalAccuracy==undefined)?null:arg3.ReturnValue.HorizontalAccuracy;
-_241.altitudeAccuracy=(arg3.ReturnValue.VerticalAccuracy==undefined)?null:arg3.ReturnValue.VerticalAccuracy;
-_241.heading=(arg3.ReturnValue.Heading==undefined)?null:arg3.ReturnValue.Heading;
-_241.speed=(arg3.ReturnValue.HorizontalSpeed==undefined)?null:arg3.ReturnValue.HorizontalSpeed;
-var _242=new Position();
-_242.coords={};
-modifyObjectBaseProp(_242.coords);
-_242.coords=_241;
-_242.timestamp=new Date();
-_23f(_242);
-delete _242.timestamp;
-delete _242;
-delete _241;
-}
-};
-if((_237==undefined)||(_237==null)||(typeof (_237)!="function")){
-var _243="Wrong callback type";
-__sp_location_handle_error(_238,0,_243);
-}
-if((_238!=undefined)){
-if((_238!=null)&&(_238!="")&&(typeof (_238)!="function")){
-var _244=new PositionError();
-_244.code=-1;
-throw _244;
-}
-}
-var _245;
-var _246={};
-modifyObjectBaseProp(_246);
-_246.LocationInformationClass="GenericLocationInfo";
-var _247={};
-modifyObjectBaseProp(_247);
-_247.UpdateInterval=0;
-if(_239!=undefined&&_239!=null){
-if((typeof (_239)!="object")){
-var _248="Wrong posOptions type";
-__sp_location_handle_error(_238,0,_248);
-return;
-}
-}
-if(_239!=undefined){
-if(_239.maximumAge!=undefined){
-if(_239.maximumAge){
-if((_239.maximumAge==Infinity)){
-if((_239.enableHighAccuracy==undefined)||(typeof (_239.enableHighAccuracy)=="boolean")){
-var arg3=this.so.ILocation.GetLastPosition();
-if(arg3.ErrorCode<0){
-var _248="Invalid input type";
-__sp_location_handle_error(_238,0,_248);
-return;
-}
-var _24a=new Coordinates();
-_24a.longitude=(arg3.ReturnValue.Longitude==undefined)?null:arg3.ReturnValue.Longitude;
-_24a.latitude=(arg3.ReturnValue.Latitude==undefined)?null:arg3.ReturnValue.Latitude;
-_24a.altitude=(arg3.ReturnValue.Altitude==undefined)?null:arg3.ReturnValue.Altitude;
-_24a.accuracy=(arg3.ReturnValue.HorizontalAccuracy==undefined)?null:arg3.ReturnValue.HorizontalAccuracy;
-_24a.altitudeAccuracy=(arg3.ReturnValue.VerticalAccuracy==undefined)?null:arg3.ReturnValue.VerticalAccuracy;
-_24a.heading=(arg3.ReturnValue.Heading==undefined)?null:arg3.ReturnValue.Heading;
-_24a.speed=(arg3.ReturnValue.HorizontalSpeed==undefined)?null:arg3.ReturnValue.HorizontalSpeed;
-var _24b=new Position();
-_24b.coords={};
-modifyObjectBaseProp(_24b.coords);
-_24b.coords=_24a;
-_24b.timestamp=new Date();
-_237(_24b);
-delete _24b.timestamp;
-delete _24b;
-delete _24a;
-return;
-}
-}
-if(!(isNaN(parseInt(_239.maximumAge)))){
-if((_239.maximumAge==0)){
-var _248="Invalid input type";
-__sp_location_handle_error(_238,0,_248);
-return;
-}
-_247.UpdateMaxAge=_239.maximumAge;
-}else{
-var _248="Invalid input type";
-__sp_location_handle_error(_238,0,_248);
-return;
-}
-}else{
-if((_239.maximumAge==null)||(_239.maximumAge=="")){
-}
-}
-}
-if((_239.enableHighAccuracy!==undefined)){
-if(_239.enableHighAccuracy==true){
-_246.EnableHighAccuracy=_239.enableHighAccuracy;
-}else{
-if(_239.enableHighAccuracy==false){
-_246.EnableHighAccuracy=_239.enableHighAccuracy;
-}else{
-if((_239.enableHighAccuracy==null)||(_239.enableHighAccuracy=="")){
-}else{
-if((typeof (_239.enableHighAccuracy)!="boolean")){
-var _24c="Wrong value for enableHighAccuracy param";
-__sp_location_handle_error(_238,0,_24c);
-return;
-}
-}
-}
-}
-}
-if(_239.timeout!==undefined){
-if((_239.timeout!==null)||((_239.timeout!==""))){
-if((_239.timeout==Infinity)){
-var _248="Invalid input type";
-__sp_location_handle_error(_238,0,_248);
-return;
-}else{
-if(!(isNaN(parseInt(_239.timeout)))){
-if((_239.timeout<=2147483647)){
-if((_239.timeout==0)){
-var _248="Invalid input type";
-__sp_location_handle_error(_238,0,_248);
-return;
-}
-_247.UpdateTimeOut=_239.timeout;
-}else{
-var _248="Invalid input type";
-__sp_location_handle_error(_238,0,_248);
-return;
-}
-}
-}
-}else{
-if((_239.timeout===null)||((_239.timeout===""))){
-}else{
-var _248="Invalid input type";
-__sp_location_handle_error(_238,0,_248);
-return;
-}
-}
-}
-}
-_247.PartialUpdates=false;
-_246.Updateoptions=_247;
-try{
-var rval=this.so.ILocation.GetLocation(_246,_23b);
-delete _247;
-delete _246;
-if(rval.ErrorCode!=0){
-__sp_location_handle_error(_238,rval.ErrorCode,rval.ErrorMessage);
-return;
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_getLocation: "+e);
-}
-};
-var __sp_location_trace_ucb=null;
-var __sp_location_fail_cb=null;
-function __sp_traceLocation(_24e,_24f,_250){
-if((_24e==undefined)||(_24e==null)||(typeof (_24e)!="function")){
-var _251="Wrong callback type";
-__sp_location_handle_error(_24f,0,_251);
-return;
-}
-if((typeof _24e!="function")){
-var _251="Wrong callback type";
-__sp_location_handle_error(_24f,0,_251);
-return;
-}
-if((_24f!=undefined)){
-if((_24f!=null)&&(_24f!="")&&(typeof (_24f)!="function")){
-var _252=new PositionError();
-_252.code=-1;
-throw _252;
-}
-}
-var _253=this;
-var _254=function(arg1,arg2,arg3){
-var _258=_24e;
-var _259=_24f;
-if(arg3.ErrorCode){
-__sp_location_handle_error(_259,arg3.ErrorCode,arg3.ErrorMessage);
-}else{
-var _25a=new Coordinates();
-_25a.longitude=(arg3.ReturnValue.Longitude==undefined)?null:arg3.ReturnValue.Longitude;
-_25a.latitude=(arg3.ReturnValue.Latitude==undefined)?null:arg3.ReturnValue.Latitude;
-_25a.altitude=(arg3.ReturnValue.Altitude==undefined)?null:arg3.ReturnValue.Altitude;
-_25a.accuracy=(arg3.ReturnValue.HorizontalAccuracy==undefined)?null:arg3.ReturnValue.HorizontalAccuracy;
-_25a.altitudeAccuracy=(arg3.ReturnValue.VerticalAccuracy==undefined)?null:arg3.ReturnValue.VerticalAccuracy;
-_25a.heading=(arg3.ReturnValue.Heading==undefined)?null:arg3.ReturnValue.Heading;
-_25a.speed=(arg3.ReturnValue.HorizontalSpeed==undefined)?null:arg3.ReturnValue.HorizontalSpeed;
-var _25b=new Position();
-_25b.coords={};
-modifyObjectBaseProp(_25b.coords);
-_25b.coords=_25a;
-_25b.timestamp=new Date();
-_258(_25b);
-delete _25b.timestamp;
-delete _25b;
-delete _25a;
-return;
-}
-};
-var _25c={};
-modifyObjectBaseProp(_25c);
-_25c.UpdateInterval=0;
-var _25d={};
-modifyObjectBaseProp(_25d);
-_25d.LocationInformationClass="GenericLocationInfo";
-if(_250!=undefined&&_250!=null){
-if((typeof (_250)!="object")){
-var _251="Wrong posOptions type";
-__sp_location_handle_error(_24f,0,_251);
-return;
-}
-}
-if(_250!=undefined){
-if((_250.enableHighAccuracy!==undefined)){
-if(_250.enableHighAccuracy==true){
-_25d.EnableHighAccuracy=_250.enableHighAccuracy;
-}else{
-if(_250.enableHighAccuracy==false){
-_25d.EnableHighAccuracy=_250.enableHighAccuracy;
-}else{
-if((_250.enableHighAccuracy==null)||(_250.enableHighAccuracy=="")){
-}else{
-if((typeof (_250.enableHighAccuracy)!="boolean")){
-var _25e="Wrong value for enableHighAccuracy param";
-__sp_location_handle_error(_24f,0,_25e);
-return;
-}
-}
-}
-}
-}
-if(_250.timeout!==undefined){
-if((_250.timeout!==null)||((_250.timeout!==""))){
-if((_250.timeout==Infinity)){
-var _251="Invalid input type";
-__sp_location_handle_error(_24f,0,_251);
-return;
-}else{
-if(!(isNaN(parseInt(_250.timeout)))){
-if((_250.timeout==0)){
-var _251="Invalid input type";
-__sp_location_handle_error(_24f,0,_251);
-return;
-}
-_25c.UpdateTimeOut=_250.timeout;
-}
-}
-}else{
-if((_250.timeout===null)||((_250.timeout===""))){
-}else{
-var _251="Invalid input type";
-__sp_location_handle_error(_24f,0,_251);
-return;
-}
-}
-}
-if(typeof _250.maximumAge!="undefined"){
-if(_250.maximumAge==_infinity){
-_25c.UpdateTimeOut=0;
-_25c.UpdateMaxAge=2147483647;
-}else{
-if(!(isNaN(parseInt(_250.maximumAge)))){
-_25c.UpdateMaxAge=_250.maximumAge;
-}else{
-if((_250.maximumAge===null)||((_250.maximumAge===""))){
-}else{
-var _251="Invalid input type";
-__sp_location_handle_error(_24f,0,_251);
-return;
-}
-}
-}
-}
-}
-_25c.PartialUpdates=false;
-_25d.Updateoptions=_25c;
-try{
-var rval=this.so.ILocation.Trace(_25d,_254);
-delete _25c;
-delete _25d;
-if(rval.ErrorCode!=0){
-__sp_location_handle_error(_24f,rval.ErrorCode,rval.ErrorMessage);
-return;
-}
-return rval.TransactionID;
-}
-catch(e){
-__device_handle_exception(e,"__sp_traceLocation: "+e);
-}
-};
-function __sp_clearTrace(_260){
-if(typeof _260!="number"){
-var _261="Invalid input type";
-__sp_location_handle_error(fail_cb,0,_261);
-}
-var _262={TransactionID:_260};
-try{
-var _263=this.so.ILocation.Cancel(_262);
-}
-catch(e){
-__device_handle_exception(e,"__sp_clearTrace: "+e);
-}
-};
-function __sp_location_instance(){
-this.descriptor=new __sp_location_descriptor();
-this.getLocation=__sp_getLocation;
-this.traceLocation=__sp_traceLocation;
-this.clearTrace=__sp_clearTrace;
-try{
-this.so=device.getServiceObject("Service.Location","ILocation");
-}
-catch(e){
-this.so=null;
-__device_handle_exception(e,"Location service not available");
-}
-};
+function __device_media_descriptor(_153){
+this.interfaceName=_153.interfaceName;
+this.version=_153.version;
+};
+function __device_media_getList(_154,_155,_156,_157){
+return this.provider.getList(_154,_155,_156,_157);
+};
+function __device_media_getThumbnail(_158,_159,_15a){
+return this.provider.getThumbnail(_158,_159,_15a);
+};
+function __device_media_addStreamUri(uri){
+return this.provider.addStreamUri(uri);
+};
+function __device_media_deleteStreamUri(uri){
+return this.provider.deleteStreamUri(uri);
+};
+function __device_media_cancel(_15d){
+this.provider.cancel(_15d);
+};
+function __device_media_refreshMediaDb(uri){
+this.provider.refreshMediaDb(uri);
+};
+function __device_media(_15f){
+this.provider=_15f;
+this.interfaceName=_15f.descriptor.interfaceName;
+this.version=_15f.descriptor.version;
+this.SORT_ASCENDING=0;
+this.SORT_DESCENDING=1;
+this.getList=__device_media_getList;
+this.getThumbnail=__device_media_getThumbnail;
+this.addStreamUri=__device_media_addStreamUri;
+this.deleteStreamUri=__device_media_deleteStreamUri;
+this.refreshMediaDb=__device_media_refreshMediaDb;
+this.cancel=__device_media_cancel;
+};
+var __device_media_service_entry={"name":null,"version":null,"proto":__device_media,"descriptor":__device_media_descriptor,"providers":[{"descriptor":__sp_media_descriptor,"instance":__sp_media_instance}]};
+function __device_media_descriptor(_160){
+this.interfaceName=_160.interfaceName;
+this.version=_160.version;
+};
+function __device_media_getList(_161,_162,_163,_164){
+return this.provider.getList(_161,_162,_163,_164);
+};
+function __device_media_getThumbnail(_165,_166,_167){
+return this.provider.getThumbnail(_165,_166,_167);
+};
+function __device_media_addStreamUri(uri){
+return this.provider.addStreamUri(uri);
+};
+function __device_media_deleteStreamUri(uri){
+return this.provider.deleteStreamUri(uri);
+};
+function __device_media_cancel(_16a){
+this.provider.cancel(_16a);
+};
+function __device_media_refreshMediaDb(uri){
+this.provider.refreshMediaDb(uri);
+};
+function __device_media(_16c){
+this.provider=_16c;
+this.interfaceName=_16c.descriptor.interfaceName;
+this.version=_16c.descriptor.version;
+this.SORT_ASCENDING=0;
+this.SORT_DESCENDING=1;
+this.getList=__device_media_getList;
+this.getThumbnail=__device_media_getThumbnail;
+this.addStreamUri=__device_media_addStreamUri;
+this.deleteStreamUri=__device_media_deleteStreamUri;
+this.refreshMediaDb=__device_media_refreshMediaDb;
+this.cancel=__device_media_cancel;
+};
+var __device_media_service_entry={"name":null,"version":null,"proto":__device_media,"descriptor":__device_media_descriptor,"providers":[{"descriptor":__sp_media_descriptor,"instance":__sp_media_instance}]};
 var FILESCHMLEN=7;
 function __sp_media_descriptor(){
 this.interfaceName="media";
@@ -4328,84 +2372,88 @@
 this.version=1;
 }
 };
-function __sp_device_media_item_build(_264){
-if(!_264){
+function __sp_device_media_item_build(_16d){
+if(!_16d){
 return null;
 }
-var _265={};
-modifyObjectBaseProp(_265);
-if(_264.FileNameAndPath){
-var _266=_264.FileNameAndPath.replace(/\\/g,"/");
-var _267="file://";
-_265.uri=_267+_266;
-}
-if(_264.MediaType){
-var _268=_264.MediaType;
-switch(_268){
+var _16e={};
+modifyObjectBaseProp(_16e);
+if(_16d.FileNameAndPath){
+var _16f=_16d.FileNameAndPath.replace(/\\/g,"/");
+var _170="file://";
+_16e.uri=_170+_16f;
+}
+if(_16d.MediaType){
+var _171=_16d.MediaType;
+switch(_171){
 case 1:
 case 2:
-_265.type="audio";
+_16e.type="audio";
 break;
 case 3:
-_265.type="image";
+_16e.type="image";
 break;
 case 4:
-_265.type="video";
+_16e.type="video";
 break;
 case 5:
-_265.type="stream";
+_16e.type="stream";
 break;
 default:
 break;
 }
 }
-if(_264.FileName){
-if(_264.MediaType==3){
-_265.title=_264.FileName;
-}
-}
-if(_264.FileDate){
-_265.date=new Date(Date.parse(_264.FileDate));
-}
-if(_264.FileSize){
-_265.size=_264.FileSize;
-}
-if(_264.SongName){
-_265.title=_264.SongName;
-}
-if(_264.Artist){
-_265.artist=_264.Artist;
-}
-if(_264.Album){
-_265.album=_264.Album;
-}
-if(_264.Genre){
-_265.genre=_264.Genre;
-}
-if(_264.TrackNumber){
-_265.track=_264.TrackNumber;
-}
-if(_264.Composer){
-_265.composer=_264.Composer;
-}
-return _265;
+if(_16d.FileName){
+if(_16d.MediaType==3){
+_16e.title=_16d.FileName;
+}
+}
+if(_16d.FileDate){
+_16e.date=new Date(Date.parse(_16d.FileDate));
+}
+if(_16d.FileSize){
+_16e.size=_16d.FileSize;
+}
+if(_16d.SongName){
+_16e.title=_16d.SongName;
+}
+if(_16d.Artist){
+_16e.artist=_16d.Artist;
+}
+if(_16d.Album){
+_16e.album=_16d.Album;
+}
+if(_16d.Genre){
+_16e.genre=_16d.Genre;
+}
+if(_16d.TrackNumber){
+_16e.track=_16d.TrackNumber;
+}
+if(_16d.Composer){
+_16e.composer=_16d.Composer;
+}
+return _16e;
 };
 function __sp_media_iterator_get_next(){
 var item=this.iter.getNext();
 if(typeof item=="undefined"){
 return null;
 }
-var _26a=__sp_device_media_item_build(item);
+var _173=__sp_device_media_item_build(item);
 item.close();
-return _26a;
-};
-function __sp_media_iterator(_26b){
-this.iter=_26b;
+return _173;
+};
+function __sp_media_iterator(_174){
+this.iter=_174;
 this.next=__sp_media_iterator_get_next;
+this.close=function(){
+this.iter.close();
+};
 };
 function __sp_media_get_field_name(name,type){
+this.error=new DeviceException(0,"Dummy");
 if(typeof name!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Media:getList:field is of invalid type");
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:field is of invalid type");
 }
 switch(name.toLowerCase()){
 case "title":
@@ -4429,64 +2477,63 @@
 }
 };
 function __sp_media_get_sortfield_name(name,type){
+this.error=new DeviceException(0,"Dummy");
 if(typeof name!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Media:getList:sortBy is of invalid type");
-}
-var _270=name.toLowerCase();
-if(_270=="date"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:sortBy is of invalid type");
+}
+var _179=name.toLowerCase();
+if(_179=="date"){
 return "FileDate";
 }else{
 return __sp_media_get_field_name(name,type);
 }
 };
 function __sp_media_get_date_objct(date){
-var _272="";
-_272=date.getFullYear().toString();
+var _17b="";
+_17b=date.getFullYear().toString();
 if(date.getMonth()<10){
-_272=_272+("0")+(date.getMonth().toString());
-}else{
-_272=_272+(date.getMonth().toString());
+_17b=_17b+("0")+(date.getMonth().toString());
+}else{
+_17b=_17b+(date.getMonth().toString());
 }
 var day=date.getDate()-1;
 if(day<10){
-_272=_272+("0")+(day.toString());
-}else{
-_272=_272+(day.toString());
-}
-_272=_272+(":");
+_17b=_17b+("0")+(day.toString());
+}else{
+_17b=_17b+(day.toString());
+}
+_17b=_17b+(":");
 if(date.getHours()<10){
-_272=_272+("0")+(date.getHours().toString());
-}else{
-_272=_272+(date.getHours().toString());
+_17b=_17b+("0")+(date.getHours().toString());
+}else{
+_17b=_17b+(date.getHours().toString());
 }
 if(date.getMinutes()<10){
-_272=_272+("0")+(date.getMinutes().toString());
-}else{
-_272=_272+(date.getMinutes().toString());
+_17b=_17b+("0")+(date.getMinutes().toString());
+}else{
+_17b=_17b+(date.getMinutes().toString());
 }
 if(date.getSeconds()<10){
-_272=_272+("0")+(date.getSeconds().toString());
-}else{
-_272=_272+(date.getSeconds().toString());
-}
-return _272;
-};
-function __sp_media_getList(_274,_275,_276,_277){
-if(!_274){
-throw new DeviceException(MISSING_ARG_ERR,"Media:getList:Callback is missing");
-}else{
-if(typeof _274!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Media:getList:Callback is of invalid type");
-}
-}
-if(_277){
-if(typeof _277!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Media: getList: error callback is invalid");
-}
-}
-var _278=function(arg1,arg2,arg3){
-if(arg3.ErrorCode!=0){
-_277(new DeviceException(arg3.ErrorCode,"Media: getList: Operation Failed"));
+_17b=_17b+("0")+(date.getSeconds().toString());
+}else{
+_17b=_17b+(date.getSeconds().toString());
+}
+return _17b;
+};
+function __sp_media_getList_cb(arg1,arg2,arg3){
+var _180;
+var _181;
+var _182;
+_182=glob_obj.getFromArray(arg1);
+if(_182){
+_180=_182.success_cb;
+_181=_182.error_cb;
+}else{
+alert("Media : __sp_media_getList_cb: Callback not found ");
+return;
+}
+if(arg3.ErrorCode!=0&&arg3.ErrorCode!=1010){
+_181(new DeviceException(arg3.ErrorCode,"Media: getList: Operation Failed"));
 return;
 }
 if(arg2!=event_cancelled){
@@ -4494,120 +2541,163 @@
 if(arg3.ReturnValue){
 iter=new __sp_media_iterator(arg3.ReturnValue);
 }
-_274(iter);
-}
-};
-var _27d={};
-modifyObjectBaseProp(_27d);
-_27d.Type="FileInfo";
-_27d.Filter={};
-modifyObjectBaseProp(_27d.Filter);
-_27d.Sort={};
-modifyObjectBaseProp(_27d.Sort);
-if(_275){
-if(_275.type){
-if(typeof _275.type!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Media:getList:type is of invalid type");
-}
-switch(_275.type.toLowerCase()){
+_180(iter);
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_media_getList(_184,_185,_186,_187){
+if(!_184){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Media:getList:Callback is missing");
+}else{
+if(typeof _184!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:Callback is of invalid type");
+}
+}
+if(_187){
+if(typeof _187!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media: getList: error callback is invalid");
+}
+}
+if((typeof _185)!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Invalid Argument:"+_185);
+}
+if(_185){
+if(("sortBy" in _185)&&(_185.sortBy==undefined||_185.sortBy==null||_185.sortBy=="")){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media: getList: sortby is invalid");
+}
+}
+var _188={};
+modifyObjectBaseProp(_188);
+_188.Type="FileInfo";
+_188.Filter={};
+modifyObjectBaseProp(_188.Filter);
+_188.Sort={};
+modifyObjectBaseProp(_188.Sort);
+if(_185){
+if(_185.type){
+if(typeof _185.type!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:type is of invalid type");
+}
+switch(_185.type.toLowerCase()){
 case "audio":
-_27d.Filter.FileType="audio";
+_188.Filter.FileType="audio";
 break;
 case "image":
-_27d.Filter.FileType="Image";
+_188.Filter.FileType="Image";
 break;
 case "video":
-_27d.Filter.FileType="Video";
+_188.Filter.FileType="Video";
 break;
 case "stream":
-_27d.Filter.FileType="StreamingURL";
+_188.Filter.FileType="StreamingURL";
 break;
 default:
-throw new DeviceException(INVALID_ARG_ERR,"Media:getList: type is invalid");
-}
-if(_275.field!=null){
-_27d.Filter.Key=__sp_media_get_field_name(_275.field.name,_27d.Filter.FileType);
-if(_27d.Filter.Key==null){
-throw new DeviceException(INVALID_ARG_ERR,"Media:getList:key is invalid");
-}
-if(_275.field.value){
-_27d.Filter.StartRange=_275.field.value;
-if(_27d.Filter.Key=="TrackNumber"){
-_27d.Filter.EndRange=_275.field.value;
-}
-}
-}else{
-if(_275.dateRange){
-if(typeof _275.dateRange!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Media:getList:dateRange is of invalid type");
-}
-_27d.Filter.Key="FileDate";
-if((typeof _275.dateRange.start!="undefined")&&(typeof _275.dateRange.end!="undefined")){
-_27d.Filter.StartRange=__sp_media_get_date_objct(_275.dateRange.start);
-_27d.Filter.EndRange=__sp_media_get_date_objct(_275.dateRange.end);
-}else{
-throw new DeviceException(MISSING_ARG_ERR,"Media:getList:start or end of dateRange is missing");
-}
-}
-}
-if(_275.sortBy){
-_27d.Sort.Key=__sp_media_get_sortfield_name(_275.sortBy,_27d.Filter.FileType);
-if(_27d.Sort.Key==null){
-throw new DeviceException(INVALID_ARG_ERR,"Media:getList:sortBy is invalid");
-}
-}else{
-_27d.Sort.Key="FileDate";
-}
-if(_276){
-if(_276==SORT_ASCENDING){
-_27d.Sort.Order="Ascending";
-}else{
-if(_276==SORT_DESCENDING){
-_27d.Sort.Order="Descending";
-}
-}
-}else{
-_27d.Sort.Order="Ascending";
-}
-}else{
-throw new DeviceException(MISSING_ARG_ERR,"Media:type is missing");
-}
-}else{
-_27d.Filter.FileType="all";
-_27d.Sort.Key="FileDate";
-_27d.Sort.Order="Ascending";
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList: type is invalid");
+}
+if(("field" in _185)&&(_185.field==undefined||_185.field==null)){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:field is invalid");
+}
+if(_185.field!=null){
+_188.Filter.Key=__sp_media_get_field_name(_185.field.name,_188.Filter.FileType);
+if(_188.Filter.Key==null){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:key is invalid");
+}
+if(_185.field.value){
+_188.Filter.StartRange=_185.field.value;
+if(_188.Filter.Key=="TrackNumber"){
+_188.Filter.EndRange=_185.field.value;
+}
+}
+}else{
+if(_185.dateRange){
+if(typeof _185.dateRange!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:dateRange is of invalid type");
+}
+_188.Filter.Key="FileDate";
+if((typeof _185.dateRange.start!="undefined")&&(typeof _185.dateRange.end!="undefined")){
+if((typeof _185.dateRange.start!="object")||(_185.dateRange.start=="")||(_185.dateRange.start==null)){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:dateRange:start is of invalid type");
+}else{
+_188.Filter.StartRange=__sp_media_get_date_objct(_185.dateRange.start);
+}
+if((typeof _185.dateRange.end!="object")||(_185.dateRange.end=="")||(_185.dateRange.end==null)){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:dateRange:end is of invalid type");
+}else{
+_188.Filter.EndRange=__sp_media_get_date_objct(_185.dateRange.end);
+}
+}else{
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:start or end of dateRange is missing");
+}
+}else{
+if(("dateRange" in _185)&&(_185.dateRange==0||_185.dateRange==null||_185.dateRange=="")){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList: dateRange is Invalid");
+}
+}
+}
+if(_185.sortBy){
+_188.Sort.Key=__sp_media_get_sortfield_name(_185.sortBy,_188.Filter.FileType);
+if(_188.Sort.Key==null){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:sortBy is invalid");
+}
+}else{
+_188.Sort.Key="FileDate";
+}
+if(_186){
+if(_186==this.SORT_ASCENDING){
+_188.Sort.Order="Ascending";
+}else{
+if(_186==this.SORT_DESCENDING){
+_188.Sort.Order="Descending";
+}else{
+if((_186!=this.SORT_ASCENDING)||(_186!=this.SORT_DESCENDING)){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:sortBy is invalid");
+}
+}
+}
+}else{
+_188.Sort.Order="Ascending";
+}
+}else{
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Media:type is missing");
+}
+}else{
+_188.Filter.FileType="all";
+_188.Sort.Key="FileDate";
+_188.Sort.Order="Ascending";
 }
 try{
-var rval=this.so.IDataSource.GetList(_27d,_278);
-if(_27d.Sort){
-delete _27d.Sort;
-}
-if(_27d.Filter.StartRange){
-delete _27d.Filter.StartRange;
-}
-if(_27d.Filter.EndRange){
-delete _27d.Filter.EndRange;
-}
-if(_27d.Filter){
-delete _27d.Filter;
+temp_scb=_184;
+temp_ecb=_187;
+var rval=this.so.IDataSource.GetList(_188,this.getListMediaCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_184,_187);
+}
+if(_188.Sort){
+delete _188.Sort;
+}
+if(_188.Filter.StartRange){
+delete _188.Filter.StartRange;
+}
+if(_188.Filter.EndRange){
+delete _188.Filter.EndRange;
+}
+if(_188.Filter){
+delete _188.Filter;
 }
 if(rval.ErrorCode!=0){
 switch(MapErrorCode[rval.ErrorCode]){
-case MISSING_ARG_ERR:
-case INVALID_ARG_ERR:
-case err_missing_argument:
-case err_bad_argument:
-case err_InvalidService_Argument:
-case err_ServiceNotSupported:
+case this.error.MISSING_ARG_ERR:
+case this.error.INVALID_ARG_ERR:
+case this.error.NOT_SUPPORTED_ERR:
 if(rval.ErrorMessage){
-var _27f=splitErrorMessage(rval.ErrorMessage);
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getList:"+_27f);
+var _18a=splitErrorMessage(rval.ErrorMessage);
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getList:"+_18a);
 }else{
 throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getList:Operation failed");
 }
 break;
 default:
-_274(iter);
+_187(new DeviceException(MapErrorCode[rval.ErrorCode],"Media: getList: Operation Failed"));
 }
 }
 return rval.TransactionID;
@@ -4616,98 +2706,116 @@
 __device_handle_exception(e,"__sp_media_getList: "+e);
 }
 };
-function __sp_media_getThumbnail(_280,_281,_282){
-if(!_280){
-throw new DeviceException(MISSING_ARG_ERR,"Media:getThumbnail:Callback is missing");
-}else{
-if(typeof _280!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Media:getList:Callback is invalid");
-}
-}
-if(_282){
-var _283=_282;
-if(typeof _282!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Media: getThumbnail: error callback is invalid");
-}
-}
-var _284=function(arg1,arg2,arg3){
-if(arg3.ErrorCode!=0){
-_282(new DeviceException(arg3.ErrorCode,"Media: getThumbnail: Operation Failed"));
+function __sp_media_getThumbnail_cb(arg1,arg2,arg3){
+var _18e;
+var _18f;
+var _190;
+_190=glob_obj.getFromArray(arg1);
+if(_190){
+_18f=_190.success_cb;
+_18e=_190.error_cb;
+}else{
+alert("Media : __sp_media_getThumbnail_cb: Callback not found ");
+return;
+}
+if(arg3.ErrorCode!=0&&arg3.ErrorCode!=1010){
+_18e(new DeviceException(arg3.ErrorCode,"Media: getThumbnail: Operation Failed"));
 return;
 }
 if(arg2!=event_cancelled){
-var _288=null;
+var _191=null;
 if(arg3.ReturnValue){
-_288=arg3.ReturnValue.replace(/\\/g,"/");
-var _289="file://";
-_288=_289+_288;
-}
-_280(_288);
-}
-};
-var _28a={};
-modifyObjectBaseProp(_28a);
-if(_281){
-if(typeof _281!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Media:getThumbnail:thumbnailInfo is of invalid type object");
-}
-if(_281.uri){
-if(typeof _281.uri!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Media:getThumbnail:uri is not of type string");
-}
-if(_281.uri.search("file://")==0){
-url=_281.uri.slice(FILESCHMLEN);
-_28a.Url=url.replace(/\//g,"\\");
-}else{
-throw new DeviceException(INVALID_ARG_ERR,"Media:getThumbnail:uri is not in file protocol");
-}
-}else{
-throw new DeviceException(MISSING_ARG_ERR,"Media:getThumbnail:uri is missing");
-}
-}else{
-throw new DeviceException(MISSING_ARG_ERR,"Media:thumbnailInfo is missing");
-}
-if(_281.size){
-if(typeof _281.size!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Media:getThumbnail:size is not of type Object");
-}
-if((typeof _281.size.width=="undefined")&&(typeof _281.size.height=="undefined")){
-throw new DeviceException(MISSING_ARG_ERR,"Media:thumbnailInfo should have atleast width or height");
-}else{
-var _28b={};
-modifyObjectBaseProp(_28b);
-if(typeof _281.size.width!="undefined"){
-_28b.width=_281.size.width;
-}
-if(typeof _281.size.height!="undefined"){
-_28b.height=_281.size.height;
-}
-_28a.ThumbnailSize=_28b;
-delete _28b;
+_191=arg3.ReturnValue.replace(/\\/g,"/");
+var _192="file://";
+_191=_192+_191;
+}
+_18f(_191);
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_media_getThumbnail(_193,_194,_195){
+if(!_193){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Media:getThumbnail:Callback is missing");
+}else{
+if(typeof _193!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:Callback is invalid");
+}
+}
+if(_195){
+var _196=_195;
+if(typeof _195!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media: getThumbnail: error callback is invalid");
+}
+}
+var _197={};
+modifyObjectBaseProp(_197);
+if(_194){
+if(typeof _194!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getThumbnail:thumbnailInfo is of invalid type object");
+}
+if(_194.uri){
+if(typeof _194.uri!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getThumbnail:uri is not of type string");
+}
+if(_194.uri.search("file://")==0){
+url=_194.uri.slice(FILESCHMLEN);
+_197.Url=url.replace(/\//g,"\\");
+}else{
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getThumbnail:uri is not in file protocol");
+}
+}else{
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Media:getThumbnail:uri is missing");
+}
+}else{
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Media:thumbnailInfo is missing");
+}
+if(_194.size==null||_194.size==""){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getThumbnail:size is not of type Object");
+}
+if(_194.size){
+if(typeof _194.size!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getThumbnail:size is not of type Object");
+}
+if((typeof _194.size.width=="undefined")&&(typeof _194.size.height=="undefined")){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Media:thumbnailInfo should have atleast width or height");
+}else{
+var _198={};
+modifyObjectBaseProp(_198);
+if(typeof _194.size.width!="undefined"){
+_198.width=_194.size.width;
+}
+if(typeof _194.size.height!="undefined"){
+_198.height=_194.size.height;
+}
+_197.ThumbnailSize=_198;
+delete _198;
 }
 }
 try{
-var rval=this.so.IDataSource.GetThumbnail(_28a,_284);
-delete _28a;
+temp_scb=_193;
+temp_ecb=_195;
+var rval=this.so.IDataSource.GetThumbnail(_197,this.getThumbnailCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_193,_195);
+}
+delete _197;
 if(rval.ErrorCode!=0){
 switch(MapErrorCode[rval.ErrorCode]){
-case MISSING_ARG_ERR:
-_282(new DeviceException(MISSING_ARG_ERR,"Media: getThumbnail: Operation Failed"));
-break;
-case NOT_SUPPORTED_ERR:
-_282(new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getThumbnail:"+_28d));
-break;
-case INVALID_ARG_ERR:
-case NOT_SUPPORTED_ERR:
-if(rval.ErrorMessage){
-var _28d=splitErrorMessage(rval.ErrorMessage);
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getThumbnail:"+_28d);
+case this.error.MISSING_ARG_ERR:
+_195(new DeviceException(this.error.MISSING_ARG_ERR,"Media: getThumbnail: Operation Failed"));
+break;
+case this.error.NOT_SUPPORTED_ERR:
+_195(new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getThumbnail:Operation failed"));
+break;
+case this.error.INVALID_ARG_ERR:
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getThumbnail:Operation failed");
+break;
+default:
+if(_195){
+_195(new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getThumbnail:Operation failed"));
 }else{
 throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getThumbnail:Operation failed");
 }
-break;
-default:
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getThumbnail:Operation failed");
 }
 }
 return rval.TransactionID;
@@ -4724,23 +2832,23 @@
 };
 function __sp_media_refreshMediaDb(uri){
 };
-function __sp_media_cancel(_291){
+function __sp_media_cancel(_19d){
 try{
-var rval=this.so.IDataSource.Cancel(_291);
+var rval=this.so.IDataSource.Cancel(_19d);
 if(rval.ErrorCode!=0){
 switch(rval.ErrorCode){
-case err_missing_argument:
-case err_bad_argument:
-case err_InvalidService_Argument:
-case err_ServiceNotSupported:
+case this.error.MISSING_ARG_ERR:
+case this.error.INVALID_ARG_ERR:
+case this.error.NOT_SUPPORTED_ERR:
 if(rval.ErrorMessage){
-var _293=splitErrorMessage(rval.ErrorMessage);
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:cancel:"+_293);
+var _19f=splitErrorMessage(rval.ErrorMessage);
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:cancel:"+_19f);
 }else{
 throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:cancel:Operation failed");
 }
 break;
 default:
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:cancel:Operation failed");
 }
 }
 }
@@ -4750,12 +2858,17 @@
 };
 function __sp_media_instance(){
 this.descriptor=new __sp_media_descriptor();
+this.SORT_ASCENDING=0;
+this.SORT_DESCENDING=1;
 this.getList=__sp_media_getList;
+this.getListMediaCb=__sp_media_getList_cb;
 this.getThumbnail=__sp_media_getThumbnail;
+this.getThumbnailCb=__sp_media_getThumbnail_cb;
 this.addStreamUri=__sp_media_addStreamUri;
 this.deleteStreamUri=__sp_media_deleteStreamUri;
 this.refreshMediaDb=__sp_media_refreshMediaDb;
 this.cancel=__sp_media_cancel;
+this.error=new DeviceException(0,"Dummy");
 try{
 this.so=device.getServiceObject("Service.MediaManagement","IDataSource");
 }
@@ -4764,836 +2877,31 @@
 __device_handle_exception(e,"media service not available");
 }
 };
-var FILE_SCHEME="file://";
-var INVALID_URI_ERR=108;
-function __sp_messaging_descriptor(){
-this.interfaceName="messaging";
-if(window.__Service_Interface_Ver){
-this.version=__Service_Interface_Ver;
-}else{
-this.version=1;
-}
-};
-function __sp_messaging_instance(){
-this.descriptor=new __sp_messaging_descriptor();
-this.startEditor=__sp_messaging_startEditor;
-this.getList=__sp_messaging_getList;
-this.send=__sp_messaging_send;
-this.setNotifier=__sp_messaging_setNotifier;
-this.cancelNotifier=__sp_messaging_cancelNotifier;
-this.getMessage=__sp_messaging_getMessage;
-this.deleteMessage=__sp_messaging_delete;
-this.setStatus=__sp_messaging_setStatus;
-this.cancel=__sp_messaging_cancel;
-this.sendCommon=__sp_messaging_send_common;
-this.SORT_ASCENDING=0;
-this.SORT_DESCENDING=1;
-this.SORT_BY_DATE=0;
-this.SORT_BY_SENDER=1;
-this.STATUS_READ=0;
-this.STATUS_UNREAD=1;
-try{
-this.so=device.getServiceObject("Service.Messaging","IMessaging");
-}
-catch(e){
-this.so=null;
-__device_handle_exception(e,"Messaging service not available");
-}
-};
-function __sp_attachment_build(_294){
-if(!_294){
-return null;
-}
-var _295={};
-modifyObjectBaseProp(_295);
-if(_294.uri){
-if(typeof _294.uri!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"uri is invalid");
-}
-if(_294.uri.slice(0,7)==FILE_SCHEME){
-if(_294.uri.charAt(7)=="/"){
-if(_294.uri.charAt(9)!=":"){
-throw new DeviceException(URI_NOT_FOUND_ERR,"specified uri not found");
-}
-_295.FileName=_294.uri.slice(8).replace(/\057/g,"\\");
-if(_295.FileName.length>256){
-throw new DeviceException(DATA_OUT_OF_RANGE_ERR,"uri is out of range");
-}
-}else{
-if(_294.uri.charAt(8)!=":"){
-throw new DeviceException(URI_NOT_FOUND_ERR,"specified uri not found");
-}
-_295.FileName=_294.uri.slice(7).replace(/\057/g,"\\");
-if(_295.FileName.length>256){
-throw new DeviceException(DATA_OUT_OF_RANGE_ERR,"uri is out of range");
-}
-}
-}else{
-throw new DeviceException(INVALID_URI_ERR,"uri is invalid");
-}
-}
-return _295;
-};
-function __sp_message_build(_296,id){
-if(!_296){
-return null;
-}
-var _298={};
-modifyObjectBaseProp(_298);
-var _299=0;
-_298.MessageParam={};
-modifyObjectBaseProp(_298.MessageParam);
-_298.MessageParam.LaunchEditor=false;
-_298.MessageType=(_296.type==undefined||_296.type==null)?"SMS":_296.type;
-if(_296.to){
-if(typeof (_296.to)=="string"){
-_298.To=_296.to;
-}else{
-if(__device_typeof(_296.to)=="Array"&&_296.to.length>0){
-if(_296.to[0]){
-_298.To=_296.to[0];
-}
-if(_296.to.length>1){
-if(_296.to.slice(1)){
-_298.MessageParam.To=_296.to.slice(1);
-}
-}
-}else{
-_298.To=_296.to;
-}
-}
-}
-if(_296.cc){
-_298.MessageParam.Cc=_296.cc;
-}
-if(id){
-if((typeof (id)=="string")&&!(isNaN(id))){
-id=Number(id);
-}
-_298.MessageParam.TemplateId=id;
-}
-if(_298.MessageType=="SMS"){
-if(_296.body){
-_298.BodyText=_296.body;
-}
-}
-if(_298.MessageType=="MMS"){
-if(_296.body){
-_298.BodyText=_296.body;
-}
-if(_296.subject){
-if(typeof _296.subject=="string"&&_296.subject.length>256){
-throw new DeviceException(DATA_OUT_OF_RANGE_ERR,"subject length is greater than 256 characters");
-}
-_298.Subject=_296.subject;
-}
-if(_296.attachments){
-_298.MessageParam.AttachmentList=[];
-for(var a in _296.attachments){
-if(typeof _296.attachments[a]=="object"&&__device_typeof(_296.attachments[a])!="Array"){
-_298.MessageParam.AttachmentList.push(__sp_attachment_build(_296.attachments[a]));
-_299=1;
-}
-}
-if(_299==0){
-throw new DeviceException(INVALID_ARG_ERR,"uri is invalid");
-}
-}
-}
-return _298;
-};
-function __sp_device_attachment_build(_29b){
-if(!_29b){
-return null;
-}
-var _29c={};
-_29c.uri=FILE_SCHEME+_29b.FileName;
-return _29c;
-};
-function __sp_device_message_build(_29d){
-if(!_29d){
-return null;
-}
-var _29e={};
-_29e.body=null;
-_29e.subject=null;
-_29e.attachments=null;
-_29e.to=null;
-_29e.cc=null;
-_29e.type=_29d.MessageType;
-if(_29d.BodyText){
-_29e.body=_29d.BodyText;
-}
-if(_29d.to){
-_29e.to=_29d.To;
-}
-if(_29d.Subject){
-_29e.subject=_29d.Subject;
-}
-_29e.attachment=false;
-if(_29e.type=="MMS"){
-if(_29d.Cc){
-_29e.cc=_29d.Cc;
-}
-if(_29d.AttachmentList){
-_29e.attachment=true;
-_29e.attachments=[];
-for(var a in _29d.AttachmentList){
-if(_29d.AttachmentList.hasOwnProperty("a")){
-_29e.attachments.push(__sp_device_attachment_build(_29d.AttachmentList[a]));
-}
-}
-}
-}
-return _29e;
-};
-function __sp_device_message_info_build_notifier(_2a0){
-if(!_2a0){
-return null;
-}
-var _2a1={};
-_2a1.message={};
-_2a1.message.type=_2a0.MessageType;
-_2a1.sender=_2a0.Sender;
-_2a1.message.subject=_2a0.Subject;
-_2a1.time=_2a0.Time;
-_2a1.attachments=(_2a0.Attachments==undefined||_2a0.Attachments==null)?(!(_2a0.AttachmentList==undefined||_2a0.AttachmentList==null)):_2a0.Attachments;
-_2a1.unread=_2a0.Unread;
-_2a1.id=(_2a0.MessageId).toString();
-return _2a1;
-};
-function __sp_device_message_info_build(_2a2){
-if(!_2a2){
-return null;
-}
-var _2a3={};
-_2a3.message=__sp_device_message_build(_2a2);
-_2a3.sender=_2a2.Sender;
-_2a3.time=_2a2.Time;
-_2a3.unread=_2a2.Unread;
-_2a3.id=(_2a2.MessageId).toString();
-return _2a3;
-};
-function __sp_message_iterator_get_next(){
-var _2a4=this.iter.getNext();
-if(typeof _2a4=="undefined"){
-return null;
-}
-var _2a5=__sp_device_message_info_build(_2a4);
-_2a4.close();
-return _2a5;
-};
-function __sp_message_iterator(_2a6){
-this.iter=_2a6;
-this.next=__sp_message_iterator_get_next;
-};
-function __sp_messaging_getList(_2a7,_2a8,_2a9,_2aa,_2ab){
-a("in getlist");
-if(!_2a7){
-throw new DeviceException(MISSING_ARG_ERR,"Messaging:getList:callback is missing");
-}else{
-if(typeof _2a7!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:getList:callback is not a function");
-}
-}
-if(_2a8!=null&&_2a8!=undefined&&typeof _2a8!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:getList:match is invalid");
-}
-if(_2a9!=null&&_2a9!=undefined&&typeof _2a9!="number"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:getList:sortkey is invalid");
-}
-if(_2aa!=null&&_2aa!=undefined&&typeof _2aa!="number"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:getList:sortorder is invalid");
-}
-if(_2a9!=null&&_2a9!=undefined&&typeof _2a9=="number"){
-if((_2a9!=0)&&(_2a9!=1)){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:getList:sortkey is invalid");
-}
-}
-if(_2aa!=null&&_2aa!=undefined&&typeof _2aa=="number"){
-if((_2aa!=0)&&(_2aa!=1)){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:getList:sortorder is invalid");
-}
-}
-if(_2ab){
-if(typeof (_2ab)!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging: startEditor: ErrorCallback is invalid");
-}
-}
-var _2ac=function(arg1,arg2,arg3){
-var _2b0=_2a7;
-var _2b1=_2ab;
-var iter=null;
-if(arg3.ErrorCode!=0){
-if(arg3.ErrorMessage){
-_2b3=splitErrorMessage(arg3.ErrorMessage);
-}else{
-_2b3="Operation Failed";
-}
-if(_2b1){
-_2b1(new DeviceException(MapErrorCode[arg3.ErrorCode],"Messaging: getList: "+_2b3));
-return;
-}
-}else{
-if(arg3.ReturnValue){
-iter=new __sp_message_iterator(arg3.ReturnValue);
-}
-}
-if(arg2!=event_cancelled){
-_2b0(iter);
-}
-};
-var _2b4={};
-modifyObjectBaseProp(_2b4);
-_2b4.Type="Inbox";
-_2b4.Filter={};
-modifyObjectBaseProp(_2b4.Filter);
-if(_2a8){
-if(_2a8.type!=null&&_2a8.type!=undefined){
-_2b4.Filter.MessageTypeList=_2a8.type;
-}
-if(_2a8.senders!=null&&_2a8.senders!=undefined){
-_2b4.Filter.SenderList=_2a8.senders;
-}
-if(_2a8.subject!=null&&_2a8.subject!=undefined){
-if(_2a8.subject.length>256){
-if(_2ab){
-_2ab(new DeviceException(DATA_OUT_OF_RANGE_ERR,"Messaging:getList:subject is out of range"));
-return;
-}else{
-throw new DeviceException(DATA_OUT_OF_RANGE_ERR,"Messaging:getList:subject is out of range");
-}
-}else{
-_2b4.Filter.Subject=_2a8.subject;
-}
-}
-if(_2a8.start!=null&&_2a8.start!=undefined){
-_2b4.Filter.StartDate=_2a8.start;
-}
-if(_2a8.end!=null&&_2a8.end!=undefined){
-_2b4.Filter.EndDate=_2a8.end;
-}
-}
-if(_2a9||_2aa){
-_2b4.SortOrder={};
-modifyObjectBaseProp(_2b4.SortOrder);
-if(_2a9){
-if((_2a9==this.SORT_BY_DATE)){
-_2b4.SortOrder.Key="Date";
-}else{
-if((_2a9==this.SORT_BY_SENDER)){
-_2b4.SortOrder.Key="Sender";
-}
-}
-}else{
-_2b4.SortOrder.Key="Date";
-}
-if(_2aa){
-if((_2aa==this.SORT_ASCENDING)){
-_2b4.SortOrder.Order="Ascending";
-}else{
-if((_2aa==this.SORT_DESCENDING)){
-_2b4.SortOrder.Order="Descending";
-}
-}
-}else{
-_2b4.SortOrder.Order="Ascending";
-}
-}
-try{
-var _2b5=this.so.IMessaging.GetList(_2b4,_2ac);
-if(_2b4){
-delete _2b4.Filter;
-delete _2b4.SortOrder;
-delete _2b4.Type;
-}
-if(_2b5.ErrorCode!=0){
-var _2b3="operation failed";
-if(_2b5.ErrorMessage){
-_2b3=splitErrorMessage(_2b5.ErrorMessage);
-}
-switch(MapErrorCode[_2b5.ErrorCode]){
-case INVALID_ARG_ERR:
-case MISSING_ARG_ERR:
-case NOT_SUPPORTED_ERR:
-throw new DeviceException(MapErrorCode[_2b5.ErrorCode],"Messaging:getList:"+_2b3);
-break;
-default:
-if(_2ab){
-setTimeout(function(){
-_2ab(new DeviceException(MapErrorCode[_2b5.ErrorCode],"Messaging:getList:"+_2b3));
-},500);
-}else{
-throw new DeviceException(MapErrorCode[_2b5.ErrorCode],"Messaging:getList:"+_2b3);
-}
-}
-}
-return _2b5.TransactionID;
-}
-catch(e){
-__device_handle_exception(e,"__sp_messaging_getList: "+e);
-}
-};
-function __sp_messaging_send_common(_2b6,_2b7,_2b8,id,eCB){
-var _2bb=function(arg1,arg2,arg3){
-if(_2b8){
-var _2bf="operation failed";
-if(arg3.ErrorCode!=0){
-if(arg3.ErrorMessage){
-_2bf=splitErrorMessage(arg3.ErrorMessage);
-}
-if(eCB){
-setTimeout(function(){
-eCB(new DeviceException(MapErrorCode[arg3.ErrorCode],"Messaging: send: "+_2bf));
-},500);
-return;
-}
-}
-if(arg2!=event_cancelled){
-_2b8();
-}
-}
-};
-var _2c0=__sp_message_build(_2b6,id);
-_2c0.MessageParam.LaunchEditor=_2b7;
-var _2c1;
-if(_2b7==false){
-_2c1=this.so.IMessaging.Send(_2c0,_2bb);
-if(_2c1.ErrorCode!=0){
-var _2c2="operation failed";
-if(_2c1.ErrorMessage){
-_2c2=splitErrorMessage(_2c1.ErrorMessage);
-}
-switch(MapErrorCode[_2c1.ErrorCode]){
-case INVALID_ARG_ERR:
-case MISSING_ARG_ERR:
-case NOT_SUPPORTED_ERR:
-throw new DeviceException(MapErrorCode[_2c1.ErrorCode],_2c2);
-break;
-default:
-if(eCB){
-setTimeout(function(){
-eCB(new DeviceException(MapErrorCode[_2c1.ErrorCode],_2c2));
-},500);
-return;
-}else{
-throw new DeviceException(MapErrorCode[_2c1.ErrorCode],_2c2);
-}
-}
-}
-var _2c3=_2c1.TransactionID;
-return _2c3;
-}else{
-_2c1=this.so.IMessaging.Send(_2c0);
-if(_2c1.ErrorCode!=0){
-if(_2c1.ErrorMessage){
-var _2c4=splitErrorMessage(_2c1.ErrorMessage);
-throw new DeviceException(MapErrorCode[_2c1.ErrorCode],"Messaging:startEditor"+_2c4);
-}else{
-throw new DeviceException(MapErrorCode[_2c1.ErrorCode],"Messaging:startEditor:operation failed");
-}
-}
-}
-if(_2c0){
-delete _2c0.MessageParam;
-}
-};
-function __sp_messaging_startEditor(_2c5){
-if(!_2c5){
-throw new DeviceException(MISSING_ARG_ERR,"Messaging:startEditor:message is missing");
-}else{
-if(typeof _2c5!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:startEditor:message is invalid");
-}
-}
-if((_2c5.subject)){
-if((_2c5.subject).length>256){
-throw new DeviceException(DATA_OUT_OF_RANGE_ERR,"Messaging:startEditor:subject is too lengthy");
-}
-}
-if(_2c5.to==undefined||_2c5.to==null){
-throw new DeviceException(MISSING_ARG_ERR,"Messaging:startEditor:to field is missing");
-}
-if(_2c5.attachments!=undefined&&_2c5.attachments!=null&&typeof _2c5.attachments!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:startEditor:attachment is invalid");
-}
-if(_2c5){
-if(_2c5.body){
-if(typeof (_2c5.body)!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:startEditor:body is invalid");
-}
-}
-}
-try{
-this.sendCommon(_2c5,true,null);
-}
-catch(e){
-var _2c6=null;
-if(e.message){
-_2c6=new DeviceException(e.code,"Messaging:startEditor:"+e.message);
-}else{
-_2c6=new DeviceException(e.code,"Messaging:startEditor:operation failed");
-}
-__device_handle_exception(_2c6,"__sp_messaging_startEditor: "+_2c6);
-}
-};
-function __sp_messaging_send(_2c7,_2c8,id,_2ca){
-if(!_2c8){
-throw new DeviceException(MISSING_ARG_ERR,"Messaging:send:message is missing");
-}else{
-if(typeof _2c8!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:send:message is invalid");
-}
-}
-if(!_2c7){
-throw new DeviceException(MISSING_ARG_ERR,"Messaging:send:callback is missing");
-}else{
-if(typeof _2c7!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:send:callback is invalid");
-}
-}
-if(_2c8.to==undefined||_2c8.to==null){
-throw new DeviceException(MISSING_ARG_ERR,"Messaging:send:to field is missing");
-}
-if(_2c8.attachments!=undefined&&_2c8.attachments!=null&&typeof _2c8.attachments!="object"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:send:attachment is invalid");
-}
-if(!id){
-id="";
-}
-if((typeof id)=="function"){
-var _2cb=id;
-id="";
-_2ca=_2cb;
-}
-if((typeof _2ca)=="undefined"||_2ca==null){
-_2ca=null;
-}else{
-if((typeof _2ca)!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:send:errorCallback is not a function");
-}
-}
-var _2cc=function(arg1,arg2,arg3){
-var _2d0=_2c7;
-var _2d1=_2ca;
-var iter=null;
-if(arg3.ErrorCode!=0){
-var _2d3;
-if(arg3.ErrorMessage){
-_2d3=splitErrorMessage(arg3.ErrorMessage);
-}else{
-_2d3="Operation Failed";
-}
-_2d1(new DeviceException(MapErrorCode[arg3.ErrorCode],"Messaging:startEditor: "+_2d3));
-return;
-}else{
-if(arg3.ReturnValue){
-iter=new __sp_message_iterator(arg3.ReturnValue);
-_2d0(iter);
-}
-}
-if(arg2!=event_cancelled){
-_2d0(iter);
-}
-};
-try{
-var _2d4=this.sendCommon(_2c8,false,_2c7,id,_2ca);
-return _2d4;
-}
-catch(e){
-var _2d5=null;
-switch(e.code){
-case INVALID_ARG_ERR:
-case MISSING_ARG_ERR:
-case NOT_SUPPORTED_ERR:
-throw new DeviceException(e.code,"Messaging:send:"+e.message);
-break;
-default:
-if(_2ca){
-setTimeout(function(){
-_2ca(new DeviceException(e.code,"Messaging:send:"+e.message));
-},1000);
-}else{
-throw new DeviceException(e.code,"Messaging:send:"+e.message);
-}
-}
-}
-};
-function __sp_messaging_setNotifier(_2d6,_2d7){
-if(!_2d6){
-throw new DeviceException(MISSING_ARG_ERR,"Messaging:setNotifier:callback is missing");
-}else{
-if(typeof _2d6!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:setNotifier:callback is invalid");
-}
-}
-if(_2d7){
-if(typeof (_2d7)!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:setNotifier: ErrorCallback is invalid");
-}
-}
-var _2d8=function(arg1,arg2,arg3){
-var _2dc=_2d6;
-var _2dd=_2d7;
-var _2de=null;
-var _2df=null;
-if(arg3.ErrorCode!=0){
-if(arg3.ErrorMessage){
-_2df=splitErrorMessage(arg3.ErrorMessage);
-}else{
-_2df="operation failed";
-}
-if(_2dd){
-_2dd(new DeviceException(MapErrorCode[arg3.ErrorCode],"Messaging:setNotifier: "+_2df));
-return;
-}
-}else{
-if(arg3.ReturnValue){
-_2de=new __sp_device_message_info_build_notifier(arg3.ReturnValue);
-arg3.ReturnValue.close();
-}
-}
-if(arg2!=event_cancelled){
-_2dc(_2de.id);
-}
-};
-var _2e0={};
-modifyObjectBaseProp(_2e0);
-_2e0.Type="NewMessage";
-try{
-var _2e1=this.so.IMessaging.RegisterNotification(_2e0,_2d8);
-if(_2e0){
-delete _2e0.Type;
-}
-if(_2e1.ErrorCode!=0){
-var _2e2="operation failed";
-if(_2e1.ErrorMessage){
-_2e2=splitErrorMessage(_2e1.ErrorMessage);
-}
-switch(MapErrorCode[_2e1.ErrorCode]){
-case INVALID_ARG_ERR:
-case MISSING_ARG_ERR:
-case NOT_SUPPORTED_ERR:
-throw new DeviceException(MapErrorCode[_2e1.ErrorCode],"Messaging:setNotifier:"+_2e2);
-break;
-default:
-if(_2d7){
-setTimeout(function(){
-_2d7(new DeviceException(MapErrorCode[_2e1.ErrorCode],"Messaging:setNotifier:"+_2e2));
-},1000);
-}else{
-throw new DeviceException(MapErrorCode[_2e1.ErrorCode],"Messaging:setNotifier:"+_2e2);
-}
-}
-}
-var _2e3=_2e1.TransactionID;
-return _2e3;
-}
-catch(e){
-__device_handle_exception(e,"__sp_messaging_setNotifier: "+e.toString());
-}
-};
-function __sp_messaging_cancelNotifier(){
-var _2e4={};
-modifyObjectBaseProp(_2e4);
-_2e4.Type="NewMessage";
-try{
-var _2e5=this.so.IMessaging.CancelNotification(_2e4);
-if(_2e4){
-delete _2e4.Type;
-}
-if(_2e5.ErrorCode!=0){
-if(_2e5.ErrorMessage){
-var _2e6=splitErrorMessage(_2e5.ErrorMessage);
-throw new DeviceException(MapErrorCode[_2e5.ErrorCode],"Messaging:cancelNotifier"+_2e6);
-}else{
-throw new DeviceException(MapErrorCode[_2e5.ErrorCode],"Messaging:cancelNotifier:operation failed");
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_messaging_cancelNotifier: "+e);
-}
-};
-function __sp_messaging_getMessage(id){
-if(!id){
-throw new DeviceException(MISSING_ARG_ERR,"Messaging:getMessage:id is missing");
-}else{
-if((typeof id)!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:getMessage:MessageId should be a string");
-}
-}
-if((typeof id=="string")&&!(isNaN(id))){
-id=Number(id);
-if(id==0){
-throw new DeviceException(DATA_NOT_FOUND_ERR,"Messaging:getMessage:id not found");
-}
-if(id<0){
-throw new DeviceException(DATA_OUT_OF_RANGE_ERR,"Messaging:getMessage:id is out of range");
-}
-}
-var _2e8={};
-modifyObjectBaseProp(_2e8);
-_2e8.Type="Inbox";
-_2e8.Filter={};
-modifyObjectBaseProp(_2e8.Filter);
-_2e8.Filter.MessageId=id;
-try{
-var _2e9=this.so.IMessaging.GetList(_2e8);
-if(_2e8){
-delete _2e8.Filter;
-delete _2e8.Type;
-}
-if(_2e9.ErrorCode!=0){
-if(_2e9.ErrorMessage){
-var _2ea=splitErrorMessage(_2e9.ErrorMessage);
-throw new DeviceException(MapErrorCode[_2e9.ErrorCode],"Messaging:getMessage"+_2ea);
-}else{
-throw new DeviceException(MapErrorCode[_2e9.ErrorCode],"Messaging:getMessage:operation failed");
-}
-}
-if(_2e9.ReturnValue){
-var iter=new __sp_message_iterator(_2e9.ReturnValue);
-var _2ec=iter.next();
-if(_2ec){
-return _2ec;
-}else{
-throw new DeviceException(DATA_NOT_FOUND_ERR,"Messaging:getMessage:id not found");
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_messaging_getMessage: "+e);
-}
-};
-function __sp_messaging_delete(id){
-a("messageId"+typeof id);
-if(!id){
-throw new DeviceException(MISSING_ARG_ERR,"Messaging:delete:id is missing");
-}else{
-if((typeof id)!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:deleteMessage:MessageId should be a string");
-}
-}
-if((typeof id=="string")&&!(isNaN(id))){
-id=Number(id);
-if(id==0){
-throw new DeviceException(DATA_NOT_FOUND_ERR,"Messaging:delete:id not found");
-}
-if(id<0){
-throw new DeviceException(DATA_OUT_OF_RANGE_ERR,"Messaging:delete:id is out of range");
-}
-}
-var _2ee={};
-modifyObjectBaseProp(_2ee);
-_2ee.MessageId=id;
-try{
-var _2ef=this.so.IMessaging.Delete(_2ee);
-a("MapErrorCode[ result.ErrorCode ]"+MapErrorCode[_2ef.ErrorCode]);
-if(_2ee){
-delete _2ee.MessageId;
-}
-if(_2ef.ErrorCode!=0){
-if(_2ef.ErrorMessage){
-var _2f0=splitErrorMessage(_2ef.ErrorMessage);
-throw new DeviceException(MapErrorCode[_2ef.ErrorCode],"Messaging:delete"+_2f0);
-}else{
-throw new DeviceException(MapErrorCode[_2ef.ErrorCode],"Messaging:delete:operation failed");
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_messaging_delete: "+e);
-}
-};
-function __sp_messaging_setStatus(id,_2f2){
-if(id==null||id==undefined||(id.length)<=0){
-throw new DeviceException(MISSING_ARG_ERR,"Messaging:setStatus:id is missing");
-}
-if((typeof id)!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:setStatus:id should be string");
-}
-if(_2f2==null||_2f2==undefined){
-throw new DeviceException(MISSING_ARG_ERR,"Messaging:setStatus:status is missing");
-}
-if(typeof _2f2!="number"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:setStatus:status is invalid");
-}
-if(typeof _2f2=="number"&&_2f2!=0&&_2f2!=1){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:setStatus:status is invalid");
-}
-if((typeof id=="string")&&!(isNaN(id))){
-id=Number(id);
-if(id==0){
-throw new DeviceException(DATA_NOT_FOUND_ERR,"Messaging:setStatus:id not found");
-}
-if(id<0){
-throw new DeviceException(DATA_OUT_OF_RANGE_ERR,"Messaging:setStatus:id is out of range");
-}
-}
-var _2f3={};
-modifyObjectBaseProp(_2f3);
-_2f3.MessageId=id;
-if((_2f2==this.STATUS_UNREAD)){
-_2f3.Status="Unread";
-}else{
-if((_2f2==this.STATUS_READ)){
-a("in read");
-_2f3.Status="Read";
-}
-}
-try{
-var _2f4=this.so.IMessaging.ChangeStatus(_2f3);
-if(_2f3){
-delete _2f3.MessageId;
-delete _2f3.Status;
-}
-if(_2f4.ErrorCode!=0){
-if(_2f4.ErrorMessage){
-var _2f5=splitErrorMessage(_2f4.ErrorMessage);
-throw new DeviceException(MapErrorCode[_2f4.ErrorCode],"Messaging:setStatus"+_2f5);
-}else{
-throw new DeviceException(MapErrorCode[_2f4.ErrorCode],"Messaging:setStatus:operation failed");
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_messaging_setStatus: "+e);
-}
-};
-function __sp_messaging_cancel(_2f6){
-if(_2f6==null||_2f6==undefined){
-throw new DeviceException(MISSING_ARG_ERR,"Messaging:setStatus:id is missing");
-}
-if(typeof _2f6!="number"){
-throw new DeviceException(INVALID_ARG_ERR,"Messaging:cancel:id is invalid");
-}
-var _2f7={};
-modifyObjectBaseProp(_2f7);
-_2f7.TransactionID=_2f6;
-try{
-var _2f8=this.so.IMessaging.Cancel(_2f7);
-if(_2f7){
-delete _2f7.TransactionID;
-}
-if(_2f8.ErrorCode!=0){
-var err;
-if(_2f8.ErrorCode==1000){
-err=DATA_NOT_FOUND_ERR;
-}else{
-err=MapErrorCode[_2f8.ErrorCode];
-}
-if(_2f8.ErrorMessage){
-var _2fa=splitErrorMessage(_2f8.ErrorMessage);
-throw new DeviceException(err,"Messaging:cancel"+_2fa);
-}else{
-throw new DeviceException(err,"Messaging:cancel:operation failed");
-}
-}
-}
-catch(e){
-__device_handle_exception(e,"__sp_messaging_setStatus: "+e);
-}
+var __device_sensors_service_entry={"name":null,"version":null,"proto":__device_sensors,"descriptor":__device_sensors_descriptor,"providers":[{"descriptor":__sp_sensors_descriptor,"instance":__sp_sensors_instance}]};
+function __device_sensors(_1a0){
+this.provider=_1a0;
+this.interfaceName=_1a0.descriptor.interfaceName;
+this.version=_1a0.descriptor.version;
+this.getChannels=__device_sensors_getChannels;
+this.startChannel=__device_sensors_setNotifier;
+this.stopChannel=__device_sensors_cancelNotifier;
+this.getScaleFactor=__device_sensors_getScaleFactor;
+};
+function __device_sensors_descriptor(_1a1){
+this.interfaceName=_1a1.interfaceName;
+this.version=_1a1.version;
+};
+function __device_sensors_getChannels(){
+return this.provider.getChannels();
+};
+function __device_sensors_setNotifier(_1a2,_1a3,_1a4){
+return this.provider.startChannel(_1a2,_1a3,_1a4);
+};
+function __device_sensors_cancelNotifier(_1a5){
+return this.provider.stopChannel(_1a5);
+};
+function __device_sensors_getScaleFactor(_1a6){
+return this.provider.getScaleFactor(_1a6);
 };
 function __sp_sensors_descriptor(){
 this.interfaceName="sensors";
@@ -5622,161 +2930,161 @@
 var __orientation_channel={ucb:null,tids:null};
 function __rotation_cb(arg1,arg2,arg3){
 if(arg2!=event_cancelled){
-var _2fe=null;
+var _1aa=null;
 if(arg3.ReturnValue){
 var time=arg3.ReturnValue.TimeStamp;
 var xrot=arg3.ReturnValue.XRotation;
 var yrot=arg3.ReturnValue.YRotation;
 var zrot=arg3.ReturnValue.ZRotation;
 arg3.ReturnValue.close();
-_2fe={};
-modifyObjectBaseProp(_2fe);
-_2fe.timeStamp=time;
-_2fe.rotationAboutXAxis=xrot;
-_2fe.rotationAboutYAxis=yrot;
-_2fe.rotationAboutZAxis=zrot;
-}
-__rotation_channel.ucb(_2fe);
+_1aa={};
+modifyObjectBaseProp(_1aa);
+_1aa.timeStamp=time;
+_1aa.rotationAboutXAxis=xrot;
+_1aa.rotationAboutYAxis=yrot;
+_1aa.rotationAboutZAxis=zrot;
+}
+__rotation_channel.ucb(_1aa);
 }
 };
 function __XYZ_cb(arg1,arg2,arg3){
 if(arg2!=event_cancelled){
-var _306=null;
+var _1b2=null;
 if(arg3.ReturnValue){
 var time=arg3.ReturnValue.TimeStamp;
-var _308=arg3.ReturnValue.XAxisData;
-var _309=arg3.ReturnValue.YAxisData;
-var _30a=arg3.ReturnValue.ZAxisData;
+var _1b4=arg3.ReturnValue.XAxisData;
+var _1b5=arg3.ReturnValue.YAxisData;
+var _1b6=arg3.ReturnValue.ZAxisData;
 arg3.ReturnValue.close();
-_306={};
-modifyObjectBaseProp(_306);
-_306.timeStamp=time;
-_306.axisX=_308;
-_306.axisY=_309;
-_306.axisZ=_30a;
-}
-__XYZ_channel.ucb(_306);
+_1b2={};
+modifyObjectBaseProp(_1b2);
+_1b2.timeStamp=time;
+_1b2.axisX=_1b4;
+_1b2.axisY=_1b5;
+_1b2.axisZ=_1b6;
+}
+__XYZ_channel.ucb(_1b2);
 }
 };
 function __orientation_cb(arg1,arg2,arg3){
 if(arg2!=event_cancelled){
-var _30e=null;
+var _1ba=null;
 if(arg3.ReturnValue){
 var time=arg3.ReturnValue.TimeStamp;
-var _310=arg3.ReturnValue.DeviceOrientation;
+var _1bc=arg3.ReturnValue.DeviceOrientation;
 arg3.ReturnValue.close();
-_30e={};
-modifyObjectBaseProp(_30e);
-_30e.timeStamp=time;
-_30e.deviceOrientation=_310;
-}
-__orientation_channel.ucb(_30e);
+_1ba={};
+modifyObjectBaseProp(_1ba);
+_1ba.timeStamp=time;
+_1ba.deviceOrientation=_1bc;
+}
+__orientation_channel.ucb(_1ba);
 }
 };
 function __sp_sensors_getChannels(){
 return ["Rotation","AccelerometerAxis","Orientation"];
 };
-function __sp_sensors_setNotifier(_311,_312,_313){
-var _314=new DeviceException(0,"dummy");
-if(!_311){
-throw new DeviceAPIError(_314.MISSING_ARG_ERR,"Callback is missing");
-}
-if((typeof _311)!="function"){
-throw new DeviceAPIError(_314.INVALID_ARG_ERR,"Callback is of invalid type");
-}
-if(_313&&((typeof _313)!="function")){
-throw new DeviceAPIError(_314.INVALID_ARG_ERR,"InValid error Callback");
-}
-if(!_312){
-throw new DeviceAPIError(_314.MISSING_ARG_ERR,"Channel is missing");
-}
-if((typeof _312)!="string"){
-throw new DeviceAPIError(_314.INVALID_ARG_ERR,"Channel is of invalid type");
+function __sp_sensors_setNotifier(_1bd,_1be,_1bf){
+var _1c0=new DeviceException(0,"dummy");
+if(!_1bd){
+throw new DeviceAPIError(_1c0.MISSING_ARG_ERR,"Callback is missing");
+}
+if((typeof _1bd)!="function"){
+throw new DeviceAPIError(_1c0.INVALID_ARG_ERR,"Callback is of invalid type");
+}
+if(_1bf&&((typeof _1bf)!="function")){
+throw new DeviceAPIError(_1c0.INVALID_ARG_ERR,"InValid error Callback");
+}
+if(!_1be){
+throw new DeviceAPIError(_1c0.MISSING_ARG_ERR,"Channel is missing");
+}
+if((typeof _1be)!="string"){
+throw new DeviceAPIError(_1c0.INVALID_ARG_ERR,"Channel is of invalid type");
 }
 var rval;
 var cb;
-var _317={};
-modifyObjectBaseProp(_317);
-switch(_312){
+var _1c3={};
+modifyObjectBaseProp(_1c3);
+switch(_1be){
 case "Rotation":
-_317.SearchCriterion="Rotation";
+_1c3.SearchCriterion="Rotation";
 cb=__rotation_cb;
-__rotation_channel.ucb=_311;
+__rotation_channel.ucb=_1bd;
 break;
 case "AccelerometerAxis":
-_317.SearchCriterion="AccelerometerAxis";
+_1c3.SearchCriterion="AccelerometerAxis";
 cb=__XYZ_cb;
-__XYZ_channel.ucb=_311;
+__XYZ_channel.ucb=_1bd;
 break;
 case "Orientation":
-_317.SearchCriterion="Orientation";
+_1c3.SearchCriterion="Orientation";
 cb=__orientation_cb;
-__orientation_channel.ucb=_311;
+__orientation_channel.ucb=_1bd;
 break;
 default:
-throw new DeviceAPIError(_314.NOT_SUPPORTED_ERR,"Unsupported input channel");
+throw new DeviceAPIError(_1c0.NOT_SUPPORTED_ERR,"Unsupported input channel");
 }
 try{
-rval=this.so.ISensor.FindSensorChannel(_317);
-if(_317){
-delete _317.SearchCriterion;
+rval=this.so.ISensor.FindSensorChannel(_1c3);
+if(_1c3){
+delete _1c3.SearchCriterion;
 }
 if(rval.ErrorCode!=0){
-throw new DeviceAPIError(_314.NOT_SUPPORTED_ERR,"StartChannel:Operation Failed");
+throw new DeviceAPIError(_1c0.NOT_SUPPORTED_ERR,"StartChannel:Operation Failed");
 }
 var cmap=[];
-var _319=[];
-var _31a=rval["ReturnValue"];
-var _31b=_31a.length;
-cmap=_31a[0];
-var _31c={};
-modifyObjectBaseProp(_31c);
-_31c.ListeningType="ChannelData";
-_31c.ChannelInfoMap=cmap;
-var _31d=this.so.ISensor.RegisterForNotification(_31c,cb);
-if(_31c){
-delete _31c.ChannelInfoMap;
-delete _31c.ListeningType;
+var _1c5=[];
+var _1c6=rval["ReturnValue"];
+var _1c7=_1c6.length;
+cmap=_1c6[0];
+var _1c8={};
+modifyObjectBaseProp(_1c8);
+_1c8.ListeningType="ChannelData";
+_1c8.ChannelInfoMap=cmap;
+var _1c9=this.so.ISensor.RegisterForNotification(_1c8,cb);
+if(_1c8){
+delete _1c8.ChannelInfoMap;
+delete _1c8.ListeningType;
 }
 if(cmap){
 delete cmap.index;
 }
-_319[0]=_31d["TransactionID"];
-if(_31d.ErrorCode!=0){
-if(_31d.ErrorCode==1005){
-_313(new DeviceAPIError(_314.SERVICE_IN_USE_ERR,"Not Allowed Operation"));
+_1c5[0]=_1c9["TransactionID"];
+if(_1c9.ErrorCode!=0){
+if(_1c9.ErrorCode==1005){
+_1bf(new DeviceAPIError(_1c0.SERVICE_IN_USE_ERR,"Not Allowed Operation"));
 return;
 }else{
-throw new DeviceAPIError(_314.NOT_SUPPORTED_ERR,"StartChannel:Operation Failed");
+throw new DeviceAPIError(_1c0.NOT_SUPPORTED_ERR,"StartChannel:Operation Failed");
 }
 }
 }
 catch(e2){
 __device_handle_exception(e2,"__sp_sensors_setNotifier: RegisterForNotification: "+e2);
 }
-switch(_312){
+switch(_1be){
 case "Rotation":
-__rotation_channel.tid=_319;
+__rotation_channel.tid=_1c5;
 break;
 case "AccelerometerAxis":
-__XYZ_channel.tid=_319;
+__XYZ_channel.tid=_1c5;
 break;
 case "Orientation":
-__orientation_channel.tid=_319;
-break;
-}
-return _319;
-};
-function __sp_sensors_cancelNotifier(_31e){
-var _31f=new DeviceException(0,"dummy");
-if(!_31e){
-throw new DeviceAPIError(_31f.MISSING_ARG_ERR,"Channel is missing");
-}
-if((typeof _31e)!="string"){
-throw new DeviceAPIError(_31f.INVALID_ARG_ERR,"Channel is of invalid type");
+__orientation_channel.tid=_1c5;
+break;
+}
+return _1c5;
+};
+function __sp_sensors_cancelNotifier(_1ca){
+var _1cb=new DeviceException(0,"dummy");
+if(!_1ca){
+throw new DeviceAPIError(_1cb.MISSING_ARG_ERR,"Channel is missing");
+}
+if((typeof _1ca)!="string"){
+throw new DeviceAPIError(_1cb.INVALID_ARG_ERR,"Channel is of invalid type");
 }
 var id;
-switch(_31e){
+switch(_1ca){
 case "Rotation":
 id=__rotation_channel.tid;
 __rotation_channel.tid=null;
@@ -5790,22 +3098,22 @@
 __orientation_channel.tid=null;
 break;
 default:
-throw new DeviceAPIError(_31f.NOT_SUPPORTED_ERR,"Unsupported input channel");
+throw new DeviceAPIError(_1cb.NOT_SUPPORTED_ERR,"Unsupported input channel");
 }
 if(!id){
-throw new DeviceAPIError(_31f.DATA_NOT_FOUND_ERR,"Stop Channel:Operation Failed");
-}
-var _321={};
-modifyObjectBaseProp(_321);
+throw new DeviceAPIError(_1cb.DATA_NOT_FOUND_ERR,"Stop Channel:Operation Failed");
+}
+var _1cd={};
+modifyObjectBaseProp(_1cd);
 for(var i in id){
-_321.TransactionID=id[i];
+_1cd.TransactionID=id[i];
 try{
-var _323=this.so.ISensor.Cancel(_321);
-if(_321){
-delete _321.TransactionID;
-}
-if(_323.ErrorCode!=0){
-throw new DeviceAPIError(_31f.DATA_NOT_FOUND_ERR,"Stop Channel:Operation Failed");
+var _1cf=this.so.ISensor.Cancel(_1cd);
+if(_1cd){
+delete _1cd.TransactionID;
+}
+if(_1cf.ErrorCode!=0){
+throw new DeviceAPIError(_1cb.DATA_NOT_FOUND_ERR,"Stop Channel:Operation Failed");
 }
 }
 catch(e1){
@@ -5813,55 +3121,81 @@
 }
 }
 };
-function __sp_sensors_getScaleFactor(_324){
-var _325=new DeviceException(0,"dummy");
-if(!_324){
-throw new DeviceAPIError(_325.MISSING_ARG_ERR,"Channel is missing");
-}
-if((typeof _324)!="string"){
-throw new DeviceAPIError(_325.INVALID_ARG_ERR,"Channel is of invalid type");
-}
-if(_324!="AccelerometerAxis"){
-throw new DeviceAPIError(_325.NOT_SUPPORTED_ERR,"Unsupported input channel");
+function __sp_sensors_getScaleFactor(_1d0){
+var _1d1=new DeviceException(0,"dummy");
+if(!_1d0){
+throw new DeviceAPIError(_1d1.MISSING_ARG_ERR,"Channel is missing");
+}
+if((typeof _1d0)!="string"){
+throw new DeviceAPIError(_1d1.INVALID_ARG_ERR,"Channel is of invalid type");
+}
+if(_1d0!="AccelerometerAxis"){
+throw new DeviceAPIError(_1d1.NOT_SUPPORTED_ERR,"Unsupported input channel");
 }
 try{
-var _326={};
-_326.SearchCriterion="AccelerometerAxis";
-var rval=this.so.ISensor.FindSensorChannel(_326);
-if(_326){
-delete _326.SearchCriterion;
+var _1d2={};
+_1d2.SearchCriterion="AccelerometerAxis";
+var rval=this.so.ISensor.FindSensorChannel(_1d2);
+if(_1d2){
+delete _1d2.SearchCriterion;
 }
 if(rval.ErrorCode!=0){
-throw new DeviceAPIError(_325.NOT_SUPPORTED_ERR,"getScaleFactor:Operation Failed");
+throw new DeviceAPIError(_1d1.NOT_SUPPORTED_ERR,"getScaleFactor:Operation Failed");
 }
 var cmap=[];
-var _329=rval["ReturnValue"];
-cmap=_329[0];
-var _32a={};
-modifyObjectBaseProp(_32a);
-_32a.ListeningType="ChannelData";
-_32a.ChannelInfoMap=cmap;
-var _32b=this.so.ISensor.GetScaleFactor(_32a);
-if(_32a){
-delete _32a.ChannelInfoMap;
-delete _32a.ListeningType;
+var _1d5=rval["ReturnValue"];
+cmap=_1d5[0];
+var _1d6={};
+modifyObjectBaseProp(_1d6);
+_1d6.ListeningType="ChannelData";
+_1d6.ChannelInfoMap=cmap;
+var _1d7=this.so.ISensor.GetScaleFactor(_1d6);
+if(_1d6){
+delete _1d6.ChannelInfoMap;
+delete _1d6.ListeningType;
 }
 if(cmap){
 delete cmap.index;
 }
-if(_32b.ErrorCode!=0){
-throw new DeviceAPIError(_325.NOT_SUPPORTED_ERR,"getScaleFactor:Operation Failed");
+if(_1d7.ErrorCode!=0){
+throw new DeviceAPIError(_1d1.NOT_SUPPORTED_ERR,"getScaleFactor:Operation Failed");
 }
 }
 catch(e1){
 __device_handle_exception(e1,"__sp_sensors_getScaleFactor: "+e1);
 }
-return _32b["ReturnValue"];
-};
-var DATA_NOT_FOUND_ERR=101;
-var DATA_OUT_OF_RANGE_ERR=105;
-var NOT_ALLOWED_ERR=106;
-var error=new DeviceException();
+return _1d7["ReturnValue"];
+};
+var __device_sysinfo_service_entry={"name":null,"version":null,"proto":__device_sysinfo,"descriptor":__device_sysinfo_descriptor,"providers":[{"descriptor":__sp_sysinfo_descriptor,"instance":__sp_sysinfo_instance}]};
+function __device_sysinfo(_1d8){
+this.provider=_1d8;
+this.interfaceName=_1d8.descriptor.interfaceName;
+this.version=_1d8.descriptor.version;
+this.getChannelList=__device_channels_get;
+this.getChannel=__device_sysinfo_get;
+this.startChannel=__device_sysinfo_setNotifier;
+this.stopChannel=__device_sysinfo_cancelNotifier;
+this.cancel=__device_sysinfo_cancel;
+};
+function __device_sysinfo_descriptor(_1d9){
+this.interfaceName=_1d9.interfaceName;
+this.version=_1d9.version;
+};
+function __device_channels_get(){
+return this.provider.getChannelList();
+};
+function __device_sysinfo_get(_1da,_1db,_1dc){
+return this.provider.getChannel(_1da,_1db,_1dc);
+};
+function __device_sysinfo_setNotifier(_1dd,_1de,_1df,_1e0){
+return this.provider.startChannel(_1dd,_1de,_1df,_1e0);
+};
+function __device_sysinfo_cancelNotifier(_1e1){
+return this.provider.stopChannel(_1e1);
+};
+function __device_sysinfo_cancel(id){
+return this.provider.cancel(id);
+};
 function __sp_sysinfo_descriptor(){
 this.interfaceName="sysinfo";
 if(window.__Service_Interface_Ver){
@@ -5874,9 +3208,11 @@
 this.descriptor=new __sp_sysinfo_descriptor();
 this.getChannelList=__sp_channel_descriptors_get;
 this.getChannel=__sp_sysinfo_get;
+this.getChannelCb=__sp_sysinfo_get_cb;
 this.startChannel=__sp_sysinfo_setNotifier;
 this.stopChannel=__sp_sysinfo_cancelNotifier;
 this.cancel=__sp_sysinfo_cancel;
+this.error=new DeviceException(0,"Dummy");
 try{
 this.so=device.getServiceObject("Service.SysInfo","ISysInfo");
 }
@@ -5886,76 +3222,76 @@
 }
 };
 function __sp_channel_descriptors_get(){
-var _32c=[{name:"Charging",data:[{name:"chargingStatus",range:"true or false",description:"Charging(true) ,Not charging(false)",}],style:["Sync","Oneshot","Notification"]},{name:"BluetoothOn",data:[{name:"btOn",range:"true or false",description:"BluetoothOn(true) ,BluetoothOff(false)",}],style:["Sync","Oneshot","Notification"]},{name:"PhoneLanguage",data:[{name:"phoneLanguage",range:"",description:"",}],style:["Sync","Oneshot"]},{name:"ProductType",data:[{name:"productType",range:"",description:"",}],style:["Sync","Oneshot"]},{name:"FirmwareVersion",data:[{name:"firmwareVersion",range:"",description:"",}],style:["Sync","Oneshot"]},{name:"BatteryLevel",data:[{name:"batteryLevel ",range:"0-100",description:"Percent battery charge"}],style:["Async","Oneshot","Notification"]},{name:"SignalStrength",data:[{name:"signalStrength",range:"0-100",description:"Signal Strength in Percentage"}],style:["Async","Oneshot","Notification"]},{name:"Network",data:[{name:"networkName ",description:"Network name"},{name:"networkStatus",range:"Available,Current,Forbidden",description:""},{name:"networkMode",range:"ModeGsm,ModeCdma,ModeWcdma",description:""},{name:"mobileCountryCode",range:"",description:""},{name:"mobileNetworkCode",range:"",description:""},{name:"locationStatus",range:"True, False",description:""},{name:"areaCode",range:"",description:""},{name:"cellID",range:"",description:""}],style:["Async","Oneshot","Notification"]},{name:"IMEI",data:[{name:"imei",range:"",description:""}],style:["Sync","Oneshot"]},{name:"OutOfMemory",data:[{name:"oomDrive",range:"",description:""}],style:["NA","NA","Notification"]},{name:"DeviceOrientation",data:[{name:"deviceOrientation",range:"Landscape,Portrait",description:""}],style:["Sync","Oneshot"]},{name:"RoamingFlag",data:[{name:"roamingFlag",range:"",description:""}],style:["Sync","Oneshot"]},{name:"DeviceInputMethod",data:[{name:"deviceInputMethod",range:"Touch,NonTouch,Hybrid",description:""}],style:["Sync","Oneshot"]},{name:"HomeNetwork",data:[{name:"networkName ",description:"Network name"},{name:"networkStatus",range:"Available,Current,Forbidden",description:""},{name:"networkMode",range:"ModeGsm,ModeCdma,ModeWcdma",description:""},{name:"mobileCountryCode",range:"",description:""},{name:"mobileNetworkCode",range:"",description:""},{name:"locationStatus",range:"True, False",description:""},{name:"areaCode",range:"",description:""},{name:"cellID",range:"",description:""}],style:["Async","Oneshot","Notification"]}];
-return _32c;
+var _1e3=[{name:"Charging",data:[{name:"chargingStatus",range:"true or false",description:"Charging(true) ,Not charging(false)",}],style:["Sync","Oneshot","Notification"]},{name:"BluetoothOn",data:[{name:"btOn",range:"true or false",description:"BluetoothOn(true) ,BluetoothOff(false)",}],style:["Sync","Oneshot","Notification"]},{name:"PhoneLanguage",data:[{name:"phoneLanguage",range:"",description:"",}],style:["Sync","Oneshot"]},{name:"ProductType",data:[{name:"productType",range:"",description:"",}],style:["Sync","Oneshot"]},{name:"FirmwareVersion",data:[{name:"firmwareVersion",range:"",description:"",}],style:["Sync","Oneshot"]},{name:"BatteryLevel",data:[{name:"batteryLevel ",range:"0-100",description:"Percent battery charge"}],style:["Async","Oneshot","Notification"]},{name:"SignalStrength",data:[{name:"signalStrength",range:"0-100",description:"Signal Strength in Percentage"}],style:["Async","Oneshot","Notification"]},{name:"Network",data:[{name:"networkName ",description:"Network name"},{name:"networkStatus",range:"Available,Current,Forbidden",description:""},{name:"networkMode",range:"ModeGsm,ModeCdma,ModeWcdma",description:""},{name:"mobileCountryCode",range:"",description:""},{name:"mobileNetworkCode",range:"",description:""},{name:"locationStatus",range:"True, False",description:""},{name:"areaCode",range:"",description:""},{name:"cellID",range:"",description:""}],style:["Async","Oneshot","Notification"]},{name:"IMEI",data:[{name:"imei",range:"",description:""}],style:["Sync","Oneshot"]},{name:"OutOfMemory",data:[{name:"oomDrive",range:"",description:""}],style:["NA","NA","Notification"]},{name:"DeviceOrientation",data:[{name:"deviceOrientation",range:"Landscape,Portrait",description:""}],style:["Sync","Oneshot"]},{name:"RoamingFlag",data:[{name:"roamingFlag",range:"",description:""}],style:["Sync","Oneshot"]},{name:"DeviceInputMethod",data:[{name:"deviceInputMethod",range:"Touch,NonTouch,Hybrid",description:""}],style:["Sync","Oneshot"]},{name:"HomeNetwork",data:[{name:"networkName ",description:"Network name"},{name:"networkStatus",range:"Available,Current,Forbidden",description:""},{name:"networkMode",range:"ModeGsm,ModeCdma,ModeWcdma",description:""},{name:"mobileCountryCode",range:"",description:""},{name:"mobileNetworkCode",range:"",description:""},{name:"locationStatus",range:"True, False",description:""},{name:"areaCode",range:"",description:""},{name:"cellID",range:"",description:""}],style:["Async","Oneshot","Notification"]}];
+return _1e3;
 };
 var max=110;
 var min=40;
 var diff=max-min;
-function __sp_device_sysinfo_toDecibel(_32d){
-var _32e=_32d/100;
-var _32f=max-(_32e*diff);
-_32f=Math.round(_32f);
-return _32f;
-};
-function __sp_device_sysinfo_toPercentage(_330){
-if(_330==0){
-return _330;
-}else{
-var _331=max-_330;
-var _332=_331/diff;
-_332*=100;
-_332=Math.round(_332);
-return _332;
-}
-};
-function __sp_device_sysinfo_toBool(_333){
-if(_333==0){
+function __sp_device_sysinfo_toDecibel(_1e4){
+var _1e5=_1e4/100;
+var _1e6=max-(_1e5*diff);
+_1e6=Math.round(_1e6);
+return _1e6;
+};
+function __sp_device_sysinfo_toPercentage(_1e7){
+if(_1e7==0){
+return _1e7;
+}else{
+var _1e8=max-_1e7;
+var _1e9=_1e8/diff;
+_1e9*=100;
+_1e9=Math.round(_1e9);
+return _1e9;
+}
+};
+function __sp_device_sysinfo_toBool(_1ea){
+if(_1ea==0){
 return false;
 }else{
 return true;
 }
 };
-function mappingVerification(_334){
-if(_334==1016||_334==1012||_334==1010||_334==1009||_334==1005||_334==1000||_334==1011||_334==1007||_334==1003||_334==1002){
+function mappingVerification(_1eb){
+if(_1eb==1016||_1eb==1012||_1eb==1010||_1eb==1009||_1eb==1005||_1eb==1000||_1eb==1011||_1eb==1007||_1eb==1003||_1eb==1002){
 return true;
 }else{
 return false;
 }
 };
-function __sp_device_sysinfo_extract(_335){
-var _336=_335.Key;
-var _337={};
-modifyObjectBaseProp(_337);
+function __sp_device_sysinfo_extract(_1ec){
+var _1ed=_1ec.Key;
+var _1ee={};
+modifyObjectBaseProp(_1ee);
 try{
-switch(_336){
+switch(_1ed){
 case "ChargingStatus":
-_337.chargingStatus=__sp_device_sysinfo_toBool(_335.Status);
+_1ee.chargingStatus=__sp_device_sysinfo_toBool(_1ec.Status);
 break;
 case "BatteryStrength":
-_337.batteryLevel=_335.Status;
+_1ee.batteryLevel=_1ec.Status;
 break;
 case "SignalStrength":
-_337.signalStrength=__sp_device_sysinfo_toPercentage(_335.Status);
+_1ee.signalStrength=__sp_device_sysinfo_toPercentage(_1ec.Status);
 break;
 case "CurrentNetwork":
-var _338;
+var _1ef;
 var mode;
-switch(_335.NetworkStatus){
+switch(_1ec.NetworkStatus){
 case 0:
-_338="Available";
+_1ef="Available";
 break;
 case 1:
-_338="Current";
+_1ef="Current";
 break;
 case 2:
-_338="Forbidden";
+_1ef="Forbidden";
 break;
 default:
-_338="Unknown";
-break;
-}
-switch(_335.NetworkMode){
+_1ef="Unknown";
+break;
+}
+switch(_1ec.NetworkMode){
 case 1:
 mode="ModeGsm";
 break;
@@ -5970,163 +3306,178 @@
 mode="Unknown";
 break;
 }
-_337.networkName=_335.NetworkName;
-_337.networkStatus=_338;
-_337.networkMode=mode;
-_337.mobileCountryCode=_335.CountryCode;
-_337.mobileNetworkCode=_335.NetworkCode;
-_337.locationStatus=_335.LocationStatus;
-_337.areaCode=_335.AreaCode;
-_337.cellID=_335.CellId;
+_1ee.networkName=_1ec.NetworkName;
+_1ee.networkStatus=_1ef;
+_1ee.networkMode=mode;
+_1ee.mobileCountryCode=_1ec.CountryCode;
+_1ee.mobileNetworkCode=_1ec.NetworkCode;
+_1ee.locationStatus=_1ec.LocationStatus;
+_1ee.areaCode=_1ec.AreaCode;
+_1ee.cellID=_1ec.CellId;
 break;
 case "DisplayLanguage":
-_337.phoneLanguage=_335.StringData;
+_1ee.phoneLanguage=_1ec.StringData;
 break;
 case "BlueTooth":
-_337.btOn=__sp_device_sysinfo_toBool(_335.Status);
+_1ee.btOn=__sp_device_sysinfo_toBool(_1ec.Status);
 break;
 case "ProductType":
-_337.productType=_335.StringData;
+_1ee.productType=_1ec.StringData;
 break;
 case "FirmwareVersion":
-_337.firmwareVersion=_335.StringData;
+_1ee.firmwareVersion=_1ec.StringData;
 break;
 case "DeviceInputMethod":
-_337.deviceInputMethod=_335.StringData;
+_1ee.deviceInputMethod=_1ec.StringData;
 break;
 default:
-_337=_335;
-break;
-}
-return _337;
+_1ee=_1ec;
+break;
+}
+return _1ee;
 }
 catch(e){
 __device_handle_exception(e,"__sp_device_sysinfo_extract: "+e);
 }
 };
-function __sp_sysinfo_get(_33a,_33b,_33c){
-var so;
-var rval;
-var _33f=function(arg1,arg2,arg3){
-var _343=_33b;
-var _344=_33c;
+function __sp_sysinfo_get_cb(arg1,arg2,arg3){
+var _1f4;
+var _1f5;
+var _1f6;
+_1f6=glob_obj.getFromArray(arg1);
+if(_1f6){
+_1f4=_1f6.success_cb;
+_1f5=_1f6.error_cb;
+}else{
+alert("Sysinfo: __sp_sysinfo_get_cb: Callback not found ");
+return;
+}
 var op=null;
 if(arg3.ErrorCode!=0){
-var _346=splitErrorMessage(arg3.ErrorMessage);
-_344(new DeviceException(MapErrorCode[arg3.ErrorCode],"SysInfo:getChannel: "+_346));
+var _1f8=splitErrorMessage(arg3.ErrorMessage);
+_1f5(new DeviceException(MapErrorCode[arg3.ErrorCode],"SysInfo:getChannel: "+_1f8));
 }else{
 if(arg3.ReturnValue){
 op=__sp_device_sysinfo_extract(arg3.ReturnValue);
 arg3.ReturnValue.close();
-_343(op);
-}
-}
-};
-var _347=false;
-var _348="Status";
-var _349;
-var _34a={};
-modifyObjectBaseProp(_34a);
+_1f4(op);
+}
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_sysinfo_get(_1f9,_1fa,_1fb){
+var so;
+var rval;
+var _1fe=false;
+var _1ff="Status";
+var _200;
+var _201={};
+modifyObjectBaseProp(_201);
 try{
-switch(_33a){
+switch(_1f9){
 case "Charging":
-_34a.Entity="Battery";
-_34a.Key="ChargingStatus";
+_201.Entity="Battery";
+_201.Key="ChargingStatus";
 break;
 case "BatteryLevel":
-_34a.Entity="Battery";
-_34a.Key="BatteryStrength";
-_347=true;
+_201.Entity="Battery";
+_201.Key="BatteryStrength";
+_1fe=true;
 break;
 case "SignalStrength":
-_34a.Entity="Network";
-_34a.Key="SignalStrength";
-_347=true;
+_201.Entity="Network";
+_201.Key="SignalStrength";
+_1fe=true;
 break;
 case "Network":
-_34a.Entity="Network";
-_34a.Key="CurrentNetwork";
-_347=true;
+_201.Entity="Network";
+_201.Key="CurrentNetwork";
+_1fe=true;
 break;
 case "PhoneLanguage":
-_34a.Entity="General";
-_34a.Key="DisplayLanguage";
+_201.Entity="General";
+_201.Key="DisplayLanguage";
 break;
 case "BluetoothOn":
-_34a.Entity="Connectivity";
-_34a.Key="BlueTooth";
+_201.Entity="Connectivity";
+_201.Key="BlueTooth";
 break;
 case "ProductType":
-_34a.Entity="Device";
-_34a.Key="ProductType";
+_201.Entity="Device";
+_201.Key="ProductType";
 break;
 case "FirmwareVersion":
-_34a.Entity="Device";
-_34a.Key="FirmwareVersion";
+_201.Entity="Device";
+_201.Key="FirmwareVersion";
 break;
 case "DeviceInputMethod":
-_34a.Entity="Device";
-_34a.Key="DeviceInputMethod";
+_201.Entity="Device";
+_201.Key="DeviceInputMethod";
 break;
 default:
-if(_33a==null){
-throw new DeviceException(MISSING_ARG_ERR,"SysInfo:getChannel:channel is missing");
-}else{
-if(typeof _33a!="string"){
-throw new DeviceException(error.INVALID_ARG_ERR,"SysInfo:getChannel:channel is of invalid type");
-}else{
-throw new DeviceException(INVALID_ARG_ERR,"SysInfo:getChannel:channel is invalid");
-}
-}
-}
-if(_347){
-if(_33b==null){
-throw new DeviceException(MISSING_ARG_ERR,"SysInfo:getChannel:callback is missing");
-}
-if(typeof _33b!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"SysInfo:getChannel:callback is invalid");
-}
-if(_33c){
-if(typeof (_33c)!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"SysInfo:getChannel: ErrorCallback is invalid");
-}
-}
-rval=this.so.ISysInfo.GetInfo(_34a,_33f);
+if(_1f9==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"SysInfo:getChannel:channel is missing");
+}else{
+if(typeof _1f9!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:getChannel:channel is of invalid type");
+}else{
+throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:getChannel:channel is invalid");
+}
+}
+}
+if(_1fe){
+if(_1fa==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"SysInfo:getChannel:callback is missing");
+}
+if(typeof _1fa!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:getChannel:callback is invalid");
+}
+if(_1fb){
+if(typeof (_1fb)!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:getChannel: ErrorCallback is invalid");
+}
+}
+temp_scb=_1fa;
+temp_ecb=_1fb;
+rval=this.so.ISysInfo.GetInfo(_201,this.getChannelCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_1fa,_1fb);
+}
 if(rval.ErrorCode!=0){
-var _34b=mappingVerification(rval.ErrorCode);
-if(_34b){
+var _202=mappingVerification(rval.ErrorCode);
+if(_202){
 switch(MapErrorCode[rval.ErrorCode]){
-case MISSING_ARG_ERR:
-case INVALID_ARG_ERR:
+case this.error.MISSING_ARG_ERR:
+case this.error.INVALID_ARG_ERR:
 if(rval.ErrorMessage){
-var _34c=splitErrorMessage(rval.ErrorMessage);
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo: getChannel: "+_34c);
+var _203=splitErrorMessage(rval.ErrorMessage);
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo: getChannel: "+_203);
 }else{
 throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo:getChannel:Operation Failed");
 }
 break;
 default:
-_33b(0);
-}
-}else{
-_33b(0);
+_1fa(0);
+}
+}else{
+_1fa(0);
 }
 }
 return rval.TransactionID;
 }else{
-rval=this.so.ISysInfo.GetInfo(_34a);
+rval=this.so.ISysInfo.GetInfo(_201);
 if(rval.ErrorCode!=0){
 if(rval.ErrorMessage){
-var _34d=splitErrorMessage(rval.ErrorMessage);
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo: getChannel: "+_34d);
+var _204=splitErrorMessage(rval.ErrorMessage);
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo: getChannel: "+_204);
 }else{
 throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo:getChannel:Operation Failed");
 }
 }
-_349=__sp_device_sysinfo_extract(rval.ReturnValue);
-return _349;
-}
-delete _34a;
+_200=__sp_device_sysinfo_extract(rval.ReturnValue);
+return _200;
+}
+delete _201;
 }
 catch(e){
 __device_handle_exception(e,"__sp_sysinfo_get: getChannel: "+e);
@@ -6210,130 +3561,132 @@
 }
 }
 };
-function __sp_sysinfo_setNotifier(_366,_367,_368,_369){
+function __sp_sysinfo_setNotifier(_21d,_21e,_21f,_220){
 var rval;
-var _36b=null;
+var _222=null;
 var cb=null;
-var _36d={};
-if(_366==null){
-throw new DeviceException(MISSING_ARG_ERR,"SysInfo:startChannel:callback is missing");
-}
-if(typeof _366!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"SysInfo:startChannel:callback is invalid");
-}
-modifyObjectBaseProp(_36d);
+var _224={};
+if(_21d==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"SysInfo:startChannel:callback is missing");
+}
+if(typeof _21d!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:startChannel:callback is invalid");
+}
+modifyObjectBaseProp(_224);
 try{
-switch(_367){
+switch(_21e){
 case "Charging":
-_36d.Entity="Battery";
-_36d.Key="ChargingStatus";
-_36b=__charging_status_channel;
+_224.Entity="Battery";
+_224.Key="ChargingStatus";
+_222=__charging_status_channel;
 cb=__charging_status_channel_cb;
 break;
 case "Network":
-_36d.Entity="Network";
-_36d.Key="CurrentNetwork";
-_36b=__net_coverage_channel;
+_224.Entity="Network";
+_224.Key="CurrentNetwork";
+_222=__net_coverage_channel;
 cb=__net_coverage_channel_cb;
 break;
 case "BatteryLevel":
-_36d.Entity="Battery";
-_36d.Key="BatteryStrength";
-_36d.SystemData={};
-modifyObjectBaseProp(_36d.SystemData);
-if(_368==null){
-_368=50;
-}
-if(!(_368>=0&&_368<=100)){
-throw new DeviceException(DATA_OUT_OF_RANGE_ERR,"SysInfo:startChannel:trigger is out of range");
-}
-if(typeof _368!="number"){
-throw new DeviceException(INVALID_ARG_ERR,"SysInfo:startChannel:trigger is of  invalid type");
-}
-_36d.SystemData.Status=_368;
-_36b=__battery_level_channel;
+_224.Entity="Battery";
+_224.Key="BatteryStrength";
+_224.SystemData={};
+modifyObjectBaseProp(_224.SystemData);
+if(_21f==null){
+_21f=50;
+}
+if(!(_21f>=0&&_21f<=100)){
+throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"SysInfo:startChannel:trigger is out of range");
+}
+if(typeof _21f!="number"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:startChannel:trigger is of  invalid type");
+}
+_224.SystemData.Status=_21f;
+_222=__battery_level_channel;
 cb=__battery_level_channel_cb;
 break;
 case "SignalStrength":
-_36d.Entity="Network";
-_36d.Key="SignalStrength";
-_36d.SystemData={};
-modifyObjectBaseProp(_36d.SystemData);
-if(_368!=null){
-if(!(_368>=0&&_368<=100)){
-throw new DeviceException(DATA_OUT_OF_RANGE_ERR,"SysInfo:startChannel:trigger is out of range");
-}
-if(typeof _368!="number"){
-throw new DeviceException(INVALID_ARG_ERR,"SysInfo:startChannel:trigger is of invalid type");
-}
-_36d.SystemData.Status=__sp_device_sysinfo_toDecibel(_368);
-}
-_36b=__signal_channel;
+_224.Entity="Network";
+_224.Key="SignalStrength";
+_224.SystemData={};
+modifyObjectBaseProp(_224.SystemData);
+if(_21f!=null){
+if(!(_21f>=0&&_21f<=100)){
+throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"SysInfo:startChannel:trigger is out of range");
+}
+if(typeof _21f!="number"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:startChannel:trigger is of invalid type");
+}
+_224.SystemData.Status=__sp_device_sysinfo_toDecibel(_21f);
+}
+_222=__signal_channel;
 cb=__signal_channel_cb;
 break;
 case "BluetoothOn":
-_36d.Entity="Connectivity";
-_36d.Key="BlueTooth";
-_36b=__bluetooth_on_channel;
+_224.Entity="Connectivity";
+_224.Key="BlueTooth";
+_222=__bluetooth_on_channel;
 cb=__bluetooth_on_channel_cb;
 break;
 default:
-var _36e;
-if(_367==null){
-throw new DeviceException(MISSING_ARG_ERR,"SysInfo:startChannel:channel is missing");
-}else{
-if(typeof _367!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"SysInfo:startChannel:channel is of invalid type");
-}else{
-throw new DeviceException(INVALID_ARG_ERR,"SysInfo:startChannel:channel is invalid");
-}
-}
-if(_36d.SystemData){
-delete _36d.SystemData;
-}
-}
-_36b.scb=_366;
-_36b.ecb=_369;
-if(_36b.ecb){
-if(typeof (_36b.ecb)!="function"){
-throw new DeviceException(INVALID_ARG_ERR,"SysInfo:startChannel: ErrorCallback is invalid");
-}
-}
-if(_36b.cancel_id){
-var _36f={};
-modifyObjectBaseProp(_36f);
-_36f.TransactionID=_36b.cancel_id;
-this.so.ISysInfo.Cancel(_36f);
-_36b.cancel_id=null;
-delete _36f;
-}
-rval=this.so.ISysInfo.GetNotification(_36d,cb);
-delete _36d;
+var _225;
+if(_21e==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"SysInfo:startChannel:channel is missing");
+}else{
+if(typeof _21e!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:startChannel:channel is of invalid type");
+}else{
+throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:startChannel:channel is invalid");
+}
+}
+if(_224.SystemData){
+delete _224.SystemData;
+}
+}
+_222.scb=_21d;
+_222.ecb=_220;
+if(_222.ecb){
+if(typeof (_222.ecb)!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:startChannel: ErrorCallback is invalid");
+}
+}
+if(_222.cancel_id){
+var _226={};
+modifyObjectBaseProp(_226);
+_226.TransactionID=_222.cancel_id;
+this.so.ISysInfo.Cancel(_226);
+_222.cancel_id=null;
+delete _226;
+}
+temp_scb=_21d;
+temp_ecb=_220;
+rval=this.so.ISysInfo.GetNotification(_224,cb);
+delete _224;
 if(rval.ErrorCode!=0){
 switch(MapErrorCode[rval.ErrorCode]){
-case MISSING_ARG_ERR:
-case INVALID_ARG_ERR:
+case this.error.MISSING_ARG_ERR:
+case this.error.INVALID_ARG_ERR:
 if(rval.ErrorMessage){
-var _370=splitErrorMessage(rval.ErrorMessage);
-throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo: startChannel: "+_370);
+var _227=splitErrorMessage(rval.ErrorMessage);
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo: startChannel: "+_227);
 }else{
 throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo:startChannel:Operation Failed");
 }
 break;
 default:
-_366(0);
-}
-}
-_36b.cancel_id=rval.TransactionID;
-return _36b.cancel_id;
+_21d(0);
+}
+}
+_222.cancel_id=rval.TransactionID;
+return _222.cancel_id;
 }
 catch(e){
 __device_handle_exception(e,"__sp_sysinfo_startChannel: "+e);
 }
 };
-function __sp_sysinfo_cancelNotifier(_371){
+function __sp_sysinfo_cancelNotifier(_228){
 try{
-switch(_371){
+switch(_228){
 case "CellId":
 channel=__cell_id_channel;
 break;
@@ -6353,1443 +3706,5006 @@
 channel=__bluetooth_on_channel;
 break;
 default:
-var _372;
-if(_371==null){
-throw new DeviceException(MISSING_ARG_ERR,"SysInfo:stopChannel:channel is missing");
-}else{
-if(typeof _371!="string"){
-throw new DeviceException(INVALID_ARG_ERR,"SysInfo:stopChannel:channel is of invalid type");
-}else{
-throw new DeviceException(INVALID_ARG_ERR,"SysInfo:stopChannel:channel is invalid");
+var _229;
+if(_228==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"SysInfo:stopChannel:channel is missing");
+}else{
+if(typeof _228!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:stopChannel:channel is of invalid type");
+}else{
+throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:stopChannel:channel is invalid");
 }
 }
 }
 if(channel.cancel_id){
-var _373={};
-modifyObjectBaseProp(_373);
-_373.TransactionID=channel.cancel_id;
-var _374=this.so.ISysInfo.Cancel(_373);
-delete _373;
-if(_374.ErrorCode!=0){
-if(_374.ErrorMessage){
-var _375=splitErrorMessage(_374.ErrorMessage);
-throw new DeviceException(MapErrorCode[_374.ErrorCode],"SysInfo: stopChannel: "+_375);
-}else{
-throw new DeviceException(MapErrorCode[_374.ErrorCode],"SysInfo:stopChannel:Operation Failed");
+var _22a={};
+modifyObjectBaseProp(_22a);
+_22a.TransactionID=channel.cancel_id;
+var _22b=this.so.ISysInfo.Cancel(_22a);
+delete _22a;
+if(_22b.ErrorCode!=0){
+if(_22b.ErrorMessage){
+var _22c=splitErrorMessage(_22b.ErrorMessage);
+throw new DeviceException(MapErrorCode[_22b.ErrorCode],"SysInfo: stopChannel: "+_22c);
+}else{
+throw new DeviceException(MapErrorCode[_22b.ErrorCode],"SysInfo:stopChannel:Operation Failed");
 }
 }
 channel.cancel_id=null;
 }else{
-throw new DeviceException(DATA_NOT_FOUND_ERR,"SysInfo:stopChannel:channel not started");
+throw new DeviceException(this.error.DATA_NOT_FOUND_ERR,"SysInfo:stopChannel:channel not started");
 }
 }
 catch(e){
 __device_handle_exception(e,"__sp_sysinfo_stopChannel: "+e);
 }
 };
-function __sp_sysinfo_cancel(_376){
+function __sp_sysinfo_cancel(_22d){
 try{
-var _377=0;
-if(_376==null){
-throw new DeviceException(MISSING_ARG_ERR,"SysInfo:cancel:Id is missing");
-}
-if(typeof _376!="number"){
-throw new DeviceException(INVALID_ARG_ERR,"SysInfo:cancel:Id is of invalid type");
-}
-if(_376==__charging_status_channel.cancel_id||_376==__net_coverage_channel.cancel_id||_376==__battery_level_channel.cancel_id||_376==__bluetooth_on_channel.cancel_id||_376==__signal_channel.cancel_id){
-_377=1;
-}
-if(_377!=1){
-var _378={TransactionID:_376};
-var _379=this.so.ISysInfo.Cancel(_378);
-if(_379.ErrorCode!=0){
-if(_379.ErrorMessage){
-var _37a=splitErrorMessage(_379.ErrorMessage);
-throw new DeviceException(INVALID_ARG_ERR,"SysInfo:cancel: "+_37a);
-}else{
-throw new DeviceException(MapErrorCode[_379.ErrorCode],"SysInfo:cancel:Operation Failed");
-}
-}
-}else{
-_377=0;
-throw new DeviceException(NOT_ALLOWED_ERR,"SysInfo:cancel:Cannot Cancel a channel started using startChannel ");
+var _22e=0;
+if(_22d==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"SysInfo:cancel:Id is missing");
+}
+if(typeof _22d!="number"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:cancel:Id is of invalid type");
+}
+if(_22d==__charging_status_channel.cancel_id||_22d==__net_coverage_channel.cancel_id||_22d==__battery_level_channel.cancel_id||_22d==__bluetooth_on_channel.cancel_id||_22d==__signal_channel.cancel_id){
+_22e=1;
+}
+if(_22e!=1){
+var _22f={TransactionID:_22d};
+var _230=this.so.ISysInfo.Cancel(_22f);
+if(_230.ErrorCode!=0){
+if(_230.ErrorMessage){
+var _231=splitErrorMessage(_230.ErrorMessage);
+throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:cancel: "+_231);
+}else{
+throw new DeviceException(MapErrorCode[_230.ErrorCode],"SysInfo:cancel:Operation Failed");
+}
+}
+}else{
+_22e=0;
+throw new DeviceException(this.error.NOT_ALLOWED_ERR,"SysInfo:cancel:Cannot Cancel a channel started using startChannel ");
 }
 }
 catch(e){
 __device_handle_exception(e,"__sp_sysinfo_cancel: "+e);
 }
 };
-var err_missing_argument=1003;
-var err_bad_argument=1002;
-var err_ServiceNotSupported=1004;
-var err_InvalidService_Argument=1000;
-function convertFromPS2JS(_37b){
-var _37c=new DeviceAPIError(0,"dummy");
-var _37d;
-switch(_37b){
-case 1016:
-_37d=_37c.TIMEOUT_ERR;
-break;
-case 1012:
-_37d=_37c.DATA_NOT_FOUND_ERR;
-break;
-case 1010:
-_37d=_37c.DATA_ALREADY_EXISTS_ERR;
-break;
-case 1009:
-_37d=_37c.SERVICE_BUSY_ERR;
-break;
-case 1005:
-_37d=_37c.SERVICE_IN_USE_ERR;
+function __device_camera_descriptor(_232){
+this.interfaceName=_232.interfaceName;
+this.version=_232.version;
+};
+function __device_camera_startCamera(_233,_234){
+return this.provider.startCamera(_233,_234);
+};
+function __device_camera_stopViewfinder(){
+this.provider.stopViewfinder();
+};
+function __device_camera_takePicture(_235){
+this.provider.takePicture(_235);
+};
+function __device_camera(_236){
+this.provider=_236;
+this.interfaceName=_236.descriptor.interfaceName;
+this.version=_236.descriptor.version;
+this.supportedMediaTypes=_236.supportedMediaTypes;
+this.supportedSizes=_236.supportedSizes;
+this.startCamera=__device_camera_startCamera;
+this.stopViewfinder=__device_camera_stopViewfinder;
+this.takePicture=__device_camera_takePicture;
+};
+var __device_camera_service_entry={"name":null,"version":null,"proto":__device_camera,"descriptor":__device_camera_descriptor,"providers":[{"descriptor":__sp_camera_descriptor,"instance":__sp_camera_instance}]};
+function __sp_camera_descriptor(){
+this.interfaceName="camera";
+if(window.__Service_Interface_Ver){
+this.version=__Service_Interface_Ver;
+}else{
+this.version=1;
+}
+};
+var __sp_camera_start_date;
+var CAMERA_APP_ID=270501242;
+function __sp_startCamera(_237,_238){
+if(_237==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Camera:startCamera:callback is missing");
+}
+if(_237==undefined){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Camera:startCamera:callback is a non-function");
+}
+if(typeof (_237)!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Camera:startCamera:callback is a non-function");
+}
+if(_238){
+if(typeof _238!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Camera:startCamera:callback is invalid");
+}
+}
+var _239=function(){
+var _23a=function(arg1,arg2,arg3){
+var it=arg3.ReturnValue;
+var item;
+var _240=[];
+if(arg3.ErrorCode!=0){
+_238(new DeviceException(arg3.ErrorCode,"Camera:startCamera: Operation Failed"));
+return;
+}
+if((item=it.getNext())!=undefined){
+var d=new Date(Date.parse(item.FileDate));
+if(d>__sp_camera_start_date){
+var _242={};
+modifyObjectBaseProp(_242);
+var _243=item.FileNameAndPath.replace(/\\/g,"/");
+var _244="file:///";
+var _245="";
+_245=_245.concat(_244,_243);
+_242.uri=_245;
+var _246={};
+_246.height=item.XPixels;
+_246.width=item.YPixels;
+_246.type=item.MimeType;
+_242.format=_246;
+_240.unshift(_242);
+if(_246){
+}
+}
+}
+var _247=0;
+var _248=0;
+_237(_240);
+};
+try{
+var mso=device.getServiceObject("Service.MediaManagement","IDataSource");
+}
+catch(e){
+__device_handle_exception(e,"media service not available : "+e);
+}
+var _24a={};
+modifyObjectBaseProp(_24a);
+_24a.Type="FileInfo";
+_24a.Filter={};
+modifyObjectBaseProp(_24a.Filter);
+_24a.Filter.FileType="Image";
+_24a.Sort={};
+modifyObjectBaseProp(_24a.Sort);
+_24a.Sort.Key="FileDate";
+_24a.Sort.Order="Descending";
+try{
+var rval=mso.IDataSource.GetList(_24a,_23a);
+}
+catch(error){
+__device_handle_exception(error,"media service GetList failed: "+error);
+}
+};
+__sp_camera_start_date=new Date();
+__s60_start_and_wait(CAMERA_APP_ID,"",_239);
+var _24c=0;
+return _24c;
+};
+function __sp_supportedSizes(){
+try{
+var _24d=device.getServiceObject("Service.SysInfo","ISysInfo");
+}
+catch(e){
+__device_handle_exception(e,"SysInfo Service not available : "+e);
+}
+var _24e={};
+modifyObjectBaseProp(_24e);
+_24e.Entity="Camera";
+_24e.Key="CameraProperties";
+try{
+var rval=_24d.ISysInfo.GetInfo(_24e);
+if(_24e){
+delete _24e.Entity;
+delete _24e.Key;
+}
+}
+catch(error){
+__device_handle_exception(error,"Camera : Failed to fetch supported size Info: "+error);
+}
+var _250=rval.ReturnValue;
+var _251=[];
+var _252=[];
+_251=_250.ResolutionList;
+for(var i=0;i<_251.length;i++){
+var _254="";
+_254=_254.concat(_251[i].height,"X",_251[i].width);
+_252.push(_254);
+}
+return _252;
+};
+function __sp_supportedMediaTypes(){
+try{
+var _255=device.getServiceObject("Service.SysInfo","ISysInfo");
+}
+catch(e){
+__device_handle_exception(e,"SysInfo Service not available : "+e);
+}
+var _256={};
+modifyObjectBaseProp(_256);
+_256.Entity="Camera";
+_256.Key="CameraProperties";
+try{
+var rval=_255.ISysInfo.GetInfo(_256);
+if(_256){
+delete _256.Entity;
+delete _256.Key;
+}
+}
+catch(error){
+__device_handle_exception(error,"Camera :Failed to fetch supported media type Info: "+error);
+}
+var _258=rval.ReturnValue;
+var _259=[];
+_259=_258.MimeTypeList;
+return _259;
+};
+function __sp_camera_instance(){
+this.descriptor=new __sp_camera_descriptor();
+this.supportedMediaTypes=__sp_supportedMediaTypes();
+this.supportedSizes=__sp_supportedSizes();
+this.startCamera=__sp_startCamera;
+this.stopViewfinder=__s60_api_not_supported;
+this.takePicture=__s60_api_not_supported;
+this.error=new DeviceException(0,"Dummy");
+};
+var _infinity=Infinity;
+function TransIdCbMap(){
+this.TransactionID=null;
+this.success_callback=null;
+this.error_callback=null;
+};
+function __device_geolocation_descriptor(_25a){
+this.interfaceName=_25a.interfaceName;
+this.version=_25a.version;
+};
+function __device_geolocation_getCurrentPosition(_25b,_25c,_25d){
+return this.provider.getLocation(_25b,_25c,_25d);
+};
+function __device_geolocation_watchPosition(_25e,_25f,_260){
+return this.provider.traceLocation(_25e,_25f,_260);
+};
+function __device_geolocation_clearWatch(_261){
+this.provider.clearTrace(_261);
+};
+function __device_geolocation(_262){
+this.provider=_262;
+this.interfaceName=_262.descriptor.interfaceName;
+this.version=_262.descriptor.version;
+this.getCurrentPosition=__device_geolocation_getCurrentPosition;
+this.watchPosition=__device_geolocation_watchPosition;
+this.clearWatch=__device_geolocation_clearWatch;
+};
+var __device_geolocation_service_entry={"name":null,"version":null,"proto":__device_geolocation,"descriptor":__device_geolocation_descriptor,"providers":[{"descriptor":__sp_location_descriptor,"instance":__sp_location_instance}]};
+function Location_PositionError(){
+this.UNKNOWN_ERROR=0;
+this.PERMISSION_DENIED=1;
+this.POSITION_UNAVAILABLE=2;
+this.TIMEOUT=3;
+this.code;
+this.message;
+};
+function Location_Coordinates(){
+this.latitude=null;
+this.longitude=null;
+this.altitude=null;
+this.accuracy=null;
+this.altitudeAccuracy=null;
+this.heading=null;
+this.speed=null;
+};
+function Location_Position(){
+this.coords=null;
+this.timestamp=null;
+};
+function Location_PositionOptions(){
+this.enableHighAccuracy;
+this.timeout;
+this.maximumAge;
+};
+var __sp_location_trace_transactionId=-1;
+function __sp_location_handle_error(_263,_264,_265){
+if((_263!=undefined)&&(typeof _263=="function")&&(_263!=null)){
+var _266=new Location_PositionError();
+if((-21)==_264){
+_266.code=_266.PERMISSION_DENIED;
+_266.message="permission denied";
+}else{
+if((-33)==_264){
+_266.code=_266.TIMEOUT;
+_266.message="request timed out";
+}else{
+_266.code=_266.UNKNOWN_ERROR;
+_266.message="UnKnown Error";
+}
+}
+_263(_266);
+}else{
+var _266=new Location_PositionError();
+_266.code=_266.UNKNOWN_ERROR;
+_266.message="UnKnown Error";
+throw _266;
+}
+};
+function __sp_location_descriptor(){
+this.interfaceName="geolocation";
+if(window.__Service_Interface_Ver){
+this.version=__Service_Interface_Ver;
+}else{
+this.version=1;
+}
+};
+var obj;
+function __sp_getLocation_cb(arg1,arg2,arg3){
+var _26a;
+_26a=glob_obj.getFromArray(arg1);
+if(_26a){
+success_cb1=_26a.success_cb;
+error_cb=_26a.error_cb;
+}else{
+alert("Geolocation: __sp_getLocation_cb: Callback not found ");
+return;
+}
+if(arg3.ErrorCode){
+__sp_location_handle_error(error_cb,arg3.ErrorCode,arg3.ErrorMessage);
+return;
+}else{
+var _26b=new Location_Coordinates();
+_26b.longitude=(arg3.ReturnValue.Longitude==undefined)?null:arg3.ReturnValue.Longitude;
+_26b.latitude=(arg3.ReturnValue.Latitude==undefined)?null:arg3.ReturnValue.Latitude;
+_26b.altitude=(arg3.ReturnValue.Altitude==undefined)?null:arg3.ReturnValue.Altitude;
+_26b.accuracy=(arg3.ReturnValue.HorizontalAccuracy==undefined)?null:arg3.ReturnValue.HorizontalAccuracy;
+_26b.altitudeAccuracy=(arg3.ReturnValue.VerticalAccuracy==undefined)?null:arg3.ReturnValue.VerticalAccuracy;
+_26b.heading=(arg3.ReturnValue.Heading==undefined)?null:arg3.ReturnValue.Heading;
+_26b.speed=(arg3.ReturnValue.HorizontalSpeed==undefined)?null:arg3.ReturnValue.HorizontalSpeed;
+var _26c=new Location_Position();
+_26c.coords={};
+modifyObjectBaseProp(_26c.coords);
+_26c.coords=_26b;
+_26c.timestamp=new Date();
+success_cb1(_26c);
+delete _26c.timestamp;
+delete _26c;
+delete _26b;
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_getLocation(_26d,_26e,_26f){
+if((_26d==undefined)||(_26d==null)||(typeof (_26d)!="function")){
+var _270="Wrong callback type";
+__sp_location_handle_error(_26e,0,_270);
+}
+if((_26e!=undefined)){
+if((_26e!=null)&&(_26e!="")&&(typeof (_26e)!="function")){
+var _271=new Location_PositionError();
+_271.code=-1;
+throw _271;
+}
+}
+var _272;
+var _273={};
+modifyObjectBaseProp(_273);
+_273.LocationInformationClass="GenericLocationInfo";
+var _274={};
+modifyObjectBaseProp(_274);
+_274.UpdateInterval=0;
+if(_26f!=undefined&&_26f!=null){
+if((typeof (_26f)!="object")){
+var _275="Wrong posOptions type";
+__sp_location_handle_error(_26e,0,_275);
+return;
+}
+}
+if(_26f!=undefined){
+if(_26f.maximumAge!=undefined){
+if(_26f.maximumAge){
+if((_26f.maximumAge==Infinity)){
+if((_26f.enableHighAccuracy==undefined)||(typeof (_26f.enableHighAccuracy)=="boolean")){
+var arg3=this.so.ILocation.GetLastPosition();
+if(arg3.ErrorCode<0){
+var _275="Invalid input type";
+__sp_location_handle_error(_26e,0,_275);
+return;
+}
+var _277=new Location_Coordinates();
+_277.longitude=(arg3.ReturnValue.Longitude==undefined)?null:arg3.ReturnValue.Longitude;
+_277.latitude=(arg3.ReturnValue.Latitude==undefined)?null:arg3.ReturnValue.Latitude;
+_277.altitude=(arg3.ReturnValue.Altitude==undefined)?null:arg3.ReturnValue.Altitude;
+_277.accuracy=(arg3.ReturnValue.HorizontalAccuracy==undefined)?null:arg3.ReturnValue.HorizontalAccuracy;
+_277.altitudeAccuracy=(arg3.ReturnValue.VerticalAccuracy==undefined)?null:arg3.ReturnValue.VerticalAccuracy;
+_277.heading=(arg3.ReturnValue.Heading==undefined)?null:arg3.ReturnValue.Heading;
+_277.speed=(arg3.ReturnValue.HorizontalSpeed==undefined)?null:arg3.ReturnValue.HorizontalSpeed;
+var _278=new Location_Position();
+_278.coords={};
+modifyObjectBaseProp(_278.coords);
+_278.coords=_277;
+_278.timestamp=new Date();
+_26d(_278);
+delete _278.timestamp;
+delete _278;
+delete _277;
+return;
+}
+}
+if(!(isNaN(parseInt(_26f.maximumAge)))){
+if((_26f.maximumAge==0)){
+var _275="Invalid input type";
+__sp_location_handle_error(_26e,0,_275);
+return;
+}
+_274.UpdateMaxAge=_26f.maximumAge;
+}else{
+var _275="Invalid input type";
+__sp_location_handle_error(_26e,0,_275);
+return;
+}
+}else{
+if((_26f.maximumAge==null)||(_26f.maximumAge=="")){
+}
+}
+}
+if((_26f.enableHighAccuracy!==undefined)){
+if(_26f.enableHighAccuracy==true){
+_273.EnableHighAccuracy=_26f.enableHighAccuracy;
+}else{
+if(_26f.enableHighAccuracy==false){
+_273.EnableHighAccuracy=_26f.enableHighAccuracy;
+}else{
+if((_26f.enableHighAccuracy==null)||(_26f.enableHighAccuracy=="")){
+}else{
+if((typeof (_26f.enableHighAccuracy)!="boolean")){
+var _279="Wrong value for enableHighAccuracy param";
+__sp_location_handle_error(_26e,0,_279);
+return;
+}
+}
+}
+}
+}
+if(_26f.timeout!==undefined){
+if((_26f.timeout!==null)||((_26f.timeout!==""))){
+if((_26f.timeout==Infinity)){
+var _275="Invalid input type";
+__sp_location_handle_error(_26e,0,_275);
+return;
+}else{
+if(!(isNaN(parseInt(_26f.timeout)))){
+if((_26f.timeout<=2147483647)){
+if((_26f.timeout==0)){
+var _275="Invalid input type";
+__sp_location_handle_error(_26e,0,_275);
+return;
+}
+_274.UpdateTimeOut=_26f.timeout;
+}else{
+var _275="Invalid input type";
+__sp_location_handle_error(_26e,0,_275);
+return;
+}
+}
+}
+}else{
+if((_26f.timeout===null)||((_26f.timeout===""))){
+}else{
+var _275="Invalid input type";
+__sp_location_handle_error(_26e,0,_275);
+return;
+}
+}
+}
+}
+_274.PartialUpdates=false;
+_273.Updateoptions=_274;
+try{
+temp_scb=_26d;
+temp_ecb=_26e;
+var rval=this.so.ILocation.GetLocation(_273,this.getLocationCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_26d,_26e);
+}
+delete _274;
+delete _273;
+if(rval.ErrorCode!=0){
+__sp_location_handle_error(_26e,rval.ErrorCode,rval.ErrorMessage);
+return;
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_getLocation: "+e);
+}
+};
+var __sp_location_trace_ucb=null;
+var __sp_location_fail_cb=null;
+function __sp_traceLocation_cb(arg1,arg2,arg3){
+var _27e;
+_27e=glob_obj.getFromArray(arg1);
+if(_27e){
+success_cb=_27e.success_cb;
+error_cb=_27e.error_cb;
+}else{
+alert("Geolocation: __sp_traceLocation_cb: Callback not found ");
+return;
+}
+if(arg3.ErrorCode){
+__sp_location_handle_error(error_cb,arg3.ErrorCode,arg3.ErrorMessage);
+}else{
+var _27f=new Location_Coordinates();
+_27f.longitude=(arg3.ReturnValue.Longitude==undefined)?null:arg3.ReturnValue.Longitude;
+_27f.latitude=(arg3.ReturnValue.Latitude==undefined)?null:arg3.ReturnValue.Latitude;
+_27f.altitude=(arg3.ReturnValue.Altitude==undefined)?null:arg3.ReturnValue.Altitude;
+_27f.accuracy=(arg3.ReturnValue.HorizontalAccuracy==undefined)?null:arg3.ReturnValue.HorizontalAccuracy;
+_27f.altitudeAccuracy=(arg3.ReturnValue.VerticalAccuracy==undefined)?null:arg3.ReturnValue.VerticalAccuracy;
+_27f.heading=(arg3.ReturnValue.Heading==undefined)?null:arg3.ReturnValue.Heading;
+_27f.speed=(arg3.ReturnValue.HorizontalSpeed==undefined)?null:arg3.ReturnValue.HorizontalSpeed;
+var _280=new Location_Position();
+_280.coords={};
+modifyObjectBaseProp(_280.coords);
+_280.coords=_27f;
+_280.timestamp=new Date();
+success_cb(_280);
+delete _280.timestamp;
+delete _280;
+delete _27f;
+return;
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_traceLocation(_281,_282,_283){
+if((_281==undefined)||(_281==null)||(typeof (_281)!="function")){
+var _284="Wrong callback type";
+__sp_location_handle_error(_282,0,_284);
+return;
+}
+if((typeof _281!="function")){
+var _284="Wrong callback type";
+__sp_location_handle_error(_282,0,_284);
+return;
+}
+if((_282!=undefined)){
+if((_282!=null)&&(_282!="")&&(typeof (_282)!="function")){
+var _285=new Location_PositionError();
+_285.code=-1;
+throw _285;
+}
+}
+var _286=this;
+var _287={};
+modifyObjectBaseProp(_287);
+_287.UpdateInterval=0;
+var _288={};
+modifyObjectBaseProp(_288);
+_288.LocationInformationClass="GenericLocationInfo";
+if(_283!=undefined&&_283!=null){
+if((typeof (_283)!="object")){
+var _284="Wrong posOptions type";
+__sp_location_handle_error(_282,0,_284);
+return;
+}
+}
+if(_283!=undefined){
+if((_283.enableHighAccuracy!==undefined)){
+if(_283.enableHighAccuracy==true){
+_288.EnableHighAccuracy=_283.enableHighAccuracy;
+}else{
+if(_283.enableHighAccuracy==false){
+_288.EnableHighAccuracy=_283.enableHighAccuracy;
+}else{
+if((_283.enableHighAccuracy==null)||(_283.enableHighAccuracy=="")){
+}else{
+if((typeof (_283.enableHighAccuracy)!="boolean")){
+var _289="Wrong value for enableHighAccuracy param";
+__sp_location_handle_error(_282,0,_289);
+return;
+}
+}
+}
+}
+}
+if(_283.timeout!==undefined){
+if((_283.timeout!==null)||((_283.timeout!==""))){
+if((_283.timeout==Infinity)){
+var _284="Invalid input type";
+__sp_location_handle_error(_282,0,_284);
+return;
+}else{
+if(!(isNaN(parseInt(_283.timeout)))){
+if((_283.timeout==0)){
+var _284="Invalid input type";
+__sp_location_handle_error(_282,0,_284);
+return;
+}
+_287.UpdateTimeOut=_283.timeout;
+}
+}
+}else{
+if((_283.timeout===null)||((_283.timeout===""))){
+}else{
+var _284="Invalid input type";
+__sp_location_handle_error(_282,0,_284);
+return;
+}
+}
+}
+if(typeof _283.maximumAge!="undefined"){
+if(_283.maximumAge==_infinity){
+_287.UpdateTimeOut=0;
+_287.UpdateMaxAge=2147483647;
+}else{
+if(!(isNaN(parseInt(_283.maximumAge)))){
+_287.UpdateMaxAge=_283.maximumAge;
+}else{
+if((_283.maximumAge===null)||((_283.maximumAge===""))){
+}else{
+var _284="Invalid input type";
+__sp_location_handle_error(_282,0,_284);
+return;
+}
+}
+}
+}
+}
+_287.PartialUpdates=false;
+_288.Updateoptions=_287;
+try{
+temp_scb=_281;
+temp_ecb=_282;
+var rval=this.so.ILocation.Trace(_288,this.traceCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_281,_282);
+}
+delete _287;
+delete _288;
+if(rval.ErrorCode!=0){
+__sp_location_handle_error(_282,rval.ErrorCode,rval.ErrorMessage);
+return;
+}
+return rval.TransactionID;
+}
+catch(e){
+__device_handle_exception(e,"__sp_traceLocation: "+e);
+}
+};
+function __sp_clearTrace(_28b){
+if(typeof _28b!="number"){
+var _28c="Invalid input type";
+__sp_location_handle_error(fail_cb,0,_28c);
+}
+var _28d={TransactionID:_28b};
+try{
+var _28e=this.so.ILocation.Cancel(_28d);
+}
+catch(e){
+__device_handle_exception(e,"__sp_clearTrace: "+e);
+}
+};
+function __sp_location_instance(){
+this.descriptor=new __sp_location_descriptor();
+this.getLocation=__sp_getLocation;
+this.getLocationCb=__sp_getLocation_cb;
+this.traceLocation=__sp_traceLocation;
+this.traceCb=__sp_traceLocation_cb;
+this.clearTrace=__sp_clearTrace;
+try{
+this.so=device.getServiceObject("Service.Location","ILocation");
+}
+catch(e){
+this.so=null;
+__device_handle_exception(e,"Location service not available");
+}
+};
+function __device_commlog_descriptor(_28f){
+this.interfaceName=_28f.interfaceName;
+this.version=_28f.version;
+};
+function __device_commlog_getList(_290,_291,_292){
+return this.provider.getList(_290,_291,_292);
+};
+function __device_commlog_setNotification(_293,_294){
+return this.provider.setNotification(_293,_294);
+};
+function __device_commlog_cancelNotification(){
+return this.provider.cancelNotification();
+};
+function __device_commlog_cancel(_295){
+return this.provider.cancel(_295);
+};
+function __device_commlog_deleteLogEntry(_296){
+return this.provider.deleteLogEntry(_296);
+};
+function __device_commlog(_297){
+this.provider=_297;
+this.interfaceName=_297.descriptor.interfaceName;
+this.version=_297.descriptor.version;
+this.getList=__device_commlog_getList;
+this.setNotification=__device_commlog_setNotification;
+this.cancelNotification=__device_commlog_cancelNotification;
+this.cancel=__device_commlog_cancel;
+this.deleteLogEntry=__device_commlog_deleteLogEntry;
+};
+var __device_commlog_service_entry={"name":null,"version":null,"proto":__device_commlog,"descriptor":__device_commlog_descriptor,"providers":[{"descriptor":__sp_commlog_descriptor,"instance":__sp_commlog_instance}]};
+var invoker_notification;
+function __sp_commlog_descriptor(){
+this.interfaceName="commlog";
+if(window.__Service_Interface_Ver){
+this.version=__Service_Interface_Ver;
+}else{
+this.version=1;
+}
+};
+var __sp_commlog_type_constants={"call":0,"sms":3};
+var __sp_commlog_constants={"received":0,"missed":5,"outgoing":1};
+var __sp_commlog_constants_output={"Received":0,"Missed":5,"Outgoing":1};
+var __notifArr=new Array();
+var __notifCount=0;
+__Notification.prototype=new Object();
+__Notification.prototype.constructor=__Notification;
+function __Notification(_298,_299){
+this.connectionId=_298;
+this.callback=_299;
+};
+var __nofLogs;
+function __get_const_string(def,val){
+var i;
+for(i in def){
+if(def[i]==val){
+return i;
+}
+}
+return null;
+};
+function __get_const_val(def,str){
+if(def[str]!=undefined){
+return def[str];
+}
+return null;
+};
+function __device_commlog_item(_29f){
+if(!_29f){
+return null;
+}
+var evt={};
+evt.type=__get_const_string(__sp_commlog_type_constants,_29f.EventType);
+if(evt.type==null||evt.type==undefined){
+return null;
+}
+evt.phoneNumber=_29f.PhoneNumber;
+if(evt.phoneNumber==null||evt.phoneNumber==undefined||evt.phoneNumber.length==0){
+evt.phoneNumber="private number";
+}
+evt.time=_29f.EventTime;
+evt.flag=(_29f.Direction==undefined)?null:__get_const_string(__sp_commlog_constants_output,_29f.Direction);
+evt.summary=_29f.Description;
+evt.logId=Number(_29f.id);
+evt.contactName=_29f.RemoteParty;
+if(!evt.contactName){
+evt.contactName=evt.phoneNumber;
+}
+return evt;
+};
+function __sp_commlog_iterator_get_next(){
+if(typeof __nofLogs=="number"){
+if(__nofLogs<=0){
+return null;
+}
+__nofLogs=__nofLogs-1;
+}
+if((typeof this.buffer=="object")&&(this.buffer!=null)){
+var b1=this.buffer;
+this.buffer=null;
+var _2a2=new __device_commlog_item(b1);
+return _2a2;
+}else{
+var _2a3;
+if(this.iter!=undefined&&this.iter!=null){
+while(_2a3=this.iter.getNext()){
+if(_2a3.EventType==0||_2a3.EventType==3){
+break;
+}
+}
+}
+if(typeof _2a3=="undefined"){
+return null;
+}
+var rval=new __device_commlog_item(_2a3);
+_2a3.close();
+return rval;
+}
+};
+function __sp_commlog_iterator_has_next(){
+if(__nofLogs<=0){
+return false;
+}
+if(this.iter!=undefined&&this.iter!=null){
+while(this.buffer=this.iter.getNext()){
+if(this.buffer.EventType==0||this.buffer.EventType==3){
+break;
+}
+}
+}
+if((typeof this.buffer=="object")&&(this.buffer!=null)){
+return true;
+}else{
+return false;
+}
+};
+function __sp_commlog_iterator_close(){
+this.iter.close();
+};
+function __sp_commlog_iterator(_2a5){
+this.iter=_2a5;
+this.buffer=null;
+this.next=__sp_commlog_iterator_get_next;
+this.hasNext=__sp_commlog_iterator_has_next;
+this.close=__sp_commlog_iterator_close;
+this.nofLogs=__nofLogs;
+};
+function __sp_commlog_getList_cb(arg1,arg2,arg3){
+var _2a9;
+var _2aa;
+var iter=null;
+var _2ac=null;
+var _2ad;
+_2ad=glob_obj.getFromArray(arg1);
+if(_2ad){
+_2a9=_2ad.success_cb;
+_2aa=_2ad.error_cb;
+}else{
+alert("Commlog: __sp_commlog_getList_cb : Callback not found ");
+return;
+}
+if(arg3.ErrorCode!=0){
+if(arg3.ErrorMessage){
+_2ac=splitErrorMessage(arg3.ErrorMessage);
+}else{
+_2ac="operation failed";
+}
+if(_2aa){
+setTimeout(function(){
+_2aa(new DeviceException(MapErrorCode[arg3.ErrorCode],"Commlog: getList: "+_2ac));
+},1000);
+return;
+}
+}else{
+if(arg3.ReturnValue){
+iter=new __sp_commlog_iterator(arg3.ReturnValue);
+}
+}
+if(arg2!=event_cancelled){
+_2a9(iter);
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_commlog_getList(_2ae,_2af,_2b0){
+if(_2ae==null||_2ae==undefined){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"CommLog:getList:callback is Required");
+}else{
+if(typeof _2ae!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog:getList:Invalid Callback");
+}
+}
+if(_2b0){
+if(typeof (_2b0)!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog: getList: ErrorCallback is invalid");
+}
+}
+if(_2af!=null&&_2af!=undefined){
+if(typeof _2af!="object"||__device_typeof(_2af)=="Array"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog: getList: Match is not an object");
+}
+if(_2af.type!=null&&_2af.type!=undefined){
+if(typeof _2af.type!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog: getList: Type is not a string");
+}
+}
+if(_2af.flag!=null&&_2af.flag!=undefined){
+if(typeof _2af.flag!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog: getList: Flag is not a string");
+}
+if(_2af.type){
+if(_2af.type.toLowerCase()=="sms"&&_2af.flag.toLowerCase()=="missed"){
+if(_2b0){
+_2b0(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"commlogs: getList: Missed is not supported for sms"));
+return;
+}else{
+throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"commlogs: getList: Missed is not supported for sms");
+}
+}
+}
+}
+if(_2af.nofLogs!=null&&_2af.nofLogs!=undefined){
+if(typeof _2af.nofLogs!="number"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog: getList: nofLogs is invalid");
+}
+}
+}
+try{
+var _2b1={};
+modifyObjectBaseProp(_2b1);
+_2b1.Type="Log";
+_2b1.Filter={};
+modifyObjectBaseProp(_2b1.Filter);
+if(_2af){
+if(_2af.type){
+var _2b2;
+_2b2=__get_const_val(__sp_commlog_type_constants,_2af.type.toLowerCase());
+if(_2b2!=undefined){
+_2b1.Filter.EventType=_2b2;
+}else{
+if(_2b0){
+_2b0(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: Type is out of range"));
+return;
+}else{
+throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: Type is out of range");
+}
+}
+}
+if(_2af.nofLogs!=null&&_2af.nofLogs!=undefined){
+if((_2af.nofLogs<0)||(_2af.nofLogs!=(_2af.nofLogs|0))){
+if(_2b0){
+_2b0(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: nofLogs is out of range"));
+return;
+}else{
+throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: nofLogs is out of range");
+}
+}
+__nofLogs=_2af.nofLogs;
+}
+if(_2af.flag){
+var _2b3;
+_2b3=__get_const_val(__sp_commlog_constants,_2af.flag.toLowerCase());
+if(_2b3!=undefined){
+_2b1.Filter.Direction=_2b3;
+}else{
+if(_2b0){
+_2b0(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: Flag is out of range"));
+}else{
+throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: Flag is out of range");
+}
+}
+}
+if(_2af.phoneNumber!=null&&_2af.phoneNumber!=undefined){
+if(_2af.phoneNumber!=""){
+_2b1.Filter.PhoneNumber=_2af.phoneNumber;
+}
+}
+if(_2af.contactName!=null&&_2af.contactName!=undefined){
+if(_2af.contactName!=""){
+_2b1.Filter.RemoteParty=_2af.contactName;
+}
+}
+if(_2af.startTime!=null&&_2af.startTime!=undefined){
+_2b1.Filter.StartTime=_2af.startTime;
+}
+if(_2af.endTime!=null&&_2af.endTime!=undefined){
+_2b1.Filter.EndTime=_2af.endTime;
+}
+}
+temp_scb=_2ae;
+temp_ecb=_2b0;
+var _2b4=this.so.IDataSource.GetList(_2b1,this.getListCb);
+if(_2b4.TransactionID){
+glob_obj.addToGlobalArray(_2b4.TransactionID,_2ae,_2b0);
+}
+if(_2b1.Filter){
+delete _2b1.Filter.Direction;
+delete _2b1.Filter.EventType;
+delete _2b1.Filter.PhoneNumber;
+}
+if(_2b1){
+delete _2b1.Filter;
+delete _2b1.Type;
+}
+if(_2b4.ErrorCode!=0){
+var _2b5="operation failed";
+if(_2b4.ErrorMessage){
+_2b5=splitErrorMessage(_2b4.ErrorMessage);
+}
+switch(MapErrorCode[_2b4.ErrorCode]){
+case this.error.INVALID_ARG_ERR:
+case this.error.MISSING_ARG_ERR:
+case this.error.NOT_SUPPORTED_ERR:
+throw new DeviceException(MapErrorCode[_2b4.ErrorCode],"CommLog:getList:"+_2b5);
 break;
 default:
-_37d=1001;
-}
-return _37d;
-};
-function __sp_landmarks_descriptor(){
-this.interfaceName="landmarks";
+if(_2b0){
+_2b0(new DeviceException(MapErrorCode[_2b4.ErrorCode],"CommLog:getList:"+_2b5));
+return;
+}else{
+throw new DeviceException(MapErrorCode[_2b4.ErrorCode],"CommLog:getList:"+_2b5);
+}
+}
+}
+return _2b4.TransactionID;
+}
+catch(e){
+__device_handle_exception(e,"__sp_commlog_Input_validation: "+e);
+}
+};
+function __sp_commlog_setNotification_cb(arg1,arg2,arg3){
+var _2b9;
+var _2ba;
+var _2bb=null;
+var _2bc;
+_2bc=glob_obj.getFromArray(arg1);
+if(_2bc){
+_2b9=_2bc.success_cb;
+_2ba=_2bc.error_cb;
+}else{
+alert("Commlog: __sp_commlog_setNotification_cb : Callback not found ");
+return;
+}
+if(arg3.ErrorCode!=0){
+if(arg3.ErrorMessage){
+err_msg=splitErrorMessage(arg3.ErrorMessage);
+}else{
+err_msg="operation failed";
+}
+if(_2ba){
+_2ba(new DeviceException(MapErrorCode[arg3.ErrorCode],"CommLog: getList: "+err_msg));
+return;
+}
+}else{
+if(arg3.ReturnValue){
+_2bb=new __device_commlog_item(arg3.ReturnValue);
+}
+}
+if(arg2!=event_cancelled){
+for(i in __notifArr){
+if(arg1==__notifArr[i].connectionId){
+var _2bd=__notifArr[i];
+break;
+}
+}
+if(_2bd){
+_2bd.callback(_2bb);
+}
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_commlog_setNotification(_2be,_2bf){
+if(!_2be){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"CommLog:setNotification:callback is missing");
+}
+if(typeof _2be!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog:setNotification:callback is invalid");
+}
+if(_2bf){
+if(typeof (_2bf)!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog: setNotification: ErrorCallback is invalid");
+}
+}
+for(i in __notifArr){
+var _2c0=__notifArr[i];
+__notifArr.splice(i,1);
+__notifCount=__notifArr.length;
+this.so.IDataSource.Cancel({TransactionID:_2c0.connectionId});
+break;
+}
+var _2c1={};
+modifyObjectBaseProp(_2c1);
+_2c1.Type="Log";
+_2c1.Filter={DelayTime:0};
+temp_scb=_2be;
+temp_ecb=_2bf;
+var _2c2=this.so.IDataSource.RequestNotification(_2c1,this.setNotificationCb);
+if(_2c2.TransactionID){
+glob_obj.addToGlobalArray(_2c2.TransactionID,_2be,_2bf);
+}
+__notifArr[__notifCount++]=new __Notification(_2c2.TransactionID,_2be);
+if(_2c1){
+delete _2c1.Type;
+}
+if(_2c2.ErrorCode!=0){
+var _2c3="operation failed";
+if(_2c2.ErrorMessage){
+_2c3=splitErrorMessage(_2c2.ErrorMessage);
+}
+switch(MapErrorCode[_2c2.ErrorCode]){
+case this.error.INVALID_ARG_ERR:
+case this.error.MISSING_ARG_ERR:
+case this.error.NOT_SUPPORTED_ERR:
+throw new DeviceException(MapErrorCode[_2c2.ErrorCode],"CommLog:setNotification:"+_2c3);
+break;
+default:
+if(_2bf){
+setTimeout(function(){
+_2bf(new DeviceException(MapErrorCode[_2c2.ErrorCode],"CommLog:setNotification:"+_2c3));
+},1000);
+}else{
+throw new DeviceException(MapErrorCode[_2c2.ErrorCode],"CommLog:setNotification:"+_2c3);
+}
+}
+}
+};
+function __sp_commlog_cancelNotification(){
+for(i in __notifArr){
+if(__notifArr[i].connectionId){
+var _2c4=__notifArr[i];
+__notifArr.splice(i,1);
+__notifCount=__notifArr.length;
+break;
+}
+}
+if(_2c4){
+var _2c5=this.so.IDataSource.Cancel({TransactionID:_2c4.connectionId});
+if(_2c5.ErrorCode!=0){
+var _2c6="operation failed";
+if(_2c5.ErrorMessage){
+_2c6=splitErrorMessage(_2c5.ErrorMessage);
+}
+}
+}
+};
+function __sp_commlog_cancel(_2c7){
+if(!_2c7){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"CommLog:cancel:transactionId is missing");
+}
+if(typeof _2c7!="number"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog:cancel:transactionId is invalid");
+}
+var _2c8=this.so.IDataSource.Cancel({TransactionID:_2c7});
+if(_2c8.ErrorCode!=0){
+var _2c9="operation failed";
+if(_2c8.ErrorMessage){
+_2c9=splitErrorMessage(_2c8.ErrorMessage);
+}
+throw new DeviceException(MapErrorCode[_2c8.ErrorCode],"CommLog:cancel:"+_2c9);
+}
+};
+function __sp_commlog_deleteLogEntry(_2ca){
+if(_2ca==null||_2ca==undefined){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"CommLog:deleteLogEntry:logId is missing");
+}
+if(typeof _2ca!="number"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog:deleteLogEntry:logId is invalid");
+}
+var _2cb={};
+modifyObjectBaseProp(_2cb);
+_2cb.Type="Log";
+_2cb.Data={id:_2ca.toString()};
+modifyObjectBaseProp(_2cb.Data);
+var _2cc=this.so.IDataSource.Delete(_2cb);
+if(_2cc.ErrorCode!=0){
+var _2cd="operation failed";
+if(_2cc.ErrorMessage){
+_2cd=splitErrorMessage(_2cc.ErrorMessage);
+}
+throw new DeviceException(MapErrorCode[_2cc.ErrorCode],"CommLog:deleteLogEntry:"+_2cd);
+}
+};
+function __sp_commlog_instance(){
+this.descriptor=new __sp_commlog_descriptor();
+this.getList=__sp_commlog_getList;
+this.getListCb=__sp_commlog_getList_cb;
+this.setNotification=__sp_commlog_setNotification;
+this.setNotificationCb=__sp_commlog_setNotification_cb;
+this.cancelNotification=__sp_commlog_cancelNotification;
+this.cancel=__sp_commlog_cancel;
+this.deleteLogEntry=__sp_commlog_deleteLogEntry;
+this.error=new DeviceException(0,"Dummy");
+try{
+this.so=device.getServiceObject("Service.Logging","IDataSource");
+}
+catch(e){
+this.so=null;
+__device_handle_exception(e,"commlog service not available");
+}
+};
+function __device_messaging_descriptor(_2ce){
+this.interfaceName=_2ce.interfaceName;
+this.version=_2ce.version;
+};
+function __device_messaging_startEditor(_2cf){
+return this.provider.startEditor(_2cf);
+};
+function __device_messaging_getList(_2d0,_2d1,_2d2,_2d3,_2d4){
+return this.provider.getList(_2d0,_2d1,_2d2,_2d3,_2d4);
+};
+function __device_messaging_send(_2d5,_2d6,id,_2d8){
+return this.provider.send(_2d5,_2d6,id,_2d8);
+};
+function __device_messaging_setNotifier(_2d9,_2da){
+return this.provider.setNotifier(_2d9,_2da);
+};
+function __device_messaging_cancelNotifier(){
+return this.provider.cancelNotifier();
+};
+function __device_messaging_getMessage(id){
+return this.provider.getMessage(id);
+};
+function __device_messaging_delete(id){
+return this.provider.deleteMessage(id);
+};
+function __device_messaging_setStatus(id,_2de){
+return this.provider.setStatus(id,_2de);
+};
+function __device_messaging_cancel(_2df){
+return this.provider.cancel(_2df);
+};
+function __device_messaging(_2e0){
+this.provider=_2e0;
+this.interfaceName=_2e0.descriptor.interfaceName;
+this.version=_2e0.descriptor.version;
+this.SORT_ASCENDING=0;
+this.SORT_DESCENDING=1;
+this.SORT_BY_DATE=0;
+this.SORT_BY_SENDER=1;
+this.STATUS_READ=0;
+this.STATUS_UNREAD=1;
+this.startEditor=__device_messaging_startEditor;
+this.getList=__device_messaging_getList;
+this.send=__device_messaging_send;
+this.setNotifier=__device_messaging_setNotifier;
+this.cancelNotifier=__device_messaging_cancelNotifier;
+this.getMessage=__device_messaging_getMessage;
+this.deleteMessage=__device_messaging_delete;
+this.setStatus=__device_messaging_setStatus;
+this.cancel=__device_messaging_cancel;
+};
+var __device_messaging_service_entry={"name":null,"version":null,"proto":__device_messaging,"descriptor":__device_messaging_descriptor,"providers":[{"descriptor":__sp_messaging_descriptor,"instance":__sp_messaging_instance}]};
+var FILE_SCHEME="file://";
+function __sp_messaging_descriptor(){
+this.interfaceName="messaging";
 if(window.__Service_Interface_Ver){
 this.version=__Service_Interface_Ver;
 }else{
 this.version=1;
 }
 };
-function __sp_landmarks_instance(){
-this.descriptor=new __sp_landmarks_descriptor();
-this.startEditor=__sp_landmarks_startEditor;
-this.getCategories=__sp_landmarks_category_getList;
-this.addCategory=__sp_landmarks_category_add;
-this.updateCategory=__sp_landmarks_category_update;
-this.deleteCategory=__sp_landmarks_category_delete;
-this.getLandmarks=__sp_landmarks_getList;
-this.addLandmark=__sp_landmarks_add;
-this.updateLandmark=__sp_landmarks_update;
-this.deleteLandmark=__sp_landmarks_delete;
-this.importLandmarks=__sp_landmarks_import;
-this.exportLandmarks=__sp_landmarks_export;
-this.organizeLandmarks=__sp_landmarks_organize;
-this.cancel=__sp_landmarks_cancel;
+function __sp_messaging_instance(){
+this.descriptor=new __sp_messaging_descriptor();
+this.startEditor=__sp_messaging_startEditor;
+this.getList=__sp_messaging_getList;
+this.getListcB=__sp_message_getListcB;
+this.send=__sp_messaging_send;
+this.sendcb=__sp_message_sendcb;
+this.setNotifier=__sp_messaging_setNotifier;
+this.setNotifierCb=__sp_messaging_setNotifier_cb;
+this.cancelNotifier=__sp_messaging_cancelNotifier;
+this.getMessage=__sp_messaging_getMessage;
+this.deleteMessage=__sp_messaging_delete;
+this.setStatus=__sp_messaging_setStatus;
+this.cancel=__sp_messaging_cancel;
+this.sendCommon=__sp_messaging_send_common;
+this.SORT_ASCENDING=0;
+this.SORT_DESCENDING=1;
+this.SORT_BY_DATE=0;
+this.SORT_BY_SENDER=1;
+this.STATUS_READ=0;
+this.STATUS_UNREAD=1;
+this.error=new DeviceException(0,"Dummy");
 try{
-this.so=device.getServiceObject("Service.Landmarks","IDataSource");
+this.so=device.getServiceObject("Service.Messaging","IMessaging");
 }
 catch(e){
-__device_handle_exception(e,"Landmarks service not available");
-}
-};
-var __SP_CATEGORY_MIN_LOCAL_ID=16;
-var __sp_category_list=[{id:1,globalId:3000,name:"Accommodation"},{id:2,globalId:6000,name:"Businesses"},{id:3,globalId:9000,name:"Telecommunications"},{id:4,globalId:12000,name:"Education"},{id:5,globalId:15000,name:"Entertainment"},{id:6,globalId:18000,name:"Food and drink"},{id:7,globalId:21000,name:"Geographical locations"},{id:8,globalId:24000,name:"Outdoor activities"},{id:9,globalId:27000,name:"People"},{id:10,globalId:30000,name:"Public services"},{id:11,globalId:33000,name:"Places of worship"},{id:12,globalId:36000,name:"Shopping"},{id:13,globalId:39000,name:"Sightseeing"},{id:14,globalId:42000,name:"Sports"},{id:15,globalId:45000,name:"Transport"}];
-function __sp_landmarks_category_iterator(_37e){
-this.iter=_37e;
-this.next=__sp_landmarks_category_iterator_get_next;
-this.hasNext=__sp_landmarks_category_iterator_has_next;
-this.hasElement=false;
-this.catItem=null;
-this.close=__sp_landmarks_category_close;
-};
-function __sp_landmarks_category_close(){
-this.iter.close();
-};
-function __sp_landmarks_category_iterator_has_next(){
-if(this.hasElement){
-if(this.catItem!==null){
-return true;
-}else{
-return false;
-}
-}else{
-this.catItem=this.iter.getNext();
-this.hasElement=true;
-if(typeof this.catItem=="undefined"){
-this.catItem=null;
-return false;
-}else{
-return true;
-}
-}
-};
-function __sp_landmarks_category_iterator_get_next(){
-if(this.hasElement){
-var _37f=new Object();
-_37f=this.catItem;
-this.catItem=this.iter.getNext();
-if(typeof (this.catItem)=="undefined"){
-this.catItem=null;
-}
-return new __sp_device_category_obj(_37f);
-}else{
-this.catItem=this.iter.getNext();
-if(typeof this.catItem=="undefined"){
-this.hasElement=true;
-this.catItem=null;
+this.so=null;
+__device_handle_exception(e,"Messaging service not available");
+}
+};
+function __sp_attachment_build(_2e1){
+if(!_2e1){
+return null;
+}
+var _2e2={};
+modifyObjectBaseProp(_2e2);
+if(_2e1.uri){
+if(typeof _2e1.uri!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"uri is invalid");
+}
+if(_2e1.uri.slice(0,7)==FILE_SCHEME){
+if(_2e1.uri.charAt(7)=="/"){
+if(_2e1.uri.charAt(9)!=":"){
+throw new DeviceException(this.error.URI_NOT_FOUND_ERR,"specified uri not found");
+}
+_2e2.FileName=_2e1.uri.slice(8).replace(/\057/g,"\\");
+if(_2e2.FileName.length>256){
+throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"uri is out of range");
+}
+}else{
+if(_2e1.uri.charAt(8)!=":"){
+throw new DeviceException(this.error.URI_NOT_FOUND_ERR,"specified uri not found");
+}
+_2e2.FileName=_2e1.uri.slice(7).replace(/\057/g,"\\");
+if(_2e2.FileName.length>256){
+throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"uri is out of range");
+}
+}
+}else{
+throw new DeviceException(this.error.INVALID_URI_ERR,"uri is invalid");
+}
+}
+return _2e2;
+};
+function __sp_message_build(_2e3,id){
+if(!_2e3){
 return null;
-}else{
-this.hasElement=true;
-var _380=new Object();
-_380=this.lmItem;
-this.catItem=this.iter.getNext();
-if(typeof (this.catItem)=="undefined"){
-this.catItem=null;
-}
-return new __sp_device_category_obj(_380);
-}
-}
-};
-function __sp_landmarks_iterator(_381){
-this.iter=_381;
-this.next=__sp_landmarks_iterator_get_next;
-this.hasNext=__sp_landmarks_iterator_has_next;
-this.hasElement=false;
-this.lmItem=null;
-this.close=__sp_landmarks_landmarkitem_close;
-};
-function __sp_landmarks_landmarkitem_close(){
-this.iter.close();
-};
-function __sp_device_landmark_location_obj(_382){
-this.longitude=(_382.Longitude==undefined)?null:_382.Longitude;
-this.latitude=(_382.Latitude==undefined)?null:_382.Latitude;
-if(_382.Altitude){
-this.altitude=_382.Altitude;
-}
-if(_382.HAccuracy){
-this.hAccuracy=_382.HAccuracy;
-}
-if(_382.VAccuracy){
-this.vAccuracy=_382.VAccuracy;
-}
-};
-function __sp_landmark_position_obj(_383){
-if(_383.longitude!==undefined){
-this.Longitude=_383.longitude;
-}
-if(_383.latitude!==undefined){
-this.Longitude=_383.latitude;
-}
-};
-function __sp_landmark_position_obj_fromJS_2LIW(_384){
-this.Longitude=_384.longitude;
-this.Latitude=_384.latitude;
-if(_384.altitude){
-this.Altitude=_384.altitude;
-}
-if(_384.hAccuracy){
-this.HAccuracy=_384.hAccuracy;
-}
-if(_384.vAccuracy){
-this.VAccuracy=_384.vAccuracy;
-}
-};
-function __sp_landmark_bounded_area_obj(area){
-this.NorthLatitude=area.coordinate1.latitude;
-this.SouthLatitude=area.coordinate2.latitude;
-this.EastLongitude=area.coordinate1.longitude;
-this.WestLongitude=area.coordinate2.longitude;
-};
-function __sp_device_landmark_address_obj(_386){
-if(_386.Street){
-this.street=_386.Street;
-}
-if(_386.City){
-this.city=_386.City;
-}
-if(_386.state){
-this.state=_386.state;
-}
-if(_386.AreaCode){
-this.postalCode=_386.AreaCode;
-}
-if(_386.Country){
-this.country=_386.Country;
-}
-if(_386.BuildingName){
-this.building=_386.BuildingName;
-}
-if(_386.Telephone){
-this.phone=_386.Telephone;
-}
-};
-function __sp_landmark_address_obj(_387){
-if(_387.street){
-this.Street=_387.street;
-}
-if(_387.locale){
-this.City=_387.locale;
-}
-if(_387.region){
-this.District=_387.region;
-}
-if(_387.code){
-this.AreaCode=_387.code;
-}
-if(_387.country){
-this.Country=_387.country;
-}
-};
-function __sp_get_category_ids_for_names(_388){
-var _389=new Array();
-var _38a=0;
-for(var i in _388){
-for(var ii in __sp_category_list){
-if(__sp_category_list[ii].name.toLowerCase()==_388[i].toLowerCase()){
-_389.push(__sp_category_list[ii].id.toString());
-_38a=1;
-}
-}
-if(_38a==0){
+}
+var _2e5={};
+modifyObjectBaseProp(_2e5);
+var _2e6=0;
+_2e5.MessageParam={};
+modifyObjectBaseProp(_2e5.MessageParam);
+_2e5.MessageParam.LaunchEditor=false;
+_2e5.MessageType=(_2e3.type==undefined||_2e3.type==null)?"SMS":_2e3.type;
+if(_2e3.to){
+if(typeof (_2e3.to)=="string"){
+_2e5.To=_2e3.to;
+}else{
+if(__device_typeof(_2e3.to)=="Array"&&_2e3.to.length>0){
+if(_2e3.to[0]){
+_2e5.To=_2e3.to[0];
+}
+if(_2e3.to.length>1){
+if(_2e3.to.slice(1)){
+_2e5.MessageParam.To=_2e3.to.slice(1);
+}
+}
+}else{
+_2e5.To=_2e3.to;
+}
+}
+}
+if(_2e3.cc){
+_2e5.MessageParam.Cc=_2e3.cc;
+}
+if(id){
+if((typeof (id)=="string")&&!(isNaN(id))){
+id=Number(id);
+}
+_2e5.MessageParam.TemplateId=id;
+}
+if(_2e5.MessageType=="SMS"){
+if(_2e3.body){
+_2e5.BodyText=_2e3.body;
+}
+}
+if(_2e5.MessageType=="MMS"){
+if(_2e3.body){
+_2e5.BodyText=_2e3.body;
+}
+if(_2e3.subject){
+if(typeof _2e3.subject=="string"&&_2e3.subject.length>256){
+throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"subject length is greater than 256 characters");
+}
+_2e5.Subject=_2e3.subject;
+}
+if(_2e3.attachments){
+_2e5.MessageParam.AttachmentList=[];
+for(var a in _2e3.attachments){
+if(typeof _2e3.attachments[a]=="object"&&__device_typeof(_2e3.attachments[a])!="Array"){
+_2e5.MessageParam.AttachmentList.push(__sp_attachment_build(_2e3.attachments[a]));
+_2e6=1;
+}
+}
+if(_2e6==0){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"uri is invalid");
+}
+}
+}
+return _2e5;
+};
+function __sp_device_attachment_build(_2e8){
+if(!_2e8){
+return null;
+}
+var _2e9={};
+_2e9.uri=FILE_SCHEME+_2e8.FileName;
+return _2e9;
+};
+function __sp_device_message_build(_2ea){
+if(!_2ea){
+return null;
+}
+var _2eb={};
+_2eb.body=null;
+_2eb.subject=null;
+_2eb.attachments=null;
+_2eb.to=null;
+_2eb.cc=null;
+_2eb.type=_2ea.MessageType;
+if(_2ea.BodyText){
+_2eb.body=_2ea.BodyText;
+}
+if(_2ea.to){
+_2eb.to=_2ea.To;
+}
+if(_2ea.Subject){
+_2eb.subject=_2ea.Subject;
+}
+_2eb.attachment=false;
+if(_2eb.type=="MMS"){
+if(_2ea.Cc){
+_2eb.cc=_2ea.Cc;
+}
+if(_2ea.AttachmentList){
+_2eb.attachment=true;
+_2eb.attachments=[];
+for(var a in _2ea.AttachmentList){
+if(_2ea.AttachmentList.hasOwnProperty("a")){
+_2eb.attachments.push(__sp_device_attachment_build(_2ea.AttachmentList[a]));
+}
+}
+}
+}
+return _2eb;
+};
+function __sp_device_message_info_build_notifier(_2ed){
+if(!_2ed){
+return null;
+}
+var _2ee={};
+_2ee.message={};
+_2ee.message.type=_2ed.MessageType;
+_2ee.sender=_2ed.Sender;
+_2ee.message.subject=_2ed.Subject;
+_2ee.time=_2ed.Time;
+_2ee.attachments=(_2ed.Attachments==undefined||_2ed.Attachments==null)?(!(_2ed.AttachmentList==undefined||_2ed.AttachmentList==null)):_2ed.Attachments;
+_2ee.unread=_2ed.Unread;
+_2ee.id=(_2ed.MessageId).toString();
+return _2ee;
+};
+function __sp_device_message_info_build(_2ef){
+if(!_2ef){
+return null;
+}
+var _2f0={};
+_2f0.message=__sp_device_message_build(_2ef);
+_2f0.sender=_2ef.Sender;
+_2f0.time=_2ef.Time;
+_2f0.unread=_2ef.Unread;
+_2f0.id=(_2ef.MessageId).toString();
+return _2f0;
+};
+function __sp_message_iterator_get_next(){
+var _2f1=this.iter.getNext();
+if(typeof _2f1=="undefined"){
 return null;
 }
-_38a=0;
-}
-return _389;
-};
-function __sp_device_landmark_obj(_38d){
-this.landmarkId=_38d.id;
-if(_38d.LandmarkName){
-this.name=_38d.LandmarkName;
-}
-if(_38d.LandmarkDesc){
-this.description=_38d.LandmarkDesc;
-}
-if(_38d.CoverageRadius){
-this.coverageRadius=_38d.CoverageRadius;
-}
-if(_38d.LandmarkPosition){
-this.position=new __sp_device_landmark_location_obj(_38d.LandmarkPosition);
-}
-if(_38d.CategoryInfo){
-this.categoryIds=_38d.CategoryInfo;
-}
-if(_38d.LandmarkFields){
-this.address=new __sp_device_landmark_address_obj(_38d.LandmarkFields);
-}
-};
-function __sp_landmark_obj(_38e,str){
-if(_38e.name){
-this.LandmarkName=_38e.name;
-}
-if(_38e.landmarkId){
-this.id=_38e.landmarkId;
-}
-if(_38e.description){
-this.LandmarkDesc=_38e.description;
-}
-if(_38e.position){
-this.LandmarkPosition=new __sp_landmark_position_obj_fromJS_2LIW(_38e.position);
-}
-if(_38e.coverageRadius){
-this.CoverageRadius=_38e.coverageRadius;
-}
-if(_38e.categories){
-this.CategoryInfo=__sp_get_category_ids_for_names(_38e.categories);
-if(!this.CategoryInfo){
-throw new DeviceError("Landmarks: "+str+"Category is invalid",err_bad_argument);
-}
-}
-if(_38e.address){
-this.LandmarkFields=new __sp_landmark_address_obj(_38e.address);
-}
-if(_38e.building){
-if(!this.LandmarkFields){
-this.LandmarkFields=new Object();
-modifyObjectBaseProp(this.LandmarkFields);
-}
-this.LandmarkFields.BuildingName=_38e.building;
-}
-if(_38e.phone){
-if(!this.LandmarkFields){
-this.LandmarkFields=new Object();
-modifyObjectBaseProp(this.LandmarkFields);
-}
-this.LandmarkFields.Telephone=_38e.phone;
-}
-};
-function __sp_landmarks_iterator_has_next(){
-if(this.hasElement){
-if(this.lmItem!==null){
-return true;
-}else{
-return false;
-}
-}else{
-this.lmItem=this.iter.getNext();
-this.hasElement=true;
-if(typeof this.lmItem=="undefined"){
-this.lmItem=null;
-return false;
-}else{
-return true;
-}
-}
-};
-function __sp_landmarks_iterator_get_next(){
-if(this.hasElement){
-var _390=new Object();
-_390=this.lmItem;
-this.lmItem=this.iter.getNext();
-if(typeof (this.lmItem)=="undefined"){
-this.lmItem=null;
-}
-return new __sp_device_landmark_obj(_390);
-}else{
-this.lmItem=this.iter.getNext();
-if(typeof this.lmItem=="undefined"){
-this.hasElement=true;
-this.lmItem=null;
-return null;
-}else{
-this.hasElement=true;
-var _391=new Object();
-_391=this.lmItem;
-this.lmItem=this.iter.getNext();
-if(typeof (this.lmItem)=="undefined"){
-this.lmItem=null;
-}
-return new __sp_device_landmark_obj(_391);
-}
-}
-};
-function __sp_category_obj(_392){
-if(_392.name){
-this.CategoryName=_392.name;
-}
-if(_392.categoryId){
-this.id=_392.categoryId;
-}
-};
-function __sp_device_category_obj(_393){
-this.categoryId=_393.id;
-this.name=_393.CategoryName;
-};
-var LANDMARKS_APP_ID=270501282;
-function __sp_landmarks_startEditor(_394,_395,_396){
-error=new DeviceAPIError(0,"dummy");
-if((_394===undefined)||(_394===null)||(_394==="")){
-throw new DeviceAPIError(error.MISSING_ARG_ERR,"StartEditor:Missing Success Callback");
-}
-if((typeof _394)!="function"){
-throw new DeviceAPIError(error.INVALID_ARG_ERR,"StartEditor:Success Callback must be of type function");
-}
-if(_395!==undefined){
-if((_395!==null)&&(_395!=="")){
-throw new DeviceAPIError(error.NOT_SUPPORTED_ERR,"startEditor:landmark item is not supported");
-}
-}
-if((_396!==undefined)&&(_396!==null)&&(_396!=="")){
-if((typeof _396)!="function"){
-throw new DeviceAPIError(error.INVALID_ARG_ERR,"StartEditor:error callback must be of type function");
-}
-}
-var _397=270501282;
-var _398;
-function __s60_on_app_exit(){
-window.xwidget.onshow=null;
-if(_398){
-_398();
-}
-};
-var _399=function(arg1,arg2,arg3){
-_394(arg1,arg2,arg3);
-};
-__s60_start_and_wait(_397,"",_399);
-};
-function __sp_landmarks_category_getList(_39d,name,_39f){
+var _2f2=__sp_device_message_info_build(_2f1);
+_2f1.close();
+return _2f2;
+};
+function __sp_message_iterator(_2f3){
+this.iter=_2f3;
+this.next=__sp_message_iterator_get_next;
+this.close=function(){
+this.iter.close();
+};
+};
+function __sp_message_getListcB(arg1,arg2,arg3){
+var _2f7;
+var _2f8;
+var _2f9;
+_2f9=glob_obj.getFromArray(arg1);
+if(_2f9){
+_2f7=_2f9.success_cb;
+_2f8=_2f9.error_cb;
+}else{
+alert("Messaging: __sp_message_getListcB: Callback not found ");
+return;
+}
+var iter=null;
+if(arg3.ErrorCode!=0){
+if(arg3.ErrorMessage){
+err_msg=splitErrorMessage(arg3.ErrorMessage);
+}else{
+err_msg="Operation Failed";
+}
+if(_2f8){
+_2f8(new DeviceException(MapErrorCode[arg3.ErrorCode],"Messaging: getList: "+err_msg));
+return;
+}
+}else{
+if(arg3.ReturnValue){
+iter=new __sp_message_iterator(arg3.ReturnValue);
+}
+}
+if(arg2!=event_cancelled){
+_2f7(iter);
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_messaging_getList(_2fb,_2fc,_2fd,_2fe,_2ff){
+if(!_2fb){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:getList:callback is missing");
+}else{
+if(typeof _2fb!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:getList:callback is not a function");
+}
+}
+if(_2fc!=null&&_2fc!=undefined&&typeof _2fc!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:getList:match is invalid");
+}
+if(_2fd!=null&&_2fd!=undefined&&typeof _2fd!="number"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:getList:sortkey is invalid");
+}
+if(_2fe!=null&&_2fe!=undefined&&typeof _2fe!="number"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:getList:sortorder is invalid");
+}
+if(_2fd!=null&&_2fd!=undefined&&typeof _2fd=="number"){
+if((_2fd!=0)&&(_2fd!=1)){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:getList:sortkey is invalid");
+}
+}
+if(_2fe!=null&&_2fe!=undefined&&typeof _2fe=="number"){
+if((_2fe!=0)&&(_2fe!=1)){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:getList:sortorder is invalid");
+}
+}
+if(_2ff){
+if(typeof (_2ff)!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging: startEditor: ErrorCallback is invalid");
+}
+}
+var _300={};
+modifyObjectBaseProp(_300);
+_300.Type="Inbox";
+_300.Filter={};
+modifyObjectBaseProp(_300.Filter);
+if(_2fc){
+if(_2fc.type!=null&&_2fc.type!=undefined){
+_300.Filter.MessageTypeList=_2fc.type;
+}
+if(_2fc.senders!=null&&_2fc.senders!=undefined){
+_300.Filter.SenderList=_2fc.senders;
+}
+if(_2fc.subject!=null&&_2fc.subject!=undefined){
+if(_2fc.subject.length>256){
+if(_2ff){
+_2ff(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:getList:subject is out of range"));
+return;
+}else{
+throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:getList:subject is out of range");
+}
+}else{
+_300.Filter.Subject=_2fc.subject;
+}
+}
+if(_2fc.start!=null&&_2fc.start!=undefined){
+_300.Filter.StartDate=_2fc.start;
+}
+if(_2fc.end!=null&&_2fc.end!=undefined){
+_300.Filter.EndDate=_2fc.end;
+}
+}
+if(_2fd||_2fe){
+_300.SortOrder={};
+modifyObjectBaseProp(_300.SortOrder);
+if(_2fd){
+if((_2fd==this.SORT_BY_DATE)){
+_300.SortOrder.Key="Date";
+}else{
+if((_2fd==this.SORT_BY_SENDER)){
+_300.SortOrder.Key="Sender";
+}
+}
+}else{
+_300.SortOrder.Key="Date";
+}
+if(_2fe){
+if((_2fe==this.SORT_ASCENDING)){
+_300.SortOrder.Order="Ascending";
+}else{
+if((_2fe==this.SORT_DESCENDING)){
+_300.SortOrder.Order="Descending";
+}
+}
+}else{
+_300.SortOrder.Order="Ascending";
+}
+}
 try{
-var _3a0=new DeviceAPIError(0,"dummy");
-if((_39d===undefined)||(_39d==="")||(_39d===null)){
-throw new DeviceAPIError(_3a0.MISSING_ARG_ERR,"callback is missing");
-}
-if(typeof (_39d)!="function"){
-throw new DeviceAPIError(_3a0.INVALID_ARG_ERR,"invalid callback argument");
-}
-var _3a1=false;
-if((_39f!==undefined)&&(_39f!==null)&&(_39f!=="")){
-if(typeof (_39f)!="function"){
-throw new DeviceAPIError(_3a0.INVALID_ARG_ERR,"invalid error callback argument");
-}else{
-_3a1=true;
-}
-}
-var _3a2=new Object();
-modifyObjectBaseProp(_3a2);
-_3a2.Type="Category";
-if((name!==undefined)&&(name!==null)&&(name!=="")){
-if(typeof (name)!="string"){
-throw new DeviceAPIError(_3a0.INVALID_ARG_ERR,"name must be a string");
-}
-}
-if(name){
-_3a2.Filter=new Object();
-modifyObjectBaseProp(_3a2.Filter);
-_3a2.Filter.CategoryName=name;
-_3a2.Filter.PreviousMatchesOnly=false;
-}
-this.invoker=function(arg1,arg2,arg3){
+temp_scb=_2fb;
+temp_ecb=_2ff;
+var _301=this.so.IMessaging.GetList(_300,this.getListcB);
+if(_301.TransactionID){
+glob_obj.addToGlobalArray(_301.TransactionID,_2fb,_2ff);
+}
+if(_300){
+delete _300.Filter;
+delete _300.SortOrder;
+delete _300.Type;
+}
+if(_301.ErrorCode!=0){
+var _302="operation failed";
+if(_301.ErrorMessage){
+_302=splitErrorMessage(_301.ErrorMessage);
+}
+switch(MapErrorCode[_301.ErrorCode]){
+case this.error.INVALID_ARG_ERR:
+case this.error.MISSING_ARG_ERR:
+case this.error.NOT_SUPPORTED_ERR:
+throw new DeviceException(MapErrorCode[_301.ErrorCode],"Messaging:getList:"+_302);
+break;
+default:
+if(_2ff){
+setTimeout(function(){
+_2ff(new DeviceException(MapErrorCode[_301.ErrorCode],"Messaging:getList:"+_302));
+},500);
+}else{
+throw new DeviceException(MapErrorCode[_301.ErrorCode],"Messaging:getList:"+_302);
+}
+}
+}
+return _301.TransactionID;
+}
+catch(e){
+__device_handle_exception(e,"__sp_messaging_getList: "+e);
+}
+};
+function __sp_message_sendcb(arg1,arg2,arg3){
+var _306;
+var eCB;
+var _308=glob_obj.getFromArray(arg1);
+if(_308){
+_306=_308.success_cb;
+eCB=_308.error_cb;
+}else{
+alert("Messaging : __sp_message_sendcb : Callback not found");
+return;
+}
+if(_306){
+var _309="operation failed";
+if(arg3.ErrorCode!=0){
+if(arg3.ErrorMessage){
+_309=splitErrorMessage(arg3.ErrorMessage);
+}
+if(eCB){
+setTimeout(function(){
+eCB(new DeviceException(MapErrorCode[arg3.ErrorCode],"Messaging: send: "+_309));
+},500);
+return;
+}
+}
+if(arg2!=event_cancelled){
+_306();
+}
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_messaging_send_common(_30a,_30b,_30c,id,eCB){
+var _30f=__sp_message_build(_30a,id);
+_30f.MessageParam.LaunchEditor=_30b;
+var _310;
+if(_30b==false){
+temp_scb=_30c;
+temp_ecb=eCB;
+_310=this.so.IMessaging.Send(_30f,this.sendcb);
+if(_310.TransactionID){
+glob_obj.addToGlobalArray(_310.TransactionID,_30c,eCB);
+}
+if(_310.ErrorCode!=0){
+var _311="operation failed";
+if(_310.ErrorMessage){
+_311=splitErrorMessage(_310.ErrorMessage);
+}
+switch(MapErrorCode[_310.ErrorCode]){
+case this.error.INVALID_ARG_ERR:
+case this.error.MISSING_ARG_ERR:
+case this.error.NOT_SUPPORTED_ERR:
+throw new DeviceException(MapErrorCode[_310.ErrorCode],_311);
+break;
+default:
+if(eCB){
+setTimeout(function(){
+eCB(new DeviceException(MapErrorCode[_310.ErrorCode],_311));
+},500);
+return;
+}else{
+throw new DeviceException(MapErrorCode[_310.ErrorCode],_311);
+}
+}
+}
+var _312=_310.TransactionID;
+return _312;
+}else{
+_310=this.so.IMessaging.Send(_30f);
+if(_310.ErrorCode!=0){
+if(_310.ErrorMessage){
+var _313=splitErrorMessage(_310.ErrorMessage);
+throw new DeviceException(MapErrorCode[_310.ErrorCode],"Messaging:startEditor"+_313);
+}else{
+throw new DeviceException(MapErrorCode[_310.ErrorCode],"Messaging:startEditor:operation failed");
+}
+}
+}
+if(_30f){
+delete _30f.MessageParam;
+}
+};
+function __sp_messaging_startEditor(_314){
+if(!_314){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:startEditor:message is missing");
+}else{
+if(typeof _314!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:startEditor:message is invalid");
+}
+}
+if((_314.subject)){
+if((_314.subject).length>256){
+throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:startEditor:subject is too lengthy");
+}
+}
+if(_314.to==undefined||_314.to==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:startEditor:to field is missing");
+}
+if(_314.attachments!=undefined&&_314.attachments!=null&&typeof _314.attachments!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:startEditor:attachment is invalid");
+}
+if(_314){
+if(_314.body){
+if(typeof (_314.body)!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:startEditor:body is invalid");
+}
+}
+}
+try{
+this.sendCommon(_314,true,null);
+}
+catch(e){
+var _315=null;
+if(e.message){
+_315=new DeviceException(e.code,"Messaging:startEditor:"+e.message);
+}else{
+_315=new DeviceException(e.code,"Messaging:startEditor:operation failed");
+}
+__device_handle_exception(_315,"__sp_messaging_startEditor: "+_315);
+}
+};
+function __sp_messaging_send(_316,_317,id,_319){
+if(!_317){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:send:message is missing");
+}else{
+if(typeof _317!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:send:message is invalid");
+}
+}
+if(!_316){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:send:callback is missing");
+}else{
+if(typeof _316!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:send:callback is invalid");
+}
+}
+if(_317.to==undefined||_317.to==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:send:to field is missing");
+}
+if(_317.attachments!=undefined&&_317.attachments!=null&&typeof _317.attachments!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:send:attachment is invalid");
+}
+if(!id){
+id="";
+}
+if((typeof id)=="function"){
+var _31a=id;
+id="";
+_319=_31a;
+}
+if((typeof _319)=="undefined"||_319==null){
+_319=null;
+}else{
+if((typeof _319)!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:send:errorCallback is not a function");
+}
+}
+var _31b=function(arg1,arg2,arg3){
+var _31f=_316;
+var _320=_319;
 var iter=null;
-if(arg3.ErrorCode||(arg2==4)){
-var _3a7=convertFromPS2JS(arg3.ErrorCode);
-var _3a8=new DeviceAPIError(_3a7,arg3.ErrorMessage);
-if(_3a1){
-_39f(_3a8);
+if(arg3.ErrorCode!=0){
+var _322;
+if(arg3.ErrorMessage){
+_322=splitErrorMessage(arg3.ErrorMessage);
+}else{
+_322="Operation Failed";
+}
+_320(new DeviceException(MapErrorCode[arg3.ErrorCode],"Messaging:startEditor: "+_322));
+return;
+}else{
+if(arg3.ReturnValue){
+iter=new __sp_message_iterator(arg3.ReturnValue);
+_31f(iter);
+}
+}
+if(arg2!=event_cancelled){
+_31f(iter);
+}
+};
+try{
+var _323=this.sendCommon(_317,false,_316,id,_319);
+return _323;
+}
+catch(e){
+var _324=null;
+switch(e.code){
+case this.error.INVALID_ARG_ERR:
+case this.error.MISSING_ARG_ERR:
+case this.error.NOT_SUPPORTED_ERR:
+throw new DeviceException(e.code,"Messaging:send:"+e.message);
+break;
+default:
+if(_319){
+setTimeout(function(){
+_319(new DeviceException(e.code,"Messaging:send:"+e.message));
+},1000);
+}else{
+throw new DeviceException(e.code,"Messaging:send:"+e.message);
+}
+}
+}
+};
+function __sp_messaging_setNotifier_cb(arg1,arg2,arg3){
+var _328;
+var _329;
+var _32a=null;
+var _32b=null;
+var _32c;
+_32c=glob_obj.getFromArray(arg1);
+if(_32c){
+_328=_32c.success_cb;
+_329=_32c.error_cb;
+}else{
+alert("Messaging: __sp_messaging_setNotifier_cb : Callback not found ");
+return;
+}
+if(arg3.ErrorCode!=0){
+if(arg3.ErrorMessage){
+_32b=splitErrorMessage(arg3.ErrorMessage);
+}else{
+_32b="operation failed";
+}
+if(_329){
+_329(new DeviceException(MapErrorCode[arg3.ErrorCode],"Messaging:setNotifier: "+_32b));
+return;
 }
 }else{
 if(arg3.ReturnValue){
-iter=new __sp_landmarks_category_iterator(arg3.ReturnValue);
-_39d(iter);
-}
-}
-};
-var rval=this.so.IDataSource.GetList(_3a2,this.invoker);
-if(rval.ErrorCode!=0){
-switch(rval.ErrorCode){
-case 1003:
-throw new DeviceAPIError(_3a0.MISSING_ARG_ERR,rval.ErrorMessage);
-break;
-case 1002:
-throw new DeviceAPIError(_3a0.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-case 1004:
-throw new DeviceAPIError(_3a0.NOT_SUPPORTED_ERR,rval.ErrorMessage);
-break;
-case 1000:
-throw new DeviceAPIError(_3a0.INVALID_ARG_ERR,rval.ErrorMessage);
+_32a=new __sp_device_message_info_build_notifier(arg3.ReturnValue);
+arg3.ReturnValue.close();
+}
+}
+if(arg2!=event_cancelled){
+_328(_32a.id);
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_messaging_setNotifier(_32d,_32e){
+if(!_32d){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:setNotifier:callback is missing");
+}else{
+if(typeof _32d!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:setNotifier:callback is invalid");
+}
+}
+if(_32e){
+if(typeof (_32e)!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:setNotifier: ErrorCallback is invalid");
+}
+}
+var _32f={};
+modifyObjectBaseProp(_32f);
+_32f.Type="NewMessage";
+try{
+temp_scb=_32d;
+temp_ecb=_32e;
+var _330=this.so.IMessaging.RegisterNotification(_32f,this.setNotifierCb);
+if(_330.TransactionID){
+glob_obj.addToGlobalArray(_330.TransactionID,_32d,_32e);
+}
+if(_32f){
+delete _32f.Type;
+}
+if(_330.ErrorCode!=0){
+var _331="operation failed";
+if(_330.ErrorMessage){
+_331=splitErrorMessage(_330.ErrorMessage);
+}
+switch(MapErrorCode[_330.ErrorCode]){
+case this.error.INVALID_ARG_ERR:
+case this.error.MISSING_ARG_ERR:
+case this.error.NOT_SUPPORTED_ERR:
+throw new DeviceException(MapErrorCode[_330.ErrorCode],"Messaging:setNotifier:"+_331);
 break;
 default:
-throw new DeviceAPIError(-101,"unknown error message");
-}
-}
-return rval.TransactionID;
+if(_32e){
+setTimeout(function(){
+_32e(new DeviceException(MapErrorCode[_330.ErrorCode],"Messaging:setNotifier:"+_331));
+},1000);
+}else{
+throw new DeviceException(MapErrorCode[_330.ErrorCode],"Messaging:setNotifier:"+_331);
+}
+}
+}
+var _332=_330.TransactionID;
+return _332;
+}
+catch(e){
+__device_handle_exception(e,"__sp_messaging_setNotifier: "+e.toString());
+}
+};
+function __sp_messaging_cancelNotifier(){
+var _333={};
+modifyObjectBaseProp(_333);
+_333.Type="NewMessage";
+try{
+var _334=this.so.IMessaging.CancelNotification(_333);
+if(_333){
+delete _333.Type;
+}
+if(_334.ErrorCode!=0){
+if(_334.ErrorMessage){
+var _335=splitErrorMessage(_334.ErrorMessage);
+throw new DeviceException(MapErrorCode[_334.ErrorCode],"Messaging:cancelNotifier"+_335);
+}else{
+throw new DeviceException(MapErrorCode[_334.ErrorCode],"Messaging:cancelNotifier:operation failed");
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_messaging_cancelNotifier: "+e);
+}
+};
+function __sp_messaging_getMessage(id){
+if(!id){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:getMessage:id is missing");
+}else{
+if((typeof id)!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:getMessage:MessageId should be a string");
+}
+}
+if((typeof id=="string")&&!(isNaN(id))){
+id=Number(id);
+if(id==0){
+throw new DeviceException(this.error.DATA_NOT_FOUND_ERR,"Messaging:getMessage:id not found");
+}
+if(id<0){
+throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:getMessage:id is out of range");
+}
+}
+var _337={};
+modifyObjectBaseProp(_337);
+_337.Type="Inbox";
+_337.Filter={};
+modifyObjectBaseProp(_337.Filter);
+_337.Filter.MessageId=id;
+try{
+var _338=this.so.IMessaging.GetList(_337);
+if(_337){
+delete _337.Filter;
+delete _337.Type;
+}
+if(_338.ErrorCode!=0){
+if(_338.ErrorMessage){
+var _339=splitErrorMessage(_338.ErrorMessage);
+throw new DeviceException(MapErrorCode[_338.ErrorCode],"Messaging:getMessage"+_339);
+}else{
+throw new DeviceException(MapErrorCode[_338.ErrorCode],"Messaging:getMessage:operation failed");
+}
+}
+if(_338.ReturnValue){
+var iter=new __sp_message_iterator(_338.ReturnValue);
+var _33b=iter.next();
+if(_33b){
+return _33b;
+}else{
+throw new DeviceException(this.error.DATA_NOT_FOUND_ERR,"Messaging:getMessage:id not found");
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_messaging_getMessage: "+e);
+}
+};
+function __sp_messaging_delete(id){
+a("messageId"+typeof id);
+if(!id){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:delete:id is missing");
+}else{
+if((typeof id)!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:deleteMessage:MessageId should be a string");
+}
+}
+if((typeof id=="string")&&!(isNaN(id))){
+id=Number(id);
+if(id==0){
+throw new DeviceException(this.error.DATA_NOT_FOUND_ERR,"Messaging:delete:id not found");
+}
+if(id<0){
+throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:delete:id is out of range");
+}
+}
+var _33d={};
+modifyObjectBaseProp(_33d);
+_33d.MessageId=id;
+try{
+var _33e=this.so.IMessaging.Delete(_33d);
+a("MapErrorCode[ result.ErrorCode ]"+MapErrorCode[_33e.ErrorCode]);
+if(_33d){
+delete _33d.MessageId;
+}
+if(_33e.ErrorCode!=0){
+if(_33e.ErrorMessage){
+var _33f=splitErrorMessage(_33e.ErrorMessage);
+throw new DeviceException(MapErrorCode[_33e.ErrorCode],"Messaging:delete"+_33f);
+}else{
+throw new DeviceException(MapErrorCode[_33e.ErrorCode],"Messaging:delete:operation failed");
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_messaging_delete: "+e);
+}
+};
+function __sp_messaging_setStatus(id,_341){
+if(id==null||id==undefined||(id.length)<=0){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:setStatus:id is missing");
+}
+if((typeof id)!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:setStatus:id should be string");
+}
+if(_341==null||_341==undefined){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:setStatus:status is missing");
+}
+if(typeof _341!="number"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:setStatus:status is invalid");
+}
+if(typeof _341=="number"&&_341!=0&&_341!=1){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:setStatus:status is invalid");
+}
+if((typeof id=="string")&&!(isNaN(id))){
+id=Number(id);
+if(id==0){
+throw new DeviceException(this.error.DATA_NOT_FOUND_ERR,"Messaging:setStatus:id not found");
+}
+if(id<0){
+throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:setStatus:id is out of range");
+}
+}
+var _342={};
+modifyObjectBaseProp(_342);
+_342.MessageId=id;
+if((_341==this.STATUS_UNREAD)){
+_342.Status="Unread";
+}else{
+if((_341==this.STATUS_READ)){
+a("in read");
+_342.Status="Read";
+}
+}
+try{
+var _343=this.so.IMessaging.ChangeStatus(_342);
+if(_342){
+delete _342.MessageId;
+delete _342.Status;
+}
+if(_343.ErrorCode!=0){
+if(_343.ErrorMessage){
+var _344=splitErrorMessage(_343.ErrorMessage);
+throw new DeviceException(MapErrorCode[_343.ErrorCode],"Messaging:setStatus"+_344);
+}else{
+throw new DeviceException(MapErrorCode[_343.ErrorCode],"Messaging:setStatus:operation failed");
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_messaging_setStatus: "+e);
+}
+};
+function __sp_messaging_cancel(_345){
+if(_345==null||_345==undefined){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:setStatus:id is missing");
+}
+if(typeof _345!="number"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:cancel:id is invalid");
+}
+var _346={};
+modifyObjectBaseProp(_346);
+_346.TransactionID=_345;
+try{
+var _347=this.so.IMessaging.Cancel(_346);
+if(_346){
+delete _346.TransactionID;
+}
+if(_347.ErrorCode!=0){
+var err;
+if(_347.ErrorCode==1000){
+err=this.error.DATA_NOT_FOUND_ERR;
+}else{
+err=MapErrorCode[_347.ErrorCode];
+}
+if(_347.ErrorMessage){
+var _349=splitErrorMessage(_347.ErrorMessage);
+throw new DeviceException(err,"Messaging:cancel"+_349);
+}else{
+throw new DeviceException(err,"Messaging:cancel:operation failed");
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_messaging_setStatus: "+e);
+}
+};
+function __device_calendar_descriptor(_34a){
+this.interfaceName=_34a.interfaceName;
+this.version=_34a.version;
+};
+function __device_calendar_startEditor(_34b,_34c,_34d){
+this.provider.startEditor(_34b,_34c,_34d);
+};
+function __device_calendar_getList(_34e,_34f,_350){
+return this.provider.getList(_34e,_34f,_350);
+};
+function __device_calendar_add(_351){
+return this.provider.addEntry(_351);
+};
+function __device_calendar_update(_352){
+return this.provider.updateEntry(_352);
+};
+function __device_calendar_delete(data){
+this.provider.deleteEntry(data);
+};
+function __device_calendar_cancel(_354){
+this.provider.cancel(_354);
+};
+function __device_calendar(_355){
+this.provider=_355;
+this.interfaceName=_355.descriptor.interfaceName;
+this.version=_355.descriptor.version;
+this.startEditor=__device_calendar_startEditor;
+this.getList=__device_calendar_getList;
+this.addEntry=__device_calendar_add;
+this.updateEntry=__device_calendar_update;
+this.deleteEntry=__device_calendar_delete;
+this.cancel=__device_calendar_cancel;
+};
+var __device_calendar_service_entry={"name":null,"version":null,"proto":__device_calendar,"descriptor":__device_calendar_descriptor,"providers":[{"descriptor":__sp_calendar_descriptor,"instance":__sp_calendar_instance}]};
+var dataGetList=0;
+var isUpdate=0;
+function __sp_calendar_descriptor(){
+this.interfaceName="calendar";
+if(window.__Service_Interface_Ver){
+this.version=__Service_Interface_Ver;
+}else{
+this.version=1;
+}
+};
+function __sp_calendar_entry_time(_356,end,_358){
+if(_356){
+var st=new Date(_356);
+this.begin=st;
+}
+if(end){
+var en=new Date(end);
+this.end=en;
+}
+if(_358){
+var al=new Date(_358);
+this.alarm=al;
+}
+};
+function __sp_calendar_isInputValid(_35c){
+if(_35c){
+if(_35c.id){
+if(typeof (_35c.id)!="string"){
+return false;
+}
+}
+if(_35c.type){
+if((typeof (_35c.type)!="string")||!__sp_calendar_entry_types.match(_35c.type)){
+return false;
+}
+}
+if(_35c.text){
+if(typeof (_35c.text)!="string"){
+return false;
+}
+}
+if(_35c.range){
+if(typeof (_35c.range)!="object"){
+return false;
+}
+if(_35c.range.begin){
+if(typeof (_35c.range.begin)!="object"){
+return false;
+}
+}
+if(_35c.range.end){
+if(typeof (_35c.range.end)!="object"){
+return false;
+}
+}
+}
+if(_35c.summary){
+if(typeof (_35c.summary)!="string"){
+return false;
+}
+}
+if(_35c.description){
+if(typeof (_35c.description)!="string"){
+return false;
+}
+}
+if(_35c.status){
+if(typeof (_35c.status)!="string"){
+return false;
+}
+}
+if(_35c.location){
+if(typeof (_35c.location)!="string"){
+return false;
+}
+}
+if(_35c.priority){
+if(typeof (_35c.priority)!="number"){
+return false;
+}
+}
+if(_35c.instanceStartTime){
+if(typeof (_35c.instanceStartTime)!="object"){
+return false;
+}
+}
+if(_35c.exceptionDates){
+if(typeof (_35c.exceptionDates)!="object"){
+return false;
+}
+}
+if(_35c.time){
+if(typeof _35c.time!="object"){
+return false;
+}
+if(_35c.time.begin){
+if(typeof (_35c.time.begin)!="object"){
+return false;
+}
+if(_35c.time.begin=="Invalid Date"){
+return false;
+}
+try{
+(_35c.time.begin).getTime();
+}
+catch(e){
+return false;
+}
+}
+if(_35c.time.end){
+if(typeof (_35c.time.end)!="object"){
+return false;
+}
+if(_35c.time.end=="Invalid Date"){
+return false;
+}
+try{
+(_35c.time.end).getTime();
+}
+catch(e){
+return false;
+}
+}
+if(_35c.time.begin&&_35c.time.end){
+if(_35c.time.begin>_35c.time.end){
+return false;
+}
+}
+if(_35c.time.alarm){
+if(typeof (_35c.time.alarm)!="object"){
+return false;
+}
+try{
+(_35c.time.alarm).getTime();
+}
+catch(e){
+return false;
+}
+}
+}
+if(_35c.repeatRule){
+if(typeof _35c.repeatRule!="object"){
+return false;
+}
+if(_35c.repeatRule.frequency){
+if(typeof (_35c.repeatRule.frequency)!="string"){
+return false;
+}
+}
+if(_35c.repeatRule.startDate){
+if(typeof (_35c.repeatRule.startDate)!="object"){
+return false;
+}
+if((_35c.repeatRule.startDate)=="Invalid Date"){
+return false;
+}
+try{
+(_35c.repeatRule.startDate).getTime();
+}
+catch(e){
+return false;
+}
+}
+if(_35c.repeatRule.untilDate){
+if(typeof (_35c.repeatRule.untilDate)!="object"){
+return false;
+}
+if((_35c.repeatRule.untilDate)=="Invalid Date"){
+return false;
+}
+try{
+(_35c.repeatRule.untilDate).getTime();
 }
 catch(e){
-throw e;
-}
-};
-function __sp_landmarks_category_add(_3aa,_3ab,_3ac){
+return false;
+}
+}
+if(_35c.repeatRule.startDate&&_35c.repeatRule.untilDate){
+if(_35c.repeatRule.startDate>_35c.repeatRule.untilDate){
+return false;
+}
+}
+if(_35c.repeatRule.interval){
+if(typeof (_35c.repeatRule.interval)!="number"){
+return false;
+}
+}
+if(_35c.repeatRule.month){
+if(typeof (_35c.repeatRule.month)!="number"){
+return false;
+}
+}
+if(_35c.repeatRule.weekDays){
+if(typeof (_35c.repeatRule.weekDays)!="object"){
+return false;
+}
+}
+if(_35c.repeatRule.daysOfMonth){
+if(typeof (_35c.repeatRule.daysOfMonth)!="object"){
+return false;
+}
+}
+if(_35c.repeatRule.monthDates){
+if(typeof (_35c.repeatRule.monthDates)!="object"){
+return false;
+}
+}
+}
+}
+return true;
+};
+function __sp_calendar_getList_repeatRule(_35d){
+var _35e;
+switch(_35d.Type){
+case 1:
+_35e="daily";
+this.frequency=_35e.toString();
+break;
+case 2:
+_35e="weekly";
+this.frequency=_35e.toString();
+break;
+case 3:
+_35e="monthly";
+this.frequency=_35e.toString();
+break;
+case 4:
+_35e="yearly";
+this.frequency=_35e.toString();
+break;
+default:
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: Repeat Rule Type is Invalid");
+}
+if(_35d.StartDate){
+this.startDate=new Date(_35d.StartDate);
+}
+if(_35d.UntilDate){
+this.untilDate=new Date(_35d.UntilDate);
+}
+if(_35d.Interval){
+this.interval=_35d.Interval;
+}
+if(_35d.DaysInWeek){
+this.weekDays=[];
+for(var a in _35d.DaysInWeek){
+if(_35d.DaysInWeek[a]==6){
+_35d.DaysInWeek[a]=0;
+}else{
+_35d.DaysInWeek[a]=_35d.DaysInWeek[a]+1;
+}
+this.weekDays.push(_35d.DaysInWeek[a]);
+}
+}
+if(_35d.Month){
+this.month=_35d.Month;
+}
+if(_35d.DaysOfMonth){
+if(_35d.DaysOfMonth.Day){
+if(_35d.DaysOfMonth.Day==6){
+_35d.DaysOfMonth.Day=0;
+}else{
+_35d.DaysOfMonth.Day=_35d.DaysOfMonth.Day+1;
+}
+this.daysOfMonth.day=_35d.DaysOfMonth.Day;
+}
+if(_35d.DaysOfMonth.WeekNum){
+this.daysOfMonth.weekInMonth=_35d.DaysOfMonth.WeekNum;
+}
+}
+if(_35d.MonthDays){
+this.monthDates=[];
+for(var i=0;i<_35d.MonthDays.length;i++){
+this.monthDates.push(_35d.MonthDays[i]-1);
+}
+}
+};
+function __sp_device_calendar_entry(_361){
+if(_361.id){
+this.id=_361.id;
+}
+if(_361.type){
+this.type=_361.Type;
+}
+if(_361.Summary){
+this.summary=_361.Summary;
+}
+if(_361.Description){
+this.description=_361.Description;
+}
+if(_361.Location){
+this.location=_361.Location;
+}
+if(_361.InstanceStartTime){
+this.instanceStartTime=_361.InstanceStartTime;
+}
+if(_361.Priority>=0||_361.Priority<=255){
+this.priority=_361.Priority;
+}
+if(_361.Status){
+this.status=_361.Status;
+}
+if(_361.ExDates){
+this.exceptionDates=_361.ExDates;
+}
+if(_361.RepeatRule){
+this.repeatRule=new __sp_calendar_getList_repeatRule(_361.RepeatRule);
+}
+if(dataGetList==0){
+this.time=new __sp_calendar_entry_time(_361.InstanceStartTime,_361.InstanceEndTime,_361.AlarmTime);
+}else{
+this.time=new __sp_calendar_entry_time(_361.StartTime,_361.EndTime,_361.AlarmTime);
+}
+};
+function __sp_daysOfMonth_build(_362){
+if(_362.day){
+if(_362.day==0){
+_362.day=6;
+}else{
+_362.day=_362.day-1;
+}
+this.Day=_362.day;
+}
+if(_362.weekInMonth){
+this.WeekNum=_362.weekInMonth;
+}
+};
+function __sp_calendar_addEntry_repeatRule(_363,str){
+try{
+if(!(_363.frequency)){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: addEntry: frequency is missing");
+}else{
+var _365=_363.frequency;
+switch(_365){
+case "daily":
+this.Type=1;
+break;
+case "weekly":
+this.Type=2;
+break;
+case "monthly":
+this.Type=3;
+break;
+case "yearly":
+this.Type=4;
+break;
+default:
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: "+str+" Repeat Rule Type is Invalid");
+}
+if(_363.startDate){
+this.StartDate=_363.startDate;
+}
+if(_363.untilDate){
+this.UntilDate=_363.untilDate;
+}
+if(_363.interval){
+this.Interval=_363.interval;
+}
+if(_363.weekDays){
+this.DaysInWeek=[];
+for(var a in _363.weekDays){
+if(_363.weekDays[a]==0){
+_363.weekDays[a]=6;
+}else{
+_363.weekDays[a]=_363.weekDays[a]-1;
+}
+this.DaysInWeek.push(_363.weekDays[a]);
+}
+}
+if(_363.month){
+this.Month=_363.month;
+}
+if(_363.monthDates){
+this.MonthDays=[];
+for(var i=0;i<_363.monthDates.length;i++){
+this.MonthDays.push(_363.monthDates[i]-1);
+}
+}
+if(_363.daysOfMonth){
+this.DaysOfMonth=new Array();
+for(var a in _363.daysOfMonth){
+var _368=new __sp_daysOfMonth_build(_363.daysOfMonth[a]);
+(this.DaysOfMonth).push(_368);
+}
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_calendar_addEntry_repeatRule: "+e);
+}
+};
+function __sp_calendar_entry(_369,str){
 try{
-var _3ad=new DeviceAPIError(0,"dummy");
-var _3ae=true;
-if(_3aa===undefined){
-throw new DeviceAPIError(_3ad.MISSING_ARG_ERR,"AddSucessCallback is missing");
-}else{
-if(((_3aa===null)||(_3aa===""))&&(typeof (_3aa)!="number")){
-throw new DeviceAPIError(_3ad.MISSING_ARG_ERR,"AddSucessCallback is missing");
-}else{
-if(typeof (_3aa)!="function"){
-throw new DeviceAPIError(_3ad.INVALID_ARG_ERR,"invalid AddSucessCallback argument");
-}
-}
-}
-if(_3ab===undefined||_3ab===null){
-throw new DeviceAPIError(_3ad.MISSING_ARG_ERR,"CategoryItem is missing");
-}else{
-if(typeof (_3ab)!=="object"){
-throw new DeviceAPIError(_3ad.INVALID_ARG_ERR,"invalid CategoryItem argument");
-}
-}
-if((_3ac!=undefined)){
-if((!_3ac)&&(typeof (_3ac)!="number")){
-_3ae=false;
-}else{
-if((typeof (_3ac)!="function")){
-throw new DeviceAPIError(_3ad.INVALID_ARG_ERR,"invalid ErrorCallback callback");
-}
-}
-}else{
-_3ae=false;
-}
-this.invoker=function(arg1,arg2,arg3){
-var id=null;
-if(arg2==4||arg3.ErrorCode){
-var _3b3=convertFromPS2JS(arg3.ErrorCode);
-var _3b4=new DeviceAPIError(_3b3,arg3.ErrorMessage);
-if(_3ae){
-_3ac(_3b4);
-}
-}else{
+if(_369.type){
+this.Type=_369.type;
+}
+if(_369.id){
+this.id=_369.id;
+if(isUpdate){
+if(_369.time){
+if(_369.time.begin){
+this.StartTime=_369.time.begin;
+}
+if(_369.time.end){
+this.EndTime=_369.time.end;
+}
+}
+}
+}
+if(_369.instanceStartTime){
+this.InstanceStartTime=_369.instanceStartTime;
+}
+if(_369.description){
+this.Description=_369.description;
+}else{
+if(isUpdate&&(_369.description==null)){
+this.Description=" ";
+}
+}
+if(_369.summary){
+this.Summary=_369.summary;
+}else{
+if(isUpdate&&(_369.summary==null)){
+this.Summary=" ";
+}
+}
+if(_369.location){
+this.Location=_369.location;
+}else{
+if(isUpdate&&(_369.location==null)){
+this.Location=" ";
+}
+}
+if(_369.priority){
+if((_369.priority<0)||(_369.priority>255)){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: "+str+" Priority is Invalid");
+}else{
+this.Priority=_369.priority;
+}
+}else{
+if(isUpdate&&(_369.priority==null)){
+this.Priority=0;
+}
+}
+if(_369.status){
+if(this.Type=="ToDo"){
+this.Status="Todo"+_369.status;
+}else{
+this.Status=_369.status;
+}
+}else{
+if(isUpdate&&(_369.status==null)){
+this.Status="Tentative";
+}
+}
+if(_369.exceptionDates){
+this.ExDates=_369.exceptionDates;
+}
+if(_369.repeatRule){
+this.RepeatRule=new __sp_calendar_addEntry_repeatRule(_369.repeatRule,str);
+}
+if(_369.type!=undefined&&_369.type!=null){
+if(typeof this.Type!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: "+str+" Type is not a string");
+}
+switch(this.Type){
+case "Meeting":
+if(_369.time){
+if(_369.time.begin){
+this.StartTime=_369.time.begin;
+}
+if(_369.time.end){
+this.EndTime=_369.time.end;
+}
+}
+break;
+case "Reminder":
+case "Anniversary":
+if(_369.time){
+if(_369.time.begin){
+this.StartTime=_369.time.begin;
+}
+}
+break;
+case "ToDo":
+if(_369.time){
+if(_369.time.end){
+this.EndTime=_369.time.end;
+}
+}
+break;
+case "DayEvent":
+if(_369.time){
+if(_369.time.begin){
+this.StartTime=_369.time.begin;
+}
+}
+break;
+default:
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: "+str+" Type is Invalid");
+}
+}
+if(_369.time){
+if(_369.time.alarm){
+this.AlarmTime=_369.time.alarm;
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_calendar_entry: "+e);
+}
+};
+function __sp_calendar_iterator_get_next(){
+var _36b=this.iter.getNext();
+if(typeof _36b=="undefined"){
+return null;
+}
+var _36c=new __sp_device_calendar_entry(_36b);
+_36b.close();
+return _36c;
+};
+function __sp_calendar_iterator(_36d){
+this.iter=_36d;
+this.next=__sp_calendar_iterator_get_next;
+this.close=function(){
+this.iter.close();
+};
+};
+var CALENDAR_APP_ID=268458241;
+function __sp_calendar_startEditor(_36e,_36f,_370){
+try{
+if(!_36e){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: startEditor: callback is missing");
+}else{
+if(typeof _36e!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: startEditor: callback is invalid");
+}
+}
+if(_370){
+if(typeof _370!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: startEditor: error callback is invalid");
+}
+}
+if(_36f==null||_36f==undefined){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: startEditor: entry is invalid");
+}
+var _371=function(arg1,arg2,arg3){
+var iter=null;
+_36e(iter);
+if(arg2!=event_cancelled){
+var iter=null;
 if(arg3.ReturnValue){
-id=arg3.ReturnValue;
-}
-_3aa(id);
-}
-};
-var _3b5=new Object();
-modifyObjectBaseProp(_3b5);
-_3b5.Type="Category";
-_3b5.Data=new __sp_category_obj(_3ab);
-var rval=this.so.IDataSource.Add(_3b5,this.invoker);
+iter=new __sp_calendar_iterator(arg3.ReturnValue);
+}
+_36e(iter);
+}
+if(arg3.ErrorCode!=0){
+switch(arg3.ErrorCode){
+case this.error.MISSING_ARG_ERR:
+case this.error.INVALID_ARG_ERR:
+case this.error.NOT_SUPPORTED_ERR:
+if(arg3.ErrorMessage){
+var _376=splitErrorMessage(arg3.ErrorMessage);
+throw new DeviceException(MapErrorCode[arg3.ErrorCode],"Calendar: startEditor: "+_376);
+}else{
+throw new DeviceException(MapErrorCode[arg3.ErrorCode],"Calendar: startEditor: Operation Failed");
+}
+break;
+default:
+_370(new DeviceException(MapErrorCode[arg3.ErrorCode],"Calendar: startEditor: Operation Failed"));
+}
+}
+};
+__s60_start_and_wait(CALENDAR_APP_ID,"",_371);
+return 0;
+}
+catch(e){
+__device_handle_exception(e,"__sp_calendar_startEditor: "+e);
+}
+};
+var __sp_calendar_entry_types="MeetingReminderToDoAnniversaryDayEvent";
+function __sp_calendar_getList_cb(arg1,arg2,arg3){
+var _37a;
+var _37b;
+var _37c;
+_37a=glob_obj.getFromArray(arg1);
+if(_37a){
+_37b=_37a.success_cb;
+_37c=_37a.error_cb;
+}else{
+alert("Calendar: __sp_calendar_getList_cb: Callback not found ");
+return;
+}
+if(arg3.ErrorCode!=0){
+_37c(new DeviceException(arg3.ErrorCode,"Calendar: getList: Operation Failed"));
+return;
+}
+if(arg2!=event_cancelled){
+var iter=null;
+if(arg3.ReturnValue){
+iter=new __sp_calendar_iterator(arg3.ReturnValue);
+}
+_37b(iter);
+}
+glob_obj.removeFromArray(arg1);
+};
+function __sp_calendar_getList(_37e,_37f,_380){
+try{
+if(_37f){
+if(typeof _37f!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");
+}
+if(_37f.id){
+dataGetList=1;
+if(typeof _37f.id!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");
+}
+}else{
+dataGetList=0;
+}
+}
+if(!_37e){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: getList: callback is missing");
+}else{
+if(typeof _37e!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: callback is invalid");
+}
+}
+if(_380){
+if(typeof _380!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: error callback is invalid");
+}
+if(_380==undefined||_380==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: getList: error callback is missing");
+}
+}
+var _381={};
+modifyObjectBaseProp(_381);
+_381.Type="IncludeAll";
+if(_37f){
+if(_37f.id){
+_381.id=_37f.id;
+}
+if((_37f.type)&&__sp_calendar_entry_types.match(_37f.type)){
+_381.Type=_37f.type;
+}else{
+if((_37f.type)&&typeof _37f.type!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");
+}
+}
+if(_37f.range){
+if(_37f.range.begin){
+if(typeof (_37f.range.begin)!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");
+}else{
+if((_37f.range.begin)=="Invalid Date"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");
+}else{
+_381.StartRange=_37f.range.begin;
+}
+}
+}
+if(_37f.range.end){
+if(typeof (_37f.range.end)!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");
+}else{
+if((_37f.range.end)=="Invalid Date"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");
+}else{
+_381.EndRange=_37f.range.end;
+}
+}
+}
+if((_37f.range.begin)&&(_37f.range.end)){
+if((_37f.range.begin)>(_37f.range.end)){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");
+}
+}
+}
+if(_37f.text){
+if(typeof (_37f.text)!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");
+}else{
+_381.SearchText=_37f.text;
+}
+}
+}
+var _382={};
+modifyObjectBaseProp(_382);
+_382.Type="CalendarEntry";
+_382.Filter=_381;
+temp_scb=_37e;
+temp_ecb=_380;
+var rval=this.so.IDataSource.GetList(_382,this.getListCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_37e,_380);
+}
+if(_382){
+delete _382.Type;
+delete _382.Filter;
+}
 if(rval.ErrorCode!=0){
 switch(rval.ErrorCode){
-case err_missing_argument:
-throw new DeviceAPIError(_3ad.MISSING_ARG_ERR,rval.ErrorMessage);
-break;
-case err_bad_argument:
-throw new DeviceAPIError(_3ad.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-case err_ServiceNotSupported:
-throw new DeviceAPIError(_3ad.NOT_SUPPORTED_ERR,rval.ErrorMessage);
-break;
-case err_InvalidService_Argument:
-throw new DeviceAPIError(_3ad.INVALID_ARG_ERR,rval.ErrorMessage);
+case this.error.MISSING_ARG_ERR:
+case this.error.INVALID_ARG_ERR:
+case this.error.NOT_SUPPORTED_ERR:
+if(rval.ErrorMessage){
+var _384=splitErrorMessage(rval.ErrorMessage);
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Calendar: getList: "+_384);
+}else{
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Calendar: getList: Operation Failed");
+}
 break;
 default:
-throw new DeviceAPIError(-101,"unknown error message");
-}
-}
-return rval.TransactionID;
-}
-catch(e){
-throw e;
-}
-};
-function __sp_landmarks_add(_3b7,_3b8,_3b9){
-try{
-var _3ba=new DeviceAPIError(0,"dummy");
-var _3bb=true;
-if(_3b7===undefined){
-throw new DeviceAPIError(_3ba.MISSING_ARG_ERR,"AddSucessCallback is missing");
-}else{
-if(((_3b7===null)||(_3b7===""))&&(typeof (_3b7)!="number")){
-throw new DeviceAPIError(_3ba.MISSING_ARG_ERR,"AddSucessCallback is missing");
-}else{
-if(typeof (_3b7)!="function"){
-throw new DeviceAPIError(_3ba.INVALID_ARG_ERR,"invalid AddSucessCallback argument");
-}
-}
-}
-if(_3b8===undefined||_3b8===null){
-throw new DeviceAPIError(_3ba.MISSING_ARG_ERR,"LandmarkItem is missing");
-}else{
-if(typeof (_3b8)!=="object"){
-throw new DeviceAPIError(_3ba.INVALID_ARG_ERR,"invalid LandmarkItem argument");
-}
-}
-if((_3b9!=undefined)){
-if((!_3b9)&&(typeof (_3b9)!="number")){
-_3bb=false;
-}else{
-if((typeof (_3b9)!="function")){
-throw new DeviceAPIError(_3ba.INVALID_ARG_ERR,"invalid ErrorCallback callback");
-}
-}
-}else{
-_3bb=false;
-}
-this.invoker=function(arg1,arg2,arg3){
-var id=null;
-if(arg2==4||arg3.ErrorCode){
-var _3c0=convertFromPS2JS(arg3.ErrorCode);
-var _3c1=new DeviceAPIError(_3c0,arg3.ErrorMessage);
-if(_3bb){
-_3b9(_3c1);
-}
-}else{
-if(arg3.ReturnValue){
-id=arg3.ReturnValue;
-}
-_3b7(id);
-}
-};
-var str="addLandmark: ";
-var _3c3=new Object();
-modifyObjectBaseProp(_3c3);
-_3c3.Type="Landmark";
-_3c3.Data=new __sp_landmark_obj(_3b8,str);
-var rval=this.so.IDataSource.Add(_3c3,this.invoker);
-if(rval.ErrorCode!=0){
-switch(rval.ErrorCode){
-case err_missing_argument:
-throw new DeviceAPIError(_3ba.MISSING_ARG_ERR,rval.ErrorMessage);
-break;
-case err_bad_argument:
-throw new DeviceAPIError(_3ba.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-case err_ServiceNotSupported:
-throw new DeviceAPIError(_3ba.NOT_SUPPORTED_ERR,rval.ErrorMessage);
-break;
-case err_InvalidService_Argument:
-throw new DeviceAPIError(_3ba.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-default:
-throw new DeviceAPIError(-101,"unknown error message");
+_380(new DeviceException(MapErrorCode[rval.ErrorCode],"Calendar: getList: Operation Failed"));
 }
 }
 return rval.TransactionID;
 }
 catch(e){
-throw e;
-}
-};
-function __sp_landmarks_delete(_3c5,_3c6,_3c7){
+__device_handle_exception(e,"sp_calendar_getList: "+e);
+}
+};
+function __sp_calendar_add(_385){
+if(_385){
+if(typeof _385!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: addEntry: calendarEntry param is invalid");
+}
+if(_385.id){
+_385.id=undefined;
+}
+if(!_385.type||!_385.time){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: addEntry: mandatory param missing");
+}else{
+if(typeof _385.type!="string"||typeof _385.time!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: addEntry: mandatory param missing");
+}
+}
+if((_385.type!="ToDo")&&!_385.time.begin){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: addEntry: mandatory param StartTime missing");
+}
+if(!_385.time.end&&(_385.type=="ToDo"||_385.type=="Meeting")){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: addEntry: mandatory param EndTime missing");
+}
+if(_385.time.end&&_385.time.alarm){
+if(_385.time.end<_385.time.alarm){
+throw new DeviceException(this.error.NOT_SUPPORTED_ERR,"Calendar: addEntry: alarm time greater than end time:Not supported");
+}
+}
+if(_385.type=="ToDo"){
+if(_385.status==0){
+if(typeof (_385.status)!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: addEntry: mandatory param missing");
+}
+}
+}
+if(_385.repeatRule){
+if(typeof _385.repeatRule!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: addEntry: repeatRule param type is invalid");
+}
+if(!_385.repeatRule.frequency||_385.repeatRule.frequency==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: addEntry: mandatory param Frequency missing");
+}
+}
+var _386=__sp_calendar_isInputValid(_385);
+if(!_386){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: addEntry: calendarEntry param is invalid");
+}
+}else{
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: addEntry: mandatory param missing");
+}
+try{
+var str="addEntry:";
+var _388={};
+modifyObjectBaseProp(_388);
+_388.Type="CalendarEntry";
+_388.Item=new __sp_calendar_entry(_385,str);
+var _389=this.so.IDataSource.Add(_388);
+if(_388){
+delete _388.Type;
+delete _388.Item;
+}
+var _38a="Operation Failed";
+if(_389.ErrorMessage){
+_38a=splitErrorMessage(_389.ErrorMessage);
+}
+if(_389.ErrorCode!=0){
+throw new DeviceException(MapErrorCode[_389.ErrorCode],"Calendar: addEntry: Operation Failed");
+return;
+}else{
+var _38b=_389.ReturnValue;
+return _38b;
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_calendar_add: "+e);
+}
+};
+function __sp_calendar_update(_38c){
+isUpdate=1;
+if(_38c){
+if(typeof _38c!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: updateEntry: calendarEntry param is invalid");
+}
+if(!_38c.id){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: updateEntry: mandatory param - Id missing");
+}
+if(_38c.repeatRule){
+if(typeof _38c.repeatRule!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: updateEntry: repeatRule param type is invalid");
+}
+if((_38c.repeatRule.frequency==null||_38c.repeatRule.frequency==undefined)){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: updateEntry: repeatRule param type is invalid");
+}
+if(_38c.repeatRule.startDate&&(_38c.repeatRule.startDate==null||_38c.repeatRule.startDate==undefined)){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: updateEntry: repeatRule param type is invalid");
+}
+if(_38c.repeatRule.untilDate&&(_38c.repeatRule.untilDate==null||_38c.repeatRule.untilDate==undefined)){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: updateEntry: repeatRule param type is invalid");
+}
+}
+if(_38c.time){
+if(_38c.time.end&&_38c.time.alarm){
+if(_38c.time.alarm>_38c.time.end){
+throw new DeviceException(this.error.NOT_SUPPORTED_ERR,"Calendar: updateEntry: alarm time greater than end time is not supported");
+}
+}
+}
+var _38d=__sp_calendar_isInputValid(_38c);
+if(!_38d){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: updateEntry: calendarEntry param is invalid");
+}
+}else{
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: updateEntry: mandatory param missing");
+}
+try{
+var str="updateEntry:";
+var _38f={};
+modifyObjectBaseProp(_38f);
+_38f.Type="CalendarEntry";
+_38f.Item=new __sp_calendar_entry(_38c,str);
+isUpdate=0;
+var _390=this.so.IDataSource.Add(_38f);
+if(_38f){
+delete _38f.Type;
+delete _38f.Item;
+}
+var _391="Operation Failed";
+if(_390.ErrorMessage){
+_391=splitErrorMessage(_390.ErrorMessage);
+}
+if(_390.ErrorCode!=0){
+throw new DeviceException(MapErrorCode[_390.ErrorCode],"Calendar: addEntry: Operation Failed");
+return;
+}else{
+var _392=_390.ReturnValue;
+return _392;
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_calendar_add: "+e);
+}
+};
+function __sp_calendar_delete(data){
 try{
-var _3c8=new DeviceAPIError(0,"dummy");
-var _3c9=true;
-if(_3c5===undefined){
-throw new DeviceAPIError(_3c8.MISSING_ARG_ERR,"SucessCallback is missing");
-}else{
-if(((_3c5===null)||(_3c5===""))&&(typeof (_3c5)!="number")){
-throw new DeviceAPIError(_3c8.MISSING_ARG_ERR,"SucessCallback is missing");
-}else{
-if(typeof (_3c5)!="function"){
-throw new DeviceAPIError(_3c8.INVALID_ARG_ERR,"invalid SucessCallback argument");
-}
-}
-}
-if(_3c6===undefined||_3c6===null){
-throw new DeviceAPIError(_3c8.MISSING_ARG_ERR,"landmarkId is missing");
-}else{
-if(typeof (_3c6)!=="string"){
-throw new DeviceAPIError(_3c8.INVALID_ARG_ERR,"invalid landmarkId argument");
-}
-}
-if((_3c7!=undefined)){
-if((!_3c7)&&(typeof (_3c7)!="number")){
-_3c9=false;
-}else{
-if((typeof (_3c7)!="function")){
-throw new DeviceAPIError(_3c8.INVALID_ARG_ERR,"invalid ErrorCallback callback");
-}
-}
-}else{
-_3c9=false;
-}
-this.invoker=function(arg1,arg2,arg3){
-if(arg2==4||arg3.ErrorCode){
-var _3cd=convertFromPS2JS(arg3.ErrorCode);
-var _3ce=new DeviceAPIError(_3cd,arg3.ErrorMessage);
-if(_3c9){
-_3c7(_3ce);
-}
-}else{
-_3c5();
-}
-};
-var _3cf=new Object();
-modifyObjectBaseProp(_3cf);
-_3cf.Type="Landmark";
-_3cf.Data=new Object();
-modifyObjectBaseProp(_3cf.Data);
-_3cf.Data.id=_3c6;
-var rval=this.so.IDataSource.Delete(_3cf,this.invoker);
+if(data){
+if(typeof data!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: deleteEntry: data is invalid");
+}
+if(!data.id){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: deleteEntry: id is missing");
+}
+var _394=__sp_calendar_isInputValid(data);
+if(!_394){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: deleteEntry: delete data is invalid");
+}
+}else{
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: deleteEntry: data is missing");
+}
+var _395={};
+modifyObjectBaseProp(_395);
+_395.Type="CalendarEntry";
+_395.Data={};
+modifyObjectBaseProp(_395.Data);
+_395.Data.IdList=[];
+var list=[data.id];
+_395.Data.IdList=list;
+if(data.range){
+if(data.range.begin){
+_395.Data.StartRange=data.range.begin;
+}
+if(data.range.end){
+_395.Data.EndRange=data.range.end;
+}
+}
+var rval=this.so.IDataSource.Delete(_395);
+if(_395){
+delete _395.Type;
+delete _395.Data.IdList;
+delete _395.Data.StartRange;
+delete _395.Data.EndRange;
+}
+if(list){
+delete list.id;
+}
 if(rval.ErrorCode!=0){
-switch(rval.ErrorCode){
-case err_missing_argument:
-throw new DeviceAPIError(_3c8.MISSING_ARG_ERR,rval.ErrorMessage);
-break;
-case err_bad_argument:
-throw new DeviceAPIError(_3c8.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-case err_ServiceNotSupported:
-throw new DeviceAPIError(_3c8.NOT_SUPPORTED_ERR,rval.ErrorMessage);
-break;
-case err_InvalidService_Argument:
-throw new DeviceAPIError(_3c8.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-default:
-throw new DeviceAPIError(-101,"unknown error message");
-}
-}
-return rval.TransactionID;
+if(rval.ErrorMessage){
+var _398=splitErrorMessage(rval.ErrorMessage);
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Calendar: deleteEntry: "+_398);
+}else{
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Calendar: deleteEntry: Operation Failed");
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_calendar_delete: "+e);
+}
+};
+function __sp_calendar_cancel(_399){
+try{
+if(!_399||_399==null||_399==undefined){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: cancel: id is missing");
+}
+if(_399){
+if(typeof _399!="number"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: cancel: id is missing");
+}
+}
+var _39a={};
+modifyObjectBaseProp(_39a);
+_39a.TransactionID=_399;
+var _39b=this.so.IDataSource.Cancel(_39a);
+if(_39a){
+delete _39a.TransactionID;
+}
+if(_39b.ErrorCode!=0){
+if(_39b.ErrorMessage){
+var _39c=splitErrorMessage(_39b.ErrorMessage);
+throw new DeviceException(MapErrorCode[_39b.ErrorCode],"Calendar: cancel: "+_39c);
+}else{
+throw new DeviceException(MapErrorCode[_39b.ErrorCode],"Calendar: cancel: Operation Failed");
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_calendar_cancel: "+e);
+}
+};
+function __sp_calendar_instance(){
+this.descriptor=new __sp_calendar_descriptor();
+this.startEditor=__sp_calendar_startEditor;
+this.getList=__sp_calendar_getList;
+this.getListCb=__sp_calendar_getList_cb;
+this.addEntry=__sp_calendar_add;
+this.updateEntry=__sp_calendar_update;
+this.deleteEntry=__sp_calendar_delete;
+this.cancel=__sp_calendar_cancel;
+this.error=new DeviceException(0,"Dummy");
+this.so=null;
+try{
+this.so=device.getServiceObject("Service.Calendar","IDataSource");
+}
+catch(e){
+__device_handle_exception(e,"Calendar service not available");
+}
+};
+function __device_contacts_descriptor(_39d){
+this.interfaceName=_39d.interfaceName;
+this.version=_39d.version;
+};
+function __device_contacts_startEditor(_39e,_39f,_3a0){
+return this.provider.startEditor(_39e,_39f,_3a0);
+};
+function __device_contacts_getContacts(_3a1,_3a2,_3a3,_3a4){
+return this.provider.getContacts(_3a1,_3a2,_3a3,_3a4);
+};
+function __device_contacts_add(_3a5){
+return this.provider.addContact(_3a5);
+};
+function __device_contacts_update(_3a6){
+this.provider.updateContact(_3a6);
+};
+function __device_contacts_delete(id){
+this.provider.deleteContacts(id);
+};
+function __device_contacts_getContactInfo(id){
+return this.provider.getContactInfo(id);
+};
+function __device_contacts_addGroup(_3a9){
+return this.provider.addGroup(_3a9);
+};
+function __device_contacts_getGroups(_3aa,_3ab){
+return this.provider.getGroups(_3aa,_3ab);
+};
+function __device_contacts_deleteGroups(id){
+this.provider.deleteGroups(id);
+};
+function __device_contacts_addContactsToGroup(_3ad,id){
+this.provider.addContactsToGroup(_3ad,id);
+};
+function __device_contacts_getContactIds(_3af,_3b0,_3b1,_3b2){
+return this.provider.getContactIds(_3af,_3b0,_3b1,_3b2);
+};
+function __device_contacts_getGroupIds(_3b3,_3b4){
+return this.provider.getGroupIds(_3b3,_3b4);
+};
+function __device_contacts_removeContactsFromGroup(_3b5,id){
+this.provider.removeContactsFromGroup(_3b5,id);
+};
+function __device_contacts_cancel(_3b7){
+this.provider.cancel(_3b7);
+};
+function __device_contacts_updateGroup(_3b8){
+this.provider.updateGroup(_3b8);
+};
+function __device_contacts_getGroupInfo(_3b9){
+return this.provider.getGroupInfo(_3b9);
+};
+function __device_contacts(_3ba){
+this.provider=_3ba;
+this.interfaceName=_3ba.descriptor.interfaceName;
+this.version=_3ba.descriptor.version;
+this.SORT_ASCENDING=0;
+this.SORT_DESCENDING=1;
+this.startEditor=__device_contacts_startEditor;
+this.getContacts=__device_contacts_getContacts;
+this.addContact=__device_contacts_add;
+this.updateContact=__device_contacts_update;
+this.deleteContacts=__device_contacts_delete;
+this.getContactInfo=__device_contacts_getContactInfo;
+this.addGroup=__device_contacts_addGroup;
+this.getGroups=__device_contacts_getGroups;
+this.deleteGroups=__device_contacts_deleteGroups;
+this.addContactsToGroup=__device_contacts_addContactsToGroup;
+this.getContactIds=__device_contacts_getContactIds;
+this.getGroupIds=__device_contacts_getGroupIds;
+this.removeContactsFromGroup=__device_contacts_removeContactsFromGroup;
+this.cancel=__device_contacts_cancel;
+this.updateGroup=__device_contacts_updateGroup;
+this.getGroupInfo=__device_contacts_getGroupInfo;
+};
+var __device_contacts_service_entry={"name":null,"version":null,"proto":__device_contacts,"descriptor":__device_contacts_descriptor,"providers":[{"descriptor":__sp_contacts_descriptor,"instance":__sp_contacts_instance}]};
+nokia.device.contacts.SORT_ASCENDING=0;
+nokia.device.contacts.SORT_DESCENDING=1;
+function __sp_contacts_descriptor(){
+this.interfaceName="contacts";
+if(window.__Service_Interface_Ver){
+this.version=__Service_Interface_Ver;
+}else{
+this.version=1;
+}
+};
+function __s60_enumerate_contact_object(_3bb,_3bc,func,_3be){
+try{
+var key;
+for(key in _3bb){
+var _3c0;
+if(_3bc){
+_3c0=_3bc+"."+key;
+}else{
+_3c0=key;
+}
+var _3c1=_3bb[key];
+if(_3c1 instanceof Array){
+func(_3c0,_3c1,_3be);
+}else{
+if(_3c1 instanceof Date){
+func(_3c0,_3c1,_3be);
+}else{
+if(typeof _3c1=="object"){
+__s60_enumerate_contact_object(_3c1,_3c0,func,_3be);
+}else{
+func(_3c0,_3c1,_3be);
+}
+}
+}
+}
 }
 catch(e){
 throw e;
 }
 };
-function __sp_landmarks_update(_3d1,_3d2,_3d3){
+function __sp_contact_extract(name,_3c3,_3c4){
+switch(name){
+case "name.last":
+_3c4.LastName={};
+modifyObjectBaseProp(_3c4.LastName);
+_3c4.LastName.Label="Last name";
+_3c4.LastName.Value=_3c3;
+break;
+case "name.first":
+_3c4.FirstName={};
+modifyObjectBaseProp(_3c4.FirstName);
+_3c4.FirstName.Label="First name";
+_3c4.FirstName.Value=_3c3;
+break;
+case "name.middle":
+_3c4.MiddleName={};
+modifyObjectBaseProp(_3c4.MiddleName);
+_3c4.MiddleName.Label="Middle name";
+_3c4.MiddleName.Value=_3c3;
+break;
+case "name.prefix":
+_3c4.Prefix={};
+modifyObjectBaseProp(_3c4.Prefix);
+_3c4.Prefix.Label="Prefix";
+_3c4.Prefix.Value=_3c3;
+break;
+case "name.suffix":
+_3c4.Suffix={};
+modifyObjectBaseProp(_3c4.Suffix);
+_3c4.Suffix.Label="Suffix";
+_3c4.Suffix.Value=_3c3;
+break;
+case "tel.land":
+_3c4.LandPhoneGen={};
+modifyObjectBaseProp(_3c4.LandPhoneGen);
+_3c4.LandPhoneGen.Label="Landline";
+_3c4.LandPhoneGen.Value=_3c3;
+break;
+case "tel.mobile":
+_3c4.MobilePhoneGen={};
+modifyObjectBaseProp(_3c4.MobilePhoneGen);
+_3c4.MobilePhoneGen.Label="Mobile";
+_3c4.MobilePhoneGen.Value=_3c3;
+break;
+case "tel.video":
+_3c4.VideoNumberGen={};
+modifyObjectBaseProp(_3c4.VideoNumberGen);
+_3c4.VideoNumberGen.Label="Video";
+_3c4.VideoNumberGen.Value=_3c3;
+break;
+case "tel.fax":
+_3c4.FaxNumberGen={};
+modifyObjectBaseProp(_3c4.FaxNumberGen);
+_3c4.FaxNumberGen.Label="Fax";
+_3c4.FaxNumberGen.Value=_3c3;
+break;
+case "tel.voip":
+_3c4.VOIPGen={};
+modifyObjectBaseProp(_3c4.VOIPGen);
+_3c4.VOIPGen.Label="Voip";
+_3c4.VOIPGen.Value=_3c3;
+break;
+case "tel.home.land":
+_3c4.LandPhoneHome={};
+modifyObjectBaseProp(_3c4.LandPhoneHome);
+_3c4.LandPhoneHome.Label="Home Landline";
+_3c4.LandPhoneHome.Value=_3c3;
+break;
+case "tel.home.mobile":
+_3c4.MobilePhoneHome={};
+modifyObjectBaseProp(_3c4.MobilePhoneHome);
+_3c4.MobilePhoneHome.Label="Home Mobile";
+_3c4.MobilePhoneHome.Value=_3c3;
+break;
+case "tel.home.video":
+_3c4.VideoNumberHome={};
+modifyObjectBaseProp(_3c4.VideoNumberHome);
+_3c4.VideoNumberHome.Label="Home Video";
+_3c4.VideoNumberHome.Value=_3c3;
+break;
+case "tel.home.fax":
+_3c4.FaxNumberHome={};
+modifyObjectBaseProp(_3c4.FaxNumberHome);
+_3c4.FaxNumberHome.Label="Home Fax";
+_3c4.FaxNumberHome.Value=_3c3;
+break;
+case "tel.home.voip":
+_3c4.VoipHome={};
+modifyObjectBaseProp(_3c4.VoipHome);
+_3c4.VoipHome.Label="Home Voip";
+_3c4.VoipHome.Value=_3c3;
+break;
+case "tel.work.land":
+_3c4.LandPhoneWork={};
+modifyObjectBaseProp(_3c4.LandPhoneWork);
+_3c4.LandPhoneWork.Label="Work Landline";
+_3c4.LandPhoneWork.Value=_3c3;
+break;
+case "tel.work.mobile":
+_3c4.MobilePhoneWork={};
+modifyObjectBaseProp(_3c4.MobilePhoneWork);
+_3c4.MobilePhoneWork.Label="Work Mobile";
+_3c4.MobilePhoneWork.Value=_3c3;
+break;
+case "tel.work.video":
+_3c4.VideoNumberWork={};
+modifyObjectBaseProp(_3c4.VideoNumberWork);
+_3c4.VideoNumberWork.Label="Work Video";
+_3c4.VideoNumberWork.Value=_3c3;
+break;
+case "tel.work.fax":
+_3c4.FaxNumberWork={};
+modifyObjectBaseProp(_3c4.FaxNumberWork);
+_3c4.FaxNumberWork.Label="Work Fax";
+_3c4.FaxNumberWork.Value=_3c3;
+break;
+case "tel.work.voip":
+_3c4.VoipWork={};
+modifyObjectBaseProp(_3c4.VoipWork);
+_3c4.VoipWork.Label="Work Voip";
+_3c4.VoipWork.Value=_3c3;
+break;
+case "address.street":
+_3c4.AddrStreetGen={};
+modifyObjectBaseProp(_3c4.AddrStreetGen);
+_3c4.AddrStreetGen.Label="Street Address";
+_3c4.AddrStreetGen.Value=_3c3;
+break;
+case "address.local":
+_3c4.AddrLocalGen={};
+modifyObjectBaseProp(_3c4.AddrLocalGen);
+_3c4.AddrLocalGen.Label="City";
+_3c4.AddrLocalGen.Value=_3c3;
+break;
+case "address.region":
+_3c4.AddrRegionGen={};
+modifyObjectBaseProp(_3c4.AddrRegionGen);
+_3c4.AddrRegionGen.Label="State/Province";
+_3c4.AddrRegionGen.Value=_3c3;
+break;
+case "address.code":
+_3c4.AddrPostCodeGen={};
+modifyObjectBaseProp(_3c4.AddrPostCodeGen);
+_3c4.AddrPostCodeGen.Label="Postal code";
+_3c4.AddrPostCodeGen.Value=_3c3;
+break;
+case "address.country":
+_3c4.AddrCountryGen={};
+modifyObjectBaseProp(_3c4.AddrCountryGen);
+_3c4.AddrCountryGen.Label="Country";
+_3c4.AddrCountryGen.Value=_3c3;
+break;
+case "address.email":
+_3c4.EmailGen={};
+modifyObjectBaseProp(_3c4.EmailGen);
+_3c4.EmailGen.Label="EMail";
+_3c4.EmailGen.Value=_3c3;
+break;
+case "address.uri":
+_3c4.URLGen={};
+modifyObjectBaseProp(_3c4.URLGen);
+_3c4.URLGen.Label="Website";
+_3c4.URLGen.Value=_3c3;
+break;
+case "address.home.street":
+_3c4.AddrStreetHome={};
+modifyObjectBaseProp(_3c4.AddrStreetHome);
+_3c4.AddrStreetHome.Label="Home Address";
+_3c4.AddrStreetHome.Value=_3c3;
+break;
+case "address.home.local":
+_3c4.AddrLocalHome={};
+modifyObjectBaseProp(_3c4.AddrLocalHome);
+_3c4.AddrLocalHome.Label="City";
+_3c4.AddrLocalHome.Value=_3c3;
+break;
+case "address.home.region":
+_3c4.AddrRegionHome={};
+modifyObjectBaseProp(_3c4.AddrRegionHome);
+_3c4.AddrRegionHome.Label="State/Province";
+_3c4.AddrRegionHome.Value=_3c3;
+break;
+case "address.home.code":
+_3c4.AddrPostCodeHome={};
+modifyObjectBaseProp(_3c4.AddrPostCodeHome);
+_3c4.AddrPostCodeHome.Label="Postal code";
+_3c4.AddrPostCodeHome.Value=_3c3;
+break;
+case "address.home.country":
+_3c4.AddrCountryHome={};
+modifyObjectBaseProp(_3c4.AddrCountryHome);
+_3c4.AddrCountryHome.Label="Country";
+_3c4.AddrCountryHome.Value=_3c3;
+break;
+case "address.home.email":
+_3c4.EmailHome={};
+modifyObjectBaseProp(_3c4.EmailHome);
+_3c4.EmailHome.Label="Home EMail";
+_3c4.EmailHome.Value=_3c3;
+break;
+case "address.home.uri":
+_3c4.URLHome={};
+modifyObjectBaseProp(_3c4.URLHome);
+_3c4.URLHome.Label="Home Website";
+_3c4.URLHome.Value=_3c3;
+break;
+case "address.work.street":
+_3c4.AddrStreetWork={};
+modifyObjectBaseProp(_3c4.AddrStreetWork);
+_3c4.AddrStreetWork.Label="Work Address";
+_3c4.AddrStreetWork.Value=_3c3;
+break;
+case "address.work.local":
+_3c4.AddrLocalWork={};
+modifyObjectBaseProp(_3c4.AddrLocalWork);
+_3c4.AddrLocalWork.Label="City";
+_3c4.AddrLocalWork.Value=_3c3;
+break;
+case "address.work.region":
+_3c4.AddrRegionWork={};
+modifyObjectBaseProp(_3c4.AddrRegionWork);
+_3c4.AddrRegionWork.Label="State/Province";
+_3c4.AddrRegionWork.Value=_3c3;
+break;
+case "address.work.code":
+_3c4.AddrPostCodeWork={};
+modifyObjectBaseProp(_3c4.AddrPostCodeWork);
+_3c4.AddrPostCodeWork.Label="Postal code";
+_3c4.AddrPostCodeWork.Value=_3c3;
+break;
+case "address.work.country":
+_3c4.AddrCountryWork={};
+modifyObjectBaseProp(_3c4.AddrCountryWork);
+_3c4.AddrCountryWork.Label="Country";
+_3c4.AddrCountryWork.Value=_3c3;
+break;
+case "address.work.email":
+_3c4.EmailWork={};
+modifyObjectBaseProp(_3c4.EmailWork);
+_3c4.EmailWork.Label="Work EMail";
+_3c4.EmailWork.Value=_3c3;
+break;
+case "address.work.uri":
+_3c4.URLWork={};
+modifyObjectBaseProp(_3c4.URLWork);
+_3c4.URLWork.Label="Work Website";
+_3c4.URLWork.Value=_3c3;
+break;
+case "company.name":
+_3c4.CompanyName={};
+modifyObjectBaseProp(_3c4.CompanyName);
+_3c4.CompanyName.Label="Company";
+_3c4.CompanyName.Value=_3c3;
+break;
+case "company.title":
+_3c4.JobTitle={};
+modifyObjectBaseProp(_3c4.JobTitle);
+_3c4.JobTitle.Label="Title";
+_3c4.JobTitle.Value=_3c3;
+break;
+case "id":
+_3c4.id=_3c3;
+break;
+case "notes":
+_3c4.Note={};
+modifyObjectBaseProp(_3c4.Note);
+_3c4.Note.Label="Note";
+_3c4.Note.Value=_3c3;
+break;
+case "anniversary":
+_3c4.Anniversary={};
+modifyObjectBaseProp(_3c4.Anniversary);
+_3c4.Anniversary.Label="Anniversary";
+_3c4.Anniversary.Value=_3c3;
+break;
+case "birthday":
+_3c4.Date={};
+modifyObjectBaseProp(_3c4.Date);
+_3c4.Date.Label="BirthDay";
+_3c4.Date.Value=_3c3;
+break;
+case "nickName":
+_3c4.SecondName={};
+modifyObjectBaseProp(_3c4.SecondName);
+_3c4.SecondName.Label="NickName";
+_3c4.SecondName.Value=_3c3;
+break;
+case "photo":
+_3c4.CallerObjImg={};
+modifyObjectBaseProp(_3c4.CallerObjImg);
+_3c4.CallerObjImg.Label="CallerObjImg";
+_3c4.CallerObjImg.Value=_3c3;
+break;
+case "xspid":
+_3c4.IMPP={};
+modifyObjectBaseProp(_3c4.IMPP);
+_3c4.IMPP.Label="IMPP";
+_3c4.IMPP.Value=_3c3;
+break;
+}
+};
+function __s60_enumerate_build_contact_object(_3c5,_3c6,func,_3c8){
+var key;
+for(key in _3c5){
+var _3ca;
+if(_3c6){
+_3ca=_3c6+"."+key;
+}else{
+_3ca=key;
+}
+var _3cb=_3c5[key];
+if(_3ca=="IMPP"){
+func(_3ca,_3cb,_3c8);
+}
+if(typeof _3cb=="object"){
+__s60_enumerate_build_contact_object(_3cb,_3ca,func,_3c8);
+}else{
+func(_3ca,_3cb,_3c8);
+}
+}
+};
+function __sp_device_contact_extract(name,_3cd,_3ce){
+if(name=="id"){
+_3ce.id=_3cd;
+return;
+}
+if(!name.match(".Value")){
+return;
+}
 try{
-var _3d4=new DeviceAPIError(0,"dummy");
-var _3d5=true;
-if(_3d1===undefined){
-throw new DeviceAPIError(_3d4.MISSING_ARG_ERR,"SuccessCallback is missing");
-}else{
-if(((_3d1===null)||(_3d1===""))&&(typeof (_3d1)!="number")){
-throw new DeviceAPIError(_3d4.MISSING_ARG_ERR,"SuccessCallback is missing");
-}else{
-if(typeof (_3d1)!="function"){
-throw new DeviceAPIError(_3d4.INVALID_ARG_ERR,"invalid SuccessCallback argument");
-}
-}
-}
-if(_3d2===undefined||_3d2===null){
-throw new DeviceAPIError(_3d4.MISSING_ARG_ERR,"LandmarkItem is missing");
-}else{
-if(typeof (_3d2)!=="object"){
-throw new DeviceAPIError(_3d4.INVALID_ARG_ERR,"invalid LandmarkItem argument");
-}
-}
-if((_3d3!=undefined)){
-if((!_3d3)&&(typeof (_3d3)!="number")){
-_3d5=false;
-}else{
-if((typeof (_3d3)!="function")){
-throw new DeviceAPIError(_3d4.INVALID_ARG_ERR,"invalid ErrorCallback callback");
-}
-}
-}else{
-_3d5=false;
-}
-this.invoker=function(arg1,arg2,arg3){
-if(arg2==4||arg3.ErrorCode){
-var _3d9=convertFromPS2JS(arg3.ErrorCode);
-var _3da=new DeviceAPIError(_3d9,arg3.ErrorMessage);
-if(_3d5){
-_3d3(_3da);
-}
-}else{
-_3d1();
-}
-};
-var str="updateLandmark: ";
-var _3dc=new Object();
-modifyObjectBaseProp(_3dc);
-_3dc.Type="Landmark";
-_3dc.Data=new __sp_landmark_obj(_3d2,str);
-var rval=this.so.IDataSource.Add(_3dc,this.invoker);
-if(rval.ErrorCode!=0){
-switch(rval.ErrorCode){
-case err_missing_argument:
-throw new DeviceAPIError(_3d4.MISSING_ARG_ERR,rval.ErrorMessage);
-break;
-case err_bad_argument:
-throw new DeviceAPIError(_3d4.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-case err_ServiceNotSupported:
-throw new DeviceAPIError(_3d4.NOT_SUPPORTED_ERR,rval.ErrorMessage);
-break;
-case err_InvalidService_Argument:
-throw new DeviceAPIError(_3d4.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-default:
-throw new DeviceAPIError(-101,"unknown error message");
-}
-}
-return rval.TransactionID;
+if(name.match("IMPP.Value.0")){
+_3ce.xspid=[];
+}
+if(name.match("Name")){
+if(name.match("CompanyName")){
+if(!_3ce.company){
+_3ce.company={};
+}
+}else{
+if(!_3ce.name){
+_3ce.name={};
+}
+}
+}else{
+if(name.match("Phone")||name.match("Number")||name.match("VOIP")||name.match("Voip")){
+if(!_3ce.tel){
+_3ce.tel={};
+}
+if(name.match("Home")){
+if(!_3ce.tel.home){
+_3ce.tel.home={};
+}
+}else{
+if(name.match("Work")){
+if(!_3ce.tel.work){
+_3ce.tel.work={};
+}
+}
+}
+}else{
+if(name.match("Addr")||name.match("Email")||name.match("URL")){
+if(!_3ce.address){
+_3ce.address={};
+}
+if(name.match("Home")){
+if(!_3ce.address.home){
+_3ce.address.home={};
+}
+}else{
+if(name.match("Work")){
+if(!_3ce.address.work){
+_3ce.address.work={};
+}
+}
+}
+}else{
+if(name.match("JobTitle")){
+if(!_3ce.company){
+_3ce.company={};
+}
+}
+}
+}
+}
 }
 catch(e){
-throw e;
-}
-};
-function __sp_landmarks_category_update(_3de,_3df,_3e0){
-try{
-var _3e1=new DeviceAPIError(0,"dummy");
-var _3e2=true;
-if(_3de===undefined){
-throw new DeviceAPIError(_3e1.MISSING_ARG_ERR,"SucessCallback is missing");
-}else{
-if(((_3de===null)||(_3de===""))&&(typeof (_3de)!="number")){
-throw new DeviceAPIError(_3e1.MISSING_ARG_ERR,"SucessCallback is missing");
-}else{
-if(typeof (_3de)!="function"){
-throw new DeviceAPIError(_3e1.INVALID_ARG_ERR,"invalid SucessCallback argument");
-}
-}
-}
-if(_3df===undefined||_3df===null){
-throw new DeviceAPIError(_3e1.MISSING_ARG_ERR,"CategoryItem is missing");
-}else{
-if(typeof (_3df)!=="object"){
-throw new DeviceAPIError(_3e1.INVALID_ARG_ERR,"invalid CategoryItem argument");
-}
-}
-if((_3e0!=undefined)){
-if((!_3e0)&&(typeof (_3e0)!="number")){
-_3e2=false;
-}else{
-if((typeof (_3e0)!="function")){
-throw new DeviceAPIError(_3e1.INVALID_ARG_ERR,"invalid ErrorCallback callback");
-}
-}
-}else{
-_3e2=false;
-}
-this.invoker=function(arg1,arg2,arg3){
-if(arg2==4||arg3.ErrorCode){
-var _3e6=convertFromPS2JS(arg3.ErrorCode);
-var _3e7=new DeviceAPIError(_3e6,arg3.ErrorMessage);
-if(_3e2){
-_3e0(_3e7);
-}
-}else{
-_3de();
-}
-};
-var _3e8=new Object();
-modifyObjectBaseProp(_3e8);
-_3e8.Type="Category";
-_3e8.Data=new __sp_category_obj(_3df);
-var rval=this.so.IDataSource.Add(_3e8,this.invoker);
-if(rval.ErrorCode!=0){
-switch(rval.ErrorCode){
-case err_missing_argument:
-throw new DeviceAPIError(_3e1.MISSING_ARG_ERR,rval.ErrorMessage);
-break;
-case err_bad_argument:
-throw new DeviceAPIError(_3e1.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-case err_ServiceNotSupported:
-throw new DeviceAPIError(_3e1.NOT_SUPPORTED_ERR,rval.ErrorMessage);
-break;
-case err_InvalidService_Argument:
-throw new DeviceAPIError(_3e1.INVALID_ARG_ERR,rval.ErrorMessage);
+__device_handle_exception(e,"__sp_device_contact_extract: "+e);
+}
+if(name.match("IMPP.Value")){
+var _3cf=name.split(".");
+var _3d0=_3cf[2];
+if(_3d0!=undefined){
+_3ce.xspid[_3cf[2]]=_3cd;
+return;
+}
+}
+switch(name){
+case "LastName.Value":
+_3ce.name.last=_3cd;
+break;
+case "FirstName.Value":
+_3ce.name.first=_3cd;
+break;
+case "MiddleName.Value":
+_3ce.name.middle=_3cd;
+break;
+case "Prefix.Value":
+_3ce.name.prefix=_3cd;
+break;
+case "Suffix.Value":
+_3ce.name.suffix=_3cd;
+break;
+case "LandPhoneGen.Value":
+_3ce.tel.land=_3cd;
+break;
+case "MobilePhoneGen.Value":
+_3ce.tel.mobile=_3cd;
+break;
+case "VideoNumberGen.Value":
+_3ce.tel.video=_3cd;
+break;
+case "FaxNumberGen.Value":
+_3ce.tel.fax=_3cd;
+break;
+case "VOIPGen.Value":
+_3ce.tel.voip=_3cd;
+break;
+case "LandPhoneHome.Value":
+_3ce.tel.home.land=_3cd;
+break;
+case "MobilePhoneHome.Value":
+_3ce.tel.home.mobile=_3cd;
+break;
+case "VideoNumberHome.Value":
+_3ce.tel.home.video=_3cd;
+break;
+case "FaxNumberHome.Value":
+_3ce.tel.home.fax=_3cd;
+break;
+case "VoipHome.Value":
+_3ce.tel.home.voip=_3cd;
+break;
+case "LandPhoneWork.Value":
+_3ce.tel.work.land=_3cd;
+break;
+case "MobilePhoneWork.Value":
+_3ce.tel.work.mobile=_3cd;
+break;
+case "VideoNumberWork.Value":
+_3ce.tel.work.video=_3cd;
+break;
+case "FaxNumberWork.Value":
+_3ce.tel.work.fax=_3cd;
+break;
+case "VoipWork.Value":
+_3ce.tel.work.voip=_3cd;
+break;
+case "AddrStreetGen.Value":
+_3ce.address.street=_3cd;
+break;
+case "AddrLocalGen.Value":
+_3ce.address.local=_3cd;
+break;
+case "AddrRegionGen.Value":
+_3ce.address.region=_3cd;
+break;
+case "AddrPostCodeGen.Value":
+_3ce.address.code=_3cd;
+break;
+case "AddrCountryGen.Value":
+_3ce.address.country=_3cd;
+break;
+case "EmailGen.Value":
+_3ce.address.email=_3cd;
+break;
+case "URLGen.Value":
+_3ce.address.uri=_3cd;
+break;
+case "AddrStreetHome.Value":
+_3ce.address.home.street=_3cd;
+break;
+case "AddrLocalHome.Value":
+_3ce.address.home.local=_3cd;
+break;
+case "AddrRegionHome.Value":
+_3ce.address.home.region=_3cd;
+break;
+case "AddrPostCodeHome.Value":
+_3ce.address.home.code=_3cd;
+break;
+case "AddrCountryHome.Value":
+_3ce.address.home.country=_3cd;
+break;
+case "EmailHome.Value":
+_3ce.address.home.email=_3cd;
+break;
+case "URLHome.Value":
+_3ce.address.home.uri=_3cd;
+break;
+case "AddrStreetWork.Value":
+_3ce.address.work.street=_3cd;
+break;
+case "AddrLocalWork.Value":
+_3ce.address.work.local=_3cd;
+break;
+case "AddrRegionWork.Value":
+_3ce.address.work.region=_3cd;
+break;
+case "AddrPostCodeWork.Value":
+_3ce.address.work.code=_3cd;
+break;
+case "AddrCountryWork.Value":
+_3ce.address.work.country=_3cd;
+break;
+case "EmailWork.Value":
+_3ce.address.work.email=_3cd;
+break;
+case "URLWork.Value":
+_3ce.address.work.uri=_3cd;
+break;
+case "CompanyName.Value":
+_3ce.company.name=_3cd;
+break;
+case "JobTitle.Value":
+_3ce.company.title=_3cd;
+break;
+case "Note.Value":
+_3ce.notes=_3cd;
+break;
+case "Anniversary.Value":
+_3ce.anniversary=_3cd;
+break;
+case "Date.Value":
+_3ce.birthday=_3cd;
+break;
+case "SecondName.Value":
+_3ce.nickName=_3cd;
+break;
+case "CallerObjImg.Value":
+_3ce.photo=_3cd;
 break;
 default:
-throw new DeviceAPIError(-101,"unknown error message");
-}
-}
-return rval.TransactionID;
-}
-catch(e){
-throw e;
-}
-};
-function __sp_landmarks_category_delete(_3ea,_3eb,_3ec){
+}
+};
+function __sp_device_contact_build(_3d1,_3d2){
+__s60_enumerate_build_contact_object(_3d1,null,__sp_device_contact_extract,_3d2);
+};
+function __sp_contact_iterator_get_next(){
+var _3d3=this.iter.getNext();
+if(typeof _3d3=="undefined"){
+return null;
+}
+var rval={};
+__sp_device_contact_build(_3d3,rval);
+_3d3.close();
+return rval;
+};
+function __sp_contact_iterator(_3d5){
+this.iter=_3d5;
+this.next=__sp_contact_iterator_get_next;
+this.close=function(){
+this.iter.close();
+};
+};
+function __s60_enumerate_group_object(_3d6,func,_3d8){
+var key;
+for(key in _3d6){
+var _3da=key;
+var _3db=_3d6[key];
+func(_3da,_3db,_3d8);
+}
+};
+function __sp_device_groupinfo_extract(name,_3dd,_3de){
+if(_3de.group==undefined){
+_3de.group={};
+}
+if(name=="id"){
+_3de.group.groupId=_3dd;
+}else{
+if(name=="GroupLabel"){
+_3de.group.groupName=_3dd;
+}else{
+if(name=="Contents"){
+_3de.contents=_3dd;
+}
+}
+}
+return;
+};
+function __sp_device_groupinfo_build(_3df,_3e0){
+__s60_enumerate_group_object(_3df,__sp_device_groupinfo_extract,_3e0);
+};
+function __sp_device_group_extract(name,_3e2,_3e3){
+if(name=="id"){
+_3e3.groupId=_3e2;
+return;
+}
+if(name=="GroupLabel"){
+_3e3.groupName=_3e2;
+return;
+}
+};
+function __sp_device_group_build(_3e4,_3e5){
+__s60_enumerate_object(_3e4,null,__sp_device_group_extract,_3e5);
+};
+function __sp_group_iterator_get_next(){
+var _3e6=this.iter.getNext();
+if(typeof _3e6=="undefined"){
+return null;
+}
+var rval={};
+__sp_device_group_build(_3e6,rval);
+_3e6.close();
+return rval;
+};
+function __sp_group_iterator(_3e8){
+this.iter=_3e8;
+this.next=__sp_group_iterator_get_next;
+this.close=function(){
+this.iter.close();
+};
+};
+var CONTACTS_APP_ID=270486734;
+function __sp_contacts_startEditor(_3e9,_3ea,_3eb){
+if(!_3e9){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: StartEditor:Missing Success Callback");
+}
+if((typeof _3e9)!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: StartEditor:Invalid Success Callback");
+}
+if((_3ea)==null){
+_3ea={};
+}
+if((typeof _3ea)=="undefined"){
+_3ea={};
+}
+if((_3ea)==undefined){
+_3ea={};
+}
+if((typeof _3ea)!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: StartEditor:Invalid Contact Data");
+}
+if(_3eb){
+if((typeof _3eb)!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts :StartEditor:Invalid Error Callback");
+}
+}
+var _3ec=function(arg1,arg2,arg3){
+var iter=null;
+_3e9(iter);
+};
+__s60_start_and_wait(CONTACTS_APP_ID,"",_3ec);
+return 0;
+};
+function __sp_contacts_getContacts_cb(arg1,arg2,arg3){
+var iter=null;
+var _3f5;
+var _3f6;
+var _3f7;
+_3f7=glob_obj.getFromArray(arg1);
+if(_3f7){
+_3f5=_3f7.success_cb;
+_3f6=_3f7.error_cb;
+}else{
+alert("Contacts: __sp_contacts_getContacts_cb : Callback not found ");
+return;
+}
+if(arg3.ReturnValue){
+iter=new __sp_contact_iterator(arg3.ReturnValue);
+}else{
+if(arg3.ErrorCode!=0){
+var _3f8;
+if(arg3.ErrorMessage){
+_3f8=splitErrorMessage(arg3.ErrorMessage);
+}else{
+_3f8="Operation Failed";
+}
+_3f6(new DeviceException(MapErrorCode[arg3.ErrorCode],"Contacts: getContacts: "+_3f8));
+return;
+}
+}
+_3f5(iter);
+glob_obj.removeFromArray(arg1);
+};
+function __sp_contacts_getContacts(_3f9,_3fa,_3fb,_3fc){
+var _3fd={};
+modifyObjectBaseProp(_3fd);
+_3fd.Type="Contact";
+if(_3fa){
+_3fd.Filter={};
+modifyObjectBaseProp(_3fd.Filter);
+_3fd.Filter.SearchVal=_3fa;
+}
+if(_3fb!=null&&_3fb!=undefined){
+_3fd.Sort={};
+modifyObjectBaseProp(_3fd.Sort);
+if(typeof _3fb=="number"){
+if(_3fb==this.SORT_ASCENDING){
+_3fd.Sort.Order="Ascending";
+}else{
+if(_3fb==this.SORT_DESCENDING){
+_3fd.Sort.Order="Descending";
+}else{
+_3fc(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Contacts: getContacts: invalid sortOrder input"));
+return;
+}
+}
+}else{
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getContacts: invalid sortOrder input");
+}
+}
 try{
-var _3ed=new DeviceAPIError(0,"dummy");
-var _3ee=true;
-if(_3ea===undefined){
-throw new DeviceAPIError(_3ed.MISSING_ARG_ERR,"SucessCallback is missing");
-}else{
-if(((_3ea===null)||(_3ea===""))&&(typeof (_3ea)!="number")){
-throw new DeviceAPIError(_3ed.MISSING_ARG_ERR,"SucessCallback is missing");
-}else{
-if(typeof (_3ea)!="function"){
-throw new DeviceAPIError(_3ed.INVALID_ARG_ERR,"invalid SucessCallback argument");
-}
-}
-}
-if(_3eb===undefined||_3eb===null){
-throw new DeviceAPIError(_3ed.MISSING_ARG_ERR,"categoryId is missing");
-}else{
-if(typeof (_3eb)!=="string"){
-throw new DeviceAPIError(_3ed.INVALID_ARG_ERR,"invalid categoryId argument");
-}
-}
-if((_3ec!=undefined)){
-if((!_3ec)&&(typeof (_3ec)!="number")){
-_3ee=false;
-}else{
-if((typeof (_3ec)!="function")){
-throw new DeviceAPIError(_3ed.INVALID_ARG_ERR,"invalid ErrorCallback callback");
-}
-}
-}else{
-_3ee=false;
-}
-this.invoker=function(arg1,arg2,arg3){
-if(arg2==4||arg3.ErrorCode){
-var _3f2=convertFromPS2JS(arg3.ErrorCode);
-var _3f3=new DeviceAPIError(_3f2,arg3.ErrorMessage);
-if(_3ee){
-_3ec(_3f3);
-}
-}else{
-_3ea();
-}
-};
-var _3f4=new Object();
-modifyObjectBaseProp(_3f4);
-_3f4.Type="Category";
-_3f4.Data=new Object();
-modifyObjectBaseProp(_3f4.Data);
-_3f4.Data.id=_3eb;
-var rval=this.so.IDataSource.Delete(_3f4,this.invoker);
+if(!_3f9){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: getContacts: callback is missing");
+}else{
+if(typeof _3f9!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getContacts: callback is invalid");
+}
+}
+if(_3fc){
+if(typeof (_3fc)!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getContacts: ErrorCallback is invalid");
+}
+}
+temp_scb=_3f9;
+temp_ecb=_3fc;
+var rval=this.so.IDataSource.GetList(_3fd,this.getContactsCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_3f9,_3fc);
+}
+if(_3fd.Sort){
+delete _3fd.Sort.Order;
+}
+if(_3fd.Filter){
+delete _3fd.Filter.SearchVal;
+}
+if(_3fd){
+delete _3fd.Type;
+delete _3fd.Filter;
+delete _3fd.Sort;
+}
 if(rval.ErrorCode!=0){
-switch(rval.ErrorCode){
-case err_missing_argument:
-throw new DeviceAPIError(_3ed.MISSING_ARG_ERR,rval.ErrorMessage);
-break;
-case err_bad_argument:
-throw new DeviceAPIError(_3ed.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-case err_ServiceNotSupported:
-throw new DeviceAPIError(_3ed.NOT_SUPPORTED_ERR,rval.ErrorMessage);
-break;
-case err_InvalidService_Argument:
-throw new DeviceAPIError(_3ed.INVALID_ARG_ERR,rval.ErrorMessage);
+var _3ff=mappingVerification(rval.ErrorCode);
+var _400=null;
+if(rval.ErrorMessage){
+_400=splitErrorMessage(rval.ErrorMessage);
+}
+if(_3ff){
+switch(MapErrorCode[rval.ErrorCode]){
+case this.error.MISSING_ARG_ERR:
+case this.error.INVALID_ARG_ERR:
+case this.error.NOT_SUPPORTED_ERR:
+if(_400){
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContacts: "+_400);
+}else{
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContacts:Operation Failed");
+}
 break;
 default:
-throw new DeviceAPIError(-101,"unknown error message");
+if(_3fc!=undefined){
+if(_400){
+_3fc(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContacts: "+_400));
+}else{
+_3fc(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContacts:Operation Failed "));
+}
+}else{
+if(_400){
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContacts: "+_400);
+}else{
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContacts:Operation Failed");
+}
+}
+}
+}else{
+if(_3fc!=undefined){
+if(_400){
+_3fc(new DeviceException(rval.ErrorCode,"Contacts: getContacts: "+_400));
+}else{
+_3fc(new DeviceException(rval.ErrorCode,"getContacts:Operation Failed "));
+}
+}else{
+if(_400){
+throw new DeviceException(rval.ErrorCode,"Contacts: getContacts: "+_400);
+}else{
+throw new DeviceException(rval.ErrorCode,"Contacts: getContacts:Operation Failed");
+}
+}
 }
 }
 return rval.TransactionID;
 }
 catch(e){
-throw e;
-}
-};
-function __sp_landmarks_getList(_3f6,_3f7,_3f8){
+__device_handle_exception(e,"__sp_contacts_getContacts: "+e);
+}
+};
+function __sp_contacts_add(_401){
+if((_401)==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"addContact:Contact Data Needed");
+}
+if((typeof _401)=="undefined"){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"addContact:Contact Data Needed");
+}
+if((_401)==undefined){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"addContact:Contact Data Needed");
+}
+if((typeof _401)!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"addContact:Invalid Contact Data");
+}
+var _402={};
+modifyObjectBaseProp(_402);
+__s60_enumerate_contact_object(_401,null,__sp_contact_extract,_402);
+var _403={};
+modifyObjectBaseProp(_403);
+_403.Type="Contact";
+_403.Data=_402;
+try{
+if(_402.id){
+throw new DeviceException(this.error.NOT_SUPPORTED_ERR,"Contacts: addContact: Id Not Supported");
+}
+var _404=this.so.IDataSource.Add(_403);
+if(_402){
+delete _402.id;
+}
+if(_403){
+delete _403.Type;
+delete _403.Data;
+}
+var _405=_404["ReturnValue"];
+if(_404.ErrorCode!=0){
+var _406=mappingVerification(_404.ErrorCode);
+if(_404.ErrorMessage){
+var _407=splitErrorMessage(_404.ErrorMessage);
+if(_406){
+throw new DeviceException(MapErrorCode[_404.ErrorCode],"Contacts: addContact: "+_407);
+}else{
+throw new DeviceException(_404.ErrorCode,"Contacts: addContact: "+_407);
+}
+}else{
+if(_406){
+throw new DeviceException(MapErrorCode[_404.ErrorCode],"Contacts: addContact: Operation Failed");
+}else{
+throw new DeviceException(_404.ErrorCode,"Contacts: addContact: Operation Failed");
+}
+}
+}
+return _405;
+}
+catch(e){
+__device_handle_exception(e,"__sp_contacts_addContact: "+e);
+}
+};
+function __sp_contacts_update(_408){
+try{
+if(!(_408&&_408.id)){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: updateContact: contact is missing");
+}
+var _409={};
+modifyObjectBaseProp(_409);
+__s60_enumerate_contact_object(_408,null,__sp_contact_extract,_409);
+if(_409.id==undefined){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: updateContact: Invalid id type");
+}
+if(typeof _409.id!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: updateContact: Invalid id type");
+}
+var _40a={};
+modifyObjectBaseProp(_40a);
+_40a.Type="Contact";
+_40a.Data=_409;
+var _40b=this.so.IDataSource.Add(_40a);
+if(_409){
+delete _409.id;
+}
+if(_40a){
+delete _40a.Type;
+delete _40a.Data;
+}
+if(_40b.ErrorCode!=0){
+var _40c=mappingVerification(_40b.ErrorCode);
+if(_40b.ErrorMessage){
+var _40d=splitErrorMessage(_40b.ErrorMessage);
+if(_40c){
+throw new DeviceException(MapErrorCode[_40b.ErrorCode],"Contacts: updateContact: "+_40d);
+}else{
+throw new DeviceException(_40b.ErrorCode,"Contacts: updateContact: "+_40d);
+}
+}else{
+if(_40c){
+throw new DeviceException(MapErrorCode[_40b.ErrorCode],"Contacts: updateContact: Operation Failed");
+}else{
+throw new DeviceException(_40b.ErrorCode,"Contacts: updateContact: Operation Failed");
+}
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_contacts_updateContact: "+e);
+}
+};
+function __sp_contacts_delete(id){
+__device_debug("sp_contacts_delete id: "+id);
+var _40f={};
+modifyObjectBaseProp(_40f);
+if(id==undefined){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: deleteContacts: idlist is missing");
+}
+if(typeof id=="object"){
+_40f.IdList=id;
+}else{
+_40f.IdList=[];
+_40f.IdList[0]=id;
+}
+var _410={};
+modifyObjectBaseProp(_410);
+_410.Type="Contact";
+_410.Data=_40f;
 try{
-var _3f9=new DeviceAPIError(0,"dummy");
-var _3fa=true;
-var _3fb=false;
-var _3fc=false;
-if(_3f6===undefined){
-throw new DeviceAPIError(_3f9.MISSING_ARG_ERR,"SucessCallback is missing");
-}else{
-if(((_3f6===null)||(_3f6===""))&&(typeof (_3f6)!="number")){
-throw new DeviceAPIError(_3f9.MISSING_ARG_ERR,"SucessCallback is missing");
-}else{
-if(typeof (_3f6)!="function"){
-throw new DeviceAPIError(_3f9.INVALID_ARG_ERR,"invalid SucessCallback argument");
-}
-}
-}
-if(_3f7!==undefined){
-if((typeof (_3f7)!="object")){
-if((_3f7===null||_3f7==="")&&(typeof (_3f7)!="number")){
-_3fb=true;
-_3fc=true;
-}else{
-if(typeof (_3f7)=="string"){
-_3fb=true;
-_3fc=false;
-}else{
-throw new DeviceAPIError(_3f9.INVALID_ARG_ERR,"invalid match criteria");
-}
-}
-}
-if(typeof (_3f7)!="object"){
-if(!_3fb){
-throw new DeviceAPIError(_3f9.INVALID_ARG_ERR,"invalid match criteria");
-}
-}
-}
-if((_3f8!=undefined)){
-if((!_3f8)&&(typeof (_3f8)!="number")){
-_3fa=false;
-}else{
-if((typeof (_3f8)!="function")){
-throw new DeviceAPIError(_3f9.INVALID_ARG_ERR,"invalid error callback");
-}
-}
-}else{
-_3fa=false;
-}
-var _3fd=new Object();
-modifyObjectBaseProp(_3fd);
-_3fd.Type="Landmark";
-if(_3f7){
-_3fd.Filter=new Object();
-modifyObjectBaseProp(_3fd.Filter);
-if(typeof _3f7=="object"){
-if(_3f7.name!==undefined){
-_3fd.Filter.LandmarkName=_3f7.name;
-}
-if(_3f7.description!==undefined){
-_3fd.Filter.LandmarkDesc=_3f7.description;
-}
-if(_3f7.categoryId!==undefined){
-_3fd.Filter.categoryId=_3f7.categoryId;
-}
-if(_3f7.position!==undefined){
-if((_3f7.position!==null)&&(_3f7.position!=="")&&(typeof (_3f7.position)!="object")){
-throw new DeviceAPIError(_3f9.INVALID_ARG_ERR,"position must be an object");
-}
-if(_3f7.position===null){
-}
-if(_3f7.position===""){
-throw new DeviceAPIError(_3f9.INVALID_ARG_ERR,"position must be an object");
-}
-if(_3f7.position){
-_3fd.Filter.LandmarkPosition=new __sp_landmark_position_obj(_3f7.position);
-}
-}
-if(_3f7.coverageRadiusUsed!==undefined){
-_3fd.Filter.CoverageRadiusOption=_3f7.coverageRadiusUsed;
-}
-if(_3f7.searchRadius!==undefined){
-_3fd.Filter.MaximumDistance=_3f7.searchRadius;
-}
-if(_3f7.area!==undefined){
-if((_3f7.area!==null)&&(_3f7.area!=="")&&(typeof (_3f7.area)!="object")){
-throw new DeviceAPIError(_3f9.INVALID_ARG_ERR,"area must be an object");
-}
-if(_3f7.area===null){
-_3fd.Filter.BoundedArea=null;
-}
-if(_3f7.area===""){
-throw new DeviceAPIError(_3f9.INVALID_ARG_ERR,"area must be an object");
-}
-if(_3f7.area){
-_3fd.Filter.LandmarkPosition=new __sp_landmark_bounded_area_obj(_3f7.area);
-}
-}
-}else{
-if(__device_typeof(_3f7).toLowerCase()=="string"){
-_3fd.Filter.LandmarkName=_3f7;
-}
-}
-}
-this.invoker=function(arg1,arg2,arg3){
+var _411=this.so.IDataSource.Delete(_410);
+if(_40f){
+delete _40f.IdList;
+}
+if(_410){
+delete _410.Type;
+delete _410.Data;
+}
+if(_411.ErrorCode!=0){
+var _412=mappingVerification(_411.ErrorCode);
+if(_411.ErrorMessage){
+var _413=splitErrorMessage(_411.ErrorMessage);
+if(_412){
+throw new DeviceException(MapErrorCode[_411.ErrorCode],"Contacts: deleteContacts: "+_413);
+}else{
+throw new DeviceException(_411.ErrorCode,"Contacts: deleteContacts: "+_413);
+}
+}else{
+if(_412){
+throw new DeviceException(MapErrorCode[_411.ErrorCode],"Contacts: deleteContacts: Operation Failed");
+}else{
+throw new DeviceException(_411.ErrorCode,"Contacts: deleteContacts: Operation Failed");
+}
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_contacts_deleteContacts: "+e);
+}
+};
+function __sp_contacts_get(id){
+var _415={};
+modifyObjectBaseProp(_415);
+_415.Type="Contact";
+if(id==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: getContactInfo: id should not be null");
+}
+if(typeof id!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getContactInfo: id should be string");
+}
+_415.Filter={};
+modifyObjectBaseProp(_415.Filter);
+_415.Filter.id=id;
+try{
+var rval=this.so.IDataSource.GetList(_415);
+if(_415.Filter){
+delete _415.Filter.id;
+}
+if(_415){
+delete _415.Type;
+delete _415.Filter;
+}
+if(rval){
+if(rval.ErrorCode!=0){
+var _417=mappingVerification(rval.ErrorCode);
+if(rval.ErrorMessage){
+var _418=splitErrorMessage(rval.ErrorMessage);
+if(_417){
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactInfo: "+_418);
+}else{
+throw new DeviceException(rval.ErrorCode,"Contacts: getContactInfo: "+_418);
+}
+}else{
+if(_417){
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactInfo: Operation Failed");
+}else{
+throw new DeviceException(rval.ErrorCode,"Contacts: getContactInfo: Operation Failed");
+}
+}
+}
+var _419={};
+modifyObjectBaseProp(_419);
+var _41a=rval.ReturnValue.getNext();
+__sp_device_contact_build(_41a,_419);
+return _419;
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_contacts_getContactInfo:"+e);
+}
+};
+function __sp_contacts_addGroup(_41b){
+var _41c={};
+modifyObjectBaseProp(_41c);
+_41c.GroupLabel=_41b;
+if(typeof (_41c.GroupLabel)==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: addGroups: callback is missing");
+}
+if((typeof _41c.GroupLabel)=="undefined"){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"addGroup:Group Data Needed");
+}
+if((_41c.GroupLabel)==undefined){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"addGroup:Group Data Needed");
+}
+var _41d={};
+modifyObjectBaseProp(_41d);
+_41d.Type="Group";
+_41d.Data=_41c;
+try{
+var _41e=this.so.IDataSource.Add(_41d);
+if(_41c){
+delete _41c.GroupLabel;
+}
+if(_41d){
+delete _41d.Type;
+delete _41d.Data;
+}
+var _41f=_41e["ReturnValue"];
+if(_41e.ErrorCode!=0){
+var _420=mappingVerification(_41e.ErrorCode);
+if(_41e.ErrorMessage){
+var _421=splitErrorMessage(_41e.ErrorMessage);
+if(_420){
+throw new DeviceException(MapErrorCode[_41e.ErrorCode],"Contacts: addGroup: "+_421);
+}else{
+throw new DeviceException(_421,_41e.ErrorCode,"Contacts: addGroup: Operation Failed ");
+}
+}else{
+if(_420){
+throw new DeviceException(MapErrorCode[_41e.ErrorCode],"Contacts: addGroup: Operation Failed");
+}else{
+throw new DeviceException(_41e.ErrorCode,"Contacts: addGroup: Operation Failed");
+}
+}
+}
+return _41f;
+}
+catch(e){
+__device_handle_exception(e,"__sp_contacts_addGroup: "+e);
+}
+};
+function __sp_contacts_getGroups_cb(arg1,arg2,arg3){
 var iter=null;
-if(arg3.ErrorCode||(arg2==4)){
-var _402=convertFromPS2JS(arg3.ErrorCode);
-var _403=new DeviceAPIError(_402,arg3.ErrorMessage);
-if(_3fa){
-_3f8(_403);
-}
-}else{
+var _426;
+var _427;
+var _428;
+_428=glob_obj.getFromArray(arg1);
+if(_428){
+_426=_428.success_cb;
+_427=_428.error_cb;
+}else{
+return;
+}
+iter=arg3.ReturnValue;
 if(arg3.ReturnValue){
-iter=new __sp_landmarks_iterator(arg3.ReturnValue);
-}
-_3f6(iter);
-}
-};
-var rval=this.so.IDataSource.GetList(_3fd,this.invoker);
+iter=new __sp_group_iterator(arg3.ReturnValue);
+}else{
+if(arg3.ErrorCode!=0){
+var _429;
+if(arg3.ErrorMessage){
+_429=splitErrorMessage(arg3.ErrorMessage);
+}else{
+_429="Operation Failed";
+}
+_427(new DeviceException(_429,MapErrorCode[arg3.ErrorCode],"Contacts: getGroups:"));
+return;
+}
+}
+_426(iter);
+glob_obj.removeFromArray(arg1);
+};
+function __sp_contacts_getGroups(_42a,_42b){
+var _42c={};
+modifyObjectBaseProp(_42c);
+_42c.Type="Group";
+try{
+if(!_42a){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: getGroups: callback is missing");
+}else{
+if(typeof _42a!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getGroups: callback is invalid");
+}
+}
+if(_42b){
+if(typeof (_42b)!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getGroups: ErrorCallback is invalid");
+}
+}
+temp_scb=_42a;
+temp_ecb=_42b;
+var rval=this.so.IDataSource.GetList(_42c,this.getGroupsCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_42a,_42b);
+}
+if(_42c){
+delete _42c.Type;
+}
 if(rval.ErrorCode!=0){
-switch(rval.ErrorCode){
-case 1003:
-throw new DeviceAPIError(_3f9.MISSING_ARG_ERR,rval.ErrorMessage);
-break;
-case 1002:
-throw new DeviceAPIError(_3f9.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-case 1004:
-throw new DeviceAPIError(_3f9.NOT_SUPPORTED_ERR,rval.ErrorMessage);
-break;
-case 1000:
-throw new DeviceAPIError(_3f9.INVALID_ARG_ERR,rval.ErrorMessage);
+var _42e=mappingVerification(rval.ErrorCode);
+var _42f=null;
+if(rval.ErrorMessage){
+_42f=splitErrorMessage(rval.ErrorMessage);
+}
+if(_42e){
+switch(MapErrorCode[rval.ErrorCode]){
+case this.error.MISSING_ARG_ERR:
+case this.error.INVALID_ARG_ERR:
+case this.error.NOT_SUPPORTED_ERR:
+if(_42f){
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroups: "+_42f);
+}else{
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroups: Operation Failed");
+}
 break;
 default:
-throw new DeviceAPIError(-101,"unknown error message");
+if(_42b!=undefined){
+if(_42f){
+_42b(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroups: "+_42f));
+}else{
+_42b(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts:  getGroups: Operation Failed "));
+}
+}else{
+if(_42f){
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroups: Operation Failed"+_42f);
+}else{
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroups: Operation Failed");
+}
+}
+}
+}else{
+if(_42b!=undefined){
+if(_42f){
+_42b(new DeviceException(rval.ErrorCode,"Contacts: getGroups: "+_42f));
+}else{
+_42b(new DeviceException(rval.ErrorCode,"Contacts: getGroups: Operation Failed"));
+}
+}else{
+if(_42f){
+throw new DeviceException(rval.ErrorCode,"Contacts: getGroups: Operation Failed"+_42f);
+}else{
+throw new DeviceException(rval.ErrorCode,"Contacts: getGroups: Operation Failed");
+}
+}
 }
 }
 return rval.TransactionID;
 }
 catch(e){
-throw e;
-}
-};
-function __sp_landmarks_import(_405,_406,_407,_408){
+__device_handle_exception(e,"__sp_contacts_getGroups: "+e);
+}
+};
+function __sp_contacts_deleteGroups(id){
+var _431={};
+modifyObjectBaseProp(_431);
+var _432=[];
+if(typeof id=="object"){
+var i=0;
+for(var val in id){
+_432[i]=id[val];
+i++;
+}
+}else{
+_432[0]=id;
+}
+_431.IdList=[];
+_431.IdList=_432;
+var _435={};
+modifyObjectBaseProp(_435);
+_435.Type="Group";
+_435.Data=_431;
+try{
+var _436=this.so.IDataSource.Delete(_435);
+if(_436.ErrorCode!=0){
+var _437=mappingVerification(_436.ErrorCode);
+if(_436.ErrorMessage){
+var _438=splitErrorMessage(_436.ErrorMessage);
+if(_437){
+throw new DeviceException(MapErrorCode[_436.ErrorCode],"Contacts: deleteGroups: "+_438);
+}else{
+throw new DeviceException(_436.ErrorCode,"Contacts: deleteGroups: "+_438);
+}
+}else{
+if(_437){
+throw new DeviceException(MapErrorCode[_436.ErrorCode],"Contacts: deleteGroups: Operation Failed");
+}else{
+throw new DeviceException(_436.ErrorCode,"Contacts: deleteGroups: Operation Failed");
+}
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_contacts_deleteGroups: "+e);
+}
+};
+function __sp_contacts_addContactsToGroup(_439,id1){
 try{
-var _409=new DeviceAPIError(0,"dummy");
-var _40a=true;
-if(_405===undefined){
-throw new DeviceAPIError(_409.MISSING_ARG_ERR,"LandmarksItrCallback is missing");
-}else{
-if(((_405===null)||(_405===""))&&(typeof (_405)!="number")){
-throw new DeviceAPIError(_409.MISSING_ARG_ERR,"LandmarksItrCallback is missing");
-}else{
-if(typeof (_405)!="function"){
-throw new DeviceAPIError(_409.INVALID_ARG_ERR,"invalid LandmarksItrCallback argument");
-}
-}
-}
-if(_406===undefined||_406===null){
-throw new DeviceAPIError(_409.MISSING_ARG_ERR,"sourceFileUri is missing");
-}else{
-if(typeof (_406)!=="string"){
-throw new DeviceAPIError(_409.INVALID_ARG_ERR,"invalid sourceFileUri argument");
-}
-}
-if(_407===undefined||_407===null){
-throw new DeviceAPIError(_409.MISSING_ARG_ERR,"mimetype is missing");
-}else{
-if(typeof (_407)!=="string"){
-throw new DeviceAPIError(_409.INVALID_ARG_ERR,"invalid mimetype argument");
-}
-}
-if((_408!=undefined)){
-if((!_408)&&(typeof (_408)!="number")){
-_40a=false;
-}else{
-if((typeof (_408)!="function")){
-throw new DeviceAPIError(_409.INVALID_ARG_ERR,"invalid ErrorCallback callback");
-}
-}
-}else{
-_40a=false;
-}
-this.invoker=function(arg1,arg2,arg3){
-var iter=null;
-if(arg2==4||arg3.ErrorCode){
-var _40f=convertFromPS2JS(arg3.ErrorCode);
-var _410=new DeviceAPIError(_40f,arg3.ErrorMessage);
-if(_40a){
-_408(_410);
-}
-}else{
-if(arg3.ReturnValue){
-iter=new __sp_landmarks_iterator(arg3.ReturnValue);
-}
-_405(iter);
-}
-};
-var _411=new Object();
-modifyObjectBaseProp(_411);
-_411.Type="Landmark";
-_411.Data=new Object();
-modifyObjectBaseProp(_411.Data);
-if(_406.slice(0,7)=="file://"){
-_406=_406.slice(7);
-}else{
-if(_406.slice(0,8)=="file:///"){
-_406=_406.slice(8);
-}else{
-throw new DeviceAPIError(_409.INVALID_ARG_ERR,"sourceFileUri is not in URI format");
-}
-}
-while(_406.search("/")!=-1){
-_406=_406.replace("/","\\");
-}
-_411.Data.SourceFile=_406;
-_411.Data.MimeType=_407;
-var rval=this.so.IDataSource.Import(_411,this.invoker);
+var _43b={};
+modifyObjectBaseProp(_43b);
+var _43c=false;
+_43b.Type="Group";
+var map={};
+modifyObjectBaseProp(map);
+var _43e=[];
+if(typeof id1=="object"){
+var i=0;
+for(var val in id1){
+_43e[i]=id1[val];
+i++;
+}
+}else{
+_43e[0]=id1;
+}
+map.IdList=_43e;
+_43c=true;
+delete _43e.index;
+if(_439!=undefined){
+map.id=_439;
+_43c=true;
+}
+if(_43c){
+_43b.Data=map;
+}
+_43b.OperationType="Associate";
+var _441=this.so.IDataSource.Organise(_43b);
+if(map){
+delete map.id;
+delete map.IdList;
+}
+if(_43b){
+delete _43b.Data;
+delete _43b.OperationType;
+delete _43b.Type;
+}
+if(_441.ErrorCode!=0){
+var _442=mappingVerification(_441.ErrorCode);
+if(_441.ErrorMessage){
+var _443=splitErrorMessage(_441.ErrorMessage);
+if(_442){
+throw new DeviceException(MapErrorCode[_441.ErrorCode],"Contacts: addContactsToGroup: "+_443);
+}else{
+throw new DeviceException(_441.ErrorCode,"Contacts: addContactsToGroup: "+_443);
+}
+}else{
+if(_442){
+throw new DeviceException(MapErrorCode[_441.ErrorCode],"Contacts: addContactsToGroup: Operation Failed");
+}else{
+throw new DeviceException(_441.ErrorCode,"Contacts: addContactsToGroup: Operation Failed");
+}
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_contacts_addContactsToGroup: "+e);
+}
+};
+function __sp_contacts_getContactIds_cb(arg1,arg2,arg3){
+var item=null;
+var _448=null;
+var _449;
+var _44a;
+var _44b;
+_44b=glob_obj.getFromArray(arg1);
+if(_44b){
+_449=_44b.success_cb;
+_44a=_44b.error_cb;
+}else{
+alert("Contacts: __sp_contacts_getContactIds_cb : Callback not found ");
+return;
+}
+var id=null;
+if(arg3["ReturnValue"]!=undefined){
+item=arg3["ReturnValue"];
+id=item["IdList"];
+_448=[];
+_448=id;
+delete _448.index;
+}else{
+if(arg3.ErrorCode!=0){
+var _44d;
+if(arg3.ErrorMessage){
+_44d=splitErrorMessage(arg3.ErrorMessage);
+}else{
+_44d="Operation Failed";
+}
+_44a(new DeviceException(MapErrorCode[arg3.ErrorCode],"Contacts: getContactIds:"+_44d));
+return;
+}
+}
+_449(_448);
+glob_obj.removeFromArray(arg1);
+};
+function __sp_contacts_getContactIds(_44e,_44f,_450,_451){
+var _452={};
+modifyObjectBaseProp(_452);
+_452.Type="Contact";
+if(_44f){
+_452.Filter={};
+modifyObjectBaseProp(_452.Filter);
+_452.Filter.SearchVal=_44f;
+}
+if(_450!=null&&_450!=undefined){
+_452.Sort={};
+modifyObjectBaseProp(_452.Sort);
+if(typeof _450=="number"){
+if(_450==this.SORT_ASCENDING){
+_452.Sort.Order="Ascending";
+}else{
+if(_450==this.SORT_DESCENDING){
+_452.Sort.Order="Descending";
+}else{
+_451(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Contacts: getContacts: invalid sortOrder input"));
+return;
+}
+}
+}else{
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getContactIds: SortOrder is Invalid");
+}
+}
+try{
+if(!_44e){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: getContactIds: callback is missing");
+}else{
+if(typeof _44e!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getContactIds: callback is invalid");
+}
+}
+if(_451){
+if(typeof (_451)!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getContactIds: ErrorCallback is invalid");
+}
+}
+temp_scb=_44e;
+temp_ecb=_451;
+var rval=this.so.IDataSource.GetIds(_452,this.getContactIdsCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_44e,_451);
+}
 if(rval.ErrorCode!=0){
-switch(rval.ErrorCode){
-case err_missing_argument:
-throw new DeviceAPIError(_409.MISSING_ARG_ERR,rval.ErrorMessage);
-break;
-case err_bad_argument:
-throw new DeviceAPIError(_409.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-case err_ServiceNotSupported:
-throw new DeviceAPIError(_409.NOT_SUPPORTED_ERR,rval.ErrorMessage);
-break;
-case err_InvalidService_Argument:
-throw new DeviceAPIError(_409.INVALID_ARG_ERR,rval.ErrorMessage);
+var _454=mappingVerification(rval.ErrorCode);
+var _455=null;
+if(rval.ErrorMessage){
+var _455=splitErrorMessage(rval.ErrorMessage);
+}
+if(_454){
+switch(MapErrorCode[rval.ErrorCode]){
+case this.error.MISSING_ARG_ERR:
+case this.error.INVALID_ARG_ERR:
+case this.error.NOT_SUPPORTED_ERR:
+if(_455){
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactIds: "+_455);
+}else{
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactIds: Operation Failed");
+}
 break;
 default:
-throw new DeviceAPIError(-101,"unknown error message");
+if(_451!=undefined){
+if(_455){
+_451(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactIds: "+_455));
+}else{
+_451(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactIds: Operation Failed "));
+}
+}else{
+if(_455){
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactIds:"+_455);
+}else{
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactIds: Operation Failed");
+}
+}
+}
+}else{
+if(_451!=undefined){
+if(_455){
+_451(new DeviceException(rval.ErrorCode,"Contacts: getContactIds: "+_455));
+}else{
+_451(new DeviceException(rval.ErrorCode,"Contacts: getContactIds: Operation Failed "));
+}
+}else{
+if(_455){
+throw new DeviceException(rval.ErrorCode,"Contacts: getContactIds:"+_455);
+}else{
+throw new DeviceException(rval.ErrorCode,"Contacts: getContactIds: Operation Failed");
+}
+}
 }
 }
 return rval.TransactionID;
 }
 catch(e){
-throw e;
-}
-};
-function __sp_landmarks_export(_413,_414,_415,_416,_417){
+__device_handle_exception(e,"__sp_contacts_getContactIds: "+e);
+}
+};
+function __sp_contacts_getGroupIds_cb(arg1,arg2,arg3){
+var _459=null;
+var item=null;
+var _45b=[];
+var _45c;
+var _459;
+var _45d;
+_45d=glob_obj.getFromArray(arg1);
+if(_45d){
+_45c=_45d.success_cb;
+_459=_45d.error_cb;
+}else{
+return;
+}
+if(arg3.ReturnValue){
+item=arg3["ReturnValue"];
+arg3.ReturnValue.close();
+var id=item["IdList"];
+_45b=id;
+}else{
+if(arg3.ErrorCode!=0){
+var _45f;
+if(rval.ErrorMessage){
+_45f=splitErrorMessage(rval.ErrorMessage);
+}else{
+_45f="Operation Failed";
+}
+_459(new DeviceException(MapErrorCode[arg3.ErrorCode],"Contacts: getGroupIds:"+_45f));
+return;
+}
+}
+_45c(_45b);
+delete _45b.index;
+glob_obj.removeFromArray(arg1);
+};
+function __sp_contacts_getGroupIds(_460,_461){
+var _462={};
+modifyObjectBaseProp(_462);
+_462.Type="Group";
 try{
-var _418=new DeviceAPIError(0,"dummy");
-var _419=true;
-if(_413===undefined){
-throw new DeviceAPIError(_418.MISSING_ARG_ERR,"SuccessCallback is missing");
-}else{
-if(((_413===null)||(_413===""))&&(typeof (_413)!="number")){
-throw new DeviceAPIError(_418.MISSING_ARG_ERR,"SuccessCallback is missing");
-}else{
-if(typeof (_413)!="function"){
-throw new DeviceAPIError(_418.INVALID_ARG_ERR,"invalid SuccessCallback argument");
-}
-}
-}
-if(_414===undefined||_414===null){
-throw new DeviceAPIError(_418.MISSING_ARG_ERR,"landmarkIdList is missing");
-}else{
-if(typeof (_414)!=="object"){
-throw new DeviceAPIError(_418.INVALID_ARG_ERR,"invalid landmarkIdList argument");
-}
-}
-if(_415===undefined||_415===null){
-throw new DeviceAPIError(_418.MISSING_ARG_ERR,"destFileUri is missing");
-}else{
-if(typeof (_415)!=="string"){
-throw new DeviceAPIError(_418.INVALID_ARG_ERR,"invalid destFileUri argument");
-}
-}
-if(_416===undefined||_416===null){
-throw new DeviceAPIError(_418.MISSING_ARG_ERR,"mimetype is missing");
-}else{
-if(typeof (_416)!=="string"){
-throw new DeviceAPIError(_418.INVALID_ARG_ERR,"invalid mimetype argument");
-}
-}
-if((_417!=undefined)){
-if((!_417)&&(typeof (_417)!="number")){
-_419=false;
-}else{
-if((typeof (_417)!="function")){
-throw new DeviceAPIError(_418.INVALID_ARG_ERR,"invalid ErrorCallback callback");
-}
-}
-}else{
-_419=false;
-}
-this.invoker=function(arg1,arg2,arg3){
-if(arg2==4||arg3.ErrorCode){
-var _41d=convertFromPS2JS(arg3.ErrorCode);
-var _41e=new DeviceAPIError(_41d,arg3.ErrorMessage);
-if(_419){
-_417(_41e);
-}
-}else{
-_413();
-}
-};
-var _41f=new Object();
-modifyObjectBaseProp(_41f);
-_41f.Type="Landmark";
-_41f.Data=new Object();
-modifyObjectBaseProp(_41f.Data);
-if(_415.slice(0,7)=="file://"){
-_415=_415.slice(7);
-}else{
-if(_415.slice(0,8)=="file:///"){
-_415=_415.slice(8);
-}else{
-throw new DeviceAPIError(_418.INVALID_ARG_ERR,"destFileUri is not in URI format");
-}
-}
-while(_415.search("/")!=-1){
-_415=_415.replace("/","\\");
-}
-_41f.Data.DestinationFile=_415;
-_41f.Data.IdList=_414;
-_41f.Data.MimeType=_416;
-var rval=this.so.IDataSource.Export(_41f,this.invoker);
+if(!_460){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: getGroupIds: callback is missing");
+}else{
+if(typeof _460!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getGroupIds: callback is invalid");
+}
+}
+if(_461){
+if(typeof (_461)!="function"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getGroupIds: ErrorCallback is invalid");
+}
+}
+temp_scb=_460;
+temp_ecb=_461;
+var rval=this.so.IDataSource.GetIds(_462,this.getGroupIdsCb);
+if(rval.TransactionID){
+glob_obj.addToGlobalArray(rval.TransactionID,_460,_461);
+}
+if(_462){
+delete _462.Type;
+}
 if(rval.ErrorCode!=0){
+var _464=mappingVerification(rval.ErrorCode);
+var _465=null;
+if(rval.ErrorMessage){
+var _465=splitErrorMessage(rval.ErrorMessage);
+}
+if(_464){
 switch(rval.ErrorCode){
-case err_missing_argument:
-throw new DeviceAPIError(_418.MISSING_ARG_ERR,rval.ErrorMessage);
-break;
-case err_bad_argument:
-throw new DeviceAPIError(_418.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-case err_ServiceNotSupported:
-throw new DeviceAPIError(_418.NOT_SUPPORTED_ERR,rval.ErrorMessage);
-break;
-case err_InvalidService_Argument:
-throw new DeviceAPIError(_418.INVALID_ARG_ERR,rval.ErrorMessage);
+case this.error.MISSING_ARG_ERR:
+case this.error.INVALID_ARG_ERR:
+case this.error.NOT_SUPPORTED_ERR:
+if(_465){
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupIds: "+_465);
+}else{
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupIds: Operation Failed");
+}
 break;
 default:
-throw new DeviceAPIError(-101,"unknown error message");
+if(_461!=undefined){
+if(_465){
+_461(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupIds: "+_465));
+}else{
+_461(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupIds: Operation Failed"));
+}
+}else{
+if(_465){
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: Contacts: getGroupIds:"+_465);
+}else{
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupIds: Operation Failed");
+}
+}
+}
+}else{
+if(_461!=undefined){
+if(_465){
+_461(new DeviceException(rval.ErrorCode,"Contacts: getGroupIds: "+_465));
+}else{
+_461(new DeviceException(rval.ErrorCode,"Contacts: getGroupIds: Operation Failed"));
+}
+}else{
+if(_465){
+throw new DeviceException(rval.ErrorCode,"Contacts: Contacts: getGroupIds:"+_465);
+}else{
+throw new DeviceException(rval.ErrorCode,"Contacts: getGroupIds: Operation Failed");
+}
+}
 }
 }
 return rval.TransactionID;
 }
 catch(e){
-throw e;
-}
-};
-function __sp_landmarks_organize(_421,_422,_423,_424,_425){
+__device_handle_exception(e,"__sp_contacts_getGroupIds: "+e);
+}
+};
+function __sp_contacts_removeContactsFromGroup(_466,id){
 try{
-var _426=new DeviceAPIError(0,"dummy");
-var _427=true;
-if(_421===undefined){
-throw new DeviceAPIError(_426.MISSING_ARG_ERR,"SuccessCallback is missing");
-}else{
-if(((_421===null)||(_421===""))&&(typeof (_421)!="number")){
-throw new DeviceAPIError(_426.MISSING_ARG_ERR,"SuccessCallback is missing");
-}else{
-if(typeof (_421)!="function"){
-throw new DeviceAPIError(_426.INVALID_ARG_ERR,"invalid SuccessCallback argument");
-}
-}
-}
-if(_422===undefined||_422===null){
-throw new DeviceAPIError(_426.MISSING_ARG_ERR,"landmarkIdList is missing");
-}else{
-if(typeof (_422)!=="object"){
-throw new DeviceAPIError(_426.INVALID_ARG_ERR,"invalid LandmarkItem argument");
-}
-}
-if(_423===undefined||_423===null){
-throw new DeviceAPIError(_426.MISSING_ARG_ERR,"categoryId is missing");
-}else{
-if(typeof (_423)!=="string"){
-throw new DeviceAPIError(_426.INVALID_ARG_ERR,"invalid categoryId argument");
-}
-}
-if(_424===undefined||_424===null){
-_424=true;
-}else{
-if(typeof (_424)!=="boolean"){
-throw new DeviceAPIError(_426.INVALID_ARG_ERR,"invalid associate argument");
-}
-}
-if((_425!=undefined)){
-if((!_425)&&(typeof (_425)!="number")){
-_427=false;
-}else{
-if((typeof (_425)!="function")){
-throw new DeviceAPIError(_426.INVALID_ARG_ERR,"invalid ErrorCallback callback");
-}
-}
-}else{
-_427=false;
-}
-this.invoker=function(arg1,arg2,arg3){
-if(arg2==4||arg3.ErrorCode){
-var _42b=convertFromPS2JS(arg3.ErrorCode);
-var _42c=new DeviceAPIError(_42b,arg3.ErrorMessage);
-if(_427){
-_425(_42c);
-}
-}else{
-_421();
-}
-};
-var _42d=new Object();
-modifyObjectBaseProp(_42d);
-_42d.Type="Landmark";
-_42d.Data=new Object();
-modifyObjectBaseProp(_42d.Data);
-_42d.Data.id=_423;
-_42d.Data.IdList=_422;
-if(_424){
-_42d.OperationType="Associate";
-}else{
-_42d.OperationType="Disassociate";
-}
-var rval=this.so.IDataSource.Organise(_42d,this.invoker);
-if(rval.ErrorCode!=0){
-switch(rval.ErrorCode){
-case err_missing_argument:
-throw new DeviceAPIError(_426.MISSING_ARG_ERR,rval.ErrorMessage);
-break;
-case err_bad_argument:
-throw new DeviceAPIError(_426.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-case err_ServiceNotSupported:
-throw new DeviceAPIError(_426.NOT_SUPPORTED_ERR,rval.ErrorMessage);
-break;
-case err_InvalidService_Argument:
-throw new DeviceAPIError(_426.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-default:
-throw new DeviceAPIError(-101,"unknown error message");
-}
-}
-return rval.TransactionID;
+var _468={};
+modifyObjectBaseProp(_468);
+var _469=false;
+_468.Type="Group";
+var map={};
+if(id!=undefined){
+var _46b=[];
+if(typeof id=="object"){
+var i=0;
+for(var val in id){
+_46b[i]=id[val];
+i++;
+}
+}else{
+_46b[0]=id;
+}
+map.IdList=_46b;
+_469=true;
+}
+if(_466!=undefined){
+map.id=_466;
+_469=true;
+}
+if(_469){
+_468.Data=map;
+}
+_468.OperationType="Disassociate";
+var _46e=this.so.IDataSource.Organise(_468);
+if(map){
+delete map.IdList;
+}
+if(_468){
+delete _468.Data;
+delete _468.OperationType;
+delete _468.Type;
+}
+if(_46e.ErrorCode!=0){
+var _46f=mappingVerification(_46e.ErrorCode);
+if(_46e.ErrorMessage){
+var _470=splitErrorMessage(_46e.ErrorMessage);
+if(_46f){
+throw new DeviceException(MapErrorCode[_46e.ErrorCode],"Contacts: removeContactsFromGroup: "+_470);
+}else{
+throw new DeviceException(_46e.ErrorCode,"Contacts: removeContactsFromGroup: "+_470);
+}
+}else{
+if(_46f){
+throw new DeviceException(MapErrorCode[_46e.ErrorCode],"Contacts: removeContactsFromGroup: Operation Failed");
+}else{
+throw new DeviceException(_46e.ErrorCode,"Contacts: removeContactsFromGroup: Operation Failed");
+}
+}
+}
 }
 catch(e){
-throw e;
-}
-};
-function __sp_landmarks_cancel(_42f){
+__device_handle_exception(e,"__sp_contacts_removeContactsFromGroup: "+e);
+}
+};
+function __sp_contacts_cancel(_471){
 try{
-if(_42f===undefined||_42f===null){
-throw new DeviceAPIError(error.MISSING_ARG_ERR,"transactionId is missing");
-}else{
-if(typeof (_42f)!=="number"){
-throw new DeviceAPIError(error.INVALID_ARG_ERR,"invalid transactionId argument");
-}
-}
-var _430=new Object();
-modifyObjectBaseProp(_430);
-_430.TransactionID=_42f;
-var rval=this.so.IDataSource.Cancel(_430);
-if(rval.ErrorCode!=0){
-switch(rval.ErrorCode){
-case err_missing_argument:
-throw new DeviceAPIError(error.MISSING_ARG_ERR,rval.ErrorMessage);
-break;
-case err_bad_argument:
-throw new DeviceAPIError(error.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-case err_ServiceNotSupported:
-throw new DeviceAPIError(error.NOT_SUPPORTED_ERR,rval.ErrorMessage);
-break;
-case err_InvalidService_Argument:
-throw new DeviceAPIError(error.INVALID_ARG_ERR,rval.ErrorMessage);
-break;
-default:
-throw new DeviceAPIError(-101,"unknown error message");
+var _472={};
+if((_471)==null){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: cancel: transactionId is missing ");
+}
+if((_471)==undefined){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: cancel:transactionId is undefined ");
+}
+if((typeof _471)=="undefined"){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: cancel: transactionId is undefined ");
+}
+if(((typeof _471)!="number")||(_471<=0)){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: cancel: transactionId is Invalid");
+}
+modifyObjectBaseProp(_472);
+_472.TransactionID=_471;
+var _473=this.so.IDataSource.Cancel(_472);
+if(_472){
+delete _472.TransactionID;
+}
+var _474=_473["ErrorCode"];
+if(_474!=0){
+var _475=mappingVerification(_473.ErrorCode);
+if(_473["ErrorMessage"]){
+var _476=splitErrorMessage(_473.ErrorMessage);
+if(_475){
+throw new DeviceException(MapErrorCode[_474],"Contacts: cancel: "+_476);
+}else{
+throw new DeviceException(_474,"Contacts: cancel: "+_476);
+}
+}else{
+if(_475){
+throw new DeviceException(MapErrorCode[_474],"Contacts: cancel: Operation Failed");
+}else{
+throw new DeviceException(_474,"Contacts: cancel: Operation Failed");
+}
 }
 }
 }
 catch(e){
-throw e;
+__device_handle_exception(e,"__sp_contacts_cancel: "+e);
+}
+};
+function __sp_contacts_updateGroup(_477){
+if(!(_477)){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: updateGroup:Group Data is missing");
+}
+if((typeof _477)!="object"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: updateGroup:Invalid Group Data");
+}
+if(!(_477&&_477.groupId)){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: updateGroup: Group id is missing");
+}
+if(typeof _477.groupId!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: updateGroup:Invalid Group id input");
+}
+try{
+var _478={};
+modifyObjectBaseProp(_478);
+_478.Type="Group";
+var _479={};
+modifyObjectBaseProp(_479);
+if(_477!=undefined){
+if(_477.groupId!=undefined){
+_479["id"]=_477.groupId;
+}else{
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: updateGroup: Id input is mandatory");
+}
+if(_477.groupName!=undefined){
+_479["GroupLabel"]=_477.groupName;
+}
+}
+_478.Data=_479;
+var _47a=this.so.IDataSource.Add(_478);
+if(_479){
+delete _479.prototype;
+}
+if(_478){
+delete _478.Data;
+delete _478.Type;
+}
+if(_47a.ErrorCode!=0){
+var _47b=mappingVerification(_47a.ErrorCode);
+if(_47a.ErrorMessage){
+var _47c=splitErrorMessage(_47a.ErrorMessage);
+if(_47b){
+throw new DeviceException(MapErrorCode[_47a.ErrorCode],"Contacts: updateGroup: "+_47c);
+}else{
+throw new DeviceException(_47a.ErrorCode,"Contacts: updateGroup: "+_47c);
+}
+}else{
+if(_47b){
+throw new DeviceException(MapErrorCode[_47a.ErrorCode],"Contacts: updateGroup: Operation Failed");
+}else{
+throw new DeviceException(_47a.ErrorCode,"Contacts: updateGroup: Operation Failed");
+}
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_contacts_updateGroup: "+e);
+}
+};
+function __sp_contacts_getGroupInfo(_47d){
+try{
+var _47e={};
+modifyObjectBaseProp(_47e);
+_47e.Type="Group";
+_47e.Filter={};
+modifyObjectBaseProp(_47e.Filter);
+if(_47d==undefined){
+throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: getGroupInfo: Id input is mandatory");
+}
+if((typeof _47d)!="string"){
+throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getGroupInfo: Id input is mandatory");
+}
+_47e.Filter.id=_47d;
+var rval=this.so.IDataSource.GetList(_47e);
+if(_47e.Filter){
+delete _47e.Filter.id;
+}
+if(_47e){
+delete _47e.Filter;
+delete _47e.Type;
+}
+if(rval){
+if(rval.ErrorCode!=0){
+var _480=mappingVerification(rval.ErrorCode);
+if(rval.ErrorMessage){
+var _481=splitErrorMessage(rval.ErrorMessage);
+if(_480){
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupInfo: "+_481);
+}else{
+throw new DeviceException(rval.ErrorCode,"Contacts: getGroupInfo: "+_481);
+}
+}else{
+if(_480){
+throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupInfo: Operation Failed");
+}else{
+throw new DeviceException(rval.ErrorCode,"Contacts: getGroupInfo: Operation Failed");
+}
+}
+}else{
+var _482={};
+modifyObjectBaseProp(_482);
+var _483=rval.ReturnValue.getNext();
+__sp_device_groupinfo_build(_483,_482);
+return _482;
+}
+}
+}
+catch(e){
+__device_handle_exception(e,"__sp_contacts_getGroupInfo:"+e);
+}
+};
+function mappingVerification(_484){
+if(_484===1016||_484===1012||_484===1010||_484===1009||_484===1005||_484===1000||_484===1011||_484===1007||_484===1003||_484===1002){
+return true;
+}else{
+return false;
+}
+};
+function __sp_contacts_instance(){
+this.SORT_ASCENDING=0;
+this.SORT_DESCENDING=1;
+this.descriptor=new __sp_contacts_descriptor();
+this.startEditor=__sp_contacts_startEditor;
+this.getContacts=__sp_contacts_getContacts;
+this.getContactsCb=__sp_contacts_getContacts_cb;
+this.addContact=__sp_contacts_add;
+this.updateContact=__sp_contacts_update;
+this.deleteContacts=__sp_contacts_delete;
+this.getContactInfo=__sp_contacts_get;
+this.addGroup=__sp_contacts_addGroup;
+this.getGroups=__sp_contacts_getGroups;
+this.getGroupsCb=__sp_contacts_getGroups_cb;
+this.deleteGroups=__sp_contacts_deleteGroups;
+this.addContactsToGroup=__sp_contacts_addContactsToGroup;
+this.getContactIds=__sp_contacts_getContactIds;
+this.getContactIdsCb=__sp_contacts_getContactIds_cb;
+this.getGroupIds=__sp_contacts_getGroupIds;
+this.getGroupIdsCb=__sp_contacts_getGroupIds_cb;
+this.removeContactsFromGroup=__sp_contacts_removeContactsFromGroup;
+this.cancel=__sp_contacts_cancel;
+this.updateGroup=__sp_contacts_updateGroup;
+this.getGroupInfo=__sp_contacts_getGroupInfo;
+this.error=new DeviceException(0,"Dummy");
+try{
+this.so=device.getServiceObject("Service.Contact","IDataSource");
+}
+catch(e){
+__device_handle_exception(e,"Contacts service not available "+e);
 }
 };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceproviders/jsapi/platformservices/src/calendar.js	Mon Jan 18 21:02:57 2010 +0200
@@ -0,0 +1,1378 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Defination of class CCalendarInterface
+*
+*/
+
+function __device_calendar_descriptor(provider){
+	//alert(("provider");
+  this.interfaceName = provider.interfaceName;
+  //alert(("provider interfaceName" + this.interfaceName);
+  this.version = provider.version;
+  //alert(("provider version" + this.version);
+}
+
+function __device_calendar_startEditor(callback, entry, ErrorCallback){
+  this.provider.startEditor(callback, entry, ErrorCallback);
+}
+
+function __device_calendar_getList(callback, match, ErrorCallback){
+  //alert(("__device_calendar_getList(callback, match)");
+  return this.provider.getList(callback, match, ErrorCallback);
+  //alert(("return from device_calendar_getList");
+
+}
+
+function __device_calendar_add(entry){
+  return this.provider.addEntry(entry);
+}
+
+function __device_calendar_update(entry){
+  return this.provider.updateEntry(entry);
+}
+
+function __device_calendar_delete(data){
+  this.provider.deleteEntry(data);
+}
+
+function __device_calendar_cancel(transactionId){
+  this.provider.cancel(transactionId);
+}
+
+// Private location prototype: called from service factory
+function __device_calendar(provider){
+  //Private properties
+  this.provider = provider;
+  //Read-only properties
+  this.interfaceName = provider.descriptor.interfaceName;
+  this.version = provider.descriptor.version;
+  //Core methods
+  this.startEditor = __device_calendar_startEditor;
+  //Extended methods
+  this.getList = __device_calendar_getList;
+  this.addEntry = __device_calendar_add;
+  this.updateEntry = __device_calendar_update;
+  this.deleteEntry = __device_calendar_delete;
+  this.cancel = __device_calendar_cancel;
+}
+
+// calendar service interface
+
+// Namepace: com.nokia.device.service
+//alert(("before com.nokia.device.service");
+var __device_calendar_service_entry = {"name": null,
+					  "version": null,
+					  "proto": __device_calendar,
+					  "descriptor": __device_calendar_descriptor,
+					  "providers": [{"descriptor": __sp_calendar_descriptor, "instance": __sp_calendar_instance}]
+					 };
+		   
+//alert(("after com.nokia.device.service");
+
+
+
+/*
+Copyright � 2009 Nokia. All rights reserved.
+Code licensed under the BSD License:
+Software License Agreement (BSD License) Copyright � 2009 Nokia.
+All rights reserved.
+Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+Neither the name of Nokia Corporation. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Nokia Corporation. 
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+version: 1.0
+*/
+
+var dataGetList = 0;
+var isUpdate = 0;
+// S60 sp-based calendar provider
+
+function __sp_calendar_descriptor(){
+  //Read-only properties
+  this.interfaceName = "calendar";
+  if(window.__Service_Interface_Ver)
+	this.version =__Service_Interface_Ver;
+  else
+	this.version =1.0;
+  //Class-static properties 
+}
+
+function __sp_calendar_entry_time(start, end, alarm){
+   //////alert( start + " __sp_calendar_entry_time ");
+  if (start) {
+    //////alert("if start");
+	//////alert(start +"start");
+	var st = new Date(start);
+  	this.begin = st;
+//	////alert("begin" + typeof this.begin);
+  }
+  if (end) {
+  //	////alert("in end");
+  	var en = new Date(end);
+	this.end = en;
+  }
+  if (alarm) {
+    var al = new Date(alarm);
+  	this.alarm = al;
+  }
+}
+
+function __sp_calendar_isInputValid(match){
+//	////alert("Inside input validation");
+	
+		if (match) {
+			if (match.id) {
+				if (typeof(match.id) != "string") {
+					return false;
+				}
+			}
+			if (match.type) {
+				if ((typeof(match.type) != "string") || !__sp_calendar_entry_types.match(match.type)) {
+					return false;
+				}
+			}
+			if (match.text) {
+				if (typeof(match.text) != "string") {
+					return false;
+				}
+			}
+			if (match.range) {
+				if (typeof(match.range) != "object") {
+					return false;
+				}
+				if (match.range.begin) {
+					if (typeof(match.range.begin) != "object") {
+						return false;
+					}
+				}
+				if (match.range.end) {
+					if (typeof(match.range.end) != "object") {
+						return false;
+					}
+				}
+			}
+			
+			/******************************************************
+			 * addEntry/updateEntry input ,  id and type checked above
+			 **********************************************************/
+		
+				if (match.summary) {
+					
+					if (typeof(match.summary) != "string") {
+						return false;
+					}
+				}
+				if (match.description) {
+					if (typeof(match.description) != "string") {
+						return false;
+					}
+				}
+				if (match.status) {
+					if (typeof(match.status) != "string") {
+						return false;
+					}
+					
+				}
+				if (match.location) {
+					if (typeof(match.location) != "string") {
+						return false;
+					}
+				}
+				if (match.priority) {
+					if (typeof(match.priority) != "number") {
+						return false;
+					}
+				}
+				if (match.instanceStartTime) {
+					if (typeof(match.instanceStartTime) != "object") {
+						return false;
+					}
+				}
+				if (match.exceptionDates) {
+					if (typeof(match.exceptionDates) != "object") {
+						return false;
+					}
+				}
+				if (match.time) {
+					if (typeof match.time != 'object') {
+						return false;
+					}
+					if (match.time.begin) {
+						if (typeof(match.time.begin) != "object") {
+							return false;
+						}
+						if(match.time.begin == "Invalid Date" )
+						{
+							return false;
+						}
+						try{
+							(match.time.begin).getTime();
+						}
+						catch(e){
+							return false;
+						}
+					}
+					
+					if (match.time.end) {
+						if (typeof(match.time.end) != "object") {
+							return false;
+						}
+						if(match.time.end == "Invalid Date")
+						{
+							return false;
+						}
+						try{
+							(match.time.end).getTime();
+						}
+						catch(e){
+							return false;
+						}
+					}
+					if(match.time.begin && match.time.end)
+					{
+						if(match.time.begin > match.time.end)
+						{
+							return false;
+						}
+					}
+					if (match.time.alarm) {
+						
+						if (typeof(match.time.alarm) != "object") {
+							return false;
+						}
+						try{
+							(match.time.alarm).getTime();
+						}
+						catch(e){
+							return false;
+						}
+					}
+					
+				}
+				/*if(match.time && match.repeatRule){
+					if(match.time.end && match.repeatRule.untilDate){
+						if((match.time.end > match.repeatRule.untilDate)){
+							return false
+						}
+					}
+				}*/
+				if (match.repeatRule) {
+					if (typeof match.repeatRule != 'object') {
+						return false;
+					}
+					if (match.repeatRule.frequency) {
+						if (typeof(match.repeatRule.frequency) != "string") {
+							return false;
+						}
+					}
+					if (match.repeatRule.startDate) {
+						if (typeof(match.repeatRule.startDate) != "object") {
+							return false;
+						}
+						if((match.repeatRule.startDate) == "Invalid Date")
+						{
+							return false;
+						}
+						try{
+							(match.repeatRule.startDate).getTime();
+						}
+						catch(e){
+							return false;
+						}
+					}
+					if (match.repeatRule.untilDate) {
+						if (typeof(match.repeatRule.untilDate) != "object") {
+							return false;
+						}
+						if((match.repeatRule.untilDate) == "Invalid Date")
+						{
+							return false;
+						}
+						try{
+							(match.repeatRule.untilDate).getTime();
+						}
+						catch(e){
+							return false;
+						}
+					}
+					if (match.repeatRule.startDate && match.repeatRule.untilDate)
+					{
+						if (match.repeatRule.startDate > match.repeatRule.untilDate)
+						{
+							return false;
+						}
+					}
+					if (match.repeatRule.interval) {
+						if (typeof(match.repeatRule.interval) != "number") {
+							return false;
+						}
+					}
+					if (match.repeatRule.month) {
+						if (typeof(match.repeatRule.month) != "number") {
+							return false;
+						}
+					}
+					if (match.repeatRule.weekDays) {
+						if (typeof(match.repeatRule.weekDays) != "object") {
+							return false;
+						}
+					}
+					if (match.repeatRule.daysOfMonth) {
+						if (typeof(match.repeatRule.daysOfMonth) != "object") {
+							return false;
+						}
+					}
+					if (match.repeatRule.monthDates) {
+						if (typeof(match.repeatRule.monthDates) != "object") {
+							return false;
+						}
+					}
+					
+				}
+			}
+	//	////alert("returning true from input validation");
+		return true;
+}
+
+function __sp_calendar_getList_repeatRule(sp_RepeatRule){
+	var string;
+ //     ////alert("getlist repeatrule************");
+	switch(sp_RepeatRule.Type){
+		case 1:
+			string = "daily";
+			this.frequency = string.toString();
+			break;
+		case 2:
+			string = "weekly";
+			this.frequency = string.toString();
+			break;
+		case 3:
+			string = "monthly";
+		//	////alert("monthly");
+			this.frequency = string.toString();
+			break;
+		case 4:
+			string = "yearly";
+			this.frequency = string.toString();
+			break;
+		default:
+			throw new DeviceException( this.error.INVALID_ARG_ERR, "Calendar: Repeat Rule Type is Invalid");
+	}
+	if (sp_RepeatRule.StartDate) {
+		this.startDate = new Date(sp_RepeatRule.StartDate);
+		//////alert("startdate");
+	}
+	if (sp_RepeatRule.UntilDate) {
+		this.untilDate = new Date(sp_RepeatRule.UntilDate);
+	}
+	if (sp_RepeatRule.Interval) {
+		this.interval = sp_RepeatRule.Interval;
+	}
+	if (sp_RepeatRule.DaysInWeek) {
+		//	this.weekDays = sp_RepeatRule.DaysInWeek;
+			this.weekDays = [];
+			//repeatRule.weekDays;
+			for(var a in sp_RepeatRule.DaysInWeek){
+				if(sp_RepeatRule.DaysInWeek[a] == 6){
+					sp_RepeatRule.DaysInWeek[a] = 0;
+				}
+				else{
+					sp_RepeatRule.DaysInWeek[a]=sp_RepeatRule.DaysInWeek[a]+ 1;
+				}
+				this.weekDays.push(sp_RepeatRule.DaysInWeek[a]);
+			}
+	}
+	
+	if (sp_RepeatRule.Month) {
+		this.month = sp_RepeatRule.Month;
+	}
+	if(sp_RepeatRule.DaysOfMonth){
+		if(sp_RepeatRule.DaysOfMonth.Day){
+			if(sp_RepeatRule.DaysOfMonth.Day == 6){
+				sp_RepeatRule.DaysOfMonth.Day = 0;
+			}
+			else{
+				sp_RepeatRule.DaysOfMonth.Day = sp_RepeatRule.DaysOfMonth.Day + 1;
+			}
+			this.daysOfMonth.day = sp_RepeatRule.DaysOfMonth.Day;
+		}
+		if(sp_RepeatRule.DaysOfMonth.WeekNum){
+			this.daysOfMonth.weekInMonth = sp_RepeatRule.DaysOfMonth.WeekNum;
+		}
+	}
+	
+	if (sp_RepeatRule.MonthDays) {
+		//	this.monthDates = sp_RepeatRule.MonthDays;
+			this.monthDates = [];
+			for( var i=0; i<sp_RepeatRule.MonthDays.length; i++){
+				this.monthDates.push(sp_RepeatRule.MonthDays[i]-1);
+			}
+	}
+}
+
+function __sp_device_calendar_entry(sp_entry){ 
+ // ////alert("sp_entry");
+  if (sp_entry.id) {
+  //	////alert("sp_entry id" + sp_entry.id);
+	this.id = sp_entry.id;
+	}
+	if (sp_entry.type) {
+	//	////alert("sp_entry.Type" + sp_entry.type);
+  this.type = sp_entry.Type;
+	}
+  if (sp_entry.Summary) {
+ // 	////alert("summary" + sp_entry.Summary);
+  	this.summary = sp_entry.Summary;
+  }
+  if (sp_entry.Description) {
+  	this.description = sp_entry.Description;
+  }
+  if (sp_entry.Location) {
+  	this.location = sp_entry.Location;
+  }
+  if (sp_entry.InstanceStartTime) {
+  	this.instanceStartTime = sp_entry.InstanceStartTime;
+//	////alert("startTimeInstacce" + sp_entry.InstanceStartTime);
+  }
+//  ////alert("sp_entry.Priority" + sp_entry.Priority);
+  if (sp_entry.Priority >= 0 || sp_entry.Priority<= 255) {
+  	this.priority = sp_entry.Priority;
+  }
+  if (sp_entry.Status) {
+  	this.status = sp_entry.Status;
+  }
+  if (sp_entry.ExDates) {
+  	this.exceptionDates = sp_entry.ExDates;
+  }
+  if (sp_entry.RepeatRule) {
+  	this.repeatRule = new __sp_calendar_getList_repeatRule(sp_entry.RepeatRule);
+  }
+ // ////alert("sp_entry.StartTime" + sp_entry.StartTime);
+	if (dataGetList == 0) {
+		this.time = new __sp_calendar_entry_time(sp_entry.InstanceStartTime, sp_entry.InstanceEndTime, sp_entry.AlarmTime);
+	}
+	else{
+		this.time = new __sp_calendar_entry_time(sp_entry.StartTime, sp_entry.EndTime, sp_entry.AlarmTime);
+	}
+
+}
+
+
+function __sp_daysOfMonth_build(daysOfMonth){
+	if (daysOfMonth.day) {
+		////alert(daysOfMonth.day);
+		if(daysOfMonth.day == 0){
+			daysOfMonth.day = 6;
+		}
+		else{
+			////alert("in else");
+			daysOfMonth.day = daysOfMonth.day-1;
+		}
+		////alert(daysOfMonth.day);
+		this.Day = daysOfMonth.day;
+			//alert("this.Day - "+ this.Day);
+	}
+	if (daysOfMonth.weekInMonth) {
+		this.WeekNum = daysOfMonth.weekInMonth;
+	//alert("this.WeekNum" + this.WeekNum);
+	}
+}
+
+
+function __sp_calendar_addEntry_repeatRule(repeatRule,str){
+	try{
+			if (!(repeatRule.frequency)) {
+				throw new DeviceException( this.error.MISSING_ARG_ERR, "Calendar: addEntry: frequency is missing");
+			}
+			else {
+				var frequency = repeatRule.frequency;
+					switch(frequency){
+						case "daily":
+								this.Type = 1;
+								break;
+						case "weekly":
+								this.Type = 2;
+							//	////alert("weekly" + this.Type );
+								break;
+						case "monthly":
+								this.Type = 3;
+							//	////alert("monthly" + this.Type );
+								break;
+						case "yearly":
+								this.Type = 4;
+								break;
+					default:
+						throw new DeviceException( this.error.INVALID_ARG_ERR, "Calendar: "+str+" Repeat Rule Type is Invalid");
+					}
+				if (repeatRule.startDate) {
+					this.StartDate = repeatRule.startDate;
+				//	////alert("this.StartDate123" +  this.StartDate);
+				}
+				if (repeatRule.untilDate) {
+					this.UntilDate = repeatRule.untilDate;
+				//	////alert("this.untilDate123" +  this.UntilDate);
+				}
+				if (repeatRule.interval) {
+					this.Interval = repeatRule.interval;
+				//	////alert("repeatRule.interval" + typeof repeatRule.interval);
+				//	////alert("this.Interval" + typeof this.Interval);
+					
+				}
+					
+				if (repeatRule.weekDays){
+						this.DaysInWeek = [];
+						//repeatRule.weekDays;
+						for(var a in repeatRule.weekDays){
+							if(repeatRule.weekDays[a] == 0){
+								repeatRule.weekDays[a] = 6;
+							}
+							else{
+								repeatRule.weekDays[a]=repeatRule.weekDays[a]-1;
+							}
+							this.DaysInWeek.push(repeatRule.weekDays[a]);
+						}
+				//		////alert("this.DaysInWeek123" + typeof this.DaysInWeek);
+				} 
+			//	//alert(repeatRule.month);
+				if (repeatRule.month) {
+					this.Month = repeatRule.month;
+					////alert("this.Month " + typeof this.Month +"  " + this.Month);
+				}
+		//	//alert("before MonthDays");
+				if (repeatRule.monthDates) {
+						this.MonthDays = [];
+						//repeatRule.monthDates;
+						for( var i=0; i<repeatRule.monthDates.length; i++){
+							this.MonthDays.push(repeatRule.monthDates[i]-1);
+						}
+						////alert("repeatRule.monthDates" + repeatRule.monthDates + "this.MonthDays" + this.MonthDays);
+				}
+				
+				if (repeatRule.daysOfMonth) {
+					////alert("repeatRule.daysOfMonth = " + repeatRule.daysOfMonth[0].weekInMonth);
+					this.DaysOfMonth = new Array();
+					for (var a in repeatRule.daysOfMonth) {
+						var dayofmnt = new __sp_daysOfMonth_build(repeatRule.daysOfMonth[a]);
+						////alert(dayofmnt.Day);
+						////alert(dayofmnt.WeekNum);
+						(this.DaysOfMonth).push(dayofmnt);
+					}
+					
+    			}
+				
+			}	
+	}
+	catch(e){
+	////alert("exception");	
+	 __device_handle_exception (e, "__sp_calendar_addEntry_repeatRule: " + e);	
+	}
+}
+
+function __sp_calendar_entry(entry,str){
+  // //alert("entry.type" + entry.type);
+  try {
+  	if (entry.type) {
+		this.Type = entry.type;
+	}
+
+  	if (entry.id) {
+		this.id = entry.id;
+		if(isUpdate)
+		{
+			if (entry.time) {
+				if (entry.time.begin) {
+					this.StartTime = entry.time.begin;
+				}
+				if (entry.time.end) {
+					this.EndTime = entry.time.end;
+				}
+			}
+		}
+	}
+	
+	if (entry.instanceStartTime) {
+		this.InstanceStartTime = entry.instanceStartTime;
+	}
+
+  	if (entry.description ) {
+		this.Description = entry.description;
+	}
+	else if(isUpdate && (entry.description == null)){
+		this.Description = " ";
+	}
+	
+  	if (entry.summary) {
+		this.Summary = entry.summary;
+	}
+	else if(isUpdate && (entry.summary == null)){
+		this.Summary = " ";
+	}
+	
+  	if (entry.location) {
+		this.Location = entry.location;
+	}
+	else if(isUpdate && (entry.location == null))
+	{
+		this.Location = " ";
+	}
+	
+	if (entry.priority) {
+		if ((entry.priority < 0) || (entry.priority > 255)) {
+			throw new DeviceException( this.error.INVALID_ARG_ERR, "Calendar: "+str+" Priority is Invalid");
+		}
+		else {
+			this.Priority = entry.priority;
+		}
+	}
+	else if(isUpdate && (entry.priority == null))
+	{
+		this.Priority = 0;
+	}
+	
+	if (entry.status) {
+		if (this.Type == "ToDo") {
+			this.Status = "Todo"+entry.status;
+		}
+		else {
+			this.Status = entry.status;
+		}
+	}
+	else if(isUpdate && (entry.status == null))
+	{
+		this.Status = "Tentative";
+		//////alert("status****" + this.Status);
+	}
+	
+	if (entry.exceptionDates) {
+		this.ExDates = entry.exceptionDates;
+	}
+	if(entry.repeatRule){
+			this.RepeatRule = new __sp_calendar_addEntry_repeatRule(entry.repeatRule,str);
+			
+		}
+	
+	if (entry.type != undefined && entry.type != null) {
+		////alert("7857465988");
+		if (typeof this.Type != "string") {
+			//	////alert("Type is not a string");
+			throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: " + str + " Type is not a string");
+		}
+		switch (this.Type) {
+			case "Meeting":
+				if (entry.time) {
+					if (entry.time.begin) {
+						this.StartTime = entry.time.begin;
+						////alert("this.StartTime" + this.StartTime);
+					}
+					if (entry.time.end) {
+						this.EndTime = entry.time.end;
+					}
+				}
+				break;
+			case "Reminder":
+			case "Anniversary":
+				if (entry.time) {
+					if (entry.time.begin) {
+						this.StartTime = entry.time.begin;
+					}
+				}
+				break;
+			case "ToDo":
+				if (entry.time) {
+					if (entry.time.end) {
+						this.EndTime = entry.time.end;
+					}
+				}
+				break;
+			case "DayEvent":
+				if (entry.time) {
+					if (entry.time.begin) {
+						this.StartTime = entry.time.begin;
+					}
+				}
+				break;
+			default:
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: " + str + " Type is Invalid");
+		}
+	}
+	
+	if (entry.time) {
+		if (entry.time.alarm) {
+			this.AlarmTime = entry.time.alarm;
+		}
+	}
+	
+	
+ }
+  catch (e) {
+  		//alert("*****out");
+    __device_handle_exception (e, "__sp_calendar_entry: " + e);
+
+  } 
+}
+
+/* ------ Wrap sp iterator ------- */
+
+function __sp_calendar_iterator_get_next(){
+	//////alert("in get next");
+  var sp_entry = this.iter.getNext();
+ // ////alert("after calling sapi getlist");
+ // ////alert("output of get next"+sp_entry.StartTime);
+ // ////alert("type of output of get next"+typeof sp_entry);
+  if(typeof sp_entry == "undefined"){
+  //	////alert("return null");
+    return null;
+  }
+  var calEntry = new __sp_device_calendar_entry(sp_entry);
+  sp_entry.close();
+  //////alert("return cal entry");
+  return calEntry;
+}
+
+function __sp_calendar_iterator(js_iterator){
+ // ////alert("in iter");	
+  this.iter = js_iterator;
+  this.next = __sp_calendar_iterator_get_next;
+  this.close = function(){
+		this.iter.close();
+	};
+}
+
+/* --------- Public methods ---------- */
+var /*const causes rhino to fail */ CALENDAR_APP_ID = 0x10005901;
+
+// Apps should take care that this is not reinvoked
+// while the editor is already running. 
+
+function __sp_calendar_startEditor(editor_cb, entry, err_cb){
+  try {
+  	if (!editor_cb) {
+  		//MissingArgument error "callback not passed";
+		throw new DeviceException( this.error.MISSING_ARG_ERR, "Calendar: startEditor: callback is missing");
+	   }
+	else if (typeof editor_cb != "function") //here we check if the type of callback is function. This case is useful when arbitrary values are passed to callback
+		{
+		  //BadArgumentType error
+		  throw new DeviceException( this.error.INVALID_ARG_ERR, "Calendar: startEditor: callback is invalid");
+		}
+	if(err_cb)
+	{ 
+		if(typeof err_cb != 'function')
+		{
+		   	throw new DeviceException( this.error.INVALID_ARG_ERR, "Calendar: startEditor: error callback is invalid");
+		}
+	}
+	if(entry == null || entry == undefined)
+	{
+		throw new DeviceException( this.error.INVALID_ARG_ERR, "Calendar: startEditor: entry is invalid");
+	}
+	var finished = function(arg1, arg2, arg3){
+	
+	
+	var iter = null;
+	editor_cb(iter);
+	if (arg2 != event_cancelled) {
+		var iter = null;
+		if (arg3.ReturnValue) {
+			iter = new __sp_calendar_iterator(arg3.ReturnValue);
+		}
+		editor_cb(iter);
+	}		
+	
+	if (arg3.ErrorCode != 0) {
+		switch( arg3.ErrorCode )
+			{
+			 case this.error.MISSING_ARG_ERR :
+			 case this.error.INVALID_ARG_ERR :
+			 case this.error.NOT_SUPPORTED_ERR :
+				if(arg3.ErrorMessage) 
+					{
+					var err_msg = splitErrorMessage(arg3.ErrorMessage); 	
+					throw new DeviceException( MapErrorCode[arg3.ErrorCode], "Calendar: startEditor: "+err_msg);
+					}
+				else
+					{
+					throw new DeviceException( MapErrorCode[arg3.ErrorCode], "Calendar: startEditor: Operation Failed");	
+					}
+				break;
+
+			default:
+				err_cb(new DeviceException( MapErrorCode[arg3.ErrorCode], "Calendar: startEditor: Operation Failed"));
+				 }
+	   }
+	
+	};
+	//For some reason, calendar is unable to parse command line
+	__s60_start_and_wait(CALENDAR_APP_ID, '', finished);
+	return 0;
+	}
+   catch (e) {
+    __device_handle_exception (e, "__sp_calendar_startEditor: " + e);
+  } 
+}
+
+var /*const causes rhino to fail */ __sp_calendar_entry_types = "MeetingReminderToDoAnniversaryDayEvent";
+
+function __sp_calendar_getList_cb(arg1, arg2, arg3) {
+
+	var CbObj;
+	var calendar_cb;
+	var err_cb;
+	
+	CbObj = glob_obj.getFromArray(arg1);
+			
+	 
+	if (CbObj) {
+		calendar_cb = CbObj.success_cb;
+		err_cb = CbObj.error_cb;
+	}
+	 
+	else{
+		alert( "Calendar: __sp_calendar_getList_cb: Callback not found ");
+		return;
+	}
+	
+	
+	//arg3.ErrorCode = DATA_OUT_OF_RANGE_ERR;
+	//////alert("err"+arg3.ErrorCode);
+	if(arg3.ErrorCode != 0)
+	{
+	//	////alert("before calling errcbk" + arg3.ErrorCode);
+		err_cb(new DeviceException( arg3.ErrorCode, "Calendar: getList: Operation Failed"));
+		return;
+	}	
+   //__device_debug("Calendar callback invoker");
+   // arg1 --> transacation Id
+   // arg2 --> Error code
+   // iter --> return object as per the domain
+   if (arg2 != event_cancelled) {
+   	  
+	   	var iter = null;
+	   	if (arg3.ReturnValue) {
+	   		iter = new __sp_calendar_iterator(arg3.ReturnValue);
+			}
+		   	calendar_cb(iter);
+		}	
+	glob_obj.removeFromArray(arg1);
+    }
+
+function __sp_calendar_getList(calendar_cb, match, err_cb){
+
+//	////alert("in getlist");
+	
+    try {
+  	if(match)
+	{
+  		if(typeof match != "object")
+		{
+			throw new DeviceException( this.error.INVALID_ARG_ERR, "Calendar: getList: match is invalid");
+		}
+		if (match.id) {
+			dataGetList = 1;
+			if (typeof match.id != "string") {
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: getList: match is invalid");
+			}
+		}
+		else
+		{
+			dataGetList = 0;
+		}
+	}
+ 	
+  	if(!calendar_cb)
+  	{
+  		//MissingArgument error "callback not passed";
+		throw new DeviceException( this.error.MISSING_ARG_ERR, "Calendar: getList: callback is missing");
+  	}
+  	else if(typeof calendar_cb != "function")	//here we check if the type of callback is function. This case is useful when arbitrary values are passed to callback
+  	{
+  		//BadArgumentType error
+		throw new DeviceException( this.error.INVALID_ARG_ERR, "Calendar: getList: callback is invalid");
+  	}
+	if(err_cb)
+	{ 
+		//////alert("(inside)type of err_cb" + typeof err_cb);
+		if(typeof err_cb != "function")
+		{
+	//		////alert("not func");
+		   	throw new DeviceException( this.error.INVALID_ARG_ERR, "Calendar: getList: error callback is invalid");
+		}
+		if( err_cb == undefined || err_cb == null)
+		{	
+			//alert("333");
+			throw new DeviceException( this.error.MISSING_ARG_ERR, "Calendar: getList: error callback is missing");
+		}
+	}
+	
+
+  
+
+    // Note: sp bug requires filter values of some kind
+    var filter = {}; 
+	modifyObjectBaseProp(filter);
+    filter.Type = "IncludeAll";
+    if(match)
+	{
+	  if(match.id){
+		filter.id = match.id;
+      }
+      if((match.type) && __sp_calendar_entry_types.match(match.type)){
+		filter.Type = match.type;
+      }
+	  else if((match.type) && typeof match.type != "string")
+	  {
+	  	 throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: getList: match is invalid");
+	  }
+      if(match.range){
+		if(match.range.begin){
+			if (typeof(match.range.begin) != "object") {
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: getList: match is invalid");
+			}
+			else if((match.range.begin) == "Invalid Date"){
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: getList: match is invalid");
+			}
+			else{
+				filter.StartRange = match.range.begin;
+			}
+		}
+        if(match.range.end){
+			if (typeof(match.range.end) != "object") {
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: getList: match is invalid");
+			}
+			else if((match.range.end) == "Invalid Date"){
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: getList: match is invalid");
+			}
+			else{
+				filter.EndRange = match.range.end;
+			}
+		}
+		if((match.range.begin) && (match.range.end)){
+			if((match.range.begin) > (match.range.end))
+			{
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: getList: match is invalid");
+			}
+		}
+			
+      }
+      if(match.text){
+	  	if (typeof(match.text) != "string") {
+			throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: getList: match is invalid");
+		}
+		else {
+			filter.SearchText = match.text;
+		}
+      }
+    }
+//	////alert("filter.StartRange" + filter.StartRange);
+//	////alert("filter.EndRange" + filter.EndRange);
+    var criteria = {};
+	modifyObjectBaseProp(criteria);
+    criteria.Type = "CalendarEntry";
+    criteria.Filter = filter;
+	temp_scb = calendar_cb;
+	temp_ecb = err_cb;
+//	////alert("1111");
+	var rval = this.so.IDataSource.GetList(criteria , this.getListCb );
+	if(rval.TransactionID){
+			glob_obj.addToGlobalArray(rval.TransactionID,calendar_cb,err_cb);
+		}
+//	////alert("2222*******");
+	if (criteria) {
+		delete criteria.Type;
+		delete criteria.Filter;
+	}
+//	////alert("rval.ErrorCode getlist" + rval.ErrorCode);
+    if(rval.ErrorCode != 0)
+		{
+			
+		switch( rval.ErrorCode )
+			{
+			 case this.error.MISSING_ARG_ERR :
+			 case this.error.INVALID_ARG_ERR :
+			 case this.error.NOT_SUPPORTED_ERR :
+			 	////alert("case NOT_SUPPORTED_ERR");
+				if(rval.ErrorMessage) 
+					{
+					var err_msg = splitErrorMessage(rval.ErrorMessage); 
+					//////alert("1111" + rval.ErrorMessage);	
+					throw new DeviceException( MapErrorCode[rval.ErrorCode], "Calendar: getList: "+err_msg);
+					
+					}
+				else
+					{
+					//////alert("2222" + rval.ErrorMessage);
+					throw new DeviceException( MapErrorCode[rval.ErrorCode], "Calendar: getList: Operation Failed");	
+					}
+				break;
+
+			default:
+			//	////alert("Calendar: getList: Operation Failed");
+				err_cb(new DeviceException( MapErrorCode[rval.ErrorCode], "Calendar: getList: Operation Failed"));
+				 }
+   		}
+	 return rval.TransactionID;
+  }
+  catch (e) {
+  	 //  ////alert("out");
+    __device_handle_exception (e, "sp_calendar_getList: " + e);
+  }  
+//////alert("out getlist");
+}
+
+function __sp_calendar_add(entry){
+	
+	
+	if(entry)
+	{
+		if(typeof entry != "object")
+		{
+			throw new DeviceException(this.error.INVALID_ARG_ERR, 'Calendar: addEntry: calendarEntry param is invalid');			
+		}
+	//	//alert("add entry1");
+		if(entry.id)
+		{
+			entry.id = undefined;
+		}
+	//	//alert("add entry2");
+		if(!entry.type || !entry.time)
+		{
+			throw new DeviceException(this.error.MISSING_ARG_ERR, "Calendar: addEntry: mandatory param missing");
+		}
+		else if(typeof entry.type != "string" || typeof entry.time != "object")
+		{
+			throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: addEntry: mandatory param missing");
+		}
+	//	//alert("add entry3");
+		if((entry.type != "ToDo") && !entry.time.begin )
+		{
+			throw new DeviceException(this.error.MISSING_ARG_ERR, "Calendar: addEntry: mandatory param StartTime missing");
+		}
+	//	//alert("add entry4");
+		if(!entry.time.end && (entry.type == "ToDo"  || entry.type == "Meeting"))
+		{
+			throw new DeviceException(this.error.MISSING_ARG_ERR, "Calendar: addEntry: mandatory param EndTime missing");
+		}
+	//	//alert("add entry5");
+		if(entry.time.end && entry.time.alarm)
+		{
+			if(entry.time.end < entry.time.alarm)
+			{
+				throw new DeviceException(this.error.NOT_SUPPORTED_ERR, "Calendar: addEntry: alarm time greater than end time:Not supported");
+			}
+		}
+		
+		if(entry.type == "ToDo"){
+			if(entry.status == 0) {
+				if (typeof(entry.status) != "string") {
+					throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: addEntry: mandatory param missing");
+				}
+			}
+		}
+		
+	//	//alert("add entry7");
+		if (entry.repeatRule) {
+			if(typeof entry.repeatRule != 'object')
+			{
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: addEntry: repeatRule param type is invalid");
+			}
+			
+			if (!entry.repeatRule.frequency || entry.repeatRule.frequency == null) 
+			{
+				throw new DeviceException(this.error.MISSING_ARG_ERR, "Calendar: addEntry: mandatory param Frequency missing");
+			}
+		}
+	
+		var isValid = __sp_calendar_isInputValid(entry);
+	//	//alert(isValid);
+	    	    
+	    if (!isValid) {	
+		//	////alert("returned false");    
+	        throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: addEntry: calendarEntry param is invalid");
+	    }
+	//	////alert("returned true");
+	}
+	else
+	{
+		throw new DeviceException(this.error.MISSING_ARG_ERR, "Calendar: addEntry: mandatory param missing");
+	}
+	
+  try{
+  	////alert("calendar_entry");
+  	var str = "addEntry:";
+    var criteria = {};
+	modifyObjectBaseProp(criteria);
+    criteria.Type = "CalendarEntry";
+    criteria.Item = new __sp_calendar_entry(entry,str);
+	
+ //   //alert("before add");
+	var result = this.so.IDataSource.Add(criteria);
+	//alert("result" + result.ErrorCode);
+	if (criteria) {
+		delete criteria.Type;
+		delete criteria.Item;
+	}
+	var err_msg = "Operation Failed";
+	if(result.ErrorMessage)
+	{
+	err_msg = splitErrorMessage(result.ErrorMessage); 	
+	}
+//	//alert(result.ErrorCode);
+    if (result.ErrorCode != 0) {
+			//alert("throwdeviceexptn" +result.ErrorCode);
+			throw new DeviceException( MapErrorCode[result.ErrorCode], "Calendar: addEntry: Operation Failed");	
+			return;
+		}
+	else {
+		var retVal = result.ReturnValue;
+		return retVal;
+	}
+//	////alert("addEntry");
+  }
+  catch(e){
+ // 	////alert("exception");
+    __device_handle_exception (e, "__sp_calendar_add: " + e);
+  }
+}
+
+function __sp_calendar_update(entry){
+	isUpdate = 1;
+	if(entry)
+		{
+			if(typeof entry != 'object')
+			{				
+				throw new DeviceException(this.error.INVALID_ARG_ERR, 'Calendar: updateEntry: calendarEntry param is invalid');			
+			}
+			if(!entry.id)
+			{
+				throw new DeviceException(this.error.MISSING_ARG_ERR, "Calendar: updateEntry: mandatory param - Id missing");
+			}	
+			if (entry.repeatRule) {
+				
+				if(typeof entry.repeatRule != 'object')
+				{
+					throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: updateEntry: repeatRule param type is invalid");
+				}
+				if(/*entry.repeatRule.frequency && */(entry.repeatRule.frequency == null || entry.repeatRule.frequency == undefined))
+				{
+					////alert("am here in repeatrule");
+					throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: updateEntry: repeatRule param type is invalid");
+				}
+				if(entry.repeatRule.startDate && (entry.repeatRule.startDate == null || entry.repeatRule.startDate == undefined))
+				{
+					throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: updateEntry: repeatRule param type is invalid");
+				}
+				if(entry.repeatRule.untilDate && (entry.repeatRule.untilDate == null || entry.repeatRule.untilDate == undefined))
+				{
+					throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: updateEntry: repeatRule param type is invalid");
+				}
+			}
+			if(entry.time)
+			{
+				if(entry.time.end && entry.time.alarm)
+				{
+					if(entry.time.alarm > entry.time.end)
+					{
+						throw new DeviceException(this.error.NOT_SUPPORTED_ERR, "Calendar: updateEntry: alarm time greater than end time is not supported");
+					}
+				}
+			}
+		    var isValid = __sp_calendar_isInputValid(entry);
+		//    //alert("isValid" + isValid);		    
+		    if (!isValid) {	    
+		        throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: updateEntry: calendarEntry param is invalid");
+		    }
+		}
+		
+		else
+		{
+			////alert("missing argument");
+			throw new DeviceException(this.error.MISSING_ARG_ERR, "Calendar: updateEntry: mandatory param missing");
+		}
+  try{
+  	//alert("update");
+  	var str = "updateEntry:";
+    var criteria = {};
+	modifyObjectBaseProp(criteria);
+    criteria.Type = "CalendarEntry";
+    criteria.Item = new __sp_calendar_entry(entry,str);
+	isUpdate = 0;
+//	//alert("am here in update entry");
+    var result = this.so.IDataSource.Add(criteria);
+//	//alert("result.ErrorCode" + result.ErrorCode);
+	if (criteria) {
+		delete criteria.Type;
+		delete criteria.Item;
+	}
+	var err_msg = "Operation Failed";
+	if(result.ErrorMessage)
+	{
+	err_msg = splitErrorMessage(result.ErrorMessage); 	
+	}
+    if (result.ErrorCode != 0) {
+			////alert("throwdeviceexptn" +result.ErrorCode);
+			throw new DeviceException( MapErrorCode[result.ErrorCode], "Calendar: addEntry: Operation Failed");	
+			return;
+		}
+	else {
+		var retVal = result.ReturnValue;
+		return retVal;
+   		}
+  }
+  catch(e){
+ // 	////alert("update exception" + e.message);
+    __device_handle_exception (e, "__sp_calendar_add: " + e);
+  }
+}
+
+function __sp_calendar_delete(data){
+
+//	////alert("in delete");
+  try{
+  	if(data)
+	{
+		if(typeof data != "object")
+		{
+			throw new DeviceException( this.error.INVALID_ARG_ERR, "Calendar: deleteEntry: data is invalid");
+		}
+		if (!data.id) 
+		{
+			throw new DeviceException( this.error.MISSING_ARG_ERR, "Calendar: deleteEntry: id is missing");
+		}
+		var isValid = __sp_calendar_isInputValid(data);
+	    
+	    if (!isValid) {      
+	        throw new DeviceException(this.error.INVALID_ARG_ERR, "Calendar: deleteEntry: delete data is invalid");
+	    }
+	}
+	else
+	{
+		throw new DeviceException( this.error.MISSING_ARG_ERR, "Calendar: deleteEntry: data is missing");
+	}
+	
+  	
+	
+    var criteria = {};
+	modifyObjectBaseProp(criteria);
+    criteria.Type = "CalendarEntry";
+    criteria.Data = {};
+	modifyObjectBaseProp(criteria.Data);
+    criteria.Data.IdList = [];
+	var list = [data.id];
+	//list  = data.id;       //new Array(data.id);
+	criteria.Data.IdList = list;
+	if (data.range) {
+		if (data.range.begin) {
+		criteria.Data.StartRange = data.range.begin;
+		}
+		if (data.range.end) {
+		criteria.Data.EndRange = data.range.end;
+		}
+	}	
+   var rval = this.so.IDataSource.Delete(criteria);
+ //  ////alert("rval.ErrorCode" + rval.ErrorCode);
+   if (criteria) {
+   	delete criteria.Type;
+	delete criteria.Data.IdList;
+	delete criteria.Data.StartRange;
+	delete criteria.Data.EndRange;
+   }
+   if (list) {
+   	delete list.id;
+   }
+   if(rval.ErrorCode != 0)
+	{
+		if(rval.ErrorMessage) 
+			{
+			var err_msg = splitErrorMessage(rval.ErrorMessage); 	
+			throw new DeviceException( MapErrorCode[rval.ErrorCode], "Calendar: deleteEntry: "+err_msg);
+			}
+		else
+			{
+			throw new DeviceException( MapErrorCode[rval.ErrorCode], "Calendar: deleteEntry: Operation Failed");	
+			}
+   	}
+  }
+  catch(e){
+ // 	////alert("exception");
+    __device_handle_exception (e, "__sp_calendar_delete: " + e);
+  }
+}
+
+function __sp_calendar_cancel(transactionId)
+{
+	try{
+    if (!transactionId || transactionId == null || transactionId == undefined) {
+		throw new DeviceException( this.error.MISSING_ARG_ERR, "Calendar: cancel: id is missing");//SErrMissingArgument = 1003  
+	}
+	if(transactionId)
+	{
+		if(typeof transactionId != "number" ){
+			throw new DeviceException( this.error.INVALID_ARG_ERR, "Calendar: cancel: id is missing");//SErrMissingArgument = 1003  
+		}
+	}
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+	criteria.TransactionID = transactionId;
+    var result = this.so.IDataSource.Cancel(criteria);
+	if(criteria){
+		delete criteria.TransactionID;
+	}
+	//alert("result.ErrorCode" + result.ErrorCode);
+   if(result.ErrorCode != 0)
+		{
+		if(result.ErrorMessage) 
+			{
+			var err_msg = splitErrorMessage(result.ErrorMessage); 	
+			throw new DeviceException( MapErrorCode[result.ErrorCode], "Calendar: cancel: "+err_msg);
+			}
+		else
+			{
+			throw new DeviceException( MapErrorCode[result.ErrorCode], "Calendar: cancel: Operation Failed");	
+			}
+   		}
+	}
+	catch(e){
+    __device_handle_exception (e, "__sp_calendar_cancel: " + e);		
+	}
+}
+
+function __sp_calendar_instance(){
+  //Descriptor
+  this.descriptor = new __sp_calendar_descriptor();
+  //Core methods
+  //////alert("startEditor");
+  this.startEditor = __sp_calendar_startEditor;
+  //Extended methods
+  this.getList = __sp_calendar_getList;
+  this.getListCb = __sp_calendar_getList_cb;
+    
+  this.addEntry = __sp_calendar_add;
+  this.updateEntry = __sp_calendar_update;
+  this.deleteEntry = __sp_calendar_delete;
+  this.cancel = __sp_calendar_cancel;
+  this.error = new DeviceException(0, "Dummy");
+  //Private data
+  this.so = null;
+  //Private methods
+  try {
+	this.so = device.getServiceObject("Service.Calendar", "IDataSource");
+	//////alert(so);
+    }
+  catch (e){
+    __device_handle_exception(e, "Calendar service not available");
+  }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceproviders/jsapi/platformservices/src/camera.js	Mon Jan 18 21:02:57 2010 +0200
@@ -0,0 +1,306 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Defination of class CCalendarInterface
+*
+*/
+
+function __device_camera_descriptor(provider){
+  this.interfaceName = provider.interfaceName;
+  this.version = provider.version;
+}
+
+//Why bother to define these methods? Because the camera
+//object defines the contract for providers!
+
+function __device_camera_startCamera(camera_cb, ErrorCallback){
+  return this.provider.startCamera(camera_cb, ErrorCallback);
+}
+
+function __device_camera_stopViewfinder(){
+  this.provider.stopViewfinder();
+}
+
+function __device_camera_takePicture(format){
+  this.provider.takePicture(format);
+}
+
+// Private camera  prototype: called from service factory
+function __device_camera(provider){
+  //Private properties
+  this.provider = provider;
+  //Read-only properties
+  this.interfaceName = provider.descriptor.interfaceName;
+  this.version = provider.descriptor.version;
+  this.supportedMediaTypes = provider.supportedMediaTypes;
+  this.supportedSizes = provider.supportedSizes;
+  //Core methods
+  this.startCamera = __device_camera_startCamera;
+  this.stopViewfinder = __device_camera_stopViewfinder;
+  //Extended methods
+  this.takePicture = __device_camera_takePicture;
+}
+
+// Camera service interface
+
+var __device_camera_service_entry =  {"name": null, 
+					 "version": null,
+					 "proto": __device_camera,
+					 "descriptor": __device_camera_descriptor,
+					 "providers": [{"descriptor": __sp_camera_descriptor, "instance": __sp_camera_instance}]
+					};
+
+
+
+
+
+/*
+Copyright © 2009 Nokia. All rights reserved.
+Code licensed under the BSD License:
+Software License Agreement (BSD License) Copyright © 2009 Nokia.
+All rights reserved.
+Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+Neither the name of Nokia Corporation. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Nokia Corporation. 
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+version: 1.0
+*/
+
+
+// S60 sp-based camera provider
+
+function __sp_camera_descriptor(){
+  //__device_debug("sp_camera_descriptor");
+  //Read-only properties
+  this.interfaceName = "camera";
+  if(window.__Service_Interface_Ver)
+	this.version =__Service_Interface_Ver;
+  else
+	this.version =1.0;
+  //Class-static properties 
+}
+
+// TBD make local to closure funcs
+var __sp_camera_start_date;
+
+var CAMERA_APP_ID = 0x101f857a;
+
+//Apps should take care that this is not reinvoked
+//while the viewfinder is running. 
+
+function __sp_startCamera(camera_cb, err_cb){
+	//If callback is null , then return missing argument error
+	
+
+
+    if (camera_cb == null) {
+		throw new DeviceException(this.error.MISSING_ARG_ERR, "Camera:startCamera:callback is missing");
+	}
+	//If the callback is not a function, then return bad type error
+	if(camera_cb == undefined)
+	{
+	throw new DeviceException(this.error.INVALID_ARG_ERR, "Camera:startCamera:callback is a non-function" );	
+	}
+	
+	if (typeof(camera_cb) != "function") {
+		throw new DeviceException(this.error.INVALID_ARG_ERR, "Camera:startCamera:callback is a non-function" );
+	}
+	
+	if(err_cb)
+	{ 
+
+		if(typeof err_cb != 'function')
+		{
+			
+		   	throw new DeviceException(this.error.INVALID_ARG_ERR, "Camera:startCamera:callback is invalid");
+		}
+		
+	}
+	
+  var finished = function (){
+    var invoker = function (arg1, arg2, arg3){    	
+      //__device_debug("invoker with: " + camera_cb);
+      var it = arg3.ReturnValue;
+      //arg3.ReturnValue.close();
+      var item;
+      var items = [];      
+      
+	  if(arg3.ErrorCode != 0)
+		{
+			
+			err_cb(new DeviceException(arg3.ErrorCode, "Camera:startCamera: Operation Failed"));
+			
+			return;
+		}	
+	
+ 	  
+      if (( item = it.getNext()) != undefined){
+          var d = new Date(Date.parse(item.FileDate));
+          //__device_debug(item.FileName + " " + d );
+          // Items returned in reverse date order, so stop iterating before
+          // reaching initial date. (Should be able to do this more efficiently
+          // with sp filter, but that doesn't seem to work right now.)
+          if (d > __sp_camera_start_date) {
+          	
+              var itemMap = {};
+	      	  modifyObjectBaseProp(itemMap);
+              var pathname = item.FileNameAndPath.replace(/\\/g, "/");
+              var fileScheme = "file:///";
+              //Non-patched builds don't allow file scheme TBD: change this for patched builds              
+              var fileUrl = "";
+              fileUrl = fileUrl.concat(fileScheme,pathname);
+              itemMap.uri = fileUrl;// url
+              
+              var formatMap = {};
+	      	   // modifyObjectBaseProp(formatMap);
+              //var stringTemp = "";
+              //stringTemp = stringTemp.concat(item.XPixels,"X",item.YPixels);
+              //formatMap.dimensions = stringTemp;
+              
+              formatMap.height = item.XPixels;
+              formatMap.width = item.YPixels;
+              
+              formatMap.type = item.MimeType;
+              
+              itemMap.format = formatMap;//format 
+                
+              items.unshift(itemMap); 
+			  if (formatMap) {
+			  	//delete formatMap.dimensions;
+				//delete formatMap.mtype;
+			  }
+		  }
+      
+	  }
+      var dummyTransID = 0;
+      var dummyStatusCode = 0;
+	   
+      camera_cb(items);
+    };
+	
+    //When camera returns, get the image(s) created
+    try {
+      var mso = device.getServiceObject("Service.MediaManagement", "IDataSource");
+    }
+    catch(e) {
+      __device_handle_exception (e, "media service not available : " + e);
+    }
+    
+    var criteria = {};
+	modifyObjectBaseProp(criteria);
+    criteria.Type = 'FileInfo';
+    criteria.Filter = {};
+	modifyObjectBaseProp(criteria.Filter);
+    criteria.Filter.FileType = 'Image';
+    //criteria.Filter.Key = 'FileDate';
+    //criteria.Filter.StartRange = null;
+    //criteria.Filter.EndRange = null;
+    criteria.Sort = {};
+	modifyObjectBaseProp(criteria.Sort);
+    criteria.Sort.Key = 'FileDate';
+    criteria.Sort.Order = 'Descending';
+    
+    try {
+      var rval = mso.IDataSource.GetList(criteria, invoker);
+    }
+    catch (error) {
+      __device_handle_exception (error, "media service GetList failed: " + error);
+    }
+  };
+
+  __sp_camera_start_date = new Date();
+  __s60_start_and_wait(CAMERA_APP_ID, "", finished);
+  var dummyTid = 0;
+  return dummyTid;
+}
+
+function __sp_supportedSizes() {
+    try {
+        var SysInfo = device.getServiceObject('Service.SysInfo', 'ISysInfo');
+    }
+    catch(e) {
+      __device_handle_exception (e, "SysInfo Service not available : " + e);
+    }
+    var sys_req = {};
+    modifyObjectBaseProp(sys_req);
+    sys_req.Entity = "Camera";
+    sys_req.Key = "CameraProperties";
+    //Get supported Sizes
+    try {
+        var rval = SysInfo.ISysInfo.GetInfo(sys_req);
+		if (sys_req) {
+			delete sys_req.Entity;
+			delete sys_req.Key;
+		}
+    }
+    catch (error) {
+        __device_handle_exception (error, "Camera : Failed to fetch supported size Info: " + error);
+    }
+    var returnValue = rval.ReturnValue;
+    var resolutionArray = [];
+    var supportedResolutions = [];
+    resolutionArray = returnValue.ResolutionList;
+    for(var i=0;i<resolutionArray.length;i++) {
+       var stringTemp ="";
+       stringTemp = stringTemp.concat(resolutionArray[i].height,"X",resolutionArray[i].width);
+       supportedResolutions.push(stringTemp);        
+    }
+    return supportedResolutions;
+}
+
+function __sp_supportedMediaTypes() {
+    try {
+        var SysInfo = device.getServiceObject('Service.SysInfo', 'ISysInfo');
+    }
+    catch(e) {
+      __device_handle_exception (e, "SysInfo Service not available : " + e);
+    }
+    var sys_req = {};
+    modifyObjectBaseProp(sys_req);
+    sys_req.Entity = "Camera";
+    sys_req.Key = "CameraProperties";
+    //Get supported Media Types
+    try {
+        var rval = SysInfo.ISysInfo.GetInfo(sys_req);
+		if (sys_req) {
+			delete sys_req.Entity;
+			delete sys_req.Key;
+		}
+    }
+    catch (error) {
+        __device_handle_exception (error, "Camera :Failed to fetch supported media type Info: " + error);
+    }
+    var returnValue = rval.ReturnValue;
+    var supportedMimeTypes = [];
+    supportedMimeTypes = returnValue.MimeTypeList;  
+    return supportedMimeTypes;
+}
+
+function __sp_camera_instance(){
+  //__device_debug("sp_camera_instance");
+  //Descriptor
+  this.descriptor = new __sp_camera_descriptor();
+  //Read-only properties
+  this.supportedMediaTypes =   __sp_supportedMediaTypes();
+  this.supportedSizes =  __sp_supportedSizes();
+  //Core methods
+  this.startCamera = __sp_startCamera;
+  this.stopViewfinder = __s60_api_not_supported;
+  //Extended methods
+  this.takePicture = __s60_api_not_supported;
+  this.error = new DeviceException(0, "Dummy");
+  //Private data
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceproviders/jsapi/platformservices/src/commlog.js	Mon Jan 18 21:02:57 2010 +0200
@@ -0,0 +1,754 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Defination of class CCalendarInterface
+*
+*/
+
+function __device_commlog_descriptor(provider){
+  this.interfaceName = provider.interfaceName;
+  this.version = provider.version;
+}
+
+function __device_commlog_getList(commlog_cb, match, ErrorCallback){
+  return this.provider.getList(commlog_cb, match, ErrorCallback);
+}
+
+function __device_commlog_setNotification(commlog_cb, ErrorCallback){
+  return this.provider.setNotification(commlog_cb, ErrorCallback);
+}
+
+function __device_commlog_cancelNotification( ){
+  return this.provider.cancelNotification( );
+}
+
+function __device_commlog_cancel( transactionId ){
+  return this.provider.cancel( transactionId );
+}
+
+function __device_commlog_deleteLogEntry( logId ){
+  return this.provider.deleteLogEntry( logId );
+}
+
+// Private location prototype: called from service factory
+function __device_commlog(provider){
+	//alert("in providere")
+  //Private properties
+  this.provider = provider;
+  //Read-only properties
+  this.interfaceName = provider.descriptor.interfaceName;
+  this.version = provider.descriptor.version;  
+  //Extended methods
+  this.getList = __device_commlog_getList;
+  this.setNotification = __device_commlog_setNotification;
+  this.cancelNotification = __device_commlog_cancelNotification;
+  this.cancel = __device_commlog_cancel;
+  this.deleteLogEntry = __device_commlog_deleteLogEntry;
+}
+
+// commlog service interface
+
+var __device_commlog_service_entry = {"name": null, 
+				      "version": null,
+				      "proto": __device_commlog,
+				      "descriptor": __device_commlog_descriptor,
+				      "providers": [{"descriptor": __sp_commlog_descriptor, "instance": __sp_commlog_instance}]
+				     };
+		
+
+
+
+/*
+ Copyright © 2009 Nokia. All rights reserved.
+ Code licensed under the BSD License:
+ Software License Agreement (BSD License) Copyright © 2009 Nokia.
+ All rights reserved.
+ Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ Neither the name of Nokia Corporation. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Nokia Corporation.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ version: 1.0
+ */
+var invoker_notification;
+//var error = new DeviceException(0, 'dummy');
+// S60 sp-based commlog provider
+
+
+
+function __sp_commlog_descriptor(){
+    //Read-only properties
+    this.interfaceName = "commlog";
+    if (window.__Service_Interface_Ver) 
+        this.version = __Service_Interface_Ver;
+    else 
+        this.version = 1.0;
+    //Class-static properties 
+}
+
+var __sp_commlog_type_constants = {
+    "call": 0,
+    "sms": 3
+};
+
+var __sp_commlog_constants = {
+    "received": 0, // Incoming received
+    "missed": 5, // Incoming missed
+    "outgoing": 1
+};
+
+var __sp_commlog_constants_output = {
+    "Received": 0, // Incoming received
+    "Missed": 5, // Incoming missed
+    "Outgoing": 1
+};
+
+/*
+ * Array holding Connection objects for setNotification
+ */
+var __notifArr = new Array();
+
+/*
+ * Counter to hold number of setNotification calls
+ */
+var __notifCount = 0;
+
+/*
+ * Object to hold connectionId and callback for setNotification
+ */
+__Notification.prototype = new Object();
+__Notification.prototype.constructor = __Notification;
+
+/*
+ * Constructor for Notification
+ */
+function __Notification(transactionId, callback){
+    this.connectionId = transactionId;
+    this.callback = callback;
+    
+}
+
+
+var __nofLogs;
+
+function __get_const_string(def, val){
+    var i;
+    for (i in def) {
+        if (def[i] == val) {
+            return i;
+        }
+    }
+    return null;
+}
+
+
+function __get_const_val(def, str){//alert(def+"  "+str);
+    if (def[str] != undefined) {
+        return def[str];
+    }
+    return null; //TBD: trow an exception on bad input
+}
+
+
+
+
+
+// All of the event fields should normally be filled in, so don't make the returned event sparse
+
+function __device_commlog_item(sp_commlog){
+    if (!sp_commlog) {
+        return null;
+    }
+    var evt = {};
+    evt.type = __get_const_string(__sp_commlog_type_constants, sp_commlog.EventType);
+    if (evt.type == null || evt.type == undefined) 
+        return null;
+    evt.phoneNumber = sp_commlog.PhoneNumber;
+    if (evt.phoneNumber == null || evt.phoneNumber == undefined || evt.phoneNumber.length == 0) 
+        evt.phoneNumber = "private number";
+    evt.time = sp_commlog.EventTime;
+    evt.flag = (sp_commlog.Direction == undefined) ? null : __get_const_string(__sp_commlog_constants_output, sp_commlog.Direction);
+    evt.summary = sp_commlog.Description;
+    evt.logId = Number(sp_commlog.id);
+    evt.contactName = sp_commlog.RemoteParty;
+    if (!evt.contactName) 
+        evt.contactName = evt.phoneNumber;
+    return evt;
+}
+
+/* ------ Wrap sp iterator ------- */
+function __sp_commlog_iterator_get_next(){
+    //__device_debug("sp_commlog_iterator_get_next");
+    //alert(__nofLogs);
+    if (typeof __nofLogs == "number") {
+        if (__nofLogs <= 0) {
+            return null;
+        }
+        __nofLogs = __nofLogs - 1;
+    }
+    
+    
+    if ((typeof this.buffer == "object") && (this.buffer != null)) {
+        var b1 = this.buffer;
+        this.buffer = null;
+        var rval1 = new __device_commlog_item(b1);
+        return rval1;
+    }
+    else {
+        var sp_commlog;
+        if (this.iter != undefined && this.iter != null) {
+            while (sp_commlog = this.iter.getNext()) {
+                if (sp_commlog.EventType == 0 || sp_commlog.EventType == 3) 
+                    break;
+            }
+        }
+        
+        if (typeof sp_commlog == "undefined") {
+            return null;
+        }
+        var rval = new __device_commlog_item(sp_commlog);
+        sp_commlog.close();
+        return rval;
+    }
+    
+    
+    // return sp_commlog;
+}
+
+function __sp_commlog_iterator_has_next(){
+    if (__nofLogs <= 0) 
+        return false;
+    
+    if (this.iter != undefined && this.iter != null) {
+        while (this.buffer = this.iter.getNext()) {
+            if (this.buffer.EventType == 0 || this.buffer.EventType == 3) 
+                break;
+        }
+        
+    }
+    
+    
+    if ((typeof this.buffer == "object") && (this.buffer != null)) {
+        return true;
+    }
+    else {
+        return false;
+    }
+}
+
+function __sp_commlog_iterator_close(){
+
+    this.iter.close();
+    
+    
+}
+
+function __sp_commlog_iterator(js_iterator){
+    this.iter = js_iterator;
+    this.buffer = null;
+    this.next = __sp_commlog_iterator_get_next;
+    this.hasNext = __sp_commlog_iterator_has_next;
+    this.close = __sp_commlog_iterator_close;
+    this.nofLogs = __nofLogs;
+    
+}
+
+function __sp_commlog_getList_cb(arg1, arg2, arg3){
+    var success_cb;
+    var error_cb;
+    var iter = null;
+    var err_msg = null;
+    
+    var CbObj;
+    
+    
+    CbObj = glob_obj.getFromArray(arg1);
+    
+    if (CbObj) {
+        success_cb = CbObj.success_cb;
+        error_cb = CbObj.error_cb;
+    }
+    
+    else {
+        alert("Commlog: __sp_commlog_getList_cb : Callback not found ");
+		return;
+    }
+    
+    
+    if (arg3.ErrorCode != 0) {
+    
+        if (arg3.ErrorMessage) {
+            err_msg = splitErrorMessage(arg3.ErrorMessage);
+        }
+        else {
+            err_msg = "operation failed";
+        }
+        
+        if (error_cb) {
+            setTimeout(function(){
+                error_cb(new DeviceException(MapErrorCode[arg3.ErrorCode], "Commlog: getList: " + err_msg));
+            }, 1000);
+            return;
+        }
+    }
+    else 
+        if (arg3.ReturnValue) {
+            iter = new __sp_commlog_iterator(arg3.ReturnValue);
+        }
+    
+    if (arg2 != event_cancelled) // 3 signifies eventcancelled 
+    {
+        success_cb(iter);
+    }
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_commlog_getList(commlog_success_cb, match, ErrorCallback){
+    //alert("in getlist");
+    
+    if (commlog_success_cb == null || commlog_success_cb == undefined) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "CommLog:getList:callback is Required");
+    }
+    
+    else 
+        if (typeof commlog_success_cb != "function") { //here we check if the type of callback is function. This case is useful when arbitrary values are passed to callback
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "CommLog:getList:Invalid Callback");
+        }
+    if (ErrorCallback) {
+        if (typeof(ErrorCallback) != 'function') {
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "CommLog: getList: ErrorCallback is invalid");
+        }
+    }
+    
+    if (match != null && match != undefined) {
+        if (typeof match != "object" || __device_typeof(match) == "Array") {
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "CommLog: getList: Match is not an object");
+        }
+        
+        if (match.type != null && match.type != undefined) {
+            if (typeof match.type != "string") {
+                throw new DeviceException(this.error.INVALID_ARG_ERR, "CommLog: getList: Type is not a string");
+            }
+        }
+        
+        if (match.flag != null && match.flag != undefined) {
+            if (typeof match.flag != "string") {
+                throw new DeviceException(this.error.INVALID_ARG_ERR, "CommLog: getList: Flag is not a string");
+            }
+            
+            if (match.type) {
+                if (match.type.toLowerCase() == "sms" && match.flag.toLowerCase() == "missed") {
+                    if (ErrorCallback) {
+						//alert("1111");
+						ErrorCallback(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "commlogs: getList: Missed is not supported for sms"));
+                        //setTimeout(function(){ErrorCallback(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "commlogs: getList: Missed is not supported for sms"));  }, 1000);
+                        return;
+                    }
+                    else {
+                        throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "commlogs: getList: Missed is not supported for sms");
+                        
+                    }
+                }
+            }
+        }
+        
+        if (match.nofLogs != null && match.nofLogs != undefined) {
+            if (typeof match.nofLogs != "number") {
+                throw new DeviceException(this.error.INVALID_ARG_ERR, "CommLog: getList: nofLogs is invalid");
+            }
+        }
+    }
+    //alert("after input validation");
+    try {
+        var criteria = {};
+        modifyObjectBaseProp(criteria);
+        criteria.Type = 'Log';
+        criteria.Filter = {};
+        modifyObjectBaseProp(criteria.Filter);
+        
+        if (match) {
+            //alert(match.type.toLowerCase());
+            if (match.type) { //Check it type is populated   	    
+                var typevalue;
+                typevalue = __get_const_val(__sp_commlog_type_constants, match.type.toLowerCase());
+                //alert(typevalue);
+                if (typevalue != undefined) {
+                    criteria.Filter.EventType = typevalue;
+                }
+                else {
+                    if (ErrorCallback) {
+						//alert("22222222222" +this.error.DATA_OUT_OF_RANGE_ERR);
+						ErrorCallback(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "CommLog: getList: Type is out of range"));
+                        //setTimeout(function(){   ErrorCallback(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "CommLog: getList: Type is out of range")); }, 1000);
+                        return;
+                    }
+                    else {
+                        throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "CommLog: getList: Type is out of range");
+                    }
+                }
+            }
+            
+            if (match.nofLogs != null && match.nofLogs != undefined) {
+                if ((match.nofLogs < 0) || (match.nofLogs != (match.nofLogs | 0))) {
+                    if (ErrorCallback) {
+						//alert("33333333333");
+						ErrorCallback(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "CommLog: getList: nofLogs is out of range"));
+                       // setTimeout(function(){ ErrorCallback(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "CommLog: getList: nofLogs is out of range"));                      }, 1000);
+                        return;
+                    }
+                    else {
+                        throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "CommLog: getList: nofLogs is out of range");
+                    }
+                }
+                __nofLogs = match.nofLogs;
+            }
+            if (match.flag) { //Check if flag is populated
+                var directionvalue;
+                directionvalue = __get_const_val(__sp_commlog_constants, match.flag.toLowerCase());
+                
+                if (directionvalue != undefined) {
+                    criteria.Filter.Direction = directionvalue;
+                }
+                else {
+                    if (ErrorCallback) {
+                        /*setTimeout(function(){
+							//alert("444444444444");
+                            ErrorCallback(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "CommLog: getList: Flag is out of range"));
+                        }, 1000);*/
+						ErrorCallback(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "CommLog: getList: Flag is out of range"));
+                    }
+                    else {
+                        throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "CommLog: getList: Flag is out of range");
+                    }
+                }
+            }
+            
+            if (match.phoneNumber != null && match.phoneNumber != undefined) {
+                if (match.phoneNumber != "") //Check if phone is populated
+                    criteria.Filter.PhoneNumber = match.phoneNumber;
+            }
+            
+            if (match.contactName != null && match.contactName != undefined) {
+                if (match.contactName != "") 
+                    criteria.Filter.RemoteParty = match.contactName;
+            }
+            
+            if (match.startTime != null && match.startTime != undefined) {
+                criteria.Filter.StartTime = match.startTime;
+            }
+            
+            if (match.endTime != null && match.endTime != undefined) {
+                criteria.Filter.EndTime = match.endTime;
+            }
+        }
+        
+        
+        temp_scb = commlog_success_cb;
+		temp_ecb = ErrorCallback;
+        var result = this.so.IDataSource.GetList(criteria, this.getListCb);
+        
+        if (result.TransactionID) {
+            glob_obj.addToGlobalArray(result.TransactionID, commlog_success_cb, ErrorCallback);
+        }
+        
+        if (criteria.Filter) {
+            delete criteria.Filter.Direction;
+            delete criteria.Filter.EventType;
+            delete criteria.Filter.PhoneNumber;
+        }
+        if (criteria) {
+            delete criteria.Filter;
+            delete criteria.Type;
+        }
+        
+        if (result.ErrorCode != 0) {
+            var err_msg = "operation failed";
+            if (result.ErrorMessage) {
+                err_msg = splitErrorMessage(result.ErrorMessage);
+            }
+            switch (MapErrorCode[result.ErrorCode]) {
+                case this.error.INVALID_ARG_ERR:
+                case this.error.MISSING_ARG_ERR:
+                case this.error.NOT_SUPPORTED_ERR:
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "CommLog:getList:" + err_msg);
+                    break;
+                    
+                default:
+                    if (ErrorCallback) {
+                    
+                        ErrorCallback(new DeviceException(MapErrorCode[result.ErrorCode], "CommLog:getList:" + err_msg));
+                        
+                        return;
+                    }
+                    else {
+                        throw new DeviceException(MapErrorCode[result.ErrorCode], "CommLog:getList:" + err_msg);
+                    }
+                    
+            }
+        }
+        //	//alert(result.TransactionID);
+        return result.TransactionID;
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_commlog_Input_validation: " + e);
+    }
+    
+    
+}
+
+function __sp_commlog_setNotification_cb(arg1, arg2, arg3){
+    var success_cb;
+    var error_cb;
+    var result = null;
+    //alert("arg3.ReturnValue  is "+arg3.ReturnValue+"  "+arg3.ErrorCode);
+    var CbObj;
+    
+    
+    CbObj = glob_obj.getFromArray(arg1);
+    
+    if (CbObj) {
+        success_cb = CbObj.success_cb;
+        error_cb = CbObj.error_cb;
+    }
+    
+    else {
+        alert("Commlog: __sp_commlog_setNotification_cb : Callback not found ");
+		return;
+    }
+    
+    if (arg3.ErrorCode != 0) {
+        if (arg3.ErrorMessage) {
+            err_msg = splitErrorMessage(arg3.ErrorMessage);
+        }
+        else {
+            err_msg = "operation failed";
+        }
+        
+        if (error_cb) {
+            error_cb(new DeviceException(MapErrorCode[arg3.ErrorCode], "CommLog: getList: " + err_msg));
+            return;
+        }
+    }
+    else 
+        if (arg3.ReturnValue) {//alert("in return value");
+            result = new __device_commlog_item(arg3.ReturnValue);
+        }
+    
+    if (arg2 != event_cancelled) // 3 signifies eventcancelled 
+    {//alert("in not event cancelled"+"  "+arg1 +"  "+ __notifArr[0].connectionId);
+        for (i in __notifArr) {
+            if (arg1 == __notifArr[i].connectionId) {
+                var found = __notifArr[i];
+                break;
+            }
+        }
+        //alert(found);
+        if (found) 
+            found.callback(result);
+    }
+	glob_obj.removeFromArray(arg1);
+}
+
+//TBD: implement these?
+
+function __sp_commlog_setNotification(successCallback, ErrorCallback){
+
+    if (!successCallback) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "CommLog:setNotification:callback is missing");
+    }
+    
+    if (typeof successCallback != "function") {
+        throw new DeviceException(this.error.INVALID_ARG_ERR, "CommLog:setNotification:callback is invalid");
+    }
+    
+    if (ErrorCallback) {
+        if (typeof(ErrorCallback) != 'function') {
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "CommLog: setNotification: ErrorCallback is invalid");
+        }
+    }
+    
+    
+    
+    for (i in __notifArr) {
+        var spliced = __notifArr[i];
+        __notifArr.splice(i, 1);
+        __notifCount = __notifArr.length;
+        
+        this.so.IDataSource.Cancel({
+            TransactionID: spliced.connectionId
+        });
+        break;
+    }
+    
+    
+    
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.Type = "Log";
+    criteria.Filter = {
+        DelayTime: 0
+    };
+    
+    temp_scb = successCallback;
+	temp_ecb = ErrorCallback;
+    var result = this.so.IDataSource.RequestNotification(criteria, this.setNotificationCb);
+    if (result.TransactionID) {
+        glob_obj.addToGlobalArray(result.TransactionID, successCallback, ErrorCallback);
+    }
+    //alert("after call");
+    __notifArr[__notifCount++] = new __Notification(result.TransactionID, successCallback);
+    //alert("after count");
+    if (criteria) {
+        delete criteria.Type;
+    }
+    
+    if (result.ErrorCode != 0) {
+        var err_msg = "operation failed";
+        if (result.ErrorMessage) {
+            err_msg = splitErrorMessage(result.ErrorMessage);
+        }
+        //alert(MapErrorCode[ result.ErrorCode ] );
+        switch (MapErrorCode[result.ErrorCode]) {
+            case this.error.INVALID_ARG_ERR:
+            case this.error.MISSING_ARG_ERR:
+            case this.error.NOT_SUPPORTED_ERR:
+                throw new DeviceException(MapErrorCode[result.ErrorCode], "CommLog:setNotification:" + err_msg);
+                break;
+                
+            default:
+                if (ErrorCallback) {
+                    setTimeout(function(){
+                        ErrorCallback(new DeviceException(MapErrorCode[result.ErrorCode], "CommLog:setNotification:" + err_msg));
+                    }, 1000);
+                }
+                else {
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "CommLog:setNotification:" + err_msg);
+                }
+                
+        }
+    }
+}
+
+function __sp_commlog_cancelNotification(){
+    //alert("in cancel notification");
+    
+    for (i in __notifArr) {//alert("in array");
+        if (__notifArr[i].connectionId) {
+            var spliced = __notifArr[i];
+            __notifArr.splice(i, 1);
+            __notifCount = __notifArr.length;
+            break;
+        }
+    }
+    if (spliced) {
+        var result = this.so.IDataSource.Cancel({
+            TransactionID: spliced.connectionId
+        });
+        
+        if (result.ErrorCode != 0) {
+            var err_msg = "operation failed";
+            if (result.ErrorMessage) {
+                err_msg = splitErrorMessage(result.ErrorMessage);
+            }
+            
+            //throw new DeviceException (MapErrorCode[ result.ErrorCode ],"CommLog:cancelNotification:" + err_msg );
+        }
+    }
+}
+
+function __sp_commlog_cancel(transactionId){//alert("in cancel");
+    if (!transactionId) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "CommLog:cancel:transactionId is missing");
+    }
+    
+    if (typeof transactionId != "number") {
+        throw new DeviceException(this.error.INVALID_ARG_ERR, "CommLog:cancel:transactionId is invalid");
+    }
+    
+    var result = this.so.IDataSource.Cancel({
+        TransactionID: transactionId
+    });
+    
+    if (result.ErrorCode != 0) {
+        var err_msg = "operation failed";
+        if (result.ErrorMessage) {
+            err_msg = splitErrorMessage(result.ErrorMessage);
+        }
+        
+        throw new DeviceException(MapErrorCode[result.ErrorCode], "CommLog:cancel:" + err_msg);
+    }
+}
+
+function __sp_commlog_deleteLogEntry(logId){
+
+    if (logId == null || logId == undefined) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "CommLog:deleteLogEntry:logId is missing");
+    }
+    
+    if (typeof logId != "number") {
+        throw new DeviceException(this.error.INVALID_ARG_ERR, "CommLog:deleteLogEntry:logId is invalid");
+    }
+    
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.Type = 'Log';
+    criteria.Data = {
+        id: logId.toString()
+    };
+    modifyObjectBaseProp(criteria.Data);
+    
+    var result = this.so.IDataSource.Delete(criteria);
+    
+    if (result.ErrorCode != 0) {
+        var err_msg = "operation failed";
+        if (result.ErrorMessage) {
+            err_msg = splitErrorMessage(result.ErrorMessage);
+        }
+        
+        throw new DeviceException(MapErrorCode[result.ErrorCode], "CommLog:deleteLogEntry:" + err_msg);
+    }
+}
+
+
+function __sp_commlog_instance(){
+    //alert("in instance");
+    
+    //Descriptor
+    this.descriptor = new __sp_commlog_descriptor();
+    
+    //Extended methods
+    this.getList = __sp_commlog_getList;
+    this.getListCb = __sp_commlog_getList_cb;
+    
+    this.setNotification = __sp_commlog_setNotification;
+	this.setNotificationCb = __sp_commlog_setNotification_cb;
+    
+    this.cancelNotification = __sp_commlog_cancelNotification;
+    
+    this.cancel = __sp_commlog_cancel;
+    
+    this.deleteLogEntry = __sp_commlog_deleteLogEntry;
+    this.error = new DeviceException(0, "Dummy");
+    //Private data
+    
+    try {
+        //__device_debug("Trying commlog service");
+        
+        this.so = device.getServiceObject('Service.Logging', 'IDataSource');
+        //__device_debug("Got commlog service object: ");    
+    } 
+    catch (e) {
+        this.so = null;
+        __device_handle_exception(e, "commlog service not available");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceproviders/jsapi/platformservices/src/contacts.js	Mon Jan 18 21:02:57 2010 +0200
@@ -0,0 +1,2385 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Defination of class CCalendarInterface
+*
+*/
+
+function __device_contacts_descriptor(provider){
+  this.interfaceName = provider.interfaceName;
+  this.version = provider.version;
+}
+
+function __device_contacts_startEditor(callback, contact, ErrorCallback){
+ return this.provider.startEditor(callback, contact, ErrorCallback);
+}
+
+function __device_contacts_getContacts(callback, match, sortOrder, ErrorCallback ){
+  return this.provider.getContacts(callback, match, sortOrder, ErrorCallback );
+}
+
+function __device_contacts_add(contact){
+  return this.provider.addContact(contact);
+}
+
+function __device_contacts_update(contact){
+  this.provider.updateContact(contact);
+}
+
+function __device_contacts_delete(id){
+  this.provider.deleteContacts(id);
+}
+
+function __device_contacts_getContactInfo(id){
+  return this.provider.getContactInfo(id);
+}
+function __device_contacts_addGroup(groupName){
+	return this.provider.addGroup(groupName);
+}
+
+function __device_contacts_getGroups(callback, ErrorCallback){
+    return this.provider.getGroups(callback, ErrorCallback);
+}
+
+function __device_contacts_deleteGroups(id){
+	this.provider.deleteGroups(id);
+}
+
+function __device_contacts_addContactsToGroup(groupId,id)
+{
+	this.provider.addContactsToGroup(groupId,id);
+}
+
+function __device_contacts_getContactIds(callback, match, sortOrder, ErrorCallback)
+{
+	return this.provider.getContactIds(callback, match, sortOrder, ErrorCallback);
+}
+
+function __device_contacts_getGroupIds(callback, ErrorCallback)
+{
+	return this.provider.getGroupIds(callback, ErrorCallback);
+}
+
+function __device_contacts_removeContactsFromGroup(groupId,id)
+{
+	this.provider.removeContactsFromGroup(groupId,id);
+}
+
+function __device_contacts_cancel(transactionId)
+{
+	this.provider.cancel(transactionId);
+}
+
+function __device_contacts_updateGroup(group)
+{
+	this.provider.updateGroup(group);
+}
+
+function __device_contacts_getGroupInfo(grpid)
+{
+	return this.provider.getGroupInfo(grpid);
+}
+
+// Private location prototype: called from service factory
+function __device_contacts(provider){
+//alert("inside ");
+  //Private properties
+  this.provider = provider;
+  //Read-only properties
+  this.interfaceName = provider.descriptor.interfaceName;
+  this.version = provider.descriptor.version;
+  
+    //constants
+  this.SORT_ASCENDING = 0;
+  this.SORT_DESCENDING = 1;
+  
+  //Core methods
+  this.startEditor = __device_contacts_startEditor;
+  //Extended methods
+  this.getContacts = __device_contacts_getContacts;
+  this.addContact = __device_contacts_add;
+  this.updateContact = __device_contacts_update;
+  this.deleteContacts = __device_contacts_delete;
+  this.getContactInfo = __device_contacts_getContactInfo;
+  this.addGroup = __device_contacts_addGroup;
+  this.getGroups = __device_contacts_getGroups;
+  this.deleteGroups = __device_contacts_deleteGroups;
+  this.addContactsToGroup = __device_contacts_addContactsToGroup;
+  this.getContactIds = __device_contacts_getContactIds;
+  this.getGroupIds = __device_contacts_getGroupIds;
+  this.removeContactsFromGroup = __device_contacts_removeContactsFromGroup;
+  this.cancel = __device_contacts_cancel;
+  this.updateGroup = __device_contacts_updateGroup;
+  this.getGroupInfo = __device_contacts_getGroupInfo;
+}
+
+// contacts service interface
+
+// Namepace: com.nokia.device.service
+
+var __device_contacts_service_entry = {"name": null, 
+					  "version": null,
+					  "proto": __device_contacts,
+					  "descriptor": __device_contacts_descriptor,
+					  "providers": [{"descriptor": __sp_contacts_descriptor, "instance": __sp_contacts_instance}]
+					 };
+		   
+		   
+		   
+		   
+		   
+		   
+		   
+
+
+
+
+
+
+
+
+
+
+
+/*
+ Copyright © 2009 Nokia. All rights reserved.
+ Code licensed under the BSD License:
+ Software License Agreement (BSD License) Copyright © 2009 Nokia.
+ All rights reserved.
+ Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ Neither the name of Nokia Corporation. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Nokia Corporation.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ version: 1.0
+ */
+// Table of user callbacks. These are "indexed" by transaction IDs.
+// These need to be global since the actual sp callback does
+// not have the location instance object in its scope chain
+
+/*
+ if((typeof (com.nokia.device.contacts) == 'undefined'))
+ {
+ com.nokia.device.contacts = {};
+ }*/
+nokia.device.contacts.SORT_ASCENDING = 0;
+nokia.device.contacts.SORT_DESCENDING = 1;
+
+
+//nokia.devive.
+//SORT_ASCENDING = 0;
+//SORT_DESCENDING = 1;
+
+function __sp_contacts_descriptor(){
+  //Read-only properties 
+   this.interfaceName = "contacts";
+  if(window.__Service_Interface_Ver){
+//	alert('in __sp_contacts_descriptor'+window.__Service_Interface_Ver);
+	this.version =__Service_Interface_Ver;
+	}
+  else{
+	this.version =1.0;
+	}
+  //Class-static properties 
+}
+
+
+/*--------- device<->sp mapping functions --------*/
+function __s60_enumerate_contact_object(object, namespace, func, param){
+    try {
+        var key;
+        for (key in object) {
+            var propname;
+            if (namespace) {
+                propname = namespace + "." + key;
+                
+            }
+            
+            else {
+                propname = key;
+            }
+            var value = object[key];
+            if (value instanceof Array) {
+                func(propname, value, param);
+            }
+            else 
+                if (value instanceof Date) {
+                    func(propname, value, param);
+                }
+                else 
+                    if (typeof value == "object") {
+                        __s60_enumerate_contact_object(value, propname, func, param);
+                    }
+                    else {
+                        func(propname, value, param);
+                    }
+        }
+    } 
+    
+    catch (e) {
+		throw e;
+		//alert("exception in __s60_enumerate_contact_object" + e.toString());
+    }
+}
+
+// Map from device contact to sp contact
+
+// TBD: labels need localization
+function __sp_contact_extract(name, value, sp_contact){
+    //__device_debug("sp_contact_extract: " + name + " " + value); 
+    switch (name) {
+        case "name.last":
+            sp_contact.LastName = {};
+            modifyObjectBaseProp(sp_contact.LastName);
+            sp_contact.LastName.Label = "Last name";
+            sp_contact.LastName.Value = value;
+            break;
+        case "name.first":
+            sp_contact.FirstName = {};
+            modifyObjectBaseProp(sp_contact.FirstName);
+            sp_contact.FirstName.Label = "First name";
+            sp_contact.FirstName.Value = value;
+            break;
+        case "name.middle":
+            sp_contact.MiddleName = {};
+            modifyObjectBaseProp(sp_contact.MiddleName);
+            sp_contact.MiddleName.Label = "Middle name";
+            sp_contact.MiddleName.Value = value;
+            break;
+        case "name.prefix":
+            sp_contact.Prefix = {};
+            modifyObjectBaseProp(sp_contact.Prefix);
+            sp_contact.Prefix.Label = "Prefix";
+            sp_contact.Prefix.Value = value;
+            break;
+        case "name.suffix":
+            sp_contact.Suffix = {};
+            modifyObjectBaseProp(sp_contact.Suffix);
+            sp_contact.Suffix.Label = "Suffix";
+            sp_contact.Suffix.Value = value;
+            break;
+        case "tel.land":
+            sp_contact.LandPhoneGen = {};
+            modifyObjectBaseProp(sp_contact.LandPhoneGen);
+            sp_contact.LandPhoneGen.Label = "Landline";
+            sp_contact.LandPhoneGen.Value = value;
+            break;
+        case "tel.mobile":
+            sp_contact.MobilePhoneGen = {};
+            modifyObjectBaseProp(sp_contact.MobilePhoneGen);
+            sp_contact.MobilePhoneGen.Label = "Mobile";
+            sp_contact.MobilePhoneGen.Value = value;
+            break;
+        case "tel.video":
+            sp_contact.VideoNumberGen = {};
+            modifyObjectBaseProp(sp_contact.VideoNumberGen);
+            sp_contact.VideoNumberGen.Label = "Video";
+            sp_contact.VideoNumberGen.Value = value;
+            break;
+        case "tel.fax":
+            sp_contact.FaxNumberGen = {};
+            modifyObjectBaseProp(sp_contact.FaxNumberGen);
+            sp_contact.FaxNumberGen.Label = "Fax";
+            sp_contact.FaxNumberGen.Value = value;
+            break;
+        case "tel.voip":
+		//alert("adding gen"+value);
+            sp_contact.VOIPGen = {};
+            modifyObjectBaseProp(sp_contact.VOIPGen);
+            sp_contact.VOIPGen.Label = "Voip";
+            sp_contact.VOIPGen.Value = value;
+            break;
+        case "tel.home.land":
+            sp_contact.LandPhoneHome = {};
+            modifyObjectBaseProp(sp_contact.LandPhoneHome);
+            sp_contact.LandPhoneHome.Label = "Home Landline";
+            sp_contact.LandPhoneHome.Value = value;
+            break;
+        case "tel.home.mobile":
+            sp_contact.MobilePhoneHome = {};
+            modifyObjectBaseProp(sp_contact.MobilePhoneHome);
+            sp_contact.MobilePhoneHome.Label = "Home Mobile";
+            sp_contact.MobilePhoneHome.Value = value;
+            break;
+        case "tel.home.video":
+            sp_contact.VideoNumberHome = {};
+            modifyObjectBaseProp(sp_contact.VideoNumberHome);
+            sp_contact.VideoNumberHome.Label = "Home Video";
+            sp_contact.VideoNumberHome.Value = value;
+            break;
+        case "tel.home.fax":
+            sp_contact.FaxNumberHome = {};
+            modifyObjectBaseProp(sp_contact.FaxNumberHome);
+            sp_contact.FaxNumberHome.Label = "Home Fax";
+            sp_contact.FaxNumberHome.Value = value;
+            break;
+        case "tel.home.voip":
+			//alert("adding home"+value);
+            sp_contact.VoipHome = {};
+            modifyObjectBaseProp(sp_contact.VoipHome);
+            sp_contact.VoipHome.Label = "Home Voip";
+            sp_contact.VoipHome.Value = value;
+            break;
+        case "tel.work.land":
+            sp_contact.LandPhoneWork = {};
+            modifyObjectBaseProp(sp_contact.LandPhoneWork);
+            sp_contact.LandPhoneWork.Label = "Work Landline";
+            sp_contact.LandPhoneWork.Value = value;
+            break;
+        case "tel.work.mobile":
+            sp_contact.MobilePhoneWork = {};
+            modifyObjectBaseProp(sp_contact.MobilePhoneWork);
+            sp_contact.MobilePhoneWork.Label = "Work Mobile";
+            sp_contact.MobilePhoneWork.Value = value;
+            break;
+        case "tel.work.video":
+            sp_contact.VideoNumberWork = {};
+            modifyObjectBaseProp(sp_contact.VideoNumberWork);
+            sp_contact.VideoNumberWork.Label = "Work Video";
+            sp_contact.VideoNumberWork.Value = value;
+            break;
+        case "tel.work.fax":
+            sp_contact.FaxNumberWork = {};
+            modifyObjectBaseProp(sp_contact.FaxNumberWork);
+            sp_contact.FaxNumberWork.Label = "Work Fax";
+            sp_contact.FaxNumberWork.Value = value;
+            break;
+        case "tel.work.voip":
+		//alert("adding work"+value);
+            sp_contact.VoipWork = {};
+            modifyObjectBaseProp(sp_contact.VoipWork);
+            sp_contact.VoipWork.Label = "Work Voip";
+            sp_contact.VoipWork.Value = value;
+            break;
+        case "address.street":
+            sp_contact.AddrStreetGen = {};
+            modifyObjectBaseProp(sp_contact.AddrStreetGen);
+            sp_contact.AddrStreetGen.Label = "Street Address";
+            sp_contact.AddrStreetGen.Value = value;
+            break;
+        case "address.local":
+            sp_contact.AddrLocalGen = {};
+            modifyObjectBaseProp(sp_contact.AddrLocalGen);
+            sp_contact.AddrLocalGen.Label = "City";
+            sp_contact.AddrLocalGen.Value = value;
+            break;
+        case "address.region":
+            sp_contact.AddrRegionGen = {};
+            modifyObjectBaseProp(sp_contact.AddrRegionGen);
+            sp_contact.AddrRegionGen.Label = "State/Province";
+            sp_contact.AddrRegionGen.Value = value;
+            break;
+        case "address.code":
+            sp_contact.AddrPostCodeGen = {};
+            modifyObjectBaseProp(sp_contact.AddrPostCodeGen);
+            sp_contact.AddrPostCodeGen.Label = "Postal code";
+            sp_contact.AddrPostCodeGen.Value = value;
+            break;
+        case "address.country":
+            sp_contact.AddrCountryGen = {};
+            modifyObjectBaseProp(sp_contact.AddrCountryGen);
+            sp_contact.AddrCountryGen.Label = "Country";
+            sp_contact.AddrCountryGen.Value = value;
+            break;
+        case "address.email":
+            sp_contact.EmailGen = {};
+            modifyObjectBaseProp(sp_contact.EmailGen);
+            sp_contact.EmailGen.Label = "EMail";
+            sp_contact.EmailGen.Value = value;
+            break;
+        case "address.uri":
+            sp_contact.URLGen = {};
+            modifyObjectBaseProp(sp_contact.URLGen);
+            sp_contact.URLGen.Label = "Website";
+            sp_contact.URLGen.Value = value;
+            break;
+        case "address.home.street":
+            sp_contact.AddrStreetHome = {};
+            modifyObjectBaseProp(sp_contact.AddrStreetHome);
+            sp_contact.AddrStreetHome.Label = "Home Address";
+            sp_contact.AddrStreetHome.Value = value;
+            break;
+        case "address.home.local":
+            sp_contact.AddrLocalHome = {};
+            modifyObjectBaseProp(sp_contact.AddrLocalHome);
+            sp_contact.AddrLocalHome.Label = "City";
+            sp_contact.AddrLocalHome.Value = value;
+            break;
+        case "address.home.region":
+            sp_contact.AddrRegionHome = {};
+            modifyObjectBaseProp(sp_contact.AddrRegionHome);
+            sp_contact.AddrRegionHome.Label = "State/Province";
+            sp_contact.AddrRegionHome.Value = value;
+            break;
+        case "address.home.code":
+            sp_contact.AddrPostCodeHome = {};
+            modifyObjectBaseProp(sp_contact.AddrPostCodeHome);
+            sp_contact.AddrPostCodeHome.Label = "Postal code";
+            sp_contact.AddrPostCodeHome.Value = value;
+            break;
+        case "address.home.country":
+            sp_contact.AddrCountryHome = {};
+            modifyObjectBaseProp(sp_contact.AddrCountryHome);
+            sp_contact.AddrCountryHome.Label = "Country";
+            sp_contact.AddrCountryHome.Value = value;
+            break;
+        case "address.home.email":
+            sp_contact.EmailHome = {};
+            modifyObjectBaseProp(sp_contact.EmailHome);
+            sp_contact.EmailHome.Label = "Home EMail";
+            sp_contact.EmailHome.Value = value;
+            break;
+        case "address.home.uri":
+            sp_contact.URLHome = {};
+            modifyObjectBaseProp(sp_contact.URLHome);
+            sp_contact.URLHome.Label = "Home Website";
+            sp_contact.URLHome.Value = value;
+            break;
+        case "address.work.street":
+            sp_contact.AddrStreetWork = {};
+            modifyObjectBaseProp(sp_contact.AddrStreetWork);
+            sp_contact.AddrStreetWork.Label = "Work Address";
+            sp_contact.AddrStreetWork.Value = value;
+            break;
+        case "address.work.local":
+            sp_contact.AddrLocalWork = {};
+            modifyObjectBaseProp(sp_contact.AddrLocalWork);
+            sp_contact.AddrLocalWork.Label = "City";
+            sp_contact.AddrLocalWork.Value = value;
+            break;
+        case "address.work.region":
+            sp_contact.AddrRegionWork = {};
+            modifyObjectBaseProp(sp_contact.AddrRegionWork);
+            sp_contact.AddrRegionWork.Label = "State/Province";
+            sp_contact.AddrRegionWork.Value = value;
+            break;
+        case "address.work.code":
+            sp_contact.AddrPostCodeWork = {};
+            modifyObjectBaseProp(sp_contact.AddrPostCodeWork);
+            sp_contact.AddrPostCodeWork.Label = "Postal code";
+            sp_contact.AddrPostCodeWork.Value = value;
+            break;
+        case "address.work.country":
+            sp_contact.AddrCountryWork = {};
+            modifyObjectBaseProp(sp_contact.AddrCountryWork);
+            sp_contact.AddrCountryWork.Label = "Country";
+            sp_contact.AddrCountryWork.Value = value;
+            break;
+        case "address.work.email":
+            sp_contact.EmailWork = {};
+            modifyObjectBaseProp(sp_contact.EmailWork);
+            sp_contact.EmailWork.Label = "Work EMail";
+            sp_contact.EmailWork.Value = value;
+            break;
+        case "address.work.uri":
+            sp_contact.URLWork = {};
+            modifyObjectBaseProp(sp_contact.URLWork);
+            sp_contact.URLWork.Label = "Work Website";
+            sp_contact.URLWork.Value = value;
+            break;
+        case "company.name":
+            sp_contact.CompanyName = {};
+            modifyObjectBaseProp(sp_contact.CompanyName);
+            sp_contact.CompanyName.Label = "Company";
+            sp_contact.CompanyName.Value = value;
+            break;
+        case "company.title":
+            sp_contact.JobTitle = {};
+            modifyObjectBaseProp(sp_contact.JobTitle);
+            sp_contact.JobTitle.Label = "Title";
+            sp_contact.JobTitle.Value = value;
+            break;
+        case "id":
+            sp_contact.id = value;
+            break;
+        case "notes":
+            sp_contact.Note = {};
+            modifyObjectBaseProp(sp_contact.Note);
+            //sp_contact.Note = {};
+            sp_contact.Note.Label = "Note";
+            sp_contact.Note.Value = value;
+            break;
+        case "anniversary":
+            sp_contact.Anniversary = {};
+            modifyObjectBaseProp(sp_contact.Anniversary);
+            //sp_contact.Anniversary = {};
+            sp_contact.Anniversary.Label = "Anniversary";
+            sp_contact.Anniversary.Value = value;
+            break;
+        case "birthday":
+            sp_contact.Date = {};
+            modifyObjectBaseProp(sp_contact.Date);
+            //sp_contact.Date = {};
+            sp_contact.Date.Label = "BirthDay";
+            sp_contact.Date.Value = value;
+            break;
+        case "nickName":
+            sp_contact.SecondName = {};
+            modifyObjectBaseProp(sp_contact.SecondName);
+            //sp_contact.SecondName = {};
+            sp_contact.SecondName.Label = "NickName";
+            sp_contact.SecondName.Value = value;
+            break;
+        case "photo":
+            sp_contact.CallerObjImg = {};
+            modifyObjectBaseProp(sp_contact.CallerObjImg);
+            //sp_contact.CallerObjImg = {};
+            sp_contact.CallerObjImg.Label = "CallerObjImg";
+            sp_contact.CallerObjImg.Value = value;
+            break;
+        case "xspid":
+            sp_contact.IMPP = {};
+            modifyObjectBaseProp(sp_contact.IMPP);
+            //sp_contact.IMPP = {};
+            sp_contact.IMPP.Label = "IMPP";
+            sp_contact.IMPP.Value = value;
+            break;
+            
+    }
+}
+
+function __s60_enumerate_build_contact_object(object, namespace, func, param){
+	//alert("In __s60_enumerate_build_contact_object");
+    var key;
+    for (key in object) {
+        //if (object.hasOwnProperty('key')) {
+        var propname;
+        if (namespace) {
+            propname = namespace + "." + key;
+        }
+        else {
+            propname = key;
+        }
+        var value = object[key];
+        //alert("propname"+propname);
+        if (propname == "IMPP") {
+            //	   //alert("val"+value[0]);
+            func(propname, value, param);
+        }
+        if (typeof value == "object") {
+            /*	if(value instanceof Array)
+             {
+             func(propname,value, param);
+             }
+             else
+             {*/
+            __s60_enumerate_build_contact_object(value, propname, func, param);
+            //}
+        }
+        else {
+            func(propname, value, param);
+        }
+    }
+    //}
+}
+
+//Map from sp contact to device contact
+
+
+
+function __sp_device_contact_extract(name, value, contact){
+	
+    if (name == "id") {
+        contact.id = value;
+        return;
+    }
+    
+    // We only care about the Value fields
+    if (!name.match(".Value")) {
+        return;
+    }
+    //__device_debug("sp_device_contact_extract: " + name + ": " + value);
+    
+    try {
+        if (name.match("IMPP.Value.0")) {
+            contact.xspid = [];
+        }
+        if (name.match("Name")) {
+            if (name.match("CompanyName")) {
+                if (!contact.company) {
+                    contact.company = {};
+                }
+            }
+            else 
+                if (!contact.name) {
+                    contact.name = {};
+                }
+        }
+        else 
+            if (name.match("Phone") || name.match("Number") || name.match("VOIP") || name.match("Voip")) {
+                if (!contact.tel) {
+                    contact.tel = {};
+                }
+                if (name.match("Home")) {
+                    if (!contact.tel.home) {
+                        contact.tel.home = {};
+                    }
+                }
+                else 
+                    if (name.match("Work")) {
+                        if (!contact.tel.work) {
+                            contact.tel.work = {};
+                        }
+                    }
+            }
+            else 
+                if (name.match("Addr") || name.match("Email") || name.match("URL")) {
+                    if (!contact.address) {
+                        contact.address = {};
+                    }
+                    if (name.match("Home")) {
+                        if (!contact.address.home) {
+                            contact.address.home = {};
+                        }
+                    }
+                    else 
+                        if (name.match("Work")) {
+                            if (!contact.address.work) {
+                                contact.address.work = {};
+                            }
+                        }
+                }
+                else 
+                    if (name.match("JobTitle")) {
+                        if (!contact.company) {
+                            contact.company = {};
+                        }
+                    }
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_device_contact_extract: " + e);
+    }
+    if (name.match("IMPP.Value")) {
+        var splitstr = name.split(".");
+        var index = splitstr[2];
+        if (index != undefined) {
+            contact.xspid[splitstr[2]] = value;
+            //alert("after assigning" + contact.xspid[splitstr[2]]);
+            return;
+        }
+    }
+    switch (name) {
+        case "LastName.Value":
+            contact.name.last = value;
+            break;
+        case "FirstName.Value":
+            contact.name.first = value;
+            break;
+        case "MiddleName.Value":
+            contact.name.middle = value;
+            break;
+        case "Prefix.Value":
+            contact.name.prefix = value;
+            break;
+        case "Suffix.Value":
+            contact.name.suffix = value;
+            break;
+        case "LandPhoneGen.Value":
+            contact.tel.land = value;
+            break;
+        case "MobilePhoneGen.Value":
+            contact.tel.mobile = value;
+            break;
+        case "VideoNumberGen.Value":
+            contact.tel.video = value;
+            break;
+        case "FaxNumberGen.Value":
+            contact.tel.fax = value;
+            break;
+        case "VOIPGen.Value":
+		//alert(" voip gen= "+value);
+            contact.tel.voip = value;
+            break;
+        case "LandPhoneHome.Value":
+            contact.tel.home.land = value;
+            break;
+        case "MobilePhoneHome.Value":
+            contact.tel.home.mobile = value;
+            break;
+        case "VideoNumberHome.Value":
+            contact.tel.home.video = value;
+            break;
+        case "FaxNumberHome.Value":
+            contact.tel.home.fax = value;
+            break;
+        case "VoipHome.Value":
+			//alert(" voip home Value = "+value);
+            contact.tel.home.voip = value;
+            break;
+        case "LandPhoneWork.Value":
+            contact.tel.work.land = value;
+            break;
+        case "MobilePhoneWork.Value":
+            contact.tel.work.mobile = value;
+            break;
+        case "VideoNumberWork.Value":
+            contact.tel.work.video = value;
+            break;
+        case "FaxNumberWork.Value":
+            contact.tel.work.fax = value;
+            break;
+        case "VoipWork.Value":
+		//alert(" voip work= "+value);
+            contact.tel.work.voip = value;
+            break;
+        case "AddrStreetGen.Value":
+            contact.address.street = value;
+            break;
+        case "AddrLocalGen.Value":
+            contact.address.local = value;
+            break;
+        case "AddrRegionGen.Value":
+            contact.address.region = value;
+            break;
+        case "AddrPostCodeGen.Value":
+            contact.address.code = value;
+            break;
+        case "AddrCountryGen.Value":
+            contact.address.country = value;
+            break;
+        case "EmailGen.Value":
+            contact.address.email = value;
+            break;
+        case "URLGen.Value":
+            contact.address.uri = value;
+            break;
+        case "AddrStreetHome.Value":
+            contact.address.home.street = value;
+            break;
+        case "AddrLocalHome.Value":
+            contact.address.home.local = value;
+            break;
+        case "AddrRegionHome.Value":
+            contact.address.home.region = value;
+            break;
+        case "AddrPostCodeHome.Value":
+            contact.address.home.code = value;
+            break;
+        case "AddrCountryHome.Value":
+            contact.address.home.country = value;
+            break;
+        case "EmailHome.Value":
+            contact.address.home.email = value;
+            break;
+        case "URLHome.Value":
+            contact.address.home.uri = value;
+            break;
+        case "AddrStreetWork.Value":
+            contact.address.work.street = value;
+            break;
+        case "AddrLocalWork.Value":
+            contact.address.work.local = value;
+            break;
+        case "AddrRegionWork.Value":
+            contact.address.work.region = value;
+            break;
+        case "AddrPostCodeWork.Value":
+            contact.address.work.code = value;
+            break;
+        case "AddrCountryWork.Value":
+            contact.address.work.country = value;
+            break;
+        case "EmailWork.Value":
+            contact.address.work.email = value;
+            break;
+        case "URLWork.Value":
+            contact.address.work.uri = value;
+            break;
+        case "CompanyName.Value":
+            contact.company.name = value;
+            break;
+        case "JobTitle.Value":
+            contact.company.title = value;
+            break;
+        case "Note.Value":
+            contact.notes = value;
+            break;
+        case "Anniversary.Value":
+            contact.anniversary = value;
+            break;
+        case "Date.Value":
+            contact.birthday = value;
+            break;
+        case "SecondName.Value":
+            //alert("nickname value"+value);
+            contact.nickName = value;
+            //alert("after assigning"+contact.nickName);
+            break;
+        case "CallerObjImg.Value":
+            contact.photo = value;
+            break;
+            
+        default:
+        //__device_debug("Default: " + value );
+    }
+}
+
+function __sp_device_contact_build(sp_contact, contact){
+	//alert("In __sp_device_contact_build");
+    __s60_enumerate_build_contact_object(sp_contact, null, __sp_device_contact_extract, contact);
+	//alert("After __s60_enumerate_build_contact_object");
+}
+
+/* ------ Wrap sp iterator ------- */
+function __sp_contact_iterator_get_next(){
+    //__device_debug("__sp_contact_iterator_get_next"); 
+	//alert("Before calling iter.getnext  "); 
+    var sp_contact = this.iter.getNext();
+	//alert("After calling iter.getnext  "); 
+    if (typeof sp_contact == "undefined") {
+		//alert("sp_contact == undefined  "); 
+        return null;
+    }	
+    var rval = {};	
+    __sp_device_contact_build(sp_contact, rval);	
+    sp_contact.close();	
+    return rval;
+}
+
+function __sp_contact_iterator(js_iterator){
+    this.iter = js_iterator;
+	//alert("before __sp_contact_iterator_get_next");
+    this.next = __sp_contact_iterator_get_next;
+	//alert("After __sp_contact_iterator_get_next ");
+    this.close = function(){
+        this.iter.close();
+    };
+}
+
+function __s60_enumerate_group_object(object, func, param){
+    var key;
+    for (key in object) {
+        //if (object.hasOwnProperty('key')) {
+        var propname = key;
+        var value = object[key];
+        func(propname, value, param);
+        //}
+    }
+}
+
+function __sp_device_groupinfo_extract(name, value, groupinfo){
+
+    if (groupinfo.group == undefined) {
+        groupinfo.group = {};
+    }
+    if (name == "id") {
+        groupinfo.group.groupId = value;
+    }
+    else 
+        if (name == "GroupLabel") {
+            groupinfo.group.groupName = value;
+        }
+        else 
+            if (name == "Contents") {
+                groupinfo.contents = value;
+            }
+    return;
+}
+
+function __sp_device_groupinfo_build(sp_group, groupinfo){
+    __s60_enumerate_group_object(sp_group, __sp_device_groupinfo_extract, groupinfo);
+}
+
+
+
+//Build group data
+function __sp_device_group_extract(name, value, group){
+    if (name == "id") {
+        group.groupId = value;
+        return;
+    }
+    if (name == "GroupLabel") {
+        group.groupName = value;
+        return;
+    }
+}
+
+function __sp_device_group_build(sp_group, group){
+    __s60_enumerate_object(sp_group, null, __sp_device_group_extract, group);
+}
+
+
+
+//Iterate the group data
+function __sp_group_iterator_get_next(){
+    var sp_group = this.iter.getNext();
+    if (typeof sp_group == "undefined") {
+        return null;
+    }
+    var rval = {};
+    __sp_device_group_build(sp_group, rval);
+    sp_group.close();
+    return rval;
+}
+
+function __sp_group_iterator(js_iterator){
+    this.iter = js_iterator;
+    this.next = __sp_group_iterator_get_next;
+    this.close = function(){
+        this.iter.close();
+    };
+}
+
+/* --------- Public methods ---------- */
+
+
+var CONTACTS_APP_ID = 0x101f4cce;
+
+// Apps should take care that this is not reinvoked
+// while the editor is already running. 
+
+function __sp_contacts_startEditor(editor_cb, contact, ErrorCallback){
+    if (!editor_cb) 
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: StartEditor:Missing Success Callback");
+    
+    if ((typeof editor_cb) != "function") 
+        throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: StartEditor:Invalid Success Callback");
+    
+    if ((contact) == null) 
+        contact = {};
+    
+    if ((typeof contact) == "undefined") 
+        contact = {};
+    
+    if ((contact) == undefined) 
+        contact = {};
+    
+    if ((typeof contact) != "object") {
+        throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: StartEditor:Invalid Contact Data");
+    }
+    
+    
+    if (ErrorCallback) 
+        if ((typeof ErrorCallback) != "function") 
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts :StartEditor:Invalid Error Callback");
+    
+    var finished = function(arg1, arg2, arg3){
+        var iter = null;
+        editor_cb(iter);
+        //editor_cb(arg1,arg2,arg3);
+    };
+    __s60_start_and_wait(CONTACTS_APP_ID, "", finished);
+    return 0; //This value is returned as the transaction id is not supported
+}
+
+// TBD: add support for match patterns
+function __sp_contacts_getContacts_cb(arg1, arg2, arg3){
+	//alert(" __sp_contacts_getContacts_cb");
+    var iter = null;
+    var contacts_cb;
+    var error_cb;
+    var CbObj;
+    
+    //alert(" before getFromArray");
+    CbObj = glob_obj.getFromArray(arg1);
+	//alert("after getFromArray");
+    
+    
+    if (CbObj) {
+		//alert(" before CbObj.success_cb");
+        contacts_cb = CbObj.success_cb;
+		//alert(" After CbObj.success_cb");
+        error_cb = CbObj.error_cb;
+		//alert(" After CbObj.error_cb");
+    }
+    
+    else {
+        alert("Contacts: __sp_contacts_getContacts_cb : Callback not found ");
+		return;
+    }
+    
+    if (arg3.ReturnValue) {
+        iter = new __sp_contact_iterator(arg3.ReturnValue);
+    }
+    else 
+        if (arg3.ErrorCode != 0) {
+            //alert(arg3.ErrorCode);
+            var err_msg;
+            if (arg3.ErrorMessage) 
+                err_msg = splitErrorMessage(arg3.ErrorMessage);
+            else 
+                err_msg = "Operation Failed";
+            
+            error_cb(new DeviceException(MapErrorCode[arg3.ErrorCode], "Contacts: getContacts: " + err_msg));
+            return;
+        }
+    contacts_cb(iter);
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_contacts_getContacts(contacts_cb, match, sortOrder, ErrorCallback){
+    //alert("__sp_contacts_getContacts");
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.Type = 'Contact';
+    if (match) {
+        criteria.Filter = {};
+        modifyObjectBaseProp(criteria.Filter);
+        criteria.Filter.SearchVal = match;
+        
+    }
+    
+    //if (sortOrder) {
+	if(sortOrder != null && sortOrder != undefined){		
+        criteria.Sort = {};
+        modifyObjectBaseProp(criteria.Sort);
+        if (typeof sortOrder == "number") {
+            if (sortOrder == this.SORT_ASCENDING) {
+                criteria.Sort.Order = "Ascending";
+            }
+            else 
+                if (sortOrder == this.SORT_DESCENDING) {
+                    criteria.Sort.Order = "Descending";
+                }
+                
+                
+                else {   
+						//alert(" In datanotfound");                
+					 ErrorCallback(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "Contacts: getContacts: invalid sortOrder input"));
+					 return;				
+                }
+        }
+        else {			
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: getContacts: invalid sortOrder input");
+        }
+    }
+    
+    try {
+    
+        if (!contacts_cb) {
+			//alert(" ! contacts_cb");
+            throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: getContacts: callback is missing");
+        }
+        else 
+            if (typeof contacts_cb != "function") {
+                throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: getContacts: callback is invalid");
+            }
+        if (ErrorCallback) {
+            if (typeof(ErrorCallback) != 'function') {
+                throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: getContacts: ErrorCallback is invalid");
+            }
+        }
+        
+			temp_scb = contacts_cb;
+			temp_ecb = ErrorCallback;
+        var rval = this.so.IDataSource.GetList(criteria, this.getContactsCb);
+        //alert(" errorcode = "+rval.ErrorCode);
+        if (rval.TransactionID) {
+			//alert(" if TransactionID ");
+            glob_obj.addToGlobalArray(rval.TransactionID, contacts_cb, ErrorCallback);
+        }
+        //alert("error code = "+rval.ErrorCode);	
+        if (criteria.Sort) {
+            delete criteria.Sort.Order;
+        }
+        if (criteria.Filter) {
+            delete criteria.Filter.SearchVal;
+        }
+        if (criteria) {
+            delete criteria.Type;
+            delete criteria.Filter;
+            delete criteria.Sort;
+        }
+        if (rval.ErrorCode != 0) {			
+            var doMap = mappingVerification(rval.ErrorCode);
+            var err_msg = null;
+            if (rval.ErrorMessage) {
+                err_msg = splitErrorMessage(rval.ErrorMessage);
+            }
+            if (doMap) {
+                switch (MapErrorCode[rval.ErrorCode]) {
+                    case this.error.MISSING_ARG_ERR:
+                    case this.error.INVALID_ARG_ERR:
+                    case this.error.NOT_SUPPORTED_ERR:  {						
+						if (err_msg) {
+							throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getContacts: " + err_msg);
+						}
+						else {
+							throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getContacts:Operation Failed");
+						}
+					}
+                        break;
+                    default:
+                        //contacts_cb(0, MapErrorCode[rval.ErrorCode],0);
+                        //contacts_cb(iter);
+                        if (ErrorCallback != undefined) {
+                            if (err_msg) {
+                                ErrorCallback(new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getContacts: " + err_msg));
+                            }
+                            else 
+                                ErrorCallback(new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getContacts:Operation Failed "));
+                        }
+                        else {
+                            if (err_msg) 
+                                throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getContacts: " + err_msg);
+                            else 
+                                throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getContacts:Operation Failed");
+                        }
+                }
+            }
+            else {
+                if (ErrorCallback != undefined) {
+                    if (err_msg) {
+                        ErrorCallback(new DeviceException(rval.ErrorCode, "Contacts: getContacts: " + err_msg));
+                    }
+                    else 
+                        ErrorCallback(new DeviceException(rval.ErrorCode, "getContacts:Operation Failed "));
+                }
+                else {
+                    if (err_msg) 
+                        throw new DeviceException(rval.ErrorCode, "Contacts: getContacts: " + err_msg);
+                    else 
+                        throw new DeviceException(rval.ErrorCode, "Contacts: getContacts:Operation Failed");
+                }
+            }
+        }
+        return rval.TransactionID;
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_contacts_getContacts: " + e);
+    }
+}
+
+function __sp_contacts_add(contact){
+	
+	if((contact) == null)
+			throw new DeviceException(this.error.MISSING_ARG_ERR, 'addContact:Contact Data Needed');
+			
+	if((typeof contact) == "undefined")
+		throw new DeviceException(this.error.MISSING_ARG_ERR, 'addContact:Contact Data Needed');
+		
+	if((contact) == undefined)
+		throw new DeviceException(this.error.MISSING_ARG_ERR, 'addContact:Contact Data Needed');
+		
+	if ((typeof contact) != "object") {
+		throw new DeviceException(this.error.INVALID_ARG_ERR, 'addContact:Invalid Contact Data');
+	}
+			
+    var sp_data = {};
+    modifyObjectBaseProp(sp_data);
+    __s60_enumerate_contact_object(contact, null, __sp_contact_extract, sp_data);
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.Type = "Contact";
+    criteria.Data = sp_data;
+    try {
+        if (sp_data.id) {
+            throw new DeviceException(this.error.NOT_SUPPORTED_ERR, "Contacts: addContact: Id Not Supported");
+        }
+        var result = this.so.IDataSource.Add(criteria);
+        //alert("res.errorcode = "+result.ErrorCode);
+        if (sp_data) {
+            delete sp_data.id;
+        }
+        if (criteria) {
+            delete criteria.Type;
+            delete criteria.Data;
+        }
+        var cntId = result["ReturnValue"];
+        if (result.ErrorCode != 0) {
+            var doMap = mappingVerification(result.ErrorCode);
+            if (result.ErrorMessage) {
+                var err_msg = splitErrorMessage(result.ErrorMessage);
+                if (doMap) {
+					//alert("In do map");
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: addContact: " + err_msg);
+                }
+                else {
+					//alert("In do map else");
+                    throw new DeviceException(result.ErrorCode, "Contacts: addContact: " + err_msg);
+                }
+            }
+            else {
+                if (doMap) {
+                
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: addContact: Operation Failed");
+                }
+                else {
+                    throw new DeviceException(result.ErrorCode, "Contacts: addContact: Operation Failed");
+                }
+            }
+        }
+        
+        
+        //Note: sp addContact no longer supports returning the new contact id
+        //__device_debug("sp_contacts_add returns: " + result);
+        //return result;
+        return cntId;
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_contacts_addContact: " + e);
+    }
+}
+
+function __sp_contacts_update(contact){
+
+    //alert("In  __sp_contacts_update");
+    try {
+        if (!(contact && contact.id)) {
+			//alert(" contact && contact.id ");
+            throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: updateContact: contact is missing");
+        }
+        var sp_data = {};
+        modifyObjectBaseProp(sp_data);
+        __s60_enumerate_contact_object(contact, null, __sp_contact_extract, sp_data);
+	if (sp_data.id == undefined) {
+			//alert("sp_data.id == undefined");
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: updateContact: Invalid id type");
+            
+        }
+        
+        if (typeof sp_data.id != "string") {
+			//alert("typeof sp_data.id != string")
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: updateContact: Invalid id type");
+            
+        }
+        var criteria = {};
+        modifyObjectBaseProp(criteria);
+        criteria.Type = "Contact";
+        criteria.Data = sp_data;
+        var result = this.so.IDataSource.Add(criteria);
+        //alert("result = "+ result.ErrorCode);
+        if (sp_data) {
+            delete sp_data.id;
+        }
+        if (criteria) {
+            delete criteria.Type;
+            delete criteria.Data;
+        }
+        if (result.ErrorCode != 0) {
+            var doMap = mappingVerification(result.ErrorCode);
+            if (result.ErrorMessage) {
+                var err_msg = splitErrorMessage(result.ErrorMessage);
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: updateContact: " + err_msg);
+                }
+                else {
+                    throw new DeviceException(result.ErrorCode, "Contacts: updateContact: " + err_msg);
+                }
+            }
+            else {
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: updateContact: Operation Failed");
+                }
+                else {
+                    throw new DeviceException(result.ErrorCode, "Contacts: updateContact: Operation Failed");
+                }
+            }
+        }
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_contacts_updateContact: " + e);
+    }
+    
+}
+
+function __sp_contacts_delete(id){
+    __device_debug("sp_contacts_delete id: " + id);
+    var contactdata = {};
+    modifyObjectBaseProp(contactdata);
+    if (id == undefined) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: deleteContacts: idlist is missing");
+    }
+    
+    if (typeof id == "object") {
+        contactdata.IdList = id;
+    }
+    else {
+        contactdata.IdList = [];
+        contactdata.IdList[0] = id;
+        //delete contactdata.IdList;
+    }
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    
+    criteria.Type = "Contact";
+    criteria.Data = contactdata;
+    
+    try {
+        var result = this.so.IDataSource.Delete(criteria);
+       // alert(" result.errorcode = "+result.ErrorCode);
+        if (contactdata) {
+            delete contactdata.IdList;
+        }
+        if (criteria) {
+            delete criteria.Type;
+            delete criteria.Data;
+        }
+        
+        if (result.ErrorCode != 0) {
+            var doMap = mappingVerification(result.ErrorCode);
+            if (result.ErrorMessage) {
+                var err_msg = splitErrorMessage(result.ErrorMessage);
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: deleteContacts: " + err_msg);
+                }
+                else {
+                    throw new DeviceException(result.ErrorCode, "Contacts: deleteContacts: " + err_msg);
+                }
+            }
+            else {
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: deleteContacts: Operation Failed");
+                }
+                else {
+                    throw new DeviceException(result.ErrorCode, "Contacts: deleteContacts: Operation Failed");
+                }
+            }
+        }
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_contacts_deleteContacts: " + e);
+    }
+}
+
+function __sp_contacts_get(id){
+    //alert("__sp_contacts_get"+typeof id);
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.Type = 'Contact';
+    
+    if (id == null) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: getContactInfo: id should not be null");
+    }
+    if ( typeof id != "string") {
+		throw new DeviceException(this.error.INVALID_ARG_ERR, 'Contacts: getContactInfo: id should be string');
+	}
+    criteria.Filter = {};
+    modifyObjectBaseProp(criteria.Filter);
+    criteria.Filter.id = id;
+    
+    try {
+        var rval = this.so.IDataSource.GetList(criteria);
+        //alert("rval .errorcode = "+rval.ErrorCode);
+        
+        if (criteria.Filter) {
+            delete criteria.Filter.id;
+        }
+        if (criteria) {
+            delete criteria.Type;
+            delete criteria.Filter;
+        }
+        if (rval) {
+            if (rval.ErrorCode != 0) {
+                var doMap = mappingVerification(rval.ErrorCode);
+                if (rval.ErrorMessage) {
+                    var err_msg = splitErrorMessage(rval.ErrorMessage);
+                    if (doMap) {
+                        throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getContactInfo: " + err_msg);
+                    }
+                    else {
+                        throw new DeviceException(rval.ErrorCode, "Contacts: getContactInfo: " + err_msg);
+                    }
+                }
+                else {
+                    if (doMap) {
+                        throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getContactInfo: Operation Failed");
+                    }
+                    else {
+                        throw new DeviceException(rval.ErrorCode, "Contacts: getContactInfo: Operation Failed");
+                    }
+                }
+            }
+            var contact = {};
+            modifyObjectBaseProp(contact);
+            var sp_contact = rval.ReturnValue.getNext();
+            __sp_device_contact_build(sp_contact, contact);
+            return contact;
+        }
+        
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_contacts_getContactInfo:" + e);
+    }
+}
+
+function __sp_contacts_addGroup(groupName){
+    //alert(" In __sp_contacts_addGroup");
+    var sp_data = {};
+    modifyObjectBaseProp(sp_data);
+    sp_data.GroupLabel = groupName;
+    
+    if (typeof(sp_data.GroupLabel) == null) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: addGroups: callback is missing");
+    }
+    
+    
+    if ((typeof sp_data.GroupLabel) == "undefined") {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, 'addGroup:Group Data Needed');
+    }
+    
+    if ((sp_data.GroupLabel) == undefined) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, 'addGroup:Group Data Needed');
+    }
+    
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.Type = "Group";
+    criteria.Data = sp_data;
+    try {
+        var result = this.so.IDataSource.Add(criteria);
+        //alert(" In __sp_contacts_addGroup result = "+result.ErrorCode);
+        if (sp_data) {
+            delete sp_data.GroupLabel;
+        }
+        if (criteria) {
+            delete criteria.Type;
+            delete criteria.Data;
+        }
+        var grpId = result["ReturnValue"];
+        if (result.ErrorCode != 0) {
+            var doMap = mappingVerification(result.ErrorCode);
+            if (result.ErrorMessage) {
+                var err_msg = splitErrorMessage(result.ErrorMessage);
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: addGroup: " + err_msg);
+                }
+                else {
+                    throw new DeviceException(err_msg, result.ErrorCode, "Contacts: addGroup: Operation Failed ");
+                }
+            }
+            else {
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: addGroup: Operation Failed");
+                }
+                else {
+                    throw new DeviceException(result.ErrorCode, "Contacts: addGroup: Operation Failed");
+                }
+            }
+        }
+        return grpId;
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_contacts_addGroup: " + e);
+    }
+}
+
+function __sp_contacts_getGroups_cb(arg1, arg2, arg3){
+    var iter = null;
+    var groups_cb;
+    var error_cb;
+    var CbObj;
+    
+    
+    CbObj = glob_obj.getFromArray(arg1);
+    
+    if (CbObj) {
+        groups_cb = CbObj.success_cb;
+        error_cb = CbObj.error_cb;
+    }
+    
+    else {
+        //alert("Contacts : __sp_contacts_getGroups_cb : Callback not found ");
+		return;
+    }
+    
+    iter = arg3.ReturnValue;
+    if (arg3.ReturnValue) {
+        iter = new __sp_group_iterator(arg3.ReturnValue);
+    }
+    else 
+        if (arg3.ErrorCode != 0) {
+            var err_msg;
+            if (arg3.ErrorMessage) 
+                err_msg = splitErrorMessage(arg3.ErrorMessage);
+            else 
+                err_msg = "Operation Failed";
+            
+            error_cb(new DeviceException(err_msg, MapErrorCode[arg3.ErrorCode], "Contacts: getGroups:"));
+            return;
+        }
+    
+    groups_cb(iter);
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_contacts_getGroups(groups_cb, ErrorCallback){
+    //alert("In __sp_contacts_getGroups");
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.Type = 'Group';
+    
+    try {
+        if (!groups_cb) {
+            throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: getGroups: callback is missing");
+        }
+        else 
+            if (typeof groups_cb != "function") {
+                throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: getGroups: callback is invalid");
+            }
+        if (ErrorCallback) {
+            if (typeof(ErrorCallback) != 'function') {
+                throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: getGroups: ErrorCallback is invalid");
+            }
+        }
+        
+        temp_scb = groups_cb;
+		temp_ecb = ErrorCallback;
+        var rval = this.so.IDataSource.GetList(criteria, this.getGroupsCb);
+       // alert(" errorcode = "+rval.ErrorCode);
+        if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, groups_cb, ErrorCallback);
+        }
+        //alert("In __sp_contacts_getGroups result = "+rval.ErrorCode);
+        if (criteria) {
+            delete criteria.Type;
+        }
+        if (rval.ErrorCode != 0) {
+           // var doMap = mappingVerification(result.ErrorCode);
+		   var doMap = mappingVerification(rval.ErrorCode);
+            var err_msg = null;
+            if (rval.ErrorMessage) {
+                err_msg = splitErrorMessage(rval.ErrorMessage);
+            }
+            if (doMap) {
+                switch (MapErrorCode[rval.ErrorCode]) {
+                    case this.error.MISSING_ARG_ERR:
+                    case this.error.INVALID_ARG_ERR:
+                    case this.error.NOT_SUPPORTED_ERR:
+                        if (err_msg) {
+                            throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getGroups: " + err_msg);
+                        }
+                        else {
+                            throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getGroups: Operation Failed");
+                        }
+                        break;
+                    default:
+                        //groups_cb(0,MapErrorCode[rval.ErrorCode] ,0) ;
+                        //groups_cb(iter) ;
+                        if (ErrorCallback != undefined) {
+                            if (err_msg) {
+                                ErrorCallback(new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getGroups: " + err_msg));
+                            }
+                            else 
+                                ErrorCallback(new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts:  getGroups: Operation Failed "));
+                        }
+                        else {
+                            if (err_msg) 
+                                throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getGroups: Operation Failed" + err_msg);
+                            else 
+                                throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getGroups: Operation Failed");
+                        }
+                        
+                }
+            }
+            else {
+                //groups_cb(0,rval.ErrorCode ,0) ;
+                //groups_cb(iter) ;
+                if (ErrorCallback != undefined) {
+                    if (err_msg) {
+                        ErrorCallback(new DeviceException(rval.ErrorCode, "Contacts: getGroups: " + err_msg));
+                    }
+                    else 
+                        ErrorCallback(new DeviceException(rval.ErrorCode, "Contacts: getGroups: Operation Failed"));
+                }
+                else {
+                    if (err_msg) 
+                        throw new DeviceException(rval.ErrorCode, "Contacts: getGroups: Operation Failed" + err_msg);
+                    else 
+                        throw new DeviceException(rval.ErrorCode, "Contacts: getGroups: Operation Failed");
+                }
+            }
+        }
+        
+        return rval.TransactionID;
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_contacts_getGroups: " + e);
+    }
+}
+
+function __sp_contacts_deleteGroups(id){
+    //alert("In __sp_contacts_deleteGroups");
+    var contactdata = {};
+    modifyObjectBaseProp(contactdata);
+    var IdList = [];
+    if (typeof id == "object") {
+        var i = 0;
+        for (var val in id) {
+            //	if (id.hasOwnProperty('val')) {
+            IdList[i] = id[val];
+            i++;
+            //}		
+        }
+    }
+    else {
+        IdList[0] = id;
+    }
+    contactdata.IdList = [];
+    contactdata.IdList = IdList;
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.Type = "Group";
+    criteria.Data = contactdata;
+    
+    try {
+        var result = this.so.IDataSource.Delete(criteria);
+        //alert("In __sp_contacts_deleteGroups result = "+result.ErrorCode);
+        /*if (contactdata) {
+         delete contactdata.IdList;
+         }
+         if (criteria) {
+         delete criteria.Type;
+         delete criteria.Data;
+         }*/
+        if (result.ErrorCode != 0) {
+            var doMap = mappingVerification(result.ErrorCode);
+            if (result.ErrorMessage) {
+                var err_msg = splitErrorMessage(result.ErrorMessage);
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: deleteGroups: " + err_msg);
+                }
+                else {
+                    throw new DeviceException(result.ErrorCode, "Contacts: deleteGroups: " + err_msg);
+                }
+            }
+            else {
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: deleteGroups: Operation Failed");
+                }
+                else {
+                    throw new DeviceException(result.ErrorCode, "Contacts: deleteGroups: Operation Failed");
+                }
+            }
+        }
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_contacts_deleteGroups: " + e);
+    }
+}
+
+function __sp_contacts_addContactsToGroup(groupId, id1){
+    //alert("__sp_contacts_addContactsToGroup");
+    try {
+        var criteria = {};
+        modifyObjectBaseProp(criteria);
+        var mapFound = false;
+        criteria.Type = "Group";
+        var map = {};
+        modifyObjectBaseProp(map);
+        //	if (id1 != undefined) {			
+        var IdList = [];
+        if (typeof id1 == "object") {
+            var i = 0;
+            for (var val in id1) {
+                //if (id1.hasOwnProperty('val')) {						
+                IdList[i] = id1[val];
+                i++;
+                //	}					
+            }
+        }
+        else {
+            IdList[0] = id1;
+        }
+        map.IdList = IdList;
+        mapFound = true;
+        delete IdList.index;
+        //	} 
+        if (groupId != undefined) {
+            map.id = groupId;
+            mapFound = true;
+        }
+        if (mapFound) {
+            criteria.Data = map;
+        }
+        
+        criteria.OperationType = "Associate";
+        var result = this.so.IDataSource.Organise(criteria);
+       // alert("__sp_contacts_addContactsToGroup result.errorCode = "+result.ErrorCode);
+        if (map) {
+            delete map.id;
+            delete map.IdList;
+        }
+        if (criteria) {
+            delete criteria.Data;
+            delete criteria.OperationType;
+            delete criteria.Type;
+        }
+        if (result.ErrorCode != 0) {
+            var doMap = mappingVerification(result.ErrorCode);
+            if (result.ErrorMessage) {
+                var err_msg = splitErrorMessage(result.ErrorMessage);
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: addContactsToGroup: " + err_msg);
+                }
+                else {
+                    throw new DeviceException(result.ErrorCode, "Contacts: addContactsToGroup: " + err_msg);
+                }
+            }
+            else {
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: addContactsToGroup: Operation Failed");
+                }
+                else {
+                    throw new DeviceException(result.ErrorCode, "Contacts: addContactsToGroup: Operation Failed");
+                }
+            }
+        }
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_contacts_addContactsToGroup: " + e);
+    }
+}
+
+function __sp_contacts_getContactIds_cb(arg1, arg2, arg3){
+    var item = null;
+    var idList = null;
+    var contacts_cb;
+    var error_cb;
+    var CbObj;
+    
+    
+    CbObj = glob_obj.getFromArray(arg1);
+    
+    
+    if (CbObj) {
+        contacts_cb = CbObj.success_cb;
+        error_cb = CbObj.error_cb;
+    }
+    
+    else {
+        alert("Contacts: __sp_contacts_getContactIds_cb : Callback not found ");
+		return;
+    }
+    
+    var id = null;
+    if (arg3["ReturnValue"] != undefined) {
+        item = arg3["ReturnValue"];
+        id = item["IdList"];
+        idList = [];
+        idList = id;
+        
+        delete idList.index;
+    }
+    else 
+        if (arg3.ErrorCode != 0) {
+            var err_msg;
+            if (arg3.ErrorMessage) 
+                err_msg = splitErrorMessage(arg3.ErrorMessage);
+            else 
+                err_msg = "Operation Failed";
+            
+            error_cb(new DeviceException(MapErrorCode[arg3.ErrorCode], "Contacts: getContactIds:" + err_msg));
+            return;
+        }
+    //var error = arg3.ErrorCode;
+    contacts_cb(idList);
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_contacts_getContactIds(contacts_cb, match, sortOrder, ErrorCallback){
+    //alert("__sp_contacts_getContactIds sortOrder =  " +sortOrder);	
+    var criteria = {};
+   // var errcb = ErrorCallback;
+    modifyObjectBaseProp(criteria);
+    criteria.Type = 'Contact';
+    
+    if (match) {
+        criteria.Filter = {};
+        modifyObjectBaseProp(criteria.Filter);
+        criteria.Filter.SearchVal = match;
+    }
+    
+//    if (sortOrder) {
+  if(sortOrder != null && sortOrder != undefined){
+        criteria.Sort = {};
+        modifyObjectBaseProp(criteria.Sort);
+        if (typeof sortOrder == "number") {
+            if (sortOrder == this.SORT_ASCENDING) {
+                criteria.Sort.Order = "Ascending";
+            }
+            else 
+                if (sortOrder == this.SORT_DESCENDING) {
+                    criteria.Sort.Order = "Descending";
+                }
+                else {
+                   // criteria.Sort.Order = sortOrder; // sapi is taking care of this
+				    ErrorCallback(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "Contacts: getContacts: invalid sortOrder input"));
+					return;
+                }
+        }
+        else {
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: getContactIds: SortOrder is Invalid");
+        }
+        
+    }
+    
+    try {
+        if (!contacts_cb) {
+            throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: getContactIds: callback is missing");
+        }
+        
+        else 
+            if (typeof contacts_cb != "function") {
+                throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: getContactIds: callback is invalid");
+            }
+        if (ErrorCallback) {
+            if (typeof(ErrorCallback) != 'function') {
+                throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: getContactIds: ErrorCallback is invalid");
+            }
+        }
+        
+        temp_scb = contacts_cb;
+		temp_ecb = ErrorCallback;
+        
+        var rval = this.so.IDataSource.GetIds(criteria, this.getContactIdsCb);
+        if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, contacts_cb, ErrorCallback);
+        }
+        //alert(" rval.errorcode = "+rval.ErrorCode);
+        /*if(criteria.Sort){
+         delete criteria.Sort.Order;
+         }
+         if(criteria.Filter){
+         delete criteria.Filter.SearchVal;
+         }
+         if (criteria) {
+         delete criteria.Filter;
+         delete criteria.Sort;
+         delete criteria.Type;
+         }*/
+        if (rval.ErrorCode != 0) {
+            var doMap = mappingVerification(rval.ErrorCode);
+            var err_msg = null;
+            if (rval.ErrorMessage) {
+                var err_msg = splitErrorMessage(rval.ErrorMessage);
+            }
+            if (doMap) {
+                switch (MapErrorCode[rval.ErrorCode]) {
+                    case this.error.MISSING_ARG_ERR:
+                    case this.error.INVALID_ARG_ERR:
+                    case this.error.NOT_SUPPORTED_ERR:
+                        if (err_msg) {
+                            throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getContactIds: " + err_msg);
+                        }
+                        else {
+                            throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getContactIds: Operation Failed");
+                        }
+                        break;
+                    default:
+                        //contacts_cb(0,MapErrorCode[rval.ErrorCode] ,0) ;
+                        //contacts_cb(idList);
+                        if (ErrorCallback != undefined) {
+                            if (err_msg) {
+                                ErrorCallback(new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getContactIds: " + err_msg));
+                            }
+                            else 
+                                ErrorCallback(new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getContactIds: Operation Failed "));
+                        }
+                        else {
+                            if (err_msg) {
+                                throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getContactIds:" + err_msg);
+                            }
+                            else 
+                                throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getContactIds: Operation Failed");
+                        }
+                }
+            }
+            else {
+                //contacts_cb(0,rval.ErrorCode ,0) ;
+                //contacts_cb(idList);
+                if (ErrorCallback != undefined) {
+                    if (err_msg) {
+                        ErrorCallback(new DeviceException(rval.ErrorCode, "Contacts: getContactIds: " + err_msg));
+                    }
+                    else 
+                        ErrorCallback(new DeviceException(rval.ErrorCode, "Contacts: getContactIds: Operation Failed "));
+                }
+                else {
+                    if (err_msg) {
+                        throw new DeviceException(rval.ErrorCode, "Contacts: getContactIds:" + err_msg);
+                    }
+                    else 
+                        throw new DeviceException(rval.ErrorCode, "Contacts: getContactIds: Operation Failed");
+                }
+            }
+        }
+        return rval.TransactionID;
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_contacts_getContactIds: " + e);
+    }
+    
+}
+
+function __sp_contacts_getGroupIds_cb(arg1, arg2, arg3){
+	//alert("In __sp_contacts_getGroupIds_cb");
+    var error_cb = null;
+    var item = null;
+    var idList = [];
+    
+    var contacts_cb;
+    var error_cb;
+    var CbObj;
+    
+    //alert("Before getfromarray ");
+    CbObj = glob_obj.getFromArray(arg1);
+	//alert("After getfromarray ");
+    
+    if (CbObj) {
+        contacts_cb = CbObj.success_cb;
+        error_cb = CbObj.error_cb;
+    }
+    
+    else {
+        //alert("Contacts: __sp_contacts_getGroupIds_cb : Callback not found ");
+		return;
+    }
+    
+    
+    if (arg3.ReturnValue) {
+        item = arg3["ReturnValue"];
+        arg3.ReturnValue.close();
+        var id = item["IdList"];
+        idList = id;
+    }
+    else 
+        if (arg3.ErrorCode != 0) {
+            var err_msg;
+            if (rval.ErrorMessage) 
+                err_msg = splitErrorMessage(rval.ErrorMessage);
+            else 
+                err_msg = "Operation Failed";
+            
+            error_cb(new DeviceException(MapErrorCode[arg3.ErrorCode], "Contacts: getGroupIds:" + err_msg));
+            return;
+        }
+    //var error = arg3.ErrorCode;	
+    contacts_cb(idList);
+    delete idList.index;
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_contacts_getGroupIds(contacts_cb, ErrorCallback){	
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.Type = 'Group';
+    
+    
+    try {
+        if (!contacts_cb) {
+            throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: getGroupIds: callback is missing");
+        }
+        else 
+            if (typeof contacts_cb != "function") {
+                throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: getGroupIds: callback is invalid");
+            }
+        if (ErrorCallback) {
+            if (typeof(ErrorCallback) != 'function') {
+                throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: getGroupIds: ErrorCallback is invalid");
+            }
+        }
+        
+        temp_scb = contacts_cb;
+		temp_ecb = ErrorCallback;
+        
+        var rval = this.so.IDataSource.GetIds(criteria, this.getGroupIdsCb);
+		//alert(" rval = "+rval.ErrorCode);
+        if (rval.TransactionID) {
+			//alert("if TransactionID");
+            glob_obj.addToGlobalArray(rval.TransactionID, contacts_cb, ErrorCallback);
+        }
+        
+        if (criteria) {
+            delete criteria.Type;
+        }
+        if (rval.ErrorCode != 0) {
+        
+            var doMap = mappingVerification(rval.ErrorCode);
+            var err_msg = null;
+            if (rval.ErrorMessage) {
+                var err_msg = splitErrorMessage(rval.ErrorMessage);
+            }
+            if (doMap) {
+                switch (rval.ErrorCode) {
+                    case this.error.MISSING_ARG_ERR:
+                    case this.error.INVALID_ARG_ERR:
+                    case this.error.NOT_SUPPORTED_ERR:
+                        if (err_msg) {
+                            throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getGroupIds: " + err_msg);
+                        }
+                        else {
+                            throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getGroupIds: Operation Failed");
+                        }
+                        break;
+                    default:
+                        if (ErrorCallback != undefined) {
+                            if (err_msg) {
+                                ErrorCallback(new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getGroupIds: " + err_msg));
+                            }
+                            else 
+                                ErrorCallback(new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getGroupIds: Operation Failed"));
+                        }
+                        else {
+                            if (err_msg) {
+                                throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: Contacts: getGroupIds:" + err_msg);
+                            }
+                            else 
+                                throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getGroupIds: Operation Failed");
+                        }
+                }
+            }
+            
+            
+            else {
+                if (ErrorCallback != undefined) {
+                    if (err_msg) {
+                        ErrorCallback(new DeviceException(rval.ErrorCode, "Contacts: getGroupIds: " + err_msg));
+                    }
+                    else 
+                        ErrorCallback(new DeviceException(rval.ErrorCode, "Contacts: getGroupIds: Operation Failed"));
+                }
+                else {
+                    if (err_msg) {
+                        throw new DeviceException(rval.ErrorCode, "Contacts: Contacts: getGroupIds:" + err_msg);
+                    }
+                    else 
+                        throw new DeviceException(rval.ErrorCode, "Contacts: getGroupIds: Operation Failed");
+                }
+            }
+        }
+		//alert(" TransactionID = "+TransactionID);
+        return rval.TransactionID;
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_contacts_getGroupIds: " + e);
+    }
+    
+}
+
+function __sp_contacts_removeContactsFromGroup(groupId, id){
+    //alert("__sp_contacts_removeContactsFromGroup");
+    try {
+        var criteria = {};
+        modifyObjectBaseProp(criteria);
+        var mapFound = false;
+        criteria.Type = "Group";
+        var map = {};
+        if (id != undefined) {
+            //alert("id != undefined");	
+            var IdList = [];
+            if (typeof id == "object") {
+                var i = 0;
+                for (var val in id) {
+                    //	if (id.hasOwnProperty('val')) {
+                    IdList[i] = id[val];
+                    i++;
+                    //	}
+                }
+            }
+            else {
+                //alert("id != undefined");
+                IdList[0] = id;
+            }
+            map.IdList = IdList;
+            mapFound = true;
+            //delete IdList.index;
+        }
+        if (groupId != undefined) {
+            map.id = groupId;
+            mapFound = true;
+        }
+        if (mapFound) {
+            criteria.Data = map;
+        }
+        
+        criteria.OperationType = "Disassociate";
+        var result = this.so.IDataSource.Organise(criteria);
+        //alert("__sp_contacts_removeContactsFromGroup result"+result.ErrorCode);
+        if (map) {
+            delete map.IdList;
+        }
+        if (criteria) {
+            delete criteria.Data;
+            delete criteria.OperationType;
+            delete criteria.Type;
+        }
+        if (result.ErrorCode != 0) {
+            var doMap = mappingVerification(result.ErrorCode);
+            if (result.ErrorMessage) {
+                var err_msg = splitErrorMessage(result.ErrorMessage);
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: removeContactsFromGroup: " + err_msg);
+                }
+                else {
+                    throw new DeviceException(result.ErrorCode, "Contacts: removeContactsFromGroup: " + err_msg);
+                }
+            }
+            else {
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: removeContactsFromGroup: Operation Failed");
+                }
+                else {
+                    throw new DeviceException(result.ErrorCode, "Contacts: removeContactsFromGroup: Operation Failed");
+                }
+            }
+        }
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_contacts_removeContactsFromGroup: " + e);
+    }
+}
+
+function __sp_contacts_cancel(transactionId){
+    //alert("__sp_contacts_cancel");
+    try {
+        var criteria = {};
+        
+        if ((transactionId) == null) 
+            throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: cancel: transactionId is missing " );
+        
+        if ((transactionId) == undefined) 
+            throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: cancel:transactionId is undefined ");
+        
+        if ((typeof transactionId) == "undefined") 
+            throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: cancel: transactionId is undefined ");
+        
+        if (((typeof transactionId) != "number") || (transactionId <= 0)) 
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: cancel: transactionId is Invalid" );
+        
+        modifyObjectBaseProp(criteria);
+        criteria.TransactionID = transactionId;
+        var result = this.so.IDataSource.Cancel(criteria);
+        //alert("result error code = " +result.ErrorCode);
+        if (criteria) {
+            delete criteria.TransactionID;
+        }
+        var errorcode = result["ErrorCode"];
+        if (errorcode != 0) {
+            var doMap = mappingVerification(result.ErrorCode);
+            if (result["ErrorMessage"]) {
+                var err_msg = splitErrorMessage(result.ErrorMessage);
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[errorcode], "Contacts: cancel: " + err_msg);
+                }
+                else {
+                    throw new DeviceException(errorcode, "Contacts: cancel: " + err_msg);
+                }
+            }
+            else {
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[errorcode], "Contacts: cancel: Operation Failed");
+                }
+                else {
+                    throw new DeviceException(errorcode, "Contacts: cancel: Operation Failed");
+                }
+            }
+        }
+    } 
+    catch (e) {
+    
+        __device_handle_exception(e, "__sp_contacts_cancel: " + e);
+    }
+}
+
+function __sp_contacts_updateGroup(group){
+    //alert("In __sp_contacts_updateGroup"+typeof group)
+    
+    if (!(group)) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: updateGroup:Group Data is missing");
+    }
+    if ((typeof group) != "object") {
+        //alert(" not object");
+        throw new DeviceException(this.error.INVALID_ARG_ERR, 'Contacts: updateGroup:Invalid Group Data');
+    }
+    if (!(group && group.groupId)) {
+			//alert(" contact && contact.id ");
+            throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: updateGroup: Group id is missing");
+        }
+	if(typeof group.groupId != "string")
+	{
+		   throw new DeviceException(this.error.INVALID_ARG_ERR, 'Contacts: updateGroup:Invalid Group id input');
+	}
+    
+    try {
+        var criteria = {};
+        modifyObjectBaseProp(criteria);
+        criteria.Type = "Group";
+        var sp_data = {};
+        modifyObjectBaseProp(sp_data);
+        if (group != undefined) {
+            if (group.groupId != undefined) {
+                sp_data["id"] = group.groupId;
+            }
+            else {
+                throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: updateGroup: Id input is mandatory");
+            }
+            if (group.groupName != undefined) {
+                sp_data["GroupLabel"] = group.groupName;
+            }
+        }
+        criteria.Data = sp_data;
+        
+        var result = this.so.IDataSource.Add(criteria);
+        //alert("In __sp_contacts_updateGroup result = "+result.ErrorCode);
+        if (sp_data) {
+            delete sp_data.prototype;
+        }
+        if (criteria) {
+            delete criteria.Data;
+            delete criteria.Type;
+        }
+        if (result.ErrorCode != 0) {
+            var doMap = mappingVerification(result.ErrorCode);
+            if (result.ErrorMessage) {
+            
+                var err_msg = splitErrorMessage(result.ErrorMessage);
+                if (doMap) {
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: updateGroup: " + err_msg);
+                }
+                else {
+                
+                    throw new DeviceException(result.ErrorCode, "Contacts: updateGroup: " + err_msg);
+                }
+            }
+            else {
+                if (doMap) {
+                
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Contacts: updateGroup: Operation Failed");
+                }
+                else {
+                
+                    throw new DeviceException(result.ErrorCode, "Contacts: updateGroup: Operation Failed");
+                }
+            }
+        }
+    } 
+    catch (e) {
+    
+        __device_handle_exception(e, "__sp_contacts_updateGroup: " + e);
+    }
+}
+
+
+function __sp_contacts_getGroupInfo(grpid){
+    try {
+        var criteria = {};
+        modifyObjectBaseProp(criteria);
+        criteria.Type = 'Group';
+        
+        criteria.Filter = {};
+        modifyObjectBaseProp(criteria.Filter);
+        if (grpid == undefined) {
+            throw new DeviceException(this.error.MISSING_ARG_ERR, "Contacts: getGroupInfo: Id input is mandatory");
+        }
+        
+        if ((typeof grpid) != "string") 
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Contacts: getGroupInfo: Id input is mandatory");
+        criteria.Filter.id = grpid;
+        var rval = this.so.IDataSource.GetList(criteria);
+        if (criteria.Filter) {
+            delete criteria.Filter.id;
+        }
+        if (criteria) {
+            delete criteria.Filter;
+            delete criteria.Type;
+        }
+        if (rval) {
+            if (rval.ErrorCode != 0) {
+                var doMap = mappingVerification(rval.ErrorCode);
+                if (rval.ErrorMessage) {
+                    var err_msg = splitErrorMessage(rval.ErrorMessage);
+                    if (doMap) {
+                        throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getGroupInfo: " + err_msg);
+                    }
+                    else {
+                        throw new DeviceException(rval.ErrorCode, "Contacts: getGroupInfo: " + err_msg);
+                    }
+                }
+                else {
+                    if (doMap) {
+                        throw new DeviceException(MapErrorCode[rval.ErrorCode], "Contacts: getGroupInfo: Operation Failed");
+                    }
+                    else {
+                        throw new DeviceException(rval.ErrorCode, "Contacts: getGroupInfo: Operation Failed");
+                    }
+                }
+                
+            }
+            else {
+                var groupinfo = {};
+                modifyObjectBaseProp(groupinfo);
+                var sp_group = rval.ReturnValue.getNext();
+                __sp_device_groupinfo_build(sp_group, groupinfo);
+                return groupinfo;
+            }
+        }
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_contacts_getGroupInfo:" + e);
+    }
+}
+
+
+function mappingVerification(errorCode){
+    //alert ("In mappingVerification errorCode = "+errorCode);	
+    if (errorCode === 1016 || errorCode === 1012 || errorCode === 1010 || errorCode === 1009 || errorCode === 1005 || errorCode === 1000 || errorCode === 1011 || errorCode === 1007 || errorCode === 1003 || errorCode === 1002) {
+        //alert("errorCode = "+errorCode);
+        return true;
+    }
+    else {
+        //alert("In mappingVerification errorCode **else part**");
+        return false;
+    }
+}
+
+
+
+function __sp_contacts_instance(){
+    //alert(" In __sp_contacts_instance");
+    
+  	 	this.SORT_ASCENDING = 0;
+  		this.SORT_DESCENDING = 1;
+    
+    //Descriptor
+    this.descriptor = new __sp_contacts_descriptor();
+    //Core methods
+    this.startEditor = __sp_contacts_startEditor;
+    //Extended methods
+    this.getContacts = __sp_contacts_getContacts;
+    this.getContactsCb = __sp_contacts_getContacts_cb;
+    
+    // this.getListSync = __sp_contacts_getListSync;
+    this.addContact = __sp_contacts_add;
+    this.updateContact = __sp_contacts_update;
+    this.deleteContacts = __sp_contacts_delete;
+    this.getContactInfo = __sp_contacts_get;
+    this.addGroup = __sp_contacts_addGroup;
+    
+    this.getGroups = __sp_contacts_getGroups;
+    this.getGroupsCb = __sp_contacts_getGroups_cb;
+    
+    this.deleteGroups = __sp_contacts_deleteGroups;
+    this.addContactsToGroup = __sp_contacts_addContactsToGroup;
+    
+    this.getContactIds = __sp_contacts_getContactIds;
+    this.getContactIdsCb = __sp_contacts_getContactIds_cb;
+    
+    this.getGroupIds = __sp_contacts_getGroupIds;
+    this.getGroupIdsCb = __sp_contacts_getGroupIds_cb;
+    
+    this.removeContactsFromGroup = __sp_contacts_removeContactsFromGroup;
+    this.cancel = __sp_contacts_cancel;
+    this.updateGroup = __sp_contacts_updateGroup;
+    this.getGroupInfo = __sp_contacts_getGroupInfo;
+    this.error = new DeviceException(0, "Dummy");
+    
+    try {
+        //__device_debug("Trying contacts service");
+        this.so = device.getServiceObject("Service.Contact", "IDataSource");
+        //__device_debug("Got contacts service object");    
+    } 
+    catch (e) {
+        __device_handle_exception(e, "Contacts service not available " + e);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceproviders/jsapi/platformservices/src/framework.js	Mon Jan 18 21:02:57 2010 +0200
@@ -0,0 +1,556 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Defination of class CCalendarInterface
+*
+*/
+
+
+var __device_debug_on__ = true;
+
+var event_completed = 2;
+var event_cancelled = 3;
+
+var __Service_Interface_Ver=1.0;
+
+
+var MapErrorCode = {1016:100,1012:101,1010:102,1009:103,1005:104,1000:105,1011:106,1007:107,1003:1,1002:2, 1004:3};
+
+function __device_debug(text){
+  //if(__device_debug_on__) alert(text);
+}
+
+function __device_handle_exception(e, text){
+	__device_debug(text);
+	throw(e);
+}
+
+function __device_typeof(value)
+{
+	// First check to see if the value is undefined.
+	if (value == undefined) {
+        return "undefined";
+    }
+	// Check for objects created with the "new" keyword.
+	if (value instanceof Object) {
+		// Check whether it's a string object.
+		if (value instanceof String) {
+			return "String";
+		}
+		// Check whether it's an array object/array literal.
+		else 
+			if (value instanceof Array) {
+				return "Array";
+			}
+	}
+	// dealing with a literal.
+		if (typeof value) {
+			if (typeof value == "object") {
+				if (typeof value == "object" && !value) {
+					return "null";
+				}
+			}
+           // if not null check for other types
+			
+				// Check if it's a string literal.
+			else if (typeof value == "string") {
+					return "string";
+				}
+		}	 
+}
+
+if ((typeof nokia) == 'undefined') {
+	nokia = {};
+	nokia.device = {};
+}
+else {
+    if ((typeof nokia.device) != 'undefined') {
+		nokia.device = {};
+    }
+	else{
+		throw ("nokia.device already defined");
+	} 
+}
+
+nokia.device = {
+    load: __device_service_load,
+    listInterfaces: __device_service_interfaces,
+	getSystemProperties: __device_getSystemProperties,
+	getLibraryVersion: __device_getLibraryVersion,
+    version: 2.0
+};
+
+function __device_getLibraryVersion(){
+	return 2.0;
+}
+
+function __device_getSystemProperties(){
+	return {
+		uriPath:{
+			// maximum limitation is 255 charectors
+			max:255
+		}
+	};
+}
+// Configure the services offered.
+
+var __device_services_inited = false;
+
+var __device_services = [
+
+  // For now, the only service is the base "device"" service
+  {
+    "name":"device",
+    "version": 2.0, 
+    "interfaces": []
+  }
+];
+
+// Initialize the configured services.
+
+function __device_services_init(){
+  if(__device_services_inited){
+    return;
+  }
+  __device_services_inited = true;
+  
+  try {
+  	var so_SrvReg = device.getServiceObject("Service.ServiceRegistry", "IService");
+	var filter = {ServiceName:"Service.Calendar", InterfaceName:"IDataSource"};  
+	
+	var returnVal = so_SrvReg.IService.GetList(filter);
+		if (returnVal.ErrorCode == 0)	{
+			var intf_iterator = returnVal.ReturnValue;
+			if(intf_iterator)	{
+				var intf = intf_iterator.getNext();
+				if(intf){
+					var versionList = intf.VersionList;
+					var index;
+					for(index in versionList){
+						if(versionList[index] > __Service_Interface_Ver){						
+							__Service_Interface_Ver = versionList[index];
+						}
+					}
+				}
+			}
+			intf_iterator.close();
+		}
+	so_SrvReg.close();
+  }catch(e){
+  	// service registry not available default version to 1.0
+//	alert('in catch'+e);
+	__Service_Interface_Ver = 1.0;
+  }
+	
+ 
+
+  // Get the service-specific service entries. Note that these
+  // need to be individually wrapped by try/catch blocks so that the
+  // interpreter gracefully handles missing services. 
+
+  try {
+    __device_services[0].interfaces.push(__device_geolocation_service_entry);
+  }catch (e){
+    __device_debug("Missing library implementation: " + e);
+  }
+  try {
+    __device_services[0].interfaces.push(__device_camera_service_entry);
+  }catch (e1){
+    __device_debug("Missing library implementation: " + e1);
+  }
+  try {
+    __device_services[0].interfaces.push(__device_media_service_entry);
+  }catch (e2){
+//    __device_debug("Missing library implementation: " + e2);
+  }
+  try {
+    __device_services[0].interfaces.push(__device_contacts_service_entry);
+  }catch (e3){
+//    __device_debug("Missing library implementation: " + e3);
+  }
+ try {
+    __device_services[0].interfaces.push(__device_messaging_service_entry);
+  }catch (e4){
+      __device_debug("Missing library implementation: " + e4);
+  }
+  try {
+    __device_services[0].interfaces.push(__device_calendar_service_entry);
+  }catch (e5){
+      __device_debug("Missing library implementation: " + e5);
+  }
+  try {
+    __device_services[0].interfaces.push(__device_landmarks_service_entry);
+  }catch (e6){
+      __device_debug("Missing library implementation: " + e6);
+  }
+  try {
+    __device_services[0].interfaces.push(__device_commlog_service_entry);
+  }catch (e7){
+      __device_debug("Missing library implementation: " + e7);
+  }
+  try {
+    __device_services[0].interfaces.push(__device_sysinfo_service_entry);
+  }catch (e8){
+      __device_debug("Missing library implementation: " + e8);
+  }
+  try {
+    __device_services[0].interfaces.push(__device_sensors_service_entry);
+  }catch (e9){
+      __device_debug("Missing library implementation: " + e9);
+  }
+
+}
+
+function __device_get_implementation(i){
+  //__device_debug("get_implementation: " + i);
+  return  new i.proto(new(i.providers[0].instance));
+}
+
+function __device_get_descriptor(i){
+  //__device_debug("get_descriptor: " + i);
+  return new i.descriptor(new(i.providers[0].descriptor));
+}
+
+function __device_get_interface(s, interfaceName, version){
+
+    // Find first match of name and version
+    var i = s.interfaces;
+	for (var d in i){
+		if(i[d].name == null){
+		  __device_update_descriptor(i[d]);
+		}
+		
+		if(i[d].name == undefined){
+		  continue;
+		}
+		
+		if (i[d].name == interfaceName){
+		// Match version if specified
+			if (version) {
+				if (i[d].version >= version) {
+					return __device_get_implementation(i[d]);
+				}
+			}else{
+				return __device_get_implementation(i[d]);
+			}
+	    }
+	}
+	return null;
+}
+
+// Implemention of the load method
+
+function __device_service_load(interfaceName, version){
+    var error = new DeviceException('dummy',0);
+	if(interfaceName){
+        if(typeof interfaceName != 'string'){
+            throw new DeviceException(error.INVALID_ARG_ERR, 'nokia.device.load:Invalid type interfaceName');
+        }
+    }else{
+        throw new DeviceException(error.MISSING_ARG_ERR, 'nokia.device.load:interfaceName param expected');
+    }
+    if(version){
+        if(typeof version != 'number'){
+            throw new DeviceException(error.INVALID_ARG_ERR, 'nokia.device.load:Invalid type version');
+        }
+    }
+
+    __device_services_init();
+  
+	for(var s in __device_services){
+	  //__device_debug("service_load: " + s + ":" +  __device_services[s].name + ": " + interfaceName);
+	  var i = __device_get_interface(__device_services[s], interfaceName, version);
+	  if (i != null){
+	    return i;
+	  }
+	}
+    return null;
+}
+
+// Lazily fill in the descriptor table
+
+function __device_update_descriptor(i){
+  var d = __device_get_descriptor(i);
+  i.name = d.interfaceName;
+  i.version = d.version;  
+}
+// Get an array of interface descriptors for a service
+
+function __device_interface_list(s){
+  var retval = new Array();
+  for(var i in s.interfaces){
+    if(s.interfaces[i].name == null){
+      __device_update_descriptor(s.interfaces[i]);
+    }
+    if(s.interfaces[i].name == undefined){
+      continue;
+    }
+    retval[i] = new Object();
+    retval[i].name = s.interfaces[i].name;
+    retval[i].version = s.interfaces[i].version;
+  }  
+  return retval;
+}
+
+// Get a service description
+
+function __device_service_descriptor(s){
+  this.name = s.name;
+  this.version = s.version;
+  this.interfaces = __device_interface_list(s);
+  this.toString = __device_service_descriptor_to_string;
+}
+
+function __device_service_descriptor_to_string(){
+  var is = "\nInterfaces(s): ";
+
+  for (i in this.interfaces){
+    is += "\n" + this.interfaces[i].name + " " + this.interfaces[0].version;
+  }
+  return ("Service: " + this.name + is);
+}
+
+// Implement the listInterfaces method
+    
+function __device_service_interfaces(){
+  __device_services_init();
+
+  for (var s in __device_services){
+      var intfs = __device_interface_list(__device_services[s]);
+	  // create interator
+	  return new __FWIter(intfs);
+  }
+  return null;
+}
+
+
+function __FWIter(arr)
+{
+    this._arr = arr;
+	this._pos = 0;
+	this._valid = true;
+}
+
+__FWIter.prototype.hasNext = function() {
+    return (this._valid && this._pos < this._arr.length);
+}
+
+__FWIter.prototype.next = function() {
+    if(this._valid && (this._pos < this._arr.length)){
+		return this._arr[this._pos++];
+	}
+	else{
+		return null;
+	}
+}
+
+__FWIter.prototype.close = function(){
+    delete this._arr;
+	this._valid = false;
+}
+
+function modifyObjectBaseProp(obj){
+  for (pro in obj) {
+    if(typeof obj[pro] == "function" )
+      obj[pro] = 0;
+    }
+}
+
+//TBD: Get rid of this global, use closures instead
+//Functions for  Handling Async API's use this variable
+var glob_obj = null;
+var temp_scb = null;
+var temp_ecb = null;
+ 
+glob_obj = new Object();
+
+glob_obj.glob_cb_arr = new Array();
+glob_obj.addToGlobalArray = addToGlobalArray;
+glob_obj.removeFromArray = removeFromArray;
+glob_obj.getFromArray = getFromArray;
+     
+DeviceAPIError.prototype = new Error(); //inheritance occurs here
+DeviceAPIError.prototype.constructor = DeviceAPIError; //If this not present then, it uses default constructor of Error
+
+//constructor for DeviceAPIError.
+function DeviceAPIError(code,message) 
+{
+	this.toString = concatenate;
+	this.code = code;
+	this.name = "DeviceError";//we can even overwrite default name "Error"
+	this.message=message; 
+	
+        this.MISSING_ARG_ERR            = 1;
+        this.INVALID_ARG_ERR            = 2;
+        this.NOT_SUPPORTED_ERR          = 3;
+        this.TIMEOUT_ERR                = 100;
+        this.DATA_NOT_FOUND_ERR         = 101;
+        this.DATA_ALREADY_EXISTS_ERR    = 102;
+        this.SERVICE_BUSY_ERR           = 103;
+        this.SERVICE_IN_USE_ERR         = 104;
+        this.DATA_OUT_OF_RANGE_ERR      = 105;
+        this.NOT_ALLOWED_ERR            = 106;
+        this.SIZE_EXCEEDED_ERR          = 107;
+        this.INVALID_URI_ERR            = 108;
+        this.URI_NOT_FOUND_ERR          = 109;
+        this.URI_ALREADY_EXISTS_ERR     = 110;
+        this.NO_MEMORY_ERR              = 111;  
+}
+
+DeviceException.prototype = new Error(); //inheritance occurs here
+DeviceException.prototype.constructor = DeviceException; //If this not present then, it uses default constructor of Error
+
+//constructor for DeviceException.
+function DeviceException(code,message) 
+{
+    this.toString = concatenate;
+    this.code = code;
+    this.name = "DeviceException";//we can even overwrite default name "Error"
+    this.message=message; 
+    
+        this.MISSING_ARG_ERR            = 1;
+        this.INVALID_ARG_ERR            = 2;
+        this.NOT_SUPPORTED_ERR          = 3;
+        this.TIMEOUT_ERR                = 100;
+        this.DATA_NOT_FOUND_ERR         = 101;
+        this.DATA_ALREADY_EXISTS_ERR    = 102;
+        this.SERVICE_BUSY_ERR           = 103;
+        this.SERVICE_IN_USE_ERR         = 104;
+        this.DATA_OUT_OF_RANGE_ERR      = 105;
+        this.NOT_ALLOWED_ERR            = 106;
+        this.SIZE_EXCEEDED_ERR          = 107;
+        this.INVALID_URI_ERR            = 108;
+        this.URI_NOT_FOUND_ERR          = 109;
+        this.URI_ALREADY_EXISTS_ERR     = 110;
+        this.NO_MEMORY_ERR              = 111;  
+}
+
+
+function concatenate()
+{
+    return (this.name+': errcode: '+this.code+'\nline: '+this.lineNumber+'\nfileName: '+this.fileName+'\nerrmsg: '+this.message);
+}
+
+function splitErrorMessage(errmessage)
+{
+	if(errmessage.search(/:/)!=-1)
+	{
+		if((errmessage.split(":").length)==2)
+		{
+			return errmessage.split(":")[1];
+		}
+		if((errmessage.split(":").length)>2)
+		{
+			return errmessage.split(":")[2];
+		}
+	}
+	return errmessage;
+}
+
+
+var __s60_start_and_wait_cb;
+
+function __s60_on_app_exit(){
+  widget.onshow = null;
+  if(__s60_start_and_wait_cb !== null){
+    __s60_start_and_wait_cb();
+  }
+}
+
+function __s60_on_app_start(){
+  widget.onhide = null;
+  widget.onshow = __s60_on_app_exit;
+}
+
+// This function cannot actually force JS to wait,
+// but it does supply a callback the apps can use
+// to continue processing on return from the app.
+// Apps should take care not to reinvoke this and
+// should be careful about any other processing
+// that might happen while the app is running.
+
+function __s60_start_and_wait(id, args, app_exit_cb){
+  __s60_start_and_wait_cb = app_exit_cb;
+  widget.onhide = __s60_on_app_start;
+  widget.openApplication(id, args);
+}
+
+function __s60_api_not_supported(){
+  throw(err_ServiceNotSupported);
+}
+
+function __s60_enumerate_object(object, namespace, func, param){
+   var key;
+   for (key in object) {
+   		var propname;
+   		if (namespace) {
+   			propname = namespace + "." + key;
+   		}
+   		else {
+   			propname = key;
+   		}
+   		var value = object[key];
+   		if (typeof value == "object") {
+   			__s60_enumerate_object(value, propname, func, param);
+   		}
+   		else {
+   			func(propname, value, param);
+   		}
+   }
+}
+
+
+/*
+ * Handling Async calls
+ */
+function removeFromArray(transId){
+    for (i = 0; i < (glob_obj.glob_cb_arr.length); i++) {
+        if (glob_obj.glob_cb_arr[i].transactionId == transId) {
+            glob_obj.glob_cb_arr.splice(i, 1);
+        }
+    }
+}
+
+function addToGlobalArray(transId, sCb, errCb){
+
+    var obj = new Object();
+    
+    obj.success_cb = sCb;
+    obj.transactionId = transId;
+    obj.error_cb = errCb;
+    
+    glob_obj.glob_cb_arr.push(obj);
+    
+}
+
+function getFromArray(tid){
+    var i;
+    
+    for (i = 0; i < (glob_obj.glob_cb_arr.length); i++) {
+        if (glob_obj.glob_cb_arr[i].transactionId == tid) {
+            return glob_obj.glob_cb_arr[i];
+        }
+    }
+	
+	if(temp_scb)
+	{
+		var obj = new Object();
+    
+	    obj.success_cb = temp_scb;
+	    obj.error_cb = temp_ecb;
+		
+		temp_ecb = temp_scb = null;
+		return obj;		
+	}
+    return null;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceproviders/jsapi/platformservices/src/geolocation.js	Mon Jan 18 21:02:57 2010 +0200
@@ -0,0 +1,815 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Defination of class CCalendarInterface
+*
+*/
+
+var _infinity = 1.7976931348623157E+10308;
+/*function PositionError()
+{
+	this.UNKNOWN_ERROR = 0;
+	this.PERMISSION_DENIED = 1;
+	this.POSITION_UNAVAILABLE = 2;
+	this.TIMEOUT = 3;
+	this.code ;
+	this.message ;
+}
+function Coordinates()
+{
+	this.latitude = null;
+	this.longitude = null;
+	this.altitude = null;
+	this.accuracy = null;
+	this.altitudeAccuracy = null;
+	this.heading = null;
+	this.speed = null;
+}
+function Position()
+{
+	this.coords = null;
+	this.timestamp = null;
+}
+function PositionOptions()
+{
+	this.enableHighAccuracy = null;
+	this.timeout = null;
+	this.maximumAge = null;
+}*/
+
+function TransIdCbMap()
+{
+	this.TransactionID = null;
+	this.success_callback = null;
+	this.error_callback = null;
+}
+
+function __device_geolocation_descriptor(provider)
+{
+	this.interfaceName = provider.interfaceName;
+	this.version = provider.version;
+}
+
+function __device_geolocation_getCurrentPosition(success_cb,fail_cb,posOptions)
+{
+  
+	return this.provider.getLocation(success_cb,fail_cb,posOptions);
+}
+
+
+function __device_geolocation_watchPosition(success_cb,fail_cb,posOpts)
+{
+	return this.provider.traceLocation(success_cb,fail_cb,posOpts);
+}
+
+function __device_geolocation_clearWatch(watchId)
+{
+	this.provider.clearTrace(watchId);
+}
+
+// Private location prototype: called from service factory
+function __device_geolocation(provider)
+{
+	//Private properties
+	this.provider = provider;
+	//Read-only properties
+	this.interfaceName = provider.descriptor.interfaceName;
+	this.version = provider.descriptor.version;
+	//one shot retrival of the current position of the device
+	this.getCurrentPosition = __device_geolocation_getCurrentPosition;
+	
+	//Register to get contineous update of device location change
+	this.watchPosition = __device_geolocation_watchPosition;
+	
+	//Clear previously invoke watchPosition Request
+	this.clearWatch = __device_geolocation_clearWatch;
+}
+
+// geolocation service interface
+
+// Namepace: com.nokia.device.service
+
+var __device_geolocation_service_entry = {"name": null, 
+					     "version": null,
+					     "proto": __device_geolocation,
+					     "descriptor": __device_geolocation_descriptor,
+					     "providers": [{"descriptor": __sp_location_descriptor, "instance": __sp_location_instance}]
+					    };
+
+
+
+
+
+
+/*
+Copyright � 2009 Nokia. All rights reserved.
+Code licensed under the BSD License:
+Software License Agreement (BSD License) Copyright � 2009 Nokia.
+All rights reserved.
+Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+Neither the name of Nokia Corporation. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Nokia Corporation. 
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+version: 1.0
+*/
+
+
+// S60 sp-based location provider
+ function Location_PositionError()
+	{
+		this.UNKNOWN_ERROR = 0;
+		this.PERMISSION_DENIED = 1;
+		this.POSITION_UNAVAILABLE = 2;
+		this.TIMEOUT = 3;
+		this.code ;
+		this.message ;
+	}
+	function Location_Coordinates()
+	{
+		this.latitude = null;
+		this.longitude = null;
+		this.altitude = null;
+		this.accuracy = null;
+		this.altitudeAccuracy = null;
+		this.heading = null;
+		this.speed = null;
+	}
+	function Location_Position()
+	{
+		this.coords = null;
+		this.timestamp = null;
+	}
+	function Location_PositionOptions()
+	{
+		this.enableHighAccuracy ;
+		this.timeout;
+		this.maximumAge;
+	}
+
+
+
+
+
+var __sp_location_trace_transactionId = -1;
+
+function __sp_location_handle_error(errorCallback,errorCode,errorMessage)
+	{ 
+		if( (errorCallback != undefined) && (typeof errorCallback == 'function') && (errorCallback != null) )
+		{
+			//create a new position error object
+			var posError = new Location_PositionError(); 
+			if( (-21) == errorCode )
+			{
+				posError.code = posError.PERMISSION_DENIED;
+				posError.message = "permission denied";
+				
+			}
+			else if( (-33) == errorCode )
+			{
+	
+				posError.code = posError.TIMEOUT;
+				posError.message = "request timed out";
+	
+				
+			}
+			else 
+			{
+				posError.code = posError.UNKNOWN_ERROR;
+				posError.message = "UnKnown Error";
+				
+			}
+			
+			//Invoke user supplied error callback
+			errorCallback( posError );
+			
+		} else {
+			var posError = new Location_PositionError();
+			posError.code = posError.UNKNOWN_ERROR;
+			posError.message = "UnKnown Error";
+			throw posError;
+		}
+		
+		
+		
+	}
+
+function __sp_location_descriptor()
+{
+	//Read-only properties
+	this.interfaceName = "geolocation";
+  if(window.__Service_Interface_Ver)
+	this.version =__Service_Interface_Ver;
+  else
+	this.version =1.0;
+	//Class-static properties 
+}
+
+
+var obj;
+
+function __sp_getLocation_cb(arg1, arg2, arg3)
+	{ 
+	var CbObj;
+    
+    
+    CbObj = glob_obj.getFromArray(arg1);
+    
+    
+    
+    if (CbObj) {
+        success_cb1 = CbObj.success_cb;
+        error_cb = CbObj.error_cb;
+    }
+    
+    else {
+        alert("Geolocation: __sp_getLocation_cb: Callback not found ");
+		return;
+    }
+    
+	
+		if( arg3.ErrorCode )
+		{
+			//process error condition
+				////alert("arg3.ErrorCode");
+				__sp_location_handle_error(error_cb,arg3.ErrorCode,arg3.ErrorMessage);
+				return;			
+		}
+		//there is no error so invoke consumer supplied success callback
+		else
+		{    
+			 var _pos_coord = new Location_Coordinates();
+			_pos_coord.longitude = (arg3.ReturnValue.Longitude == undefined)?null:arg3.ReturnValue.Longitude;
+			_pos_coord.latitude = (arg3.ReturnValue.Latitude == undefined)?null:arg3.ReturnValue.Latitude;
+			_pos_coord.altitude = (arg3.ReturnValue.Altitude == undefined)?null:arg3.ReturnValue.Altitude;
+			_pos_coord.accuracy = (arg3.ReturnValue.HorizontalAccuracy == undefined)?null:arg3.ReturnValue.HorizontalAccuracy;			
+			_pos_coord.altitudeAccuracy = (arg3.ReturnValue.VerticalAccuracy == undefined)?null:arg3.ReturnValue.VerticalAccuracy;
+			_pos_coord.heading = (arg3.ReturnValue.Heading == undefined)?null:arg3.ReturnValue.Heading;
+			_pos_coord.speed = (arg3.ReturnValue.HorizontalSpeed == undefined)?null:arg3.ReturnValue.HorizontalSpeed;
+			
+			//Position Object
+			var _pos_data = new Location_Position();
+
+			_pos_data.coords = {};
+			modifyObjectBaseProp(_pos_data.coords);
+			_pos_data.coords =_pos_coord;
+			_pos_data.timestamp = new Date();
+			
+			//Invoke consumer callback			
+			success_cb1( _pos_data );			
+			delete _pos_data.timestamp;
+			delete _pos_data;
+			delete _pos_coord;	
+		}
+		 glob_obj.removeFromArray(arg1);	
+	}
+	
+//Gets the current location 
+function __sp_getLocation(success_cb,fail_cb,posOptions)
+{    
+     
+	
+		
+	 if((success_cb == undefined) || (success_cb == null) || (typeof(success_cb) != "function"))
+			{
+				var errorFormat = "Wrong callback type";
+		       __sp_location_handle_error(fail_cb,0,errorFormat);
+				
+			}	
+	
+	
+	if ((fail_cb != undefined)) {
+				if ((fail_cb != null)
+				    &&(fail_cb != "")
+					&& (typeof(fail_cb) != "function")) {						
+						var errorObject = new Location_PositionError();
+						errorObject.code = -1;
+						throw errorObject;	
+				}
+			}
+
+
+	var returnValue;
+	//Input object to be passed to Location provider
+	var criteria = {};
+	modifyObjectBaseProp(criteria);
+	criteria.LocationInformationClass = "GenericLocationInfo";
+	
+	var updateoptions = {};
+	modifyObjectBaseProp(updateoptions);
+	updateoptions.UpdateInterval = 0;
+	
+	if (posOptions != undefined && posOptions != null) {
+		if ((typeof(posOptions) != "object")) {
+			////alert("!= object");
+			var errorMessage = "Wrong posOptions type";
+			__sp_location_handle_error(fail_cb, 0, errorMessage);
+			return;
+		}
+	}		
+			
+	if( posOptions != undefined )
+	{
+	
+		if (posOptions.maximumAge != undefined ) {
+		
+			if (posOptions.maximumAge) {
+				//If the param is specified and it is a number
+				if ((posOptions.maximumAge == Infinity)) {////alert("infinty");
+					if ((posOptions.enableHighAccuracy == undefined) ||
+					(typeof(posOptions.enableHighAccuracy) == "boolean")) {															
+						var arg3 = this.so.ILocation.GetLastPosition();
+						if (arg3.ErrorCode < 0) { 						
+							var errorMessage = "Invalid input type";
+							__sp_location_handle_error(fail_cb, 0, errorMessage);
+							return;
+							
+						}
+						
+						var _pos_coord = new Location_Coordinates();
+						_pos_coord.longitude = (arg3.ReturnValue.Longitude == undefined) ? null : arg3.ReturnValue.Longitude;
+						_pos_coord.latitude = (arg3.ReturnValue.Latitude == undefined) ? null : arg3.ReturnValue.Latitude;
+						_pos_coord.altitude = (arg3.ReturnValue.Altitude == undefined) ? null : arg3.ReturnValue.Altitude;
+						_pos_coord.accuracy = (arg3.ReturnValue.HorizontalAccuracy == undefined) ? null : arg3.ReturnValue.HorizontalAccuracy;
+						_pos_coord.altitudeAccuracy = (arg3.ReturnValue.VerticalAccuracy == undefined) ? null : arg3.ReturnValue.VerticalAccuracy;
+						_pos_coord.heading = (arg3.ReturnValue.Heading == undefined) ? null : arg3.ReturnValue.Heading;
+						_pos_coord.speed = (arg3.ReturnValue.HorizontalSpeed == undefined) ? null : arg3.ReturnValue.HorizontalSpeed;
+						
+						//Position Object
+						var _pos_data = new Location_Position();
+						_pos_data.coords = {};
+						modifyObjectBaseProp(_pos_data.coords);
+						_pos_data.coords = _pos_coord;
+						_pos_data.timestamp = new Date();
+						
+						//Invoke consumer callback
+						
+						success_cb(_pos_data);
+						delete _pos_data.timestamp;
+						delete _pos_data;
+						delete _pos_coord;
+						return;
+						
+					}
+					
+				
+				}
+			
+			if (!(isNaN(parseInt(posOptions.maximumAge)))) {
+					
+					if ((posOptions.maximumAge == 0)) {
+						
+						var errorMessage = "Invalid input type";
+						__sp_location_handle_error(fail_cb, 0, errorMessage);
+						return;
+					}
+					
+					    //alert("number");
+						updateoptions.UpdateMaxAge = posOptions.maximumAge ;
+						//alert("updateoptions.UpdateMaxAget"+ updateoptions.UpdateMaxAge);
+					
+				}
+				else {
+					//alert("!number");
+					var errorMessage = "Invalid input type";
+					__sp_location_handle_error(fail_cb, 0, errorMessage);
+					return;
+				}
+				
+			}
+			
+			else if ((posOptions.maximumAge == null) || (posOptions.maximumAge == "")) { ////alert("null");
+					}
+			
+		}
+		
+		//check if timeout is supplied.
+		if((posOptions.enableHighAccuracy !== undefined ))
+		{  
+			
+			if(posOptions.enableHighAccuracy == true) {////alert("1");
+					criteria.EnableHighAccuracy = posOptions.enableHighAccuracy;
+				}				
+			else if(posOptions.enableHighAccuracy == false) {	////alert("2e");					
+						criteria.EnableHighAccuracy = posOptions.enableHighAccuracy;
+					}				
+			else if ((posOptions.enableHighAccuracy == null) || (posOptions.enableHighAccuracy == "")) {
+							}
+			else{ ////alert("acc = else");
+				if ((typeof(posOptions.enableHighAccuracy) != "boolean")) {
+					var errorFormat1 = "Wrong value for enableHighAccuracy param";
+					__sp_location_handle_error(fail_cb, 0, errorFormat1);
+				
+					return;
+				}
+				
+			}
+			
+		}
+		
+			
+		if (posOptions.timeout !== undefined) {
+			if ((posOptions.timeout !== null) || ((posOptions.timeout !== ""))) {
+				//alert("12");
+				if ((posOptions.timeout == Infinity)) {
+					//alert("12345");
+					//alert("infinty condition");
+					var errorMessage = "Invalid input type";
+					__sp_location_handle_error(fail_cb, 0, errorMessage);
+					return;
+				}
+				
+				else 
+					if (!(isNaN(parseInt(posOptions.timeout)))) {
+						//alert("timeout = 0")
+						if ((posOptions.timeout <= 2147483647)) {
+						
+						if ((posOptions.timeout == 0)) {
+							//alert("inside if int");
+							var errorMessage = "Invalid input type";
+							__sp_location_handle_error(fail_cb, 0, errorMessage);
+							return;
+						}
+						//alert("true condition");
+						updateoptions.UpdateTimeOut = posOptions.timeout;
+						
+					}
+					else{
+						var errorMessage = "Invalid input type";
+				       __sp_location_handle_error(fail_cb, 0, errorMessage);
+				       return;
+					}
+			}
+		}
+		else if ((posOptions.timeout === null) || ((posOptions.timeout === ""))) {
+				//alert("true condition");
+			
+			}
+			else {
+				//alert("!number");
+				var errorMessage = "Invalid input type";
+				__sp_location_handle_error(fail_cb, 0, errorMessage);
+				return;
+			}		
+		}   
+		     
+	}
+
+	// Setting PartialUpdates to false ensures that user gets at least 
+	// BasicLocationInformation (Longitude, Latitude, and Altitude.)
+	updateoptions.PartialUpdates = false;
+		
+	criteria.Updateoptions = updateoptions;
+	
+	try 
+	{     
+		temp_scb = success_cb;
+		temp_ecb = fail_cb;
+		var rval = this.so.ILocation.GetLocation(criteria, this.getLocationCb);   
+		if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, success_cb, fail_cb);
+        }
+		
+		delete updateoptions;
+		delete criteria; 
+		
+		if(rval.ErrorCode != 0)
+			{   		
+			//process error condition
+	
+			__sp_location_handle_error(fail_cb,rval.ErrorCode,rval.ErrorMessage);
+			
+			//__sp_location_handle_error(__fail_cb,-1);
+			return;
+			}
+
+	}
+	
+	catch (e) 
+	{
+		__device_handle_exception (e, "__sp_getLocation: " + e);
+	}
+}
+
+
+
+var __sp_location_trace_ucb = null;
+var __sp_location_fail_cb  = null;
+
+function __sp_traceLocation_cb(arg1, arg2, arg3){
+	
+		 var CbObj;
+    
+    
+	    CbObj = glob_obj.getFromArray(arg1);
+	    
+	    
+	    
+	    if (CbObj) {
+	        success_cb = CbObj.success_cb;
+	        error_cb = CbObj.error_cb;
+	    }
+	    
+	    else {
+	        alert("Geolocation: __sp_traceLocation_cb: Callback not found ");
+			return;
+	    }
+    
+		
+			
+		if( arg3.ErrorCode )
+		{	
+			//process error condition			
+			__sp_location_handle_error(error_cb,
+									   arg3.ErrorCode,
+									   arg3.ErrorMessage);
+				
+		}
+		
+		else//there is no error so invoke consumer supplied success callback
+		{   
+			
+			 var _pos_coord = new Location_Coordinates();
+			_pos_coord.longitude = (arg3.ReturnValue.Longitude == undefined)?null:arg3.ReturnValue.Longitude;
+			_pos_coord.latitude = (arg3.ReturnValue.Latitude == undefined)?null:arg3.ReturnValue.Latitude;
+			_pos_coord.altitude = (arg3.ReturnValue.Altitude == undefined)?null:arg3.ReturnValue.Altitude;
+			_pos_coord.accuracy = (arg3.ReturnValue.HorizontalAccuracy == undefined)?null:arg3.ReturnValue.HorizontalAccuracy;		
+			_pos_coord.altitudeAccuracy = (arg3.ReturnValue.VerticalAccuracy == undefined)?null:arg3.ReturnValue.VerticalAccuracy;
+			_pos_coord.heading = (arg3.ReturnValue.Heading == undefined)?null:arg3.ReturnValue.Heading;
+			_pos_coord.speed = (arg3.ReturnValue.HorizontalSpeed == undefined)?null:arg3.ReturnValue.HorizontalSpeed;
+			
+			//Position Object
+			var _pos_data = new Location_Position();
+			_pos_data.coords = {};
+			modifyObjectBaseProp(_pos_data.coords);
+			_pos_data.coords =_pos_coord;
+			_pos_data.timestamp = new Date();
+			
+			
+			//Invoke consumer callback
+			
+			success_cb( _pos_data );
+			delete _pos_data.timestamp;
+			delete _pos_data;
+			delete _pos_coord;
+			return;
+		}
+	 glob_obj.removeFromArray(arg1);	
+	}
+
+//Funtion to obtain periodic updates
+function __sp_traceLocation(trace_cb, fail_cb,posOptions)
+{
+
+	
+	if((trace_cb == undefined) || (trace_cb == null) || (typeof(trace_cb) != "function"))
+			{
+				var errorMessage = "Wrong callback type";
+				__sp_location_handle_error(fail_cb,0,errorMessage);
+				return;				
+			}
+	
+	
+	if((typeof trace_cb != 'function' ))
+	{////alert("not fun");
+		var errorMessage = "Wrong callback type";
+		__sp_location_handle_error(fail_cb,0,errorMessage);
+		return;
+	}
+	
+	if ((fail_cb != undefined)) {////alert("!= fail_cb");
+				if ((fail_cb != null)
+				    &&(fail_cb != "")
+					&& (typeof(fail_cb) != "function")) {
+						//////alert("fail_cb fail");
+					var errorObject = new Location_PositionError();
+					errorObject.code = -1;
+					throw errorObject;	
+				}
+			}
+   
+   
+	   
+	var thisobj = this;
+	
+	
+	
+	var updateoptions = {};
+	modifyObjectBaseProp(updateoptions);
+	updateoptions.UpdateInterval = 0;
+	var criteria = {};
+	modifyObjectBaseProp(criteria);
+	criteria.LocationInformationClass = "GenericLocationInfo";	
+	
+	if (posOptions != undefined && posOptions != null) {
+		if ((typeof(posOptions) != "object")) {
+			////alert("!= object");
+			var errorMessage = "Wrong posOptions type";
+			__sp_location_handle_error(fail_cb, 0, errorMessage);
+			return;
+		}
+	}		
+
+	if (posOptions != undefined) {
+	
+	
+		if ((posOptions.enableHighAccuracy !== undefined)) {
+		
+			if (posOptions.enableHighAccuracy == true) {////alert("1");
+				criteria.EnableHighAccuracy = posOptions.enableHighAccuracy;
+			}
+			else 
+				if (posOptions.enableHighAccuracy == false) { ////alert("2e");					
+					criteria.EnableHighAccuracy = posOptions.enableHighAccuracy;
+				}
+				else 
+					if ((posOptions.enableHighAccuracy == null) || (posOptions.enableHighAccuracy == "")) {
+					}
+					
+					else { 
+						if ((typeof(posOptions.enableHighAccuracy) != "boolean")) {
+							var errorFormat = "Wrong value for enableHighAccuracy param";
+							__sp_location_handle_error(fail_cb, 0, errorFormat);
+							return;
+						}
+						
+					}
+			
+		}	
+
+	
+	if (posOptions.timeout !== undefined) {
+			if ((posOptions.timeout !== null)  || ((posOptions.timeout !== ""))) {
+					//alert("12");
+				if ((posOptions.timeout == Infinity)) {
+					//alert("12345");
+					//alert("infinty condition");
+					var errorMessage = "Invalid input type";
+					__sp_location_handle_error(fail_cb, 0, errorMessage);
+					return;
+				}
+				
+				else if (!(isNaN(parseInt(posOptions.timeout)))) {//alert("timeout = 0")
+					
+					if ((posOptions.timeout == 0) ) {
+						//alert("inside if int");
+						var errorMessage = "Invalid input type";
+						__sp_location_handle_error(fail_cb, 0, errorMessage);
+						return;
+					}
+						//alert("true condition");
+						updateoptions.UpdateTimeOut = posOptions.timeout ;
+					
+				}	
+			}	
+				
+		else if ((posOptions.timeout === null) ||((posOptions.timeout === ""))) {
+					//alert("true condition");
+					//	updateoptions.UpdateTimeOut = posOptions.timeout * 1000;
+				}
+				else {
+					//alert("!number");
+					var errorMessage = "Invalid input type";
+					__sp_location_handle_error(fail_cb, 0, errorMessage);
+					return;
+				}	
+				
+					
+		}
+		//check that update interval if specified is an integer.
+	 
+		if( typeof posOptions.maximumAge != 'undefined')
+		{
+			
+						
+			if(posOptions.maximumAge == _infinity)
+				{
+					updateoptions.UpdateTimeOut = 0;
+					updateoptions.UpdateMaxAge = 2147483647; //2^31 - 1
+
+				}
+			
+			//If the param is specified and it is a number 
+			else if(!(isNaN(parseInt(posOptions.maximumAge))))
+			{
+		  		updateoptions.UpdateMaxAge = posOptions.maximumAge ;
+			}
+				
+			else if ((posOptions.maximumAge === null) || ((posOptions.maximumAge === ""))) {
+				//alert("true condition");
+			//	updateoptions.UpdateTimeOut = posOptions.timeout * 1000;
+				}
+			else {
+				//alert("!number");
+				var errorMessage = "Invalid input type";
+				__sp_location_handle_error(fail_cb, 0, errorMessage);
+				return;
+			}		
+				
+		}
+		
+	}
+
+	// Setting PartialUpdates to false ensures that user gets at least 
+	// BasicLocationInformation (Longitude, Latitude, and Altitude.)	
+	updateoptions.PartialUpdates = false;
+	
+	criteria.Updateoptions = updateoptions;
+	
+	try 
+	{
+		temp_scb = trace_cb;
+		temp_ecb = fail_cb;
+		var rval = this.so.ILocation.Trace(criteria,this.traceCb);
+		if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, trace_cb, fail_cb);
+        }
+		delete updateoptions;
+		delete criteria;
+		if(rval.ErrorCode != 0)
+			{
+				//process error condition
+				__sp_location_handle_error(fail_cb,rval.ErrorCode,rval.ErrorMessage);				
+				return;
+			}
+		
+		return rval.TransactionID;
+	}
+
+	catch (e) 
+	{
+		__device_handle_exception (e, "__sp_traceLocation: " + e);  
+	}
+}
+
+//clears any outstanding Trace requests
+function __sp_clearTrace(watchId)
+{ 
+
+		if(typeof watchId != 'number')	
+		{
+			        var errorMessage = "Invalid input type";
+				   __sp_location_handle_error(fail_cb,0,errorMessage);		
+		}
+		 
+		var locationParams = {            
+            TransactionID : watchId
+        };
+		
+		try 
+		{
+			
+			var result = this.so.ILocation.Cancel(locationParams);
+			
+		//Just ignore the error
+			
+		}
+		catch (e) 
+		{
+			__device_handle_exception (e, "__sp_clearTrace: " + e );
+		
+		}
+		 
+
+}
+
+
+function __sp_location_instance()
+{
+	
+	//Descriptor
+	this.descriptor = new __sp_location_descriptor();
+	//Core methods
+	this.getLocation = __sp_getLocation;
+	this.getLocationCb = __sp_getLocation_cb;
+	//Extended methods
+	this.traceLocation = __sp_traceLocation;
+	this.traceCb = __sp_traceLocation_cb;
+	this.clearTrace = __sp_clearTrace;
+	
+	//Private data
+
+	try
+	{
+	
+		this.so = device.getServiceObject("Service.Location", "ILocation");
+	
+	}
+	catch (e)
+	{
+		this.so = null;
+		__device_handle_exception (e, "Location service not available");
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceproviders/jsapi/platformservices/src/landmarks.js	Mon Jan 18 21:02:57 2010 +0200
@@ -0,0 +1,2572 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Defination of class CCalendarInterface
+*
+*/
+
+// Namepace: com.nokia.device.service
+
+var __device_landmarks_service_entry = {
+    "name": null,
+    "version": null,
+    "proto": __device_landmarks,
+    "descriptor": __device_landmarks_descriptor,
+    "providers": [{
+        "descriptor": __sp_landmarks_descriptor,
+        "instance": __sp_landmarks_instance
+    }]
+};
+
+// Private location prototype: called from service factory
+function __device_landmarks(provider){
+    //Private properties
+    this.provider = provider;
+    //Read-only properties
+    this.interfaceName = provider.descriptor.interfaceName;
+    this.version = provider.descriptor.version;
+    //Core methods
+    this.startEditor = __device_landmarks_startEditor;
+    //Extended methods
+    this.getCategories = __device_landmarks_getCategories;
+    this.getLandmarks = __device_landmarks_getLandmarks;
+    this.addCategory = __device_landmarks_add_category;
+    this.updateCategory = __device_landmarks_update_category;
+    this.updateLandmark = __device_landmarks_update_landmark;
+    this.addLandmark = __device_landmarks_add_landmark;
+    this.deleteCategory = __device_landmarks_delete_category;
+    this.deleteLandmark = __device_landmarks_delete_landmark;
+    this.importLandmarks = __device_landmarks_import_landmarks;
+    this.exportLandmarks = __device_landmarks_export_landmarks;
+    this.organizeLandmarks = __device_landmarks_organize_landmarks;
+    ;
+    this.cancel = __device_landmarks_cancel;
+}
+
+function __device_landmarks_descriptor(provider){
+    this.interfaceName = provider.interfaceName;
+    this.version = provider.version;
+}
+
+function __device_landmarks_startEditor(callback, entry){
+    this.provider.startEditor(callback, entry);
+}
+
+function __device_landmarks_getCategories(callback, name, errorcb){
+    return this.provider.getCategories(callback, name, errorcb);
+}
+
+
+function __device_landmarks_getLandmarks(callback, match, errcb){
+    return this.provider.getLandmarks(callback, match, errcb);
+}
+
+function __device_landmarks_add_category(callback, categoryItem, ErrorCallback){
+    return this.provider.addCategory(callback, categoryItem, ErrorCallback);
+}
+
+
+function __device_landmarks_add_landmark(callback, landmarkItem, ErrorCallback){
+    return this.provider.addLandmark(callback, landmarkItem, ErrorCallback);
+}
+
+function __device_landmarks_delete_category(callback, categoryId, ErrorCallback){
+    return this.provider.deleteCategory(callback, categoryId, ErrorCallback);
+}
+
+function __device_landmarks_delete_landmark(callback, landmarkId, ErrorCallback){
+    return this.provider.deleteLandmark(callback, landmarkId, ErrorCallback);
+}
+
+function __device_landmarks_update_landmark(callback, landmarkItem, ErrorCallback){
+    return this.provider.updateLandmark(callback, landmarkItem, ErrorCallback);
+}
+
+function __device_landmarks_update_category(callback, categoryItem, ErrorCallback){
+    return this.provider.updateCategory(callback, categoryItem, ErrorCallback);
+}
+
+function __device_landmarks_import_landmarks(callback, sourceFileUri, mimetype, ErrorCallback){
+    return this.provider.importLandmarks(callback, sourceFileUri, mimetype, ErrorCallback);
+}
+
+function __device_landmarks_export_landmarks(callback, landmarkIdList, destFileUri, mimetype, ErrorCallback){
+    return this.provider.exportLandmarks(callback, landmarkIdList, destFileUri, mimetype, ErrorCallback);
+}
+
+function __device_landmarks_organize_landmarks(callback, landmarkIdList, categoryId, associate, ErrorCallback){
+    return this.provider.organizeLandmarks(callback, landmarkIdList, categoryId, associate, ErrorCallback);
+}
+
+function __device_landmarks_cancel(transactionId){
+    return this.provider.cancel(transactionId);
+}
+
+
+
+
+/*
+ Copyright � 2009 Nokia. All rights reserved.
+ Code licensed under the BSD License:
+ Software License Agreement (BSD License) Copyright � 2009 Nokia.
+ All rights reserved.
+ Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ Neither the name of Nokia Corporation. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Nokia Corporation.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ version: 1.0
+ */
+//utillity function for converting error code from PS to CJSE codes
+//this gets used in communicating errors via error callback
+var err_missing_argument = 1003;
+var err_bad_argument = 1002;
+var err_ServiceNotSupported = 1004;
+var err_InvalidService_Argument = 1000;
+function convertFromPS2JS(PSCode){
+    var JSCodeValue = new DeviceAPIError(0, "dummy");
+    var JsErrCode;
+    switch (PSCode) {
+        case 1016:
+            JsErrCode = JSCodeValue.TIMEOUT_ERR;
+            break;
+        case 1012:
+            JsErrCode = JSCodeValue.DATA_NOT_FOUND_ERR;
+            break;
+        case 1010:
+            JsErrCode = JSCodeValue.DATA_ALREADY_EXISTS_ERR;
+            break;
+        case 1009:
+            JsErrCode = JSCodeValue.SERVICE_BUSY_ERR;
+            break;
+        case 1005:
+            JsErrCode = JSCodeValue.SERVICE_IN_USE_ERR;
+            break;
+        default:
+            JsErrCode = 1001;
+    }
+    return JsErrCode;
+}
+
+// S60 sp-based landmarks provider
+
+function __sp_landmarks_descriptor(){
+    //Read-only properties
+    this.interfaceName = "landmarks";
+    if (window.__Service_Interface_Ver) 
+        this.version = __Service_Interface_Ver;
+    else 
+        this.version = 1.0;
+    //Class-static properties 
+}
+
+function __sp_landmarks_instance(){
+    //Descriptor
+    this.descriptor = new __sp_landmarks_descriptor();
+    //Core methods
+    this.startEditor = __sp_landmarks_startEditor;
+    //Extended methods
+    this.getCategories = __sp_landmarks_category_getList;
+    this.getCategoriesCb = __sp_landmarks_category_getList_cb;
+    
+    this.addCategory = __sp_landmarks_category_add;
+    this.addCategoryCb = __sp_landmarks_category_add_cb;
+    
+    this.updateCategory = __sp_landmarks_category_update;
+    this.updateCategoryCb = __sp_landmarks_category_update_cb;
+    
+    this.deleteCategory = __sp_landmarks_category_delete;
+    this.deleteCategoryCb = __sp_landmarks_category_delete_cb;
+    
+    this.getLandmarks = __sp_landmarks_getList;
+    this.getLandmarksCb = __sp_landmarks_getList_cb;
+    
+    this.addLandmark = __sp_landmarks_add;
+    this.addLandmarkCb = __sp_landmarks_add_cb;
+    
+    this.updateLandmark = __sp_landmarks_update;
+    this.updateLandmarkCb = __sp_landmarks_update_cb;
+    
+    this.deleteLandmark = __sp_landmarks_delete;
+    this.deleteLandmarkCb = __sp_landmarks_delete_cb;
+    
+    this.importLandmarks = __sp_landmarks_import;
+    this.importLandmarksCb = __sp_landmarks_import_cb;
+    
+    this.exportLandmarks = __sp_landmarks_export;
+    this.exportLandmarksCb = __sp_landmarks_export_cb;
+    
+    this.organizeLandmarks = __sp_landmarks_organize;
+    this.organizeLandmarksCb = __sp_landmarks_organize_cb;
+    
+    this.temporarySCb = null;
+    this.temporaryECb = null;
+    
+    this.cancel = __sp_landmarks_cancel;
+    //Private data 
+    try {
+        this.so = device.getServiceObject("Service.Landmarks", "IDataSource");
+    } 
+    catch (e) {
+        __device_handle_exception(e, "Landmarks service not available");
+    }
+}
+
+// TBD: We MUST get rid of this when underlying sp supports category names directly
+// For one thing this is not localized!
+
+var __SP_CATEGORY_MIN_LOCAL_ID = 16;
+
+var __sp_category_list = [{
+    id: 1,
+    globalId: 3000,
+    name: "Accommodation"
+}, {
+    id: 2,
+    globalId: 6000,
+    name: "Businesses"
+}, {
+    id: 3,
+    globalId: 9000,
+    name: "Telecommunications"
+}, {
+    id: 4,
+    globalId: 12000,
+    name: "Education"
+}, {
+    id: 5,
+    globalId: 15000,
+    name: "Entertainment"
+}, {
+    id: 6,
+    globalId: 18000,
+    name: "Food and drink"
+}, {
+    id: 7,
+    globalId: 21000,
+    name: "Geographical locations"
+}, {
+    id: 8,
+    globalId: 24000,
+    name: "Outdoor activities"
+}, {
+    id: 9,
+    globalId: 27000,
+    name: "People"
+}, {
+    id: 10,
+    globalId: 30000,
+    name: "Public services"
+}, {
+    id: 11,
+    globalId: 33000,
+    name: "Places of worship"
+}, {
+    id: 12,
+    globalId: 36000,
+    name: "Shopping"
+}, {
+    id: 13,
+    globalId: 39000,
+    name: "Sightseeing"
+}, {
+    id: 14,
+    globalId: 42000,
+    name: "Sports"
+}, {
+    id: 15,
+    globalId: 45000,
+    name: "Transport"
+}];
+
+/* ------ Wrap sp iterators ------- */
+
+function __sp_landmarks_category_iterator(js_iterator){
+    this.iter = js_iterator;
+    this.next = __sp_landmarks_category_iterator_get_next;
+    this.hasNext = __sp_landmarks_category_iterator_has_next;
+    
+    //indicate whether iterator has been populated atleast once
+    this.hasElement = false;
+    //refers to the current category item
+    this.catItem = null;
+    this.close = __sp_landmarks_category_close;
+}
+
+function __sp_landmarks_category_close(){
+    this.iter.close();
+}
+
+function __sp_landmarks_category_iterator_has_next(){
+    if (this.hasElement) {
+        if (this.catItem !== null) {
+            return true;
+        }
+        else {
+            return false;
+        }
+        
+    }
+    else {
+        this.catItem = this.iter.getNext();
+        this.hasElement = true;
+        if (typeof this.catItem == "undefined") {
+            this.catItem = null;
+            return false;
+        }
+        else {
+            return true;
+        }
+    }
+}
+
+function __sp_landmarks_category_iterator_get_next(){
+    if (this.hasElement) {
+        var tempitem = new Object();
+        tempitem = this.catItem;
+        //update
+        this.catItem = this.iter.getNext();
+        if (typeof(this.catItem) == "undefined") {
+            this.catItem = null;
+        }
+        return new __sp_device_category_obj(tempitem);
+    }
+    else {
+        this.catItem = this.iter.getNext();
+        if (typeof this.catItem == "undefined") {
+            this.hasElement = true;
+            this.catItem = null;
+            return null;
+            
+        }
+        else {
+            this.hasElement = true;
+            var tempObject = new Object();
+            tempObject = this.lmItem;
+            //update 
+            
+            this.catItem = this.iter.getNext();
+            if (typeof(this.catItem) == "undefined") {
+                this.catItem = null;
+            }
+            return new __sp_device_category_obj(tempObject);
+        }
+    }
+}
+
+//landmark iterator
+function __sp_landmarks_iterator(js_iterator){
+    this.iter = js_iterator;
+    this.next = __sp_landmarks_iterator_get_next;
+    this.hasNext = __sp_landmarks_iterator_has_next;
+    
+    //indicate whether iterator has been populated atleast once
+    this.hasElement = false;
+    //refers to the current landmark item
+    this.lmItem = null;
+    this.close = __sp_landmarks_landmarkitem_close;
+}
+
+function __sp_landmarks_landmarkitem_close(){
+    this.iter.close();
+}
+
+// Parameter objects
+//converts from LIW position to JS wrapper positionfield object
+function __sp_device_landmark_location_obj(sp_location){
+    this.longitude = (sp_location.Longitude == undefined) ? null : sp_location.Longitude;
+    this.latitude = (sp_location.Latitude == undefined) ? null : sp_location.Latitude;
+    if (sp_location.Altitude) 
+        this.altitude = sp_location.Altitude;
+    if (sp_location.HAccuracy) 
+        this.hAccuracy = sp_location.HAccuracy;
+    if (sp_location.VAccuracy) 
+        this.vAccuracy = sp_location.VAccuracy;
+}
+
+//this is being used for converting position field in criteria for getLandmarks.
+function __sp_landmark_position_obj(location){
+    if ((location.longitude !== undefined) &&
+    (location.longitude !== null) &&
+    (location.longitude !== "")) {
+        this.Longitude = location.longitude;
+    }
+    if ((location.latitude !== undefined) &&
+    (location.latitude !== null) &&
+    (location.latitude !== "")) {
+        this.Latitude = location.latitude;
+    }
+    
+    
+    /*if(location.altitude) 
+    
+     this.Altitude = location.altitude;
+    
+     if(location.hAccuracy)
+    
+     this.HAccuracy = location.hAccuracy;
+    
+     if(location.vAccuracy)
+    
+     this.VAccuracy = location.vAccuracy;*/
+    
+}
+
+//use this to convert from positon filed of landmarkitem to convert it to position field 
+//in LIW of landmark item
+function __sp_landmark_position_obj_fromJS_2LIW(location){
+	var error = new DeviceAPIError(0, "dummy");
+	if (typeof(location) != "object"){
+		throw new DeviceAPIError(error.INVALID_ARG_ERR, 'position must be of type object');	
+	}
+	var loFound = false;
+	var laFound = false;
+	if ((location.longitude !== undefined)
+	     && (location.longitude !== null)
+		 && (location.longitude !== "")){
+		this.Longitude = location.longitude;
+		loFound = true;	 
+	}
+	if ((location.latitude !== undefined)
+	     && (location.latitude !== null)
+		 && (location.latitude !== "")){
+		this.Latitude = location.latitude;
+		laFound = true;	 
+	}
+    if (!(loFound && laFound)) {
+		throw new DeviceAPIError(error.MISSING_ARG_ERR, 'missing position field');
+	}
+    if (location.altitude) 
+        this.Altitude = location.altitude;
+    if (location.hAccuracy) 
+        this.HAccuracy = location.hAccuracy;
+    if (location.vAccuracy) 
+        this.VAccuracy = location.vAccuracy;
+}
+
+function __sp_landmark_bounded_area_obj(area){
+
+    var error = new DeviceAPIError(0, "dummy");
+    var c1Found = false;
+    var c2Found = false;
+    if ((area.coordinate1 !== undefined) &&
+    (area.coordinate1 !== null) &&
+    (area.coordinate1 !== "")) {
+        if (typeof(area.coordinate1) != "object") {
+            throw new DeviceAPIError(error.INVALID_ARG_ERR, 'coordinate1 must be an object');
+        }
+        else {
+            var latFound = false;
+            var longFound = false;
+            if ((area.coordinate1.latitude !== undefined) &&
+            (area.coordinate1.latitude !== null) &&
+            (area.coordinate1.latitude !== "")) {
+                this.NorthLatitude = area.coordinate1.latitude;
+                latFound = true;
+            }
+            
+            
+            if ((area.coordinate1.longitude !== undefined) &&
+            (area.coordinate1.longitude !== null) &&
+            (area.coordinate1.longitude !== "")) {
+                this.EastLongitude = area.coordinate1.longitude;
+                longFound = true;
+            }
+            if (!(latFound && longFound)) {
+                throw new DeviceAPIError(error.MISSING_ARG_ERR, 'missing position field');
+            }
+            c1Found = true;
+            
+        }
+        
+        
+    }
+    if ((area.coordinate2 !== undefined) &&
+    (area.coordinate2 !== null) &&
+    (area.coordinate2 !== "")) {
+        if (typeof(area.coordinate2) != "object") {
+            throw new DeviceAPIError(error.INVALID_ARG_ERR, 'coordinate2 must be an object');
+        }
+        else {
+            var latFound = false;
+            var longFound = false;
+            if ((area.coordinate2.latitude !== undefined) &&
+            (area.coordinate2.latitude !== null) &&
+            (area.coordinate2.latitude !== "")) {
+                this.SouthLatitude = area.coordinate2.latitude;
+                latFound = true;
+            }
+            
+            
+            if ((area.coordinate2.longitude !== undefined) &&
+            (area.coordinate2.longitude !== null) &&
+            (area.coordinate2.longitude !== "")) {
+                this.WestLongitude = area.coordinate2.longitude;
+                longFound = true;
+            }
+            if (!(latFound && longFound)) {
+                throw new DeviceAPIError(error.MISSING_ARG_ERR, 'missing position field');
+            }
+            c2Found = true;
+            
+        }
+        
+        
+    }
+    if (!(c1Found && c2Found)) {
+        throw new DeviceAPIError(error.MISSING_ARG_ERR, 'missing position field');
+    }
+    
+}
+
+
+//converts from LIW address to JS wrapper AddressDetails
+
+function __sp_device_landmark_address_obj(sp_address){
+    if (sp_address.Street) 
+        this.street = sp_address.Street;
+    if (sp_address.City) 
+        this.city = sp_address.City;
+    if (sp_address.state) 
+        this.state = sp_address.state;
+    if (sp_address.AreaCode) 
+        this.postalCode = sp_address.AreaCode;
+    if (sp_address.Country) 
+        this.country = sp_address.Country;
+    if (sp_address.BuildingName) 
+        this.building = sp_address.BuildingName;
+    if (sp_address.Telephone) 
+        this.phone = sp_address.Telephone;
+}
+
+// sp problem: no way to specify state/province?
+
+function __sp_landmark_address_obj(address){
+	var error = new DeviceAPIError(0, "dummy");
+	if (typeof(address) != "object"){
+		throw new DeviceAPIError(error.MISSING_ARG_ERR, 'address must be of type object');	
+	}
+	
+    if (address.street !== undefined){
+		if (address.street === null){
+			this.Street = "";	
+		}
+		else {
+			this.Street = address.street;	
+		}
+			
+	} 
+	if (address.city !== undefined){
+		if (address.city === null){
+			this.City = "";	
+		}
+		else {
+			this.City = address.city;	
+		}
+			
+	} 
+	if (address.state !== undefined){
+		if (address.state === null){
+			this.state = "";	
+		}
+		else {
+			this.state = address.state;	
+		}
+			
+	} 
+	if (address.postalCode !== undefined){
+		if (address.postalCode === null){
+			this.AreaCode = "";	
+		}
+		else {
+			this.AreaCode = address.postalCode;	
+		}
+			
+	} 
+	if (address.country !== undefined){
+		if (address.country === null){
+			this.Country = "";	
+		}
+		else {
+			this.Country = address.country;	
+		}
+			
+	} 
+	if (address.building !== undefined){
+		if (address.building === null){
+			this.BuildingName = "";	
+		}
+		else {
+			this.BuildingName = address.building;	
+		}
+			
+	} 
+	if (address.phone !== undefined){
+		if (address.phone === null){
+			this.Telephone = "";	
+		}
+		else {
+			this.Telephone = address.phone;	
+		}
+			
+	} 
+    
+}
+
+function __sp_add_category_ids_for_names(names){
+    var errObj = new DeviceAPIError(0, "dummy");
+    var retval = new Array();
+    
+    for (var i in names) {
+        if ((names[i] !== undefined) &&
+        (names[i] !== "") &&
+        (names[i] !== null)) {
+            if (typeof(names[i]) != "string") {
+                throw new DeviceAPIError(errObj.INVALID_ARG_ERR, 'category should be of type string');
+            }
+            else {
+                retval.push(names[i].toString());
+            }
+            
+            
+        }
+        
+    }
+    return retval;
+}
+
+function __sp_get_category_ids_for_names(names){
+    var errObj = new DeviceAPIError(0, "dummy");
+    var retval = new Array();
+    var isCatGlobal = 0;// to check if the category passed is a global category
+    for (var i in names) {
+        if (typeof(names[i]) != "string") {
+            throw new DeviceAPIError(errObj.INVALID_ARG_ERR, 'category should be of type string');
+        }
+        for (var ii in __sp_category_list) {
+            //__device_debug(names[i] + " ==? " + __sp_category_list[ii].name);
+            
+            if (__sp_category_list[ii].name.toLowerCase() == names[i].toLowerCase()) {
+                retval.push(__sp_category_list[ii].id.toString());
+                isCatGlobal = 1;
+            }
+        }
+        if (isCatGlobal == 0) {
+            return null;
+        }
+        isCatGlobal = 0;// set the flag to 0
+    }
+    return retval;
+}
+
+//converts from LIW to JS wrapper paramater
+function __sp_device_landmark_obj(sp_landmark){
+    this.landmarkId = sp_landmark.id;
+    if (sp_landmark.LandmarkName) {
+        this.name = sp_landmark.LandmarkName;
+    }
+    if (sp_landmark.LandmarkDesc) {
+        this.description = sp_landmark.LandmarkDesc;
+    }
+    if (sp_landmark.CoverageRadius) {
+        this.coverageRadius = sp_landmark.CoverageRadius;
+    }
+    if (sp_landmark.LandmarkPosition) {
+        this.position = new __sp_device_landmark_location_obj(sp_landmark.LandmarkPosition);
+    }
+    if (sp_landmark.CategoryInfo) {
+        this.categoryIds = sp_landmark.CategoryInfo;
+    }
+    
+    if (sp_landmark.LandmarkFields) {
+        this.address = new __sp_device_landmark_address_obj(sp_landmark.LandmarkFields);
+    }
+}
+
+function __sp_landmarks_addLocality(add){
+    var errLoc = new DeviceAPIError(0, "dummy");
+    if (typeof(add) != "object") {
+        throw new DeviceAPIError(errLoc.INVALID_ARG_ERR, 'address should be of type object');
+    }
+    if ((add.street !== undefined) &&
+    (add.street !== null) &&
+    (add.street !== "")) {
+    
+        this.Street = add.street;
+        
+    }
+    if ((add.city !== undefined) &&
+    (add.city !== null) &&
+    (add.city !== "")) {
+    
+        this.City = add.city;
+        
+    }
+    if ((add.state !== undefined) &&
+    (add.state !== null) &&
+    (add.state !== "")) {
+    
+        this.state = add.state;
+        
+    }
+    if ((add.postalCode !== undefined) &&
+    (add.postalCode !== null) &&
+    (add.postalCode !== "")) {
+    
+        this.AreaCode = add.postalCode;
+        
+    }
+    if ((add.country !== undefined) &&
+    (add.country !== null) &&
+    (add.country !== "")) {
+    
+        this.Country = add.country;
+        
+    }
+    if ((add.building !== undefined) &&
+    (add.building !== null) &&
+    (add.building !== "")) {
+    
+        this.BuildingName = add.building;
+        
+    }
+    if ((add.phone !== undefined) &&
+    (add.phone !== null) &&
+    (add.phone !== "")) {
+    
+        this.Telephone = add.phone;
+        
+    }
+}
+
+function __sp_landmarks_addPosition(pos){
+    var errPos = new DeviceAPIError(0, "dummy");
+    if (typeof(pos) != "object") {
+        throw new DeviceAPIError(errPos.INVALID_ARG_ERR, 'position should be of type object');
+    }
+    
+    if ((pos.longitude !== undefined) &&
+    (pos.longitude !== null) &&
+    (pos.longitude !== "")) {
+    
+        this.Longitude = pos.longitude;
+        //alert("longitude found");
+    
+    }
+    if ((pos.latitude !== undefined) &&
+    (pos.latitude !== null) &&
+    (pos.latitude !== "")) {
+    
+        this.Latitude = pos.latitude;
+        //alert("latitude found");
+    
+    }
+    if ((pos.altitude !== undefined) &&
+    (pos.altitude !== null) &&
+    (pos.altitude !== "")) {
+    
+        this.Altitude = pos.altitude;
+        
+    }
+    if ((pos.hAccuracy !== undefined) &&
+    (pos.hAccuracy !== null) &&
+    (pos.hAccuracy !== "")) {
+    
+        this.HAccuracy = pos.hAccuracy;
+        
+    }
+    if ((pos.vAccuracy !== undefined) &&
+    (pos.vAccuracy !== null) &&
+    (pos.vAccuracy !== "")) {
+    
+        this.VAccuracy = pos.vAccuracy;
+        
+    }
+}
+
+function __sp_landmarks_addLmObject(lm){
+    var posSet = false;
+    var errObj = new DeviceAPIError(0, "dummy");
+    if ((lm.name !== undefined) &&
+    (lm.name !== null) &&
+    (lm.name !== "")) {
+    
+        this.LandmarkName = lm.name;
+        
+    }
+    if ((lm.description !== undefined) &&
+    (lm.description !== null) &&
+    (lm.description !== "")) {
+    
+        this.LandmarkDesc = lm.description;
+        
+    }
+    if ((lm.position !== undefined) &&
+    (lm.position !== null) &&
+    (lm.position !== "")) {
+        //alert("adding position");
+        this.LandmarkPosition = new __sp_landmarks_addPosition(lm.position);
+        posSet = true;
+        //alert("pos="+this.position); 
+    
+    }
+    if ((lm.coverageRadius !== undefined) &&
+    (lm.coverageRadius !== null) &&
+    (lm.coverageRadius !== "")) {
+    
+        if (posSet) {
+            this.CoverageRadius = lm.coverageRadius;
+        }
+        else {
+            throw new DeviceAPIError(errObj.MISSING_ARG_ERR, 'missing position');
+        }
+        
+        
+    }
+    
+    if ((lm.categoryIds !== undefined) &&
+    (lm.categoryIds !== null) &&
+    (lm.categoryIds !== "")) {
+        if (typeof(lm.categoryIds) != 'object') {
+            throw new DeviceAPIError(errObj.INVALID_ARG_ERR, 'categoryids should be of type object');
+        }
+        
+        this.CategoryInfo = __sp_add_category_ids_for_names(lm.categoryIds);
+        if (!this.CategoryInfo) {
+            throw new DeviceAPIError(errObj.MISSING_ARG_ERR, 'invalid category');
+            
+        }
+        
+    }
+    if ((lm.address !== undefined) &&
+    (lm.address !== null) &&
+    (lm.address !== "")) {
+    
+        this.LandmarkFields = new __sp_landmarks_addLocality(lm.address);
+        
+    }
+    //dummy object
+    this.dummyField = "dummyfield";
+    
+}
+
+//this converts from JS landmarkitem to LIW landmark item
+//being used by updateLandmark API
+function __sp_landmark_obj(landmark, str){
+	var error = new DeviceAPIError(0, "dummy");
+    if (landmark.name !== undefined){
+		if (landmark.name === null){
+			this.LandmarkName = "";	
+		}
+		else {
+			this.LandmarkName = landmark.name;	
+		}
+		
+	} 
+        
+    if ((landmark.landmarkId === undefined)
+	     || (landmark.landmarkId === null)
+		 || (landmark.landmarkId === "")) 
+		 throw new DeviceAPIError(error.MISSING_ARG_ERR, 'for updating; id must be supplied');
+	else 
+        this.id = landmark.landmarkId;
+    if (landmark.description !== undefined){
+		if (landmark.description === null){
+			this.LandmarkDesc = "";	
+		}
+		else {
+			this.LandmarkDesc = landmark.description;	
+		}
+		
+	} 
+        
+    if (landmark.position) 
+        this.LandmarkPosition = new __sp_landmark_position_obj_fromJS_2LIW(landmark.position);
+    if (landmark.coverageRadius) 
+        this.CoverageRadius = landmark.coverageRadius;
+    if (landmark.categories) {
+        this.CategoryInfo = __sp_get_category_ids_for_names(landmark.categories);
+        if (!this.CategoryInfo) {
+            throw new DeviceError("Landmarks: " + str + "Category is invalid", err_bad_argument);
+        }
+    }
+    if (landmark.address) 
+        this.LandmarkFields = new __sp_landmark_address_obj(landmark.address);
+    
+	this.temp = "dummy";
+}
+
+function __sp_landmarks_iterator_has_next(){
+    if (this.hasElement) {
+        if (this.lmItem !== null) {
+            return true;
+        }
+        else {
+            return false;
+        }
+        
+    }
+    else {
+        this.lmItem = this.iter.getNext();
+        this.hasElement = true;
+        if (typeof this.lmItem == "undefined") {
+            this.lmItem = null;
+            return false;
+        }
+        else {
+            return true;
+        }
+    }
+}
+
+function __sp_landmarks_iterator_get_next(){
+    if (this.hasElement) {
+        var tempitem = new Object();
+        tempitem = this.lmItem;
+        //update
+        this.lmItem = this.iter.getNext();
+        if (typeof(this.lmItem) == "undefined") {
+            this.lmItem = null;
+        }
+        return new __sp_device_landmark_obj(tempitem);
+    }
+    else {
+        this.lmItem = this.iter.getNext();
+        if (typeof this.lmItem == "undefined") {
+            this.hasElement = true;
+            this.lmItem = null;
+            return null;
+            
+        }
+        else {
+            this.hasElement = true;
+            var tempObject = new Object();
+            tempObject = this.lmItem;
+            //update 
+            
+            this.lmItem = this.iter.getNext();
+            if (typeof(this.lmItem) == "undefined") {
+                this.lmItem = null;
+            }
+            return new __sp_device_landmark_obj(tempObject);
+        }
+    }
+    
+}
+
+function __sp_category_obj(category){
+    if (category.name) 
+        this.CategoryName = category.name;
+    if (category.categoryId) 
+        this.id = category.categoryId;
+}
+
+function __sp_device_category_obj(sp_category){
+    this.categoryId = sp_category.id;
+    this.name = sp_category.CategoryName;
+}
+
+/* --------- Public methods ---------- */
+
+
+var LANDMARKS_APP_ID = 0x101F85A2;
+
+// Apps should take care that this is not reinvoked
+// while the editor is already running. 
+
+function __sp_landmarks_startEditor(__success_cb, landmark_item, _error_cb){
+    // internal variable used in this library implementation
+    // This will made local variable when seperate module js files gets integrated in this file.
+    error = new DeviceAPIError(0, "dummy");
+    if ((__success_cb === undefined) ||
+    (__success_cb === null) ||
+    (__success_cb === "")) 
+        throw new DeviceAPIError(error.MISSING_ARG_ERR, 'StartEditor:Missing Success Callback');
+    
+    if ((typeof __success_cb) != "function") 
+        throw new DeviceAPIError(error.INVALID_ARG_ERR, 'StartEditor:Success Callback must be of type function');
+    
+    if (landmark_item !== undefined) {
+        if ((landmark_item !== null) &&
+        (landmark_item !== "")) {
+        
+            throw new DeviceAPIError(error.NOT_SUPPORTED_ERR, 'startEditor:landmark item is not supported');
+            
+        }
+    }
+    
+    if ((_error_cb !== undefined) &&
+    (_error_cb !== null) &&
+    (_error_cb !== "")) {
+        if ((typeof _error_cb) != "function") 
+            throw new DeviceAPIError(error.INVALID_ARG_ERR, 'StartEditor:error callback must be of type function');
+    }
+    
+    var LANDMARKS_APP_ID = 0x101F85A2;
+    
+    
+    var __s60_start_and_wait_cb;
+    
+    function __s60_on_app_exit(){
+        window.xwidget.onshow = null;
+        if (__s60_start_and_wait_cb) {
+            __s60_start_and_wait_cb();
+        }
+    }
+    
+    var finished = function(arg1, arg2, arg3){
+        __success_cb(arg1, arg2, arg3);
+    };
+    __s60_start_and_wait(LANDMARKS_APP_ID, '', finished);
+    
+}
+
+//oriiginal signature category_cb, name
+
+function __sp_landmarks_category_getList_cb(arg1, arg2, arg3){
+    var CbObj;
+    var category_cb;
+    var ErrorCallback;
+    if (this.temporarySCb) {
+        category_cb = this.temporarySCb;
+        ErrorCallback = this.temporaryECb;
+        this.temporarySCb = null;
+        this.temporaryECb = null;
+    }
+    else {
+        CbObj = glob_obj.getFromArray(arg1);
+        if (CbObj) {
+            category_cb = CbObj.success_cb;
+            ErrorCallback = CbObj.error_cb;
+        }
+        
+        else {
+            alert("Landmarks: __sp_landmarks_category_getList_cb: Callback not found ");
+            return;
+        }
+    }
+    
+    
+    var iter = null;
+    //if there is an error invoke user supplied error callback
+    if (arg3.ErrorCode || (arg2 == 4)) { //indicates an error
+        var scbErrCode = convertFromPS2JS(arg3.ErrorCode);
+        var erroObject = new DeviceAPIError(scbErrCode, arg3.ErrorMessage);
+        if (ErrorCallback) {
+            ErrorCallback(erroObject);
+        }
+    }
+    else {
+        if (arg3.ReturnValue) {
+            iter = new __sp_landmarks_category_iterator(arg3.ReturnValue);
+            category_cb(iter);
+        }
+    }
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_landmarks_category_getList(category_cb, name, ErrorCallback){
+    try {
+        //alert("calling getlist");
+        var error = new DeviceAPIError(0, "dummy");
+        //succes callback must be defined and should be of the type function
+        if ((category_cb === undefined) ||
+        (category_cb === "") ||
+        (category_cb === null)) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'callback is missing');
+        }
+        if (typeof(category_cb) != "function") {
+            throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid callback argument');
+        }
+        //check if errorcallback has been supplied and valid
+        var errcbFound = false;
+        if ((ErrorCallback !== undefined) &&
+        (ErrorCallback !== null) &&
+        (ErrorCallback !== "")) {
+            if (typeof(ErrorCallback) != "function") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid error callback argument');
+            }
+            else {
+                errcbFound = true;
+            }
+        }
+        //to check from here
+        var criteria = new Object();
+        modifyObjectBaseProp(criteria);
+        criteria.Type = "Category";
+        //if name has been supplied it must be of type string
+        if ((name !== undefined) &&
+        (name !== null) &&
+        (name !== "")) {
+        
+            if (typeof(name) != "string") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'name must be a string');
+            }
+            
+        }
+        
+        if (name) {
+            criteria.Filter = new Object();
+            modifyObjectBaseProp(criteria.Filter);
+            criteria.Filter.CategoryName = name;
+            criteria.Filter.PreviousMatchesOnly = false;
+        }
+        
+        this.temporarySCb = category_cb;
+        this.temporaryECb = ErrorCallback;
+        
+        var rval = this.so.IDataSource.GetList(criteria, this.getCategoriesCb);
+        
+        if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, category_cb, ErrorCallback);
+        }
+        
+        if (rval.ErrorCode != 0) {
+            switch (rval.ErrorCode) {
+                case 1003:
+                    throw new DeviceAPIError(error.MISSING_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case 1002:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case 1004:
+                    throw new DeviceAPIError(error.NOT_SUPPORTED_ERR, rval.ErrorMessage);
+                    break;
+                case 1000:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                default:
+                    throw new DeviceAPIError(-101, "unknown error message");
+                    
+            }
+            
+        }
+        return rval.TransactionID;
+        
+        
+    } 
+    catch (e) {
+        //alert("exception from here");
+        throw e;
+    }
+}
+
+function __sp_landmarks_category_add_cb(arg1, arg2, arg3){
+    var CbObj;
+    var callback;
+    var ErrorCallback;
+    if (this.temporarySCb) {
+        category_cb = this.temporarySCb;
+        ErrorCallback = this.temporaryECb;
+        this.temporarySCb = null;
+        this.temporaryECb = null;
+    }
+    else {
+        CbObj = glob_obj.getFromArray(arg1);
+        if (CbObj) {
+            callback = CbObj.success_cb;
+            ErrorCallback = CbObj.error_cb;
+        }
+        
+        else {
+            alert("Landmarks: __sp_landmarks_category_add_cb: Callback not found ");
+            return;
+        }
+    }
+    
+    
+    var id = null;
+    //if there is an error invoke user supplied error callback
+    if (arg2 == 4 || arg3.ErrorCode) { //indicates an error
+        var scbErrCode = convertFromPS2JS(arg3.ErrorCode);
+        var erroObject = new DeviceAPIError(scbErrCode, arg3.ErrorMessage);
+        if (ErrorCallback) {
+            ErrorCallback(erroObject);
+        }
+    }
+    else {
+        if (arg3.ReturnValue) {
+            id = arg3.ReturnValue;
+        }
+        //in case of success invoke user supplied scb
+        callback(id);
+    }
+    glob_obj.removeFromArray(arg1);
+}
+
+//original signature : __sp_landmarks_category_add(cat)
+function __sp_landmarks_category_add(callback, categoryItem, ErrorCallback){
+    try {
+        var error = new DeviceAPIError(0, "dummy");
+        var isErrCB = true;//indicates a valid errocalback has been supplied
+        if (callback === undefined) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'AddSucessCallback is missing');
+        }
+        else {
+            if (((callback === null) ||
+            (callback === "")) &&
+            (typeof(callback) != "number")) {
+                throw new DeviceAPIError(error.MISSING_ARG_ERR, 'AddSucessCallback is missing');
+            }
+            else 
+                if (typeof(callback) != 'function') {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid AddSucessCallback argument');
+                }
+        }
+        if (categoryItem === undefined || categoryItem === null) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'CategoryItem is missing');
+        }
+        else 
+            if (typeof(categoryItem) !== "object") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid CategoryItem argument');
+            }
+        
+        if ((ErrorCallback != undefined)) {
+            if ((!ErrorCallback) &&
+            (typeof(ErrorCallback) != "number")) {
+                isErrCB = false;
+            }
+            else 
+                if ((typeof(ErrorCallback) != 'function')) {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid ErrorCallback callback');
+                }
+            
+        }
+        else {
+            isErrCB = false;
+        }
+        
+        var criteria = new Object();
+        modifyObjectBaseProp(criteria);
+        criteria.Type = "Category";
+        criteria.Data = new __sp_category_obj(categoryItem);
+		
+		this.temporarySCb = callback;
+        this.temporaryECb = ErrorCallback;
+		
+        var rval = this.so.IDataSource.Add(criteria, this.addCategoryCb);
+        
+        if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, callback, ErrorCallback);
+        }
+        if (rval.ErrorCode != 0) {
+            switch (rval.ErrorCode) {
+                case err_missing_argument:
+                    throw new DeviceAPIError(error.MISSING_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_bad_argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_ServiceNotSupported:
+                    throw new DeviceAPIError(error.NOT_SUPPORTED_ERR, rval.ErrorMessage);
+                    break;
+                case err_InvalidService_Argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                default:
+                    throw new DeviceAPIError(-101, "unknown error message");
+            }
+        }
+        return rval.TransactionID;
+    } 
+    catch (e) {
+        throw e;
+    }
+}
+
+function __sp_landmarks_add_cb(arg1, arg2, arg3){
+    var id = null;
+    var CbObj;
+    var callback;
+    var ErrorCallback;
+	if (this.temporarySCb) {
+        category_cb = this.temporarySCb;
+        ErrorCallback = this.temporaryECb;
+        this.temporarySCb = null;
+        this.temporaryECb = null;
+    }
+    else {
+        CbObj = glob_obj.getFromArray(arg1);
+        if (CbObj) {
+            callback = CbObj.success_cb;
+            ErrorCallback = CbObj.error_cb;
+        }
+        
+        else {
+            alert("Landmarks: __sp_landmarks_add_cb: Callback not found ");
+            return;
+        }
+    }
+    
+    //if there is an error invoke user supplied error callback
+    if (arg2 == 4 || arg3.ErrorCode) { //indicates an error
+        var scbErrCode = convertFromPS2JS(arg3.ErrorCode);
+        var erroObject = new DeviceAPIError(scbErrCode, arg3.ErrorMessage);
+        if (ErrorCallback) {
+            ErrorCallback(erroObject);
+        }
+    }
+    else {
+        if (arg3.ReturnValue) {
+            id = arg3.ReturnValue;
+        }
+        //in case of success invoke user supplied scb
+        callback(id);
+    }
+    glob_obj.removeFromArray(arg1);
+}
+
+//original signature : __sp_landmarks_add(landmark)
+function __sp_landmarks_add(callback, landmarkItem, ErrorCallback){
+    try {
+        var error = new DeviceAPIError(0, "dummy");
+        var isErrCB = true;//indicates a valid errocalback has been supplied
+        if (callback === undefined) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'AddSucessCallback is missing');
+        }
+        else {
+            if (((callback === null) ||
+            (callback === "")) &&
+            (typeof(callback) != "number")) {
+                throw new DeviceAPIError(error.MISSING_ARG_ERR, 'AddSucessCallback is missing');
+            }
+            else 
+                if (typeof(callback) != 'function') {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid AddSucessCallback argument');
+                }
+        }
+        if ((landmarkItem === undefined) ||
+        (landmarkItem === null) ||
+        (landmarkItem === "")) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'LandmarkItem is missing');
+        }
+        else 
+            if (typeof(landmarkItem) !== "object") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid LandmarkItem argument');
+            }
+        
+        if ((ErrorCallback != undefined)) {
+            if ((!ErrorCallback) &&
+            (typeof(ErrorCallback) != "number")) {
+                isErrCB = false;
+            }
+            else 
+                if ((typeof(ErrorCallback) != 'function')) {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid ErrorCallback callback');
+                }
+            
+        }
+        else {
+            isErrCB = false;
+        }
+        
+        
+        var str = "addLandmark: ";
+        var criteria = new Object();
+        modifyObjectBaseProp(criteria);
+        criteria.Type = "Landmark";
+        //criteria.Data = new __sp_landmark_obj(landmarkItem, str);
+        criteria.Data = new __sp_landmarks_addLmObject(landmarkItem);
+        //alert("calling PS add");
+		this.temporarySCb = callback;
+        this.temporaryECb = ErrorCallback;
+        var rval = this.so.IDataSource.Add(criteria, this.addLandmarkCb);
+        //alert("rval.tid="+rval.TransactionID);
+        //alert("rval.error="+rval.ErrorCode);
+        if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, callback, ErrorCallback);
+        }
+        
+        if (rval.ErrorCode != 0) {
+            switch (rval.ErrorCode) {
+                case err_missing_argument:
+                    throw new DeviceAPIError(error.MISSING_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_bad_argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_ServiceNotSupported:
+                    throw new DeviceAPIError(error.NOT_SUPPORTED_ERR, rval.ErrorMessage);
+                    break;
+                case err_InvalidService_Argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                default:
+                    throw new DeviceAPIError(-101, "unknown error message");
+            }
+        }
+        return rval.TransactionID;
+    } 
+    catch (e) {
+        throw e;
+    }
+}
+
+function __sp_landmarks_delete_cb(arg1, arg2, arg3){
+    var callback;
+    var ErrorCallback;
+    var CbObj;
+	if (this.temporarySCb) {
+        category_cb = this.temporarySCb;
+        ErrorCallback = this.temporaryECb;
+        this.temporarySCb = null;
+        this.temporaryECb = null;
+    }
+    else {
+        CbObj = glob_obj.getFromArray(arg1);
+        if (CbObj) {
+            callback = CbObj.success_cb;
+            ErrorCallback = CbObj.error_cb;
+        }
+        
+        else {
+            alert("Landmarks: __sp_landmarks_delete_cb: Callback not found ");
+            return;
+        }
+    }
+    
+    //if there is an error invoke user supplied error callback
+    if (arg2 == 4 || arg3.ErrorCode) { //indicates an error
+        var scbErrCode = convertFromPS2JS(arg3.ErrorCode);
+        var erroObject = new DeviceAPIError(scbErrCode, arg3.ErrorMessage);
+        if (ErrorCallback) {
+            ErrorCallback(erroObject);
+        }
+    }
+    else {
+        //in case of success invoke user supplied scb
+        callback();
+    }
+    glob_obj.removeFromArray(arg1);
+}
+
+//original signature : __sp_landmarks_delete(id)
+function __sp_landmarks_delete(callback, landmarkId, ErrorCallback){
+    try {
+        var error = new DeviceAPIError(0, "dummy");
+        var isErrCB = true;//indicates a valid errocalback has been supplied
+        if (callback === undefined) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'SucessCallback is missing');
+        }
+        else {
+            if (((callback === null) ||
+            (callback === "")) &&
+            (typeof(callback) != "number")) {
+                throw new DeviceAPIError(error.MISSING_ARG_ERR, 'SucessCallback is missing');
+            }
+            else 
+                if (typeof(callback) != 'function') {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid SucessCallback argument');
+                }
+        }
+        if (landmarkId === undefined || landmarkId === null) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'landmarkId is missing');
+        }
+        else 
+            if (typeof(landmarkId) !== "string") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid landmarkId argument');
+            }
+        
+        if ((ErrorCallback != undefined)) {
+            if ((!ErrorCallback) &&
+            (typeof(ErrorCallback) != "number")) {
+                isErrCB = false;
+            }
+            else 
+                if ((typeof(ErrorCallback) != 'function')) {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid ErrorCallback callback');
+                }
+            
+        }
+        else {
+            isErrCB = false;
+        }
+        
+        
+        var criteria = new Object();
+        modifyObjectBaseProp(criteria);
+        criteria.Type = "Landmark";
+        criteria.Data = new Object();
+        modifyObjectBaseProp(criteria.Data);
+        criteria.Data.id = landmarkId;
+		
+		this.temporarySCb = callback;
+        this.temporaryECb = ErrorCallback;
+		
+        var rval = this.so.IDataSource.Delete(criteria, this.deleteLandmarkCb);
+        if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, callback, ErrorCallback);
+        }
+        if (rval.ErrorCode != 0) {
+            switch (rval.ErrorCode) {
+                case err_missing_argument:
+                    throw new DeviceAPIError(error.MISSING_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_bad_argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_ServiceNotSupported:
+                    throw new DeviceAPIError(error.NOT_SUPPORTED_ERR, rval.ErrorMessage);
+                    break;
+                case err_InvalidService_Argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                default:
+                    throw new DeviceAPIError(-101, "unknown error message");
+            }
+        }
+        return rval.TransactionID;
+    } 
+    catch (e) {
+        throw e;
+    }
+}
+
+function __sp_landmarks_update_cb(arg1, arg2, arg3){
+
+    var callback;
+    var ErrorCallback;
+    var CbObj;
+		if (this.temporarySCb) {
+        category_cb = this.temporarySCb;
+        ErrorCallback = this.temporaryECb;
+        this.temporarySCb = null;
+        this.temporaryECb = null;
+    }
+    else {
+        CbObj = glob_obj.getFromArray(arg1);
+        if (CbObj) {
+            callback = CbObj.success_cb;
+            ErrorCallback = CbObj.error_cb;
+        }
+        
+        else {
+            alert("Landmarks: __sp_landmarks_update_cb: Callback not found ");
+            return;
+        }
+    }
+    
+    //if there is an error invoke user supplied error callback
+    if (arg2 == 4 || arg3.ErrorCode) { //indicates an error
+        var scbErrCode = convertFromPS2JS(arg3.ErrorCode);
+        var erroObject = new DeviceAPIError(scbErrCode, arg3.ErrorMessage);
+        if (ErrorCallback) {
+            ErrorCallback(erroObject);
+        }
+    }
+    else {
+        //in case of success invoke user supplied scb
+        callback();
+    }
+    glob_obj.removeFromArray(arg1);
+}
+
+//original signature : __sp_landmarks_update(landmark)
+function __sp_landmarks_update(callback, landmarkItem, ErrorCallback){
+    try {
+        var error = new DeviceAPIError(0, "dummy");
+        var isErrCB = true;//indicates a valid errocalback has been supplied
+        if (callback === undefined) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'SuccessCallback is missing');
+        }
+        else {
+            if (((callback === null) ||
+            (callback === "")) &&
+            (typeof(callback) != "number")) {
+                throw new DeviceAPIError(error.MISSING_ARG_ERR, 'SuccessCallback is missing');
+            }
+            else 
+                if (typeof(callback) != 'function') {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid SuccessCallback argument');
+                }
+        }
+        if (landmarkItem === undefined || landmarkItem === null || landmarkItem === "") {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'LandmarkItem is missing');
+        }
+        else 
+            if (typeof(landmarkItem) !== "object") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid LandmarkItem argument');
+            }
+        
+        if ((ErrorCallback != undefined)) {
+            if ((!ErrorCallback) &&
+            (typeof(ErrorCallback) != "number")) {
+                isErrCB = false;
+            }
+            else 
+                if ((typeof(ErrorCallback) != 'function')) {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid ErrorCallback callback');
+                }
+            
+        }
+        else {
+            isErrCB = false;
+        }
+        
+        
+        var str = "updateLandmark: ";
+        var criteria = new Object();
+        modifyObjectBaseProp(criteria);
+        criteria.Type = "Landmark";
+        criteria.Data = new __sp_landmark_obj(landmarkItem, str);
+		
+		this.temporarySCb = callback;
+        this.temporaryECb = ErrorCallback;
+        var rval = this.so.IDataSource.Add(criteria, this.updateLandmarkCb);
+        if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, callback, ErrorCallback);
+        }
+        
+        if (rval.ErrorCode != 0) {
+            switch (rval.ErrorCode) {
+                case err_missing_argument:
+                    throw new DeviceAPIError(error.MISSING_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_bad_argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_ServiceNotSupported:
+                    throw new DeviceAPIError(error.NOT_SUPPORTED_ERR, rval.ErrorMessage);
+                    break;
+                case err_InvalidService_Argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                default:
+                    throw new DeviceAPIError(-101, "unknown error message");
+            }
+        }
+        return rval.TransactionID;
+    } 
+    catch (e) {
+        throw e;
+    }
+}
+
+function __sp_landmarks_category_update_cb(arg1, arg2, arg3){
+    var callback;
+    var ErrorCallback;
+    var CbObj;
+	if (this.temporarySCb) {
+        category_cb = this.temporarySCb;
+        ErrorCallback = this.temporaryECb;
+        this.temporarySCb = null;
+        this.temporaryECb = null;
+    }
+    else {
+        CbObj = glob_obj.getFromArray(arg1);
+        if (CbObj) {
+            callback = CbObj.success_cb;
+            ErrorCallback = CbObj.error_cb;
+        }
+        
+        else {
+            alert("Landmarks: __sp_landmarks_category_update_cb: Callback not found ");
+            return;
+        }
+    }
+    
+    //if there is an error invoke user supplied error callback
+    if (arg2 == 4 || arg3.ErrorCode) { //indicates an error
+        var scbErrCode = convertFromPS2JS(arg3.ErrorCode);
+        var erroObject = new DeviceAPIError(scbErrCode, arg3.ErrorMessage);
+        if (ErrorCallback) {
+            ErrorCallback(erroObject);
+        }
+    }
+    else {
+        //in case of success invoke user supplied scb
+        callback();
+    }
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_landmarks_category_update(callback, categoryItem, ErrorCallback){
+    try {
+        var error = new DeviceAPIError(0, "dummy");
+        var isErrCB = true;//indicates a valid errocalback has been supplied
+        if (callback === undefined) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'SucessCallback is missing');
+        }
+        else {
+            if (((callback === null) ||
+            (callback === "")) &&
+            (typeof(callback) != "number")) {
+                throw new DeviceAPIError(error.MISSING_ARG_ERR, 'SucessCallback is missing');
+            }
+            else 
+                if (typeof(callback) != 'function') {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid SucessCallback argument');
+                }
+        }
+        if (categoryItem === undefined || categoryItem === null || categoryItem === "") {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'CategoryItem is missing');
+        }
+        else 
+            if (typeof(categoryItem) !== "object") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid CategoryItem argument');
+            }
+        if ((categoryItem.categoryId === undefined)
+		     || (categoryItem.categoryId === null)
+			 || (categoryItem.categoryId === "")){
+			 throw new DeviceAPIError(error.MISSING_ARG_ERR, 'categoryId is missing');	
+		}
+		if (typeof (categoryItem.categoryId) != "string") {
+			throw new DeviceAPIError(error.INVALID_ARG_ERR, 'category Id must be a string');
+		}
+        if ((ErrorCallback != undefined)) {
+            if ((!ErrorCallback) &&
+            (typeof(ErrorCallback) != "number")) {
+                isErrCB = false;
+            }
+            else 
+                if ((typeof(ErrorCallback) != 'function')) {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid ErrorCallback callback');
+                }
+        }
+        else {
+            isErrCB = false;
+        }
+        
+        
+        var criteria = new Object();
+        modifyObjectBaseProp(criteria);
+        criteria.Type = "Category";
+        criteria.Data = new __sp_category_obj(categoryItem);
+		
+		this.temporarySCb = callback;
+        this.temporaryECb = ErrorCallback;
+		
+        var rval = this.so.IDataSource.Add(criteria, this.updateCategoryCb);
+        
+        if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, callback, ErrorCallback);
+        }
+        
+        if (rval.ErrorCode != 0) {
+            switch (rval.ErrorCode) {
+                case err_missing_argument:
+                    throw new DeviceAPIError(error.MISSING_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_bad_argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_ServiceNotSupported:
+                    throw new DeviceAPIError(error.NOT_SUPPORTED_ERR, rval.ErrorMessage);
+                    break;
+                case err_InvalidService_Argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                default:
+                    throw new DeviceAPIError(-101, "unknown error message");
+            }
+        }
+        return rval.TransactionID;
+    } 
+    catch (e) {
+        throw e;
+    }
+}
+
+function __sp_landmarks_category_delete_cb(arg1, arg2, arg3){
+    var callback;
+    var ErrorCallback;
+    var CbObj;
+    if (this.temporarySCb) {
+        category_cb = this.temporarySCb;
+        ErrorCallback = this.temporaryECb;
+        this.temporarySCb = null;
+        this.temporaryECb = null;
+    }
+    else {
+        CbObj = glob_obj.getFromArray(arg1);
+        if (CbObj) {
+            callback = CbObj.success_cb;
+            ErrorCallback = CbObj.error_cb;
+        }
+        
+        else {
+            alert("Landmarks: __sp_landmarks_category_delete_cb: Callback not found ");
+            return;
+        }
+    }
+    
+    //if there is an error invoke user supplied error callback
+    if (arg2 == 4 || arg3.ErrorCode) { //indicates an error
+        var scbErrCode = convertFromPS2JS(arg3.ErrorCode);
+        var erroObject = new DeviceAPIError(scbErrCode, arg3.ErrorMessage);
+        if (ErrorCallback) {
+            ErrorCallback(erroObject);
+        }
+    }
+    else {
+        //in case of success invoke user supplied scb
+        callback();
+    }
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_landmarks_category_delete(callback, categoryId, ErrorCallback){
+    try {
+        var error = new DeviceAPIError(0, "dummy");
+        var isErrCB = true;//indicates a valid errocalback has been supplied
+        if (callback === undefined) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'SucessCallback is missing');
+        }
+        else {
+            if (((callback === null) ||
+            (callback === "")) &&
+            (typeof(callback) != "number")) {
+                throw new DeviceAPIError(error.MISSING_ARG_ERR, 'SucessCallback is missing');
+            }
+            else 
+                if (typeof(callback) != 'function') {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid SucessCallback argument');
+                }
+        }
+        if (categoryId === undefined || categoryId === null) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'categoryId is missing');
+        }
+        else 
+            if (typeof(categoryId) !== "string") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid categoryId argument');
+            }
+        
+        if ((ErrorCallback != undefined)) {
+            if ((!ErrorCallback) &&
+            (typeof(ErrorCallback) != "number")) {
+                isErrCB = false;
+            }
+            else 
+                if ((typeof(ErrorCallback) != 'function')) {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid ErrorCallback callback');
+                }
+            
+        }
+        else {
+            isErrCB = false;
+        }
+        
+        
+        var criteria = new Object();
+        modifyObjectBaseProp(criteria);
+        criteria.Type = "Category";
+        criteria.Data = new Object();
+        modifyObjectBaseProp(criteria.Data);
+        criteria.Data.id = categoryId;
+		
+		this.temporarySCb = callback;
+        this.temporaryECb = ErrorCallback;
+		
+        var rval = this.so.IDataSource.Delete(criteria, this.deleteCategoryCb);
+        if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, callback, ErrorCallback);
+        }
+        
+        if (rval.ErrorCode != 0) {
+            switch (rval.ErrorCode) {
+                case err_missing_argument:
+                    throw new DeviceAPIError(error.MISSING_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_bad_argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_ServiceNotSupported:
+                    throw new DeviceAPIError(error.NOT_SUPPORTED_ERR, rval.ErrorMessage);
+                    break;
+                case err_InvalidService_Argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                default:
+                    throw new DeviceAPIError(-101, "unknown error message");
+            }
+        }
+        return rval.TransactionID;
+    } 
+    catch (e) {
+        throw e;
+    }
+}
+
+function __sp_landmarks_getList_cb(arg1, arg2, arg3){
+    var iter = null;
+    var callback;
+    var ErrorCallback;
+    var CbObj;
+    if (this.temporarySCb) {
+        category_cb = this.temporarySCb;
+        ErrorCallback = this.temporaryECb;
+        this.temporarySCb = null;
+        this.temporaryECb = null;
+    }
+    else {
+        CbObj = glob_obj.getFromArray(arg1);
+        if (CbObj) {
+            callback = CbObj.success_cb;
+            ErrorCallback = CbObj.error_cb;
+        }
+        
+        else {
+            alert("Landmarks: __sp_landmarks_getList_cb: Callback not found ");
+            return;
+        }
+    }
+    
+    //if there is an error invoke user supplied error callback
+    if (arg3.ErrorCode || (arg2 == 4)) { //indicates an error
+        var scbErrCode = convertFromPS2JS(arg3.ErrorCode);
+        var erroObject = new DeviceAPIError(scbErrCode, arg3.ErrorMessage);
+        if (ErrorCallback) {
+            ErrorCallback(erroObject);
+        }
+    }
+    else {
+        if (arg3.ReturnValue) {
+            iter = new __sp_landmarks_iterator(arg3.ReturnValue);
+        }
+        //in case of success invoke user supplied scb
+        callback(iter);
+    }
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_landmarks_getList(callback, matchObject, ErrorCallback){
+    try {
+        var error = new DeviceAPIError(0, "dummy");
+        //test variable
+        var isErrCB = false;//indicates a valid errocalback has not been supplied
+        var isNameSearch = false;
+        var isDefaultvalue = false;
+        
+        if ((callback === undefined) ||
+        (callback === null) ||
+        (callback === "")) {
+        
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'SucessCallback is missing');
+        }
+        if (typeof(callback) != 'function') {
+            throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid SucessCallback argument');
+        }
+        if ((ErrorCallback !== undefined) &&
+        (ErrorCallback !== "") &&
+        (ErrorCallback !== null)) {
+        
+            if ((typeof(ErrorCallback) != 'function')) {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid error callback');
+            }
+            else {
+                isErrCB = true;
+            }
+            
+        }
+        var criteria = new Object();
+        modifyObjectBaseProp(criteria);
+        criteria.Type = "Landmark";
+        criteria.Filter = new Object();
+        if ((matchObject === undefined) ||
+        (matchObject === null) ||
+        (matchObject === "")) {
+        
+            criteria.Filter.dummy = "dummy";
+        }
+        else 
+            if (typeof(matchObject) == "string") {
+            
+                criteria.Filter.LandmarkName = matchObject;
+            }
+            else 
+                if (typeof(matchObject) != "object") {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid match criteria');
+                }
+                else {
+                    if ((matchObject.name !== undefined) &&
+                    (matchObject.name !== null) &&
+                    (matchObject.name !== "")) 
+                        criteria.Filter.LandmarkName = matchObject.name;
+                    if ((matchObject.description !== undefined) &&
+                    (matchObject.description !== null) &&
+                    (matchObject.description !== "")) 
+                        criteria.Filter.LandmarkDesc = matchObject.description;
+                    
+                    if ((matchObject.categoryId !== undefined) &&
+                    (matchObject.categoryId !== null) &&
+                    (matchObject.categoryId !== "")) 
+                        criteria.Filter.categoryId = matchObject.categoryId;
+                    
+                    if ((matchObject.position !== undefined) &&
+                    (matchObject.position !== null) &&
+                    (matchObject.position !== "")) {
+                        if (typeof(matchObject.position) != "object") 
+                            throw new DeviceAPIError(error.INVALID_ARG_ERR, 'position must be an object');
+                        else {
+                            criteria.Filter.LandmarkPosition = new __sp_landmark_position_obj(matchObject.position);
+                        }
+                    }
+                    if ((matchObject.coverageRadiusUsed !== undefined) &&
+                    (matchObject.coverageRadiusUsed !== null) &&
+                    (matchObject.coverageRadiusUsed !== "")) {
+                        if (typeof(matchObject.coverageRadiusUsed) != "number") 
+                            throw new DeviceAPIError(error.INVALID_ARG_ERR, "coverageRadiusUsed should be number");
+                        else 
+                            criteria.Filter.CoverageRadiusOption = matchObject.coverageRadiusUsed;
+                    }
+                    
+                    if ((matchObject.searchRadius !== undefined) &&
+                    (matchObject.searchRadius !== null) &&
+                    (matchObject.searchRadius !== "")) {
+                        if (typeof(matchObject.searchRadius) != "number") 
+                            throw new DeviceAPIError(error.INVALID_ARG_ERR, "searchRadius should be number");
+                        else 
+                            criteria.Filter.MaximumDistance = matchObject.searchRadius;
+                        
+                    }
+                    
+                    if ((matchObject.area !== undefined) &&
+                    (matchObject.area !== null) &&
+                    (matchObject.area !== "")) {
+                        if (typeof(matchObject.area) != 'object') 
+                            throw new DeviceAPIError(error.INVALID_ARG_ERR, 'area must be an object');
+                        else {
+                            criteria.Filter.BoundedArea = new __sp_landmark_bounded_area_obj(matchObject.area);
+                        }
+                    }
+                }
+        //alert("calling getlist");        
+		
+		this.temporarySCb = callback;
+        this.temporaryECb = ErrorCallback;
+		   
+        var rval = this.so.IDataSource.GetList(criteria, this.getLandmarksCb);
+        if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, callback, ErrorCallback);
+        }
+        
+        if (rval.ErrorCode != 0) {
+            switch (rval.ErrorCode) {
+                case 1003:
+                    throw new DeviceAPIError(error.MISSING_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case 1002:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case 1004:
+                    throw new DeviceAPIError(error.NOT_SUPPORTED_ERR, rval.ErrorMessage);
+                    break;
+                case 1000:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                default:
+                    throw new DeviceAPIError(-101, "unknown error message");
+                    
+            }
+            
+        }
+        return rval.TransactionID;
+        
+        
+    } 
+    catch (e) {
+        //alert("exception from here");
+        throw e;
+    }
+}
+
+function __sp_landmarks_import_cb(arg1, arg2, arg3){
+    //if there is an error invoke user supplied error callback
+    var iter = null;
+    var callback;
+    var ErrorCallback;
+    var CbObj;
+    if (this.temporarySCb) {
+        category_cb = this.temporarySCb;
+        ErrorCallback = this.temporaryECb;
+        this.temporarySCb = null;
+        this.temporaryECb = null;
+    }
+    else {
+        CbObj = glob_obj.getFromArray(arg1);
+        if (CbObj) {
+            callback = CbObj.success_cb;
+            ErrorCallback = CbObj.error_cb;
+        }
+        
+        else {
+            alert("Landmarks: __sp_landmarks_import_cb: Callback not found ");
+            return;
+        }
+    }
+    
+    //if there is an error invoke user supplied error callback
+    if (arg2 == 4 || arg3.ErrorCode) { //indicates an error
+        var scbErrCode = convertFromPS2JS(arg3.ErrorCode);
+        var erroObject = new DeviceAPIError(scbErrCode, arg3.ErrorMessage);
+        if (ErrorCallback) {
+            ErrorCallback(erroObject);
+        }
+    }
+    else {
+        if (arg3.ReturnValue) {
+            iter = new __sp_landmarks_iterator(arg3.ReturnValue);
+        }
+        
+        //in case of success invoke user supplied scb
+        callback(iter);
+    }
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_landmarks_import(callback, sourceFileUri, mimetype, ErrorCallback){
+    try {
+        var error = new DeviceAPIError(0, "dummy");
+        var isErrCB = true;//indicates a valid errocalback has been supplied
+        if (callback === undefined) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'LandmarksItrCallback is missing');
+        }
+        else {
+            if (((callback === null) ||
+            (callback === "")) &&
+            (typeof(callback) != "number")) {
+                throw new DeviceAPIError(error.MISSING_ARG_ERR, 'LandmarksItrCallback is missing');
+            }
+            else 
+                if (typeof(callback) != 'function') {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid LandmarksItrCallback argument');
+                }
+        }
+        
+        if (sourceFileUri === undefined || sourceFileUri === null) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'sourceFileUri is missing');
+        }
+        else 
+            if (typeof(sourceFileUri) !== "string") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid sourceFileUri argument');
+            }
+        
+        if (mimetype === undefined || mimetype === null) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'mimetype is missing');
+        }
+        else 
+            if (typeof(mimetype) !== "string") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid mimetype argument');
+            }
+        
+        if ((ErrorCallback != undefined)) {
+            if ((!ErrorCallback) &&
+            (typeof(ErrorCallback) != "number")) {
+                isErrCB = false;
+            }
+            else 
+                if ((typeof(ErrorCallback) != 'function')) {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid ErrorCallback callback');
+                }
+            
+        }
+        else {
+            isErrCB = false;
+        }
+        
+        
+        
+        var criteria = new Object();
+        modifyObjectBaseProp(criteria);
+        criteria.Type = "Landmark";
+        criteria.Data = new Object();
+        modifyObjectBaseProp(criteria.Data);
+        //replace all '/' to '\' and remove file:// or file:///
+        if (sourceFileUri.slice(0, 7) == "file://") {
+            sourceFileUri = sourceFileUri.slice(7);
+        }
+        else 
+            if (sourceFileUri.slice(0, 8) == "file:///") {
+                sourceFileUri = sourceFileUri.slice(8);
+            }
+            else {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, "sourceFileUri is not in URI format");
+            }
+        while (sourceFileUri.search("/") != -1) {
+            sourceFileUri = sourceFileUri.replace("/", "\\");
+        }
+        criteria.Data.SourceFile = sourceFileUri;
+        criteria.Data.MimeType = mimetype;
+		
+		this.temporarySCb = callback;
+        this.temporaryECb = ErrorCallback;
+		
+        var rval = this.so.IDataSource.Import(criteria, this.importLandmarksCb);
+        if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, callback, ErrorCallback);
+        }
+        
+        if (rval.ErrorCode != 0) {
+            switch (rval.ErrorCode) {
+                case err_missing_argument:
+                    throw new DeviceAPIError(error.MISSING_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_bad_argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_ServiceNotSupported:
+                    throw new DeviceAPIError(error.NOT_SUPPORTED_ERR, rval.ErrorMessage);
+                    break;
+                case err_InvalidService_Argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                default:
+                    throw new DeviceAPIError(-101, "unknown error message");
+            }
+        }
+        return rval.TransactionID;
+    } 
+    catch (e) {
+        throw e;
+    }
+}
+
+function __sp_landmarks_export_cb(arg1, arg2, arg3){
+    var callback;
+    var ErrorCallback;
+    var CbObj;
+    if (this.temporarySCb) {
+        category_cb = this.temporarySCb;
+        ErrorCallback = this.temporaryECb;
+        this.temporarySCb = null;
+        this.temporaryECb = null;
+    }
+    else {
+        CbObj = glob_obj.getFromArray(arg1);
+        if (CbObj) {
+            callback = CbObj.success_cb;
+            ErrorCallback = CbObj.error_cb;
+        }
+        
+        else {
+            alert("Landmarks: __sp_landmarks_export_cb: Callback not found ");
+            return;
+        }
+    }
+    
+    //if there is an error invoke user supplied error callback
+    //if there is an error invoke user supplied error callback
+    if (arg2 == 4 || arg3.ErrorCode) { //indicates an error
+        var scbErrCode = convertFromPS2JS(arg3.ErrorCode);
+        var erroObject = new DeviceAPIError(scbErrCode, arg3.ErrorMessage);
+        if (ErrorCallback) {
+            ErrorCallback(erroObject);
+        }
+    }
+    else {
+        //in case of success invoke user supplied scb
+        callback();
+    }
+    
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_landmarks_export(callback, landmarkIdList, destFileUri, mimetype, ErrorCallback){
+    try {
+        var error = new DeviceAPIError(0, "dummy");
+        var isErrCB = true;//indicates a valid errocalback has been supplied
+        if (callback === undefined) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'SuccessCallback is missing');
+        }
+        else {
+            if (((callback === null) ||
+            (callback === "")) &&
+            (typeof(callback) != "number")) {
+                throw new DeviceAPIError(error.MISSING_ARG_ERR, 'SuccessCallback is missing');
+            }
+            else 
+                if (typeof(callback) != 'function') {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid SuccessCallback argument');
+                }
+        }
+        
+        if (landmarkIdList === undefined || landmarkIdList === null) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'landmarkIdList is missing');
+        }
+        else 
+            if (typeof(landmarkIdList) !== "object") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid landmarkIdList argument');
+            }
+        
+        if (destFileUri === undefined || destFileUri === null) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'destFileUri is missing');
+        }
+        else 
+            if (typeof(destFileUri) !== "string") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid destFileUri argument');
+            }
+        
+        if (mimetype === undefined || mimetype === null) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'mimetype is missing');
+        }
+        else 
+            if (typeof(mimetype) !== "string") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid mimetype argument');
+            }
+        
+        if ((ErrorCallback != undefined)) {
+            if ((!ErrorCallback) &&
+            (typeof(ErrorCallback) != "number")) {
+                isErrCB = false;
+            }
+            else 
+                if ((typeof(ErrorCallback) != 'function')) {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid ErrorCallback callback');
+                }
+            
+        }
+        else {
+            isErrCB = false;
+        }
+        
+        
+        var criteria = new Object();
+        modifyObjectBaseProp(criteria);
+        criteria.Type = "Landmark";
+        criteria.Data = new Object();
+        modifyObjectBaseProp(criteria.Data);
+        //replace all '/' to '\' and remove file:// or file:///
+        if (destFileUri.slice(0, 7) == "file://") {
+            destFileUri = destFileUri.slice(7);
+        }
+        else 
+            if (destFileUri.slice(0, 8) == "file:///") {
+                destFileUri = destFileUri.slice(8);
+            }
+            else {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, "destFileUri is not in URI format");
+            }
+        while (destFileUri.search("/") != -1) {
+            destFileUri = destFileUri.replace("/", "\\");
+        }
+        criteria.Data.DestinationFile = destFileUri;
+        criteria.Data.IdList = landmarkIdList;
+        criteria.Data.MimeType = mimetype;
+		
+		this.temporarySCb = callback;
+        this.temporaryECb = ErrorCallback;
+		
+        var rval = this.so.IDataSource.Export(criteria, this.exportLandmarksCb);
+        if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, callback, ErrorCallback);
+        }
+        if (rval.ErrorCode != 0) {
+            switch (rval.ErrorCode) {
+                case err_missing_argument:
+                    throw new DeviceAPIError(error.MISSING_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_bad_argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_ServiceNotSupported:
+                    throw new DeviceAPIError(error.NOT_SUPPORTED_ERR, rval.ErrorMessage);
+                    break;
+                case err_InvalidService_Argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                default:
+                    throw new DeviceAPIError(-101, "unknown error message");
+            }
+        }
+        return rval.TransactionID;
+    } 
+    catch (e) {
+        throw e;
+    }
+}
+
+function __sp_landmarks_organize_cb(arg1, arg2, arg3){
+    var callback;
+    var ErrorCallback;
+	if (this.temporarySCb) {
+        category_cb = this.temporarySCb;
+        ErrorCallback = this.temporaryECb;
+        this.temporarySCb = null;
+        this.temporaryECb = null;
+    }
+    else {
+        CbObj = glob_obj.getFromArray(arg1);
+        if (CbObj) {
+            callback = CbObj.success_cb;
+            ErrorCallback = CbObj.error_cb;
+        }
+        
+        else {
+            alert("Landmarks: __sp_landmarks_organize_cb: Callback not found ");
+            return;
+        }
+    }
+    
+    //if there is an error invoke user supplied error callback
+    if (arg2 == 4 || arg3.ErrorCode) { //indicates an error
+        var scbErrCode = convertFromPS2JS(arg3.ErrorCode);
+        var erroObject = new DeviceAPIError(scbErrCode, arg3.ErrorMessage);
+        if (ErrorCallback) {
+            ErrorCallback(erroObject);
+        }
+    }
+    else {
+        //in case of success invoke user supplied scb
+        callback();
+    }
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_landmarks_organize(callback, landmarkIdList, categoryId, associate, ErrorCallback){
+    try {
+        var error = new DeviceAPIError(0, "dummy");
+        var isErrCB = true;//indicates a valid errocalback has been supplied
+        if (callback === undefined) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'SuccessCallback is missing');
+        }
+        else {
+            if (((callback === null) ||
+            (callback === "")) &&
+            (typeof(callback) != "number")) {
+                throw new DeviceAPIError(error.MISSING_ARG_ERR, 'SuccessCallback is missing');
+            }
+            else 
+                if (typeof(callback) != 'function') {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid SuccessCallback argument');
+                }
+        }
+        
+        if (landmarkIdList === undefined || landmarkIdList === null) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'landmarkIdList is missing');
+        }
+        else 
+            if (typeof(landmarkIdList) !== "object") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid LandmarkItem argument');
+            }
+        
+        if (categoryId === undefined || categoryId === null) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'categoryId is missing');
+        }
+        else 
+            if (typeof(categoryId) !== "string") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid categoryId argument');
+            }
+        
+        if (associate === undefined || associate === null) {
+            associate = true;
+        }
+        else 
+            if (typeof(associate) !== "boolean") {
+                throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid associate argument');
+            }
+        
+        if ((ErrorCallback != undefined)) {
+            if ((!ErrorCallback) &&
+            (typeof(ErrorCallback) != "number")) {
+                isErrCB = false;
+            }
+            else 
+                if ((typeof(ErrorCallback) != 'function')) {
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid ErrorCallback callback');
+                }
+            
+        }
+        else {
+            isErrCB = false;
+        }
+        
+        
+        
+        var criteria = new Object();
+        modifyObjectBaseProp(criteria);
+        criteria.Type = "Landmark";
+        criteria.Data = new Object();
+        modifyObjectBaseProp(criteria.Data);
+        criteria.Data.id = categoryId;
+        criteria.Data.IdList = landmarkIdList;
+        if (associate) 
+            criteria.OperationType = "Associate";
+        else 
+            criteria.OperationType = "Disassociate";
+		
+		this.temporarySCb = callback;
+        this.temporaryECb = ErrorCallback;
+		
+        var rval = this.so.IDataSource.Organise(criteria, this.organizeLandmarksCb);
+        if (rval.TransactionID) {
+            glob_obj.addToGlobalArray(rval.TransactionID, callback, ErrorCallback);
+        }
+        
+        if (rval.ErrorCode != 0) {
+            switch (rval.ErrorCode) {
+                case err_missing_argument:
+                    throw new DeviceAPIError(error.MISSING_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_bad_argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_ServiceNotSupported:
+                    throw new DeviceAPIError(error.NOT_SUPPORTED_ERR, rval.ErrorMessage);
+                    break;
+                case err_InvalidService_Argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                default:
+                    throw new DeviceAPIError(-101, "unknown error message");
+            }
+        }
+        return rval.TransactionID;
+    } 
+    catch (e) {
+        throw e;
+    }
+}
+
+function __sp_landmarks_cancel(transactionId){
+    try {
+        var error = new DeviceAPIError(0, "dummy");
+        if ((transactionId === undefined) ||
+        (transactionId === null) ||
+        (transactionId === "")) {
+            throw new DeviceAPIError(error.MISSING_ARG_ERR, 'transactionId is missing');
+        }
+        
+        if (typeof(transactionId) != "number") {
+            throw new DeviceAPIError(error.INVALID_ARG_ERR, 'invalid transactionId argument');
+        }
+        if (transactionId < 0) {
+            throw new DeviceAPIError(error.DATA_NOT_FOUND_ERR, 'non-existent transactionId');
+        }
+        
+        var criteria = new Object();
+        modifyObjectBaseProp(criteria);
+        criteria.TransactionID = transactionId;
+        var rval = this.so.IDataSource.Cancel(criteria);
+        if (rval.ErrorCode != 0) {
+            switch (rval.ErrorCode) {
+                case err_missing_argument:
+                    throw new DeviceAPIError(error.MISSING_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_bad_argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                case err_ServiceNotSupported:
+                    throw new DeviceAPIError(error.NOT_SUPPORTED_ERR, rval.ErrorMessage);
+                    break;
+                case err_InvalidService_Argument:
+                    throw new DeviceAPIError(error.INVALID_ARG_ERR, rval.ErrorMessage);
+                    break;
+                default:
+                    throw new DeviceAPIError(-101, "unknown error message");
+            }
+        }
+    } 
+    catch (e) {
+        throw e;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceproviders/jsapi/platformservices/src/media.js	Mon Jan 18 21:02:57 2010 +0200
@@ -0,0 +1,974 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Defination of class CCalendarInterface
+*
+*/
+
+function __device_media_descriptor(provider){
+  this.interfaceName = provider.interfaceName;
+  this.version = provider.version;
+}
+
+function __device_media_getList(media_cb, match,order, media_errcbk){
+//  return this.provider.getList(match,order, media_cb);
+   return this.provider.getList(media_cb, match,order, media_errcbk);
+}
+function __device_media_getThumbnail(media_cb, match, media_errcbk){
+
+
+   return this.provider.getThumbnail(media_cb, match, media_errcbk);
+}
+
+function __device_media_addStreamUri(uri){
+
+   return this.provider.addStreamUri(uri);
+}
+
+function __device_media_deleteStreamUri(uri){
+
+   return this.provider.deleteStreamUri(uri);
+}
+
+function __device_media_cancel(transactionId)
+{
+
+ this.provider.cancel(transactionId);
+}
+
+function __device_media_refreshMediaDb(uri)
+{
+
+ this.provider.refreshMediaDb(uri); 
+}
+
+// Private location prototype: called from service factory
+function __device_media(provider){
+  //Private properties
+  this.provider = provider;
+  //Read-only properties
+  this.interfaceName = provider.descriptor.interfaceName;
+  this.version = provider.descriptor.version;
+  //constants
+  this.SORT_ASCENDING = 0;
+  this.SORT_DESCENDING = 1;
+    
+  //Extended methods
+  this.getList = __device_media_getList;
+
+  this.getThumbnail = __device_media_getThumbnail;
+
+
+  this.addStreamUri = __device_media_addStreamUri;
+
+  this.deleteStreamUri = __device_media_deleteStreamUri;
+  
+  this.refreshMediaDb = __device_media_refreshMediaDb;
+  
+  this.cancel = __device_media_cancel;
+
+
+}
+
+// media service interface
+
+var __device_media_service_entry = {"name": null, 
+				      "version": null,
+				      "proto": __device_media,
+				      "descriptor": __device_media_descriptor,
+				      "providers": [{"descriptor": __sp_media_descriptor, "instance": __sp_media_instance}]
+				     };
+		   
+
+
+
+
+/*
+Copyright � 2009 Nokia. All rights reserved.
+Code licensed under the BSD License:
+Software License Agreement (BSD License) Copyright � 2009 Nokia.
+All rights reserved.
+Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+Neither the name of Nokia Corporation. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Nokia Corporation. 
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+version: 1.0
+*/
+/*
+ * Global object for Async utility functions:
+ * 1)addToGlobalArray
+ * 2)getFromArray
+ * 3)removeFromArray
+ */
+
+
+function __device_media_descriptor(provider){
+  this.interfaceName = provider.interfaceName;
+  this.version = provider.version;
+}
+
+function __device_media_getList(media_cb, match,order, media_errcbk){
+//  return this.provider.getList(match,order, media_cb);
+   return this.provider.getList(media_cb, match,order, media_errcbk);
+}
+function __device_media_getThumbnail(media_cb, match, media_errcbk){
+
+
+   return this.provider.getThumbnail(media_cb, match, media_errcbk);
+}
+
+function __device_media_addStreamUri(uri){
+
+   return this.provider.addStreamUri(uri);
+}
+
+function __device_media_deleteStreamUri(uri){
+
+   return this.provider.deleteStreamUri(uri);
+}
+
+function __device_media_cancel(transactionId)
+{
+
+ this.provider.cancel(transactionId);
+}
+
+function __device_media_refreshMediaDb(uri)
+{
+
+ this.provider.refreshMediaDb(uri); 
+}
+
+// Private location prototype: called from service factory
+function __device_media(provider){
+  //Private properties
+  this.provider = provider;
+  //Read-only properties
+  this.interfaceName = provider.descriptor.interfaceName;
+  this.version = provider.descriptor.version;
+  //constants
+  this.SORT_ASCENDING = 0;
+  this.SORT_DESCENDING = 1;
+    
+  //Extended methods
+  this.getList = __device_media_getList;
+
+  this.getThumbnail = __device_media_getThumbnail;
+
+
+  this.addStreamUri = __device_media_addStreamUri;
+
+  this.deleteStreamUri = __device_media_deleteStreamUri;
+  
+  this.refreshMediaDb = __device_media_refreshMediaDb;
+  
+  this.cancel = __device_media_cancel;
+
+
+}
+
+// media service interface
+
+var __device_media_service_entry = {"name": null, 
+				      "version": null,
+				      "proto": __device_media,
+				      "descriptor": __device_media_descriptor,
+				      "providers": [{"descriptor": __sp_media_descriptor, "instance": __sp_media_instance}]
+				     };
+		   
+
+
+
+
+
+
+
+/*
+Copyright © 2009 Nokia. All rights reserved.
+Code licensed under the BSD License:
+Software License Agreement (BSD License) Copyright © 2009 Nokia.
+All rights reserved.
+Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+Neither the name of Nokia Corporation. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Nokia Corporation. 
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+version: 1.0
+*/
+
+// S60 sp-based media provider
+var FILESCHMLEN = 7;
+
+//var MISSING_ARG_ERR = 1003;
+//var error = DeviceException();
+
+/*
+if(undefined==com.nokia.device.media){
+com.nokia.device.media={};
+}
+
+com.nokia.device.media.SORT_ASCENDING  = 0;
+com.nokia.device.media.SORT_DESCENDING  = 1;
+*/
+function __sp_media_descriptor(){
+  //Read-only properties
+  this.interfaceName = "media";
+  if(window.__Service_Interface_Ver)
+	this.version =__Service_Interface_Ver;
+  else
+	this.version =1.0;
+  //Class-static properties 
+}
+
+function __sp_device_media_item_build(sp_item){
+    if (!sp_item) {
+		return null;
+	}
+    var media_item = {};
+	modifyObjectBaseProp(media_item);
+    if (sp_item.FileNameAndPath) {
+        var pathname = sp_item.FileNameAndPath.replace(/\\/g, "/");
+        var fileScheme = "file://";
+        media_item.uri = fileScheme + pathname; 
+    }
+    if(sp_item.MediaType){
+		var mediaType = sp_item.MediaType;
+		switch( mediaType ){
+			case 1:
+			case 2:	 media_item.type	= "audio";
+					break;
+			case 3: media_item.type	= "image";
+					break;
+			case 4: media_item.type	= "video";
+					break;
+			case 5: media_item.type	= "stream";
+			        break;
+			default:break;
+		}
+	}
+if(sp_item.FileName){
+		if(sp_item.MediaType == 3)
+		{
+		media_item.title = 	sp_item.FileName;
+		}
+	}
+    if (sp_item.FileDate) {
+		media_item.date = new Date(Date.parse(sp_item.FileDate));
+	}
+    if (sp_item.FileSize) {
+		media_item.size = sp_item.FileSize;
+	}
+    if (sp_item.SongName) {
+		media_item.title = sp_item.SongName;
+	}
+    if (sp_item.Artist) {
+		media_item.artist = sp_item.Artist;
+	}
+    if (sp_item.Album) {
+		media_item.album = sp_item.Album;
+	}
+    if (sp_item.Genre) {
+		media_item.genre = sp_item.Genre;
+	}
+    if (sp_item.TrackNumber) {
+		media_item.track = sp_item.TrackNumber;
+	}
+    if (sp_item.Composer) {
+		media_item.composer = sp_item.Composer;
+	}
+    return media_item;
+}
+
+// ------ Wrap sp iterator ------- 
+
+function __sp_media_iterator_get_next(){
+  //__device_debug("sp_media_iterator_get_next");
+  //alert("Before iterator_get_next");
+  var item = this.iter.getNext();
+  //alert("After iterator_get_next");
+  if(typeof item == "undefined"){
+    return null;
+  }
+  var mediaitem =  __sp_device_media_item_build(item);
+  item.close();
+  return mediaitem;
+}
+
+function __sp_media_iterator(js_iterator){
+  this.iter = js_iterator;
+  this.next = __sp_media_iterator_get_next;
+  this.close = function(){
+        this.iter.close();
+    };
+}
+
+function __sp_media_get_field_name(name, type){
+	 this.error = new DeviceException(0, "Dummy");
+	//alert("__sp_media_get_field_name");
+	  if(typeof name != "string"){
+	    throw new DeviceException(this.error.INVALID_ARG_ERR ,"Media:getList:field is of invalid type");
+	  }
+     switch(name.toLowerCase()){
+        case "title":
+			if (type == "Image" || type == "Video") {
+				//alert("__sp_media_get_field_name video r image");
+				return "FileName";
+			}
+			else {
+				//alert("__sp_media_get_field_name in else part");
+				return "SongName";
+			}
+        case "artist":
+			//alert(" In artist");
+            return "Artist";
+        case "album":
+		//alert(" In album");
+            return "Album";
+        case "genre":
+			//alert(" In genere");
+            return "Genre";
+        case "track":
+		//alert(" In track");
+            return "TrackNumber";
+        case "composer":
+            return "Composer";
+        default:				
+		    return null;
+     }
+}
+function __sp_media_get_sortfield_name(name, type){
+	 this.error = new DeviceException(0, "Dummy");
+	//alert("neme = "+name);
+	//alert("In get sort field"+typeof name);
+	  if(typeof name != "string"){
+	    throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getList:sortBy is of invalid type");
+	  }
+	  var sortfield = name.toLowerCase();
+	  if( sortfield == "date"){
+	  	return "FileDate";
+	  }
+	  else{
+	  	return __sp_media_get_field_name(name, type);
+	  }
+}
+
+
+// Converting date object to string
+function __sp_media_get_date_objct(date)
+{
+	//alert("In method __sp_media_get_date_objct");
+	var dateString = "";
+	// adding year to dateString
+	dateString = date.getFullYear().toString();
+
+	// adding month to dateString
+	if(date.getMonth() <10)
+		{
+		dateString = dateString + ("0")+(date.getMonth().toString());
+		}
+	else
+		{
+		dateString = dateString + (date.getMonth().toString());
+		}
+
+	// adding day to dateString
+	var day = date.getDate() -1;
+	if(day<10)
+		{
+		dateString = dateString + ("0")+(day.toString());
+		}
+	else
+		{
+		dateString = dateString + (day.toString());	
+		}
+		
+		// Adding : to dateString
+		dateString = dateString + (":");
+	
+	// Adding hours to dateString
+	if(date.getHours()<10)		
+		{
+		dateString = dateString + ("0")+(date.getHours().toString());	
+		}
+	else
+		{
+		dateString = dateString + (date.getHours().toString());		
+		}
+		
+	// Adding minutes to dateString
+	if(date.getMinutes()<10)		
+		{
+		dateString = dateString + ("0")+(date.getMinutes().toString());	
+		}
+	else
+		{
+		dateString = dateString + (date.getMinutes().toString());		
+		}
+
+	// Adding seconds to dateString
+	if(date.getSeconds()<10)		
+		{
+		dateString = dateString + ("0")+(date.getSeconds().toString());	
+		}
+	else
+		{
+		dateString = dateString + (date.getSeconds().toString());		
+		}
+	return dateString;
+}
+
+function __sp_media_getList_cb(arg1, arg2, arg3) {
+	//alert("__sp_media_getList_cb" + arg1);
+	var media_cb;
+	var media_errcbk;
+	 var CbObj;
+    
+    //alert("1111111111");
+    CbObj = glob_obj.getFromArray(arg1);
+	// alert("222222222222");
+    
+    if (CbObj) {
+		 //alert("33333333333");
+        media_cb = CbObj.success_cb;
+		// alert("4444444444444444");
+        media_errcbk = CbObj.error_cb;
+		// alert("5555555555555555");
+    }
+    
+    else {
+		//alert("6666666666666666");
+        alert("Media : __sp_media_getList_cb: Callback not found ");
+		return;
+    }
+    
+		if(arg3.ErrorCode != 0 && arg3.ErrorCode != 1010)
+		{
+			//alert("77777777777777");
+			media_errcbk(new DeviceException( arg3.ErrorCode,"Media: getList: Operation Failed"));
+			return;
+		}
+		if (arg2 != event_cancelled) {
+			//alert("888888888");
+			var iter = null;
+			if (arg3.ReturnValue) {
+				//alert("11");
+				iter = new __sp_media_iterator(arg3.ReturnValue);
+				//alert("12");
+			}
+			//alert( " before sucess call back");
+			media_cb(iter); // Need to make change later on as case of eventid
+			//alert( " After sucess call back");
+		}
+		
+		glob_obj.removeFromArray(arg1);
+  }
+
+function __sp_media_getList(media_cb, match, order, media_errcbk){	
+	//alert("In __sp_media_getList wraper ");
+	if (!media_cb) {		
+		throw new DeviceException(this.error.MISSING_ARG_ERR,"Media:getList:Callback is missing");
+	}
+	else 
+		if (typeof media_cb != "function") //here we check if the type of callback is function. This case is useful when arbitrary values are passed to callback
+		{			
+			throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:Callback is of invalid type");
+		}
+	if(media_errcbk)
+	{ 		
+		if(typeof media_errcbk != 'function')
+		{			
+		   	throw new DeviceException(this.error.INVALID_ARG_ERR, "Media: getList: error callback is invalid");
+		}
+	}
+	
+	 if((typeof match) != 'object'){
+  			//alert(" match is not object");
+  	      	throw  new DeviceException(this.error.INVALID_ARG_ERR, "Invalid Argument:" +match);	
+			}
+	
+		//alert(" In my match");
+		if (match) {
+			if (('sortBy' in match) && (match.sortBy == undefined || match.sortBy == null || match.sortBy == "")) {
+				//alert(" In condition" + this.error.INVALID_ARG_ERR);
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "Media: getList: sortby is invalid");
+				
+			}
+		}
+	//alert(" After match");
+
+  var criteria = {};  
+  modifyObjectBaseProp(criteria);  
+  criteria.Type = 'FileInfo';  
+  criteria.Filter = {};
+  modifyObjectBaseProp(criteria.Filter);
+  criteria.Sort = {};
+  modifyObjectBaseProp(criteria.Sort);
+  if (match) {  	
+  	  if(match.type){	  	
+	  	  if(typeof match.type != "string"){		  	
+		  throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:type is of invalid type");
+		  }
+	      switch (match.type.toLowerCase()) {
+	          case "audio":
+//	              criteria.Filter.FileType = "Music";
+ 	              criteria.Filter.FileType = "audio";
+	              break;
+	          case "image":
+	              criteria.Filter.FileType = "Image";
+	              break;
+	          case "video":
+			  		//alert(" In Video");
+	              criteria.Filter.FileType = "Video";
+	              break;
+	          case "stream":
+	              criteria.Filter.FileType = "StreamingURL";
+	              break;
+			  default:			 
+			  	  throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList: type is invalid");
+	      }
+		  
+		  if( ('field' in match) && ( match.field == undefined || match.field == null) )
+        		   throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getList:field is invalid");
+				   
+				   
+	      if (match.field != null) {
+	          criteria.Filter.Key = __sp_media_get_field_name(match.field.name,criteria.Filter.FileType);
+			  if( criteria.Filter.Key == null ){			  
+			  throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getList:key is invalid");	
+			  }
+	          if(match.field.value){
+			  criteria.Filter.StartRange = match.field.value;
+			  if(criteria.Filter.Key == "TrackNumber"){
+			  criteria.Filter.EndRange = match.field.value;  
+			  }
+	          //Note: date matches not supported currently		  	
+			  }			  
+	      }
+		  else{ // When match is not defined then we will look for daterange
+		  	if(match.dateRange)
+			{				
+				if(typeof match.dateRange != "object")
+					{						
+					throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getList:dateRange is of invalid type");		
+					}
+				//alert("got daterange");
+				criteria.Filter.Key = "FileDate";
+				if((typeof match.dateRange.start != "undefined") && (typeof match.dateRange.end != "undefined"))
+				{
+						//alert(" In range");
+				if((typeof match.dateRange.start != 'object') || ( match.dateRange.start == "") ||(match.dateRange.start == null)){
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getList:dateRange:start is of invalid type");		
+				}
+				else{
+				criteria.Filter.StartRange = __sp_media_get_date_objct(match.dateRange.start);	
+				}	
+					
+				if((typeof match.dateRange.end != 'object') || ( match.dateRange.end == "")||(match.dateRange.end == null)){
+					//alert(" end is empty");
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getList:dateRange:end is of invalid type");		
+				}
+				else{
+					//alert(" ")
+				criteria.Filter.EndRange   = __sp_media_get_date_objct(match.dateRange.end);	
+				}	
+				
+				}
+				else{					 
+					throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getList:start or end of dateRange is missing"); //  frm missing to invalid for test case 60 & 65
+				}
+			}		
+				 else if( ('dateRange' in match) &&(match.dateRange == 0 || match.dateRange == null || match.dateRange == "")){
+					//alert(" In else match.dateRange = "+typeof(match.dateRange));
+					throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getList: dateRange is Invalid");
+				}	
+		  }
+	      if (match.sortBy) {
+	          criteria.Sort.Key = __sp_media_get_sortfield_name(match.sortBy, criteria.Filter.FileType);
+			  if( criteria.Sort.Key == null ){
+			  throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getList:sortBy is invalid");	
+			  }
+	      } 
+		  else {
+		  criteria.Sort.Key = "FileDate";
+		  }
+		  // Adding sort order
+		  if(order)
+		  {  	
+				
+				if (order == this.SORT_ASCENDING) {
+								//alert(" Ascending ");
+								criteria.Sort.Order = "Ascending";
+							}
+							// else if(order == com.nokia.device.SORT_DESCENDING || order == com.nokia.device.media.SORT_DESCENDING)
+				else if (order == this.SORT_DESCENDING) {
+									criteria.Sort.Order = "Descending";
+								}				
+								
+				else if((order != this.SORT_ASCENDING) || (order != this.SORT_DESCENDING)) {
+								throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getList:sortBy is invalid");
+			}
+		  }
+		  else
+		  {
+		  criteria.Sort.Order = "Ascending"; 		
+		  }
+	      //criteria.Sort.Order = "Descending"; 
+		  //Note: sort order has been removed because of ambiguous behavior: if FileDate
+		  // is specified then sapi sorts in ascending order by default, if FileDate is not specified,
+		  // sorting is performed on FileDate in descending order. 	  	
+	  }
+	  else{
+	  			//alert( " In match.type missing");
+	  	throw new DeviceException(this.error.MISSING_ARG_ERR, "Media:type is missing");
+	  }	
+  }
+  else {
+      // Must supply something to sp, so default to music .... Need to change to all
+//      criteria.Filter.FileType = "Music"; // here need to make all
+        criteria.Filter.FileType = "all"; 
+        criteria.Sort.Key = "FileDate";
+	  //	  criteria.Sort.Order = "Descending";
+	  criteria.Sort.Order = "Ascending"; // By default it should be ascending
+  }
+  
+  try {    
+    //__device_debug("Getting media list");
+	//alert(" before calling sapi");
+	temp_scb = media_cb;
+	temp_ecb = media_errcbk;
+    var rval = this.so.IDataSource.GetList(criteria, this.getListMediaCb);
+	//alert(" errorcode = "+rval.ErrorCode);
+	//alert(" errorcode = "+rval.TransactionID);
+	if (rval.TransactionID) {
+		//alert(" In if of TransactionID");
+        glob_obj.addToGlobalArray(rval.TransactionID, media_cb, media_errcbk);
+    }
+	//alert("rval.errorcode = "+rval.ErrorCode);
+	if(criteria.Sort)
+	{
+	delete criteria.Sort;	
+	}	
+	if(criteria.Filter.StartRange)
+	{
+	delete 	criteria.Filter.StartRange;
+	}
+
+	if(criteria.Filter.EndRange)
+	{
+	delete 	criteria.Filter.EndRange;
+	}
+
+	if(criteria.Filter)
+	{
+	delete 	criteria.Filter;
+	}
+
+    if(rval.ErrorCode != 0){
+    	  switch(MapErrorCode[rval.ErrorCode]){
+				case this.error.MISSING_ARG_ERR :
+				case this.error.INVALID_ARG_ERR :
+				case this.error.NOT_SUPPORTED_ERR :
+        		//case err_missing_argument :
+        		//case err_bad_argument :
+						//case err_InvalidService_Argument :
+						//case err_ServiceNotSupported :
+							
+						if(rval.ErrorMessage){ 
+            			var err_msg = splitErrorMessage(rval.ErrorMessage); 	
+			            throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getList:"+err_msg);						    
+						}
+						else{
+						throw new DeviceException(MapErrorCode[rval.ErrorCode], "Media:getList:Operation failed");	
+						}
+						break;
+						default:						
+						//media_cb(iter) ;
+						//err_cb(new DeviceException(MapErrorCode[rval.ErrorCode], "Media: getList: Operation Failed"));
+						media_errcbk(new DeviceException(MapErrorCode[rval.ErrorCode], "Media: getList: Operation Failed"));
+    	  }
+    }
+  return rval.TransactionID;
+  }
+  catch (e) {
+    __device_handle_exception(e, '__sp_media_getList: '+e);
+  }  
+}
+
+function __sp_media_getThumbnail_cb(arg1, arg2, arg3) {
+	var thumbnail_errcbk;
+	var thumbnail_cb;
+	 var CbObj;
+    
+    
+    CbObj = glob_obj.getFromArray(arg1);
+    
+    if (CbObj) {
+        thumbnail_cb = CbObj.success_cb;
+        thumbnail_errcbk = CbObj.error_cb;
+    }
+    
+    else {
+        alert("Media : __sp_media_getThumbnail_cb: Callback not found ");
+		return;
+    }
+    
+	if(arg3.ErrorCode != 0 && arg3.ErrorCode != 1010)
+	{
+		
+		thumbnail_errcbk(new DeviceException(arg3.ErrorCode, "Media: getThumbnail: Operation Failed"));
+		return;
+	}
+	if (arg2 != event_cancelled) {
+		var thumbUrl = null;
+		if (arg3.ReturnValue) {
+			thumbUrl = arg3.ReturnValue.replace(/\\/g, "/");
+			var fileScheme = "file://";
+			thumbUrl = fileScheme + thumbUrl;
+		}
+		thumbnail_cb(thumbUrl);
+	} 
+	glob_obj.removeFromArray(arg1);
+	}
+	
+// Code for getthumbnail
+function __sp_media_getThumbnail(thumbnail_cb,thumbnailInfo, thumbnail_errcbk)
+{
+	//alert("In __sp_media_getThumbnail");
+	// Checking validation for callback method
+	if(!thumbnail_cb)
+  	{
+  		throw new DeviceException(this.error.MISSING_ARG_ERR, "Media:getThumbnail:Callback is missing");
+  	}
+  	else if(typeof thumbnail_cb != "function")	//here we check if the type of callback is function. This case is useful when arbitrary values are passed to callback
+  	{
+  		throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getList:Callback is invalid");
+  	}
+	if(thumbnail_errcbk)
+	{ 
+		var err_cb = thumbnail_errcbk;
+		//alert(" In thumbnail_errcbk");
+		if(typeof thumbnail_errcbk != 'function')
+		{
+			//alert(" thumbnail_errcbk != function");
+		   	throw new DeviceException(this.error.INVALID_ARG_ERR, "Media: getThumbnail: error callback is invalid");
+			//err_cb(new DeviceException(INVALID_ARG_ERR, "Media: getThumbnail: error callback is invalid"));
+		}
+	}
+
+
+	// Creating url and thumbnail
+	var inputParam = {};
+	modifyObjectBaseProp(inputParam);
+	if (thumbnailInfo) {
+		if(typeof thumbnailInfo != "object" ){			
+			throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getThumbnail:thumbnailInfo is of invalid type object");
+			}
+		if (thumbnailInfo.uri) {			
+			if (typeof thumbnailInfo.uri != "string") {				
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getThumbnail:uri is not of type string");
+				
+				}
+			if (thumbnailInfo.uri.search("file://") == 0) {				
+				url = thumbnailInfo.uri.slice(FILESCHMLEN);
+				inputParam.Url = url.replace(/\//g, "\\");
+			}
+			else {				
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getThumbnail:uri is not in file protocol");
+			}
+		}
+		else {			
+			throw new DeviceException(this.error.MISSING_ARG_ERR, "Media:getThumbnail:uri is missing");
+		}
+	}
+	else{		
+		throw new DeviceException(this.error.MISSING_ARG_ERR, "Media:thumbnailInfo is missing");
+		}	
+	//for thumbanilsize
+
+	if ( thumbnailInfo.size == null ||  thumbnailInfo.size == "" ){
+		//alert(" size is null");
+		throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getThumbnail:size is not of type Object");
+	}
+	if (thumbnailInfo.size) {
+	
+		// chekcing if sise is object or not
+		//alert(" In thumbnail size");
+		if(typeof thumbnailInfo.size != "object" ){
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "Media:getThumbnail:size is not of type Object");
+		}
+		if((typeof thumbnailInfo.size.width == "undefined") && ( typeof thumbnailInfo.size.height == "undefined"))
+			{
+			throw new DeviceException(this.error.MISSING_ARG_ERR, "Media:thumbnailInfo should have atleast width or height");	
+			}
+		else{
+			var thumbnailsize = {};
+			modifyObjectBaseProp(thumbnailsize);
+			if (typeof thumbnailInfo.size.width != "undefined") // Need to put check on this
+				{
+				thumbnailsize.width = thumbnailInfo.size.width;
+				}
+			if (typeof thumbnailInfo.size.height != "undefined") 
+				{
+				thumbnailsize.height = thumbnailInfo.size.height;
+				}
+			inputParam.ThumbnailSize = thumbnailsize;
+			delete thumbnailsize;
+			}
+	
+		}
+
+  try {    
+   	temp_scb = thumbnail_cb;
+	temp_ecb = thumbnail_errcbk;
+    var rval = this.so.IDataSource.GetThumbnail(inputParam, this.getThumbnailCb);
+	//alert(" errorcode = "+rval.ErrorCode);
+	if (rval.TransactionID) {
+        glob_obj.addToGlobalArray(rval.TransactionID, thumbnail_cb, thumbnail_errcbk);
+    }
+	delete inputParam;
+
+    if(rval.ErrorCode != 0){
+		//alert(" In if loop = "+ MapErrorCode[rval.ErrorCode]);
+		//alert(" In not supported= "+ this.error.NOT_SUPPORTED_ERR);
+		//alert(" in if of rval.errorcode" +MapErrorCode[rval.ErrorCode]);	
+		//alert(" MISSING_ARG_ERR = " +MapErrorCode[1003]);	
+		//var errmsg = null;
+		//errmsg = splitErrorMessage(rval.ErrorMessage); 		
+    	  switch(MapErrorCode[rval.ErrorCode]){		  	        				
+        				case this.error.MISSING_ARG_ERR :
+						{
+							//alert(" in switch MISSING_ARG_ERR");
+							thumbnail_errcbk(new DeviceException(this.error.MISSING_ARG_ERR, "Media: getThumbnail: Operation Failed"));
+						}
+						break;	
+						case this.error.NOT_SUPPORTED_ERR :	{
+							//alert(" In not supported");
+							thumbnail_errcbk( new DeviceException(MapErrorCode[rval.ErrorCode], "Media:getThumbnail:Operation failed"));
+						}						
+						break;				
+						case this.error.INVALID_ARG_ERR :												
+						throw new DeviceException(MapErrorCode[rval.ErrorCode], "Media:getThumbnail:Operation failed");							
+						break;
+						default:	
+							//throw new DeviceException(MapErrorCode[rval.ErrorCode], "Media:getThumbnail:Operation failed");					
+							//thumbnail_errcbk
+							if (thumbnail_errcbk) {
+							
+								thumbnail_errcbk(new DeviceException(MapErrorCode[rval.ErrorCode], "Media:getThumbnail:Operation failed"));
+							}
+							
+							else {
+							
+								throw new DeviceException(MapErrorCode[rval.ErrorCode], "Media:getThumbnail:Operation failed");
+							}
+							
+						
+    	  }		  	
+    }	
+  return rval.TransactionID;
+  }
+  catch (e) {		
+  		//alert(" In exception");
+    __device_handle_exception(e, '__sp_media_getThumbnail: '+e);
+  }  		
+	
+}
+
+function __sp_media_addStreamUri(uri)
+	{
+	throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:addStreamUri:Not Supported");	
+	}
+function __sp_media_deleteStreamUri(uri)
+	{
+	throw new DeviceException(MapErrorCode[rval.ErrorCode], "Media:deleteStreamUri:Not Supported");	
+	}
+
+function 	__sp_media_refreshMediaDb(uri)
+{
+
+}
+
+function __sp_media_cancel(transactionId)
+{
+	try{
+		var rval = this.so.IDataSource.Cancel(transactionId);
+	
+	    if(rval.ErrorCode != 0){
+    	  switch(rval.ErrorCode){
+        				//case err_missing_argument :
+        				//case err_bad_argument :
+						//case err_InvalidService_Argument :
+						//case err_ServiceNotSupported :
+							case this.error.MISSING_ARG_ERR :
+							case this.error.INVALID_ARG_ERR :							
+							case this.error.NOT_SUPPORTED_ERR :
+						if(rval.ErrorMessage){ 
+            			var err_msg = splitErrorMessage(rval.ErrorMessage); 	
+			            throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:cancel:"+err_msg);						    
+						}
+						else{
+						throw new DeviceException(MapErrorCode[rval.ErrorCode], "Media:cancel:Operation failed");	
+						}
+						break;
+						default:
+						throw new DeviceException(MapErrorCode[rval.ErrorCode], "Media:cancel:Operation failed");
+    	  }
+    	}
+
+	}
+	catch(e){
+	   __device_handle_exception(e, '__sp_media_refreshMediaDb: '+e);
+	}
+}
+
+function __sp_media_instance(){
+  
+  //Descriptor
+  this.descriptor = new __sp_media_descriptor();
+  //Extended methods
+  this.SORT_ASCENDING = 0;
+  this.SORT_DESCENDING = 1;
+  this.getList = __sp_media_getList;
+  this.getListMediaCb = __sp_media_getList_cb;
+  //Method for gethumbnail
+
+  this.getThumbnail = __sp_media_getThumbnail;
+  this.getThumbnailCb = __sp_media_getThumbnail_cb;
+	// Method for addStreamuri
+  this.addStreamUri = __sp_media_addStreamUri;
+  
+  //Method for deleteStreamUri
+  this.deleteStreamUri = __sp_media_deleteStreamUri;
+  
+  //Method for refreshMediaDb
+  this.refreshMediaDb = __sp_media_refreshMediaDb;
+  
+  //Method for cancel
+  this.cancel = __sp_media_cancel;
+  //Private data
+  this.error = new DeviceException(0, "Dummy");
+  try {
+    //__device_debug("Trying media service");
+      this.so = device.getServiceObject("Service.MediaManagement", "IDataSource");
+    //__device_debug("Got media service object");    
+  }
+  catch (e){
+    this.so = null;
+    __device_handle_exception(e, "media service not available");
+  }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceproviders/jsapi/platformservices/src/messaging.js	Mon Jan 18 21:02:57 2010 +0200
@@ -0,0 +1,1289 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Defination of class CCalendarInterface
+*
+*/
+
+
+
+function __device_messaging_descriptor(provider){
+    this.interfaceName = provider.interfaceName;
+    this.version = provider.version;
+}
+
+
+
+function __device_messaging_startEditor(message){
+
+    return this.provider.startEditor(message);
+}
+
+function __device_messaging_getList(callback, match, sortkey, sortorder, ErrorCallback){
+    return this.provider.getList(callback, match, sortkey, sortorder, ErrorCallback);
+}
+
+function __device_messaging_send(callback, message, id, ErrorCallback){
+    return this.provider.send(callback, message, id, ErrorCallback);
+}
+
+
+function __device_messaging_setNotifier(callback, ErrorCallback){
+    return this.provider.setNotifier(callback, ErrorCallback );
+}
+
+function __device_messaging_cancelNotifier(){
+    return this.provider.cancelNotifier();
+}
+
+function __device_messaging_getMessage(id){
+    return this.provider.getMessage(id);
+}
+
+function __device_messaging_delete(id){
+    return this.provider.deleteMessage(id);
+}
+
+function __device_messaging_setStatus(id, status){
+    return this.provider.setStatus(id, status);
+}
+function __device_messaging_cancel(transactionId){
+
+    return this.provider.cancel(transactionId);
+}
+
+function __device_messaging(provider){
+    //Private properties
+    this.provider = provider;
+    //Read-only properties
+    this.interfaceName = provider.descriptor.interfaceName;
+    this.version = provider.descriptor.version;
+	//constants
+	this.SORT_ASCENDING = 0;
+    this.SORT_DESCENDING = 1;
+    this.SORT_BY_DATE = 0;
+    this.SORT_BY_SENDER = 1;
+	this.STATUS_READ = 0;
+	this.STATUS_UNREAD = 1;
+
+    //Core methods
+    this.startEditor = __device_messaging_startEditor;
+    //Extended methods
+    this.getList = __device_messaging_getList;
+    this.send = __device_messaging_send;
+    this.setNotifier = __device_messaging_setNotifier;
+    this.cancelNotifier = __device_messaging_cancelNotifier;
+    this.getMessage = __device_messaging_getMessage;
+    this.deleteMessage = __device_messaging_delete;
+    this.setStatus = __device_messaging_setStatus;
+	this.cancel = __device_messaging_cancel;
+}
+
+// Namepace: com.nokia.device.service
+
+
+var __device_messaging_service_entry = {
+    "name": null,
+    "version": null,
+    "proto": __device_messaging,
+    "descriptor": __device_messaging_descriptor,
+    "providers": [{
+        "descriptor": __sp_messaging_descriptor,
+        "instance": __sp_messaging_instance
+    }]
+};
+
+
+
+/*
+ Copyright © 2009 Nokia. All rights reserved.
+ Code licensed under the BSD License:
+ Software License Agreement (BSD License) Copyright © 2009 Nokia.
+ All rights reserved.
+ Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ Neither the name of Nokia Corporation. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Nokia Corporation.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ version: 1.0
+ */
+// S60 sp-based messaging provider
+var FILE_SCHEME = 'file://';
+//Constant values as per the CJSE Spec
+//var INVALID_URI_ERR = 108;
+
+/*
+ * Global object for Async utility functions:
+ * 1)addToGlobalArray
+ * 2)getFromArray
+ * 3)removeFromArray
+ */
+
+//var error = new DeviceError(0, 'dummy');
+/*
+ if(undefined == com.nokia.device.messaging)
+ {
+ com.nokia.device.messaging={};
+ }
+ nokia.device.messaging.SORT_ASCENDING = 0;
+ nokia.device.messaging.SORT_DESCENDING = 1;
+ nokia.device.messaging.SORT_BY_DATE = 0;
+ nokia.device.messaging.SORT_BY_SENDER = 1;
+ nokia.device.messaging.STATUS_READ = 0;
+ nokia.device.messaging.STATUS_UNREAD = 1;*/
+function __sp_messaging_descriptor(){
+    //Read-only properties
+    this.interfaceName = "messaging";
+    if (window.__Service_Interface_Ver) 
+        this.version = __Service_Interface_Ver;
+    else 
+        this.version = 1.0;
+    //Class-static properties 
+}
+
+function __sp_messaging_instance(){
+
+    
+    //Descriptor
+    this.descriptor = new __sp_messaging_descriptor();
+    //Core methods
+    this.startEditor = __sp_messaging_startEditor;
+    //Extended methods
+    this.getList = __sp_messaging_getList;
+    this.getListcB = __sp_message_getListcB;
+    
+    this.send = __sp_messaging_send;
+    this.sendcb = __sp_message_sendcb;
+    
+    this.setNotifier = __sp_messaging_setNotifier;
+	this.setNotifierCb = __sp_messaging_setNotifier_cb;
+	
+    this.cancelNotifier = __sp_messaging_cancelNotifier;
+    this.getMessage = __sp_messaging_getMessage;
+    this.deleteMessage = __sp_messaging_delete;
+    this.setStatus = __sp_messaging_setStatus;
+    this.cancel = __sp_messaging_cancel;
+    // Private data
+    this.sendCommon = __sp_messaging_send_common;
+    //Constant values as per the CJSE Spec
+    this.SORT_ASCENDING = 0;
+    this.SORT_DESCENDING = 1;
+    this.SORT_BY_DATE = 0;
+    this.SORT_BY_SENDER = 1;
+    this.STATUS_READ = 0;
+    this.STATUS_UNREAD = 1;
+    this.error = new DeviceException(0, "Dummy");
+    
+    try {
+        //__device_debug("Trying messaging service");
+        this.so = device.getServiceObject("Service.Messaging", "IMessaging");
+        //__device_debug("Got messaging service object");    
+    } 
+    catch (e) {
+        this.so = null;
+        __device_handle_exception(e, "Messaging service not available");
+    }
+}
+
+
+
+function __sp_attachment_build(attachment){
+    if (!attachment) {
+        return null;
+    }
+    var sp_attachment = {};
+    modifyObjectBaseProp(sp_attachment);
+    if (attachment.uri) {
+        if (typeof attachment.uri != "string") {
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "uri is invalid");
+        }
+        //device1.0: added this statement.. with out this the script will crib..also checking for proper URI
+        if (attachment.uri.slice(0, 7) == FILE_SCHEME) {
+            if (attachment.uri.charAt(7) == "/") {
+                if (attachment.uri.charAt(9) != ":") {
+                    throw new DeviceException(this.error.URI_NOT_FOUND_ERR, "specified uri not found");
+                }
+                sp_attachment.FileName = attachment.uri.slice(8).replace(/\057/g, "\\");
+                if (sp_attachment.FileName.length > 256) {
+                    throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "uri is out of range");//map the errorcode to data_out_of_range
+                }
+            }
+            
+            else {
+                if (attachment.uri.charAt(8) != ":") {
+                    throw new DeviceException(this.error.URI_NOT_FOUND_ERR, "specified uri not found");
+                }
+                sp_attachment.FileName = attachment.uri.slice(7).replace(/\057/g, "\\");
+                if (sp_attachment.FileName.length > 256) {
+                    throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "uri is out of range");//map the errorcode to data_out_of_range
+                }
+            }
+        }
+        else {
+            throw new DeviceException(this.error.INVALID_URI_ERR, "uri is invalid")
+        }
+        
+    }
+    //alert("attachment" + sp_attachment.FileName);
+    return sp_attachment;
+}
+
+function __sp_message_build(message, id){
+    //a(id)
+    //__device_debug("sp_message_build");
+    if (!message) {
+        return null;
+    }
+    var sp_message = {};
+    modifyObjectBaseProp(sp_message);
+    var attachFlag = 0;
+    sp_message.MessageParam = {};
+    modifyObjectBaseProp(sp_message.MessageParam);
+    sp_message.MessageParam.LaunchEditor = false; //Defaults to no editor
+    sp_message.MessageType = (message.type == undefined || message.type == null) ? "SMS" : message.type;
+    //alert(message.to[0]+" "+message.type)
+    if (message.to) {
+        if (typeof(message.to) == "string") {
+            sp_message.To = message.to;
+        }
+        else 
+            if (__device_typeof(message.to) == "Array" && message.to.length > 0) {
+                if (message.to[0]) {
+                    sp_message.To = message.to[0];
+                }
+                
+                
+                if (message.to.length > 1) {
+                    if (message.to.slice(1)) {
+                        sp_message.MessageParam.To = message.to.slice(1);
+                        
+                    }
+                }
+            }
+            else {
+                sp_message.To = message.to;
+            }
+    }
+    
+    if (message.cc) {
+        sp_message.MessageParam.Cc = message.cc;
+    }
+    
+    if (id) {
+        if ((typeof(id) == "string") && !(isNaN(id))) {
+            id = Number(id);
+        }
+        sp_message.MessageParam.TemplateId = id;
+    }
+    if (sp_message.MessageType == "SMS") {
+        if (message.body) {
+            sp_message.BodyText = message.body;
+        }
+    }
+    
+    if (sp_message.MessageType == "MMS") {
+        if (message.body) {
+            //device1.0: Added body to MMS as it is a valid input to MMS type of message also
+            sp_message.BodyText = message.body;
+        }
+        if (message.subject) {
+            if (typeof message.subject == "string" && message.subject.length > 256) {
+                throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "subject length is greater than 256 characters");
+            }
+            sp_message.Subject = message.subject;
+        }
+        if (message.attachments) {
+            sp_message.MessageParam.AttachmentList = [];
+            for (var a in message.attachments) {
+                //if (message.attachments.hasOwnProperty('a')) {
+                if (typeof message.attachments[a] == "object" && __device_typeof(message.attachments[a]) != "Array") {
+                    sp_message.MessageParam.AttachmentList.push(__sp_attachment_build(message.attachments[a]));
+                    attachFlag = 1;
+                }
+                
+                
+                
+                //}
+            }
+            if (attachFlag == 0) {
+                throw new DeviceException(this.error.INVALID_ARG_ERR, "uri is invalid");
+            }
+        }
+    }
+    //   //alert("returning message____");
+    return sp_message;
+}
+
+function __sp_device_attachment_build(sp_attachment){
+    if (!sp_attachment) {
+        return null;
+    }
+    var attachment = {};
+    attachment.uri = FILE_SCHEME + sp_attachment.FileName;
+    return attachment;
+}
+
+function __sp_device_message_build(sp_message){
+    if (!sp_message) {
+        return null;
+    }
+    //	//alert("am in message build");
+    var message = {};
+    message.body = null;
+    message.subject = null;
+    message.attachments = null;
+    message.to = null;
+    message.cc = null;
+    
+    message.type = sp_message.MessageType;
+    if (sp_message.BodyText) {
+        message.body = sp_message.BodyText;
+    }
+    if (sp_message.to) {
+        message.to = sp_message.To;
+        
+    }
+    if (sp_message.Subject) //device1.0: moved to here from MMS,for sms also subject is valid it will return the first 64 characters of the body as subject
+    {
+        message.subject = sp_message.Subject;
+    }
+    message.attachment = false;
+    
+    
+    if (message.type == "MMS") {
+        if (sp_message.Cc) {
+            message.cc = sp_message.Cc;
+        }
+        if (sp_message.AttachmentList) {
+            message.attachment = true;
+            message.attachments = [];
+            for (var a in sp_message.AttachmentList) {
+                if (sp_message.AttachmentList.hasOwnProperty('a')) {
+                    message.attachments.push(__sp_device_attachment_build(sp_message.AttachmentList[a]));
+                }
+            }
+        }
+    }
+    //	//alert("returning message");
+    return message;
+}
+
+function __sp_device_message_info_build_notifier(sp_message){
+    if (!sp_message) {
+        return null;
+    }
+    var message_info = {};
+    message_info.message = {};
+    message_info.message.type = sp_message.MessageType;
+    message_info.sender = sp_message.Sender;
+    message_info.message.subject = sp_message.Subject;
+    message_info.time = sp_message.Time;
+    message_info.attachments = (sp_message.Attachments == undefined || sp_message.Attachments == null) ? (!(sp_message.AttachmentList == undefined || sp_message.AttachmentList == null)) : sp_message.Attachments;
+    message_info.unread = sp_message.Unread; //TBD: check existence
+    message_info.id = (sp_message.MessageId).toString(); // TBD: check name of sp field
+    return message_info;
+}
+
+
+function __sp_device_message_info_build(sp_message){
+    //__device_debug("sp_device_message_info_build");
+    if (!sp_message) {
+        return null;
+    }
+    //	//alert("*******");
+    var message_info = {};
+    message_info.message = __sp_device_message_build(sp_message);
+    message_info.sender = sp_message.Sender;
+    message_info.time = sp_message.Time;
+    message_info.unread = sp_message.Unread; //TBD: check existence
+    message_info.id = (sp_message.MessageId).toString(); // TBD: check name of sp field
+    return message_info;
+}
+
+// ------ Wrap sp iterator ------- 
+
+
+
+function __sp_message_iterator_get_next(){
+    //__device_debug("sp_message_iterator_get_next");
+    //	//alert("in get_next");
+    var sp_message = this.iter.getNext();
+    if (typeof sp_message == "undefined") {
+        //	//alert("returning null");
+        return null;
+    }
+    //	//alert("iterator");
+    var message = __sp_device_message_info_build(sp_message);
+    sp_message.close();
+    return message;
+}
+
+function __sp_message_iterator(js_iterator){
+    this.iter = js_iterator;
+    this.next = __sp_message_iterator_get_next;
+    this.close = function(){
+        this.iter.close();
+    }
+    
+}
+
+
+function __sp_message_getListcB(arg1, arg2, arg3){
+
+    var success_cb;
+    var error_cb;
+    var CbObj;
+    
+    
+    CbObj = glob_obj.getFromArray(arg1);
+    
+    
+    
+    if (CbObj) {
+        success_cb = CbObj.success_cb;
+        error_cb = CbObj.error_cb;
+    }
+    
+    else {
+        alert("Messaging: __sp_message_getListcB: Callback not found ");
+		return;
+    }
+    
+    
+    var iter = null;
+    
+    if (arg3.ErrorCode != 0) {
+        //alert('error '+error_cb);
+        if (arg3.ErrorMessage) {
+            err_msg = splitErrorMessage(arg3.ErrorMessage);
+        }
+        else {
+            err_msg = "Operation Failed";
+        }
+        
+        if (error_cb) {
+            error_cb(new DeviceException(MapErrorCode[arg3.ErrorCode], "Messaging: getList: " + err_msg));
+            return;
+        }
+    }
+    else 
+        if (arg3.ReturnValue) {
+        
+            iter = new __sp_message_iterator(arg3.ReturnValue);
+        }
+
+    if (arg2 != event_cancelled) // 3 signifies eventcancelled //device1.0: currently this check is not required here but might be in future if sp provides Async getlist
+    {
+        success_cb(iter);//device1.0: arg1 is the errorcode, arg2 is the transactionId and iter is the return value
+    }
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_messaging_getList(msg_cb, match, sortkey, sortorder, ErrorCallback){
+
+    //alert("in getlist");
+    
+    if (!msg_cb) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Messaging:getList:callback is missing");
+    }
+    else 
+        if (typeof msg_cb != "function") {
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:getList:callback is not a function"); //BadArgumentType error
+        }
+    if (match != null && match != undefined && typeof match != "object") {
+        //	a("match not object")
+        throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:getList:match is invalid"); //BadArgumentType error
+    }
+    
+    if (sortkey != null && sortkey != undefined && typeof sortkey != "number") {
+        throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:getList:sortkey is invalid"); //BadArgumentType error
+    }
+    
+    if (sortorder != null && sortorder != undefined && typeof sortorder != "number") {
+        throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:getList:sortorder is invalid"); //BadArgumentType error
+    }
+    
+    if (sortkey != null && sortkey != undefined && typeof sortkey == "number") {
+        if ((sortkey != 0) && (sortkey != 1)) 
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:getList:sortkey is invalid"); //BadArgumentType error
+    }
+    
+    if (sortorder != null && sortorder != undefined && typeof sortorder == "number") {
+        //	a(sortorder+" "+typeof sortorder)
+        if ((sortorder != 0) && (sortorder != 1)) 
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:getList:sortorder is invalid"); //BadArgumentType error
+    }
+    
+    if (ErrorCallback) {
+        if (typeof(ErrorCallback) != 'function') {
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging: startEditor: ErrorCallback is invalid");
+        }
+    }
+    
+    
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.Type = "Inbox";
+    criteria.Filter = {};
+    modifyObjectBaseProp(criteria.Filter);
+    
+    
+    if (match) {
+        //	a("in match");
+        if (match.type != null && match.type != undefined) {
+            //	a("match.type" + match.type);
+            criteria.Filter.MessageTypeList = match.type;
+        }
+        if (match.senders != null && match.senders != undefined) {
+            criteria.Filter.SenderList = match.senders;
+        }
+        if (match.subject != null && match.subject != undefined) {
+            if (match.subject.length > 256) {
+                if (ErrorCallback) {
+                    ErrorCallback(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "Messaging:getList:subject is out of range"));
+                    return;
+                }
+                else {
+                    throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "Messaging:getList:subject is out of range");
+                }
+            }
+            else {
+                criteria.Filter.Subject = match.subject;
+            }
+        }
+        if (match.start != null && match.start != undefined) {
+            criteria.Filter.StartDate = match.start;
+        }
+        if (match.end != null && match.end != undefined) {
+            criteria.Filter.EndDate = match.end;
+        }
+    }
+    
+    if (sortkey || sortorder) {
+        //	a("in sortkey");
+        criteria.SortOrder = {};
+        modifyObjectBaseProp(criteria.SortOrder);
+        if (sortkey) {
+            if ((sortkey == this.SORT_BY_DATE)) {
+                criteria.SortOrder.Key = "Date";
+            }
+            else 
+                if ((sortkey == this.SORT_BY_SENDER)) {
+                    criteria.SortOrder.Key = "Sender";
+                }
+        }
+        else {
+            criteria.SortOrder.Key = "Date";
+        }
+        if (sortorder) {
+        
+            if ((sortorder == this.SORT_ASCENDING)) {
+                criteria.SortOrder.Order = "Ascending";
+            }
+            else 
+                if ((sortorder == this.SORT_DESCENDING)) {
+                    criteria.SortOrder.Order = "Descending";
+                }
+        }
+        else {
+            criteria.SortOrder.Order = "Ascending";
+        }
+    }
+    
+    try {
+        //__device_debug("Getting message list");
+	    temp_scb = msg_cb;
+		temp_ecb = ErrorCallback;
+        var result = this.so.IMessaging.GetList(criteria, this.getListcB);
+        if (result.TransactionID) {
+            glob_obj.addToGlobalArray(result.TransactionID, msg_cb, ErrorCallback);
+        }
+        
+        if (criteria) {
+            delete criteria.Filter;
+            delete criteria.SortOrder;
+            delete criteria.Type;
+        }
+        if (result.ErrorCode != 0)//device1.0:Modified to throw exceptions
+        {
+        
+            var err_msg = "operation failed";
+            if (result.ErrorMessage) {
+                err_msg = splitErrorMessage(result.ErrorMessage);
+            }
+            switch (MapErrorCode[result.ErrorCode]) {
+                case this.error.INVALID_ARG_ERR:
+                case this.error.MISSING_ARG_ERR:
+                case this.error.NOT_SUPPORTED_ERR:
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:getList:" + err_msg);
+                    break;
+                    
+                default:
+                    if (ErrorCallback) {
+                        setTimeout(function(){
+                            ErrorCallback(new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:getList:" + err_msg));
+                        }, 500);
+                    }
+                    else {
+                        throw new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:getList:" + err_msg);
+                    }
+                    
+            }
+        }
+        
+        return result.TransactionID;
+    } 
+    catch (e) {
+        __device_handle_exception(e, '__sp_messaging_getList: ' + e);
+    }
+}
+
+function __sp_message_sendcb(arg1, arg2, arg3){
+	var send_cb;
+	var eCB;
+    var CbObj = glob_obj.getFromArray(arg1);
+    
+    if (CbObj) {
+        send_cb = CbObj.success_cb;
+        eCB = CbObj.error_cb;
+    }
+    
+	else
+	{
+		alert('Messaging : __sp_message_sendcb : Callback not found');
+		return;
+	}
+    if (send_cb) {
+        var err_msg = "operation failed";
+
+        if (arg3.ErrorCode != 0) {
+        
+            if (arg3.ErrorMessage) {
+                err_msg = splitErrorMessage(arg3.ErrorMessage);
+            }
+            if (eCB) {
+                //alert("am in ecb");
+                setTimeout(function(){
+                    eCB(new DeviceException(MapErrorCode[arg3.ErrorCode], "Messaging: send: " + err_msg));
+                }, 500);
+                return;
+            }
+        }
+        if (arg2 != event_cancelled) // 3 signifies eventcancelled 
+        {
+            send_cb();//device1.0: arg1 is the transaction id, arg3 is the return value which holds the errorcode
+        }
+    }
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_messaging_send_common(message, editor, send_cb, id, eCB){
+
+    //__device_debug("sp_messaging_send_common");
+    var criteria = __sp_message_build(message, id);
+    criteria.MessageParam.LaunchEditor = editor;
+    
+    var result;
+    //	//alert("before editor");
+    if (editor == false) //device1.0:making it async only in case of send api, as it doesnot invoke editor, returning the output accordingly
+    {
+    	temp_scb = send_cb;
+		temp_ecb = eCB;
+        result = this.so.IMessaging.Send(criteria, this.sendcb);
+        if (result.TransactionID) {
+            glob_obj.addToGlobalArray(result.TransactionID, send_cb, eCB);
+        }
+        
+        //alert("ErrorCode" + (result.ErrorCode));
+        if (result.ErrorCode != 0)//device1.0:Modified to throw exceptions
+        {
+            var err_msg = "operation failed";
+            if (result.ErrorMessage) {
+                err_msg = splitErrorMessage(result.ErrorMessage);
+            }
+            //alert("before switch");
+            switch (MapErrorCode[result.ErrorCode]) {
+                case this.error.INVALID_ARG_ERR:
+                case this.error.MISSING_ARG_ERR:
+                case this.error.NOT_SUPPORTED_ERR:
+                    //alert("INVALID");
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], err_msg);
+                    break;
+                    
+                default:
+                    //   a("in default");
+                    if (eCB) {
+                        //		a("calling eCB");
+                        setTimeout(function(){
+                            eCB(new DeviceException(MapErrorCode[result.ErrorCode], err_msg));
+                        }, 500);
+                        //	a("after eCB" + result.TransactionID);
+                        return;
+                    }
+                    else {
+                        //				a("else");
+                        throw new DeviceException(MapErrorCode[result.ErrorCode], err_msg);
+                    }
+                    
+            }
+        }
+        
+        var transactionID = result.TransactionID;
+        //		a("transactionID" + transactionID);
+        return transactionID;
+    }
+    else {
+        //		a("am coming here");
+        result = this.so.IMessaging.Send(criteria);
+        //		a("result.ErrorCode" + result.ErrorCode);
+        if (result.ErrorCode != 0)//device1.0:Modified to throw exceptions
+        {
+            if (result.ErrorMessage) {
+                var err_msg1 = splitErrorMessage(result.ErrorMessage);
+                throw new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:startEditor" + err_msg1);
+            }
+            else {
+                throw new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:startEditor:operation failed");
+            }
+        }
+    }
+    if (criteria) {
+        delete criteria.MessageParam;
+    }
+    
+}
+
+
+function __sp_messaging_startEditor(message){
+    //a("starteditor");
+    if (!message) {
+        //	a("starteditor1");
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Messaging:startEditor:message is missing");//SErrMissingArgument = 1003      
+    }
+    else 
+        if (typeof message != "object") {
+            //	a("starteditor2");
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:startEditor:message is invalid"); //BadArgumentType error
+        }
+    //__device_debug("sp_messaging_startEditor");
+    if ((message.subject)) {
+        if ((message.subject).length > 256) {
+            //	a("starteditor3");
+            throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "Messaging:startEditor:subject is too lengthy");//SErrMissingArgument = 1003
+        }
+    }
+    if (message.to == undefined || message.to == null) {
+        //	a("starteditor4");
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Messaging:startEditor:to field is missing");//SErrMissingArgument = 1003
+    }
+    
+    if (message.attachments != undefined && message.attachments != null && typeof message.attachments != "object") {
+        //		a("INVALID_ARG_ERR");
+        throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:startEditor:attachment is invalid");//SErrMissingArgument = 1003
+    }
+    if (message) {
+        if (message.body) {
+            if (typeof(message.body) != "string") {
+                throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:startEditor:body is invalid");
+            }
+        }
+    }
+    try {
+        //	a("before sendcommon");
+        this.sendCommon(message, true, null);
+    } 
+    catch (e) {
+        //	a("starteditor catch");
+        var error = null;
+        if (e.message) {
+        
+            error = new DeviceException(e.code, "Messaging:startEditor:" + e.message);
+        }
+        else {
+            error = new DeviceException(e.code, "Messaging:startEditor:operation failed");
+        }
+        __device_handle_exception(error, '__sp_messaging_startEditor: ' + error);
+    }
+}
+
+function __sp_messaging_send(msg_cb, message, id, ErrorCallback){
+
+    //	a("send!!!!!!!" + ErrorCallback);
+    if (!message) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Messaging:send:message is missing");//SErrMissingArgument = 1003      
+    }
+    else 
+        if (typeof message != "object") {
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:send:message is invalid"); //BadArgumentType error
+        }
+    if (!msg_cb) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Messaging:send:callback is missing");//SErrMissingArgument = 1003  
+    }
+    else 
+        if (typeof msg_cb != "function") {
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:send:callback is invalid"); //BadArgumentType error
+        }
+    
+    
+    if (message.to == undefined || message.to == null) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Messaging:send:to field is missing");//SErrMissingArgument = 1003
+    }
+    
+    
+    if (message.attachments != undefined && message.attachments != null && typeof message.attachments != "object") {
+        throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:send:attachment is invalid");//SErrMissingArgument = 1003
+    }
+    
+    if (!id) {
+        id = "";
+    }
+    /*  if (id) {
+     if (((typeof id) != "function") && ((typeof id) != "string") && ((typeof id) != "number")) {
+     throw new DeviceException(INVALID_ARG_ERR, 'Messaging:send:id is not a string');
+     }*/
+    if ((typeof id) == "function") {
+        var errorCbk = id;
+        id = "";
+        ErrorCallback = errorCbk;
+    }
+    
+    if ((typeof ErrorCallback) == "undefined" || ErrorCallback == null) {
+        ErrorCallback = null;
+    }
+    else 
+        if ((typeof ErrorCallback) != "function") {
+            throw new DeviceException(this.error.INVALID_ARG_ERR, 'Messaging:send:errorCallback is not a function');
+        }
+    
+    var invoker = function(arg1, arg2, arg3){
+        var success_cb = msg_cb;
+        var error_cb = ErrorCallback;
+        var iter = null;
+        if (arg3.ErrorCode != 0) {
+            var err_msg;
+            if (arg3.ErrorMessage) 
+                err_msg = splitErrorMessage(arg3.ErrorMessage);
+            else 
+                err_msg = "Operation Failed";
+            
+            error_cb(new DeviceException(MapErrorCode[arg3.ErrorCode], "Messaging:startEditor: " + err_msg));
+            return;
+        }
+        else 
+            if (arg3.ReturnValue) {
+                iter = new __sp_message_iterator(arg3.ReturnValue);
+                success_cb(iter);
+            }
+        if (arg2 != event_cancelled) // 3 signifies eventcancelled //device1.0: currently this check is not required here but might be in future if sp provides Async getlist
+        {
+            success_cb(iter);//device1.0: arg1 is the errorcode, arg2 is the transactionId and iter is the return value
+        }
+    };
+    
+    try {
+        //	//alert("before sendCommon");
+        //	a("ErrorCallback" + ErrorCallback);
+        var transactionID = this.sendCommon(message, false, msg_cb, id, ErrorCallback);
+        //	a("transactionID" + transactionID);
+        return transactionID;
+    } 
+    catch (e) {
+        //a("e.message" + e.message);
+        var error = null;
+        switch (e.code) {
+            case this.error.INVALID_ARG_ERR:
+            case this.error.MISSING_ARG_ERR:
+            case this.error.NOT_SUPPORTED_ERR:
+                throw new DeviceException(e.code, "Messaging:send:" + e.message);
+                break;
+                
+            default:
+                if (ErrorCallback) {
+                    setTimeout(function(){
+                        ErrorCallback(new DeviceException(e.code, "Messaging:send:" + e.message));
+                    }, 1000);
+                }
+                else {
+                    throw new DeviceException(e.code, "Messaging:send:" + e.message);
+                }
+                
+        }
+    }
+}
+
+function __sp_messaging_setNotifier_cb(arg1, arg2, arg3){
+    var success_cb;
+    var error_cb;
+    var msginfo = null;
+    var err_msg = null;
+    
+    var CbObj;
+    
+    
+    CbObj = glob_obj.getFromArray(arg1);
+    
+    
+    if (CbObj) {
+        success_cb = CbObj.success_cb;
+        error_cb = CbObj.error_cb;
+    }
+    
+    else {
+        alert("Messaging: __sp_messaging_setNotifier_cb : Callback not found ");
+		return;
+    }
+    
+    
+    if (arg3.ErrorCode != 0) {
+        if (arg3.ErrorMessage) {
+            err_msg = splitErrorMessage(arg3.ErrorMessage);
+        }
+        else {
+            err_msg = "operation failed";
+        }
+        if (error_cb) {
+            error_cb(new DeviceException(MapErrorCode[arg3.ErrorCode], "Messaging:setNotifier: " + err_msg));
+            return;
+        }
+    }
+    else 
+        if (arg3.ReturnValue) {
+            msginfo = new __sp_device_message_info_build_notifier(arg3.ReturnValue);//LAT BUG
+            arg3.ReturnValue.close();
+        }
+    if (arg2 != event_cancelled) // 3 signifies eventcancelled
+    {
+        success_cb(msginfo.id);//msginfo.id)//device1.0: returning the errorcode,
+    }
+    glob_obj.removeFromArray(arg1);
+}
+
+function __sp_messaging_setNotifier(msg_cb, ErrorCallback){
+
+    if (!msg_cb) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Messaging:setNotifier:callback is missing");//SErrMissingArgument = 1003  
+    }
+    else 
+        if (typeof msg_cb != "function") {
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:setNotifier:callback is invalid"); //BadArgumentType error
+        }
+    
+    
+    
+    if (ErrorCallback) {
+        if (typeof(ErrorCallback) != 'function') {
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:setNotifier: ErrorCallback is invalid");
+        }
+    }
+    
+    
+    
+    
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.Type = 'NewMessage';
+    
+    try {
+		temp_scb = msg_cb;
+		temp_ecb = ErrorCallback;
+        var result = this.so.IMessaging.RegisterNotification(criteria, this.setNotifierCb);
+        
+        if (result.TransactionID) {
+            glob_obj.addToGlobalArray(result.TransactionID, msg_cb, ErrorCallback);
+        }
+        
+        if (criteria) {
+            delete criteria.Type;
+        }
+        if (result.ErrorCode != 0)//device1.0:Modified to throw exceptions
+        {
+        
+            var err_msg = "operation failed";
+            if (result.ErrorMessage) {
+                err_msg = splitErrorMessage(result.ErrorMessage);
+            }
+            switch (MapErrorCode[result.ErrorCode]) {
+                case this.error.INVALID_ARG_ERR:
+                case this.error.MISSING_ARG_ERR:
+                case this.error.NOT_SUPPORTED_ERR:
+                    throw new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:setNotifier:" + err_msg);
+                    break;
+                    
+                default:
+                    if (ErrorCallback) {
+                        setTimeout(function(){
+                            ErrorCallback(new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:setNotifier:" + err_msg));
+                        }, 1000);
+                    }
+                    else {
+                        throw new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:setNotifier:" + err_msg);
+                    }
+                    
+            }
+        }
+        var transactionID = result.TransactionID;
+        return transactionID;
+    } 
+    catch (e) {
+        __device_handle_exception(e, '__sp_messaging_setNotifier: ' + e.toString());
+    }
+}
+
+function __sp_messaging_cancelNotifier(){
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.Type = "NewMessage";
+    
+    try {
+        var result = this.so.IMessaging.CancelNotification(criteria);
+        if (criteria) {
+            delete criteria.Type;
+        }
+        //alert("result.ErrorCode" + result.ErrorCode);
+        if (result.ErrorCode != 0)//device1.0:Modified to throw exceptions
+        {
+            if (result.ErrorMessage) {
+                var err_msg = splitErrorMessage(result.ErrorMessage);
+                throw new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:cancelNotifier" + err_msg);
+            }
+            else {
+                throw new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:cancelNotifier:operation failed");
+            }
+        }
+    } 
+    catch (e) {
+        __device_handle_exception(e, '__sp_messaging_cancelNotifier: ' + e);
+    }
+}
+
+function __sp_messaging_getMessage(id){
+
+    if (!id) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Messaging:getMessage:id is missing");//SErrMissingArgument = 1003  
+    }
+    else 
+        if ((typeof id) != "string") 
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:getMessage:MessageId should be a string");
+    if ((typeof id == "string") && !(isNaN(id))) {
+        id = Number(id);
+        if (id == 0) {
+            throw new DeviceException(this.error.DATA_NOT_FOUND_ERR, "Messaging:getMessage:id not found");
+        }
+        if (id < 0) {
+            throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "Messaging:getMessage:id is out of range");
+        }
+    }
+    
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.Type = "Inbox";
+    criteria.Filter = {};
+    modifyObjectBaseProp(criteria.Filter);
+    criteria.Filter.MessageId = id;
+    
+    try {
+        var result = this.so.IMessaging.GetList(criteria);
+        
+        if (criteria) {
+            delete criteria.Filter;
+            delete criteria.Type;
+        }
+        //	a("result.ErrorCode" + result.ErrorCode);
+        if (result.ErrorCode != 0)//device1.0:Modified to throw exceptions
+        {
+            //		a("result.ErrorCode" + result.ErrorCode);
+            if (result.ErrorMessage) {
+                //			a("result.ErrorMessage");
+                var err_msg = splitErrorMessage(result.ErrorMessage);
+                throw new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:getMessage" + err_msg);
+            }
+            else {
+                throw new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:getMessage:operation failed");
+            }
+        }
+        if (result.ReturnValue) {
+            //		a("result.ReturnValue" + result.ReturnValue);
+            var iter = new __sp_message_iterator(result.ReturnValue);//LAT BUG
+            var result1 = iter.next();
+            if (result1) {
+                //		a("result1");
+                return result1;
+            }
+            else {
+                //		a("DATA_NOT_FOUND_ERR");
+                throw new DeviceException(this.error.DATA_NOT_FOUND_ERR, "Messaging:getMessage:id not found");//sapi doesnot return errorcode for non-existent id
+            }
+            
+        }
+    } 
+    catch (e) {
+        __device_handle_exception(e, '__sp_messaging_getMessage: ' + e);
+    }
+}
+
+function __sp_messaging_delete(id){
+    a("messageId" + typeof id);
+    if (!id) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Messaging:delete:id is missing");//SErrMissingArgument = 1003  
+    }
+    else 
+        if ((typeof id) != "string") 
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:deleteMessage:MessageId should be a string");
+    
+    if ((typeof id == "string") && !(isNaN(id))) {
+        id = Number(id);
+        if (id == 0) {
+            throw new DeviceException(this.error.DATA_NOT_FOUND_ERR, "Messaging:delete:id not found");
+        }
+        if (id < 0) {
+            throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "Messaging:delete:id is out of range");
+        }
+    }
+    
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.MessageId = id;
+    
+    try {
+        //		a("criteria.MessageId" + criteria.MessageId);
+        var result = this.so.IMessaging.Delete(criteria);
+        a("MapErrorCode[ result.ErrorCode ]" + MapErrorCode[result.ErrorCode]);
+        if (criteria) {
+            delete criteria.MessageId;
+        }
+        //		a("result.ErrorCode" + result.ErrorCode);
+        if (result.ErrorCode != 0)//device1.0:Modified to throw exceptions
+        {
+            if (result.ErrorMessage) {
+                //				a("result.ErrorMessage");
+                var err_msg = splitErrorMessage(result.ErrorMessage);
+                throw new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:delete" + err_msg);
+            }
+            else {
+                throw new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:delete:operation failed");
+            }
+        }
+    } 
+    catch (e) {
+        __device_handle_exception(e, '__sp_messaging_delete: ' + e);
+    }
+}
+
+function __sp_messaging_setStatus(id, status){
+
+    if (id == null || id == undefined || (id.length) <= 0) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Messaging:setStatus:id is missing");//SErrMissingArgument = 1003  
+    }
+    //a("id.length" + id.length);
+    if ((typeof id) != "string") {
+        throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:setStatus:id should be string");//SErrMissingArgument = 1003  
+    }
+    
+    if (status == null || status == undefined) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Messaging:setStatus:status is missing");//SErrMissingArgument = 1003 
+    }
+    
+    if (typeof status != "number") {
+        throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:setStatus:status is invalid"); //BadArgumentType error
+    }
+    
+    if (typeof status == "number" && status != 0 && status != 1) {
+        throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:setStatus:status is invalid"); //BadArgumentType error
+    }
+    
+    if ((typeof id == "string") && !(isNaN(id))) {
+        id = Number(id);
+        if (id == 0) {
+            throw new DeviceException(this.error.DATA_NOT_FOUND_ERR, "Messaging:setStatus:id not found");
+        }
+        if (id < 0) {
+            throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "Messaging:setStatus:id is out of range");
+        }
+    }
+    
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.MessageId = id;
+    if ((status == this.STATUS_UNREAD)) {
+        criteria.Status = "Unread";
+    }
+    else 
+        if ((status == this.STATUS_READ)) {
+            a("in read")
+            criteria.Status = "Read";
+        }
+    try {
+        var result = this.so.IMessaging.ChangeStatus(criteria);
+        if (criteria) {
+            delete criteria.MessageId;
+            delete criteria.Status;
+        }
+        //		a("result.ErrorCode" + result.ErrorCode);
+        if (result.ErrorCode != 0)//device1.0:Modified to throw exceptions
+        {
+            //a("error code is non-zero")
+            if (result.ErrorMessage) {
+                var err_msg = splitErrorMessage(result.ErrorMessage);
+                throw new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:setStatus" + err_msg);
+            }
+            else {
+                throw new DeviceException(MapErrorCode[result.ErrorCode], "Messaging:setStatus:operation failed");
+            }
+        }
+    } 
+    catch (e) {
+        __device_handle_exception(e, '__sp_messaging_setStatus: ' + e);
+    }
+}
+
+function __sp_messaging_cancel(transactionId){
+
+    if (transactionId == null || transactionId == undefined) {
+        throw new DeviceException(this.error.MISSING_ARG_ERR, "Messaging:setStatus:id is missing");//SErrMissingArgument = 1003  
+    }
+    
+    if (typeof transactionId != "number") {
+        throw new DeviceException(this.error.INVALID_ARG_ERR, "Messaging:cancel:id is invalid");//SErrMissingArgument = 1003  
+    }
+    var criteria = {};
+    modifyObjectBaseProp(criteria);
+    criteria.TransactionID = transactionId;
+    //   a("in cancel");
+    try {
+        var result = this.so.IMessaging.Cancel(criteria);
+        if (criteria) {
+            delete criteria.TransactionID;
+        }
+        //alert("result.ErrorCode" + result.ErrorCode);
+        if (result.ErrorCode != 0)//device1.0:Modified to throw exceptions
+        {
+            var err;
+            if (result.ErrorCode == 1000) {
+                err = this.error.DATA_NOT_FOUND_ERR;
+            }
+            else {
+                err = MapErrorCode[result.ErrorCode];
+            }
+            if (result.ErrorMessage) {
+                var err_msg = splitErrorMessage(result.ErrorMessage);
+                throw new DeviceException(err, "Messaging:cancel" + err_msg);
+            }
+            else {
+                throw new DeviceException(err, "Messaging:cancel:operation failed");
+            }
+        }
+    } 
+    catch (e) {
+        __device_handle_exception(e, '__sp_messaging_setStatus: ' + e);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceproviders/jsapi/platformservices/src/sensors.js	Mon Jan 18 21:02:57 2010 +0200
@@ -0,0 +1,423 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Defination of class CCalendarInterface
+*
+*/
+
+
+// sensors service interface
+
+var __device_sensors_service_entry = {"name": null, 
+				      "version": null,
+				      "proto": __device_sensors,
+				      "descriptor": __device_sensors_descriptor,
+				      "providers": [{"descriptor": __sp_sensors_descriptor, "instance": __sp_sensors_instance}]
+				     };
+		   
+
+// Private location prototype: called from service factory
+function __device_sensors(provider){
+  //Private properties
+  this.provider = provider;
+  //Read-only properties
+  this.interfaceName = provider.descriptor.interfaceName;
+  this.version = provider.descriptor.version;  
+  //Extended methods
+  this.getChannels = __device_sensors_getChannels;
+  this.startChannel = __device_sensors_setNotifier;
+  this.stopChannel = __device_sensors_cancelNotifier;
+  this.getScaleFactor = __device_sensors_getScaleFactor;
+}
+
+function __device_sensors_descriptor(provider){
+  this.interfaceName = provider.interfaceName;
+  this.version = provider.version;
+}
+
+function __device_sensors_getChannels(){
+  return this.provider.getChannels();
+}
+
+function __device_sensors_setNotifier(sensors_cb, channel,__fail_cb){
+  return this.provider.startChannel(sensors_cb, channel,__fail_cb);
+}
+
+function __device_sensors_cancelNotifier(channel){
+  return this.provider.stopChannel(channel);
+}
+
+function __device_sensors_getScaleFactor(channel){
+  return this.provider.getScaleFactor(channel);
+}
+
+
+
+
+
+
+/*
+Copyright © 2009 Nokia. All rights reserved.
+Code licensed under the BSD License:
+Software License Agreement (BSD License) Copyright © 2009 Nokia.
+All rights reserved.
+Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+Neither the name of Nokia Corporation. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Nokia Corporation. 
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+version: 2.7.0
+*/
+
+
+// S60 sp-based sensors provider
+
+
+
+function __sp_sensors_descriptor(){
+  //Read-only properties
+  this.interfaceName = "sensors";
+  if(window.__Service_Interface_Ver)
+	this.version =__Service_Interface_Ver;
+  else
+	this.version =1.0;
+  //Class-static properties 
+}
+
+function __sp_sensors_instance(){
+  //Descriptor
+  this.descriptor = new __sp_sensors_descriptor();
+  //Extended methods
+  this.getChannels = __sp_sensors_getChannels;
+  this.startChannel =  __sp_sensors_setNotifier;
+  this.stopChannel =  __sp_sensors_cancelNotifier;
+  this.getScaleFactor = __sp_sensors_getScaleFactor;
+  //Public properties
+  
+  try {
+    //__device_debug("Trying sensors service");
+    this.so = device.getServiceObject('Service.Sensor', 'ISensor');
+    //__device_debug("Got sensors service object: ");    
+  }
+  catch (e){
+    this.so = null;
+    __device_handle_exception (e, "sensors service not available");
+  }
+}
+
+var __rotation_channel = {
+  ucb: null,
+  tids: null
+};
+
+
+var __XYZ_channel = {
+  ucb: null,
+  tids: null
+};
+
+var __orientation_channel = {
+  ucb: null,
+  tids: null
+};
+
+function __rotation_cb(arg1, arg2, arg3){
+    if(arg2 != event_cancelled)
+        {
+        var output = null ;    
+        if (arg3.ReturnValue)
+            {
+            var time = arg3.ReturnValue.TimeStamp;
+            var xrot = arg3.ReturnValue.XRotation;
+            var yrot = arg3.ReturnValue.YRotation;
+            var zrot = arg3.ReturnValue.ZRotation;
+			      arg3.ReturnValue.close();
+            output = {};
+	          modifyObjectBaseProp(output); 
+            output.timeStamp = time;
+            output.rotationAboutXAxis = xrot;
+            output.rotationAboutYAxis = yrot;
+            output.rotationAboutZAxis = zrot;
+            }
+         __rotation_channel.ucb(output);
+        }
+		
+}
+
+function __XYZ_cb(arg1, arg2, arg3){
+    if(arg2 != event_cancelled)
+        {
+        var output = null ;    
+        if (arg3.ReturnValue)
+            {
+            var time = arg3.ReturnValue.TimeStamp;
+            var xaxis = arg3.ReturnValue.XAxisData;
+            var yaxis = arg3.ReturnValue.YAxisData;
+            var zaxis = arg3.ReturnValue.ZAxisData;
+			      arg3.ReturnValue.close();
+            output = {}; 
+	          modifyObjectBaseProp(output);
+            output.timeStamp = time;
+            output.axisX = xaxis;
+            output.axisY = yaxis;
+            output.axisZ = zaxis;
+            }    
+        __XYZ_channel.ucb(output);
+        }
+		
+}
+
+function __orientation_cb(arg1, arg2, arg3){
+    if(arg2 != event_cancelled)
+        {
+        var output = null ;    
+        if (arg3.ReturnValue)
+            {
+            var time = arg3.ReturnValue.TimeStamp;
+            var orientation = arg3.ReturnValue.DeviceOrientation;
+			arg3.ReturnValue.close();
+            output = {}; 
+	    modifyObjectBaseProp(output);
+            output.timeStamp = time;
+            output.deviceOrientation = orientation;
+            }        
+        __orientation_channel.ucb(output);
+        }
+		
+}
+
+
+// For now this is statically configured though this could be dynamically populated by the sensors sp
+
+
+
+
+function __sp_sensors_getChannels(){
+  return ["Rotation", "AccelerometerAxis", "Orientation"];
+}
+
+function __sp_sensors_setNotifier(__succes_cb, __channel,__fail_cb){ 
+	    
+    	var error = new DeviceException(0, 'dummy');
+	    if (!__succes_cb) {//alert("!__succes_cb");
+			throw new DeviceAPIError(error.MISSING_ARG_ERR, "Callback is missing");
+		}		
+		if ((typeof __succes_cb) != "function") {
+			throw new DeviceAPIError(error.INVALID_ARG_ERR, "Callback is of invalid type");
+		}	
+		if (__fail_cb && ((typeof __fail_cb) != "function")) {
+			throw new DeviceAPIError(error.INVALID_ARG_ERR, "InValid error Callback");
+		} 
+		if (!__channel) {
+			throw new DeviceAPIError(error.MISSING_ARG_ERR, "Channel is missing");
+		}			
+		if ((typeof __channel) != "string") {
+			
+			throw new DeviceAPIError(error.INVALID_ARG_ERR, "Channel is of invalid type");
+		}
+		
+		
+	  var rval;
+	  var cb;
+	  var channelInfo = {};
+	  modifyObjectBaseProp(channelInfo);
+   switch(__channel){
+   	  
+	  case "Rotation":
+		channelInfo.SearchCriterion = "Rotation";
+		cb = __rotation_cb;
+		__rotation_channel.ucb = __succes_cb;
+		break;
+	  case "AccelerometerAxis":
+	  //alert("case AccelerometerAxis");
+	  channelInfo.SearchCriterion = "AccelerometerAxis";
+		cb = __XYZ_cb;
+		__XYZ_channel.ucb = __succes_cb;
+	 break;
+	  case "Orientation":
+		channelInfo.SearchCriterion = "Orientation";
+		cb = __orientation_cb;
+		__orientation_channel.ucb = __succes_cb;
+		break;
+	  default:
+	    //alert("default");
+	    throw  new DeviceAPIError(error.NOT_SUPPORTED_ERR, "Unsupported input channel");	
+	 }
+  
+  try{
+  	rval = this.so.ISensor.FindSensorChannel(channelInfo);
+		if (channelInfo) {
+		delete channelInfo.SearchCriterion;
+		}
+    if(rval.ErrorCode != 0)
+      {
+      throw  new DeviceAPIError(error.NOT_SUPPORTED_ERR, "StartChannel:Operation Failed");
+      }
+
+  var cmap = [];
+  var transactionid = [];
+  var returnvalue = rval["ReturnValue"];
+  var count = returnvalue.length;
+  cmap = returnvalue[0];
+  var sensorParams = {};
+	modifyObjectBaseProp(sensorParams);
+	sensorParams.ListeningType = "ChannelData";
+	sensorParams.ChannelInfoMap = cmap;
+	var result = this.so.ISensor.RegisterForNotification(sensorParams, cb);
+	  if(sensorParams){
+	  	delete sensorParams.ChannelInfoMap;
+		  delete sensorParams.ListeningType;
+	  }
+	  if(cmap){
+	  	delete cmap.index;
+	  }
+    transactionid[0] = result["TransactionID"];
+    if(result.ErrorCode != 0)
+        {
+        //throw result.ErrorCode;
+		
+						 if( result.ErrorCode == 1005)
+						 {
+						 __fail_cb(new DeviceAPIError(error.SERVICE_IN_USE_ERR,"Not Allowed Operation"));
+						 return;	 
+						 }
+						 else
+						 	{
+						 	throw  new DeviceAPIError(error.NOT_SUPPORTED_ERR, "StartChannel:Operation Failed");	
+						 	}
+				 }
+        		 
+			
+    }catch(e2){
+      __device_handle_exception (e2, "__sp_sensors_setNotifier: RegisterForNotification: " + e2);
+        }
+  
+  
+  switch(__channel){
+  case "Rotation":
+    __rotation_channel.tid = transactionid;
+    break;
+  case "AccelerometerAxis":
+  __XYZ_channel.tid = transactionid;
+    break;
+  case "Orientation":
+    __orientation_channel.tid = transactionid;
+    break;
+  }
+  return transactionid;
+ }
+
+function __sp_sensors_cancelNotifier(__channel){
+ 
+    var error1 = new DeviceException(0, 'dummy');
+	  if(!__channel)
+			    throw  new DeviceAPIError(error1.MISSING_ARG_ERR, "Channel is missing");
+							
+			if((typeof __channel) != "string")
+					throw  new DeviceAPIError(error1.INVALID_ARG_ERR, "Channel is of invalid type");
+  
+	  var id ;  
+	  
+	  switch (__channel)
+	  {
+		case "Rotation":
+		  id = __rotation_channel.tid;
+		  __rotation_channel.tid = null;
+		  break;
+		case "AccelerometerAxis":
+		id = __XYZ_channel.tid;
+		__XYZ_channel.tid = null;
+		  break;
+		case "Orientation":
+		  id = __orientation_channel.tid;
+		  __orientation_channel.tid = null;
+		  break;
+		default:
+		  throw  new DeviceAPIError(error1.NOT_SUPPORTED_ERR, "Unsupported input channel");	
+		}     
+	
+	 if(!id)
+	 {
+	 throw  new DeviceAPIError(error1.DATA_NOT_FOUND_ERR, "Stop Channel:Operation Failed");		
+	 }
+	 
+	var cancelParams = {};
+  modifyObjectBaseProp(cancelParams);
+  for (var i in id) {
+  		  cancelParams.TransactionID = id[i];
+				try {
+					var result = this.so.ISensor.Cancel(cancelParams);
+					if (cancelParams) {
+						delete cancelParams.TransactionID;
+					}
+					if (result.ErrorCode != 0) {
+						throw  new DeviceAPIError(error1.DATA_NOT_FOUND_ERR, "Stop Channel:Operation Failed");
+						}
+				} 
+				catch (e1) {
+					__device_handle_exception(e1, "__sp_sensors_cancelNotifier: " + e1);
+				}
+		}
+}
+
+function __sp_sensors_getScaleFactor(__channel){
+	var error2 = new DeviceException(0, 'dummy');
+	if(!__channel)
+		    throw  new DeviceAPIError(error2.MISSING_ARG_ERR, "Channel is missing");
+						
+		if((typeof __channel) != "string")
+				throw  new DeviceAPIError(error2.INVALID_ARG_ERR, "Channel is of invalid type");
+				
+	if(__channel != "AccelerometerAxis")
+		    throw  new DeviceAPIError(error2.NOT_SUPPORTED_ERR, "Unsupported input channel");
+		    
+ try{    
+	  var channelInfo = {};	    
+	  channelInfo.SearchCriterion = "AccelerometerAxis";
+	  var rval = this.so.ISensor.FindSensorChannel(channelInfo);
+		if (channelInfo) {
+		delete channelInfo.SearchCriterion;
+		}
+    if(rval.ErrorCode != 0)
+      {
+      throw  new DeviceAPIError(error2.NOT_SUPPORTED_ERR, "getScaleFactor:Operation Failed");
+      }
+    var cmap = [];    		
+		var returnvalue = rval["ReturnValue"];
+    cmap = returnvalue[0];
+    var sensorParams = {};
+	  modifyObjectBaseProp(sensorParams);
+	  sensorParams.ListeningType = "ChannelData";
+	  sensorParams.ChannelInfoMap = cmap;
+	  var result = this.so.ISensor.GetScaleFactor(sensorParams);
+	  if(sensorParams){
+	  	delete sensorParams.ChannelInfoMap;
+		  delete sensorParams.ListeningType;
+	  }
+	  if(cmap){
+	  	delete cmap.index;
+	  }
+	  if(result.ErrorCode != 0)
+        {
+        throw  new DeviceAPIError(error2.NOT_SUPPORTED_ERR, "getScaleFactor:Operation Failed");	
+        }
+   }
+   
+   catch (e1) {
+					__device_handle_exception(e1, "__sp_sensors_getScaleFactor: " + e1);
+				}
+		 return result["ReturnValue"];  
+				
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serviceproviders/jsapi/platformservices/src/sysinfo.js	Mon Jan 18 21:02:57 2010 +0200
@@ -0,0 +1,956 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Defination of class CCalendarInterface
+*
+*/
+
+
+// sysinfo service interface
+var __device_sysinfo_service_entry = {"name": null, 
+				      "version": null,
+				      "proto": __device_sysinfo,
+				      "descriptor": __device_sysinfo_descriptor,
+				      "providers": [{"descriptor": __sp_sysinfo_descriptor, "instance": __sp_sysinfo_instance}]
+				     };
+	
+
+// Private location prototype: called from service factory
+function __device_sysinfo(provider){
+	//alert("in provider");
+  //Private properties
+  this.provider = provider;
+  //Read-only properties
+  this.interfaceName = provider.descriptor.interfaceName;
+  this.version = provider.descriptor.version;  
+  //Extended methods
+  this.getChannelList = __device_channels_get;
+  this.getChannel = __device_sysinfo_get;
+  this.startChannel = __device_sysinfo_setNotifier;
+  this.stopChannel = __device_sysinfo_cancelNotifier;
+
+  this.cancel = __device_sysinfo_cancel;
+}
+
+function __device_sysinfo_descriptor(provider){
+  this.interfaceName = provider.interfaceName;
+  this.version = provider.version;
+}
+function __device_channels_get(){
+   return this.provider.getChannelList();   
+}
+
+function __device_sysinfo_get(channel, sysinfo_cb, ErrorCallback){
+  return this.provider.getChannel(channel, sysinfo_cb, ErrorCallback);
+}
+
+function __device_sysinfo_setNotifier( sysinfo_cb,channel, trigger, ErrorCallback){
+  return this.provider.startChannel(sysinfo_cb,channel,trigger, ErrorCallback);
+}
+
+function __device_sysinfo_cancelNotifier(channel){
+  return this.provider.stopChannel(channel);
+}
+
+function __device_sysinfo_cancel(id) {
+    return this.provider.cancel(id);    
+}
+	   
+
+
+
+
+// S60 sp-based sysinfo provider
+/*
+var DATA_NOT_FOUND_ERR = 101;
+var DATA_OUT_OF_RANGE_ERR = 105;
+var NOT_ALLOWED_ERR = 106;
+//var error = new DeviceAPIError();
+var error = new DeviceException();
+*/
+function __sp_sysinfo_descriptor(){
+    //Read-only properties
+    this.interfaceName = "sysinfo";
+  if(window.__Service_Interface_Ver)
+	this.version =__Service_Interface_Ver;
+  else
+	this.version =1.0;
+    //Class-static properties 
+}
+
+function __sp_sysinfo_instance(){//alert("in instance");
+    //Descriptor
+    this.descriptor = new __sp_sysinfo_descriptor();
+    //Extended methods
+    this.getChannelList = __sp_channel_descriptors_get;
+    this.getChannel = __sp_sysinfo_get;
+	this.getChannelCb = __sp_sysinfo_get_cb;
+	
+    this.startChannel = __sp_sysinfo_setNotifier;
+    this.stopChannel = __sp_sysinfo_cancelNotifier;
+    this.cancel = __sp_sysinfo_cancel;
+    this.error = new DeviceException(0, "Dummy");
+    try {
+        //__device_debug("Trying sysinfo service");
+        this.so = device.getServiceObject('Service.SysInfo', 'ISysInfo');
+		//alert( this.so);
+        //__device_debug("Got sysinfo service object: ");    
+    } 
+    catch (e) {
+        this.so = null;
+		//alert( this.so);
+        __device_handle_exception(e, "Sysinfo service not available");
+    }
+}
+// Data format is 
+// {
+//    Entity: Network, Device, Features, Battery
+//    Key:  SignalStrength, RegistrationStatus, CurrentNetwork, CellID | IMEI|| ChargingStatus, BatteryStrength
+//    [SystemData]: params
+// }
+
+function __sp_channel_descriptors_get(){
+	
+	var __sp_channel_descriptors = [{
+		name: 'Charging',
+		data: [{
+			name: 'chargingStatus',
+			range: 'true or false',
+			description: 'Charging(true) ,Not charging(false)',
+		}],
+		style: ["Sync", "Oneshot", "Notification"]
+	}, {
+		name: 'BluetoothOn',
+		data: [{
+			name: 'btOn',
+			range: 'true or false',
+			description: 'BluetoothOn(true) ,BluetoothOff(false)',
+		}],
+		style: ["Sync", "Oneshot", "Notification"]
+	}, {
+		name: 'PhoneLanguage',
+		data: [{
+			name: 'phoneLanguage',
+			range: "",
+			description: "",
+		}],
+		style: ["Sync", "Oneshot"]
+	}, {
+		name: 'ProductType',
+		data: [{
+			name: 'productType',
+			range: "",
+			description: "",
+		}],
+		style: ["Sync", "Oneshot"]
+	}, {
+		name: 'FirmwareVersion',
+		data: [{
+			name: 'firmwareVersion',
+			range: "",
+			description: "",
+		}],
+		style: ["Sync", "Oneshot"]
+	}, {
+		name: 'BatteryLevel',
+		data: [{
+			name: "batteryLevel ",
+			range: '0-100',
+			description: 'Percent battery charge'
+		}],
+		style: ["Async", "Oneshot", "Notification"]
+	}, {
+		name: 'SignalStrength',
+		data: [{
+			name: "signalStrength",
+			range: '0-100',
+			description: 'Signal Strength in Percentage'
+		}],
+		style: ["Async", "Oneshot", "Notification"]
+	}, {
+		name: 'Network',
+		data: [{
+			name: "networkName ",
+			description: "Network name"
+		}, {
+			name: "networkStatus",
+			range: "Available,Current,Forbidden",
+			description: ""
+		}, {
+			name: "networkMode",
+			range: "ModeGsm,ModeCdma,ModeWcdma",
+			description: ""
+		}, {
+			name: "mobileCountryCode",
+			range: "",
+			description: ""
+		}, {
+			name: "mobileNetworkCode",
+			range: "",
+			description: ""
+		}, {
+			name: "locationStatus",
+			range: "True, False",
+			description: ""
+		}, {
+			name: "areaCode",
+			range: "",
+			description: ""
+		}, {
+			name: "cellID",
+			range: "",
+			description: ""
+		}],
+		style: ["Async", "Oneshot", "Notification"]
+	} , {
+		name: 'IMEI',
+		data: [{
+			name: "imei",
+			range: "",
+			description: ""
+		}],
+		style: ["Sync", "Oneshot"]
+	} , {
+		name: 'OutOfMemory',
+		data: [{
+			name: "oomDrive",
+			range: "",
+			description: ""
+		}],
+		style: ["NA", "NA", "Notification"]
+	}, {
+		name: 'DeviceOrientation',
+		data: [{
+			name: "deviceOrientation",
+			range: "Landscape,Portrait",
+			description: ""
+		}],
+		style: ["Sync", "Oneshot"]
+	}, {
+		name: 'RoamingFlag',
+		data: [{
+			name: "roamingFlag",
+			range: "",
+			description: ""
+		}],
+		style: ["Sync", "Oneshot"]
+	}, {
+		name: 'DeviceInputMethod',
+		data: [{
+			name: "deviceInputMethod",
+			range: "Touch,NonTouch,Hybrid",
+			description: ""
+		}],
+		style: ["Sync", "Oneshot"]
+	}, {
+		name: 'HomeNetwork',
+		data: [{
+			name: "networkName ",
+			description: "Network name"
+		}, {
+			name: "networkStatus",
+			range: "Available,Current,Forbidden",
+			description: ""
+		}, {
+			name: "networkMode",
+			range: "ModeGsm,ModeCdma,ModeWcdma",
+			description: ""
+		}, {
+			name: "mobileCountryCode",
+			range: "",
+			description: ""
+		}, {
+			name: "mobileNetworkCode",
+			range: "",
+			description: ""
+		}, {
+			name: "locationStatus",
+			range: "True, False",
+			description: ""
+		}, {
+			name: "areaCode",
+			range: "",
+			description: ""
+		}, {
+			name: "cellID",
+			range: "",
+			description: ""
+		}],
+		style: ["Async", "Oneshot", "Notification"]
+	}];
+	return __sp_channel_descriptors;
+}
+
+var max = 110;
+var min = 40;
+var diff = max-min;
+function __sp_device_sysinfo_toDecibel(trigger) {
+    var percentage = trigger/100;
+    var decibel = max - (percentage * diff);
+	decibel = Math.round(decibel);
+    return decibel;
+}
+
+function __sp_device_sysinfo_toPercentage(signalStatus) {
+   if(signalStatus == 0){
+		return signalStatus;
+		}
+    else{
+		 var numerator = max - signalStatus;
+	    var percentage = numerator/diff;
+	    percentage *= 100;
+	    percentage = Math.round(percentage);
+	    return percentage;  
+    }             
+}
+
+function __sp_device_sysinfo_toBool(chargeStatus) {
+	if(chargeStatus == 0){
+		return false;
+		}
+    else{
+		return true;
+		}
+}
+
+function mappingVerification(errorCode) {
+	if(errorCode == 1016 || errorCode == 1012 || errorCode == 1010 || errorCode == 1009 || errorCode == 1005 || errorCode == 1000 || errorCode == 1011 || errorCode == 1007 || errorCode  == 1003 || errorCode == 1002){
+		return true;
+		}
+	else{
+		return false;		
+		}
+}
+
+function __sp_device_sysinfo_extract(sysinfo){
+
+    var channel = sysinfo.Key;
+	//alert("inside extract , channel  "+channel);
+    var dataMap = {};
+    modifyObjectBaseProp(dataMap);
+    try {
+        switch (channel) { 
+            case "ChargingStatus": 
+                dataMap.chargingStatus = __sp_device_sysinfo_toBool(sysinfo.Status);
+                break; 
+                
+            case "BatteryStrength":
+                dataMap.batteryLevel = sysinfo.Status;
+				//alert(dataMap.batteryLevel);
+                break; 
+                
+            case "SignalStrength":
+                dataMap.signalStrength = __sp_device_sysinfo_toPercentage(sysinfo.Status);
+                break;
+                
+            case "CurrentNetwork":
+				var status;
+				var  mode;
+				switch(sysinfo.NetworkStatus)
+				{
+					case 0:
+						status = "Available";
+						break;
+					case 1:
+						status = "Current";
+						break;
+					case 2:
+						status = "Forbidden";
+						break;
+					default:
+						status = "Unknown";
+						break;									
+				}
+				
+				switch(sysinfo.NetworkMode) {
+					case 1:
+						mode = "ModeGsm";
+						break;
+					case 3:
+					case 4:
+						mode = "ModeCdma";
+						break;
+					case 5:
+						mode = "ModeWcdma";
+						break;
+					default:
+						mode = "Unknown";
+						break;
+				}
+                dataMap.networkName = sysinfo.NetworkName;
+                dataMap.networkStatus = status;
+                dataMap.networkMode = mode;
+                dataMap.mobileCountryCode = sysinfo.CountryCode;
+                dataMap.mobileNetworkCode = sysinfo.NetworkCode;
+                dataMap.locationStatus = sysinfo.LocationStatus;
+                dataMap.areaCode = sysinfo.AreaCode;
+                dataMap.cellID = sysinfo.CellId;
+                break;
+                
+            case "DisplayLanguage" :
+                dataMap.phoneLanguage = sysinfo.StringData;
+                break;
+                
+            case "BlueTooth" :
+                dataMap.btOn = __sp_device_sysinfo_toBool(sysinfo.Status);
+                break;
+                
+            case "ProductType":
+                dataMap.productType = sysinfo.StringData;
+                break;
+                
+            case "FirmwareVersion" :
+                dataMap.firmwareVersion = sysinfo.StringData;
+                break;
+            
+			case "DeviceInputMethod" :
+                dataMap.deviceInputMethod = sysinfo.StringData;
+                break;			
+			    
+            default :
+                dataMap = sysinfo;
+                break;
+        }
+        return dataMap;
+    } 
+    
+    catch (e) {
+        __device_handle_exception(e, "__sp_device_sysinfo_extract: " + e);
+    }   
+}
+
+function __sp_sysinfo_get_cb(arg1, arg2, arg3){//alert("in callback of wrapper");
+		var success_cb ;
+		var error_cb ;
+	 	var CbObj;
+	    
+	    
+	    CbObj = glob_obj.getFromArray(arg1);
+	    
+	    
+	    
+	    if (CbObj) {
+	        success_cb = CbObj.success_cb;
+	        error_cb = CbObj.error_cb;
+	    }
+	    
+	    else {
+	        alert("Sysinfo: __sp_sysinfo_get_cb: Callback not found ");
+			return;
+	    }
+	    		
+        var op = null;        
+		if(arg3.ErrorCode != 0){
+				var err_msg = splitErrorMessage(arg3.ErrorMessage); 	
+				error_cb(new DeviceException(MapErrorCode[arg3.ErrorCode], "SysInfo:getChannel: "+err_msg ));
+			}
+		else if (arg3.ReturnValue) {
+		    //alert("returnvalue is"+arg3.ReturnValue);
+            op = __sp_device_sysinfo_extract(arg3.ReturnValue);
+			arg3.ReturnValue.close();
+			success_cb(op);
+        }
+		glob_obj.removeFromArray(arg1);	
+    }
+	
+function __sp_sysinfo_get(channel, sysinfo_success_cb, ErrorCallback){
+    var so;
+    var rval;
+    
+    
+	//---------------Function not in use-------------------
+    /*var cell_id_invoker = function(arg1, arg2, arg3){
+        var op = null;
+        if (arg3.ReturnValue) {
+            op = arg3.ReturnValue;
+			arg3.ReturnValue.close();
+        }
+        sysinfo_success_cb(arg1, arg3.ErrorCode, op);
+        so.ISysInfo.Cancel(arg1);
+    };*/
+	//-----------------------------------------------------------
+    var async = false;
+    var rdata = "Status";
+	var rvalSync;
+    var sys_req = {};
+	modifyObjectBaseProp(sys_req);
+    try {
+        switch (channel) {
+            case "Charging":
+                sys_req.Entity = "Battery";
+                sys_req.Key = "ChargingStatus";
+                break;
+            case "BatteryLevel":
+                sys_req.Entity = "Battery";
+                sys_req.Key = "BatteryStrength";
+                async = true;
+                break;
+            case "SignalStrength":
+                sys_req.Entity = "Network";
+                sys_req.Key = "SignalStrength";
+                async = true;
+                break;
+            case "Network":
+                sys_req.Entity = "Network";
+                sys_req.Key = "CurrentNetwork";
+                async = true;
+                break;
+		    case "PhoneLanguage": 
+                sys_req.Entity = "General";
+                sys_req.Key = "DisplayLanguage";
+                break;
+            case "BluetoothOn":
+                sys_req.Entity = "Connectivity";
+                sys_req.Key = "BlueTooth";
+                break;
+            case "ProductType":
+                sys_req.Entity = "Device";
+                sys_req.Key = "ProductType";
+                break; 
+            case "FirmwareVersion":
+                sys_req.Entity = "Device";
+                sys_req.Key = "FirmwareVersion";
+                break; 
+				
+			case "DeviceInputMethod":
+				sys_req.Entity = "Device";
+                sys_req.Key = "DeviceInputMethod";			
+			     break;	                               
+            default:
+                if (channel == null) {
+					throw new DeviceException(this.error.MISSING_ARG_ERR, "SysInfo:getChannel:channel is missing" );
+                }
+                else {
+                    if (typeof channel != "string"){ 
+                        throw new DeviceException(this.error.INVALID_ARG_ERR, "SysInfo:getChannel:channel is of invalid type");
+						}
+                    else {
+						throw new DeviceException(this.error.INVALID_ARG_ERR, "SysInfo:getChannel:channel is invalid");
+						}
+                }
+        }
+        
+        if (async) {
+            if (sysinfo_success_cb == null) {
+                throw new DeviceException( this.error.MISSING_ARG_ERR, "SysInfo:getChannel:callback is missing");
+				}
+            if (typeof sysinfo_success_cb != "function"){ 
+                 throw new DeviceException(this.error.INVALID_ARG_ERR, "SysInfo:getChannel:callback is invalid" );            
+				 }
+			if(ErrorCallback){
+				if(typeof(ErrorCallback) != 'function'){
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "SysInfo:getChannel: ErrorCallback is invalid" );
+				}
+			}
+			temp_scb = sysinfo_success_cb;
+			temp_ecb = ErrorCallback;
+            rval = this.so.ISysInfo.GetInfo(sys_req, this.getChannelCb);
+			if (rval.TransactionID) {
+            	glob_obj.addToGlobalArray(rval.TransactionID, sysinfo_success_cb, ErrorCallback);
+        	}
+            if (rval.ErrorCode != 0) {     
+						var doMap = mappingVerification(rval.ErrorCode);
+						if(doMap) {
+							switch(MapErrorCode[rval.ErrorCode])
+							{						
+								case this.error.MISSING_ARG_ERR :
+								case this.error.INVALID_ARG_ERR :							
+								if(rval.ErrorMessage)  {
+									var err_msg = splitErrorMessage(rval.ErrorMessage); 
+									throw new DeviceException(MapErrorCode[rval.ErrorCode], "SysInfo: getChannel: "+err_msg );
+								}
+								else {
+									throw new DeviceException(MapErrorCode[rval.ErrorCode], "SysInfo:getChannel:Operation Failed" );	
+								}
+								break;
+	       						default:
+									sysinfo_success_cb(0) ;
+	    					}
+						}
+						else {
+							sysinfo_success_cb(0) ;
+						}
+			}
+						
+            return rval.TransactionID;
+        }
+        else {   
+            rval = this.so.ISysInfo.GetInfo(sys_req);
+            if (rval.ErrorCode != 0) {
+                if(rval.ErrorMessage) {
+					var err_msg1 = splitErrorMessage(rval.ErrorMessage); 
+					throw new DeviceException(MapErrorCode[rval.ErrorCode], "SysInfo: getChannel: "+err_msg1 );
+				}
+				else {
+					throw new DeviceException(MapErrorCode[rval.ErrorCode], "SysInfo:getChannel:Operation Failed" );	
+				}
+            }
+            rvalSync = __sp_device_sysinfo_extract(rval.ReturnValue);
+            return rvalSync;
+        }
+		delete sys_req;
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_sysinfo_get: getChannel: " + e);
+    }
+}
+
+// channels
+var __cell_id_channel = {
+    scb: null,
+	ecb: null,
+    cancel_id: null
+};
+
+function __cell_id_channel_cb(arg1, arg2, arg3){
+    var op = null;
+	if(arg3.ErrorCode){
+		__cell_id_channel.ecb(arg3.ErrorCode);
+	}
+    else if (arg3.ReturnValue) {
+       op = arg3.ReturnValue;
+	   arg3.ReturnValue.close();
+	    __cell_id_channel.scb(op);    
+    }
+}
+
+var __charging_status_channel = {
+    scb: null,
+	ecb: null,
+    cancel_id: null    
+};
+function __charging_status_channel_cb(arg1, arg2, arg3){
+    var op = null;
+	if(arg3.ErrorCode){
+		__charging_status_channel.ecb(arg3.ErrorCode);
+	}
+    else if (arg3.ReturnValue) {
+        op = __sp_device_sysinfo_extract(arg3.ReturnValue);
+		arg3.ReturnValue.close();
+    __charging_status_channel.scb(op);
+    }
+}
+
+
+var __net_coverage_channel = {
+    scb: null,
+	ecb: null,
+    cancel_id: null    
+};
+function __net_coverage_channel_cb(arg1, arg2, arg3){
+    var op = null;
+	if(arg3.ErrorCode){
+		__net_coverage_channel.ecb(arg3.ErrorCode);
+	}
+    else if (arg3.ReturnValue) {
+        op = __sp_device_sysinfo_extract(arg3.ReturnValue);
+		arg3.ReturnValue.close();
+	    __net_coverage_channel.scb(op);
+    }
+}
+
+var __battery_level_channel = {
+    scb: null,
+	ecb: null,
+    cancel_id: null    
+};
+function __battery_level_channel_cb(arg1, arg2, arg3){
+    var op = null;
+	if(arg3.ErrorCode){
+		__battery_level_channel.ecb(arg3.ErrorCode);
+	}
+	else if (arg3.ReturnValue) {
+        op = __sp_device_sysinfo_extract(arg3.ReturnValue);
+		arg3.ReturnValue.close();
+	    __battery_level_channel.scb(op);
+    }
+}
+
+var __bluetooth_on_channel = {
+    scb: null,
+	ecb: null,
+    cancel_id: null    
+};
+function __bluetooth_on_channel_cb(arg1, arg2, arg3){
+    var op = null;
+	if(arg3.ErrorCode){
+		__bluetooth_on_channel.ecb(arg3.ErrorCode);
+	}
+	else if (arg3.ReturnValue) {
+        op = __sp_device_sysinfo_extract(arg3.ReturnValue);
+		arg3.ReturnValue.close();
+    __bluetooth_on_channel.scb(op);
+    }
+}
+
+
+var __signal_channel = {
+    scb: null,
+	ecb: null,
+    cancel_id: null    
+};
+
+
+function __signal_channel_cb(arg1, arg2, arg3){
+
+    var op = null;
+	if(arg3.ErrorCode){
+		__signal_channel.ecb(arg3.ErrorCode);
+	}
+	else if (arg3.ReturnValue) {
+        op = __sp_device_sysinfo_extract(arg3.ReturnValue);
+		arg3.ReturnValue.close();
+	    __signal_channel.scb(op);
+    }
+}
+
+
+function __sp_sysinfo_setNotifier(sysinfo_success_cb, channel_name, trigger, ErrorCallback){
+    var rval;
+    var channel = null;
+    var cb = null;
+    var sys_req = {};
+	
+	
+	 if (sysinfo_success_cb == null) {
+            throw new DeviceException(this.error.MISSING_ARG_ERR, "SysInfo:startChannel:callback is missing" );
+        }
+        if (typeof sysinfo_success_cb != "function") {
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "SysInfo:startChannel:callback is invalid" );
+        }
+		
+	
+	modifyObjectBaseProp(sys_req);
+    try {
+        switch (channel_name) {
+            case "Charging":
+                sys_req.Entity = "Battery";
+                sys_req.Key = "ChargingStatus";
+                channel = __charging_status_channel;
+                cb = __charging_status_channel_cb;
+                break;            
+            case "Network":
+                sys_req.Entity = "Network";
+                sys_req.Key = "CurrentNetwork";
+                channel = __net_coverage_channel;
+                cb = __net_coverage_channel_cb;
+                break;
+            case "BatteryLevel":
+                sys_req.Entity = "Battery";
+                sys_req.Key = "BatteryStrength";
+                sys_req.SystemData = {};
+				modifyObjectBaseProp(sys_req.SystemData);
+                if (trigger == null) {
+                    trigger = 50;
+                }
+                if(!(trigger>=0 && trigger<=100)){
+				    throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "SysInfo:startChannel:trigger is out of range" );
+					}
+				if(typeof trigger != "number"){
+					throw new DeviceException(this.error.INVALID_ARG_ERR, "SysInfo:startChannel:trigger is of  invalid type" );
+					}
+                sys_req.SystemData.Status = trigger;
+                channel = __battery_level_channel;
+                cb = __battery_level_channel_cb;
+                break;
+            case "SignalStrength":
+                sys_req.Entity = "Network";
+                sys_req.Key = "SignalStrength";
+                sys_req.SystemData = {};
+				modifyObjectBaseProp(sys_req.SystemData);
+                if (trigger != null) {
+				     if(!(trigger>=0 && trigger<=100)){
+						throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR, "SysInfo:startChannel:trigger is out of range" );
+						}
+					if(typeof trigger != "number"){
+						throw new DeviceException(this.error.INVALID_ARG_ERR, "SysInfo:startChannel:trigger is of invalid type" );
+						}
+                sys_req.SystemData.Status = __sp_device_sysinfo_toDecibel(trigger);						                 
+                }
+                channel = __signal_channel;
+                cb = __signal_channel_cb;
+                break;                
+             case "BluetoothOn":
+                sys_req.Entity = "Connectivity";
+                sys_req.Key = "BlueTooth";
+                channel = __bluetooth_on_channel;
+                cb = __bluetooth_on_channel_cb;
+                break;
+            default:
+                var error;
+                if (channel_name == null) {
+				    throw new DeviceException(this.error.MISSING_ARG_ERR, "SysInfo:startChannel:channel is missing" );
+                }
+                else {
+                    if (typeof channel_name != "string"){ 
+						throw new DeviceException(this.error.INVALID_ARG_ERR, "SysInfo:startChannel:channel is of invalid type" );
+						}
+                    else {
+                        throw new DeviceException(this.error.INVALID_ARG_ERR, "SysInfo:startChannel:channel is invalid" );
+						}
+                }
+				if(sys_req.SystemData){
+					delete sys_req.SystemData;
+					}
+        }
+        
+        channel.scb = sysinfo_success_cb;		
+       
+		channel.ecb = ErrorCallback;
+		
+		if(channel.ecb){
+				if(typeof(channel.ecb) != 'function'){
+				throw new DeviceException(this.error.INVALID_ARG_ERR, "SysInfo:startChannel: ErrorCallback is invalid" );
+				}
+			}
+        if (channel.cancel_id) {
+            var cancelParams = {};
+			modifyObjectBaseProp(cancelParams);
+            cancelParams.TransactionID = channel.cancel_id;
+            this.so.ISysInfo.Cancel(cancelParams);            
+            channel.cancel_id = null;   
+			delete cancelParams;         
+        }
+        temp_scb = sysinfo_success_cb;
+		temp_ecb = ErrorCallback;
+        rval = this.so.ISysInfo.GetNotification(sys_req, cb);
+		
+		delete sys_req;
+        if (rval.ErrorCode != 0) {
+            switch(MapErrorCode[rval.ErrorCode])
+			{						
+				case this.error.MISSING_ARG_ERR :
+				case this.error.INVALID_ARG_ERR :		
+				if(rval.ErrorMessage)  {
+					var err_msg = splitErrorMessage(rval.ErrorMessage); 
+					throw new DeviceException(MapErrorCode[rval.ErrorCode], "SysInfo: startChannel: "+err_msg );
+				}
+				else {
+					throw new DeviceException(MapErrorCode[rval.ErrorCode], "SysInfo:startChannel:Operation Failed" );	
+				}
+				break;
+				default:
+					sysinfo_success_cb(0) ;
+			}
+        }
+        channel.cancel_id = rval.TransactionID;        
+        return channel.cancel_id;
+    } 
+    
+    catch (e) {
+        __device_handle_exception(e, "__sp_sysinfo_startChannel: " + e);
+    }
+}
+
+function __sp_sysinfo_cancelNotifier(channel_name){
+    try {
+        switch (channel_name) {            
+            case "CellId":
+                channel = __cell_id_channel;
+                break;
+            case "Charging":
+                channel = __charging_status_channel;
+                break;                
+            case "Network":
+                channel = __net_coverage_channel;
+                break;
+            case "BatteryLevel":
+                channel = __battery_level_channel;
+                break;
+            case "SignalStrength":
+                channel = __signal_channel;
+                break;
+            case "BluetoothOn":
+                channel = __bluetooth_on_channel;
+                break;
+            default:
+                var error;
+                if (channel_name == null) {
+                     throw new DeviceException(this.error.MISSING_ARG_ERR, "SysInfo:stopChannel:channel is missing" );
+                }
+                else {
+                    if (typeof channel_name != "string") {
+						 throw new DeviceException(this.error.INVALID_ARG_ERR, "SysInfo:stopChannel:channel is of invalid type"  );
+						 }
+                    else{
+						throw new DeviceException(this.error.INVALID_ARG_ERR, "SysInfo:stopChannel:channel is invalid" );
+						}
+                }
+        }
+        if (channel.cancel_id) {
+            var cancelParams = {};
+			modifyObjectBaseProp(cancelParams);
+            cancelParams.TransactionID = channel.cancel_id;
+            var retval = this.so.ISysInfo.Cancel(cancelParams);   
+			delete cancelParams;   
+            if(retval.ErrorCode != 0) {
+					if(retval.ErrorMessage)  {
+						var err_msg = splitErrorMessage(retval.ErrorMessage); 
+						throw new DeviceException(MapErrorCode[retval.ErrorCode], "SysInfo: stopChannel: "+err_msg );
+					}
+					else {
+						throw new DeviceException(MapErrorCode[retval.ErrorCode], "SysInfo:stopChannel:Operation Failed" );	
+					}
+					}	           
+            channel.cancel_id = null;          
+        }
+        else {
+			throw new DeviceException(this.error.DATA_NOT_FOUND_ERR, "SysInfo:stopChannel:channel not started" );
+        }
+    } 
+    catch (e) {
+        __device_handle_exception(e, "__sp_sysinfo_stopChannel: " + e);
+    }
+}
+
+function __sp_sysinfo_cancel(cancel_Id) {
+    try {        
+        var cancelFlag = 0;
+        
+        if(cancel_Id == null) {
+            throw new DeviceException(this.error.MISSING_ARG_ERR, "SysInfo:cancel:Id is missing" );
+        }
+        
+        if(typeof cancel_Id != "number") {
+            throw new DeviceException(this.error.INVALID_ARG_ERR, "SysInfo:cancel:Id is of invalid type" );
+        }
+
+        if (cancel_Id == __charging_status_channel.cancel_id || cancel_Id == __net_coverage_channel.cancel_id || cancel_Id == __battery_level_channel.cancel_id || cancel_Id == __bluetooth_on_channel.cancel_id || cancel_Id == __signal_channel.cancel_id){
+            cancelFlag = 1;
+			}
+        
+        if (cancelFlag != 1) {          
+                var cancelParam = {
+                    TransactionID: cancel_Id
+                };
+                var retval = this.so.ISysInfo.Cancel(cancelParam);
+                if (retval.ErrorCode != 0) {
+                    if (retval.ErrorMessage) {
+                        var err_msg = splitErrorMessage(retval.ErrorMessage);//alert("err_msg_my"+err_msg);
+                        throw new DeviceException( this.error.INVALID_ARG_ERR, "SysInfo:cancel: " + err_msg);
+                    }
+                    else {
+                        throw new DeviceException(MapErrorCode[retval.ErrorCode],"SysInfo:cancel:Operation Failed" );
+                    }
+                }
+        }
+        
+        else {
+            cancelFlag = 0;
+			throw new DeviceException(this.error.NOT_ALLOWED_ERR,"SysInfo:cancel:Cannot Cancel a channel started using startChannel ");          
+        }
+    }
+    catch (e) {
+        __device_handle_exception(e, "__sp_sysinfo_cancel: " + e);
+    }  
+}
--- a/serviceproviders/sapi_contacts_vpbk/contactservice/src/addcontactobserver.cpp	Thu Dec 17 09:09:50 2009 +0200
+++ b/serviceproviders/sapi_contacts_vpbk/contactservice/src/addcontactobserver.cpp	Mon Jan 18 21:02:57 2010 +0200
@@ -224,8 +224,8 @@
             TDes16 desVal = bufVal;
             TPtrC ptrVal; //desVal.Left(0);
             TInt valLen = val->Length();
-            (MVPbkContactFieldUriData::Cast(cntField->FieldData())).SetUriL( bufVal );
- 
+            //(MVPbkContactFieldUriData::Cast(cntField->FieldData())).SetUriL( bufVal );
+            (static_cast<MVPbkContactFieldUriData&>(cntField->FieldData())).SetUriL( bufVal );
             len = val->Find(_L(":"));
                   
             if(len != -1)
--- a/serviceproviders/sapi_contacts_vpbk/contactservice/src/singlecontact.cpp	Thu Dec 17 09:09:50 2009 +0200
+++ b/serviceproviders/sapi_contacts_vpbk/contactservice/src/singlecontact.cpp	Mon Jan 18 21:02:57 2010 +0200
@@ -149,7 +149,8 @@
                       if(EVPbkFieldStorageTypeUri == storageType )
                           {
                           //TDesC val = label.Alloc();
-                          uri.Set((MVPbkContactFieldUriData::Cast(field.FieldData())).Uri());
+                          //uri.Set((MVPbkContactFieldUriData::Cast(field.FieldData())).Uri());
+                          uri.Set((static_cast<const MVPbkContactFieldUriData&>(field.FieldData())).Uri());
                    /*       TBuf<10> bufVal1;
                           bufVal1.Copy(label);
                           TBuf<100> bufVal2;
--- a/serviceproviders/sapi_contacts_vpbk/group/contactprovider.mmp	Thu Dec 17 09:09:50 2009 +0200
+++ b/serviceproviders/sapi_contacts_vpbk/group/contactprovider.mmp	Mon Jan 18 21:02:57 2010 +0200
@@ -65,6 +65,7 @@
 LIBRARY       charconv.lib 
 LIBRARY		  efsrv.lib 
 LIBRARY       estor.lib 
+LIBRARY 	  CentralRepository.lib
 
 #if defined(WINS)
     deffile ../bwins/contactproviderwinscw.def
--- a/serviceproviders/sapi_contacts_vpbk/inc/contactinterface.h	Thu Dec 17 09:09:50 2009 +0200
+++ b/serviceproviders/sapi_contacts_vpbk/inc/contactinterface.h	Mon Jan 18 21:02:57 2010 +0200
@@ -20,15 +20,22 @@
 
 //System includes
 #include <liwvariant.h>
+#include <centralrepository.h>
 
 // User Includes
 #include "contactinterface.hrh"
 #include "singlecontact.h"
 #include "contactcallbackmap.h"
+const TInt KInitialStoreUriSize = 1;
+const TUint32 KPhonebookDefaultSavingStoreUri               = 0x00000001;
+const TUint32 KCRUidPhonebook = 0x101f8794;
+const TUint32 KCRUidPhonebookStoreConfiguration             = 0x1020727f;
+
+
 // Forward Declarations
 class CContactService;
 class CContactInterfaceCallback;
-
+class CRepository;
 /**
  * CContactInterface - Provides interface between the AIW FrameWork
  * and Service Provider.
@@ -241,7 +248,9 @@
                             TInt aTransId);                                                               
                                                                                                                                   
 		MLiwNotifyCallback* Callback( TInt32 aTransactionId );                                 
-    private:
+	private:
+	    TPtrC GetDefaultDBUri();
+	private:
         // POINTER MEMBER
         /**
          * contact service implementation object.
@@ -258,6 +267,8 @@
         HBufC* iErrorMess;
         //this is used only for add api due to reset problem with TLiwVariant
         HBufC* iDburi;
+        
+        CRepository *iRepository;
   
     };
 
--- a/serviceproviders/sapi_contacts_vpbk/src/contactinterface.cpp	Thu Dec 17 09:09:50 2009 +0200
+++ b/serviceproviders/sapi_contacts_vpbk/src/contactinterface.cpp	Mon Jan 18 21:02:57 2010 +0200
@@ -40,7 +40,7 @@
 #include "contacterrormessage.hrh"
 #include "../../inc/serviceerrno.h"
 #include "contactsmaxlength.h"
-
+#include <centralrepository.h>
 using namespace LIW;
 
 #define KMissingArg -100
@@ -70,6 +70,7 @@
     {
     iContactService = CContactService::NewL();    
 	iErrorMess = HBufC::NewL(250);    
+	iRepository = CRepository::NewL( TUid::Uid(KCRUidPhonebookStoreConfiguration) );
     }
 /*
 -----------------------------------------------------------------------------
@@ -99,6 +100,7 @@
     delete iContactService;
     delete iErrorMess;
     delete iDburi;
+    delete iRepository;
     iCallbackMap.ResetAndDestroy();
     iCallbackMap.Close();		
     }
@@ -401,9 +403,10 @@
     TBool xspid = EFalse;
     TBool xspidIsDes = EFalse;
     TBool atleastOneField = EFalse;
-    iDburi = HBufC::NewL(VPbkContactStoreUris::DefaultCntDbUri().Length());    
+    //iDburi = HBufC::NewL(VPbkContactStoreUris::DefaultCntDbUri().Length());    
     //set the DBUri to the default value.    
-    iDburi->Des().Copy(VPbkContactStoreUris::DefaultCntDbUri());
+    //iDburi->Des().Copy(VPbkContactStoreUris::DefaultCntDbUri());
+    iDburi = GetDefaultDBUri().AllocLC();
     //get the number of entries in the map
     TInt keyCount = aMap->Count();
 
@@ -1052,7 +1055,8 @@
 	HBufC8* cntid = NULL;
 	CContactIter* iter;
 	CContactIterator* iterator;
-	TPtrC dbUri(VPbkContactStoreUris::DefaultCntDbUri());	
+	//TPtrC dbUri(VPbkContactStoreUris::DefaultCntDbUri());
+	TPtrC dbUri = GetDefaultDBUri();
 	//Switch based on the Ttype var value
 	switch(listType)
 	    {	    
@@ -1591,7 +1595,35 @@
 			    }
 	    return errCode;	
 	}
-	
+
+TPtrC CContactInterface::GetDefaultDBUri()
+    {
+       TPtrC dbUri;
+       HBufC* defaultStoreUri = HBufC::NewL(KInitialStoreUriSize);
+       TPtr ptr = defaultStoreUri->Des();
+       TInt actualSize = 0;
+       TInt ret = iRepository->Get
+          (KPhonebookDefaultSavingStoreUri, ptr, actualSize);
+        if (ret == KErrOverflow || ret != KErrNone)
+        {
+            delete defaultStoreUri;
+            defaultStoreUri = NULL;
+            defaultStoreUri = HBufC::NewL(actualSize);
+            ptr.Set(defaultStoreUri->Des());
+            TInt status = iRepository->Get(KPhonebookDefaultSavingStoreUri, ptr);
+            if(status == KErrNone)
+                {
+                TPtrC dbUri(VPbkContactStoreUris::DefaultCntDbUri());
+                delete defaultStoreUri;
+                defaultStoreUri = NULL;
+                return dbUri;
+                }
+            delete defaultStoreUri;
+            defaultStoreUri = NULL;
+         }   
+       dbUri.Set(ptr);
+       return dbUri;
+    }
 	
 /*
 -----------------------------------------------------------------------------
@@ -1746,7 +1778,7 @@
                     User::Leave(err);
                     }
                 } 
-            
+            CleanupStack::Pop();
             CleanupStack::Pop(contact);
             } //end of if pMap
         else
@@ -1774,8 +1806,7 @@
 		    CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &valueUri) );
 
 			//set the Db Uri to default database.
-            TPtrC dbUri(VPbkContactStoreUris::DefaultCntDbUri());
-
+            TPtrC dbUri = GetDefaultDBUri();
             TPtrC grpIdUnicode(KNullDesC);
             TPtrC grpLabel(KNullDesC);
 
@@ -2016,7 +2047,8 @@
         const CLiwMap* pMap = paramImportData->Value().AsMap();
         if(NULL != pMap)
             {
-            TPtrC  dburi(VPbkContactStoreUris::DefaultCntDbUri());
+            //TPtrC  dburi(VPbkContactStoreUris::DefaultCntDbUri());
+            TPtrC dburi = GetDefaultDBUri();
             TLiwVariant valueFname;
             CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &valueFname) );
 
@@ -2207,7 +2239,8 @@
             TLiwVariant valueUri;
             CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &valueUri) );
 
-            TPtrC dburi(VPbkContactStoreUris::DefaultCntDbUri());
+            //TPtrC dburi(VPbkContactStoreUris::DefaultCntDbUri());
+            TPtrC dburi = GetDefaultDBUri();
             if( EFalse != pMap->FindL(KDBUri,valueUri))
                 {
                 if(EVariantTypeDesC != valueUri.TypeId())
@@ -2402,7 +2435,8 @@
             TLiwVariant valueId;
             CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &valueId) );
 
-            TPtrC dbUri(VPbkContactStoreUris::DefaultCntDbUri());
+            //TPtrC dbUri(VPbkContactStoreUris::DefaultCntDbUri());
+            TPtrC dbUri = GetDefaultDBUri();
             const CLiwList* contactIdList = NULL;
 
             if( EFalse != pMap->FindL(KDBUri,valueUri))
@@ -2596,7 +2630,8 @@
 			TLiwVariant valueUri;
             CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &valueUri) );
 
-            TPtrC dbUri(VPbkContactStoreUris::DefaultCntDbUri());
+            //TPtrC dbUri(VPbkContactStoreUris::DefaultCntDbUri());
+            TPtrC dbUri = GetDefaultDBUri();
             TBool associateType = EFalse;
             HBufC8* groupId = NULL;
 
--- a/serviceproviders/sapi_landmarks/landmarksservice/inc/clandmarkdummyao.h	Thu Dec 17 09:09:50 2009 +0200
+++ b/serviceproviders/sapi_landmarks/landmarksservice/inc/clandmarkdummyao.h	Mon Jan 18 21:02:57 2010 +0200
@@ -59,6 +59,9 @@
 			TInt aError);
 
 private:
+    
+    void Delay(TInt aError);
+    
 	//from CActive
 
 	// RunL.
@@ -92,6 +95,7 @@
 
 	TPosLmItemId iId;
 
+	TBool iIsDelay;
 	};
 
 #endif /* CLANDMARKDUMMYAO_H_ */
--- a/serviceproviders/sapi_landmarks/landmarksservice/src/clandmarkdummyao.cpp	Thu Dec 17 09:09:50 2009 +0200
+++ b/serviceproviders/sapi_landmarks/landmarksservice/src/clandmarkdummyao.cpp	Mon Jan 18 21:02:57 2010 +0200
@@ -32,7 +32,7 @@
 CLandmarkDummyAO::CLandmarkDummyAO(MLandmarkObserver* aObserver,
 		CLandmarkManageObjects* aManageObjects) :
 	CActive(EPriorityNormal), iObserver(aObserver), iManageObjects(
-			aManageObjects)
+			aManageObjects),iIsDelay(EFalse)
 	{
 	CActiveScheduler::Add(this);
 	}
@@ -56,24 +56,39 @@
 	SetActive();
 	TRequestStatus* status = &iStatus;
 	User::RequestComplete(status, aError);
+	iIsDelay = ETrue;
 	}
 
+void CLandmarkDummyAO::Delay(TInt aError)
+    {
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, aError);
+    iIsDelay = EFalse;
+    }
 void CLandmarkDummyAO::RunL()
 	{
-	switch(iCmd)
-	 {
-	 case EAdd: TRAP_IGNORE(iObserver->HandleAddItemsL(iId,iTransactionId,iStatus.Int()));
-				break;
-	 case EUpdate:
-	 case ERemove: TRAP_IGNORE(iObserver->HandleItemsL(iTransactionId,iStatus.Int()));
-	 				break;
-	 default:
-		 break;
-	 }
-	
-	if (!iManageObjects->IsActive())
-		{
-		iManageObjects->Start();
-		}
+	/*if( iIsDelay )
+	    {
+	    Delay(iStatus.Int());
+	    }
+	else*/
+	    //{
+        switch(iCmd)
+         {
+         case EAdd: TRAP_IGNORE(iObserver->HandleAddItemsL(iId,iTransactionId,iStatus.Int()));
+                    break;
+         case EUpdate:
+         case ERemove: TRAP_IGNORE(iObserver->HandleItemsL(iTransactionId,iStatus.Int()));
+                        break;
+         default:
+             break;
+         }
+        
+        if (!iManageObjects->IsActive())
+            {
+            iManageObjects->Start();
+            }
+       // }
 	}
 
--- a/serviceproviders/sapi_landmarks/src/landmarkinterface.cpp	Thu Dec 17 09:09:50 2009 +0200
+++ b/serviceproviders/sapi_landmarks/src/landmarkinterface.cpp	Mon Jan 18 21:02:57 2010 +0200
@@ -2299,6 +2299,12 @@
             landmark->SetPositionFieldL (EPositionFieldBuildingTelephone,
                     variant.AsDes ( ) );
             }
+        if ( ValidateParamL (KAdd, KLandmarkstate, lmFields,
+                        LIW::EVariantTypeDesC, EFalse, variant ) )
+            {
+            landmark->SetPositionFieldL (EPositionFieldState,
+                    variant.AsDes ( ) );
+            }
         }
 	//Async Call
 	if (aCallback)
--- a/serviceproviders/sapi_sensor/sensorservice/bwins/sensorserviceu.def	Thu Dec 17 09:09:50 2009 +0200
+++ b/serviceproviders/sapi_sensor/sensorservice/bwins/sensorserviceu.def	Mon Jan 18 21:02:57 2010 +0200
@@ -4,5 +4,5 @@
 	?GetDataNotificationL@CSensorService@@QAEXABVTSensrvChannelInfo@@PAVMSensrvDataListener@@@Z @ 3 NONAME ; void CSensorService::GetDataNotificationL(class TSensrvChannelInfo const &, class MSensrvDataListener *)
 	?NewL@CSensorService@@SAPAV1@XZ @ 4 NONAME ; class CSensorService * CSensorService::NewL(void)
 	?StopNotificationL@CSensorService@@QAEXHK@Z @ 5 NONAME ; void CSensorService::StopNotificationL(int, unsigned long)
-	?GetScaleFactorL@CSensorService@@QAEXABVTSensrvChannelInfo@@AAVTSensrvProperty@@1@Z @ 6 NONAME ; void CSensorService::GetScaleFactorL(class TSensrvChannelInfo const &, class TSensrvProperty &, class TSensrvProperty &)
+	
 
--- a/serviceproviders/sapi_sensor/sensorservice/eabi/sensorserviceu.def	Thu Dec 17 09:09:50 2009 +0200
+++ b/serviceproviders/sapi_sensor/sensorservice/eabi/sensorserviceu.def	Mon Jan 18 21:02:57 2010 +0200
@@ -6,5 +6,5 @@
 	_ZN14CSensorService4NewLEv @ 5 NONAME
 	_ZTI14CSensorService @ 6 NONAME ; #<TI>#
 	_ZTV14CSensorService @ 7 NONAME ; #<VT>#
-	_ZN14CSensorService15GetScaleFactorLERK18TSensrvChannelInfoR15TSensrvPropertyS4_ @ 8 NONAME
+	
 
--- a/serviceproviders/sapi_sensor/sensorservice/inc/sensorservice.h	Thu Dec 17 09:09:50 2009 +0200
+++ b/serviceproviders/sapi_sensor/sensorservice/inc/sensorservice.h	Mon Jan 18 21:02:57 2010 +0200
@@ -122,20 +122,8 @@
 		 */		 
 		 IMPORT_C void GetChannelPropertyL(const TSensrvChannelInfo& aChannelInfo, 
 										   RSensrvPropertyList& aChannelPropertyList);
-		 /**
-          * Get Scale Factor
-          * @since S60 v5.0
-          * @param aChannelInfo refers to channel whose property will be obtained
-          * @param aMeasureRange will be populated  with obtained channel properties
-          * @param aScaleRange will be populated  with obtained channel properties
-          * @leave KErrNotFound - No open channel with that id for this client found,
-          *                    or property does not exist.
-          */      
-		 IMPORT_C void GetScaleFactorL(const TSensrvChannelInfo& aChannelInfo, 
-		                                  TSensrvProperty& aMeasureRange,
-										  TSensrvProperty& aScaleRange);
-
-	private:
+										   
+	 private:
 	 	/**
 	 	 * Constructor
 	 	 * @since S60 v5.0
--- a/serviceproviders/sapi_sensor/sensorservice/src/sensorservice.cpp	Thu Dec 17 09:09:50 2009 +0200
+++ b/serviceproviders/sapi_sensor/sensorservice/src/sensorservice.cpp	Mon Jan 18 21:02:57 2010 +0200
@@ -240,37 +240,4 @@
 		}
 			
 	}
-/*
------------------------------------------------------------------------------
-    CSensorService::GetScaleFactorL()
-    Description   : Get property of specified channel
-    Return values : NA
------------------------------------------------------------------------------
-*/  
 
-EXPORT_C void CSensorService::GetScaleFactorL(const TSensrvChannelInfo& aChannelInfo, 
-                          TSensrvProperty& aMeasureRange,TSensrvProperty& aScaleRange)
-    {
-    TInt index;
-    //Channel Id of the specified channel in the inpiut parameter
-    TUint32 channelId = aChannelInfo.iChannelId;
-    //Find if specified channel is already opened
-    if ( ( IsChannelOpen( channelId,index ) ) )
-        {
-        iChannelList[index]->GetPropertyL( KSensrvPropIdMeasureRange,-1, aMeasureRange );
-        iChannelList[index]->GetPropertyL( KSensrvPropIdScaledRange,-1, aScaleRange );
-        }
-    //else open new channel and get property change listener for it
-     else
-        {
-        CSensrvChannel* sensorChannel = CSensrvChannel::NewL( aChannelInfo );
-        CleanupStack::PushL( sensorChannel );
-        //open requested channel
-        sensorChannel->OpenChannelL();
-        sensorChannel->GetPropertyL( KSensrvPropIdMeasureRange,-1, aMeasureRange );
-        sensorChannel->GetPropertyL( KSensrvPropIdScaledRange,-1, aScaleRange );
-        sensorChannel->CloseChannel();
-        CleanupStack::PopAndDestroy( sensorChannel );
-        }
-            
-    }
--- a/serviceproviders/sapi_sensor/src/sensorinterface.cpp	Thu Dec 17 09:09:50 2009 +0200
+++ b/serviceproviders/sapi_sensor/src/sensorinterface.cpp	Mon Jan 18 21:02:57 2010 +0200
@@ -513,21 +513,49 @@
          //Retreive Channel Info
          GetChannelInfoL( channelInfo , chnlInfoMap );
          
-         TSensrvProperty measureProperty;
-         TSensrvProperty scaleProperty;
-         TRAPD(anErr,iSensorService->GetScaleFactorL( channelInfo ,
-                                                       measureProperty,scaleProperty ));
+         RSensrvPropertyList propertyList;
+         CleanupClosePushL( propertyList );
+         TRAPD( anErr, iSensorService->GetChannelPropertyL( channelInfo,
+                                                            propertyList ) );
          
          if( anErr != KErrNone )
              {
+             CleanupStack::PopAndDestroy( &propertyList );
              iErrorString = KErrInvalidChnlMap.operator()().Alloc();
              User::Leave(KErrArgument);
              }
          TReal scaleFactor ;
-         TReal measureValue;
+         TInt measureValue;
          TInt scaleValue;
-         measureProperty.GetValue( measureValue );// 0 or 1
-         scaleProperty.GetValue( scaleValue); // 8 or 12
+         TInt propCount = propertyList.Count();
+         TInt j=0;
+         TInt k=0;
+         // If no properties listed then leave with error - Not found
+         if( propCount == 0 )
+            {
+            User::Leave( KErrNotFound );
+            }
+         
+         for (TInt i = 0; i < propCount; i++ )
+             {
+             if(propertyList[i].GetPropertyId()== KSensrvPropIdMeasureRange)
+                 {
+                 if(j<1)
+                     {
+                     propertyList[i].GetValue( measureValue );
+                     j++;
+                     }
+                 }
+             if(propertyList[i].GetPropertyId()== KSensrvPropIdScaledRange)
+                 {
+                 if(k<1)
+                     {	
+                 		 propertyList[i].GetValue( scaleValue );
+               			 }
+                 }
+                             
+             }
+         CleanupStack::PopAndDestroy( &propertyList );
          TReal outputValue;
          TInt errPow;
          errPow = Math::Pow(outputValue,2,scaleValue-1);