Best JavaScript code snippet using playwright-internal
platformservices.js
Source:platformservices.js
...331};332function concatenate(){333return (this.name+": errcode: "+this.code+"\nline: "+this.lineNumber+"\nfileName: "+this.fileName+"\nerrmsg: "+this.message);334};335function splitErrorMessage(_27){336if(_27.search(/:/)!=-1){337if((_27.split(":").length)==2){338return _27.split(":")[1];339}340if((_27.split(":").length)>2){341return _27.split(":")[2];342}343}344return _27;345};346var __s60_start_and_wait_cb;347function __s60_on_app_exit(){348widget.onshow=null;349if(__s60_start_and_wait_cb!==null){350__s60_start_and_wait_cb();351}352};353function __s60_on_app_start(){354widget.onhide=null;355widget.onshow=__s60_on_app_exit;356};357function __s60_start_and_wait(id,_29,_2a){358__s60_start_and_wait_cb=_2a;359widget.onhide=__s60_on_app_start;360widget.openApplication(id,_29);361};362function __s60_api_not_supported(){363throw (err_ServiceNotSupported);364};365function __s60_enumerate_object(_2b,_2c,_2d,_2e){366var key;367for(key in _2b){368var _30;369if(_2c){370_30=_2c+"."+key;371}else{372_30=key;373}374var _31=_2b[key];375if(typeof _31=="object"){376__s60_enumerate_object(_31,_30,_2d,_2e);377}else{378_2d(_30,_31,_2e);379}380}381};382function removeFromArray(_32){383for(i=0;i<(glob_obj.glob_cb_arr.length);i++){384if(glob_obj.glob_cb_arr[i].transactionId==_32){385glob_obj.glob_cb_arr.splice(i,1);386}387}388};389function addToGlobalArray(_33,sCb,_35){390var obj=new Object();391obj.success_cb=sCb;392obj.transactionId=_33;393obj.error_cb=_35;394glob_obj.glob_cb_arr.push(obj);395};396function getFromArray(tid){397var i;398for(i=0;i<(glob_obj.glob_cb_arr.length);i++){399if(glob_obj.glob_cb_arr[i].transactionId==tid){400return glob_obj.glob_cb_arr[i];401}402}403if(temp_scb){404var obj=new Object();405obj.success_cb=temp_scb;406obj.error_cb=temp_ecb;407temp_ecb=temp_scb=null;408return obj;409}410return null;411};412var __device_landmarks_service_entry={"name":null,"version":null,"proto":__device_landmarks,"descriptor":__device_landmarks_descriptor,"providers":[{"descriptor":__sp_landmarks_descriptor,"instance":__sp_landmarks_instance}]};413function __device_landmarks(_3a){414this.provider=_3a;415this.interfaceName=_3a.descriptor.interfaceName;416this.version=_3a.descriptor.version;417this.startEditor=__device_landmarks_startEditor;418this.getCategories=__device_landmarks_getCategories;419this.getLandmarks=__device_landmarks_getLandmarks;420this.addCategory=__device_landmarks_add_category;421this.updateCategory=__device_landmarks_update_category;422this.updateLandmark=__device_landmarks_update_landmark;423this.addLandmark=__device_landmarks_add_landmark;424this.deleteCategory=__device_landmarks_delete_category;425this.deleteLandmark=__device_landmarks_delete_landmark;426this.importLandmarks=__device_landmarks_import_landmarks;427this.exportLandmarks=__device_landmarks_export_landmarks;428this.organizeLandmarks=__device_landmarks_organize_landmarks;429this.cancel=__device_landmarks_cancel;430};431function __device_landmarks_descriptor(_3b){432this.interfaceName=_3b.interfaceName;433this.version=_3b.version;434};435function __device_landmarks_startEditor(_3c,_3d){436this.provider.startEditor(_3c,_3d);437};438function __device_landmarks_getCategories(_3e,_3f,_40){439return this.provider.getCategories(_3e,_3f,_40);440};441function __device_landmarks_getLandmarks(_41,_42,_43){442return this.provider.getLandmarks(_41,_42,_43);443};444function __device_landmarks_add_category(_44,_45,_46){445return this.provider.addCategory(_44,_45,_46);446};447function __device_landmarks_add_landmark(_47,_48,_49){448return this.provider.addLandmark(_47,_48,_49);449};450function __device_landmarks_delete_category(_4a,_4b,_4c){451return this.provider.deleteCategory(_4a,_4b,_4c);452};453function __device_landmarks_delete_landmark(_4d,_4e,_4f){454return this.provider.deleteLandmark(_4d,_4e,_4f);455};456function __device_landmarks_update_landmark(_50,_51,_52){457return this.provider.updateLandmark(_50,_51,_52);458};459function __device_landmarks_update_category(_53,_54,_55){460return this.provider.updateCategory(_53,_54,_55);461};462function __device_landmarks_import_landmarks(_56,_57,_58,_59){463return this.provider.importLandmarks(_56,_57,_58,_59);464};465function __device_landmarks_export_landmarks(_5a,_5b,_5c,_5d,_5e){466return this.provider.exportLandmarks(_5a,_5b,_5c,_5d,_5e);467};468function __device_landmarks_organize_landmarks(_5f,_60,_61,_62,_63){469return this.provider.organizeLandmarks(_5f,_60,_61,_62,_63);470};471function __device_landmarks_cancel(_64){472return this.provider.cancel(_64);473};474var err_missing_argument=1003;475var err_bad_argument=1002;476var err_ServiceNotSupported=1004;477var err_InvalidService_Argument=1000;478function convertFromPS2JS(_65){479var _66=new DeviceAPIError(0,"dummy");480var _67;481switch(_65){482case 1016:483_67=_66.TIMEOUT_ERR;484break;485case 1012:486_67=_66.DATA_NOT_FOUND_ERR;487break;488case 1010:489_67=_66.DATA_ALREADY_EXISTS_ERR;490break;491case 1009:492_67=_66.SERVICE_BUSY_ERR;493break;494case 1005:495_67=_66.SERVICE_IN_USE_ERR;496break;497default:498_67=1001;499}500return _67;501};502function __sp_landmarks_descriptor(){503this.interfaceName="landmarks";504if(window.__Service_Interface_Ver){505this.version=__Service_Interface_Ver;506}else{507this.version=1;508}509};510function __sp_landmarks_instance(){511this.descriptor=new __sp_landmarks_descriptor();512this.startEditor=__sp_landmarks_startEditor;513this.getCategories=__sp_landmarks_category_getList;514this.getCategoriesCb=__sp_landmarks_category_getList_cb;515this.addCategory=__sp_landmarks_category_add;516this.addCategoryCb=__sp_landmarks_category_add_cb;517this.updateCategory=__sp_landmarks_category_update;518this.updateCategoryCb=__sp_landmarks_category_update_cb;519this.deleteCategory=__sp_landmarks_category_delete;520this.deleteCategoryCb=__sp_landmarks_category_delete_cb;521this.getLandmarks=__sp_landmarks_getList;522this.getLandmarksCb=__sp_landmarks_getList_cb;523this.addLandmark=__sp_landmarks_add;524this.addLandmarkCb=__sp_landmarks_add_cb;525this.updateLandmark=__sp_landmarks_update;526this.updateLandmarkCb=__sp_landmarks_update_cb;527this.deleteLandmark=__sp_landmarks_delete;528this.deleteLandmarkCb=__sp_landmarks_delete_cb;529this.importLandmarks=__sp_landmarks_import;530this.importLandmarksCb=__sp_landmarks_import_cb;531this.exportLandmarks=__sp_landmarks_export;532this.exportLandmarksCb=__sp_landmarks_export_cb;533this.organizeLandmarks=__sp_landmarks_organize;534this.organizeLandmarksCb=__sp_landmarks_organize_cb;535this.temporarySCb=null;536this.temporaryECb=null;537this.cancel=__sp_landmarks_cancel;538try{539this.so=device.getServiceObject("Service.Landmarks","IDataSource");540}541catch(e){542__device_handle_exception(e,"Landmarks service not available");543}544};545var __SP_CATEGORY_MIN_LOCAL_ID=16;546var __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"}];547function __sp_landmarks_category_iterator(_68){548this.iter=_68;549this.next=__sp_landmarks_category_iterator_get_next;550this.hasNext=__sp_landmarks_category_iterator_has_next;551this.hasElement=false;552this.catItem=null;553this.close=__sp_landmarks_category_close;554};555function __sp_landmarks_category_close(){556this.iter.close();557};558function __sp_landmarks_category_iterator_has_next(){559if(this.hasElement){560if(this.catItem!==null){561return true;562}else{563return false;564}565}else{566this.catItem=this.iter.getNext();567this.hasElement=true;568if(typeof this.catItem=="undefined"||this.catItem==null){569this.catItem=null;570return false;571}else{572return true;573}574}575};576function __sp_landmarks_category_iterator_get_next(){577if(this.hasElement){578var _69=new Object();579_69=this.catItem;580this.catItem=this.iter.getNext();581if(typeof (this.catItem)=="undefined"){582this.catItem=null;583}584if(_69){585return new __sp_device_category_obj(_69);586}else{587return null;588}589}else{590this.catItem=this.iter.getNext();591if(typeof this.catItem=="undefined"||this.catItem==null){592this.hasElement=true;593this.catItem=null;594return null;595}else{596this.hasElement=true;597var _6a=new Object();598_6a=this.lmItem;599this.catItem=this.iter.getNext();600if(typeof (this.catItem)=="undefined"){601this.catItem=null;602}603return new __sp_device_category_obj(_6a);604}605}606};607function __sp_landmarks_iterator(_6b){608this.iter=_6b;609this.next=__sp_landmarks_iterator_get_next;610this.hasNext=__sp_landmarks_iterator_has_next;611this.hasElement=false;612this.lmItem=null;613this.close=__sp_landmarks_landmarkitem_close;614};615function __sp_landmarks_landmarkitem_close(){616this.iter.close();617};618function __sp_device_landmark_location_obj(_6c){619this.longitude=(_6c.Longitude==undefined)?null:_6c.Longitude;620this.latitude=(_6c.Latitude==undefined)?null:_6c.Latitude;621if(_6c.Altitude){622this.altitude=_6c.Altitude;623}624if(_6c.HAccuracy){625this.hAccuracy=_6c.HAccuracy;626}627if(_6c.VAccuracy){628this.vAccuracy=_6c.VAccuracy;629}630};631function __sp_landmark_position_obj(_6d){632if((_6d.longitude!==undefined)&&(_6d.longitude!==null)&&(_6d.longitude!=="")){633this.Longitude=_6d.longitude;634}635if((_6d.latitude!==undefined)&&(_6d.latitude!==null)&&(_6d.latitude!=="")){636this.Latitude=_6d.latitude;637}638};639function __sp_landmark_position_obj_fromJS_2LIW(_6e){640var _6f=new DeviceAPIError(0,"dummy");641if(typeof (_6e)!="object"){642throw new DeviceAPIError(_6f.INVALID_ARG_ERR,"position must be of type object");643}644var _70=false;645var _71=false;646if((_6e.longitude!==undefined)&&(_6e.longitude!==null)&&(_6e.longitude!=="")){647this.Longitude=_6e.longitude;648_70=true;649}650if((_6e.latitude!==undefined)&&(_6e.latitude!==null)&&(_6e.latitude!=="")){651this.Latitude=_6e.latitude;652_71=true;653}654if(!(_70&&_71)){655throw new DeviceAPIError(_6f.MISSING_ARG_ERR,"missing position field");656}657if(_6e.altitude){658this.Altitude=_6e.altitude;659}660if(_6e.hAccuracy){661this.HAccuracy=_6e.hAccuracy;662}663if(_6e.vAccuracy){664this.VAccuracy=_6e.vAccuracy;665}666};667function __sp_landmark_bounded_area_obj(_72){668var _73=new DeviceAPIError(0,"dummy");669var _74=false;670var _75=false;671if((_72.coordinate1!==undefined)&&(_72.coordinate1!==null)&&(_72.coordinate1!=="")){672if(typeof (_72.coordinate1)!="object"){673throw new DeviceAPIError(_73.INVALID_ARG_ERR,"coordinate1 must be an object");674}else{675var _76=false;676var _77=false;677if((_72.coordinate1.latitude!==undefined)&&(_72.coordinate1.latitude!==null)&&(_72.coordinate1.latitude!=="")){678this.NorthLatitude=_72.coordinate1.latitude;679_76=true;680}681if((_72.coordinate1.longitude!==undefined)&&(_72.coordinate1.longitude!==null)&&(_72.coordinate1.longitude!=="")){682this.EastLongitude=_72.coordinate1.longitude;683_77=true;684}685if(!(_76&&_77)){686throw new DeviceAPIError(_73.MISSING_ARG_ERR,"missing position field");687}688_74=true;689}690}691if((_72.coordinate2!==undefined)&&(_72.coordinate2!==null)&&(_72.coordinate2!=="")){692if(typeof (_72.coordinate2)!="object"){693throw new DeviceAPIError(_73.INVALID_ARG_ERR,"coordinate2 must be an object");694}else{695var _76=false;696var _77=false;697if((_72.coordinate2.latitude!==undefined)&&(_72.coordinate2.latitude!==null)&&(_72.coordinate2.latitude!=="")){698this.SouthLatitude=_72.coordinate2.latitude;699_76=true;700}701if((_72.coordinate2.longitude!==undefined)&&(_72.coordinate2.longitude!==null)&&(_72.coordinate2.longitude!=="")){702this.WestLongitude=_72.coordinate2.longitude;703_77=true;704}705if(!(_76&&_77)){706throw new DeviceAPIError(_73.MISSING_ARG_ERR,"missing position field");707}708_75=true;709}710}711if(!(_74&&_75)){712throw new DeviceAPIError(_73.MISSING_ARG_ERR,"missing position field");713}714};715function __sp_device_landmark_address_obj(_78){716if(_78.Street){717this.street=_78.Street;718}719if(_78.City){720this.city=_78.City;721}722if(_78.state){723this.state=_78.state;724}725if(_78.AreaCode){726this.postalCode=_78.AreaCode;727}728if(_78.Country){729this.country=_78.Country;730}731if(_78.BuildingName){732this.building=_78.BuildingName;733}734if(_78.Telephone){735this.phone=_78.Telephone;736}737};738function __sp_landmark_address_obj(_79){739var _7a=new DeviceAPIError(0,"dummy");740if(typeof (_79)!="object"){741throw new DeviceAPIError(_7a.MISSING_ARG_ERR,"address must be of type object");742}743if(_79.street!==undefined){744if(_79.street===null){745this.Street="";746}else{747this.Street=_79.street;748}749}750if(_79.city!==undefined){751if(_79.city===null){752this.City="";753}else{754this.City=_79.city;755}756}757if(_79.state!==undefined){758if(_79.state===null){759this.state="";760}else{761this.state=_79.state;762}763}764if(_79.postalCode!==undefined){765if(_79.postalCode===null){766this.AreaCode="";767}else{768this.AreaCode=_79.postalCode;769}770}771if(_79.country!==undefined){772if(_79.country===null){773this.Country="";774}else{775this.Country=_79.country;776}777}778if(_79.building!==undefined){779if(_79.building===null){780this.BuildingName="";781}else{782this.BuildingName=_79.building;783}784}785if(_79.phone!==undefined){786if(_79.phone===null){787this.Telephone="";788}else{789this.Telephone=_79.phone;790}791}792};793function __sp_add_category_ids_for_names(_7b){794var _7c=new DeviceAPIError(0,"dummy");795var _7d=new Array();796for(var i in _7b){797if((_7b[i]!==undefined)&&(_7b[i]!=="")&&(_7b[i]!==null)){798if(typeof (_7b[i])!="string"){799throw new DeviceAPIError(_7c.INVALID_ARG_ERR,"category should be of type string");800}else{801_7d.push(_7b[i].toString());802}803}804}805return _7d;806};807function __sp_get_category_ids_for_names(_7f){808var _80=new DeviceAPIError(0,"dummy");809var _81=new Array();810var _82=0;811for(var i in _7f){812if(typeof (_7f[i])!="string"){813throw new DeviceAPIError(_80.INVALID_ARG_ERR,"category should be of type string");814}815for(var ii in __sp_category_list){816if(__sp_category_list[ii].name.toLowerCase()==_7f[i].toLowerCase()){817_81.push(__sp_category_list[ii].id.toString());818_82=1;819}820}821if(_82==0){822return null;823}824_82=0;825}826return _81;827};828function __sp_device_landmark_obj(_85){829this.landmarkId=_85.id;830if(_85.LandmarkName){831this.name=_85.LandmarkName;832}833if(_85.LandmarkDesc){834this.description=_85.LandmarkDesc;835}836if(_85.CoverageRadius){837this.coverageRadius=_85.CoverageRadius;838}839if(_85.LandmarkPosition){840this.position=new __sp_device_landmark_location_obj(_85.LandmarkPosition);841}842if(_85.CategoryInfo){843this.categoryIds=_85.CategoryInfo;844}845if(_85.LandmarkFields){846this.address=new __sp_device_landmark_address_obj(_85.LandmarkFields);847}848};849function __sp_landmarks_addLocality(add){850var _87=new DeviceAPIError(0,"dummy");851if(typeof (add)!="object"){852throw new DeviceAPIError(_87.INVALID_ARG_ERR,"address should be of type object");853}854if((add.street!==undefined)&&(add.street!==null)&&(add.street!=="")){855this.Street=add.street;856}857if((add.city!==undefined)&&(add.city!==null)&&(add.city!=="")){858this.City=add.city;859}860if((add.state!==undefined)&&(add.state!==null)&&(add.state!=="")){861this.state=add.state;862}863if((add.postalCode!==undefined)&&(add.postalCode!==null)&&(add.postalCode!=="")){864this.AreaCode=add.postalCode;865}866if((add.country!==undefined)&&(add.country!==null)&&(add.country!=="")){867this.Country=add.country;868}869if((add.building!==undefined)&&(add.building!==null)&&(add.building!=="")){870this.BuildingName=add.building;871}872if((add.phone!==undefined)&&(add.phone!==null)&&(add.phone!=="")){873this.Telephone=add.phone;874}875};876function __sp_landmarks_addPosition(pos){877var _89=new DeviceAPIError(0,"dummy");878if(typeof (pos)!="object"){879throw new DeviceAPIError(_89.INVALID_ARG_ERR,"position should be of type object");880}881if((pos.longitude!==undefined)&&(pos.longitude!==null)&&(pos.longitude!=="")){882this.Longitude=pos.longitude;883}884if((pos.latitude!==undefined)&&(pos.latitude!==null)&&(pos.latitude!=="")){885this.Latitude=pos.latitude;886}887if((pos.altitude!==undefined)&&(pos.altitude!==null)&&(pos.altitude!=="")){888this.Altitude=pos.altitude;889}890if((pos.hAccuracy!==undefined)&&(pos.hAccuracy!==null)&&(pos.hAccuracy!=="")){891this.HAccuracy=pos.hAccuracy;892}893if((pos.vAccuracy!==undefined)&&(pos.vAccuracy!==null)&&(pos.vAccuracy!=="")){894this.VAccuracy=pos.vAccuracy;895}896};897function __sp_landmarks_addLmObject(lm){898var _8b=false;899var _8c=new DeviceAPIError(0,"dummy");900if((lm.name!==undefined)&&(lm.name!==null)&&(lm.name!=="")){901this.LandmarkName=lm.name;902}903if((lm.description!==undefined)&&(lm.description!==null)&&(lm.description!=="")){904this.LandmarkDesc=lm.description;905}906if((lm.position!==undefined)&&(lm.position!==null)&&(lm.position!=="")){907this.LandmarkPosition=new __sp_landmarks_addPosition(lm.position);908_8b=true;909}910if((lm.coverageRadius!==undefined)&&(lm.coverageRadius!==null)&&(lm.coverageRadius!=="")){911if(_8b){912this.CoverageRadius=lm.coverageRadius;913}else{914throw new DeviceAPIError(_8c.MISSING_ARG_ERR,"missing position");915}916}917if((lm.categoryIds!==undefined)&&(lm.categoryIds!==null)&&(lm.categoryIds!=="")){918if(typeof (lm.categoryIds)!="object"){919throw new DeviceAPIError(_8c.INVALID_ARG_ERR,"categoryids should be of type object");920}921this.CategoryInfo=__sp_add_category_ids_for_names(lm.categoryIds);922if(!this.CategoryInfo){923throw new DeviceAPIError(_8c.MISSING_ARG_ERR,"invalid category");924}925}926if((lm.address!==undefined)&&(lm.address!==null)&&(lm.address!=="")){927this.LandmarkFields=new __sp_landmarks_addLocality(lm.address);928}929this.dummyField="dummyfield";930};931function __sp_landmark_obj(_8d,str){932var _8f=new DeviceAPIError(0,"dummy");933if(_8d.name!==undefined){934if(_8d.name===null){935this.LandmarkName="";936}else{937this.LandmarkName=_8d.name;938}939}940if((_8d.landmarkId===undefined)||(_8d.landmarkId===null)||(_8d.landmarkId==="")){941throw new DeviceAPIError(_8f.MISSING_ARG_ERR,"for updating; id must be supplied");942}else{943this.id=_8d.landmarkId;944}945if(_8d.description!==undefined){946if(_8d.description===null){947this.LandmarkDesc="";948}else{949this.LandmarkDesc=_8d.description;950}951}952if(_8d.position){953this.LandmarkPosition=new __sp_landmark_position_obj_fromJS_2LIW(_8d.position);954}955if(_8d.coverageRadius){956this.CoverageRadius=_8d.coverageRadius;957}958if(_8d.categories){959this.CategoryInfo=__sp_get_category_ids_for_names(_8d.categories);960if(!this.CategoryInfo){961throw new DeviceError("Landmarks: "+str+"Category is invalid",err_bad_argument);962}963}964if(_8d.address){965this.LandmarkFields=new __sp_landmark_address_obj(_8d.address);966}967this.temp="dummy";968};969function __sp_landmarks_iterator_has_next(){970if(this.hasElement){971if(this.lmItem!==null){972return true;973}else{974return false;975}976}else{977this.lmItem=this.iter.getNext();978this.hasElement=true;979if(typeof this.lmItem=="undefined"){980this.lmItem=null;981return false;982}else{983return true;984}985}986};987function __sp_landmarks_iterator_get_next(){988if(this.hasElement){989var _90=new Object();990_90=this.lmItem;991this.lmItem=this.iter.getNext();992if(typeof (this.lmItem)=="undefined"){993this.lmItem=null;994}995if(_90){996return new __sp_device_landmark_obj(_90);997}else{998return null;999}1000}else{1001this.lmItem=this.iter.getNext();1002if(typeof this.lmItem=="undefined"||this.lmItem==null){1003this.hasElement=true;1004this.lmItem=null;1005return null;1006}else{1007this.hasElement=true;1008var _91=new Object();1009_91=this.lmItem;1010this.lmItem=this.iter.getNext();1011if(typeof (this.lmItem)=="undefined"||this.lmItem==null){1012this.lmItem=null;1013}1014return new __sp_device_landmark_obj(_91);1015}1016}1017};1018function __sp_category_obj(_92){1019if(_92.name){1020this.CategoryName=_92.name;1021}1022if(_92.categoryId){1023this.id=_92.categoryId;1024}1025};1026function __sp_device_category_obj(_93){1027this.categoryId=_93.id;1028this.name=_93.CategoryName;1029};1030var LANDMARKS_APP_ID=270501282;1031function __sp_landmarks_startEditor(_94,_95,_96){1032error=new DeviceAPIError(0,"dummy");1033if((_94===undefined)||(_94===null)||(_94==="")){1034throw new DeviceAPIError(error.MISSING_ARG_ERR,"StartEditor:Missing Success Callback");1035}1036if((typeof _94)!="function"){1037throw new DeviceAPIError(error.INVALID_ARG_ERR,"StartEditor:Success Callback must be of type function");1038}1039if(_95!==undefined){1040if((_95!==null)&&(_95!=="")){1041throw new DeviceAPIError(error.NOT_SUPPORTED_ERR,"startEditor:landmark item is not supported");1042}1043}1044if((_96!==undefined)&&(_96!==null)&&(_96!=="")){1045if((typeof _96)!="function"){1046throw new DeviceAPIError(error.INVALID_ARG_ERR,"StartEditor:error callback must be of type function");1047}1048}1049var _97=270501282;1050var _98;1051function __s60_on_app_exit(){1052window.xwidget.onshow=null;1053if(_98){1054_98();1055}1056};1057var _99=function(_9a,_9b,_9c){1058_94(_9a,_9b,_9c);1059};1060__s60_start_and_wait(_97,"",_99);1061};1062function __sp_landmarks_category_getList_cb(_9d,_9e,_9f){1063var _a0;1064var _a1;1065var _a2;1066if(this.temporarySCb){1067_a1=this.temporarySCb;1068_a2=this.temporaryECb;1069this.temporarySCb=null;1070this.temporaryECb=null;1071}else{1072_a0=glob_obj.getFromArray(_9d);1073if(_a0){1074_a1=_a0.success_cb;1075_a2=_a0.error_cb;1076}else{1077alert("Landmarks: __sp_landmarks_category_getList_cb: Callback not found ");1078return;1079}1080}1081var _a3=null;1082if(_9f.ErrorCode||(_9e==4)){1083var _a4=convertFromPS2JS(_9f.ErrorCode);1084var _a5=new DeviceAPIError(_a4,_9f.ErrorMessage);1085if(_a2){1086_a2(_a5);1087}1088}else{1089if(_9f.ReturnValue){1090_a3=new __sp_landmarks_category_iterator(_9f.ReturnValue);1091_a1(_a3);1092}1093}1094glob_obj.removeFromArray(_9d);1095};1096function __sp_landmarks_category_getList(_a6,_a7,_a8){1097try{1098var _a9=new DeviceAPIError(0,"dummy");1099if((_a6===undefined)||(_a6==="")||(_a6===null)){1100throw new DeviceAPIError(_a9.MISSING_ARG_ERR,"callback is missing");1101}1102if(typeof (_a6)!="function"){1103throw new DeviceAPIError(_a9.INVALID_ARG_ERR,"invalid callback argument");1104}1105var _aa=false;1106if((_a8!==undefined)&&(_a8!==null)&&(_a8!=="")){1107if(typeof (_a8)!="function"){1108throw new DeviceAPIError(_a9.INVALID_ARG_ERR,"invalid error callback argument");1109}else{1110_aa=true;1111}1112}1113var _ab=new Object();1114modifyObjectBaseProp(_ab);1115_ab.Type="Category";1116if((_a7!==undefined)&&(_a7!==null)&&(_a7!=="")){1117if(typeof (_a7)!="string"){1118throw new DeviceAPIError(_a9.INVALID_ARG_ERR,"name must be a string");1119}1120}1121if(_a7){1122_ab.Filter=new Object();1123modifyObjectBaseProp(_ab.Filter);1124_ab.Filter.CategoryName=_a7;1125_ab.Filter.PreviousMatchesOnly=false;1126}1127this.temporarySCb=_a6;1128this.temporaryECb=_a8;1129var _ac=this.so.IDataSource.GetList(_ab,this.getCategoriesCb);1130if(_ac.TransactionID){1131glob_obj.addToGlobalArray(_ac.TransactionID,_a6,_a8);1132}1133if(_ac.ErrorCode!=0){1134switch(_ac.ErrorCode){1135case 1003:1136throw new DeviceAPIError(_a9.MISSING_ARG_ERR,_ac.ErrorMessage);1137break;1138case 1002:1139throw new DeviceAPIError(_a9.INVALID_ARG_ERR,_ac.ErrorMessage);1140break;1141case 1004:1142throw new DeviceAPIError(_a9.NOT_SUPPORTED_ERR,_ac.ErrorMessage);1143break;1144case 1000:1145throw new DeviceAPIError(_a9.INVALID_ARG_ERR,_ac.ErrorMessage);1146break;1147default:1148throw new DeviceAPIError(-101,"unknown error message");1149}1150}1151return _ac.TransactionID;1152}1153catch(e){1154throw e;1155}1156};1157function __sp_landmarks_category_add_cb(_ad,_ae,_af){1158var _b0;1159var _b1;1160var _b2;1161if(this.temporarySCb){1162category_cb=this.temporarySCb;1163_b2=this.temporaryECb;1164this.temporarySCb=null;1165this.temporaryECb=null;1166}else{1167_b0=glob_obj.getFromArray(_ad);1168if(_b0){1169_b1=_b0.success_cb;1170_b2=_b0.error_cb;1171}else{1172alert("Landmarks: __sp_landmarks_category_add_cb: Callback not found ");1173return;1174}1175}1176var id=null;1177if(_ae==4||_af.ErrorCode){1178var _b4=convertFromPS2JS(_af.ErrorCode);1179var _b5=new DeviceAPIError(_b4,_af.ErrorMessage);1180if(_b2){1181_b2(_b5);1182}1183}else{1184if(_af.ReturnValue){1185id=_af.ReturnValue;1186}1187_b1(id);1188}1189glob_obj.removeFromArray(_ad);1190};1191function __sp_landmarks_category_add(_b6,_b7,_b8){1192try{1193var _b9=new DeviceAPIError(0,"dummy");1194var _ba=true;1195if(_b6===undefined){1196throw new DeviceAPIError(_b9.MISSING_ARG_ERR,"AddSucessCallback is missing");1197}else{1198if(((_b6===null)||(_b6===""))&&(typeof (_b6)!="number")){1199throw new DeviceAPIError(_b9.MISSING_ARG_ERR,"AddSucessCallback is missing");1200}else{1201if(typeof (_b6)!="function"){1202throw new DeviceAPIError(_b9.INVALID_ARG_ERR,"invalid AddSucessCallback argument");1203}1204}1205}1206if(_b7===undefined||_b7===null){1207throw new DeviceAPIError(_b9.MISSING_ARG_ERR,"CategoryItem is missing");1208}else{1209if(typeof (_b7)!=="object"){1210throw new DeviceAPIError(_b9.INVALID_ARG_ERR,"invalid CategoryItem argument");1211}1212}1213if((_b8!=undefined)){1214if((!_b8)&&(typeof (_b8)!="number")){1215_ba=false;1216}else{1217if((typeof (_b8)!="function")){1218throw new DeviceAPIError(_b9.INVALID_ARG_ERR,"invalid ErrorCallback callback");1219}1220}1221}else{1222_ba=false;1223}1224var _bb=new Object();1225modifyObjectBaseProp(_bb);1226_bb.Type="Category";1227_bb.Data=new __sp_category_obj(_b7);1228this.temporarySCb=_b6;1229this.temporaryECb=_b8;1230var _bc=this.so.IDataSource.Add(_bb,this.addCategoryCb);1231if(_bc.TransactionID){1232glob_obj.addToGlobalArray(_bc.TransactionID,_b6,_b8);1233}1234if(_bc.ErrorCode!=0){1235switch(_bc.ErrorCode){1236case err_missing_argument:1237throw new DeviceAPIError(_b9.MISSING_ARG_ERR,_bc.ErrorMessage);1238break;1239case err_bad_argument:1240throw new DeviceAPIError(_b9.INVALID_ARG_ERR,_bc.ErrorMessage);1241break;1242case err_ServiceNotSupported:1243throw new DeviceAPIError(_b9.NOT_SUPPORTED_ERR,_bc.ErrorMessage);1244break;1245case err_InvalidService_Argument:1246throw new DeviceAPIError(_b9.INVALID_ARG_ERR,_bc.ErrorMessage);1247break;1248default:1249throw new DeviceAPIError(-101,"unknown error message");1250}1251}1252return _bc.TransactionID;1253}1254catch(e){1255throw e;1256}1257};1258function __sp_landmarks_add_cb(_bd,_be,_bf){1259var id=null;1260var _c1;1261var _c2;1262var _c3;1263if(this.temporarySCb){1264category_cb=this.temporarySCb;1265_c3=this.temporaryECb;1266this.temporarySCb=null;1267this.temporaryECb=null;1268}else{1269_c1=glob_obj.getFromArray(_bd);1270if(_c1){1271_c2=_c1.success_cb;1272_c3=_c1.error_cb;1273}else{1274alert("Landmarks: __sp_landmarks_add_cb: Callback not found ");1275return;1276}1277}1278if(_be==4||_bf.ErrorCode){1279var _c4=convertFromPS2JS(_bf.ErrorCode);1280var _c5=new DeviceAPIError(_c4,_bf.ErrorMessage);1281if(_c3){1282_c3(_c5);1283}1284}else{1285if(_bf.ReturnValue){1286id=_bf.ReturnValue;1287}1288_c2(id);1289}1290glob_obj.removeFromArray(_bd);1291};1292function __sp_landmarks_add(_c6,_c7,_c8){1293try{1294var _c9=new DeviceAPIError(0,"dummy");1295var _ca=true;1296if(_c6===undefined){1297throw new DeviceAPIError(_c9.MISSING_ARG_ERR,"AddSucessCallback is missing");1298}else{1299if(((_c6===null)||(_c6===""))&&(typeof (_c6)!="number")){1300throw new DeviceAPIError(_c9.MISSING_ARG_ERR,"AddSucessCallback is missing");1301}else{1302if(typeof (_c6)!="function"){1303throw new DeviceAPIError(_c9.INVALID_ARG_ERR,"invalid AddSucessCallback argument");1304}1305}1306}1307if((_c7===undefined)||(_c7===null)||(_c7==="")){1308throw new DeviceAPIError(_c9.MISSING_ARG_ERR,"LandmarkItem is missing");1309}else{1310if(typeof (_c7)!=="object"){1311throw new DeviceAPIError(_c9.INVALID_ARG_ERR,"invalid LandmarkItem argument");1312}1313}1314if((_c8!=undefined)){1315if((!_c8)&&(typeof (_c8)!="number")){1316_ca=false;1317}else{1318if((typeof (_c8)!="function")){1319throw new DeviceAPIError(_c9.INVALID_ARG_ERR,"invalid ErrorCallback callback");1320}1321}1322}else{1323_ca=false;1324}1325var str="addLandmark: ";1326var _cc=new Object();1327modifyObjectBaseProp(_cc);1328_cc.Type="Landmark";1329_cc.Data=new __sp_landmarks_addLmObject(_c7);1330this.temporarySCb=_c6;1331this.temporaryECb=_c8;1332var _cd=this.so.IDataSource.Add(_cc,this.addLandmarkCb);1333if(_cd.TransactionID){1334glob_obj.addToGlobalArray(_cd.TransactionID,_c6,_c8);1335}1336if(_cd.ErrorCode!=0){1337switch(_cd.ErrorCode){1338case err_missing_argument:1339throw new DeviceAPIError(_c9.MISSING_ARG_ERR,_cd.ErrorMessage);1340break;1341case err_bad_argument:1342throw new DeviceAPIError(_c9.INVALID_ARG_ERR,_cd.ErrorMessage);1343break;1344case err_ServiceNotSupported:1345throw new DeviceAPIError(_c9.NOT_SUPPORTED_ERR,_cd.ErrorMessage);1346break;1347case err_InvalidService_Argument:1348throw new DeviceAPIError(_c9.INVALID_ARG_ERR,_cd.ErrorMessage);1349break;1350default:1351throw new DeviceAPIError(-101,"unknown error message");1352}1353}1354return _cd.TransactionID;1355}1356catch(e){1357throw e;1358}1359};1360function __sp_landmarks_delete_cb(_ce,_cf,_d0){1361var _d1;1362var _d2;1363var _d3;1364if(this.temporarySCb){1365category_cb=this.temporarySCb;1366_d2=this.temporaryECb;1367this.temporarySCb=null;1368this.temporaryECb=null;1369}else{1370_d3=glob_obj.getFromArray(_ce);1371if(_d3){1372_d1=_d3.success_cb;1373_d2=_d3.error_cb;1374}else{1375alert("Landmarks: __sp_landmarks_delete_cb: Callback not found ");1376return;1377}1378}1379if(_cf==4||_d0.ErrorCode){1380var _d4=convertFromPS2JS(_d0.ErrorCode);1381var _d5=new DeviceAPIError(_d4,_d0.ErrorMessage);1382if(_d2){1383_d2(_d5);1384}1385}else{1386_d1();1387}1388glob_obj.removeFromArray(_ce);1389};1390function __sp_landmarks_delete(_d6,_d7,_d8){1391try{1392var _d9=new DeviceAPIError(0,"dummy");1393var _da=true;1394if(_d6===undefined){1395throw new DeviceAPIError(_d9.MISSING_ARG_ERR,"SucessCallback is missing");1396}else{1397if(((_d6===null)||(_d6===""))&&(typeof (_d6)!="number")){1398throw new DeviceAPIError(_d9.MISSING_ARG_ERR,"SucessCallback is missing");1399}else{1400if(typeof (_d6)!="function"){1401throw new DeviceAPIError(_d9.INVALID_ARG_ERR,"invalid SucessCallback argument");1402}1403}1404}1405if(_d7===undefined||_d7===null){1406throw new DeviceAPIError(_d9.MISSING_ARG_ERR,"landmarkId is missing");1407}else{1408if(typeof (_d7)!=="string"){1409throw new DeviceAPIError(_d9.INVALID_ARG_ERR,"invalid landmarkId argument");1410}1411}1412if((_d8!=undefined)){1413if((!_d8)&&(typeof (_d8)!="number")){1414_da=false;1415}else{1416if((typeof (_d8)!="function")){1417throw new DeviceAPIError(_d9.INVALID_ARG_ERR,"invalid ErrorCallback callback");1418}1419}1420}else{1421_da=false;1422}1423var _db=new Object();1424modifyObjectBaseProp(_db);1425_db.Type="Landmark";1426_db.Data=new Object();1427modifyObjectBaseProp(_db.Data);1428_db.Data.id=_d7;1429this.temporarySCb=_d6;1430this.temporaryECb=_d8;1431var _dc=this.so.IDataSource.Delete(_db,this.deleteLandmarkCb);1432if(_dc.TransactionID){1433glob_obj.addToGlobalArray(_dc.TransactionID,_d6,_d8);1434}1435if(_dc.ErrorCode!=0){1436switch(_dc.ErrorCode){1437case err_missing_argument:1438throw new DeviceAPIError(_d9.MISSING_ARG_ERR,_dc.ErrorMessage);1439break;1440case err_bad_argument:1441throw new DeviceAPIError(_d9.INVALID_ARG_ERR,_dc.ErrorMessage);1442break;1443case err_ServiceNotSupported:1444throw new DeviceAPIError(_d9.NOT_SUPPORTED_ERR,_dc.ErrorMessage);1445break;1446case err_InvalidService_Argument:1447throw new DeviceAPIError(_d9.INVALID_ARG_ERR,_dc.ErrorMessage);1448break;1449default:1450throw new DeviceAPIError(-101,"unknown error message");1451}1452}1453return _dc.TransactionID;1454}1455catch(e){1456throw e;1457}1458};1459function __sp_landmarks_update_cb(_dd,_de,_df){1460var _e0;1461var _e1;1462var _e2;1463if(this.temporarySCb){1464category_cb=this.temporarySCb;1465_e1=this.temporaryECb;1466this.temporarySCb=null;1467this.temporaryECb=null;1468}else{1469_e2=glob_obj.getFromArray(_dd);1470if(_e2){1471_e0=_e2.success_cb;1472_e1=_e2.error_cb;1473}else{1474alert("Landmarks: __sp_landmarks_update_cb: Callback not found ");1475return;1476}1477}1478if(_de==4||_df.ErrorCode){1479var _e3=convertFromPS2JS(_df.ErrorCode);1480var _e4=new DeviceAPIError(_e3,_df.ErrorMessage);1481if(_e1){1482_e1(_e4);1483}1484}else{1485_e0();1486}1487glob_obj.removeFromArray(_dd);1488};1489function __sp_landmarks_update(_e5,_e6,_e7){1490try{1491var _e8=new DeviceAPIError(0,"dummy");1492var _e9=true;1493if(_e5===undefined){1494throw new DeviceAPIError(_e8.MISSING_ARG_ERR,"SuccessCallback is missing");1495}else{1496if(((_e5===null)||(_e5===""))&&(typeof (_e5)!="number")){1497throw new DeviceAPIError(_e8.MISSING_ARG_ERR,"SuccessCallback is missing");1498}else{1499if(typeof (_e5)!="function"){1500throw new DeviceAPIError(_e8.INVALID_ARG_ERR,"invalid SuccessCallback argument");1501}1502}1503}1504if(_e6===undefined||_e6===null||_e6===""){1505throw new DeviceAPIError(_e8.MISSING_ARG_ERR,"LandmarkItem is missing");1506}else{1507if(typeof (_e6)!=="object"){1508throw new DeviceAPIError(_e8.INVALID_ARG_ERR,"invalid LandmarkItem argument");1509}1510}1511if((_e7!=undefined)){1512if((!_e7)&&(typeof (_e7)!="number")){1513_e9=false;1514}else{1515if((typeof (_e7)!="function")){1516throw new DeviceAPIError(_e8.INVALID_ARG_ERR,"invalid ErrorCallback callback");1517}1518}1519}else{1520_e9=false;1521}1522var str="updateLandmark: ";1523var _eb=new Object();1524modifyObjectBaseProp(_eb);1525_eb.Type="Landmark";1526_eb.Data=new __sp_landmark_obj(_e6,str);1527this.temporarySCb=_e5;1528this.temporaryECb=_e7;1529var _ec=this.so.IDataSource.Add(_eb,this.updateLandmarkCb);1530if(_ec.TransactionID){1531glob_obj.addToGlobalArray(_ec.TransactionID,_e5,_e7);1532}1533if(_ec.ErrorCode!=0){1534switch(_ec.ErrorCode){1535case err_missing_argument:1536throw new DeviceAPIError(_e8.MISSING_ARG_ERR,_ec.ErrorMessage);1537break;1538case err_bad_argument:1539throw new DeviceAPIError(_e8.INVALID_ARG_ERR,_ec.ErrorMessage);1540break;1541case err_ServiceNotSupported:1542throw new DeviceAPIError(_e8.NOT_SUPPORTED_ERR,_ec.ErrorMessage);1543break;1544case err_InvalidService_Argument:1545throw new DeviceAPIError(_e8.INVALID_ARG_ERR,_ec.ErrorMessage);1546break;1547default:1548throw new DeviceAPIError(-101,"unknown error message");1549}1550}1551return _ec.TransactionID;1552}1553catch(e){1554throw e;1555}1556};1557function __sp_landmarks_category_update_cb(_ed,_ee,_ef){1558var _f0;1559var _f1;1560var _f2;1561if(this.temporarySCb){1562category_cb=this.temporarySCb;1563_f1=this.temporaryECb;1564this.temporarySCb=null;1565this.temporaryECb=null;1566}else{1567_f2=glob_obj.getFromArray(_ed);1568if(_f2){1569_f0=_f2.success_cb;1570_f1=_f2.error_cb;1571}else{1572alert("Landmarks: __sp_landmarks_category_update_cb: Callback not found ");1573return;1574}1575}1576if(_ee==4||_ef.ErrorCode){1577var _f3=convertFromPS2JS(_ef.ErrorCode);1578var _f4=new DeviceAPIError(_f3,_ef.ErrorMessage);1579if(_f1){1580_f1(_f4);1581}1582}else{1583_f0();1584}1585glob_obj.removeFromArray(_ed);1586};1587function __sp_landmarks_category_update(_f5,_f6,_f7){1588try{1589var _f8=new DeviceAPIError(0,"dummy");1590var _f9=true;1591if(_f5===undefined){1592throw new DeviceAPIError(_f8.MISSING_ARG_ERR,"SucessCallback is missing");1593}else{1594if(((_f5===null)||(_f5===""))&&(typeof (_f5)!="number")){1595throw new DeviceAPIError(_f8.MISSING_ARG_ERR,"SucessCallback is missing");1596}else{1597if(typeof (_f5)!="function"){1598throw new DeviceAPIError(_f8.INVALID_ARG_ERR,"invalid SucessCallback argument");1599}1600}1601}1602if(_f6===undefined||_f6===null||_f6===""){1603throw new DeviceAPIError(_f8.MISSING_ARG_ERR,"CategoryItem is missing");1604}else{1605if(typeof (_f6)!=="object"){1606throw new DeviceAPIError(_f8.INVALID_ARG_ERR,"invalid CategoryItem argument");1607}1608}1609if((_f6.categoryId===undefined)||(_f6.categoryId===null)||(_f6.categoryId==="")){1610throw new DeviceAPIError(_f8.MISSING_ARG_ERR,"categoryId is missing");1611}1612if(typeof (_f6.categoryId)!="string"){1613throw new DeviceAPIError(_f8.INVALID_ARG_ERR,"category Id must be a string");1614}1615if((_f7!=undefined)){1616if((!_f7)&&(typeof (_f7)!="number")){1617_f9=false;1618}else{1619if((typeof (_f7)!="function")){1620throw new DeviceAPIError(_f8.INVALID_ARG_ERR,"invalid ErrorCallback callback");1621}1622}1623}else{1624_f9=false;1625}1626var _fa=new Object();1627modifyObjectBaseProp(_fa);1628_fa.Type="Category";1629_fa.Data=new __sp_category_obj(_f6);1630this.temporarySCb=_f5;1631this.temporaryECb=_f7;1632var _fb=this.so.IDataSource.Add(_fa,this.updateCategoryCb);1633if(_fb.TransactionID){1634glob_obj.addToGlobalArray(_fb.TransactionID,_f5,_f7);1635}1636if(_fb.ErrorCode!=0){1637switch(_fb.ErrorCode){1638case err_missing_argument:1639throw new DeviceAPIError(_f8.MISSING_ARG_ERR,_fb.ErrorMessage);1640break;1641case err_bad_argument:1642throw new DeviceAPIError(_f8.INVALID_ARG_ERR,_fb.ErrorMessage);1643break;1644case err_ServiceNotSupported:1645throw new DeviceAPIError(_f8.NOT_SUPPORTED_ERR,_fb.ErrorMessage);1646break;1647case err_InvalidService_Argument:1648throw new DeviceAPIError(_f8.INVALID_ARG_ERR,_fb.ErrorMessage);1649break;1650default:1651throw new DeviceAPIError(-101,"unknown error message");1652}1653}1654return _fb.TransactionID;1655}1656catch(e){1657throw e;1658}1659};1660function __sp_landmarks_category_delete_cb(_fc,_fd,_fe){1661var _ff;1662var _100;1663var _101;1664if(this.temporarySCb){1665category_cb=this.temporarySCb;1666_100=this.temporaryECb;1667this.temporarySCb=null;1668this.temporaryECb=null;1669}else{1670_101=glob_obj.getFromArray(_fc);1671if(_101){1672_ff=_101.success_cb;1673_100=_101.error_cb;1674}else{1675alert("Landmarks: __sp_landmarks_category_delete_cb: Callback not found ");1676return;1677}1678}1679if(_fd==4||_fe.ErrorCode){1680var _102=convertFromPS2JS(_fe.ErrorCode);1681var _103=new DeviceAPIError(_102,_fe.ErrorMessage);1682if(_100){1683_100(_103);1684}1685}else{1686_ff();1687}1688glob_obj.removeFromArray(_fc);1689};1690function __sp_landmarks_category_delete(_104,_105,_106){1691try{1692var _107=new DeviceAPIError(0,"dummy");1693var _108=true;1694if(_104===undefined){1695throw new DeviceAPIError(_107.MISSING_ARG_ERR,"SucessCallback is missing");1696}else{1697if(((_104===null)||(_104===""))&&(typeof (_104)!="number")){1698throw new DeviceAPIError(_107.MISSING_ARG_ERR,"SucessCallback is missing");1699}else{1700if(typeof (_104)!="function"){1701throw new DeviceAPIError(_107.INVALID_ARG_ERR,"invalid SucessCallback argument");1702}1703}1704}1705if(_105===undefined||_105===null){1706throw new DeviceAPIError(_107.MISSING_ARG_ERR,"categoryId is missing");1707}else{1708if(typeof (_105)!=="string"){1709throw new DeviceAPIError(_107.INVALID_ARG_ERR,"invalid categoryId argument");1710}1711}1712if((_106!=undefined)){1713if((!_106)&&(typeof (_106)!="number")){1714_108=false;1715}else{1716if((typeof (_106)!="function")){1717throw new DeviceAPIError(_107.INVALID_ARG_ERR,"invalid ErrorCallback callback");1718}1719}1720}else{1721_108=false;1722}1723var _109=new Object();1724modifyObjectBaseProp(_109);1725_109.Type="Category";1726_109.Data=new Object();1727modifyObjectBaseProp(_109.Data);1728_109.Data.id=_105;1729this.temporarySCb=_104;1730this.temporaryECb=_106;1731var rval=this.so.IDataSource.Delete(_109,this.deleteCategoryCb);1732if(rval.TransactionID){1733glob_obj.addToGlobalArray(rval.TransactionID,_104,_106);1734}1735if(rval.ErrorCode!=0){1736switch(rval.ErrorCode){1737case err_missing_argument:1738throw new DeviceAPIError(_107.MISSING_ARG_ERR,rval.ErrorMessage);1739break;1740case err_bad_argument:1741throw new DeviceAPIError(_107.INVALID_ARG_ERR,rval.ErrorMessage);1742break;1743case err_ServiceNotSupported:1744throw new DeviceAPIError(_107.NOT_SUPPORTED_ERR,rval.ErrorMessage);1745break;1746case err_InvalidService_Argument:1747throw new DeviceAPIError(_107.INVALID_ARG_ERR,rval.ErrorMessage);1748break;1749default:1750throw new DeviceAPIError(-101,"unknown error message");1751}1752}1753return rval.TransactionID;1754}1755catch(e){1756throw e;1757}1758};1759function __sp_landmarks_getList_cb(arg1,arg2,arg3){1760var iter=null;1761var _10f;1762var _110;1763var _111;1764if(this.temporarySCb){1765category_cb=this.temporarySCb;1766_110=this.temporaryECb;1767this.temporarySCb=null;1768this.temporaryECb=null;1769}else{1770_111=glob_obj.getFromArray(arg1);1771if(_111){1772_10f=_111.success_cb;1773_110=_111.error_cb;1774}else{1775alert("Landmarks: __sp_landmarks_getList_cb: Callback not found ");1776return;1777}1778}1779if(arg3.ErrorCode||(arg2==4)){1780var _112=convertFromPS2JS(arg3.ErrorCode);1781var _113=new DeviceAPIError(_112,arg3.ErrorMessage);1782if(_110){1783_110(_113);1784}1785}else{1786if(arg3.ReturnValue){1787iter=new __sp_landmarks_iterator(arg3.ReturnValue);1788}1789_10f(iter);1790}1791glob_obj.removeFromArray(arg1);1792};1793function __sp_landmarks_getList(_114,_115,_116){1794try{1795var _117=new DeviceAPIError(0,"dummy");1796var _118=false;1797var _119=false;1798var _11a=false;1799if((_114===undefined)||(_114===null)||(_114==="")){1800throw new DeviceAPIError(_117.MISSING_ARG_ERR,"SucessCallback is missing");1801}1802if(typeof (_114)!="function"){1803throw new DeviceAPIError(_117.INVALID_ARG_ERR,"invalid SucessCallback argument");1804}1805if((_116!==undefined)&&(_116!=="")&&(_116!==null)){1806if((typeof (_116)!="function")){1807throw new DeviceAPIError(_117.INVALID_ARG_ERR,"invalid error callback");1808}else{1809_118=true;1810}1811}1812var _11b=new Object();1813modifyObjectBaseProp(_11b);1814_11b.Type="Landmark";1815_11b.Filter=new Object();1816if((_115===undefined)||(_115===null)||(_115==="")){1817_11b.Filter.dummy="dummy";1818}else{1819if(typeof (_115)=="string"){1820_11b.Filter.LandmarkName=_115;1821}else{1822if(typeof (_115)!="object"){1823throw new DeviceAPIError(_117.INVALID_ARG_ERR,"invalid match criteria");1824}else{1825if((_115.name!==undefined)&&(_115.name!==null)&&(_115.name!=="")){1826_11b.Filter.LandmarkName=_115.name;1827}1828if((_115.description!==undefined)&&(_115.description!==null)&&(_115.description!=="")){1829_11b.Filter.LandmarkDesc=_115.description;1830}1831if((_115.categoryId!==undefined)&&(_115.categoryId!==null)&&(_115.categoryId!=="")){1832_11b.Filter.categoryId=_115.categoryId;1833}1834if((_115.position!==undefined)&&(_115.position!==null)&&(_115.position!=="")){1835if(typeof (_115.position)!="object"){1836throw new DeviceAPIError(_117.INVALID_ARG_ERR,"position must be an object");1837}else{1838_11b.Filter.LandmarkPosition=new __sp_landmark_position_obj(_115.position);1839}1840}1841if((_115.coverageRadiusUsed!==undefined)&&(_115.coverageRadiusUsed!==null)&&(_115.coverageRadiusUsed!=="")){1842if(typeof (_115.coverageRadiusUsed)!="number"){1843throw new DeviceAPIError(_117.INVALID_ARG_ERR,"coverageRadiusUsed should be number");1844}else{1845_11b.Filter.CoverageRadiusOption=_115.coverageRadiusUsed;1846}1847}1848if((_115.searchRadius!==undefined)&&(_115.searchRadius!==null)&&(_115.searchRadius!=="")){1849if(typeof (_115.searchRadius)!="number"){1850throw new DeviceAPIError(_117.INVALID_ARG_ERR,"searchRadius should be number");1851}else{1852_11b.Filter.MaximumDistance=_115.searchRadius;1853}1854}1855if((_115.area!==undefined)&&(_115.area!==null)&&(_115.area!=="")){1856if(typeof (_115.area)!="object"){1857throw new DeviceAPIError(_117.INVALID_ARG_ERR,"area must be an object");1858}else{1859_11b.Filter.BoundedArea=new __sp_landmark_bounded_area_obj(_115.area);1860}1861}1862}1863}1864}1865this.temporarySCb=_114;1866this.temporaryECb=_116;1867var rval=this.so.IDataSource.GetList(_11b,this.getLandmarksCb);1868if(rval.TransactionID){1869glob_obj.addToGlobalArray(rval.TransactionID,_114,_116);1870}1871if(rval.ErrorCode!=0){1872switch(rval.ErrorCode){1873case 1003:1874throw new DeviceAPIError(_117.MISSING_ARG_ERR,rval.ErrorMessage);1875break;1876case 1002:1877throw new DeviceAPIError(_117.INVALID_ARG_ERR,rval.ErrorMessage);1878break;1879case 1004:1880throw new DeviceAPIError(_117.NOT_SUPPORTED_ERR,rval.ErrorMessage);1881break;1882case 1000:1883throw new DeviceAPIError(_117.INVALID_ARG_ERR,rval.ErrorMessage);1884break;1885default:1886throw new DeviceAPIError(-101,"unknown error message");1887}1888}1889return rval.TransactionID;1890}1891catch(e){1892throw e;1893}1894};1895function __sp_landmarks_import_cb(arg1,arg2,arg3){1896var iter=null;1897var _121;1898var _122;1899var _123;1900if(this.temporarySCb){1901category_cb=this.temporarySCb;1902_122=this.temporaryECb;1903this.temporarySCb=null;1904this.temporaryECb=null;1905}else{1906_123=glob_obj.getFromArray(arg1);1907if(_123){1908_121=_123.success_cb;1909_122=_123.error_cb;1910}else{1911alert("Landmarks: __sp_landmarks_import_cb: Callback not found ");1912return;1913}1914}1915if(arg2==4||arg3.ErrorCode){1916var _124=convertFromPS2JS(arg3.ErrorCode);1917var _125=new DeviceAPIError(_124,arg3.ErrorMessage);1918if(_122){1919_122(_125);1920}1921}else{1922if(arg3.ReturnValue){1923iter=new __sp_landmarks_iterator(arg3.ReturnValue);1924}1925_121(iter);1926}1927glob_obj.removeFromArray(arg1);1928};1929function __sp_landmarks_import(_126,_127,_128,_129){1930try{1931var _12a=new DeviceAPIError(0,"dummy");1932var _12b=true;1933if(_126===undefined){1934throw new DeviceAPIError(_12a.MISSING_ARG_ERR,"LandmarksItrCallback is missing");1935}else{1936if(((_126===null)||(_126===""))&&(typeof (_126)!="number")){1937throw new DeviceAPIError(_12a.MISSING_ARG_ERR,"LandmarksItrCallback is missing");1938}else{1939if(typeof (_126)!="function"){1940throw new DeviceAPIError(_12a.INVALID_ARG_ERR,"invalid LandmarksItrCallback argument");1941}1942}1943}1944if(_127===undefined||_127===null){1945throw new DeviceAPIError(_12a.MISSING_ARG_ERR,"sourceFileUri is missing");1946}else{1947if(typeof (_127)!=="string"){1948throw new DeviceAPIError(_12a.INVALID_ARG_ERR,"invalid sourceFileUri argument");1949}1950}1951if(_128===undefined||_128===null){1952throw new DeviceAPIError(_12a.MISSING_ARG_ERR,"mimetype is missing");1953}else{1954if(typeof (_128)!=="string"){1955throw new DeviceAPIError(_12a.INVALID_ARG_ERR,"invalid mimetype argument");1956}1957}1958if((_129!=undefined)){1959if((!_129)&&(typeof (_129)!="number")){1960_12b=false;1961}else{1962if((typeof (_129)!="function")){1963throw new DeviceAPIError(_12a.INVALID_ARG_ERR,"invalid ErrorCallback callback");1964}1965}1966}else{1967_12b=false;1968}1969var _12c=new Object();1970modifyObjectBaseProp(_12c);1971_12c.Type="Landmark";1972_12c.Data=new Object();1973modifyObjectBaseProp(_12c.Data);1974if(_127.slice(0,7)=="file://"){1975_127=_127.slice(7);1976}else{1977if(_127.slice(0,8)=="file:///"){1978_127=_127.slice(8);1979}else{1980throw new DeviceAPIError(_12a.INVALID_ARG_ERR,"sourceFileUri is not in URI format");1981}1982}1983while(_127.search("/")!=-1){1984_127=_127.replace("/","\\");1985}1986_12c.Data.SourceFile=_127;1987_12c.Data.MimeType=_128;1988this.temporarySCb=_126;1989this.temporaryECb=_129;1990var rval=this.so.IDataSource.Import(_12c,this.importLandmarksCb);1991if(rval.TransactionID){1992glob_obj.addToGlobalArray(rval.TransactionID,_126,_129);1993}1994if(rval.ErrorCode!=0){1995switch(rval.ErrorCode){1996case err_missing_argument:1997throw new DeviceAPIError(_12a.MISSING_ARG_ERR,rval.ErrorMessage);1998break;1999case err_bad_argument:2000throw new DeviceAPIError(_12a.INVALID_ARG_ERR,rval.ErrorMessage);2001break;2002case err_ServiceNotSupported:2003throw new DeviceAPIError(_12a.NOT_SUPPORTED_ERR,rval.ErrorMessage);2004break;2005case err_InvalidService_Argument:2006throw new DeviceAPIError(_12a.INVALID_ARG_ERR,rval.ErrorMessage);2007break;2008default:2009throw new DeviceAPIError(-101,"unknown error message");2010}2011}2012return rval.TransactionID;2013}2014catch(e){2015throw e;2016}2017};2018function __sp_landmarks_export_cb(arg1,arg2,arg3){2019var _131;2020var _132;2021var _133;2022if(this.temporarySCb){2023category_cb=this.temporarySCb;2024_132=this.temporaryECb;2025this.temporarySCb=null;2026this.temporaryECb=null;2027}else{2028_133=glob_obj.getFromArray(arg1);2029if(_133){2030_131=_133.success_cb;2031_132=_133.error_cb;2032}else{2033alert("Landmarks: __sp_landmarks_export_cb: Callback not found ");2034return;2035}2036}2037if(arg2==4||arg3.ErrorCode){2038var _134=convertFromPS2JS(arg3.ErrorCode);2039var _135=new DeviceAPIError(_134,arg3.ErrorMessage);2040if(_132){2041_132(_135);2042}2043}else{2044_131();2045}2046glob_obj.removeFromArray(arg1);2047};2048function __sp_landmarks_export(_136,_137,_138,_139,_13a){2049try{2050var _13b=new DeviceAPIError(0,"dummy");2051var _13c=true;2052if(_136===undefined){2053throw new DeviceAPIError(_13b.MISSING_ARG_ERR,"SuccessCallback is missing");2054}else{2055if(((_136===null)||(_136===""))&&(typeof (_136)!="number")){2056throw new DeviceAPIError(_13b.MISSING_ARG_ERR,"SuccessCallback is missing");2057}else{2058if(typeof (_136)!="function"){2059throw new DeviceAPIError(_13b.INVALID_ARG_ERR,"invalid SuccessCallback argument");2060}2061}2062}2063if(_137===undefined||_137===null){2064throw new DeviceAPIError(_13b.MISSING_ARG_ERR,"landmarkIdList is missing");2065}else{2066if(typeof (_137)!=="object"){2067throw new DeviceAPIError(_13b.INVALID_ARG_ERR,"invalid landmarkIdList argument");2068}2069}2070if(_138===undefined||_138===null){2071throw new DeviceAPIError(_13b.MISSING_ARG_ERR,"destFileUri is missing");2072}else{2073if(typeof (_138)!=="string"){2074throw new DeviceAPIError(_13b.INVALID_ARG_ERR,"invalid destFileUri argument");2075}2076}2077if(_139===undefined||_139===null){2078throw new DeviceAPIError(_13b.MISSING_ARG_ERR,"mimetype is missing");2079}else{2080if(typeof (_139)!=="string"){2081throw new DeviceAPIError(_13b.INVALID_ARG_ERR,"invalid mimetype argument");2082}2083}2084if((_13a!=undefined)){2085if((!_13a)&&(typeof (_13a)!="number")){2086_13c=false;2087}else{2088if((typeof (_13a)!="function")){2089throw new DeviceAPIError(_13b.INVALID_ARG_ERR,"invalid ErrorCallback callback");2090}2091}2092}else{2093_13c=false;2094}2095var _13d=new Object();2096modifyObjectBaseProp(_13d);2097_13d.Type="Landmark";2098_13d.Data=new Object();2099modifyObjectBaseProp(_13d.Data);2100if(_138.slice(0,7)=="file://"){2101_138=_138.slice(7);2102}else{2103if(_138.slice(0,8)=="file:///"){2104_138=_138.slice(8);2105}else{2106throw new DeviceAPIError(_13b.INVALID_ARG_ERR,"destFileUri is not in URI format");2107}2108}2109while(_138.search("/")!=-1){2110_138=_138.replace("/","\\");2111}2112_13d.Data.DestinationFile=_138;2113_13d.Data.IdList=_137;2114_13d.Data.MimeType=_139;2115this.temporarySCb=_136;2116this.temporaryECb=_13a;2117var rval=this.so.IDataSource.Export(_13d,this.exportLandmarksCb);2118if(rval.TransactionID){2119glob_obj.addToGlobalArray(rval.TransactionID,_136,_13a);2120}2121if(rval.ErrorCode!=0){2122switch(rval.ErrorCode){2123case err_missing_argument:2124throw new DeviceAPIError(_13b.MISSING_ARG_ERR,rval.ErrorMessage);2125break;2126case err_bad_argument:2127throw new DeviceAPIError(_13b.INVALID_ARG_ERR,rval.ErrorMessage);2128break;2129case err_ServiceNotSupported:2130throw new DeviceAPIError(_13b.NOT_SUPPORTED_ERR,rval.ErrorMessage);2131break;2132case err_InvalidService_Argument:2133throw new DeviceAPIError(_13b.INVALID_ARG_ERR,rval.ErrorMessage);2134break;2135default:2136throw new DeviceAPIError(-101,"unknown error message");2137}2138}2139return rval.TransactionID;2140}2141catch(e){2142throw e;2143}2144};2145function __sp_landmarks_organize_cb(arg1,arg2,arg3){2146var _142;2147var _143;2148if(this.temporarySCb){2149category_cb=this.temporarySCb;2150_143=this.temporaryECb;2151this.temporarySCb=null;2152this.temporaryECb=null;2153}else{2154CbObj=glob_obj.getFromArray(arg1);2155if(CbObj){2156_142=CbObj.success_cb;2157_143=CbObj.error_cb;2158}else{2159alert("Landmarks: __sp_landmarks_organize_cb: Callback not found ");2160return;2161}2162}2163if(arg2==4||arg3.ErrorCode){2164var _144=convertFromPS2JS(arg3.ErrorCode);2165var _145=new DeviceAPIError(_144,arg3.ErrorMessage);2166if(_143){2167_143(_145);2168}2169}else{2170_142();2171}2172glob_obj.removeFromArray(arg1);2173};2174function __sp_landmarks_organize(_146,_147,_148,_149,_14a){2175try{2176var _14b=new DeviceAPIError(0,"dummy");2177var _14c=true;2178if(_146===undefined){2179throw new DeviceAPIError(_14b.MISSING_ARG_ERR,"SuccessCallback is missing");2180}else{2181if(((_146===null)||(_146===""))&&(typeof (_146)!="number")){2182throw new DeviceAPIError(_14b.MISSING_ARG_ERR,"SuccessCallback is missing");2183}else{2184if(typeof (_146)!="function"){2185throw new DeviceAPIError(_14b.INVALID_ARG_ERR,"invalid SuccessCallback argument");2186}2187}2188}2189if(_147===undefined||_147===null){2190throw new DeviceAPIError(_14b.MISSING_ARG_ERR,"landmarkIdList is missing");2191}else{2192if(typeof (_147)!=="object"){2193throw new DeviceAPIError(_14b.INVALID_ARG_ERR,"invalid LandmarkItem argument");2194}2195}2196if(_148===undefined||_148===null){2197throw new DeviceAPIError(_14b.MISSING_ARG_ERR,"categoryId is missing");2198}else{2199if(typeof (_148)!=="string"){2200throw new DeviceAPIError(_14b.INVALID_ARG_ERR,"invalid categoryId argument");2201}2202}2203if(_149===undefined||_149===null){2204_149=true;2205}else{2206if(typeof (_149)!=="boolean"){2207throw new DeviceAPIError(_14b.INVALID_ARG_ERR,"invalid associate argument");2208}2209}2210if((_14a!=undefined)){2211if((!_14a)&&(typeof (_14a)!="number")){2212_14c=false;2213}else{2214if((typeof (_14a)!="function")){2215throw new DeviceAPIError(_14b.INVALID_ARG_ERR,"invalid ErrorCallback callback");2216}2217}2218}else{2219_14c=false;2220}2221var _14d=new Object();2222modifyObjectBaseProp(_14d);2223_14d.Type="Landmark";2224_14d.Data=new Object();2225modifyObjectBaseProp(_14d.Data);2226_14d.Data.id=_148;2227_14d.Data.IdList=_147;2228if(_149){2229_14d.OperationType="Associate";2230}else{2231_14d.OperationType="Disassociate";2232}2233this.temporarySCb=_146;2234this.temporaryECb=_14a;2235var rval=this.so.IDataSource.Organise(_14d,this.organizeLandmarksCb);2236if(rval.TransactionID){2237glob_obj.addToGlobalArray(rval.TransactionID,_146,_14a);2238}2239if(rval.ErrorCode!=0){2240switch(rval.ErrorCode){2241case err_missing_argument:2242throw new DeviceAPIError(_14b.MISSING_ARG_ERR,rval.ErrorMessage);2243break;2244case err_bad_argument:2245throw new DeviceAPIError(_14b.INVALID_ARG_ERR,rval.ErrorMessage);2246break;2247case err_ServiceNotSupported:2248throw new DeviceAPIError(_14b.NOT_SUPPORTED_ERR,rval.ErrorMessage);2249break;2250case err_InvalidService_Argument:2251throw new DeviceAPIError(_14b.INVALID_ARG_ERR,rval.ErrorMessage);2252break;2253default:2254throw new DeviceAPIError(-101,"unknown error message");2255}2256}2257return rval.TransactionID;2258}2259catch(e){2260throw e;2261}2262};2263function __sp_landmarks_cancel(_14f){2264try{2265var _150=new DeviceAPIError(0,"dummy");2266if((_14f===undefined)||(_14f===null)||(_14f==="")){2267throw new DeviceAPIError(_150.MISSING_ARG_ERR,"transactionId is missing");2268}2269if(typeof (_14f)!="number"){2270throw new DeviceAPIError(_150.INVALID_ARG_ERR,"invalid transactionId argument");2271}2272if(_14f<0){2273throw new DeviceAPIError(_150.DATA_NOT_FOUND_ERR,"non-existent transactionId");2274}2275var _151=new Object();2276modifyObjectBaseProp(_151);2277_151.TransactionID=_14f;2278var rval=this.so.IDataSource.Cancel(_151);2279if(rval.ErrorCode!=0){2280switch(rval.ErrorCode){2281case err_missing_argument:2282throw new DeviceAPIError(_150.MISSING_ARG_ERR,rval.ErrorMessage);2283break;2284case err_bad_argument:2285throw new DeviceAPIError(_150.INVALID_ARG_ERR,rval.ErrorMessage);2286break;2287case err_ServiceNotSupported:2288throw new DeviceAPIError(_150.NOT_SUPPORTED_ERR,rval.ErrorMessage);2289break;2290case err_InvalidService_Argument:2291throw new DeviceAPIError(_150.INVALID_ARG_ERR,rval.ErrorMessage);2292break;2293default:2294throw new DeviceAPIError(-101,"unknown error message");2295}2296}2297}2298catch(e){2299throw e;2300}2301};2302function __device_media_descriptor(_153){2303this.interfaceName=_153.interfaceName;2304this.version=_153.version;2305};2306function __device_media_getList(_154,_155,_156,_157){2307return this.provider.getList(_154,_155,_156,_157);2308};2309function __device_media_getThumbnail(_158,_159,_15a){2310return this.provider.getThumbnail(_158,_159,_15a);2311};2312function __device_media_addStreamUri(uri){2313return this.provider.addStreamUri(uri);2314};2315function __device_media_deleteStreamUri(uri){2316return this.provider.deleteStreamUri(uri);2317};2318function __device_media_cancel(_15d){2319this.provider.cancel(_15d);2320};2321function __device_media_refreshMediaDb(uri){2322this.provider.refreshMediaDb(uri);2323};2324function __device_media(_15f){2325this.provider=_15f;2326this.interfaceName=_15f.descriptor.interfaceName;2327this.version=_15f.descriptor.version;2328this.SORT_ASCENDING=0;2329this.SORT_DESCENDING=1;2330this.getList=__device_media_getList;2331this.getThumbnail=__device_media_getThumbnail;2332this.addStreamUri=__device_media_addStreamUri;2333this.deleteStreamUri=__device_media_deleteStreamUri;2334this.refreshMediaDb=__device_media_refreshMediaDb;2335this.cancel=__device_media_cancel;2336};2337var __device_media_service_entry={"name":null,"version":null,"proto":__device_media,"descriptor":__device_media_descriptor,"providers":[{"descriptor":__sp_media_descriptor,"instance":__sp_media_instance}]};2338function __device_media_descriptor(_160){2339this.interfaceName=_160.interfaceName;2340this.version=_160.version;2341};2342function __device_media_getList(_161,_162,_163,_164){2343return this.provider.getList(_161,_162,_163,_164);2344};2345function __device_media_getThumbnail(_165,_166,_167){2346return this.provider.getThumbnail(_165,_166,_167);2347};2348function __device_media_addStreamUri(uri){2349return this.provider.addStreamUri(uri);2350};2351function __device_media_deleteStreamUri(uri){2352return this.provider.deleteStreamUri(uri);2353};2354function __device_media_cancel(_16a){2355this.provider.cancel(_16a);2356};2357function __device_media_refreshMediaDb(uri){2358this.provider.refreshMediaDb(uri);2359};2360function __device_media(_16c){2361this.provider=_16c;2362this.interfaceName=_16c.descriptor.interfaceName;2363this.version=_16c.descriptor.version;2364this.SORT_ASCENDING=0;2365this.SORT_DESCENDING=1;2366this.getList=__device_media_getList;2367this.getThumbnail=__device_media_getThumbnail;2368this.addStreamUri=__device_media_addStreamUri;2369this.deleteStreamUri=__device_media_deleteStreamUri;2370this.refreshMediaDb=__device_media_refreshMediaDb;2371this.cancel=__device_media_cancel;2372};2373var __device_media_service_entry={"name":null,"version":null,"proto":__device_media,"descriptor":__device_media_descriptor,"providers":[{"descriptor":__sp_media_descriptor,"instance":__sp_media_instance}]};2374var FILESCHMLEN=7;2375function __sp_media_descriptor(){2376this.interfaceName="media";2377if(window.__Service_Interface_Ver){2378this.version=__Service_Interface_Ver;2379}else{2380this.version=1;2381}2382};2383function __sp_device_media_item_build(_16d){2384if(!_16d){2385return null;2386}2387var _16e={};2388modifyObjectBaseProp(_16e);2389if(_16d.FileNameAndPath){2390var _16f=_16d.FileNameAndPath.replace(/\\/g,"/");2391var _170="file://";2392_16e.uri=_170+_16f;2393}2394if(_16d.MediaType){2395var _171=_16d.MediaType;2396switch(_171){2397case 1:2398case 2:2399_16e.type="audio";2400break;2401case 3:2402_16e.type="image";2403break;2404case 4:2405_16e.type="video";2406break;2407case 5:2408_16e.type="stream";2409break;2410default:2411break;2412}2413}2414if(_16d.FileName){2415if(_16d.MediaType==3){2416_16e.title=_16d.FileName;2417}2418}2419if(_16d.FileDate){2420_16e.date=new Date(Date.parse(_16d.FileDate));2421}2422if(_16d.FileSize){2423_16e.size=_16d.FileSize;2424}2425if(_16d.SongName){2426_16e.title=_16d.SongName;2427}2428if(_16d.Artist){2429_16e.artist=_16d.Artist;2430}2431if(_16d.Album){2432_16e.album=_16d.Album;2433}2434if(_16d.Genre){2435_16e.genre=_16d.Genre;2436}2437if(_16d.TrackNumber){2438_16e.track=_16d.TrackNumber;2439}2440if(_16d.Composer){2441_16e.composer=_16d.Composer;2442}2443return _16e;2444};2445function __sp_media_iterator_get_next(){2446var item=this.iter.getNext();2447if(typeof item=="undefined"){2448return null;2449}2450var _173=__sp_device_media_item_build(item);2451item.close();2452return _173;2453};2454function __sp_media_iterator(_174){2455this.iter=_174;2456this.next=__sp_media_iterator_get_next;2457this.close=function(){2458this.iter.close();2459};2460};2461function __sp_media_get_field_name(name,type){2462this.error=new DeviceException(0,"Dummy");2463if(typeof name!="string"){2464throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:field is of invalid type");2465}2466switch(name.toLowerCase()){2467case "title":2468if(type=="Image"||type=="Video"){2469return "FileName";2470}else{2471return "SongName";2472}2473case "artist":2474return "Artist";2475case "album":2476return "Album";2477case "genre":2478return "Genre";2479case "track":2480return "TrackNumber";2481case "composer":2482return "Composer";2483default:2484return null;2485}2486};2487function __sp_media_get_sortfield_name(name,type){2488this.error=new DeviceException(0,"Dummy");2489if(typeof name!="string"){2490throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:sortBy is of invalid type");2491}2492var _179=name.toLowerCase();2493if(_179=="date"){2494return "FileDate";2495}else{2496return __sp_media_get_field_name(name,type);2497}2498};2499function __sp_media_get_date_objct(date){2500var _17b="";2501_17b=date.getFullYear().toString();2502if(date.getMonth()<10){2503_17b=_17b+("0")+(date.getMonth().toString());2504}else{2505_17b=_17b+(date.getMonth().toString());2506}2507var day=date.getDate()-1;2508if(day<10){2509_17b=_17b+("0")+(day.toString());2510}else{2511_17b=_17b+(day.toString());2512}2513_17b=_17b+(":");2514if(date.getHours()<10){2515_17b=_17b+("0")+(date.getHours().toString());2516}else{2517_17b=_17b+(date.getHours().toString());2518}2519if(date.getMinutes()<10){2520_17b=_17b+("0")+(date.getMinutes().toString());2521}else{2522_17b=_17b+(date.getMinutes().toString());2523}2524if(date.getSeconds()<10){2525_17b=_17b+("0")+(date.getSeconds().toString());2526}else{2527_17b=_17b+(date.getSeconds().toString());2528}2529return _17b;2530};2531function __sp_media_getList_cb(arg1,arg2,arg3){2532var _180;2533var _181;2534var _182;2535_182=glob_obj.getFromArray(arg1);2536if(_182){2537_180=_182.success_cb;2538_181=_182.error_cb;2539}else{2540alert("Media : __sp_media_getList_cb: Callback not found ");2541return;2542}2543if(arg3.ErrorCode!=0&&arg3.ErrorCode!=1010){2544_181(new DeviceException(arg3.ErrorCode,"Media: getList: Operation Failed"));2545return;2546}2547if(arg2!=event_cancelled){2548var iter=null;2549if(arg3.ReturnValue){2550iter=new __sp_media_iterator(arg3.ReturnValue);2551}2552_180(iter);2553}2554glob_obj.removeFromArray(arg1);2555};2556function __sp_media_getList(_184,_185,_186,_187){2557if(!_184){2558throw new DeviceException(this.error.MISSING_ARG_ERR,"Media:getList:Callback is missing");2559}else{2560if(typeof _184!="function"){2561throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:Callback is of invalid type");2562}2563}2564if(_187){2565if(typeof _187!="function"){2566throw new DeviceException(this.error.INVALID_ARG_ERR,"Media: getList: error callback is invalid");2567}2568}2569if((typeof _185)!="object"){2570throw new DeviceException(this.error.INVALID_ARG_ERR,"Invalid Argument:"+_185);2571}2572if(_185){2573if(("sortBy" in _185)&&(_185.sortBy==undefined||_185.sortBy==null||_185.sortBy=="")){2574throw new DeviceException(this.error.INVALID_ARG_ERR,"Media: getList: sortby is invalid");2575}2576}2577var _188={};2578modifyObjectBaseProp(_188);2579_188.Type="FileInfo";2580_188.Filter={};2581modifyObjectBaseProp(_188.Filter);2582_188.Sort={};2583modifyObjectBaseProp(_188.Sort);2584if(_185){2585if(_185.type){2586if(typeof _185.type!="string"){2587throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:type is of invalid type");2588}2589switch(_185.type.toLowerCase()){2590case "audio":2591_188.Filter.FileType="audio";2592break;2593case "image":2594_188.Filter.FileType="Image";2595break;2596case "video":2597_188.Filter.FileType="Video";2598break;2599case "stream":2600_188.Filter.FileType="StreamingURL";2601break;2602default:2603throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList: type is invalid");2604}2605if(("field" in _185)&&(_185.field==undefined||_185.field==null)){2606throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:field is invalid");2607}2608if(_185.field!=null){2609_188.Filter.Key=__sp_media_get_field_name(_185.field.name,_188.Filter.FileType);2610if(_188.Filter.Key==null){2611throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:key is invalid");2612}2613if(_185.field.value){2614_188.Filter.StartRange=_185.field.value;2615if(_188.Filter.Key=="TrackNumber"){2616_188.Filter.EndRange=_185.field.value;2617}2618}2619}else{2620if(_185.dateRange){2621if(typeof _185.dateRange!="object"){2622throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:dateRange is of invalid type");2623}2624_188.Filter.Key="FileDate";2625if((typeof _185.dateRange.start!="undefined")&&(typeof _185.dateRange.end!="undefined")){2626if((typeof _185.dateRange.start!="object")||(_185.dateRange.start=="")||(_185.dateRange.start==null)){2627throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:dateRange:start is of invalid type");2628}else{2629_188.Filter.StartRange=__sp_media_get_date_objct(_185.dateRange.start);2630}2631if((typeof _185.dateRange.end!="object")||(_185.dateRange.end=="")||(_185.dateRange.end==null)){2632throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:dateRange:end is of invalid type");2633}else{2634_188.Filter.EndRange=__sp_media_get_date_objct(_185.dateRange.end);2635}2636}else{2637throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:start or end of dateRange is missing");2638}2639}else{2640if(("dateRange" in _185)&&(_185.dateRange==0||_185.dateRange==null||_185.dateRange=="")){2641throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList: dateRange is Invalid");2642}2643}2644}2645if(_185.sortBy){2646_188.Sort.Key=__sp_media_get_sortfield_name(_185.sortBy,_188.Filter.FileType);2647if(_188.Sort.Key==null){2648throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:sortBy is invalid");2649}2650}else{2651_188.Sort.Key="FileDate";2652}2653if(_186){2654if(_186==this.SORT_ASCENDING){2655_188.Sort.Order="Ascending";2656}else{2657if(_186==this.SORT_DESCENDING){2658_188.Sort.Order="Descending";2659}else{2660if((_186!=this.SORT_ASCENDING)||(_186!=this.SORT_DESCENDING)){2661throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:sortBy is invalid");2662}2663}2664}2665}else{2666_188.Sort.Order="Ascending";2667}2668}else{2669throw new DeviceException(this.error.MISSING_ARG_ERR,"Media:type is missing");2670}2671}else{2672_188.Filter.FileType="all";2673_188.Sort.Key="FileDate";2674_188.Sort.Order="Ascending";2675}2676try{2677temp_scb=_184;2678temp_ecb=_187;2679var rval=this.so.IDataSource.GetList(_188,this.getListMediaCb);2680if(rval.TransactionID){2681glob_obj.addToGlobalArray(rval.TransactionID,_184,_187);2682}2683if(_188.Sort){2684delete _188.Sort;2685}2686if(_188.Filter.StartRange){2687delete _188.Filter.StartRange;2688}2689if(_188.Filter.EndRange){2690delete _188.Filter.EndRange;2691}2692if(_188.Filter){2693delete _188.Filter;2694}2695if(rval.ErrorCode!=0){2696switch(MapErrorCode[rval.ErrorCode]){2697case this.error.MISSING_ARG_ERR:2698case this.error.INVALID_ARG_ERR:2699case this.error.NOT_SUPPORTED_ERR:2700if(rval.ErrorMessage){2701var _18a=splitErrorMessage(rval.ErrorMessage);2702throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getList:"+_18a);2703}else{2704throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getList:Operation failed");2705}2706break;2707default:2708_187(new DeviceException(MapErrorCode[rval.ErrorCode],"Media: getList: Operation Failed"));2709}2710}2711return rval.TransactionID;2712}2713catch(e){2714__device_handle_exception(e,"__sp_media_getList: "+e);2715}2716};2717function __sp_media_getThumbnail_cb(arg1,arg2,arg3){2718var _18e;2719var _18f;2720var _190;2721_190=glob_obj.getFromArray(arg1);2722if(_190){2723_18f=_190.success_cb;2724_18e=_190.error_cb;2725}else{2726alert("Media : __sp_media_getThumbnail_cb: Callback not found ");2727return;2728}2729if(arg3.ErrorCode!=0&&arg3.ErrorCode!=1010){2730_18e(new DeviceException(arg3.ErrorCode,"Media: getThumbnail: Operation Failed"));2731return;2732}2733if(arg2!=event_cancelled){2734var _191=null;2735if(arg3.ReturnValue){2736_191=arg3.ReturnValue.replace(/\\/g,"/");2737var _192="file://";2738_191=_192+_191;2739}2740_18f(_191);2741}2742glob_obj.removeFromArray(arg1);2743};2744function __sp_media_getThumbnail(_193,_194,_195){2745if(!_193){2746throw new DeviceException(this.error.MISSING_ARG_ERR,"Media:getThumbnail:Callback is missing");2747}else{2748if(typeof _193!="function"){2749throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getList:Callback is invalid");2750}2751}2752if(_195){2753var _196=_195;2754if(typeof _195!="function"){2755throw new DeviceException(this.error.INVALID_ARG_ERR,"Media: getThumbnail: error callback is invalid");2756}2757}2758var _197={};2759modifyObjectBaseProp(_197);2760if(_194){2761if(typeof _194!="object"){2762throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getThumbnail:thumbnailInfo is of invalid type object");2763}2764if(_194.uri){2765if(typeof _194.uri!="string"){2766throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getThumbnail:uri is not of type string");2767}2768if(_194.uri.search("file://")==0){2769url=_194.uri.slice(FILESCHMLEN);2770_197.Url=url.replace(/\//g,"\\");2771}else{2772throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getThumbnail:uri is not in file protocol");2773}2774}else{2775throw new DeviceException(this.error.MISSING_ARG_ERR,"Media:getThumbnail:uri is missing");2776}2777}else{2778throw new DeviceException(this.error.MISSING_ARG_ERR,"Media:thumbnailInfo is missing");2779}2780if(_194.size==null||_194.size==""){2781throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getThumbnail:size is not of type Object");2782}2783if(_194.size){2784if(typeof _194.size!="object"){2785throw new DeviceException(this.error.INVALID_ARG_ERR,"Media:getThumbnail:size is not of type Object");2786}2787if((typeof _194.size.width=="undefined")&&(typeof _194.size.height=="undefined")){2788throw new DeviceException(this.error.MISSING_ARG_ERR,"Media:thumbnailInfo should have atleast width or height");2789}else{2790var _198={};2791modifyObjectBaseProp(_198);2792if(typeof _194.size.width!="undefined"){2793_198.width=_194.size.width;2794}2795if(typeof _194.size.height!="undefined"){2796_198.height=_194.size.height;2797}2798_197.ThumbnailSize=_198;2799delete _198;2800}2801}2802try{2803temp_scb=_193;2804temp_ecb=_195;2805var rval=this.so.IDataSource.GetThumbnail(_197,this.getThumbnailCb);2806if(rval.TransactionID){2807glob_obj.addToGlobalArray(rval.TransactionID,_193,_195);2808}2809delete _197;2810if(rval.ErrorCode!=0){2811switch(MapErrorCode[rval.ErrorCode]){2812case this.error.MISSING_ARG_ERR:2813_195(new DeviceException(this.error.MISSING_ARG_ERR,"Media: getThumbnail: Operation Failed"));2814break;2815case this.error.NOT_SUPPORTED_ERR:2816_195(new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getThumbnail:Operation failed"));2817break;2818case this.error.INVALID_ARG_ERR:2819throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getThumbnail:Operation failed");2820break;2821default:2822if(_195){2823_195(new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getThumbnail:Operation failed"));2824}else{2825throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:getThumbnail:Operation failed");2826}2827}2828}2829return rval.TransactionID;2830}2831catch(e){2832__device_handle_exception(e,"__sp_media_getThumbnail: "+e);2833}2834};2835function __sp_media_addStreamUri(uri){2836throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:addStreamUri:Not Supported");2837};2838function __sp_media_deleteStreamUri(uri){2839throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:deleteStreamUri:Not Supported");2840};2841function __sp_media_refreshMediaDb(uri){2842};2843function __sp_media_cancel(_19d){2844try{2845var rval=this.so.IDataSource.Cancel(_19d);2846if(rval.ErrorCode!=0){2847switch(rval.ErrorCode){2848case this.error.MISSING_ARG_ERR:2849case this.error.INVALID_ARG_ERR:2850case this.error.NOT_SUPPORTED_ERR:2851if(rval.ErrorMessage){2852var _19f=splitErrorMessage(rval.ErrorMessage);2853throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:cancel:"+_19f);2854}else{2855throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:cancel:Operation failed");2856}2857break;2858default:2859throw new DeviceException(MapErrorCode[rval.ErrorCode],"Media:cancel:Operation failed");2860}2861}2862}2863catch(e){2864__device_handle_exception(e,"__sp_media_refreshMediaDb: "+e);2865}2866};2867function __sp_media_instance(){2868this.descriptor=new __sp_media_descriptor();2869this.SORT_ASCENDING=0;2870this.SORT_DESCENDING=1;2871this.getList=__sp_media_getList;2872this.getListMediaCb=__sp_media_getList_cb;2873this.getThumbnail=__sp_media_getThumbnail;2874this.getThumbnailCb=__sp_media_getThumbnail_cb;2875this.addStreamUri=__sp_media_addStreamUri;2876this.deleteStreamUri=__sp_media_deleteStreamUri;2877this.refreshMediaDb=__sp_media_refreshMediaDb;2878this.cancel=__sp_media_cancel;2879this.error=new DeviceException(0,"Dummy");2880try{2881this.so=device.getServiceObject("Service.MediaManagement","IDataSource");2882}2883catch(e){2884this.so=null;2885__device_handle_exception(e,"media service not available");2886}2887};2888var __device_sensors_service_entry={"name":null,"version":null,"proto":__device_sensors,"descriptor":__device_sensors_descriptor,"providers":[{"descriptor":__sp_sensors_descriptor,"instance":__sp_sensors_instance}]};2889function __device_sensors(_1a0){2890this.provider=_1a0;2891this.interfaceName=_1a0.descriptor.interfaceName;2892this.version=_1a0.descriptor.version;2893this.getChannels=__device_sensors_getChannels;2894this.startChannel=__device_sensors_setNotifier;2895this.stopChannel=__device_sensors_cancelNotifier;2896this.getScaleFactor=__device_sensors_getScaleFactor;2897};2898function __device_sensors_descriptor(_1a1){2899this.interfaceName=_1a1.interfaceName;2900this.version=_1a1.version;2901};2902function __device_sensors_getChannels(){2903return this.provider.getChannels();2904};2905function __device_sensors_setNotifier(_1a2,_1a3,_1a4){2906return this.provider.startChannel(_1a2,_1a3,_1a4);2907};2908function __device_sensors_cancelNotifier(_1a5){2909return this.provider.stopChannel(_1a5);2910};2911function __device_sensors_getScaleFactor(_1a6){2912return this.provider.getScaleFactor(_1a6);2913};2914function __sp_sensors_descriptor(){2915this.interfaceName="sensors";2916if(window.__Service_Interface_Ver){2917this.version=__Service_Interface_Ver;2918}else{2919this.version=1;2920}2921};2922function __sp_sensors_instance(){2923this.descriptor=new __sp_sensors_descriptor();2924this.getChannels=__sp_sensors_getChannels;2925this.startChannel=__sp_sensors_setNotifier;2926this.stopChannel=__sp_sensors_cancelNotifier;2927this.getScaleFactor=__sp_sensors_getScaleFactor;2928try{2929this.so=device.getServiceObject("Service.Sensor","ISensor");2930}2931catch(e){2932this.so=null;2933__device_handle_exception(e,"sensors service not available");2934}2935};2936var __rotation_channel={ucb:null,tids:null};2937var __XYZ_channel={ucb:null,tids:null};2938var __orientation_channel={ucb:null,tids:null};2939function __rotation_cb(arg1,arg2,arg3){2940if(arg2!=event_cancelled){2941var _1aa=null;2942if(arg3.ReturnValue){2943var time=arg3.ReturnValue.TimeStamp;2944var xrot=arg3.ReturnValue.XRotation;2945var yrot=arg3.ReturnValue.YRotation;2946var zrot=arg3.ReturnValue.ZRotation;2947arg3.ReturnValue.close();2948_1aa={};2949modifyObjectBaseProp(_1aa);2950_1aa.timeStamp=time;2951_1aa.rotationAboutXAxis=xrot;2952_1aa.rotationAboutYAxis=yrot;2953_1aa.rotationAboutZAxis=zrot;2954}2955__rotation_channel.ucb(_1aa);2956}2957};2958function __XYZ_cb(arg1,arg2,arg3){2959if(arg2!=event_cancelled){2960var _1b2=null;2961if(arg3.ReturnValue){2962var time=arg3.ReturnValue.TimeStamp;2963var _1b4=arg3.ReturnValue.XAxisData;2964var _1b5=arg3.ReturnValue.YAxisData;2965var _1b6=arg3.ReturnValue.ZAxisData;2966arg3.ReturnValue.close();2967_1b2={};2968modifyObjectBaseProp(_1b2);2969_1b2.timeStamp=time;2970_1b2.axisX=_1b4;2971_1b2.axisY=_1b5;2972_1b2.axisZ=_1b6;2973}2974__XYZ_channel.ucb(_1b2);2975}2976};2977function __orientation_cb(arg1,arg2,arg3){2978if(arg2!=event_cancelled){2979var _1ba=null;2980if(arg3.ReturnValue){2981var time=arg3.ReturnValue.TimeStamp;2982var _1bc=arg3.ReturnValue.DeviceOrientation;2983arg3.ReturnValue.close();2984_1ba={};2985modifyObjectBaseProp(_1ba);2986_1ba.timeStamp=time;2987_1ba.deviceOrientation=_1bc;2988}2989__orientation_channel.ucb(_1ba);2990}2991};2992function __sp_sensors_getChannels(){2993return ["Rotation","AccelerometerAxis","Orientation"];2994};2995function __sp_sensors_setNotifier(_1bd,_1be,_1bf){2996var _1c0=new DeviceException(0,"dummy");2997if(!_1bd){2998throw new DeviceAPIError(_1c0.MISSING_ARG_ERR,"Callback is missing");2999}3000if((typeof _1bd)!="function"){3001throw new DeviceAPIError(_1c0.INVALID_ARG_ERR,"Callback is of invalid type");3002}3003if(_1bf&&((typeof _1bf)!="function")){3004throw new DeviceAPIError(_1c0.INVALID_ARG_ERR,"InValid error Callback");3005}3006if(!_1be){3007throw new DeviceAPIError(_1c0.MISSING_ARG_ERR,"Channel is missing");3008}3009if((typeof _1be)!="string"){3010throw new DeviceAPIError(_1c0.INVALID_ARG_ERR,"Channel is of invalid type");3011}3012var rval;3013var cb;3014var _1c3={};3015modifyObjectBaseProp(_1c3);3016switch(_1be){3017case "Rotation":3018_1c3.SearchCriterion="Rotation";3019cb=__rotation_cb;3020__rotation_channel.ucb=_1bd;3021break;3022case "AccelerometerAxis":3023_1c3.SearchCriterion="AccelerometerAxis";3024cb=__XYZ_cb;3025__XYZ_channel.ucb=_1bd;3026break;3027case "Orientation":3028_1c3.SearchCriterion="Orientation";3029cb=__orientation_cb;3030__orientation_channel.ucb=_1bd;3031break;3032default:3033throw new DeviceAPIError(_1c0.NOT_SUPPORTED_ERR,"Unsupported input channel");3034}3035try{3036rval=this.so.ISensor.FindSensorChannel(_1c3);3037if(_1c3){3038delete _1c3.SearchCriterion;3039}3040if(rval.ErrorCode!=0){3041throw new DeviceAPIError(_1c0.NOT_SUPPORTED_ERR,"StartChannel:Operation Failed");3042}3043var cmap=[];3044var _1c5=[];3045var _1c6=rval["ReturnValue"];3046var _1c7=_1c6.length;3047cmap=_1c6[0];3048var _1c8={};3049modifyObjectBaseProp(_1c8);3050_1c8.ListeningType="ChannelData";3051_1c8.ChannelInfoMap=cmap;3052var _1c9=this.so.ISensor.RegisterForNotification(_1c8,cb);3053if(_1c8){3054delete _1c8.ChannelInfoMap;3055delete _1c8.ListeningType;3056}3057if(cmap){3058delete cmap.index;3059}3060_1c5[0]=_1c9["TransactionID"];3061if(_1c9.ErrorCode!=0){3062if(_1c9.ErrorCode==1005){3063_1bf(new DeviceAPIError(_1c0.SERVICE_IN_USE_ERR,"Not Allowed Operation"));3064return;3065}else{3066throw new DeviceAPIError(_1c0.NOT_SUPPORTED_ERR,"StartChannel:Operation Failed");3067}3068}3069}3070catch(e2){3071__device_handle_exception(e2,"__sp_sensors_setNotifier: RegisterForNotification: "+e2);3072}3073switch(_1be){3074case "Rotation":3075__rotation_channel.tid=_1c5;3076break;3077case "AccelerometerAxis":3078__XYZ_channel.tid=_1c5;3079break;3080case "Orientation":3081__orientation_channel.tid=_1c5;3082break;3083}3084return _1c5;3085};3086function __sp_sensors_cancelNotifier(_1ca){3087var _1cb=new DeviceException(0,"dummy");3088if(!_1ca){3089throw new DeviceAPIError(_1cb.MISSING_ARG_ERR,"Channel is missing");3090}3091if((typeof _1ca)!="string"){3092throw new DeviceAPIError(_1cb.INVALID_ARG_ERR,"Channel is of invalid type");3093}3094var id;3095switch(_1ca){3096case "Rotation":3097id=__rotation_channel.tid;3098__rotation_channel.tid=null;3099break;3100case "AccelerometerAxis":3101id=__XYZ_channel.tid;3102__XYZ_channel.tid=null;3103break;3104case "Orientation":3105id=__orientation_channel.tid;3106__orientation_channel.tid=null;3107break;3108default:3109throw new DeviceAPIError(_1cb.NOT_SUPPORTED_ERR,"Unsupported input channel");3110}3111if(!id){3112throw new DeviceAPIError(_1cb.DATA_NOT_FOUND_ERR,"Stop Channel:Operation Failed");3113}3114var _1cd={};3115modifyObjectBaseProp(_1cd);3116for(var i in id){3117_1cd.TransactionID=id[i];3118try{3119var _1cf=this.so.ISensor.Cancel(_1cd);3120if(_1cd){3121delete _1cd.TransactionID;3122}3123if(_1cf.ErrorCode!=0){3124throw new DeviceAPIError(_1cb.DATA_NOT_FOUND_ERR,"Stop Channel:Operation Failed");3125}3126}3127catch(e1){3128__device_handle_exception(e1,"__sp_sensors_cancelNotifier: "+e1);3129}3130}3131};3132function __sp_sensors_getScaleFactor(_1d0){3133var _1d1=new DeviceException(0,"dummy");3134if(!_1d0){3135throw new DeviceAPIError(_1d1.MISSING_ARG_ERR,"Channel is missing");3136}3137if((typeof _1d0)!="string"){3138throw new DeviceAPIError(_1d1.INVALID_ARG_ERR,"Channel is of invalid type");3139}3140if(_1d0!="AccelerometerAxis"){3141throw new DeviceAPIError(_1d1.NOT_SUPPORTED_ERR,"Unsupported input channel");3142}3143try{3144var _1d2={};3145_1d2.SearchCriterion="AccelerometerAxis";3146var rval=this.so.ISensor.FindSensorChannel(_1d2);3147if(_1d2){3148delete _1d2.SearchCriterion;3149}3150if(rval.ErrorCode!=0){3151throw new DeviceAPIError(_1d1.NOT_SUPPORTED_ERR,"getScaleFactor:Operation Failed");3152}3153var cmap=[];3154var _1d5=rval["ReturnValue"];3155cmap=_1d5[0];3156var _1d6={};3157modifyObjectBaseProp(_1d6);3158_1d6.ListeningType="ChannelData";3159_1d6.ChannelInfoMap=cmap;3160var _1d7=this.so.ISensor.GetScaleFactor(_1d6);3161if(_1d6){3162delete _1d6.ChannelInfoMap;3163delete _1d6.ListeningType;3164}3165if(cmap){3166delete cmap.index;3167}3168if(_1d7.ErrorCode!=0){3169throw new DeviceAPIError(_1d1.NOT_SUPPORTED_ERR,"getScaleFactor:Operation Failed");3170}3171}3172catch(e1){3173__device_handle_exception(e1,"__sp_sensors_getScaleFactor: "+e1);3174}3175return _1d7["ReturnValue"];3176};3177var __device_sysinfo_service_entry={"name":null,"version":null,"proto":__device_sysinfo,"descriptor":__device_sysinfo_descriptor,"providers":[{"descriptor":__sp_sysinfo_descriptor,"instance":__sp_sysinfo_instance}]};3178function __device_sysinfo(_1d8){3179this.provider=_1d8;3180this.interfaceName=_1d8.descriptor.interfaceName;3181this.version=_1d8.descriptor.version;3182this.getChannelList=__device_channels_get;3183this.getChannel=__device_sysinfo_get;3184this.startChannel=__device_sysinfo_setNotifier;3185this.stopChannel=__device_sysinfo_cancelNotifier;3186this.cancel=__device_sysinfo_cancel;3187};3188function __device_sysinfo_descriptor(_1d9){3189this.interfaceName=_1d9.interfaceName;3190this.version=_1d9.version;3191};3192function __device_channels_get(){3193return this.provider.getChannelList();3194};3195function __device_sysinfo_get(_1da,_1db,_1dc){3196return this.provider.getChannel(_1da,_1db,_1dc);3197};3198function __device_sysinfo_setNotifier(_1dd,_1de,_1df,_1e0){3199return this.provider.startChannel(_1dd,_1de,_1df,_1e0);3200};3201function __device_sysinfo_cancelNotifier(_1e1){3202return this.provider.stopChannel(_1e1);3203};3204function __device_sysinfo_cancel(id){3205return this.provider.cancel(id);3206};3207function __sp_sysinfo_descriptor(){3208this.interfaceName="sysinfo";3209if(window.__Service_Interface_Ver){3210this.version=__Service_Interface_Ver;3211}else{3212this.version=1;3213}3214};3215function __sp_sysinfo_instance(){3216this.descriptor=new __sp_sysinfo_descriptor();3217this.getChannelList=__sp_channel_descriptors_get;3218this.getChannel=__sp_sysinfo_get;3219this.getChannelCb=__sp_sysinfo_get_cb;3220this.startChannel=__sp_sysinfo_setNotifier;3221this.stopChannel=__sp_sysinfo_cancelNotifier;3222this.cancel=__sp_sysinfo_cancel;3223this.error=new DeviceException(0,"Dummy");3224try{3225this.so=device.getServiceObject("Service.SysInfo","ISysInfo");3226}3227catch(e){3228this.so=null;3229__device_handle_exception(e,"Sysinfo service not available");3230}3231};3232function __sp_channel_descriptors_get(){3233var _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"]}];3234return _1e3;3235};3236var max=110;3237var min=40;3238var diff=max-min;3239function __sp_device_sysinfo_toDecibel(_1e4){3240var _1e5=_1e4/100;3241var _1e6=max-(_1e5*diff);3242_1e6=Math.round(_1e6);3243return _1e6;3244};3245function __sp_device_sysinfo_toPercentage(_1e7){3246if(_1e7==0){3247return _1e7;3248}else{3249var _1e8=max-_1e7;3250var _1e9=_1e8/diff;3251_1e9*=100;3252_1e9=Math.round(_1e9);3253return _1e9;3254}3255};3256function __sp_device_sysinfo_toBool(_1ea){3257if(_1ea==0){3258return false;3259}else{3260return true;3261}3262};3263function mappingVerification_sysinfo(_1eb){3264if(_1eb===1016||_1eb===1012||_1eb===1010||_1eb===1009||_1eb===1005||_1eb===1000||_1eb===1011||_1eb===1007||_1eb===1003||_1eb===1002||_1eb===1004){3265return true;3266}else{3267return false;3268}3269};3270function __sp_device_sysinfo_extract(_1ec){3271var _1ed=_1ec.Key;3272var _1ee={};3273modifyObjectBaseProp(_1ee);3274try{3275switch(_1ed){3276case "ChargingStatus":3277_1ee.chargingStatus=__sp_device_sysinfo_toBool(_1ec.Status);3278break;3279case "BatteryStrength":3280_1ee.batteryLevel=_1ec.Status;3281break;3282case "SignalStrength":3283_1ee.signalStrength=__sp_device_sysinfo_toPercentage(_1ec.Status);3284break;3285case "CurrentNetwork":3286var _1ef;3287var mode;3288switch(_1ec.NetworkStatus){3289case 0:3290_1ef="Available";3291break;3292case 1:3293_1ef="Current";3294break;3295case 2:3296_1ef="Forbidden";3297break;3298default:3299_1ef="Unknown";3300break;3301}3302switch(_1ec.NetworkMode){3303case 1:3304mode="ModeGsm";3305break;3306case 3:3307case 4:3308mode="ModeCdma";3309break;3310case 5:3311mode="ModeWcdma";3312break;3313default:3314mode="Unknown";3315break;3316}3317_1ee.networkName=_1ec.NetworkName;3318_1ee.networkStatus=_1ef;3319_1ee.networkMode=mode;3320_1ee.mobileCountryCode=_1ec.CountryCode;3321_1ee.mobileNetworkCode=_1ec.NetworkCode;3322_1ee.locationStatus=_1ec.LocationStatus;3323_1ee.areaCode=_1ec.AreaCode;3324_1ee.cellID=_1ec.CellId;3325break;3326case "DisplayLanguage":3327_1ee.phoneLanguage=_1ec.StringData;3328break;3329case "BlueTooth":3330_1ee.btOn=__sp_device_sysinfo_toBool(_1ec.Status);3331break;3332case "ProductType":3333_1ee.productType=_1ec.StringData;3334break;3335case "FirmwareVersion":3336_1ee.firmwareVersion=_1ec.StringData;3337break;3338case "DeviceInputMethod":3339_1ee.deviceInputMethod=_1ec.StringData;3340break;3341default:3342_1ee=_1ec;3343break;3344}3345return _1ee;3346}3347catch(e){3348__device_handle_exception(e,"__sp_device_sysinfo_extract: "+e);3349}3350};3351function __sp_sysinfo_get_cb(arg1,arg2,arg3){3352var _1f4;3353var _1f5;3354var _1f6;3355_1f6=glob_obj.getFromArray(arg1);3356if(_1f6){3357_1f4=_1f6.success_cb;3358_1f5=_1f6.error_cb;3359}else{3360alert("Sysinfo: __sp_sysinfo_get_cb: Callback not found ");3361return;3362}3363var op=null;3364if(arg3.ErrorCode!=0){3365var _1f8=splitErrorMessage(arg3.ErrorMessage);3366_1f5(new DeviceException(MapErrorCode[arg3.ErrorCode],"SysInfo:getChannel: "+_1f8));3367}else{3368if(arg3.ReturnValue){3369op=__sp_device_sysinfo_extract(arg3.ReturnValue);3370arg3.ReturnValue.close();3371_1f4(op);3372}3373}3374glob_obj.removeFromArray(arg1);3375};3376function __sp_sysinfo_get(_1f9,_1fa,_1fb){3377var so;3378var rval;3379var _1fe=false;3380var _1ff="Status";3381var _200;3382var _201={};3383modifyObjectBaseProp(_201);3384try{3385switch(_1f9){3386case "Charging":3387_201.Entity="Battery";3388_201.Key="ChargingStatus";3389break;3390case "BatteryLevel":3391_201.Entity="Battery";3392_201.Key="BatteryStrength";3393_1fe=true;3394break;3395case "SignalStrength":3396_201.Entity="Network";3397_201.Key="SignalStrength";3398_1fe=true;3399break;3400case "Network":3401_201.Entity="Network";3402_201.Key="CurrentNetwork";3403_1fe=true;3404break;3405case "PhoneLanguage":3406_201.Entity="General";3407_201.Key="DisplayLanguage";3408break;3409case "BluetoothOn":3410_201.Entity="Connectivity";3411_201.Key="BlueTooth";3412break;3413case "ProductType":3414_201.Entity="Device";3415_201.Key="ProductType";3416break;3417case "FirmwareVersion":3418_201.Entity="Device";3419_201.Key="FirmwareVersion";3420break;3421case "DeviceInputMethod":3422_201.Entity="Device";3423_201.Key="DeviceInputMethod";3424break;3425default:3426if(_1f9==null){3427throw new DeviceException(this.error.MISSING_ARG_ERR,"SysInfo:getChannel:channel is missing");3428}else{3429if(typeof _1f9!="string"){3430throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:getChannel:channel is of invalid type");3431}else{3432throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:getChannel:channel is invalid");3433}3434}3435}3436if(_1fe){3437if(_1fa==null){3438throw new DeviceException(this.error.MISSING_ARG_ERR,"SysInfo:getChannel:callback is missing");3439}3440if(typeof _1fa!="function"){3441throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:getChannel:callback is invalid");3442}3443if(_1fb){3444if(typeof (_1fb)!="function"){3445throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:getChannel: ErrorCallback is invalid");3446}3447}3448temp_scb=_1fa;3449temp_ecb=_1fb;3450rval=this.so.ISysInfo.GetInfo(_201,this.getChannelCb);3451if(rval.TransactionID){3452glob_obj.addToGlobalArray(rval.TransactionID,_1fa,_1fb);3453}3454if(rval.ErrorCode!=0){3455var _202=mappingVerification_sysinfo(rval.ErrorCode);3456if(_202){3457switch(MapErrorCode[rval.ErrorCode]){3458case this.error.MISSING_ARG_ERR:3459case this.error.INVALID_ARG_ERR:3460if(rval.ErrorMessage){3461var _203=splitErrorMessage(rval.ErrorMessage);3462throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo: getChannel: "+_203);3463}else{3464throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo:getChannel:Operation Failed");3465}3466break;3467default:3468_1fa(0);3469}3470}else{3471_1fa(0);3472}3473}3474return rval.TransactionID;3475}else{3476rval=this.so.ISysInfo.GetInfo(_201);3477if(rval.ErrorCode!=0){3478if(rval.ErrorMessage){3479var _204=splitErrorMessage(rval.ErrorMessage);3480throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo: getChannel: "+_204);3481}else{3482throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo:getChannel:Operation Failed");3483}3484}3485_200=__sp_device_sysinfo_extract(rval.ReturnValue);3486return _200;3487}3488delete _201;3489}3490catch(e){3491__device_handle_exception(e,"__sp_sysinfo_get: getChannel: "+e);3492}3493};3494var __cell_id_channel={scb:null,ecb:null,cancel_id:null};3495function __cell_id_channel_cb(arg1,arg2,arg3){3496var op=null;3497if(arg3.ErrorCode){3498__cell_id_channel.ecb(arg3.ErrorCode);3499}else{3500if(arg3.ReturnValue){3501op=arg3.ReturnValue;3502arg3.ReturnValue.close();3503__cell_id_channel.scb(op);3504}3505}3506};3507var __charging_status_channel={scb:null,ecb:null,cancel_id:null};3508function __charging_status_channel_cb(arg1,arg2,arg3){3509var op=null;3510if(arg3.ErrorCode){3511__charging_status_channel.ecb(arg3.ErrorCode);3512}else{3513if(arg3.ReturnValue){3514op=__sp_device_sysinfo_extract(arg3.ReturnValue);3515arg3.ReturnValue.close();3516__charging_status_channel.scb(op);3517}3518}3519};3520var __net_coverage_channel={scb:null,ecb:null,cancel_id:null};3521function __net_coverage_channel_cb(arg1,arg2,arg3){3522var op=null;3523if(arg3.ErrorCode){3524__net_coverage_channel.ecb(arg3.ErrorCode);3525}else{3526if(arg3.ReturnValue){3527op=__sp_device_sysinfo_extract(arg3.ReturnValue);3528arg3.ReturnValue.close();3529__net_coverage_channel.scb(op);3530}3531}3532};3533var __battery_level_channel={scb:null,ecb:null,cancel_id:null};3534function __battery_level_channel_cb(arg1,arg2,arg3){3535var op=null;3536if(arg3.ErrorCode){3537__battery_level_channel.ecb(arg3.ErrorCode);3538}else{3539if(arg3.ReturnValue){3540op=__sp_device_sysinfo_extract(arg3.ReturnValue);3541arg3.ReturnValue.close();3542__battery_level_channel.scb(op);3543}3544}3545};3546var __bluetooth_on_channel={scb:null,ecb:null,cancel_id:null};3547function __bluetooth_on_channel_cb(arg1,arg2,arg3){3548var op=null;3549if(arg3.ErrorCode){3550__bluetooth_on_channel.ecb(arg3.ErrorCode);3551}else{3552if(arg3.ReturnValue){3553op=__sp_device_sysinfo_extract(arg3.ReturnValue);3554arg3.ReturnValue.close();3555__bluetooth_on_channel.scb(op);3556}3557}3558};3559var __signal_channel={scb:null,ecb:null,cancel_id:null};3560function __signal_channel_cb(arg1,arg2,arg3){3561var op=null;3562if(arg3.ErrorCode){3563__signal_channel.ecb(arg3.ErrorCode);3564}else{3565if(arg3.ReturnValue){3566op=__sp_device_sysinfo_extract(arg3.ReturnValue);3567arg3.ReturnValue.close();3568__signal_channel.scb(op);3569}3570}3571};3572function __sp_sysinfo_setNotifier(_21d,_21e,_21f,_220){3573var rval;3574var _222=null;3575var cb=null;3576var _224={};3577if(_21d==null){3578throw new DeviceException(this.error.MISSING_ARG_ERR,"SysInfo:startChannel:callback is missing");3579}3580if(typeof _21d!="function"){3581throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:startChannel:callback is invalid");3582}3583modifyObjectBaseProp(_224);3584try{3585switch(_21e){3586case "Charging":3587_224.Entity="Battery";3588_224.Key="ChargingStatus";3589_222=__charging_status_channel;3590cb=__charging_status_channel_cb;3591break;3592case "Network":3593_224.Entity="Network";3594_224.Key="CurrentNetwork";3595_222=__net_coverage_channel;3596cb=__net_coverage_channel_cb;3597break;3598case "BatteryLevel":3599_224.Entity="Battery";3600_224.Key="BatteryStrength";3601_224.SystemData={};3602modifyObjectBaseProp(_224.SystemData);3603if(_21f==null){3604_21f=50;3605}3606if(!(_21f>=0&&_21f<=100)){3607throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"SysInfo:startChannel:trigger is out of range");3608}3609if(typeof _21f!="number"){3610throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:startChannel:trigger is of invalid type");3611}3612_224.SystemData.Status=_21f;3613_222=__battery_level_channel;3614cb=__battery_level_channel_cb;3615break;3616case "SignalStrength":3617_224.Entity="Network";3618_224.Key="SignalStrength";3619_224.SystemData={};3620modifyObjectBaseProp(_224.SystemData);3621if(_21f!=null){3622if(!(_21f>=0&&_21f<=100)){3623throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"SysInfo:startChannel:trigger is out of range");3624}3625if(typeof _21f!="number"){3626throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:startChannel:trigger is of invalid type");3627}3628_224.SystemData.Status=__sp_device_sysinfo_toDecibel(_21f);3629}3630_222=__signal_channel;3631cb=__signal_channel_cb;3632break;3633case "BluetoothOn":3634_224.Entity="Connectivity";3635_224.Key="BlueTooth";3636_222=__bluetooth_on_channel;3637cb=__bluetooth_on_channel_cb;3638break;3639default:3640var _225;3641if(_21e==null){3642throw new DeviceException(this.error.MISSING_ARG_ERR,"SysInfo:startChannel:channel is missing");3643}else{3644if(typeof _21e!="string"){3645throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:startChannel:channel is of invalid type");3646}else{3647throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:startChannel:channel is invalid");3648}3649}3650if(_224.SystemData){3651delete _224.SystemData;3652}3653}3654_222.scb=_21d;3655_222.ecb=_220;3656if(_222.ecb){3657if(typeof (_222.ecb)!="function"){3658throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:startChannel: ErrorCallback is invalid");3659}3660}3661if(_222.cancel_id){3662var _226={};3663modifyObjectBaseProp(_226);3664_226.TransactionID=_222.cancel_id;3665this.so.ISysInfo.Cancel(_226);3666_222.cancel_id=null;3667delete _226;3668}3669temp_scb=_21d;3670temp_ecb=_220;3671rval=this.so.ISysInfo.GetNotification(_224,cb);3672delete _224;3673if(rval.ErrorCode!=0){3674switch(MapErrorCode[rval.ErrorCode]){3675case this.error.MISSING_ARG_ERR:3676case this.error.INVALID_ARG_ERR:3677if(rval.ErrorMessage){3678var _227=splitErrorMessage(rval.ErrorMessage);3679throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo: startChannel: "+_227);3680}else{3681throw new DeviceException(MapErrorCode[rval.ErrorCode],"SysInfo:startChannel:Operation Failed");3682}3683break;3684default:3685_21d(0);3686}3687}3688_222.cancel_id=rval.TransactionID;3689return _222.cancel_id;3690}3691catch(e){3692__device_handle_exception(e,"__sp_sysinfo_startChannel: "+e);3693}3694};3695function __sp_sysinfo_cancelNotifier(_228){3696try{3697switch(_228){3698case "CellId":3699channel=__cell_id_channel;3700break;3701case "Charging":3702channel=__charging_status_channel;3703break;3704case "Network":3705channel=__net_coverage_channel;3706break;3707case "BatteryLevel":3708channel=__battery_level_channel;3709break;3710case "SignalStrength":3711channel=__signal_channel;3712break;3713case "BluetoothOn":3714channel=__bluetooth_on_channel;3715break;3716default:3717var _229;3718if(_228==null){3719throw new DeviceException(this.error.MISSING_ARG_ERR,"SysInfo:stopChannel:channel is missing");3720}else{3721if(typeof _228!="string"){3722throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:stopChannel:channel is of invalid type");3723}else{3724throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:stopChannel:channel is invalid");3725}3726}3727}3728if(channel.cancel_id){3729var _22a={};3730modifyObjectBaseProp(_22a);3731_22a.TransactionID=channel.cancel_id;3732var _22b=this.so.ISysInfo.Cancel(_22a);3733delete _22a;3734if(_22b.ErrorCode!=0){3735if(_22b.ErrorMessage){3736var _22c=splitErrorMessage(_22b.ErrorMessage);3737throw new DeviceException(MapErrorCode[_22b.ErrorCode],"SysInfo: stopChannel: "+_22c);3738}else{3739throw new DeviceException(MapErrorCode[_22b.ErrorCode],"SysInfo:stopChannel:Operation Failed");3740}3741}3742channel.cancel_id=null;3743}else{3744throw new DeviceException(this.error.DATA_NOT_FOUND_ERR,"SysInfo:stopChannel:channel not started");3745}3746}3747catch(e){3748__device_handle_exception(e,"__sp_sysinfo_stopChannel: "+e);3749}3750};3751function __sp_sysinfo_cancel(_22d){3752try{3753var _22e=0;3754if(_22d==null){3755throw new DeviceException(this.error.MISSING_ARG_ERR,"SysInfo:cancel:Id is missing");3756}3757if(typeof _22d!="number"){3758throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:cancel:Id is of invalid type");3759}3760if(_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){3761_22e=1;3762}3763if(_22e!=1){3764var _22f={TransactionID:_22d};3765var _230=this.so.ISysInfo.Cancel(_22f);3766if(_230.ErrorCode!=0){3767if(_230.ErrorMessage){3768var _231=splitErrorMessage(_230.ErrorMessage);3769throw new DeviceException(this.error.INVALID_ARG_ERR,"SysInfo:cancel: "+_231);3770}else{3771throw new DeviceException(MapErrorCode[_230.ErrorCode],"SysInfo:cancel:Operation Failed");3772}3773}3774}else{3775_22e=0;3776throw new DeviceException(this.error.NOT_ALLOWED_ERR,"SysInfo:cancel:Cannot Cancel a channel started using startChannel ");3777}3778}3779catch(e){3780__device_handle_exception(e,"__sp_sysinfo_cancel: "+e);3781}3782};3783function __device_camera_descriptor(_232){3784this.interfaceName=_232.interfaceName;3785this.version=_232.version;3786};3787function __device_camera_startCamera(_233,_234){3788return this.provider.startCamera(_233,_234);3789};3790function __device_camera_stopViewfinder(){3791this.provider.stopViewfinder();3792};3793function __device_camera_takePicture(_235){3794this.provider.takePicture(_235);3795};3796function __device_camera(_236){3797this.provider=_236;3798this.interfaceName=_236.descriptor.interfaceName;3799this.version=_236.descriptor.version;3800this.supportedMediaTypes=_236.supportedMediaTypes;3801this.supportedSizes=_236.supportedSizes;3802this.startCamera=__device_camera_startCamera;3803this.stopViewfinder=__device_camera_stopViewfinder;3804this.takePicture=__device_camera_takePicture;3805};3806var __device_camera_service_entry={"name":null,"version":null,"proto":__device_camera,"descriptor":__device_camera_descriptor,"providers":[{"descriptor":__sp_camera_descriptor,"instance":__sp_camera_instance}]};3807function __sp_camera_descriptor(){3808this.interfaceName="camera";3809if(window.__Service_Interface_Ver){3810this.version=__Service_Interface_Ver;3811}else{3812this.version=1;3813}3814};3815var __sp_camera_start_date;3816var CAMERA_APP_ID=270501242;3817function __sp_startCamera(_237,_238){3818if(_237==null){3819throw new DeviceException(this.error.MISSING_ARG_ERR,"Camera:startCamera:callback is missing");3820}3821if(_237==undefined){3822throw new DeviceException(this.error.INVALID_ARG_ERR,"Camera:startCamera:callback is a non-function");3823}3824if(typeof (_237)!="function"){3825throw new DeviceException(this.error.INVALID_ARG_ERR,"Camera:startCamera:callback is a non-function");3826}3827if(_238){3828if(typeof _238!="function"){3829throw new DeviceException(this.error.INVALID_ARG_ERR,"Camera:startCamera:callback is invalid");3830}3831}3832var _239=function(){3833var _23a=function(arg1,arg2,arg3){3834var it=arg3.ReturnValue;3835var item;3836var _240=[];3837if(arg3.ErrorCode!=0){3838_238(new DeviceException(arg3.ErrorCode,"Camera:startCamera: Operation Failed"));3839return;3840}3841if((item=it.getNext())!=undefined){3842var d=new Date(Date.parse(item.FileDate));3843if(d>__sp_camera_start_date){3844var _242={};3845modifyObjectBaseProp(_242);3846var _243=item.FileNameAndPath.replace(/\\/g,"/");3847var _244="file:///";3848var _245="";3849_245=_245.concat(_244,_243);3850_242.uri=_245;3851var _246={};3852_246.height=item.XPixels;3853_246.width=item.YPixels;3854_246.type=item.MimeType;3855_242.format=_246;3856_240.unshift(_242);3857if(_246){3858}3859}3860}3861var _247=0;3862var _248=0;3863_237(_240);3864};3865try{3866var mso=device.getServiceObject("Service.MediaManagement","IDataSource");3867}3868catch(e){3869__device_handle_exception(e,"media service not available : "+e);3870}3871var _24a={};3872modifyObjectBaseProp(_24a);3873_24a.Type="FileInfo";3874_24a.Filter={};3875modifyObjectBaseProp(_24a.Filter);3876_24a.Filter.FileType="Image";3877_24a.Sort={};3878modifyObjectBaseProp(_24a.Sort);3879_24a.Sort.Key="FileDate";3880_24a.Sort.Order="Descending";3881try{3882var rval=mso.IDataSource.GetList(_24a,_23a);3883}3884catch(error){3885__device_handle_exception(error,"media service GetList failed: "+error);3886}3887};3888__sp_camera_start_date=new Date();3889__s60_start_and_wait(CAMERA_APP_ID,"",_239);3890var _24c=0;3891return _24c;3892};3893function __sp_supportedSizes(){3894try{3895var _24d=device.getServiceObject("Service.SysInfo","ISysInfo");3896}3897catch(e){3898__device_handle_exception(e,"SysInfo Service not available : "+e);3899}3900var _24e={};3901modifyObjectBaseProp(_24e);3902_24e.Entity="Camera";3903_24e.Key="CameraProperties";3904try{3905var rval=_24d.ISysInfo.GetInfo(_24e);3906if(_24e){3907delete _24e.Entity;3908delete _24e.Key;3909}3910}3911catch(error){3912__device_handle_exception(error,"Camera : Failed to fetch supported size Info: "+error);3913}3914var _250=rval.ReturnValue;3915var _251=[];3916var _252=[];3917_251=_250.ResolutionList;3918for(var i=0;i<_251.length;i++){3919var _254="";3920_254=_254.concat(_251[i].height,"X",_251[i].width);3921_252.push(_254);3922}3923return _252;3924};3925function __sp_supportedMediaTypes(){3926try{3927var _255=device.getServiceObject("Service.SysInfo","ISysInfo");3928}3929catch(e){3930__device_handle_exception(e,"SysInfo Service not available : "+e);3931}3932var _256={};3933modifyObjectBaseProp(_256);3934_256.Entity="Camera";3935_256.Key="CameraProperties";3936try{3937var rval=_255.ISysInfo.GetInfo(_256);3938if(_256){3939delete _256.Entity;3940delete _256.Key;3941}3942}3943catch(error){3944__device_handle_exception(error,"Camera :Failed to fetch supported media type Info: "+error);3945}3946var _258=rval.ReturnValue;3947var _259=[];3948_259=_258.MimeTypeList;3949return _259;3950};3951function __sp_camera_instance(){3952this.descriptor=new __sp_camera_descriptor();3953this.supportedMediaTypes=__sp_supportedMediaTypes();3954this.supportedSizes=__sp_supportedSizes();3955this.startCamera=__sp_startCamera;3956this.stopViewfinder=__s60_api_not_supported;3957this.takePicture=__s60_api_not_supported;3958this.error=new DeviceException(0,"Dummy");3959};3960var _infinity=Infinity;3961function TransIdCbMap(){3962this.TransactionID=null;3963this.success_callback=null;3964this.error_callback=null;3965};3966function __device_geolocation_descriptor(_25a){3967this.interfaceName=_25a.interfaceName;3968this.version=_25a.version;3969};3970function __device_geolocation_getCurrentPosition(_25b,_25c,_25d){3971return this.provider.getLocation(_25b,_25c,_25d);3972};3973function __device_geolocation_watchPosition(_25e,_25f,_260){3974return this.provider.traceLocation(_25e,_25f,_260);3975};3976function __device_geolocation_clearWatch(_261){3977this.provider.clearTrace(_261);3978};3979function __device_geolocation(_262){3980this.provider=_262;3981this.interfaceName=_262.descriptor.interfaceName;3982this.version=_262.descriptor.version;3983this.getCurrentPosition=__device_geolocation_getCurrentPosition;3984this.watchPosition=__device_geolocation_watchPosition;3985this.clearWatch=__device_geolocation_clearWatch;3986};3987var __device_geolocation_service_entry={"name":null,"version":null,"proto":__device_geolocation,"descriptor":__device_geolocation_descriptor,"providers":[{"descriptor":__sp_location_descriptor,"instance":__sp_location_instance}]};3988function Location_PositionError(){3989this.UNKNOWN_ERROR=0;3990this.PERMISSION_DENIED=1;3991this.POSITION_UNAVAILABLE=2;3992this.TIMEOUT=3;3993this.code;3994this.message;3995};3996function Location_Coordinates(){3997this.latitude=null;3998this.longitude=null;3999this.altitude=null;4000this.accuracy=null;4001this.altitudeAccuracy=null;4002this.heading=null;4003this.speed=null;4004};4005function Location_Position(){4006this.coords=null;4007this.timestamp=null;4008};4009function Location_PositionOptions(){4010this.enableHighAccuracy;4011this.timeout;4012this.maximumAge;4013};4014function getGeoLocationPosition(_263){4015var _264=new Location_Coordinates();4016_264.longitude=(_263.Longitude==undefined)?null:_263.Longitude;4017_264.latitude=(_263.Latitude==undefined)?null:_263.Latitude;4018_264.altitude=(_263.Altitude==undefined)?null:_263.Altitude;4019_264.accuracy=(_263.HorizontalAccuracy==undefined)?null:_263.HorizontalAccuracy;4020_264.altitudeAccuracy=(_263.VerticalAccuracy==undefined)?null:_263.VerticalAccuracy;4021_264.heading=(_263.Heading==undefined)?null:_263.Heading;4022_264.speed=(_263.HorizontalSpeed==undefined)?null:_263.HorizontalSpeed;4023var _265=new Location_Position();4024_265.coords={};4025modifyObjectBaseProp(_265.coords);4026_265.coords=_264;4027_265.timestamp=(_263.timestamp==undefined)?null:_263.timestamp;4028return _265;4029};4030var __sp_location_trace_transactionId=-1;4031function __sp_location_handle_error(_266,_267,_268){4032if((_266!=undefined)&&(typeof _266=="function")&&(_266!=null)){4033var _269=new Location_PositionError();4034if((-21)==_267){4035_269.code=_269.PERMISSION_DENIED;4036_269.message="permission denied";4037}else{4038if((-33)==_267){4039_269.code=_269.TIMEOUT;4040_269.message="request timed out";4041}else{4042_269.code=_269.UNKNOWN_ERROR;4043_269.message="UnKnown Error";4044}4045}4046_266(_269);4047}else{4048var _269=new Location_PositionError();4049_269.code=_269.UNKNOWN_ERROR;4050_269.message="UnKnown Error";4051throw _269;4052}4053};4054function __sp_location_descriptor(){4055this.interfaceName="geolocation";4056if(window.__Service_Interface_Ver){4057this.version=__Service_Interface_Ver;4058}else{4059this.version=1;4060}4061};4062var obj;4063function __sp_getLocation_cb(arg1,arg2,arg3){4064var _26d;4065_26d=glob_obj.getFromArray(arg1);4066if(_26d){4067success_cb1=_26d.success_cb;4068error_cb=_26d.error_cb;4069}else{4070return;4071}4072if(arg3.ErrorCode){4073__sp_location_handle_error(error_cb,arg3.ErrorCode,arg3.ErrorMessage);4074return;4075}else{4076var _26e=getGeoLocationPosition(arg3.ReturnValue);4077success_cb1(_26e);4078delete _26e;4079}4080glob_obj.removeFromArray(arg1);4081};4082function __sp_getLocation(_26f,_270,_271){4083if((_26f==undefined)||(_26f==null)||(typeof (_26f)!="function")){4084var _272="Wrong callback type";4085__sp_location_handle_error(_270,0,_272);4086}4087if((_270!=undefined)){4088if((_270!=null)&&(_270!="")&&(typeof (_270)!="function")){4089var _273=new Location_PositionError();4090_273.code=-1;4091throw _273;4092}4093}4094var _274;4095var _275={};4096modifyObjectBaseProp(_275);4097_275.LocationInformationClass="GenericLocationInfo";4098var _276={};4099modifyObjectBaseProp(_276);4100_276.UpdateInterval=0;4101if(_271!=undefined&&_271!=null){4102if((typeof (_271)!="object")){4103var _277="Wrong posOptions type";4104__sp_location_handle_error(_270,0,_277);4105return;4106}4107}4108if(_271!=undefined){4109if(_271.maximumAge!=undefined){4110if(_271.maximumAge){4111if((_271.maximumAge==Infinity)){4112if((_271.enableHighAccuracy==undefined)||(typeof (_271.enableHighAccuracy)=="boolean")){4113var arg3=this.so.ILocation.GetLastPosition();4114if(arg3.ErrorCode<0){4115var _277="Invalid input type";4116__sp_location_handle_error(_270,0,_277);4117return;4118}4119var _279=getGeoLocationPosition(arg3.ReturnValue);4120success_cb1(_279);4121return;4122}4123}4124if(!(isNaN(parseInt(_271.maximumAge)))){4125if((_271.maximumAge==0)){4126var _277="Invalid input type";4127__sp_location_handle_error(_270,0,_277);4128return;4129}4130_276.UpdateMaxAge=_271.maximumAge*1000;4131}else{4132var _277="Invalid input type";4133__sp_location_handle_error(_270,0,_277);4134return;4135}4136}else{4137if((_271.maximumAge==null)||(_271.maximumAge=="")){4138}4139}4140}4141if((_271.enableHighAccuracy!==undefined)){4142if(_271.enableHighAccuracy==true){4143_275.EnableHighAccuracy=_271.enableHighAccuracy;4144}else{4145if(_271.enableHighAccuracy==false){4146_275.EnableHighAccuracy=_271.enableHighAccuracy;4147}else{4148if((_271.enableHighAccuracy==null)||(_271.enableHighAccuracy=="")){4149}else{4150if((typeof (_271.enableHighAccuracy)!="boolean")){4151var _27a="Wrong value for enableHighAccuracy param";4152__sp_location_handle_error(_270,0,_27a);4153return;4154}4155}4156}4157}4158}4159if(_271.timeout!==undefined){4160if((_271.timeout!==null)||((_271.timeout!==""))){4161if((_271.timeout==Infinity)){4162var _277="Invalid input type";4163__sp_location_handle_error(_270,0,_277);4164return;4165}else{4166if(!(isNaN(parseInt(_271.timeout)))){4167if((_271.timeout<=2147483647)){4168if((_271.timeout==0)){4169var _277="Data out of range";4170__sp_location_handle_error(_270,0,_277);4171return;4172}4173_276.UpdateTimeOut=_271.timeout*1000;4174}else{4175var _277="Invalid input type";4176__sp_location_handle_error(_270,0,_277);4177return;4178}4179}4180}4181}else{4182if((_271.timeout===null)||((_271.timeout===""))){4183}else{4184var _277="Invalid input type";4185__sp_location_handle_error(_270,0,_277);4186return;4187}4188}4189}4190}4191_276.PartialUpdates=false;4192_275.Updateoptions=_276;4193try{4194temp_scb=_26f;4195temp_ecb=_270;4196var rval=this.so.ILocation.GetLocation(_275,this.getLocationCb);4197if(rval.TransactionID){4198glob_obj.addToGlobalArray(rval.TransactionID,_26f,_270);4199}4200delete _276;4201delete _275;4202if(rval.ErrorCode!=0){4203__sp_location_handle_error(_270,rval.ErrorCode,rval.ErrorMessage);4204return;4205}4206}4207catch(e){4208__device_handle_exception(e,"__sp_getLocation: "+e);4209}4210};4211var __sp_location_trace_ucb=null;4212var __sp_location_fail_cb=null;4213function __sp_traceLocation_cb(arg1,arg2,arg3){4214var _27f;4215_27f=glob_obj.getFromArray(arg1);4216if(_27f){4217success_cb=_27f.success_cb;4218error_cb=_27f.error_cb;4219}else{4220return;4221}4222if(arg3.ErrorCode){4223__sp_location_handle_error(error_cb,arg3.ErrorCode,arg3.ErrorMessage);4224}else{4225var _280=getGeoLocationPosition(arg3.ReturnValue);4226success_cb(_280);4227return;4228}4229glob_obj.removeFromArray(arg1);4230};4231function __sp_traceLocation(_281,_282,_283){4232if((_281==undefined)||(_281==null)||(typeof (_281)!="function")){4233var _284="Wrong callback type";4234__sp_location_handle_error(_282,0,_284);4235return;4236}4237if((typeof _281!="function")){4238var _284="Wrong callback type";4239__sp_location_handle_error(_282,0,_284);4240return;4241}4242if((_282)){4243if((_282!=null)&&(_282!="")&&(typeof (_282)!="function")){4244var _285=new Location_PositionError();4245_285.code=-1;4246throw _285;4247}4248}4249var _286=this;4250var _287={};4251modifyObjectBaseProp(_287);4252_287.UpdateInterval=0;4253var _288={};4254modifyObjectBaseProp(_288);4255_288.LocationInformationClass="GenericLocationInfo";4256if(_283!=undefined&&_283!=null){4257if((typeof (_283)!="object")){4258var _284="Wrong posOptions type";4259__sp_location_handle_error(_282,0,_284);4260return;4261}4262}4263if(_283!=undefined){4264if((_283.enableHighAccuracy!==undefined)){4265if(_283.enableHighAccuracy==true){4266_288.EnableHighAccuracy=_283.enableHighAccuracy;4267}else{4268if(_283.enableHighAccuracy==false){4269_288.EnableHighAccuracy=_283.enableHighAccuracy;4270}else{4271if((_283.enableHighAccuracy==null)||(_283.enableHighAccuracy=="")){4272}else{4273if((typeof (_283.enableHighAccuracy)!="boolean")){4274var _289="Wrong value for enableHighAccuracy param";4275__sp_location_handle_error(_282,0,_289);4276return;4277}4278}4279}4280}4281}4282if(_283.timeout!==undefined){4283if((_283.timeout!==null)||((_283.timeout!==""))){4284if((_283.timeout==Infinity)){4285var _284="Invalid input type";4286__sp_location_handle_error(_282,0,_284);4287return;4288}else{4289if(!(isNaN(parseInt(_283.timeout)))){4290if((_283.timeout==0)){4291var _284="Invalid input type";4292__sp_location_handle_error(_282,0,_284);4293return;4294}4295_287.UpdateTimeOut=_283.timeout*1000;4296}4297}4298}else{4299if((_283.timeout===null)||((_283.timeout===""))){4300}else{4301var _284="Invalid input type";4302__sp_location_handle_error(_282,0,_284);4303return;4304}4305}4306}4307if(typeof _283.maximumAge!="undefined"){4308if(_283.maximumAge==_infinity){4309_287.UpdateTimeOut=0;4310_287.UpdateMaxAge=2147483647;4311}else{4312if(!(isNaN(parseInt(_283.maximumAge)))){4313_287.UpdateMaxAge=_283.maximumAge*1000;4314}else{4315if((_283.maximumAge===null)||((_283.maximumAge===""))){4316}else{4317var _284="Invalid input type";4318__sp_location_handle_error(_282,0,_284);4319return;4320}4321}4322}4323}4324}4325_287.PartialUpdates=false;4326_288.Updateoptions=_287;4327try{4328temp_scb=_281;4329temp_ecb=_282;4330var rval=this.so.ILocation.Trace(_288,this.traceCb);4331if(rval.TransactionID){4332glob_obj.addToGlobalArray(rval.TransactionID,_281,_282);4333}4334delete _287;4335delete _288;4336if(rval.ErrorCode!=0){4337__sp_location_handle_error(_282,rval.ErrorCode,rval.ErrorMessage);4338return;4339}4340return rval.TransactionID;4341}4342catch(e){4343__device_handle_exception(e,"__sp_traceLocation: "+e);4344}4345};4346function __sp_clearTrace(_28b){4347if(typeof _28b!="number"){4348var _28c="Invalid input type";4349__sp_location_handle_error(fail_cb,0,_28c);4350}4351var _28d={TransactionID:_28b};4352try{4353var _28e=this.so.ILocation.Cancel(_28d);4354}4355catch(e){4356__device_handle_exception(e,"__sp_clearTrace: "+e);4357}4358};4359function __sp_location_instance(){4360this.descriptor=new __sp_location_descriptor();4361this.getLocation=__sp_getLocation;4362this.getLocationCb=__sp_getLocation_cb;4363this.traceLocation=__sp_traceLocation;4364this.traceCb=__sp_traceLocation_cb;4365this.clearTrace=__sp_clearTrace;4366try{4367this.so=device.getServiceObject("Service.Location","ILocation");4368}4369catch(e){4370this.so=null;4371__device_handle_exception(e,"Location service not available");4372}4373};4374function __device_commlog_descriptor(_28f){4375this.interfaceName=_28f.interfaceName;4376this.version=_28f.version;4377};4378function __device_commlog_getList(_290,_291,_292){4379return this.provider.getList(_290,_291,_292);4380};4381function __device_commlog_setNotification(_293,_294){4382return this.provider.setNotification(_293,_294);4383};4384function __device_commlog_cancelNotification(){4385return this.provider.cancelNotification();4386};4387function __device_commlog_cancel(_295){4388return this.provider.cancel(_295);4389};4390function __device_commlog_deleteLogEntry(_296){4391return this.provider.deleteLogEntry(_296);4392};4393function __device_commlog(_297){4394this.provider=_297;4395this.interfaceName=_297.descriptor.interfaceName;4396this.version=_297.descriptor.version;4397this.getList=__device_commlog_getList;4398this.setNotification=__device_commlog_setNotification;4399this.cancelNotification=__device_commlog_cancelNotification;4400this.cancel=__device_commlog_cancel;4401this.deleteLogEntry=__device_commlog_deleteLogEntry;4402};4403var __device_commlog_service_entry={"name":null,"version":null,"proto":__device_commlog,"descriptor":__device_commlog_descriptor,"providers":[{"descriptor":__sp_commlog_descriptor,"instance":__sp_commlog_instance}]};4404var invoker_notification;4405function __sp_commlog_descriptor(){4406this.interfaceName="commlog";4407if(window.__Service_Interface_Ver){4408this.version=__Service_Interface_Ver;4409}else{4410this.version=1;4411}4412};4413var __sp_commlog_type_constants={"call":0,"sms":3};4414var __sp_commlog_constants={"received":0,"missed":5,"outgoing":1};4415var __sp_commlog_constants_output={"Received":0,"Missed":5,"Outgoing":1};4416var __notifArr=new Array();4417var __notifCount=0;4418__Notification.prototype=new Object();4419__Notification.prototype.constructor=__Notification;4420function __Notification(_298,_299){4421this.connectionId=_298;4422this.callback=_299;4423};4424var __nofLogs;4425function __get_const_string(def,val){4426var i;4427for(i in def){4428if(def[i]==val){4429return i;4430}4431}4432return null;4433};4434function __get_const_val(def,str){4435if(def[str]!=undefined){4436return def[str];4437}4438return null;4439};4440function __device_commlog_item(_29f){4441if(!_29f){4442return null;4443}4444var evt={};4445evt.type=__get_const_string(__sp_commlog_type_constants,_29f.EventType);4446if(evt.type==null||evt.type==undefined){4447return null;4448}4449evt.phoneNumber=_29f.PhoneNumber;4450if(evt.phoneNumber==null||evt.phoneNumber==undefined||evt.phoneNumber.length==0){4451evt.phoneNumber="private number";4452}4453evt.time=_29f.EventTime;4454evt.flag=(_29f.Direction==undefined)?null:__get_const_string(__sp_commlog_constants_output,_29f.Direction);4455evt.summary=_29f.Description;4456evt.logId=Number(_29f.id);4457evt.contactName=_29f.RemoteParty;4458if(!evt.contactName){4459evt.contactName=evt.phoneNumber;4460}4461return evt;4462};4463function __sp_commlog_iterator_get_next(){4464if(typeof __nofLogs=="number"){4465if(__nofLogs<=0){4466return null;4467}4468__nofLogs=__nofLogs-1;4469}4470if((typeof this.buffer=="object")&&(this.buffer!=null)){4471var b1=this.buffer;4472this.buffer=null;4473var _2a2=new __device_commlog_item(b1);4474return _2a2;4475}else{4476var _2a3;4477if(this.iter!=undefined&&this.iter!=null){4478while(_2a3=this.iter.getNext()){4479if(_2a3.EventType==0||_2a3.EventType==3){4480break;4481}4482}4483}4484if(typeof _2a3=="undefined"){4485return null;4486}4487var rval=new __device_commlog_item(_2a3);4488_2a3.close();4489return rval;4490}4491};4492function __sp_commlog_iterator_has_next(){4493if(__nofLogs<=0){4494return false;4495}4496if(this.iter!=undefined&&this.iter!=null){4497while(this.buffer=this.iter.getNext()){4498if(this.buffer.EventType==0||this.buffer.EventType==3){4499break;4500}4501}4502}4503if((typeof this.buffer=="object")&&(this.buffer!=null)){4504return true;4505}else{4506return false;4507}4508};4509function __sp_commlog_iterator_close(){4510this.iter.close();4511};4512function __sp_commlog_iterator(_2a5){4513this.iter=_2a5;4514this.buffer=null;4515this.next=__sp_commlog_iterator_get_next;4516this.hasNext=__sp_commlog_iterator_has_next;4517this.close=__sp_commlog_iterator_close;4518this.nofLogs=__nofLogs;4519};4520function __sp_commlog_getList_cb(arg1,arg2,arg3){4521var _2a9;4522var _2aa;4523var iter=null;4524var _2ac=null;4525var _2ad;4526_2ad=glob_obj.getFromArray(arg1);4527if(_2ad){4528_2a9=_2ad.success_cb;4529_2aa=_2ad.error_cb;4530}else{4531alert("Commlog: __sp_commlog_getList_cb : Callback not found ");4532return;4533}4534if(arg3.ErrorCode!=0){4535if(arg3.ErrorMessage){4536_2ac=splitErrorMessage(arg3.ErrorMessage);4537}else{4538_2ac="operation failed";4539}4540if(_2aa){4541setTimeout(function(){4542_2aa(new DeviceException(MapErrorCode[arg3.ErrorCode],"Commlog: getList: "+_2ac));4543},1000);4544return;4545}4546}else{4547if(arg3.ReturnValue){4548iter=new __sp_commlog_iterator(arg3.ReturnValue);4549}4550}4551if(arg2!=event_cancelled){4552_2a9(iter);4553}4554glob_obj.removeFromArray(arg1);4555};4556function __sp_commlog_getList(_2ae,_2af,_2b0){4557if(_2ae==null||_2ae==undefined){4558throw new DeviceException(this.error.MISSING_ARG_ERR,"CommLog:getList:callback is Required");4559}else{4560if(typeof _2ae!="function"){4561throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog:getList:Invalid Callback");4562}4563}4564if(_2b0){4565if(typeof (_2b0)!="function"){4566throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog: getList: ErrorCallback is invalid");4567}4568}4569if(_2af!=null&&_2af!=undefined){4570if(typeof _2af!="object"||__device_typeof(_2af)=="Array"){4571throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog: getList: Match is not an object");4572}4573if(_2af.type!=null&&_2af.type!=undefined){4574if(typeof _2af.type!="string"){4575throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog: getList: Type is not a string");4576}4577}4578if(_2af.flag!=null&&_2af.flag!=undefined){4579if(typeof _2af.flag!="string"){4580throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog: getList: Flag is not a string");4581}4582if(_2af.type){4583if(_2af.type.toLowerCase()=="sms"&&_2af.flag.toLowerCase()=="missed"){4584if(_2b0){4585_2b0(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"commlogs: getList: Missed is not supported for sms"));4586return;4587}else{4588throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"commlogs: getList: Missed is not supported for sms");4589}4590}4591}4592}4593if(_2af.nofLogs!=null&&_2af.nofLogs!=undefined){4594if(typeof _2af.nofLogs!="number"){4595throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog: getList: nofLogs is invalid");4596}4597}4598}4599try{4600var _2b1={};4601modifyObjectBaseProp(_2b1);4602_2b1.Type="Log";4603_2b1.Filter={};4604modifyObjectBaseProp(_2b1.Filter);4605if(_2af){4606if(_2af.type){4607var _2b2;4608_2b2=__get_const_val(__sp_commlog_type_constants,_2af.type.toLowerCase());4609if(_2b2!=undefined){4610_2b1.Filter.EventType=_2b2;4611}else{4612if(_2b0){4613_2b0(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: Type is out of range"));4614return;4615}else{4616throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: Type is out of range");4617}4618}4619}4620if(_2af.nofLogs!=null&&_2af.nofLogs!=undefined){4621if((_2af.nofLogs<0)||(_2af.nofLogs!=(_2af.nofLogs|0))){4622if(_2b0){4623_2b0(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: nofLogs is out of range"));4624return;4625}else{4626throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: nofLogs is out of range");4627}4628}4629__nofLogs=_2af.nofLogs;4630}4631if(_2af.flag){4632var _2b3;4633_2b3=__get_const_val(__sp_commlog_constants,_2af.flag.toLowerCase());4634if(_2b3!=undefined){4635_2b1.Filter.Direction=_2b3;4636}else{4637if(_2b0){4638_2b0(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: Flag is out of range"));4639}else{4640throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"CommLog: getList: Flag is out of range");4641}4642}4643}4644if(_2af.phoneNumber!=null&&_2af.phoneNumber!=undefined){4645if(_2af.phoneNumber!=""){4646_2b1.Filter.PhoneNumber=_2af.phoneNumber;4647}4648}4649if(_2af.contactName!=null&&_2af.contactName!=undefined){4650if(_2af.contactName!=""){4651_2b1.Filter.RemoteParty=_2af.contactName;4652}4653}4654if(_2af.startTime!=null&&_2af.startTime!=undefined){4655_2b1.Filter.StartTime=_2af.startTime;4656}4657if(_2af.endTime!=null&&_2af.endTime!=undefined){4658_2b1.Filter.EndTime=_2af.endTime;4659}4660}4661temp_scb=_2ae;4662temp_ecb=_2b0;4663var _2b4=this.so.IDataSource.GetList(_2b1,this.getListCb);4664if(_2b4.TransactionID){4665glob_obj.addToGlobalArray(_2b4.TransactionID,_2ae,_2b0);4666}4667if(_2b1.Filter){4668delete _2b1.Filter.Direction;4669delete _2b1.Filter.EventType;4670delete _2b1.Filter.PhoneNumber;4671}4672if(_2b1){4673delete _2b1.Filter;4674delete _2b1.Type;4675}4676if(_2b4.ErrorCode!=0){4677var _2b5="operation failed";4678if(_2b4.ErrorMessage){4679_2b5=splitErrorMessage(_2b4.ErrorMessage);4680}4681switch(MapErrorCode[_2b4.ErrorCode]){4682case this.error.INVALID_ARG_ERR:4683case this.error.MISSING_ARG_ERR:4684case this.error.NOT_SUPPORTED_ERR:4685throw new DeviceException(MapErrorCode[_2b4.ErrorCode],"CommLog:getList:"+_2b5);4686break;4687default:4688if(_2b0){4689_2b0(new DeviceException(MapErrorCode[_2b4.ErrorCode],"CommLog:getList:"+_2b5));4690return;4691}else{4692throw new DeviceException(MapErrorCode[_2b4.ErrorCode],"CommLog:getList:"+_2b5);4693}4694}4695}4696return _2b4.TransactionID;4697}4698catch(e){4699__device_handle_exception(e,"__sp_commlog_Input_validation: "+e);4700}4701};4702function __sp_commlog_setNotification_cb(arg1,arg2,arg3){4703var _2b9;4704var _2ba;4705var _2bb=null;4706var _2bc;4707_2bc=glob_obj.getFromArray(arg1);4708if(_2bc){4709_2b9=_2bc.success_cb;4710_2ba=_2bc.error_cb;4711}else{4712alert("Commlog: __sp_commlog_setNotification_cb : Callback not found ");4713return;4714}4715if(arg3.ErrorCode!=0){4716if(arg3.ErrorMessage){4717err_msg=splitErrorMessage(arg3.ErrorMessage);4718}else{4719err_msg="operation failed";4720}4721if(_2ba){4722_2ba(new DeviceException(MapErrorCode[arg3.ErrorCode],"CommLog: getList: "+err_msg));4723return;4724}4725}else{4726if(arg3.ReturnValue){4727_2bb=new __device_commlog_item(arg3.ReturnValue);4728}4729}4730if(arg2!=event_cancelled){4731for(i in __notifArr){4732if(arg1==__notifArr[i].connectionId){4733var _2bd=__notifArr[i];4734break;4735}4736}4737if(_2bd){4738_2bd.callback(_2bb);4739}4740}4741glob_obj.removeFromArray(arg1);4742};4743function __sp_commlog_setNotification(_2be,_2bf){4744if(!_2be){4745throw new DeviceException(this.error.MISSING_ARG_ERR,"CommLog:setNotification:callback is missing");4746}4747if(typeof _2be!="function"){4748throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog:setNotification:callback is invalid");4749}4750if(_2bf){4751if(typeof (_2bf)!="function"){4752throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog: setNotification: ErrorCallback is invalid");4753}4754}4755for(i in __notifArr){4756var _2c0=__notifArr[i];4757__notifArr.splice(i,1);4758__notifCount=__notifArr.length;4759this.so.IDataSource.Cancel({TransactionID:_2c0.connectionId});4760break;4761}4762var _2c1={};4763modifyObjectBaseProp(_2c1);4764_2c1.Type="Log";4765_2c1.Filter={DelayTime:0};4766temp_scb=_2be;4767temp_ecb=_2bf;4768var _2c2=this.so.IDataSource.RequestNotification(_2c1,this.setNotificationCb);4769if(_2c2.TransactionID){4770glob_obj.addToGlobalArray(_2c2.TransactionID,_2be,_2bf);4771}4772__notifArr[__notifCount++]=new __Notification(_2c2.TransactionID,_2be);4773if(_2c1){4774delete _2c1.Type;4775}4776if(_2c2.ErrorCode!=0){4777var _2c3="operation failed";4778if(_2c2.ErrorMessage){4779_2c3=splitErrorMessage(_2c2.ErrorMessage);4780}4781switch(MapErrorCode[_2c2.ErrorCode]){4782case this.error.INVALID_ARG_ERR:4783case this.error.MISSING_ARG_ERR:4784case this.error.NOT_SUPPORTED_ERR:4785throw new DeviceException(MapErrorCode[_2c2.ErrorCode],"CommLog:setNotification:"+_2c3);4786break;4787default:4788if(_2bf){4789setTimeout(function(){4790_2bf(new DeviceException(MapErrorCode[_2c2.ErrorCode],"CommLog:setNotification:"+_2c3));4791},1000);4792}else{4793throw new DeviceException(MapErrorCode[_2c2.ErrorCode],"CommLog:setNotification:"+_2c3);4794}4795}4796}4797};4798function __sp_commlog_cancelNotification(){4799for(i in __notifArr){4800if(__notifArr[i].connectionId){4801var _2c4=__notifArr[i];4802__notifArr.splice(i,1);4803__notifCount=__notifArr.length;4804break;4805}4806}4807if(_2c4){4808var _2c5=this.so.IDataSource.Cancel({TransactionID:_2c4.connectionId});4809if(_2c5.ErrorCode!=0){4810var _2c6="operation failed";4811if(_2c5.ErrorMessage){4812_2c6=splitErrorMessage(_2c5.ErrorMessage);4813}4814}4815}4816};4817function __sp_commlog_cancel(_2c7){4818if(!_2c7){4819throw new DeviceException(this.error.MISSING_ARG_ERR,"CommLog:cancel:transactionId is missing");4820}4821if(typeof _2c7!="number"){4822throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog:cancel:transactionId is invalid");4823}4824var _2c8=this.so.IDataSource.Cancel({TransactionID:_2c7});4825if(_2c8.ErrorCode!=0){4826var _2c9="operation failed";4827if(_2c8.ErrorMessage){4828_2c9=splitErrorMessage(_2c8.ErrorMessage);4829}4830throw new DeviceException(MapErrorCode[_2c8.ErrorCode],"CommLog:cancel:"+_2c9);4831}4832};4833function __sp_commlog_deleteLogEntry(_2ca){4834if(_2ca==null||_2ca==undefined){4835throw new DeviceException(this.error.MISSING_ARG_ERR,"CommLog:deleteLogEntry:logId is missing");4836}4837if(typeof _2ca!="number"){4838throw new DeviceException(this.error.INVALID_ARG_ERR,"CommLog:deleteLogEntry:logId is invalid");4839}4840var _2cb={};4841modifyObjectBaseProp(_2cb);4842_2cb.Type="Log";4843_2cb.Data={id:_2ca.toString()};4844modifyObjectBaseProp(_2cb.Data);4845var _2cc=this.so.IDataSource.Delete(_2cb);4846if(_2cc.ErrorCode!=0){4847var _2cd="operation failed";4848if(_2cc.ErrorMessage){4849_2cd=splitErrorMessage(_2cc.ErrorMessage);4850}4851throw new DeviceException(MapErrorCode[_2cc.ErrorCode],"CommLog:deleteLogEntry:"+_2cd);4852}4853};4854function __sp_commlog_instance(){4855this.descriptor=new __sp_commlog_descriptor();4856this.getList=__sp_commlog_getList;4857this.getListCb=__sp_commlog_getList_cb;4858this.setNotification=__sp_commlog_setNotification;4859this.setNotificationCb=__sp_commlog_setNotification_cb;4860this.cancelNotification=__sp_commlog_cancelNotification;4861this.cancel=__sp_commlog_cancel;4862this.deleteLogEntry=__sp_commlog_deleteLogEntry;4863this.error=new DeviceException(0,"Dummy");4864try{4865this.so=device.getServiceObject("Service.Logging","IDataSource");4866}4867catch(e){4868this.so=null;4869__device_handle_exception(e,"commlog service not available");4870}4871};4872function __device_messaging_descriptor(_2ce){4873this.interfaceName=_2ce.interfaceName;4874this.version=_2ce.version;4875};4876function __device_messaging_startEditor(_2cf){4877return this.provider.startEditor(_2cf);4878};4879function __device_messaging_getList(_2d0,_2d1,_2d2,_2d3,_2d4){4880return this.provider.getList(_2d0,_2d1,_2d2,_2d3,_2d4);4881};4882function __device_messaging_send(_2d5,_2d6,id,_2d8){4883return this.provider.send(_2d5,_2d6,id,_2d8);4884};4885function __device_messaging_setNotifier(_2d9,_2da){4886return this.provider.setNotifier(_2d9,_2da);4887};4888function __device_messaging_cancelNotifier(){4889return this.provider.cancelNotifier();4890};4891function __device_messaging_getMessage(id){4892return this.provider.getMessage(id);4893};4894function __device_messaging_delete(id){4895return this.provider.deleteMessage(id);4896};4897function __device_messaging_setStatus(id,_2de){4898return this.provider.setStatus(id,_2de);4899};4900function __device_messaging_cancel(_2df){4901return this.provider.cancel(_2df);4902};4903function __device_messaging(_2e0){4904this.provider=_2e0;4905this.interfaceName=_2e0.descriptor.interfaceName;4906this.version=_2e0.descriptor.version;4907this.SORT_ASCENDING=0;4908this.SORT_DESCENDING=1;4909this.SORT_BY_DATE=0;4910this.SORT_BY_SENDER=1;4911this.STATUS_READ=0;4912this.STATUS_UNREAD=1;4913this.startEditor=__device_messaging_startEditor;4914this.getList=__device_messaging_getList;4915this.send=__device_messaging_send;4916this.setNotifier=__device_messaging_setNotifier;4917this.cancelNotifier=__device_messaging_cancelNotifier;4918this.getMessage=__device_messaging_getMessage;4919this.deleteMessage=__device_messaging_delete;4920this.setStatus=__device_messaging_setStatus;4921this.cancel=__device_messaging_cancel;4922};4923var __device_messaging_service_entry={"name":null,"version":null,"proto":__device_messaging,"descriptor":__device_messaging_descriptor,"providers":[{"descriptor":__sp_messaging_descriptor,"instance":__sp_messaging_instance}]};4924var FILE_SCHEME="file://";4925function __sp_messaging_descriptor(){4926this.interfaceName="messaging";4927if(window.__Service_Interface_Ver){4928this.version=__Service_Interface_Ver;4929}else{4930this.version=1;4931}4932};4933function __sp_messaging_instance(){4934this.descriptor=new __sp_messaging_descriptor();4935this.startEditor=__sp_messaging_startEditor;4936this.getList=__sp_messaging_getList;4937this.getListcB=__sp_message_getListcB;4938this.send=__sp_messaging_send;4939this.sendcb=__sp_message_sendcb;4940this.setNotifier=__sp_messaging_setNotifier;4941this.setNotifierCb=__sp_messaging_setNotifier_cb;4942this.cancelNotifier=__sp_messaging_cancelNotifier;4943this.getMessage=__sp_messaging_getMessage;4944this.deleteMessage=__sp_messaging_delete;4945this.setStatus=__sp_messaging_setStatus;4946this.cancel=__sp_messaging_cancel;4947this.sendCommon=__sp_messaging_send_common;4948this.SORT_ASCENDING=0;4949this.SORT_DESCENDING=1;4950this.SORT_BY_DATE=0;4951this.SORT_BY_SENDER=1;4952this.STATUS_READ=0;4953this.STATUS_UNREAD=1;4954this.error=new DeviceException(0,"Dummy");4955try{4956this.so=device.getServiceObject("Service.Messaging","IMessaging");4957}4958catch(e){4959this.so=null;4960__device_handle_exception(e,"Messaging service not available");4961}4962};4963function __sp_attachment_build(_2e1){4964if(!_2e1){4965return null;4966}4967var _2e2={};4968modifyObjectBaseProp(_2e2);4969if(_2e1.uri){4970if(typeof _2e1.uri!="string"){4971throw new DeviceException(this.error.INVALID_ARG_ERR,"uri is invalid");4972}4973if(_2e1.uri.slice(0,7)==FILE_SCHEME){4974if(_2e1.uri.charAt(7)=="/"){4975if(_2e1.uri.charAt(9)!=":"){4976throw new DeviceException(this.error.URI_NOT_FOUND_ERR,"specified uri not found");4977}4978_2e2.FileName=_2e1.uri.slice(8).replace(/\057/g,"\\");4979if(_2e2.FileName.length>256){4980throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"uri is out of range");4981}4982}else{4983if(_2e1.uri.charAt(8)!=":"){4984throw new DeviceException(this.error.URI_NOT_FOUND_ERR,"specified uri not found");4985}4986_2e2.FileName=_2e1.uri.slice(7).replace(/\057/g,"\\");4987if(_2e2.FileName.length>256){4988throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"uri is out of range");4989}4990}4991}else{4992throw new DeviceException(this.error.INVALID_URI_ERR,"uri is invalid");4993}4994}4995return _2e2;4996};4997function __sp_message_build(_2e3,id){4998if(!_2e3){4999return null;5000}5001var _2e5={};5002modifyObjectBaseProp(_2e5);5003var _2e6=0;5004_2e5.MessageParam={};5005modifyObjectBaseProp(_2e5.MessageParam);5006_2e5.MessageParam.LaunchEditor=false;5007_2e5.MessageType=(_2e3.type==undefined||_2e3.type==null||_2e3.type=="")?"SMS":_2e3.type;5008if(_2e3.to){5009if(typeof (_2e3.to)=="string"){5010_2e5.To=_2e3.to;5011}else{5012if(__device_typeof(_2e3.to)=="Array"&&_2e3.to.length>0){5013if(_2e3.to[0]){5014_2e5.To=_2e3.to[0];5015}5016if(_2e3.to.length>1){5017if(_2e3.to.slice(1)){5018_2e5.MessageParam.To=_2e3.to.slice(1);5019}5020}5021}else{5022_2e5.To=_2e3.to;5023}5024}5025}5026if(_2e3.cc){5027_2e5.MessageParam.Cc=_2e3.cc;5028}5029if(id){5030if((typeof (id)=="string")&&!(isNaN(id))){5031id=Number(id);5032}5033_2e5.MessageParam.TemplateId=id;5034}5035if(_2e5.MessageType=="SMS"){5036if(_2e3.body){5037_2e5.BodyText=_2e3.body;5038}5039}5040if(_2e5.MessageType=="MMS"){5041if(_2e3.body){5042_2e5.BodyText=_2e3.body;5043}5044if(_2e3.subject){5045if(typeof _2e3.subject=="string"&&_2e3.subject.length>256){5046throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"subject length is greater than 256 characters");5047}5048_2e5.Subject=_2e3.subject;5049}5050if(_2e3.attachments){5051_2e5.MessageParam.AttachmentList=[];5052for(var a in _2e3.attachments){5053if(typeof _2e3.attachments[a]=="object"&&__device_typeof(_2e3.attachments[a])!="Array"){5054_2e5.MessageParam.AttachmentList.push(__sp_attachment_build(_2e3.attachments[a]));5055_2e6=1;5056}5057}5058if(_2e6==0){5059throw new DeviceException(this.error.INVALID_ARG_ERR,"uri is invalid");5060}5061}5062}5063return _2e5;5064};5065function __sp_device_attachment_build(_2e8){5066if(!_2e8){5067return null;5068}5069var _2e9={};5070_2e9.uri=FILE_SCHEME+_2e8.FileName;5071return _2e9;5072};5073function __sp_device_message_build(_2ea){5074if(!_2ea){5075return null;5076}5077var _2eb={};5078_2eb.body=null;5079_2eb.subject=null;5080_2eb.attachments=null;5081_2eb.to=null;5082_2eb.cc=null;5083_2eb.type=_2ea.MessageType;5084if(_2ea.BodyText){5085_2eb.body=_2ea.BodyText;5086}5087if(_2ea.to){5088_2eb.to=_2ea.To;5089}5090if(_2ea.Subject){5091_2eb.subject=_2ea.Subject;5092}5093_2eb.attachment=false;5094if(_2eb.type=="MMS"){5095if(_2ea.Cc){5096_2eb.cc=_2ea.Cc;5097}5098if(_2ea.AttachmentList){5099_2eb.attachment=true;5100_2eb.attachments=[];5101for(var a in _2ea.AttachmentList){5102if(_2ea.AttachmentList.hasOwnProperty("a")){5103_2eb.attachments.push(__sp_device_attachment_build(_2ea.AttachmentList[a]));5104}5105}5106}5107}5108return _2eb;5109};5110function __sp_device_message_info_build_notifier(_2ed){5111if(!_2ed){5112return null;5113}5114var _2ee={};5115_2ee.message={};5116_2ee.message.type=_2ed.MessageType;5117_2ee.sender=_2ed.Sender;5118_2ee.message.subject=_2ed.Subject;5119_2ee.time=_2ed.Time;5120_2ee.attachments=(_2ed.Attachments==undefined||_2ed.Attachments==null)?(!(_2ed.AttachmentList==undefined||_2ed.AttachmentList==null)):_2ed.Attachments;5121_2ee.unread=_2ed.Unread;5122_2ee.id=(_2ed.MessageId).toString();5123return _2ee;5124};5125function __sp_device_message_info_build(_2ef){5126if(!_2ef){5127return null;5128}5129var _2f0={};5130_2f0.message=__sp_device_message_build(_2ef);5131_2f0.sender=_2ef.Sender;5132_2f0.time=_2ef.Time;5133_2f0.unread=_2ef.Unread;5134_2f0.id=(_2ef.MessageId).toString();5135return _2f0;5136};5137function __sp_message_iterator_get_next(){5138var _2f1=this.iter.getNext();5139if(typeof _2f1=="undefined"){5140return null;5141}5142var _2f2=__sp_device_message_info_build(_2f1);5143_2f1.close();5144return _2f2;5145};5146function __sp_message_iterator(_2f3){5147this.iter=_2f3;5148this.next=__sp_message_iterator_get_next;5149this.close=function(){5150this.iter.close();5151};5152};5153function __sp_message_getListcB(arg1,arg2,arg3){5154var _2f7;5155var _2f8;5156var _2f9;5157_2f9=glob_obj.getFromArray(arg1);5158if(_2f9){5159_2f7=_2f9.success_cb;5160_2f8=_2f9.error_cb;5161}else{5162alert("Messaging: __sp_message_getListcB: Callback not found ");5163return;5164}5165var iter=null;5166if(arg3.ErrorCode!=0){5167if(arg3.ErrorMessage){5168err_msg=splitErrorMessage(arg3.ErrorMessage);5169}else{5170err_msg="Operation Failed";5171}5172if(_2f8){5173_2f8(new DeviceException(MapErrorCode[arg3.ErrorCode],"Messaging: getList: "+err_msg));5174return;5175}5176}else{5177if(arg3.ReturnValue){5178iter=new __sp_message_iterator(arg3.ReturnValue);5179}5180}5181if(arg2!=event_cancelled){5182_2f7(iter);5183}5184glob_obj.removeFromArray(arg1);5185};5186function __sp_messaging_getList(_2fb,_2fc,_2fd,_2fe,_2ff){5187if(!_2fb){5188throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:getList:callback is missing");5189}else{5190if(typeof _2fb!="function"){5191throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:getList:callback is not a function");5192}5193}5194if(_2ff!=null&&typeof _2ff!="undefined"){5195if(typeof (_2ff)!="function"){5196throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging: startEditor: ErrorCallback is invalid");5197}5198}5199if(_2fc!=null&&_2fc!=undefined&&typeof _2fc!="object"){5200throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:getList:match is invalid");5201}5202if(_2fd!=null&&_2fd!=undefined&&typeof _2fd!="number"){5203throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:getList:sortkey is invalid");5204}5205if(_2fe!=null&&_2fe!=undefined&&typeof _2fe!="number"){5206throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:getList:sortorder is invalid");5207}5208if(_2fd!=null&&_2fd!=undefined&&typeof _2fd=="number"){5209if((_2fd!=0)&&(_2fd!=1)){5210_2ff(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:getList:sortkey is out of range"));5211return;5212}5213}5214if(_2fe!=null&&_2fe!=undefined&&typeof _2fe=="number"){5215if((_2fe!=0)&&(_2fe!=1)){5216_2ff(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:getList:sortorder is out of range"));5217return;5218}5219}5220var _300={};5221modifyObjectBaseProp(_300);5222_300.Type="Inbox";5223_300.Filter={};5224modifyObjectBaseProp(_300.Filter);5225if(_2fc){5226if(_2fc.type!=null&&_2fc.type!=undefined){5227_300.Filter.MessageTypeList=_2fc.type;5228}5229if(_2fc.senders!=null&&_2fc.senders!=undefined){5230_300.Filter.SenderList=_2fc.senders;5231}5232if(_2fc.subject!=null&&_2fc.subject!=undefined){5233if(_2fc.subject.length>256){5234if(_2ff){5235_2ff(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:getList:subject is out of range"));5236return;5237}else{5238throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:getList:subject is out of range");5239}5240}else{5241_300.Filter.Subject=_2fc.subject;5242}5243}5244if(_2fc.start!=null&&_2fc.start!=undefined){5245_300.Filter.StartDate=_2fc.start;5246}5247if(_2fc.end!=null&&_2fc.end!=undefined){5248_300.Filter.EndDate=_2fc.end;5249}5250}5251if(_2fd||_2fe){5252_300.SortOrder={};5253modifyObjectBaseProp(_300.SortOrder);5254if(_2fd){5255if((_2fd==this.SORT_BY_DATE)){5256_300.SortOrder.Key="Date";5257}else{5258if((_2fd==this.SORT_BY_SENDER)){5259_300.SortOrder.Key="Sender";5260}5261}5262}else{5263_300.SortOrder.Key="Date";5264}5265if(_2fe){5266if((_2fe==this.SORT_ASCENDING)){5267_300.SortOrder.Order="Ascending";5268}else{5269if((_2fe==this.SORT_DESCENDING)){5270_300.SortOrder.Order="Descending";5271}5272}5273}else{5274_300.SortOrder.Order="Ascending";5275}5276}5277try{5278temp_scb=_2fb;5279temp_ecb=_2ff;5280var _301=this.so.IMessaging.GetList(_300,this.getListcB);5281if(_301.TransactionID){5282glob_obj.addToGlobalArray(_301.TransactionID,_2fb,_2ff);5283}5284if(_300){5285delete _300.Filter;5286delete _300.SortOrder;5287delete _300.Type;5288}5289if(_301.ErrorCode!=0){5290var _302="operation failed";5291if(_301.ErrorMessage){5292_302=splitErrorMessage(_301.ErrorMessage);5293}5294switch(MapErrorCode[_301.ErrorCode]){5295case this.error.INVALID_ARG_ERR:5296case this.error.MISSING_ARG_ERR:5297case this.error.NOT_SUPPORTED_ERR:5298throw new DeviceException(MapErrorCode[_301.ErrorCode],"Messaging:getList:"+_302);5299break;5300default:5301if(_2ff){5302setTimeout(function(){5303_2ff(new DeviceException(MapErrorCode[_301.ErrorCode],"Messaging:getList:"+_302));5304},500);5305}else{5306throw new DeviceException(MapErrorCode[_301.ErrorCode],"Messaging:getList:"+_302);5307}5308}5309}5310return _301.TransactionID;5311}5312catch(e){5313__device_handle_exception(e,"__sp_messaging_getList: "+e);5314}5315};5316function __sp_message_sendcb(arg1,arg2,arg3){5317var _306;5318var eCB;5319var _308=glob_obj.getFromArray(arg1);5320if(_308){5321_306=_308.success_cb;5322eCB=_308.error_cb;5323}else{5324alert("Messaging : __sp_message_sendcb : Callback not found");5325return;5326}5327if(_306){5328var _309="operation failed";5329if(arg3.ErrorCode!=0){5330if(arg3.ErrorMessage){5331_309=splitErrorMessage(arg3.ErrorMessage);5332}5333if(eCB){5334setTimeout(function(){5335eCB(new DeviceException(MapErrorCode[arg3.ErrorCode],"Messaging: send: "+_309));5336},500);5337return;5338}5339}5340if(arg2!=event_cancelled){5341_306();5342}5343}5344glob_obj.removeFromArray(arg1);5345};5346function __sp_messaging_send_common(_30a,_30b,_30c,id,eCB){5347var _30f=__sp_message_build(_30a,id);5348_30f.MessageParam.LaunchEditor=_30b;5349var _310;5350if(_30b==false){5351temp_scb=_30c;5352temp_ecb=eCB;5353_310=this.so.IMessaging.Send(_30f,this.sendcb);5354if(_310.TransactionID){5355glob_obj.addToGlobalArray(_310.TransactionID,_30c,eCB);5356}5357if(_310.ErrorCode!=0){5358var _311="operation failed";5359if(_310.ErrorMessage){5360_311=splitErrorMessage(_310.ErrorMessage);5361}5362switch(MapErrorCode[_310.ErrorCode]){5363case this.error.INVALID_ARG_ERR:5364case this.error.MISSING_ARG_ERR:5365case this.error.NOT_SUPPORTED_ERR:5366throw new DeviceException(MapErrorCode[_310.ErrorCode],_311);5367break;5368default:5369if(eCB){5370setTimeout(function(){5371eCB(new DeviceException(MapErrorCode[_310.ErrorCode],_311));5372},500);5373return;5374}else{5375throw new DeviceException(MapErrorCode[_310.ErrorCode],_311);5376}5377}5378}5379var _312=_310.TransactionID;5380return _312;5381}else{5382_310=this.so.IMessaging.Send(_30f);5383if(_310.ErrorCode!=0){5384if(_310.ErrorMessage){5385var _313=splitErrorMessage(_310.ErrorMessage);5386throw new DeviceException(MapErrorCode[_310.ErrorCode],"Messaging:startEditor"+_313);5387}else{5388throw new DeviceException(MapErrorCode[_310.ErrorCode],"Messaging:startEditor:operation failed");5389}5390}5391}5392if(_30f){5393delete _30f.MessageParam;5394}5395};5396function __sp_messaging_startEditor(_314){5397if(!_314){5398throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:startEditor:message is missing");5399}else{5400if(typeof _314!="object"){5401throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:startEditor:message is invalid");5402}5403}5404if((_314.subject)){5405if((_314.subject).length>256){5406throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:startEditor:subject is too lengthy");5407}5408}5409if(_314.attachments!=undefined&&_314.attachments!=null&&typeof _314.attachments!="object"){5410throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:startEditor:attachment is invalid");5411}5412if(_314){5413if(_314.body){5414if(typeof (_314.body)!="string"){5415throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:startEditor:body is invalid");5416}5417}5418}5419try{5420this.sendCommon(_314,true,null);5421}5422catch(e){5423var _315=null;5424if(e.message){5425_315=new DeviceException(e.code,"Messaging:startEditor:"+e.message);5426}else{5427_315=new DeviceException(e.code,"Messaging:startEditor:operation failed");5428}5429__device_handle_exception(_315,"__sp_messaging_startEditor: "+_315);5430}5431};5432function __sp_messaging_send(_316,_317,id,_319){5433if(!_317){5434throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:send:message is missing");5435}else{5436if(typeof _317!="object"){5437throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:send:message is invalid");5438}5439}5440if(!_316){5441throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:send:callback is missing");5442}else{5443if(typeof _316!="function"){5444throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:send:callback is invalid");5445}5446}5447if(_317.to==undefined||_317.to==null){5448throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:send:to field is missing");5449}5450if(_317.attachments!=undefined&&_317.attachments!=null&&typeof _317.attachments!="object"){5451throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:send:attachment is invalid");5452}5453if(!id){5454id="";5455}5456if((typeof id)=="function"){5457var _31a=id;5458id="";5459_319=_31a;5460}5461if((typeof _319)=="undefined"||_319==null){5462_319=null;5463}else{5464if((typeof _319)!="function"){5465throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:send:errorCallback is not a function");5466}5467}5468var _31b=function(arg1,arg2,arg3){5469var _31f=_316;5470var _320=_319;5471var iter=null;5472if(arg3.ErrorCode!=0){5473var _322;5474if(arg3.ErrorMessage){5475_322=splitErrorMessage(arg3.ErrorMessage);5476}else{5477_322="Operation Failed";5478}5479_320(new DeviceException(MapErrorCode[arg3.ErrorCode],"Messaging:startEditor: "+_322));5480return;5481}else{5482if(arg3.ReturnValue){5483iter=new __sp_message_iterator(arg3.ReturnValue);5484_31f(iter);5485}5486}5487if(arg2!=event_cancelled){5488_31f(iter);5489}5490};5491try{5492var _323=this.sendCommon(_317,false,_316,id,_319);5493return _323;5494}5495catch(e){5496var _324=null;5497switch(e.code){5498case this.error.INVALID_ARG_ERR:5499case this.error.MISSING_ARG_ERR:5500case this.error.NOT_SUPPORTED_ERR:5501throw new DeviceException(e.code,"Messaging:send:"+e.message);5502break;5503default:5504if(_319){5505setTimeout(function(){5506_319(new DeviceException(e.code,"Messaging:send:"+e.message));5507},1000);5508}else{5509throw new DeviceException(e.code,"Messaging:send:"+e.message);5510}5511}5512}5513};5514function __sp_messaging_setNotifier_cb(arg1,arg2,arg3){5515var _328;5516var _329;5517var _32a=null;5518var _32b=null;5519var _32c;5520_32c=glob_obj.getFromArray(arg1);5521if(_32c){5522_328=_32c.success_cb;5523_329=_32c.error_cb;5524}else{5525alert("Messaging: __sp_messaging_setNotifier_cb : Callback not found ");5526return;5527}5528if(arg3.ErrorCode!=0){5529if(arg3.ErrorMessage){5530_32b=splitErrorMessage(arg3.ErrorMessage);5531}else{5532_32b="operation failed";5533}5534if(_329){5535_329(new DeviceException(MapErrorCode[arg3.ErrorCode],"Messaging:setNotifier: "+_32b));5536return;5537}5538}else{5539if(arg3.ReturnValue){5540_32a=new __sp_device_message_info_build_notifier(arg3.ReturnValue);5541arg3.ReturnValue.close();5542}5543}5544if(arg2!=event_cancelled){5545_328(_32a.id);5546}5547glob_obj.removeFromArray(arg1);5548};5549function __sp_messaging_setNotifier(_32d,_32e){5550if(!_32d){5551throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:setNotifier:callback is missing");5552}else{5553if(typeof _32d!="function"){5554throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:setNotifier:callback is invalid");5555}5556}5557if(_32e){5558if(typeof (_32e)!="function"){5559throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:setNotifier: ErrorCallback is invalid");5560}5561}5562var _32f={};5563modifyObjectBaseProp(_32f);5564_32f.Type="NewMessage";5565try{5566temp_scb=_32d;5567temp_ecb=_32e;5568var _330=this.so.IMessaging.RegisterNotification(_32f,this.setNotifierCb);5569if(_330.TransactionID){5570glob_obj.addToGlobalArray(_330.TransactionID,_32d,_32e);5571}5572if(_32f){5573delete _32f.Type;5574}5575if(_330.ErrorCode!=0){5576var _331="operation failed";5577if(_330.ErrorMessage){5578_331=splitErrorMessage(_330.ErrorMessage);5579}5580switch(MapErrorCode[_330.ErrorCode]){5581case this.error.INVALID_ARG_ERR:5582case this.error.MISSING_ARG_ERR:5583case this.error.NOT_SUPPORTED_ERR:5584throw new DeviceException(MapErrorCode[_330.ErrorCode],"Messaging:setNotifier:"+_331);5585break;5586default:5587if(_32e){5588setTimeout(function(){5589_32e(new DeviceException(MapErrorCode[_330.ErrorCode],"Messaging:setNotifier:"+_331));5590},1000);5591}else{5592throw new DeviceException(MapErrorCode[_330.ErrorCode],"Messaging:setNotifier:"+_331);5593}5594}5595}5596var _332=_330.TransactionID;5597return _332;5598}5599catch(e){5600__device_handle_exception(e,"__sp_messaging_setNotifier: "+e.toString());5601}5602};5603function __sp_messaging_cancelNotifier(){5604var _333={};5605modifyObjectBaseProp(_333);5606_333.Type="NewMessage";5607try{5608var _334=this.so.IMessaging.CancelNotification(_333);5609if(_333){5610delete _333.Type;5611}5612if(_334.ErrorCode!=0){5613if(_334.ErrorMessage){5614var _335=splitErrorMessage(_334.ErrorMessage);5615throw new DeviceException(MapErrorCode[_334.ErrorCode],"Messaging:cancelNotifier"+_335);5616}else{5617throw new DeviceException(MapErrorCode[_334.ErrorCode],"Messaging:cancelNotifier:operation failed");5618}5619}5620}5621catch(e){5622__device_handle_exception(e,"__sp_messaging_cancelNotifier: "+e);5623}5624};5625function __sp_messaging_getMessage(id){5626if(!id){5627throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:getMessage:id is missing");5628}else{5629if((typeof id)!="string"){5630throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:getMessage:MessageId should be a string");5631}5632}5633if((typeof id=="string")&&!(isNaN(id))){5634id=Number(id);5635if(id==0){5636throw new DeviceException(this.error.DATA_NOT_FOUND_ERR,"Messaging:getMessage:id not found");5637}5638if(id<0){5639throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:getMessage:id is out of range");5640}5641}5642var _337={};5643modifyObjectBaseProp(_337);5644_337.Type="Inbox";5645_337.Filter={};5646modifyObjectBaseProp(_337.Filter);5647_337.Filter.MessageId=id;5648try{5649var _338=this.so.IMessaging.GetList(_337);5650if(_337){5651delete _337.Filter;5652delete _337.Type;5653}5654if(_338.ErrorCode!=0){5655if(_338.ErrorMessage){5656var _339=splitErrorMessage(_338.ErrorMessage);5657throw new DeviceException(MapErrorCode[_338.ErrorCode],"Messaging:getMessage"+_339);5658}else{5659throw new DeviceException(MapErrorCode[_338.ErrorCode],"Messaging:getMessage:operation failed");5660}5661}5662if(_338.ReturnValue){5663var iter=new __sp_message_iterator(_338.ReturnValue);5664var _33b=iter.next();5665if(_33b){5666return _33b;5667}else{5668throw new DeviceException(this.error.DATA_NOT_FOUND_ERR,"Messaging:getMessage:id not found");5669}5670}5671}5672catch(e){5673__device_handle_exception(e,"__sp_messaging_getMessage: "+e);5674}5675};5676function __sp_messaging_delete(id){5677if(!id){5678throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:delete:id is missing");5679}else{5680if((typeof id)!="string"){5681throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:deleteMessage:MessageId should be a string");5682}5683}5684if((typeof id=="string")&&!(isNaN(id))){5685id=Number(id);5686if(id==0){5687throw new DeviceException(this.error.DATA_NOT_FOUND_ERR,"Messaging:delete:id not found");5688}5689if(id<0){5690throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:delete:id is out of range");5691}5692}5693var _33d={};5694modifyObjectBaseProp(_33d);5695_33d.MessageId=id;5696try{5697var _33e=this.so.IMessaging.Delete(_33d);5698if(_33d){5699delete _33d.MessageId;5700}5701if(_33e.ErrorCode!=0){5702if(_33e.ErrorMessage){5703var _33f=splitErrorMessage(_33e.ErrorMessage);5704throw new DeviceException(MapErrorCode[_33e.ErrorCode],"Messaging:delete"+_33f);5705}else{5706throw new DeviceException(MapErrorCode[_33e.ErrorCode],"Messaging:delete:operation failed");5707}5708}5709}5710catch(e){5711__device_handle_exception(e,"__sp_messaging_delete: "+e);5712}5713};5714function __sp_messaging_setStatus(id,_341){5715if(id==null||id==undefined||(id.length)<=0){5716throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:setStatus:id is missing");5717}5718if((typeof id)!="string"){5719throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:setStatus:id should be string");5720}5721if(_341==null||_341==undefined){5722throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:setStatus:status is missing");5723}5724if(typeof _341!="number"){5725throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:setStatus:status is invalid");5726}5727if(typeof _341=="number"&&_341!=0&&_341!=1){5728throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:setStatus:status is out of range");5729}5730if((typeof id=="string")&&!(isNaN(id))){5731id=Number(id);5732if(id==0){5733throw new DeviceException(this.error.DATA_NOT_FOUND_ERR,"Messaging:setStatus:id not found");5734}5735if(id<0){5736throw new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Messaging:setStatus:id is out of range");5737}5738}5739var _342={};5740modifyObjectBaseProp(_342);5741_342.MessageId=id;5742if((_341==this.STATUS_UNREAD)){5743_342.Status="Unread";5744}else{5745if((_341==this.STATUS_READ)){5746_342.Status="Read";5747}5748}5749try{5750var _343=this.so.IMessaging.ChangeStatus(_342);5751if(_342){5752delete _342.MessageId;5753delete _342.Status;5754}5755if(_343.ErrorCode!=0){5756if(_343.ErrorMessage){5757var _344=splitErrorMessage(_343.ErrorMessage);5758throw new DeviceException(MapErrorCode[_343.ErrorCode],"Messaging:setStatus"+_344);5759}else{5760throw new DeviceException(MapErrorCode[_343.ErrorCode],"Messaging:setStatus:operation failed");5761}5762}5763}5764catch(e){5765__device_handle_exception(e,"__sp_messaging_setStatus: "+e);5766}5767};5768function __sp_messaging_cancel(_345){5769if(_345==null||_345==undefined){5770throw new DeviceException(this.error.MISSING_ARG_ERR,"Messaging:setStatus:id is missing");5771}5772if(typeof _345!="number"){5773throw new DeviceException(this.error.INVALID_ARG_ERR,"Messaging:cancel:id is invalid");5774}5775var _346={};5776modifyObjectBaseProp(_346);5777_346.TransactionID=_345;5778try{5779var _347=this.so.IMessaging.Cancel(_346);5780if(_346){5781delete _346.TransactionID;5782}5783if(_347.ErrorCode!=0){5784var err;5785if(_347.ErrorCode==1000){5786err=this.error.DATA_NOT_FOUND_ERR;5787}else{5788err=MapErrorCode[_347.ErrorCode];5789}5790if(_347.ErrorMessage){5791var _349=splitErrorMessage(_347.ErrorMessage);5792throw new DeviceException(err,"Messaging:cancel"+_349);5793}else{5794throw new DeviceException(err,"Messaging:cancel:operation failed");5795}5796}5797}5798catch(e){5799__device_handle_exception(e,"__sp_messaging_setStatus: "+e);5800}5801};5802function __device_calendar_descriptor(_34a){5803this.interfaceName=_34a.interfaceName;5804this.version=_34a.version;5805};5806function __device_calendar_startEditor(_34b,_34c,_34d){5807this.provider.startEditor(_34b,_34c,_34d);5808};5809function __device_calendar_getList(_34e,_34f,_350){5810return this.provider.getList(_34e,_34f,_350);5811};5812function __device_calendar_add(_351){5813return this.provider.addEntry(_351);5814};5815function __device_calendar_update(_352){5816return this.provider.updateEntry(_352);5817};5818function __device_calendar_delete(data){5819this.provider.deleteEntry(data);5820};5821function __device_calendar_cancel(_354){5822this.provider.cancel(_354);5823};5824function __device_calendar(_355){5825this.provider=_355;5826this.interfaceName=_355.descriptor.interfaceName;5827this.version=_355.descriptor.version;5828this.startEditor=__device_calendar_startEditor;5829this.getList=__device_calendar_getList;5830this.addEntry=__device_calendar_add;5831this.updateEntry=__device_calendar_update;5832this.deleteEntry=__device_calendar_delete;5833this.cancel=__device_calendar_cancel;5834};5835var __device_calendar_service_entry={"name":null,"version":null,"proto":__device_calendar,"descriptor":__device_calendar_descriptor,"providers":[{"descriptor":__sp_calendar_descriptor,"instance":__sp_calendar_instance}]};5836var dataGetList=0;5837var isUpdate=0;5838function __sp_calendar_descriptor(){5839this.interfaceName="calendar";5840if(window.__Service_Interface_Ver){5841this.version=__Service_Interface_Ver;5842}else{5843this.version=1;5844}5845};5846function __sp_calendar_entry_time(_356,end,_358){5847if(_356){5848var st=new Date(_356);5849this.begin=st;5850}5851if(end){5852var en=new Date(end);5853this.end=en;5854}5855if(_358){5856var al=new Date(_358);5857this.alarm=al;5858}5859};5860function __sp_calendar_isInputValid(_35c){5861if(_35c){5862if(_35c.id){5863if(typeof (_35c.id)!="string"){5864return false;5865}5866}5867if(_35c.type){5868if((typeof (_35c.type)!="string")||!__sp_calendar_entry_types.match(_35c.type)){5869return false;5870}5871}5872if(_35c.text){5873if(typeof (_35c.text)!="string"){5874return false;5875}5876}5877if(_35c.range){5878if(typeof (_35c.range)!="object"){5879return false;5880}5881if(_35c.range.begin){5882if(typeof (_35c.range.begin)!="object"){5883return false;5884}5885}5886if(_35c.range.end){5887if(typeof (_35c.range.end)!="object"){5888return false;5889}5890}5891}5892if(_35c.summary){5893if(typeof (_35c.summary)!="string"){5894return false;5895}5896}5897if(_35c.description){5898if(typeof (_35c.description)!="string"){5899return false;5900}5901}5902if(_35c.status){5903if(typeof (_35c.status)!="string"){5904return false;5905}5906}5907if(_35c.location){5908if(typeof (_35c.location)!="string"){5909return false;5910}5911}5912if(_35c.priority){5913if(typeof (_35c.priority)!="number"){5914return false;5915}5916}5917if(_35c.instanceStartTime){5918if(typeof (_35c.instanceStartTime)!="object"){5919return false;5920}5921}5922if(_35c.exceptionDates){5923if(typeof (_35c.exceptionDates)!="object"){5924return false;5925}5926}5927if(_35c.time){5928if(typeof _35c.time!="object"){5929return false;5930}5931if(_35c.time.begin){5932if(typeof (_35c.time.begin)!="object"){5933return false;5934}5935var _35d=new Date("January 1, 1970 00:01");5936if(_35c.time.begin<_35d){5937return false;5938}5939try{5940(_35c.time.begin).getTime();5941}5942catch(e){5943return false;5944}5945}5946if(_35c.time.end){5947if(typeof (_35c.time.end)!="object"){5948return false;5949}5950if(_35c.time.end=="Invalid Date"){5951return false;5952}5953try{5954(_35c.time.end).getTime();5955}5956catch(e){5957return false;5958}5959}5960if(_35c.time.begin&&_35c.time.end){5961if(_35c.time.begin>_35c.time.end){5962return false;5963}5964}5965if(_35c.time.alarm){5966if(typeof (_35c.time.alarm)!="object"){5967return false;5968}5969try{5970(_35c.time.alarm).getTime();5971}5972catch(e){5973return false;5974}5975}5976}5977if(_35c.repeatRule){5978if(typeof _35c.repeatRule!="object"){5979return false;5980}5981if(_35c.repeatRule.frequency){5982if(typeof (_35c.repeatRule.frequency)!="string"){5983return false;5984}5985}5986if(_35c.repeatRule.startDate){5987if(typeof (_35c.repeatRule.startDate)!="object"){5988return false;5989}5990if((_35c.repeatRule.startDate)=="Invalid Date"){5991return false;5992}5993try{5994(_35c.repeatRule.startDate).getTime();5995}5996catch(e){5997return false;5998}5999}6000if(_35c.repeatRule.untilDate){6001if(typeof (_35c.repeatRule.untilDate)!="object"){6002return false;6003}6004if((_35c.repeatRule.untilDate)=="Invalid Date"){6005return false;6006}6007try{6008(_35c.repeatRule.untilDate).getTime();6009}6010catch(e){6011return false;6012}6013}6014if(_35c.repeatRule.startDate&&_35c.repeatRule.untilDate){6015if(_35c.repeatRule.startDate>_35c.repeatRule.untilDate){6016return false;6017}6018}6019if(_35c.repeatRule.interval){6020if(typeof (_35c.repeatRule.interval)!="number"){6021return false;6022}6023}6024if(_35c.repeatRule.month){6025if(typeof (_35c.repeatRule.month)!="number"){6026return false;6027}6028}6029if(_35c.repeatRule.weekDays){6030if(typeof (_35c.repeatRule.weekDays)!="object"){6031return false;6032}6033}6034if(_35c.repeatRule.daysOfMonth){6035if(typeof (_35c.repeatRule.daysOfMonth)!="object"){6036return false;6037}6038}6039if(_35c.repeatRule.monthDates){6040if(typeof (_35c.repeatRule.monthDates)!="object"){6041return false;6042}6043}6044}6045}6046return true;6047};6048function __sp_calendar_getList_repeatRule(_35e){6049var _35f;6050switch(_35e.Type){6051case 1:6052_35f="daily";6053this.frequency=_35f.toString();6054break;6055case 2:6056_35f="weekly";6057this.frequency=_35f.toString();6058break;6059case 3:6060_35f="monthly";6061this.frequency=_35f.toString();6062break;6063case 4:6064_35f="yearly";6065this.frequency=_35f.toString();6066break;6067default:6068throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: Repeat Rule Type is Invalid");6069}6070if(_35e.StartDate){6071this.startDate=new Date(_35e.StartDate);6072}6073if(_35e.UntilDate){6074this.untilDate=new Date(_35e.UntilDate);6075}6076if(_35e.Interval){6077this.interval=_35e.Interval;6078}6079if(_35e.DaysInWeek){6080this.weekDays=[];6081for(var a in _35e.DaysInWeek){6082if(_35e.DaysInWeek[a]==6){6083_35e.DaysInWeek[a]=0;6084}else{6085_35e.DaysInWeek[a]=_35e.DaysInWeek[a]+1;6086}6087this.weekDays.push(_35e.DaysInWeek[a]);6088}6089}6090if(_35e.Month){6091this.month=_35e.Month;6092}6093if(_35e.DaysOfMonth){6094if(_35e.DaysOfMonth.Day){6095if(_35e.DaysOfMonth.Day==6){6096_35e.DaysOfMonth.Day=0;6097}else{6098_35e.DaysOfMonth.Day=_35e.DaysOfMonth.Day+1;6099}6100this.daysOfMonth.day=_35e.DaysOfMonth.Day;6101}6102if(_35e.DaysOfMonth.WeekNum){6103this.daysOfMonth.weekInMonth=_35e.DaysOfMonth.WeekNum;6104}6105}6106if(_35e.MonthDays){6107this.monthDates=[];6108for(var i=0;i<_35e.MonthDays.length;i++){6109this.monthDates.push(_35e.MonthDays[i]-1);6110}6111}6112};6113function __sp_device_calendar_entry(_362){6114if(_362.id){6115this.id=_362.id;6116}6117if(_362.Type){6118this.type=_362.Type;6119}6120if(_362.Summary){6121this.summary=_362.Summary;6122}6123if(_362.Description){6124this.description=_362.Description;6125}6126if(_362.Location){6127this.location=_362.Location;6128}6129if(_362.InstanceStartTime){6130this.instanceStartTime=_362.InstanceStartTime;6131}6132if(_362.Priority>=0||_362.Priority<=255){6133this.priority=_362.Priority;6134}6135if(_362.Status){6136this.status=_362.Status;6137}6138if(_362.Status=="TodoCompleted"){6139this.status="Completed";6140}else{6141if(_362.Status=="TodoNeedsAction"){6142this.status="NeedsAction";6143}6144}6145if(_362.ExDates){6146this.exceptionDates=_362.ExDates;6147}6148if(_362.RepeatRule){6149this.repeatRule=new __sp_calendar_getList_repeatRule(_362.RepeatRule);6150}6151if(dataGetList==0){6152this.time=new __sp_calendar_entry_time(_362.InstanceStartTime,_362.InstanceEndTime,_362.AlarmTime);6153}else{6154this.time=new __sp_calendar_entry_time(_362.StartTime,_362.EndTime,_362.AlarmTime);6155}6156};6157function __sp_daysOfMonth_build(_363){6158if(_363.day){6159if(_363.day==0){6160_363.day=6;6161}else{6162_363.day=_363.day-1;6163}6164this.Day=_363.day;6165}6166if(_363.weekInMonth){6167this.WeekNum=_363.weekInMonth;6168}6169};6170function __sp_calendar_addEntry_repeatRule(_364,str){6171try{6172if(!(_364.frequency)){6173throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: addEntry: frequency is missing");6174}else{6175var _366=_364.frequency;6176switch(_366){6177case "daily":6178this.Type=1;6179break;6180case "weekly":6181this.Type=2;6182break;6183case "monthly":6184this.Type=3;6185break;6186case "yearly":6187this.Type=4;6188break;6189default:6190throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: "+str+" Repeat Rule Type is Invalid");6191}6192if(_364.startDate){6193this.StartDate=_364.startDate;6194}6195if(_364.untilDate){6196this.UntilDate=_364.untilDate;6197}6198if(_364.interval){6199this.Interval=_364.interval;6200}6201if(_364.weekDays){6202this.DaysInWeek=[];6203for(var a in _364.weekDays){6204if(_364.weekDays[a]==0){6205_364.weekDays[a]=6;6206}else{6207_364.weekDays[a]=_364.weekDays[a]-1;6208}6209this.DaysInWeek.push(_364.weekDays[a]);6210}6211}6212if(_364.month){6213this.Month=_364.month;6214}6215if(_364.monthDates){6216this.MonthDays=[];6217for(var i=0;i<_364.monthDates.length;i++){6218this.MonthDays.push(_364.monthDates[i]-1);6219}6220}6221if(_364.daysOfMonth){6222this.DaysOfMonth=new Array();6223for(var a in _364.daysOfMonth){6224var _369=new __sp_daysOfMonth_build(_364.daysOfMonth[a]);6225(this.DaysOfMonth).push(_369);6226}6227}6228}6229}6230catch(e){6231__device_handle_exception(e,"__sp_calendar_addEntry_repeatRule: "+e);6232}6233};6234function __sp_calendar_entry(_36a,str){6235try{6236if(_36a.type){6237this.Type=_36a.type;6238}6239if(_36a.id){6240this.id=_36a.id;6241if(isUpdate){6242if(_36a.time){6243if(_36a.time.begin){6244this.StartTime=_36a.time.begin;6245}6246if(_36a.time.end){6247this.EndTime=_36a.time.end;6248}6249}6250}6251}6252if(_36a.instanceStartTime){6253this.InstanceStartTime=_36a.instanceStartTime;6254}6255if(_36a.description){6256this.Description=_36a.description;6257}else{6258if(isUpdate&&(_36a.description==null)){6259this.Description=" ";6260}6261}6262if(_36a.summary){6263this.Summary=_36a.summary;6264}else{6265if(isUpdate&&(_36a.summary==null)){6266this.Summary=" ";6267}6268}6269if(_36a.location){6270this.Location=_36a.location;6271}else{6272if(isUpdate&&(_36a.location==null)){6273this.Location=" ";6274}6275}6276if(_36a.priority){6277if((_36a.priority<0)||(_36a.priority>255)){6278throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: "+str+" Priority is Invalid");6279}else{6280this.Priority=_36a.priority;6281}6282}else{6283if(isUpdate&&(_36a.priority==null)){6284this.Priority=0;6285}6286}6287if(_36a.status){6288this.Status=_36a.status;6289if(_36a.status=="NeedsAction"||_36a.status=="Completed"){6290this.Status="Todo"+_36a.status;6291}6292}6293if(_36a.exceptionDates){6294this.ExDates=_36a.exceptionDates;6295}6296if(_36a.repeatRule){6297this.RepeatRule=new __sp_calendar_addEntry_repeatRule(_36a.repeatRule,str);6298}6299if(_36a.type!=undefined&&_36a.type!=null){6300if(typeof this.Type!="string"){6301throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: "+str+" Type is not a string");6302}6303switch(this.Type){6304case "Meeting":6305if(_36a.time){6306if(_36a.time.begin){6307this.StartTime=_36a.time.begin;6308}6309if(_36a.time.end){6310this.EndTime=_36a.time.end;6311}6312}6313break;6314case "Reminder":6315case "Anniversary":6316if(_36a.time){6317if(_36a.time.begin){6318this.StartTime=_36a.time.begin;6319}6320}6321break;6322case "ToDo":6323if(_36a.time){6324if(_36a.time.end){6325this.EndTime=_36a.time.end;6326}6327}6328break;6329case "DayEvent":6330if(_36a.time){6331if(_36a.time.begin){6332this.StartTime=_36a.time.begin;6333}6334}6335break;6336default:6337throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: "+str+" Type is Invalid");6338}6339}6340if(_36a.time){6341if(_36a.time.alarm){6342this.AlarmTime=_36a.time.alarm;6343}6344}6345}6346catch(e){6347__device_handle_exception(e,"__sp_calendar_entry: "+e);6348}6349};6350function __sp_calendar_iterator_get_next(){6351var _36c=this.iter.getNext();6352if(typeof _36c=="undefined"){6353return null;6354}6355var _36d=new __sp_device_calendar_entry(_36c);6356_36c.close();6357return _36d;6358};6359function __sp_calendar_iterator(_36e){6360this.iter=_36e;6361this.next=__sp_calendar_iterator_get_next;6362this.close=function(){6363this.iter.close();6364};6365};6366var CALENDAR_APP_ID=268458241;6367function __sp_calendar_startEditor(_36f,_370,_371){6368try{6369if(!_36f){6370throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: startEditor: callback is missing");6371}else{6372if(typeof _36f!="function"){6373throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: startEditor: callback is invalid");6374}6375}6376if(_371){6377if(typeof _371!="function"){6378throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: startEditor: error callback is invalid");6379}6380}6381if(_370!=null){6382throw new DeviceException(this.error.NOT_SUPPORTED_ERR,"Calendar: startEditor: Entry should be null");6383}6384var _372=function(arg1,arg2,arg3){6385var iter=null;6386_36f(iter);6387if(arg2!=event_cancelled){6388var iter=null;6389if(arg3.ReturnValue){6390iter=new __sp_calendar_iterator(arg3.ReturnValue);6391}6392_36f(iter);6393}6394if(arg3.ErrorCode!=0){6395switch(arg3.ErrorCode){6396case this.error.MISSING_ARG_ERR:6397case this.error.INVALID_ARG_ERR:6398case this.error.NOT_SUPPORTED_ERR:6399if(arg3.ErrorMessage){6400var _377=splitErrorMessage(arg3.ErrorMessage);6401throw new DeviceException(MapErrorCode[arg3.ErrorCode],"Calendar: startEditor: "+_377);6402}else{6403throw new DeviceException(MapErrorCode[arg3.ErrorCode],"Calendar: startEditor: Operation Failed");6404}6405break;6406default:6407_371(new DeviceException(MapErrorCode[arg3.ErrorCode],"Calendar: startEditor: Operation Failed"));6408}6409}6410};6411__s60_start_and_wait(CALENDAR_APP_ID,"",_372);6412return 0;6413}6414catch(e){6415__device_handle_exception(e,"__sp_calendar_startEditor: "+e);6416}6417};6418var __sp_calendar_entry_types="MeetingReminderToDoAnniversaryDayEvent";6419function __sp_calendar_getList_cb(arg1,arg2,arg3){6420var _37b;6421var _37c;6422var _37d;6423_37b=glob_obj.getFromArray(arg1);6424if(_37b){6425_37c=_37b.success_cb;6426_37d=_37b.error_cb;6427}else{6428alert("Calendar: __sp_calendar_getList_cb: Callback not found ");6429return;6430}6431if(arg3.ErrorCode!=0){6432_37d(new DeviceException(arg3.ErrorCode,"Calendar: getList: Operation Failed"));6433return;6434}6435if(arg2!=event_cancelled){6436var iter=null;6437if(arg3.ReturnValue){6438iter=new __sp_calendar_iterator(arg3.ReturnValue);6439}6440_37c(iter);6441}6442glob_obj.removeFromArray(arg1);6443};6444function __sp_calendar_getList(_37f,_380,_381){6445try{6446if(_380){6447if(typeof _380!="object"){6448throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");6449}6450if(_380.id){6451dataGetList=1;6452if(typeof _380.id!="string"){6453throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");6454}6455}else{6456dataGetList=0;6457}6458}6459if(!_37f){6460throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: getList: callback is missing");6461}else{6462if(typeof _37f!="function"){6463throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: callback is invalid");6464}6465}6466if(_381){6467if(typeof _381!="function"){6468throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: error callback is invalid");6469}6470if(_381==undefined||_381==null){6471throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: getList: error callback is missing");6472}6473}6474var _382={};6475modifyObjectBaseProp(_382);6476_382.Type="IncludeAll";6477if(_380){6478if(_380.id){6479_382.id=_380.id;6480}6481if((_380.type)&&__sp_calendar_entry_types.match(_380.type)){6482_382.Type=_380.type;6483}else{6484if((_380.type)&&typeof _380.type!="string"){6485throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");6486}6487}6488if(_380.range){6489if(_380.range.begin){6490if(typeof (_380.range.begin)!="object"){6491throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");6492}else{6493if((_380.range.begin)=="Invalid Date"){6494throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");6495}else{6496_382.StartRange=_380.range.begin;6497}6498}6499}6500if(_380.range.end){6501if(typeof (_380.range.end)!="object"){6502throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");6503}else{6504if((_380.range.end)=="Invalid Date"){6505throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");6506}else{6507_382.EndRange=_380.range.end;6508}6509}6510}6511if((_380.range.begin)&&(_380.range.end)){6512if((_380.range.begin)>(_380.range.end)){6513throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");6514}6515}6516}6517if(_380.text){6518if(typeof (_380.text)!="string"){6519throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: getList: match is invalid");6520}else{6521_382.SearchText=_380.text;6522}6523}6524}6525var _383={};6526modifyObjectBaseProp(_383);6527_383.Type="CalendarEntry";6528_383.Filter=_382;6529temp_scb=_37f;6530temp_ecb=_381;6531var rval=this.so.IDataSource.GetList(_383,this.getListCb);6532if(rval.TransactionID){6533glob_obj.addToGlobalArray(rval.TransactionID,_37f,_381);6534}6535if(_383){6536delete _383.Type;6537delete _383.Filter;6538}6539if(rval.ErrorCode!=0){6540switch(rval.ErrorCode){6541case this.error.MISSING_ARG_ERR:6542case this.error.INVALID_ARG_ERR:6543case this.error.NOT_SUPPORTED_ERR:6544if(rval.ErrorMessage){6545var _385=splitErrorMessage(rval.ErrorMessage);6546throw new DeviceException(MapErrorCode[rval.ErrorCode],"Calendar: getList: "+_385);6547}else{6548throw new DeviceException(MapErrorCode[rval.ErrorCode],"Calendar: getList: Operation Failed");6549}6550break;6551default:6552_381(new DeviceException(MapErrorCode[rval.ErrorCode],"Calendar: getList: Operation Failed"));6553}6554}6555return rval.TransactionID;6556}6557catch(e){6558__device_handle_exception(e,"sp_calendar_getList: "+e);6559}6560};6561function __sp_calendar_add(_386){6562if(_386){6563if(typeof _386!="object"){6564throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: addEntry: calendarEntry param is invalid");6565}6566if(_386.id){6567_386.id=undefined;6568}6569if(!_386.type||!_386.time){6570throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: addEntry: mandatory param missing");6571}else{6572if(typeof _386.type!="string"||typeof _386.time!="object"){6573throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: addEntry: mandatory param missing");6574}6575}6576if((_386.type!="ToDo")&&!_386.time.begin){6577throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: addEntry: mandatory param StartTime missing");6578}6579if(!_386.time.end&&(_386.type=="ToDo"||_386.type=="Meeting")){6580throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: addEntry: mandatory param EndTime missing");6581}6582if(_386.time.end&&_386.time.alarm){6583if(_386.time.end<_386.time.alarm){6584throw new DeviceException(this.error.NOT_SUPPORTED_ERR,"Calendar: addEntry: alarm time greater than end time:Not supported");6585}6586}6587if(_386.type=="ToDo"){6588if(_386.status==0){6589if(typeof (_386.status)!="string"){6590throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: addEntry: mandatory param missing");6591}6592}6593}6594if(_386.repeatRule){6595if(typeof _386.repeatRule!="object"){6596throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: addEntry: repeatRule param type is invalid");6597}6598if(!_386.repeatRule.frequency||_386.repeatRule.frequency==null){6599throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: addEntry: mandatory param Frequency missing");6600}6601}6602var _387=__sp_calendar_isInputValid(_386);6603if(!_387){6604throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: addEntry: calendarEntry param is invalid");6605}6606}else{6607throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: addEntry: mandatory param missing");6608}6609try{6610var str="addEntry:";6611var _389={};6612modifyObjectBaseProp(_389);6613_389.Type="CalendarEntry";6614_389.Item=new __sp_calendar_entry(_386,str);6615var _38a=this.so.IDataSource.Add(_389);6616if(_389){6617delete _389.Type;6618delete _389.Item;6619}6620var _38b="Operation Failed";6621if(_38a.ErrorMessage){6622_38b=splitErrorMessage(_38a.ErrorMessage);6623}6624if(_38a.ErrorCode!=0){6625throw new DeviceException(MapErrorCode[_38a.ErrorCode],"Calendar: addEntry: Operation Failed");6626return;6627}else{6628var _38c=_38a.ReturnValue;6629return _38c;6630}6631}6632catch(e){6633__device_handle_exception(e,"__sp_calendar_add: "+e);6634}6635};6636function __sp_calendar_update(_38d){6637isUpdate=1;6638if(_38d){6639if(typeof _38d!="object"){6640throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: updateEntry: calendarEntry param is invalid");6641}6642if(!_38d.id){6643throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: updateEntry: mandatory param - Id missing");6644}6645if(_38d.repeatRule){6646if(typeof _38d.repeatRule!="object"){6647throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: updateEntry: repeatRule param type is invalid");6648}6649if((_38d.repeatRule.frequency==null||_38d.repeatRule.frequency==undefined)){6650throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: updateEntry: repeatRule param type is invalid");6651}6652if(_38d.repeatRule.startDate&&(_38d.repeatRule.startDate==null||_38d.repeatRule.startDate==undefined)){6653throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: updateEntry: repeatRule param type is invalid");6654}6655if(_38d.repeatRule.untilDate&&(_38d.repeatRule.untilDate==null||_38d.repeatRule.untilDate==undefined)){6656throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: updateEntry: repeatRule param type is invalid");6657}6658}6659if(_38d.time){6660if(_38d.time.end&&_38d.time.alarm){6661if(_38d.time.alarm>_38d.time.end){6662throw new DeviceException(this.error.NOT_SUPPORTED_ERR,"Calendar: updateEntry: alarm time greater than end time is not supported");6663}6664}6665}6666var _38e=__sp_calendar_isInputValid(_38d);6667if(!_38e){6668throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: updateEntry: calendarEntry param is invalid");6669}6670}else{6671throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: updateEntry: mandatory param missing");6672}6673try{6674var str="updateEntry:";6675var _390={};6676modifyObjectBaseProp(_390);6677_390.Type="CalendarEntry";6678_390.Item=new __sp_calendar_entry(_38d,str);6679isUpdate=0;6680var _391=this.so.IDataSource.Add(_390);6681if(_390){6682delete _390.Type;6683delete _390.Item;6684}6685var _392="Operation Failed";6686if(_391.ErrorMessage){6687_392=splitErrorMessage(_391.ErrorMessage);6688}6689if(_391.ErrorCode!=0){6690throw new DeviceException(MapErrorCode[_391.ErrorCode],"Calendar: addEntry: Operation Failed");6691return;6692}else{6693var _393=_391.ReturnValue;6694return _393;6695}6696}6697catch(e){6698__device_handle_exception(e,"__sp_calendar_add: "+e);6699}6700};6701function __sp_calendar_delete(data){6702try{6703if(data){6704if(typeof data!="object"){6705throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: deleteEntry: data is invalid");6706}6707if(!data.id){6708throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: deleteEntry: id is missing");6709}6710var _395=__sp_calendar_isInputValid(data);6711if(!_395){6712throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: deleteEntry: delete data is invalid");6713}6714}else{6715throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: deleteEntry: data is missing");6716}6717var _396={};6718modifyObjectBaseProp(_396);6719_396.Type="CalendarEntry";6720_396.Data={};6721modifyObjectBaseProp(_396.Data);6722_396.Data.IdList=[];6723var list=[data.id];6724_396.Data.IdList=list;6725if(data.range){6726if(data.range.begin){6727_396.Data.StartRange=data.range.begin;6728}6729if(data.range.end){6730_396.Data.EndRange=data.range.end;6731}6732}6733var rval=this.so.IDataSource.Delete(_396);6734if(_396){6735delete _396.Type;6736delete _396.Data.IdList;6737delete _396.Data.StartRange;6738delete _396.Data.EndRange;6739}6740if(list){6741delete list.id;6742}6743if(rval.ErrorCode!=0){6744if(rval.ErrorMessage){6745var _399=splitErrorMessage(rval.ErrorMessage);6746throw new DeviceException(MapErrorCode[rval.ErrorCode],"Calendar: deleteEntry: "+_399);6747}else{6748throw new DeviceException(MapErrorCode[rval.ErrorCode],"Calendar: deleteEntry: Operation Failed");6749}6750}6751}6752catch(e){6753__device_handle_exception(e,"__sp_calendar_delete: "+e);6754}6755};6756function __sp_calendar_cancel(_39a){6757try{6758if(!_39a||_39a==null||_39a==undefined){6759throw new DeviceException(this.error.MISSING_ARG_ERR,"Calendar: cancel: id is missing");6760}6761if(_39a){6762if(typeof _39a!="number"){6763throw new DeviceException(this.error.INVALID_ARG_ERR,"Calendar: cancel: id is missing");6764}6765}6766var _39b={};6767modifyObjectBaseProp(_39b);6768_39b.TransactionID=_39a;6769var _39c=this.so.IDataSource.Cancel(_39b);6770if(_39b){6771delete _39b.TransactionID;6772}6773if(_39c.ErrorCode!=0){6774if(_39c.ErrorMessage){6775var _39d=splitErrorMessage(_39c.ErrorMessage);6776throw new DeviceException(MapErrorCode[_39c.ErrorCode],"Calendar: cancel: "+_39d);6777}else{6778throw new DeviceException(MapErrorCode[_39c.ErrorCode],"Calendar: cancel: Operation Failed");6779}6780}6781}6782catch(e){6783__device_handle_exception(e,"__sp_calendar_cancel: "+e);6784}6785};6786function __sp_calendar_instance(){6787this.descriptor=new __sp_calendar_descriptor();6788this.startEditor=__sp_calendar_startEditor;6789this.getList=__sp_calendar_getList;6790this.getListCb=__sp_calendar_getList_cb;6791this.addEntry=__sp_calendar_add;6792this.updateEntry=__sp_calendar_update;6793this.deleteEntry=__sp_calendar_delete;6794this.cancel=__sp_calendar_cancel;6795this.error=new DeviceException(0,"Dummy");6796this.so=null;6797try{6798this.so=device.getServiceObject("Service.Calendar","IDataSource");6799}6800catch(e){6801__device_handle_exception(e,"Calendar service not available");6802}6803};6804function __device_contacts_descriptor(_39e){6805this.interfaceName=_39e.interfaceName;6806this.version=_39e.version;6807};6808function __device_contacts_startEditor(_39f,_3a0,_3a1){6809return this.provider.startEditor(_39f,_3a0,_3a1);6810};6811function __device_contacts_getContacts(_3a2,_3a3,_3a4,_3a5){6812return this.provider.getContacts(_3a2,_3a3,_3a4,_3a5);6813};6814function __device_contacts_add(_3a6){6815return this.provider.addContact(_3a6);6816};6817function __device_contacts_update(_3a7){6818this.provider.updateContact(_3a7);6819};6820function __device_contacts_delete(id){6821this.provider.deleteContacts(id);6822};6823function __device_contacts_getContactInfo(id){6824return this.provider.getContactInfo(id);6825};6826function __device_contacts_addGroup(_3aa){6827return this.provider.addGroup(_3aa);6828};6829function __device_contacts_getGroups(_3ab,_3ac){6830return this.provider.getGroups(_3ab,_3ac);6831};6832function __device_contacts_deleteGroups(id){6833this.provider.deleteGroups(id);6834};6835function __device_contacts_addContactsToGroup(_3ae,id){6836this.provider.addContactsToGroup(_3ae,id);6837};6838function __device_contacts_getContactIds(_3b0,_3b1,_3b2,_3b3){6839return this.provider.getContactIds(_3b0,_3b1,_3b2,_3b3);6840};6841function __device_contacts_getGroupIds(_3b4,_3b5){6842return this.provider.getGroupIds(_3b4,_3b5);6843};6844function __device_contacts_removeContactsFromGroup(_3b6,id){6845this.provider.removeContactsFromGroup(_3b6,id);6846};6847function __device_contacts_cancel(_3b8){6848this.provider.cancel(_3b8);6849};6850function __device_contacts_updateGroup(_3b9){6851this.provider.updateGroup(_3b9);6852};6853function __device_contacts_getGroupInfo(_3ba){6854return this.provider.getGroupInfo(_3ba);6855};6856function __device_contacts(_3bb){6857this.provider=_3bb;6858this.interfaceName=_3bb.descriptor.interfaceName;6859this.version=_3bb.descriptor.version;6860this.SORT_ASCENDING=0;6861this.SORT_DESCENDING=1;6862this.startEditor=__device_contacts_startEditor;6863this.getContacts=__device_contacts_getContacts;6864this.addContact=__device_contacts_add;6865this.updateContact=__device_contacts_update;6866this.deleteContacts=__device_contacts_delete;6867this.getContactInfo=__device_contacts_getContactInfo;6868this.addGroup=__device_contacts_addGroup;6869this.getGroups=__device_contacts_getGroups;6870this.deleteGroups=__device_contacts_deleteGroups;6871this.addContactsToGroup=__device_contacts_addContactsToGroup;6872this.getContactIds=__device_contacts_getContactIds;6873this.getGroupIds=__device_contacts_getGroupIds;6874this.removeContactsFromGroup=__device_contacts_removeContactsFromGroup;6875this.cancel=__device_contacts_cancel;6876this.updateGroup=__device_contacts_updateGroup;6877this.getGroupInfo=__device_contacts_getGroupInfo;6878};6879var __device_contacts_service_entry={"name":null,"version":null,"proto":__device_contacts,"descriptor":__device_contacts_descriptor,"providers":[{"descriptor":__sp_contacts_descriptor,"instance":__sp_contacts_instance}]};6880function __sp_contacts_descriptor(){6881this.interfaceName="contacts";6882if(window.__Service_Interface_Ver){6883this.version=__Service_Interface_Ver;6884}else{6885this.version=1;6886}6887};6888function __s60_enumerate_contact_object(_3bc,_3bd,func,_3bf){6889try{6890var key;6891for(key in _3bc){6892var _3c1;6893if(_3bd){6894_3c1=_3bd+"."+key;6895}else{6896_3c1=key;6897}6898var _3c2=_3bc[key];6899if(_3c2 instanceof Array){6900func(_3c1,_3c2,_3bf);6901}else{6902if(_3c2 instanceof Date){6903func(_3c1,_3c2,_3bf);6904}else{6905if(typeof _3c2=="object"){6906__s60_enumerate_contact_object(_3c2,_3c1,func,_3bf);6907}else{6908func(_3c1,_3c2,_3bf);6909}6910}6911}6912}6913}6914catch(e){6915throw e;6916}6917};6918function __sp_contact_extract(name,_3c4,_3c5){6919switch(name){6920case "name.last":6921_3c5.LastName={};6922modifyObjectBaseProp(_3c5.LastName);6923_3c5.LastName.Label="Last name";6924_3c5.LastName.Value=_3c4;6925break;6926case "name.first":6927_3c5.FirstName={};6928modifyObjectBaseProp(_3c5.FirstName);6929_3c5.FirstName.Label="First name";6930_3c5.FirstName.Value=_3c4;6931break;6932case "name.middle":6933_3c5.MiddleName={};6934modifyObjectBaseProp(_3c5.MiddleName);6935_3c5.MiddleName.Label="Middle name";6936_3c5.MiddleName.Value=_3c4;6937break;6938case "name.prefix":6939_3c5.Prefix={};6940modifyObjectBaseProp(_3c5.Prefix);6941_3c5.Prefix.Label="Prefix";6942_3c5.Prefix.Value=_3c4;6943break;6944case "name.suffix":6945_3c5.Suffix={};6946modifyObjectBaseProp(_3c5.Suffix);6947_3c5.Suffix.Label="Suffix";6948_3c5.Suffix.Value=_3c4;6949break;6950case "tel.land":6951_3c5.LandPhoneGen={};6952modifyObjectBaseProp(_3c5.LandPhoneGen);6953_3c5.LandPhoneGen.Label="Landline";6954_3c5.LandPhoneGen.Value=_3c4;6955break;6956case "tel.mobile":6957_3c5.MobilePhoneGen={};6958modifyObjectBaseProp(_3c5.MobilePhoneGen);6959_3c5.MobilePhoneGen.Label="Mobile";6960_3c5.MobilePhoneGen.Value=_3c4;6961break;6962case "tel.video":6963_3c5.VideoNumberGen={};6964modifyObjectBaseProp(_3c5.VideoNumberGen);6965_3c5.VideoNumberGen.Label="Video";6966_3c5.VideoNumberGen.Value=_3c4;6967break;6968case "tel.fax":6969_3c5.FaxNumberGen={};6970modifyObjectBaseProp(_3c5.FaxNumberGen);6971_3c5.FaxNumberGen.Label="Fax";6972_3c5.FaxNumberGen.Value=_3c4;6973break;6974case "tel.voip":6975_3c5.VOIPGen={};6976modifyObjectBaseProp(_3c5.VOIPGen);6977_3c5.VOIPGen.Label="Voip";6978_3c5.VOIPGen.Value=_3c4;6979break;6980case "tel.home.land":6981_3c5.LandPhoneHome={};6982modifyObjectBaseProp(_3c5.LandPhoneHome);6983_3c5.LandPhoneHome.Label="Home Landline";6984_3c5.LandPhoneHome.Value=_3c4;6985break;6986case "tel.home.mobile":6987_3c5.MobilePhoneHome={};6988modifyObjectBaseProp(_3c5.MobilePhoneHome);6989_3c5.MobilePhoneHome.Label="Home Mobile";6990_3c5.MobilePhoneHome.Value=_3c4;6991break;6992case "tel.home.video":6993_3c5.VideoNumberHome={};6994modifyObjectBaseProp(_3c5.VideoNumberHome);6995_3c5.VideoNumberHome.Label="Home Video";6996_3c5.VideoNumberHome.Value=_3c4;6997break;6998case "tel.home.fax":6999_3c5.FaxNumberHome={};7000modifyObjectBaseProp(_3c5.FaxNumberHome);7001_3c5.FaxNumberHome.Label="Home Fax";7002_3c5.FaxNumberHome.Value=_3c4;7003break;7004case "tel.home.voip":7005_3c5.VoipHome={};7006modifyObjectBaseProp(_3c5.VoipHome);7007_3c5.VoipHome.Label="Home Voip";7008_3c5.VoipHome.Value=_3c4;7009break;7010case "tel.work.land":7011_3c5.LandPhoneWork={};7012modifyObjectBaseProp(_3c5.LandPhoneWork);7013_3c5.LandPhoneWork.Label="Work Landline";7014_3c5.LandPhoneWork.Value=_3c4;7015break;7016case "tel.work.mobile":7017_3c5.MobilePhoneWork={};7018modifyObjectBaseProp(_3c5.MobilePhoneWork);7019_3c5.MobilePhoneWork.Label="Work Mobile";7020_3c5.MobilePhoneWork.Value=_3c4;7021break;7022case "tel.work.video":7023_3c5.VideoNumberWork={};7024modifyObjectBaseProp(_3c5.VideoNumberWork);7025_3c5.VideoNumberWork.Label="Work Video";7026_3c5.VideoNumberWork.Value=_3c4;7027break;7028case "tel.work.fax":7029_3c5.FaxNumberWork={};7030modifyObjectBaseProp(_3c5.FaxNumberWork);7031_3c5.FaxNumberWork.Label="Work Fax";7032_3c5.FaxNumberWork.Value=_3c4;7033break;7034case "tel.work.voip":7035_3c5.VoipWork={};7036modifyObjectBaseProp(_3c5.VoipWork);7037_3c5.VoipWork.Label="Work Voip";7038_3c5.VoipWork.Value=_3c4;7039break;7040case "address.street":7041_3c5.AddrStreetGen={};7042modifyObjectBaseProp(_3c5.AddrStreetGen);7043_3c5.AddrStreetGen.Label="Street Address";7044_3c5.AddrStreetGen.Value=_3c4;7045break;7046case "address.local":7047_3c5.AddrLocalGen={};7048modifyObjectBaseProp(_3c5.AddrLocalGen);7049_3c5.AddrLocalGen.Label="City";7050_3c5.AddrLocalGen.Value=_3c4;7051break;7052case "address.region":7053_3c5.AddrRegionGen={};7054modifyObjectBaseProp(_3c5.AddrRegionGen);7055_3c5.AddrRegionGen.Label="State/Province";7056_3c5.AddrRegionGen.Value=_3c4;7057break;7058case "address.code":7059_3c5.AddrPostCodeGen={};7060modifyObjectBaseProp(_3c5.AddrPostCodeGen);7061_3c5.AddrPostCodeGen.Label="Postal code";7062_3c5.AddrPostCodeGen.Value=_3c4;7063break;7064case "address.country":7065_3c5.AddrCountryGen={};7066modifyObjectBaseProp(_3c5.AddrCountryGen);7067_3c5.AddrCountryGen.Label="Country";7068_3c5.AddrCountryGen.Value=_3c4;7069break;7070case "address.email":7071_3c5.EmailGen={};7072modifyObjectBaseProp(_3c5.EmailGen);7073_3c5.EmailGen.Label="EMail";7074_3c5.EmailGen.Value=_3c4;7075break;7076case "address.uri":7077_3c5.URLGen={};7078modifyObjectBaseProp(_3c5.URLGen);7079_3c5.URLGen.Label="Website";7080_3c5.URLGen.Value=_3c4;7081break;7082case "address.home.street":7083_3c5.AddrStreetHome={};7084modifyObjectBaseProp(_3c5.AddrStreetHome);7085_3c5.AddrStreetHome.Label="Home Address";7086_3c5.AddrStreetHome.Value=_3c4;7087break;7088case "address.home.local":7089_3c5.AddrLocalHome={};7090modifyObjectBaseProp(_3c5.AddrLocalHome);7091_3c5.AddrLocalHome.Label="City";7092_3c5.AddrLocalHome.Value=_3c4;7093break;7094case "address.home.region":7095_3c5.AddrRegionHome={};7096modifyObjectBaseProp(_3c5.AddrRegionHome);7097_3c5.AddrRegionHome.Label="State/Province";7098_3c5.AddrRegionHome.Value=_3c4;7099break;7100case "address.home.code":7101_3c5.AddrPostCodeHome={};7102modifyObjectBaseProp(_3c5.AddrPostCodeHome);7103_3c5.AddrPostCodeHome.Label="Postal code";7104_3c5.AddrPostCodeHome.Value=_3c4;7105break;7106case "address.home.country":7107_3c5.AddrCountryHome={};7108modifyObjectBaseProp(_3c5.AddrCountryHome);7109_3c5.AddrCountryHome.Label="Country";7110_3c5.AddrCountryHome.Value=_3c4;7111break;7112case "address.home.email":7113_3c5.EmailHome={};7114modifyObjectBaseProp(_3c5.EmailHome);7115_3c5.EmailHome.Label="Home EMail";7116_3c5.EmailHome.Value=_3c4;7117break;7118case "address.home.uri":7119_3c5.URLHome={};7120modifyObjectBaseProp(_3c5.URLHome);7121_3c5.URLHome.Label="Home Website";7122_3c5.URLHome.Value=_3c4;7123break;7124case "address.work.street":7125_3c5.AddrStreetWork={};7126modifyObjectBaseProp(_3c5.AddrStreetWork);7127_3c5.AddrStreetWork.Label="Work Address";7128_3c5.AddrStreetWork.Value=_3c4;7129break;7130case "address.work.local":7131_3c5.AddrLocalWork={};7132modifyObjectBaseProp(_3c5.AddrLocalWork);7133_3c5.AddrLocalWork.Label="City";7134_3c5.AddrLocalWork.Value=_3c4;7135break;7136case "address.work.region":7137_3c5.AddrRegionWork={};7138modifyObjectBaseProp(_3c5.AddrRegionWork);7139_3c5.AddrRegionWork.Label="State/Province";7140_3c5.AddrRegionWork.Value=_3c4;7141break;7142case "address.work.code":7143_3c5.AddrPostCodeWork={};7144modifyObjectBaseProp(_3c5.AddrPostCodeWork);7145_3c5.AddrPostCodeWork.Label="Postal code";7146_3c5.AddrPostCodeWork.Value=_3c4;7147break;7148case "address.work.country":7149_3c5.AddrCountryWork={};7150modifyObjectBaseProp(_3c5.AddrCountryWork);7151_3c5.AddrCountryWork.Label="Country";7152_3c5.AddrCountryWork.Value=_3c4;7153break;7154case "address.work.email":7155_3c5.EmailWork={};7156modifyObjectBaseProp(_3c5.EmailWork);7157_3c5.EmailWork.Label="Work EMail";7158_3c5.EmailWork.Value=_3c4;7159break;7160case "address.work.uri":7161_3c5.URLWork={};7162modifyObjectBaseProp(_3c5.URLWork);7163_3c5.URLWork.Label="Work Website";7164_3c5.URLWork.Value=_3c4;7165break;7166case "company.name":7167_3c5.CompanyName={};7168modifyObjectBaseProp(_3c5.CompanyName);7169_3c5.CompanyName.Label="Company";7170_3c5.CompanyName.Value=_3c4;7171break;7172case "company.title":7173_3c5.JobTitle={};7174modifyObjectBaseProp(_3c5.JobTitle);7175_3c5.JobTitle.Label="Title";7176_3c5.JobTitle.Value=_3c4;7177break;7178case "id":7179_3c5.id=_3c4;7180break;7181case "notes":7182_3c5.Note={};7183modifyObjectBaseProp(_3c5.Note);7184_3c5.Note.Label="Note";7185_3c5.Note.Value=_3c4;7186break;7187case "anniversary":7188_3c5.Anniversary={};7189modifyObjectBaseProp(_3c5.Anniversary);7190_3c5.Anniversary.Label="Anniversary";7191_3c5.Anniversary.Value=_3c4;7192break;7193case "birthday":7194_3c5.Date={};7195modifyObjectBaseProp(_3c5.Date);7196_3c5.Date.Label="BirthDay";7197_3c5.Date.Value=_3c4;7198break;7199case "nickName":7200_3c5.SecondName={};7201modifyObjectBaseProp(_3c5.SecondName);7202_3c5.SecondName.Label="NickName";7203_3c5.SecondName.Value=_3c4;7204break;7205case "photo":7206_3c5.CallerObjImg={};7207modifyObjectBaseProp(_3c5.CallerObjImg);7208_3c5.CallerObjImg.Label="CallerObjImg";7209_3c5.CallerObjImg.Value=_3c4;7210break;7211case "xspid":7212_3c5.IMPP={};7213modifyObjectBaseProp(_3c5.IMPP);7214_3c5.IMPP.Label="IMPP";7215_3c5.IMPP.Value=_3c4;7216break;7217}7218};7219function __s60_enumerate_build_contact_object(_3c6,_3c7,func,_3c9){7220var key;7221for(key in _3c6){7222var _3cb;7223if(_3c7){7224_3cb=_3c7+"."+key;7225}else{7226_3cb=key;7227}7228var _3cc=_3c6[key];7229if(_3cb=="IMPP"){7230func(_3cb,_3cc,_3c9);7231}7232if(typeof _3cc=="object"){7233__s60_enumerate_build_contact_object(_3cc,_3cb,func,_3c9);7234}else{7235func(_3cb,_3cc,_3c9);7236}7237}7238};7239function __sp_device_contact_extract(name,_3ce,_3cf){7240if(name=="id"){7241_3cf.id=_3ce;7242return;7243}7244if(!name.match(".Value")){7245return;7246}7247try{7248if(name.match("IMPP.Value.0")){7249_3cf.xspid=[];7250}7251if(name.match("Name")){7252if(name.match("CompanyName")){7253if(!_3cf.company){7254_3cf.company={};7255}7256}else{7257if(!_3cf.name){7258_3cf.name={};7259}7260}7261}else{7262if(name.match("Phone")||name.match("Number")||name.match("VOIP")||name.match("Voip")){7263if(!_3cf.tel){7264_3cf.tel={};7265}7266if(name.match("Home")){7267if(!_3cf.tel.home){7268_3cf.tel.home={};7269}7270}else{7271if(name.match("Work")){7272if(!_3cf.tel.work){7273_3cf.tel.work={};7274}7275}7276}7277}else{7278if(name.match("Addr")||name.match("Email")||name.match("URL")){7279if(!_3cf.address){7280_3cf.address={};7281}7282if(name.match("Home")){7283if(!_3cf.address.home){7284_3cf.address.home={};7285}7286}else{7287if(name.match("Work")){7288if(!_3cf.address.work){7289_3cf.address.work={};7290}7291}7292}7293}else{7294if(name.match("JobTitle")){7295if(!_3cf.company){7296_3cf.company={};7297}7298}7299}7300}7301}7302}7303catch(e){7304__device_handle_exception(e,"__sp_device_contact_extract: "+e);7305}7306if(name.match("IMPP.Value")){7307var _3d0=name.split(".");7308var _3d1=_3d0[2];7309if(_3d1!=undefined){7310_3cf.xspid[_3d0[2]]=_3ce;7311return;7312}7313}7314switch(name){7315case "LastName.Value":7316_3cf.name.last=_3ce;7317break;7318case "FirstName.Value":7319_3cf.name.first=_3ce;7320break;7321case "MiddleName.Value":7322_3cf.name.middle=_3ce;7323break;7324case "Prefix.Value":7325_3cf.name.prefix=_3ce;7326break;7327case "Suffix.Value":7328_3cf.name.suffix=_3ce;7329break;7330case "LandPhoneGen.Value":7331_3cf.tel.land=_3ce;7332break;7333case "MobilePhoneGen.Value":7334_3cf.tel.mobile=_3ce;7335break;7336case "VideoNumberGen.Value":7337_3cf.tel.video=_3ce;7338break;7339case "FaxNumberGen.Value":7340_3cf.tel.fax=_3ce;7341break;7342case "VOIPGen.Value":7343_3cf.tel.voip=_3ce;7344break;7345case "LandPhoneHome.Value":7346_3cf.tel.home.land=_3ce;7347break;7348case "MobilePhoneHome.Value":7349_3cf.tel.home.mobile=_3ce;7350break;7351case "VideoNumberHome.Value":7352_3cf.tel.home.video=_3ce;7353break;7354case "FaxNumberHome.Value":7355_3cf.tel.home.fax=_3ce;7356break;7357case "VoipHome.Value":7358_3cf.tel.home.voip=_3ce;7359break;7360case "LandPhoneWork.Value":7361_3cf.tel.work.land=_3ce;7362break;7363case "MobilePhoneWork.Value":7364_3cf.tel.work.mobile=_3ce;7365break;7366case "VideoNumberWork.Value":7367_3cf.tel.work.video=_3ce;7368break;7369case "FaxNumberWork.Value":7370_3cf.tel.work.fax=_3ce;7371break;7372case "VoipWork.Value":7373_3cf.tel.work.voip=_3ce;7374break;7375case "AddrStreetGen.Value":7376_3cf.address.street=_3ce;7377break;7378case "AddrLocalGen.Value":7379_3cf.address.local=_3ce;7380break;7381case "AddrRegionGen.Value":7382_3cf.address.region=_3ce;7383break;7384case "AddrPostCodeGen.Value":7385_3cf.address.code=_3ce;7386break;7387case "AddrCountryGen.Value":7388_3cf.address.country=_3ce;7389break;7390case "EmailGen.Value":7391_3cf.address.email=_3ce;7392break;7393case "URLGen.Value":7394_3cf.address.uri=_3ce;7395break;7396case "AddrStreetHome.Value":7397_3cf.address.home.street=_3ce;7398break;7399case "AddrLocalHome.Value":7400_3cf.address.home.local=_3ce;7401break;7402case "AddrRegionHome.Value":7403_3cf.address.home.region=_3ce;7404break;7405case "AddrPostCodeHome.Value":7406_3cf.address.home.code=_3ce;7407break;7408case "AddrCountryHome.Value":7409_3cf.address.home.country=_3ce;7410break;7411case "EmailHome.Value":7412_3cf.address.home.email=_3ce;7413break;7414case "URLHome.Value":7415_3cf.address.home.uri=_3ce;7416break;7417case "AddrStreetWork.Value":7418_3cf.address.work.street=_3ce;7419break;7420case "AddrLocalWork.Value":7421_3cf.address.work.local=_3ce;7422break;7423case "AddrRegionWork.Value":7424_3cf.address.work.region=_3ce;7425break;7426case "AddrPostCodeWork.Value":7427_3cf.address.work.code=_3ce;7428break;7429case "AddrCountryWork.Value":7430_3cf.address.work.country=_3ce;7431break;7432case "EmailWork.Value":7433_3cf.address.work.email=_3ce;7434break;7435case "URLWork.Value":7436_3cf.address.work.uri=_3ce;7437break;7438case "CompanyName.Value":7439_3cf.company.name=_3ce;7440break;7441case "JobTitle.Value":7442_3cf.company.title=_3ce;7443break;7444case "Note.Value":7445_3cf.notes=_3ce;7446break;7447case "Anniversary.Value":7448_3cf.anniversary=_3ce;7449break;7450case "Date.Value":7451_3cf.birthday=_3ce;7452break;7453case "SecondName.Value":7454_3cf.nickName=_3ce;7455break;7456case "CallerObjImg.Value":7457_3cf.photo=_3ce;7458break;7459default:7460}7461};7462function __sp_device_contact_build(_3d2,_3d3){7463__s60_enumerate_build_contact_object(_3d2,null,__sp_device_contact_extract,_3d3);7464};7465function __sp_contact_iterator_get_next(){7466var _3d4=this.iter.getNext();7467if(typeof _3d4=="undefined"){7468return null;7469}7470var rval={};7471__sp_device_contact_build(_3d4,rval);7472_3d4.close();7473return rval;7474};7475function __sp_contact_iterator(_3d6){7476this.iter=_3d6;7477this.next=__sp_contact_iterator_get_next;7478this.close=function(){7479this.iter.close();7480};7481};7482function __s60_enumerate_group_object(_3d7,func,_3d9){7483var key;7484for(key in _3d7){7485var _3db=key;7486var _3dc=_3d7[key];7487func(_3db,_3dc,_3d9);7488}7489};7490function __sp_device_groupinfo_extract(name,_3de,_3df){7491if(_3df.group==undefined){7492_3df.group={};7493}7494if(name=="id"){7495_3df.group.groupId=_3de;7496}else{7497if(name=="GroupLabel"){7498_3df.group.groupName=_3de;7499}else{7500if(name=="Contents"){7501_3df.contents=_3de;7502}7503}7504}7505return;7506};7507function __sp_device_groupinfo_build(_3e0,_3e1){7508__s60_enumerate_group_object(_3e0,__sp_device_groupinfo_extract,_3e1);7509};7510function __sp_groupinfo_iterator_get_next(){7511var _3e2=this.iter.getNext();7512if(typeof _3e2=="undefined"){7513return null;7514}7515var rval={};7516__sp_device_groupinfo_build(_3e2,rval);7517_3e2.close();7518return rval;7519};7520function __sp_groupinfo_iterator(_3e4){7521this.iter=_3e4;7522this.next=__sp_groupinfo_iterator_get_next;7523this.close=function(){7524this.iter.close();7525};7526};7527function __sp_device_group_extract(name,_3e6,_3e7){7528if(name=="id"){7529_3e7.groupId=_3e6;7530return;7531}7532if(name=="GroupLabel"){7533_3e7.groupName=_3e6;7534return;7535}7536};7537function __sp_device_group_build(_3e8,_3e9){7538__s60_enumerate_object(_3e8,null,__sp_device_group_extract,_3e9);7539};7540function __sp_group_iterator_get_next(){7541var _3ea=this.iter.getNext();7542if(typeof _3ea=="undefined"){7543return null;7544}7545var rval={};7546__sp_device_group_build(_3ea,rval);7547_3ea.close();7548return rval;7549};7550function __sp_group_iterator(_3ec){7551this.iter=_3ec;7552this.next=__sp_group_iterator_get_next;7553this.close=function(){7554this.iter.close();7555};7556};7557var CONTACTS_APP_ID=270486734;7558function __sp_contacts_startEditor(_3ed,_3ee,_3ef){7559if(!_3ed){7560throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: StartEditor:Missing Success Callback");7561}7562if((typeof _3ed)!="function"){7563throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: StartEditor:Invalid Success Callback");7564}7565if((_3ee)==null){7566_3ee={};7567}7568if((typeof _3ee)=="undefined"){7569_3ee={};7570}7571if((_3ee)==undefined){7572_3ee={};7573}7574if((typeof _3ee)!="object"){7575throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: StartEditor:Invalid Contact Data");7576}7577if(_3ef){7578if((typeof _3ef)!="function"){7579throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts :StartEditor:Invalid Error Callback");7580}7581}7582var _3f0=function(arg1,arg2,arg3){7583var iter=null;7584_3ed(iter);7585};7586__s60_start_and_wait(CONTACTS_APP_ID,"",_3f0);7587return 0;7588};7589function __sp_contacts_getContacts_cb(arg1,arg2,arg3){7590var iter=null;7591var _3f9;7592var _3fa;7593var _3fb;7594_3fb=glob_obj.getFromArray(arg1);7595if(_3fb){7596_3f9=_3fb.success_cb;7597_3fa=_3fb.error_cb;7598}else{7599alert("Contacts: __sp_contacts_getContacts_cb : Callback not found ");7600return;7601}7602if(arg3.ReturnValue){7603iter=new __sp_contact_iterator(arg3.ReturnValue);7604}else{7605if(arg3.ErrorCode!=0){7606var _3fc;7607if(arg3.ErrorMessage){7608_3fc=splitErrorMessage(arg3.ErrorMessage);7609}else{7610_3fc="Operation Failed";7611}7612_3fa(new DeviceException(MapErrorCode[arg3.ErrorCode],"Contacts: getContacts: "+_3fc));7613return;7614}7615}7616_3f9(iter);7617glob_obj.removeFromArray(arg1);7618};7619function __sp_contacts_getContacts(_3fd,_3fe,_3ff,_400){7620var _401={};7621modifyObjectBaseProp(_401);7622_401.Type="Contact";7623if(_3fe){7624_401.Filter={};7625modifyObjectBaseProp(_401.Filter);7626_401.Filter.SearchVal=_3fe;7627}7628if(_3ff!=null&&_3ff!=undefined){7629_401.Sort={};7630modifyObjectBaseProp(_401.Sort);7631if(typeof _3ff=="number"){7632if(_3ff==this.SORT_ASCENDING){7633_401.Sort.Order="Ascending";7634}else{7635if(_3ff==this.SORT_DESCENDING){7636_401.Sort.Order="Descending";7637}else{7638_400(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Contacts: getContacts: invalid sortOrder input"));7639return;7640}7641}7642}else{7643throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getContacts: invalid sortOrder input");7644}7645}7646try{7647if(!_3fd){7648throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: getContacts: callback is missing");7649}else{7650if(typeof _3fd!="function"){7651throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getContacts: callback is invalid");7652}7653}7654if(_400){7655if(typeof (_400)!="function"){7656throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getContacts: ErrorCallback is invalid");7657}7658}7659temp_scb=_3fd;7660temp_ecb=_400;7661var rval=this.so.IDataSource.GetList(_401,this.getContactsCb);7662if(rval.TransactionID){7663glob_obj.addToGlobalArray(rval.TransactionID,_3fd,_400);7664}7665if(_401.Sort){7666delete _401.Sort.Order;7667}7668if(_401.Filter){7669delete _401.Filter.SearchVal;7670}7671if(_401){7672delete _401.Type;7673delete _401.Filter;7674delete _401.Sort;7675}7676if(rval.ErrorCode!=0){7677var _403=mappingVerification(rval.ErrorCode);7678var _404=null;7679if(rval.ErrorMessage){7680_404=splitErrorMessage(rval.ErrorMessage);7681}7682if(_403){7683switch(MapErrorCode[rval.ErrorCode]){7684case this.error.MISSING_ARG_ERR:7685case this.error.INVALID_ARG_ERR:7686case this.error.NOT_SUPPORTED_ERR:7687if(_404){7688throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContacts: "+_404);7689}else{7690throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContacts:Operation Failed");7691}7692break;7693default:7694if(_400!=undefined){7695if(_404){7696_400(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContacts: "+_404));7697}else{7698_400(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContacts:Operation Failed "));7699}7700}else{7701if(_404){7702throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContacts: "+_404);7703}else{7704throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContacts:Operation Failed");7705}7706}7707}7708}else{7709if(_400!=undefined){7710if(_404){7711_400(new DeviceException(rval.ErrorCode,"Contacts: getContacts: "+_404));7712}else{7713_400(new DeviceException(rval.ErrorCode,"getContacts:Operation Failed "));7714}7715}else{7716if(_404){7717throw new DeviceException(rval.ErrorCode,"Contacts: getContacts: "+_404);7718}else{7719throw new DeviceException(rval.ErrorCode,"Contacts: getContacts:Operation Failed");7720}7721}7722}7723}7724return rval.TransactionID;7725}7726catch(e){7727__device_handle_exception(e,"__sp_contacts_getContacts: "+e);7728}7729};7730function __sp_contacts_add(_405){7731if((_405)==null){7732throw new DeviceException(this.error.MISSING_ARG_ERR,"addContact:Contact Data Needed");7733}7734if((typeof _405)=="undefined"){7735throw new DeviceException(this.error.MISSING_ARG_ERR,"addContact:Contact Data Needed");7736}7737if((_405)==undefined){7738throw new DeviceException(this.error.MISSING_ARG_ERR,"addContact:Contact Data Needed");7739}7740if((typeof _405)!="object"){7741throw new DeviceException(this.error.INVALID_ARG_ERR,"addContact:Invalid Contact Data");7742}7743var _406={};7744modifyObjectBaseProp(_406);7745__s60_enumerate_contact_object(_405,null,__sp_contact_extract,_406);7746var _407={};7747modifyObjectBaseProp(_407);7748_407.Type="Contact";7749_407.Data=_406;7750try{7751if(_406.id){7752throw new DeviceException(this.error.NOT_SUPPORTED_ERR,"Contacts: addContact: Id Not Supported");7753}7754var _408=this.so.IDataSource.Add(_407);7755if(_406){7756delete _406.id;7757}7758if(_407){7759delete _407.Type;7760delete _407.Data;7761}7762var _409=_408["ReturnValue"];7763if(_408.ErrorCode!=0){7764var _40a=mappingVerification(_408.ErrorCode);7765if(_408.ErrorMessage){7766var _40b=splitErrorMessage(_408.ErrorMessage);7767if(_40a){7768throw new DeviceException(MapErrorCode[_408.ErrorCode],"Contacts: addContact: "+_40b);7769}else{7770throw new DeviceException(_408.ErrorCode,"Contacts: addContact: "+_40b);7771}7772}else{7773if(_40a){7774throw new DeviceException(MapErrorCode[_408.ErrorCode],"Contacts: addContact: Operation Failed");7775}else{7776throw new DeviceException(_408.ErrorCode,"Contacts: addContact: Operation Failed");7777}7778}7779}7780return _409;7781}7782catch(e){7783__device_handle_exception(e,"__sp_contacts_addContact: "+e);7784}7785};7786function __sp_contacts_update(_40c){7787try{7788if(!(_40c&&_40c.id)){7789throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: updateContact: contact is missing");7790}7791var _40d={};7792modifyObjectBaseProp(_40d);7793__s60_enumerate_contact_object(_40c,null,__sp_contact_extract,_40d);7794if(_40d.id==undefined){7795throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: updateContact: Invalid id type");7796}7797if(typeof _40d.id!="string"){7798throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: updateContact: Invalid id type");7799}7800var _40e={};7801modifyObjectBaseProp(_40e);7802_40e.Type="Contact";7803_40e.Data=_40d;7804var _40f=this.so.IDataSource.Add(_40e);7805if(_40d){7806delete _40d.id;7807}7808if(_40e){7809delete _40e.Type;7810delete _40e.Data;7811}7812if(_40f.ErrorCode!=0){7813var _410=mappingVerification(_40f.ErrorCode);7814if(_40f.ErrorMessage){7815var _411=splitErrorMessage(_40f.ErrorMessage);7816if(_410){7817throw new DeviceException(MapErrorCode[_40f.ErrorCode],"Contacts: updateContact: "+_411);7818}else{7819throw new DeviceException(_40f.ErrorCode,"Contacts: updateContact: "+_411);7820}7821}else{7822if(_410){7823throw new DeviceException(MapErrorCode[_40f.ErrorCode],"Contacts: updateContact: Operation Failed");7824}else{7825throw new DeviceException(_40f.ErrorCode,"Contacts: updateContact: Operation Failed");7826}7827}7828}7829}7830catch(e){7831__device_handle_exception(e,"__sp_contacts_updateContact: "+e);7832}7833};7834function __sp_contacts_delete(id){7835__device_debug("sp_contacts_delete id: "+id);7836var _413={};7837modifyObjectBaseProp(_413);7838if(id==undefined){7839throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: deleteContacts: idlist is missing");7840}7841if(typeof id=="object"){7842_413.IdList=id;7843}else{7844_413.IdList=[];7845_413.IdList[0]=id;7846}7847var _414={};7848modifyObjectBaseProp(_414);7849_414.Type="Contact";7850_414.Data=_413;7851try{7852var _415=this.so.IDataSource.Delete(_414);7853if(_413){7854delete _413.IdList;7855}7856if(_414){7857delete _414.Type;7858delete _414.Data;7859}7860if(_415.ErrorCode!=0){7861var _416=mappingVerification(_415.ErrorCode);7862if(_415.ErrorMessage){7863var _417=splitErrorMessage(_415.ErrorMessage);7864if(_416){7865throw new DeviceException(MapErrorCode[_415.ErrorCode],"Contacts: deleteContacts: "+_417);7866}else{7867throw new DeviceException(_415.ErrorCode,"Contacts: deleteContacts: "+_417);7868}7869}else{7870if(_416){7871throw new DeviceException(MapErrorCode[_415.ErrorCode],"Contacts: deleteContacts: Operation Failed");7872}else{7873throw new DeviceException(_415.ErrorCode,"Contacts: deleteContacts: Operation Failed");7874}7875}7876}7877}7878catch(e){7879__device_handle_exception(e,"__sp_contacts_deleteContacts: "+e);7880}7881};7882function __sp_contacts_get(id){7883var _419={};7884modifyObjectBaseProp(_419);7885_419.Type="Contact";7886if(id==null){7887throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: getContactInfo: id should not be null");7888}7889if(typeof id!="string"){7890throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getContactInfo: id should be string");7891}7892_419.Filter={};7893modifyObjectBaseProp(_419.Filter);7894_419.Filter.id=id;7895try{7896var rval=this.so.IDataSource.GetList(_419);7897if(_419.Filter){7898delete _419.Filter.id;7899}7900if(_419){7901delete _419.Type;7902delete _419.Filter;7903}7904if(rval){7905if(rval.ErrorCode!=0){7906var _41b=mappingVerification(rval.ErrorCode);7907if(rval.ErrorMessage){7908var _41c=splitErrorMessage(rval.ErrorMessage);7909if(_41b){7910throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactInfo: "+_41c);7911}else{7912throw new DeviceException(rval.ErrorCode,"Contacts: getContactInfo: "+_41c);7913}7914}else{7915if(_41b){7916throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactInfo: Operation Failed");7917}else{7918throw new DeviceException(rval.ErrorCode,"Contacts: getContactInfo: Operation Failed");7919}7920}7921}7922var _41d={};7923modifyObjectBaseProp(_41d);7924var _41e=rval.ReturnValue.getNext();7925__sp_device_contact_build(_41e,_41d);7926return _41d;7927}7928}7929catch(e){7930__device_handle_exception(e,"__sp_contacts_getContactInfo:"+e);7931}7932};7933function __sp_contacts_addGroup(_41f){7934var _420={};7935modifyObjectBaseProp(_420);7936_420.GroupLabel=_41f;7937if(typeof (_420.GroupLabel)==null){7938throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: addGroups: callback is missing");7939}7940if((typeof _420.GroupLabel)=="undefined"){7941throw new DeviceException(this.error.MISSING_ARG_ERR,"addGroup:Group Data Needed");7942}7943if((_420.GroupLabel)==undefined){7944throw new DeviceException(this.error.MISSING_ARG_ERR,"addGroup:Group Data Needed");7945}7946var _421={};7947modifyObjectBaseProp(_421);7948_421.Type="Group";7949_421.Data=_420;7950try{7951var _422=this.so.IDataSource.Add(_421);7952if(_420){7953delete _420.GroupLabel;7954}7955if(_421){7956delete _421.Type;7957delete _421.Data;7958}7959var _423=_422["ReturnValue"];7960if(_422.ErrorCode!=0){7961var _424=mappingVerification(_422.ErrorCode);7962if(_422.ErrorMessage){7963var _425=splitErrorMessage(_422.ErrorMessage);7964if(_424){7965throw new DeviceException(MapErrorCode[_422.ErrorCode],"Contacts: addGroup: "+_425);7966}else{7967throw new DeviceException(_425,_422.ErrorCode,"Contacts: addGroup: Operation Failed ");7968}7969}else{7970if(_424){7971throw new DeviceException(MapErrorCode[_422.ErrorCode],"Contacts: addGroup: Operation Failed");7972}else{7973throw new DeviceException(_422.ErrorCode,"Contacts: addGroup: Operation Failed");7974}7975}7976}7977return _423;7978}7979catch(e){7980__device_handle_exception(e,"__sp_contacts_addGroup: "+e);7981}7982};7983function __sp_contacts_getGroups_cb(arg1,arg2,arg3){7984var iter=null;7985var _42a;7986var _42b;7987var _42c;7988_42c=glob_obj.getFromArray(arg1);7989if(_42c){7990_42a=_42c.success_cb;7991_42b=_42c.error_cb;7992}else{7993return;7994}7995iter=arg3.ReturnValue;7996if(arg3.ReturnValue){7997iter=new __sp_groupinfo_iterator(arg3.ReturnValue);7998}else{7999if(arg3.ErrorCode!=0){8000var _42d;8001if(arg3.ErrorMessage){8002_42d=splitErrorMessage(arg3.ErrorMessage);8003}else{8004_42d="Operation Failed";8005}8006_42b(new DeviceException(_42d,MapErrorCode[arg3.ErrorCode],"Contacts: getGroups:"));8007return;8008}8009}8010_42a(iter);8011glob_obj.removeFromArray(arg1);8012};8013function __sp_contacts_getGroups(_42e,_42f){8014var _430={};8015modifyObjectBaseProp(_430);8016_430.Type="Group";8017try{8018if(!_42e){8019throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: getGroups: callback is missing");8020}else{8021if(typeof _42e!="function"){8022throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getGroups: callback is invalid");8023}8024}8025if(_42f){8026if(typeof (_42f)!="function"){8027throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getGroups: ErrorCallback is invalid");8028}8029}8030temp_scb=_42e;8031temp_ecb=_42f;8032var rval=this.so.IDataSource.GetList(_430,this.getGroupsCb);8033if(rval.TransactionID){8034glob_obj.addToGlobalArray(rval.TransactionID,_42e,_42f);8035}8036if(_430){8037delete _430.Type;8038}8039if(rval.ErrorCode!=0){8040var _432=mappingVerification(rval.ErrorCode);8041var _433=null;8042if(rval.ErrorMessage){8043_433=splitErrorMessage(rval.ErrorMessage);8044}8045if(_432){8046switch(MapErrorCode[rval.ErrorCode]){8047case this.error.MISSING_ARG_ERR:8048case this.error.INVALID_ARG_ERR:8049case this.error.NOT_SUPPORTED_ERR:8050if(_433){8051throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroups: "+_433);8052}else{8053throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroups: Operation Failed");8054}8055break;8056default:8057if(_42f!=undefined){8058if(_433){8059_42f(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroups: "+_433));8060}else{8061_42f(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroups: Operation Failed "));8062}8063}else{8064if(_433){8065throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroups: Operation Failed"+_433);8066}else{8067throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroups: Operation Failed");8068}8069}8070}8071}else{8072if(_42f!=undefined){8073if(_433){8074_42f(new DeviceException(rval.ErrorCode,"Contacts: getGroups: "+_433));8075}else{8076_42f(new DeviceException(rval.ErrorCode,"Contacts: getGroups: Operation Failed"));8077}8078}else{8079if(_433){8080throw new DeviceException(rval.ErrorCode,"Contacts: getGroups: Operation Failed"+_433);8081}else{8082throw new DeviceException(rval.ErrorCode,"Contacts: getGroups: Operation Failed");8083}8084}8085}8086}8087return rval.TransactionID;8088}8089catch(e){8090__device_handle_exception(e,"__sp_contacts_getGroups: "+e);8091}8092};8093function __sp_contacts_deleteGroups(id){8094var _435={};8095modifyObjectBaseProp(_435);8096var _436=[];8097if(typeof id=="object"){8098var i=0;8099for(var val in id){8100_436[i]=id[val];8101i++;8102}8103}else{8104_436[0]=id;8105}8106_435.IdList=[];8107_435.IdList=_436;8108var _439={};8109modifyObjectBaseProp(_439);8110_439.Type="Group";8111_439.Data=_435;8112try{8113var _43a=this.so.IDataSource.Delete(_439);8114if(_43a.ErrorCode!=0){8115var _43b=mappingVerification(_43a.ErrorCode);8116if(_43a.ErrorMessage){8117var _43c=splitErrorMessage(_43a.ErrorMessage);8118if(_43b){8119throw new DeviceException(MapErrorCode[_43a.ErrorCode],"Contacts: deleteGroups: "+_43c);8120}else{8121throw new DeviceException(_43a.ErrorCode,"Contacts: deleteGroups: "+_43c);8122}8123}else{8124if(_43b){8125throw new DeviceException(MapErrorCode[_43a.ErrorCode],"Contacts: deleteGroups: Operation Failed");8126}else{8127throw new DeviceException(_43a.ErrorCode,"Contacts: deleteGroups: Operation Failed");8128}8129}8130}8131}8132catch(e){8133__device_handle_exception(e,"__sp_contacts_deleteGroups: "+e);8134}8135};8136function __sp_contacts_addContactsToGroup(_43d,id1){8137try{8138var _43f={};8139modifyObjectBaseProp(_43f);8140var _440=false;8141_43f.Type="Group";8142var map={};8143modifyObjectBaseProp(map);8144var _442=[];8145if(typeof id1=="object"){8146var i=0;8147for(var val in id1){8148_442[i]=id1[val];8149i++;8150}8151}else{8152_442[0]=id1;8153}8154map.IdList=_442;8155_440=true;8156delete _442.index;8157if(_43d!=undefined){8158map.id=_43d;8159_440=true;8160}8161if(_440){8162_43f.Data=map;8163}8164_43f.OperationType="Associate";8165var _445=this.so.IDataSource.Organise(_43f);8166if(map){8167delete map.id;8168delete map.IdList;8169}8170if(_43f){8171delete _43f.Data;8172delete _43f.OperationType;8173delete _43f.Type;8174}8175if(_445.ErrorCode!=0){8176var _446=mappingVerification(_445.ErrorCode);8177if(_445.ErrorMessage){8178var _447=splitErrorMessage(_445.ErrorMessage);8179if(_446){8180throw new DeviceException(MapErrorCode[_445.ErrorCode],"Contacts: addContactsToGroup: "+_447);8181}else{8182throw new DeviceException(_445.ErrorCode,"Contacts: addContactsToGroup: "+_447);8183}8184}else{8185if(_446){8186throw new DeviceException(MapErrorCode[_445.ErrorCode],"Contacts: addContactsToGroup: Operation Failed");8187}else{8188throw new DeviceException(_445.ErrorCode,"Contacts: addContactsToGroup: Operation Failed");8189}8190}8191}8192}8193catch(e){8194__device_handle_exception(e,"__sp_contacts_addContactsToGroup: "+e);8195}8196};8197function __sp_contacts_getContactIds_cb(arg1,arg2,arg3){8198var item=null;8199var _44c=null;8200var _44d;8201var _44e;8202var _44f;8203_44f=glob_obj.getFromArray(arg1);8204if(_44f){8205_44d=_44f.success_cb;8206_44e=_44f.error_cb;8207}else{8208alert("Contacts: __sp_contacts_getContactIds_cb : Callback not found ");8209return;8210}8211var id=null;8212if(arg3["ReturnValue"]!=undefined){8213item=arg3["ReturnValue"];8214id=item["IdList"];8215_44c=[];8216_44c=id;8217delete _44c.index;8218}else{8219if(arg3.ErrorCode!=0){8220var _451;8221if(arg3.ErrorMessage){8222_451=splitErrorMessage(arg3.ErrorMessage);8223}else{8224_451="Operation Failed";8225}8226_44e(new DeviceException(MapErrorCode[arg3.ErrorCode],"Contacts: getContactIds:"+_451));8227return;8228}8229}8230_44d(_44c);8231glob_obj.removeFromArray(arg1);8232};8233function __sp_contacts_getContactIds(_452,_453,_454,_455){8234var _456={};8235modifyObjectBaseProp(_456);8236_456.Type="Contact";8237if(_453){8238_456.Filter={};8239modifyObjectBaseProp(_456.Filter);8240_456.Filter.SearchVal=_453;8241}8242if(_454!=null&&_454!=undefined){8243_456.Sort={};8244modifyObjectBaseProp(_456.Sort);8245if(typeof _454=="number"){8246if(_454==this.SORT_ASCENDING){8247_456.Sort.Order="Ascending";8248}else{8249if(_454==this.SORT_DESCENDING){8250_456.Sort.Order="Descending";8251}else{8252_455(new DeviceException(this.error.DATA_OUT_OF_RANGE_ERR,"Contacts: getContacts: invalid sortOrder input"));8253return;8254}8255}8256}else{8257throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getContactIds: SortOrder is Invalid");8258}8259}8260try{8261if(!_452){8262throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: getContactIds: callback is missing");8263}else{8264if(typeof _452!="function"){8265throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getContactIds: callback is invalid");8266}8267}8268if(_455){8269if(typeof (_455)!="function"){8270throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getContactIds: ErrorCallback is invalid");8271}8272}8273temp_scb=_452;8274temp_ecb=_455;8275var rval=this.so.IDataSource.GetIds(_456,this.getContactIdsCb);8276if(rval.TransactionID){8277glob_obj.addToGlobalArray(rval.TransactionID,_452,_455);8278}8279if(rval.ErrorCode!=0){8280var _458=mappingVerification(rval.ErrorCode);8281var _459=null;8282if(rval.ErrorMessage){8283var _459=splitErrorMessage(rval.ErrorMessage);8284}8285if(_458){8286switch(MapErrorCode[rval.ErrorCode]){8287case this.error.MISSING_ARG_ERR:8288case this.error.INVALID_ARG_ERR:8289case this.error.NOT_SUPPORTED_ERR:8290if(_459){8291throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactIds: "+_459);8292}else{8293throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactIds: Operation Failed");8294}8295break;8296default:8297if(_455!=undefined){8298if(_459){8299_455(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactIds: "+_459));8300}else{8301_455(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactIds: Operation Failed "));8302}8303}else{8304if(_459){8305throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactIds:"+_459);8306}else{8307throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getContactIds: Operation Failed");8308}8309}8310}8311}else{8312if(_455!=undefined){8313if(_459){8314_455(new DeviceException(rval.ErrorCode,"Contacts: getContactIds: "+_459));8315}else{8316_455(new DeviceException(rval.ErrorCode,"Contacts: getContactIds: Operation Failed "));8317}8318}else{8319if(_459){8320throw new DeviceException(rval.ErrorCode,"Contacts: getContactIds:"+_459);8321}else{8322throw new DeviceException(rval.ErrorCode,"Contacts: getContactIds: Operation Failed");8323}8324}8325}8326}8327return rval.TransactionID;8328}8329catch(e){8330__device_handle_exception(e,"__sp_contacts_getContactIds: "+e);8331}8332};8333function __sp_contacts_getGroupIds_cb(arg1,arg2,arg3){8334var _45d=null;8335var item=null;8336var _45f=[];8337var _460;8338var _45d;8339var _461;8340_461=glob_obj.getFromArray(arg1);8341if(_461){8342_460=_461.success_cb;8343_45d=_461.error_cb;8344}else{8345return;8346}8347if(arg3.ReturnValue){8348item=arg3["ReturnValue"];8349arg3.ReturnValue.close();8350var id=item["IdList"];8351_45f=id;8352}else{8353if(arg3.ErrorCode!=0){8354var _463;8355if(rval.ErrorMessage){8356_463=splitErrorMessage(rval.ErrorMessage);8357}else{8358_463="Operation Failed";8359}8360_45d(new DeviceException(MapErrorCode[arg3.ErrorCode],"Contacts: getGroupIds:"+_463));8361return;8362}8363}8364_460(_45f);8365delete _45f.index;8366glob_obj.removeFromArray(arg1);8367};8368function __sp_contacts_getGroupIds(_464,_465){8369var _466={};8370modifyObjectBaseProp(_466);8371_466.Type="Group";8372try{8373if(!_464){8374throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: getGroupIds: callback is missing");8375}else{8376if(typeof _464!="function"){8377throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getGroupIds: callback is invalid");8378}8379}8380if(_465){8381if(typeof (_465)!="function"){8382throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getGroupIds: ErrorCallback is invalid");8383}8384}8385temp_scb=_464;8386temp_ecb=_465;8387var rval=this.so.IDataSource.GetIds(_466,this.getGroupIdsCb);8388if(rval.TransactionID){8389glob_obj.addToGlobalArray(rval.TransactionID,_464,_465);8390}8391if(_466){8392delete _466.Type;8393}8394if(rval.ErrorCode!=0){8395var _468=mappingVerification(rval.ErrorCode);8396var _469=null;8397if(rval.ErrorMessage){8398var _469=splitErrorMessage(rval.ErrorMessage);8399}8400if(_468){8401switch(rval.ErrorCode){8402case this.error.MISSING_ARG_ERR:8403case this.error.INVALID_ARG_ERR:8404case this.error.NOT_SUPPORTED_ERR:8405if(_469){8406throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupIds: "+_469);8407}else{8408throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupIds: Operation Failed");8409}8410break;8411default:8412if(_465!=undefined){8413if(_469){8414_465(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupIds: "+_469));8415}else{8416_465(new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupIds: Operation Failed"));8417}8418}else{8419if(_469){8420throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: Contacts: getGroupIds:"+_469);8421}else{8422throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupIds: Operation Failed");8423}8424}8425}8426}else{8427if(_465!=undefined){8428if(_469){8429_465(new DeviceException(rval.ErrorCode,"Contacts: getGroupIds: "+_469));8430}else{8431_465(new DeviceException(rval.ErrorCode,"Contacts: getGroupIds: Operation Failed"));8432}8433}else{8434if(_469){8435throw new DeviceException(rval.ErrorCode,"Contacts: Contacts: getGroupIds:"+_469);8436}else{8437throw new DeviceException(rval.ErrorCode,"Contacts: getGroupIds: Operation Failed");8438}8439}8440}8441}8442return rval.TransactionID;8443}8444catch(e){8445__device_handle_exception(e,"__sp_contacts_getGroupIds: "+e);8446}8447};8448function __sp_contacts_removeContactsFromGroup(_46a,id){8449try{8450var _46c={};8451modifyObjectBaseProp(_46c);8452var _46d=false;8453_46c.Type="Group";8454var map={};8455if(id!=undefined){8456var _46f=[];8457if(typeof id=="object"){8458var i=0;8459for(var val in id){8460_46f[i]=id[val];8461i++;8462}8463}else{8464_46f[0]=id;8465}8466map.IdList=_46f;8467_46d=true;8468}8469if(_46a!=undefined){8470map.id=_46a;8471_46d=true;8472}8473if(_46d){8474_46c.Data=map;8475}8476_46c.OperationType="Disassociate";8477var _472=this.so.IDataSource.Organise(_46c);8478if(map){8479delete map.IdList;8480}8481if(_46c){8482delete _46c.Data;8483delete _46c.OperationType;8484delete _46c.Type;8485}8486if(_472.ErrorCode!=0){8487var _473=mappingVerification(_472.ErrorCode);8488if(_472.ErrorMessage){8489var _474=splitErrorMessage(_472.ErrorMessage);8490if(_473){8491throw new DeviceException(MapErrorCode[_472.ErrorCode],"Contacts: removeContactsFromGroup: "+_474);8492}else{8493throw new DeviceException(_472.ErrorCode,"Contacts: removeContactsFromGroup: "+_474);8494}8495}else{8496if(_473){8497throw new DeviceException(MapErrorCode[_472.ErrorCode],"Contacts: removeContactsFromGroup: Operation Failed");8498}else{8499throw new DeviceException(_472.ErrorCode,"Contacts: removeContactsFromGroup: Operation Failed");8500}8501}8502}8503}8504catch(e){8505__device_handle_exception(e,"__sp_contacts_removeContactsFromGroup: "+e);8506}8507};8508function __sp_contacts_cancel(_475){8509try{8510var _476={};8511if((_475)==null){8512throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: cancel: transactionId is missing ");8513}8514if((_475)==undefined){8515throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: cancel:transactionId is undefined ");8516}8517if((typeof _475)=="undefined"){8518throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: cancel: transactionId is undefined ");8519}8520if(((typeof _475)!="number")||(_475<=0)){8521throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: cancel: transactionId is Invalid");8522}8523modifyObjectBaseProp(_476);8524_476.TransactionID=_475;8525var _477=this.so.IDataSource.Cancel(_476);8526if(_476){8527delete _476.TransactionID;8528}8529var _478=_477["ErrorCode"];8530if(_478!=0){8531var _479=mappingVerification(_477.ErrorCode);8532if(_477["ErrorMessage"]){8533var _47a=splitErrorMessage(_477.ErrorMessage);8534if(_479){8535throw new DeviceException(MapErrorCode[_478],"Contacts: cancel: "+_47a);8536}else{8537throw new DeviceException(_478,"Contacts: cancel: "+_47a);8538}8539}else{8540if(_479){8541throw new DeviceException(MapErrorCode[_478],"Contacts: cancel: Operation Failed");8542}else{8543throw new DeviceException(_478,"Contacts: cancel: Operation Failed");8544}8545}8546}8547}8548catch(e){8549__device_handle_exception(e,"__sp_contacts_cancel: "+e);8550}8551};8552function __sp_contacts_updateGroup(_47b){8553if(!(_47b)){8554throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: updateGroup:Group Data is missing");8555}8556if((typeof _47b)!="object"){8557throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: updateGroup:Invalid Group Data");8558}8559if(!(_47b&&_47b.groupId)){8560throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: updateGroup: Group id is missing");8561}8562if(typeof _47b.groupId!="string"){8563throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: updateGroup:Invalid Group id input");8564}8565try{8566var _47c={};8567modifyObjectBaseProp(_47c);8568_47c.Type="Group";8569var _47d={};8570modifyObjectBaseProp(_47d);8571if(_47b!=undefined){8572if(_47b.groupId!=undefined){8573_47d["id"]=_47b.groupId;8574}else{8575throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: updateGroup: Id input is mandatory");8576}8577if(_47b.groupName!=undefined){8578_47d["GroupLabel"]=_47b.groupName;8579}8580}8581_47c.Data=_47d;8582var _47e=this.so.IDataSource.Add(_47c);8583if(_47d){8584delete _47d.prototype;8585}8586if(_47c){8587delete _47c.Data;8588delete _47c.Type;8589}8590if(_47e.ErrorCode!=0){8591var _47f=mappingVerification(_47e.ErrorCode);8592if(_47e.ErrorMessage){8593var _480=splitErrorMessage(_47e.ErrorMessage);8594if(_47f){8595throw new DeviceException(MapErrorCode[_47e.ErrorCode],"Contacts: updateGroup: "+_480);8596}else{8597throw new DeviceException(_47e.ErrorCode,"Contacts: updateGroup: "+_480);8598}8599}else{8600if(_47f){8601throw new DeviceException(MapErrorCode[_47e.ErrorCode],"Contacts: updateGroup: Operation Failed");8602}else{8603throw new DeviceException(_47e.ErrorCode,"Contacts: updateGroup: Operation Failed");8604}8605}8606}8607}8608catch(e){8609__device_handle_exception(e,"__sp_contacts_updateGroup: "+e);8610}8611};8612function __sp_contacts_getGroupInfo(_481){8613try{8614var _482={};8615modifyObjectBaseProp(_482);8616_482.Type="Group";8617_482.Filter={};8618modifyObjectBaseProp(_482.Filter);8619if(_481==undefined){8620throw new DeviceException(this.error.MISSING_ARG_ERR,"Contacts: getGroupInfo: Id input is mandatory");8621}8622if((typeof _481)!="string"){8623throw new DeviceException(this.error.INVALID_ARG_ERR,"Contacts: getGroupInfo: Id input is mandatory");8624}8625_482.Filter.id=_481;8626var rval=this.so.IDataSource.GetList(_482);8627if(_482.Filter){8628delete _482.Filter.id;8629}8630if(_482){8631delete _482.Filter;8632delete _482.Type;8633}8634if(rval){8635if(rval.ErrorCode!=0){8636var _484=mappingVerification(rval.ErrorCode);8637if(rval.ErrorMessage){8638var _485=splitErrorMessage(rval.ErrorMessage);8639if(_484){8640throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupInfo: "+_485);8641}else{8642throw new DeviceException(rval.ErrorCode,"Contacts: getGroupInfo: "+_485);8643}8644}else{8645if(_484){8646throw new DeviceException(MapErrorCode[rval.ErrorCode],"Contacts: getGroupInfo: Operation Failed");8647}else{8648throw new DeviceException(rval.ErrorCode,"Contacts: getGroupInfo: Operation Failed");8649}8650}8651}else{8652var _486={};
...
index.js
Source:index.js
1// Copyright 2018 Superblocks AB2//3// This file is part of Superblocks Lab.4//5// Superblocks Lab is free software: you can redistribute it and/or modify6// it under the terms of the GNU General Public License as published by7// the Free Software Foundation version 3 of the License.8//9// Superblocks Lab is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.13//14// You should have received a copy of the GNU General Public License15// along with Superblocks Lab. If not, see <http://www.gnu.org/licenses/>.16if (typeof module === 'undefined') module = {};17var render_item = function(item, item_index, handler, prefix) {18 if (!item.name || item.type != 'function') {19 return null;20 }21 var functionName = item.name;22 var classes = 'item';23 if (item.constant) {24 classes += ' constant';25 }26 if (item.payable) {27 classes += ' payable';28 }29 if (!item.payable && !item.constant) {30 classes += ' regular';31 }32 var intro =33 `34<div>35 <h2>` +36 functionName +37 `</h2>38</div>39`;40 var html =41 `<div class="` +42 classes +43 `">44` +45 intro +46 `47<form id="` +48 prefix +49 item.name +50 `" action="/static/error/404.html" onsubmit="` +51 handler +52 `(` +53 item_index +54 `, event);return false;">55`;56 var js = '';57 var input_value = '';58 if (!item.constant || item.payable) {59 input_value += `60<div class="inputs">61 `;62 if (!item.constant) {63 var id = prefix + item.name + '_gas';64 input_value +=65 `66 <div class="arguments">67 <div class="btn2">Gas</div>68 <div class="argument">69 <span>Limit</span>70 <input type="text" placeholder="300000" name="` +71 id +72 `" id="` +73 id +74 `" />75 </div>76`;77 var id = prefix + item.name + '_gasPrice';78 input_value +=79 `80 <div class="argument">81 <span>Price</span>82 <input type="text" name="` +83 id +84 `" id="` +85 id +86 `" placeholder="1000000000" /> Wei87 </div>88`;89 input_value += `90 </div>91`;92 }93 if (item.payable) {94 var id = prefix + item.name + '_payable';95 input_value +=96 `97 <div class="arguments">98 <div class="btn2">Value</div>99 <div class="argument">100 <span>Value</span>101 <input type="text" name="` +102 id +103 `" id="` +104 id +105 `" placeholder="0" /> Wei106 </div>107 </div>108 `;109 }110 input_value += `</div>111`;112 }113 var fnArguments = '';114 if (item.inputs.length > 0) {115 fnArguments += `116<div class="arguments">117 <div class="btn2">Arguments</div>118`;119 for (var index = 0; index < item.inputs.length; index++) {120 var input = item.inputs[index];121 var id = prefix + item.name + '__' + input.name;122 fnArguments +=123 `124 <div class="argument">125 <span>` +126 input.name +127 `</span>128 <input type="text" placeholder="(` +129 input.type +130 `)" name="` +131 id +132 `" id="` +133 id +134 `" />135 </div>136`;137 }138 fnArguments += `139</div>140`;141 }142 var returns = `143<div class="returns">144 <div class="btn2">Returns:</div>145`;146 if (item.outputs.length > 0 && !item.constant) {147 returns += `148<div class="argument">149 <span>Warning</span>150 <span style="width: unset;">Non constant function can't return values in transaction.</span>151</div>152`;153 }154 if (!item.constant) {155 // Show tx hash156 returns +=157 `158<div class="argument">159 <span>Transaction hash</span>160 <span style="width: unset;" id="` +161 prefix +162 item.name +163 `_res"></span>164</div>165`;166 } else if (item.outputs.length > 0) {167 // Show return values168 for (var index = 0; index < item.outputs.length; index++) {169 var output = item.outputs[index];170 var id = prefix + item.name + '_output_' + index;171 returns +=172 `173 <div class="argument">174 <span>` +175 output.type +176 `</span>177 <span style="width: unset;" id="` +178 id +179 `"></span>180 </div>181`;182 }183 }184 returns += `185</div>186`;187 html +=188 `189<div>190 ` +191 fnArguments +192 `193 ` +194 input_value +195 `196 <div class="function">197 <button class="functionName" type="submit">` +198 functionName +199 `</button>200 </div>201 ` +202 returns +203 `204</div>205</div>206</form>207`;208 return { html: html, js: js };209};210var render = function(abi, contractName) {211 var intro = `212<div class="item">213 <h1>Interact directly with the deployed contract</h1>214 <h3>All public contract functions are represented as colored buttons below, click them to call the function.</h3>215 <h3>Legend of colors:</h3>216 <div class="constant function" style="margin-bottom:10px;">217 <span class="functionName nohover" style="text-align: center;font-weight:unset;padding: 3px 16px;width: unset; display: inline;" type="submit">Constant</span>218 <span>This is a constant function which runs outside of a transaction and can return one or many values. Running it does not consume any gas nor can it mutate the state of the contract.</span>219 </div>220 <div class="regular function" style="margin-bottom:10px;">221 <span class="functionName nohover" style="text-align: center;font-weight:unset;padding: 3px 16px;width: unset; display: inline;" type="submit">Transaction</span>222 <span>This is a function which always runs inside a transaction. It consumes gas and doesn't allow any ether to be sent with it.</span>223 <span>A transaction always returns a transaction hash. In order to retrieve the transaction status it is necessary to read the transaction receipt.</span>224 </div>225 <div class="payable function" style="margin-bottom:10px;">226 <span class="functionName nohover" style=";text-align: center;font-weight:unset;padding: 3px 16px;width: unset; display: inline;" type="submit">Payable</span>227 <span>This is a payable function which always runs inside a transaction. It consumes gas and allows ether to be sent along with it.</span>228 <span>A transaction always returns a transaction hash. In order to retrieve the transaction status it is necessary to read the transaction receipt.</span>229 </div>230</div>231`;232 var prefix = contractName + '_';233 var renderings = [];234 var html_snippets = [intro];235 var js_snippets = [];236 for (var index = 0; index < abi.length; index++) {237 var item = abi[index];238 var o = render_item(item, index, prefix + 'Handler', prefix);239 if (o) {240 html_snippets.push(o.html);241 js_snippets.push(o.js);242 }243 }244 if (html_snippets.length == 1) {245 var nofuncs = `246<div class="item">247 <h1>This contract has no public functions to interact with</h1>248</div>249`;250 html_snippets.push(nofuncs);251 }252 var js =253 `var module={};254(function(module, abi, address, provider) {255 const _web3 = new Web3(provider);256 const contract=_web3.eth.contract(abi);257 var instance=contract.at(address);258 var handler = function(index, event) {259 var id=event.target.id;260 const item=abi[index];261 for(var index=0;index<item.outputs.length;index++) {262 var id2=id+"_output_"+index;;263 var elm = document.getElementById(id2);264 if (elm) elm.textContent="";265 }266 const args=[];267 for(var index=0;index<item.inputs.length;index++) {268 var input=item.inputs[index];269 var id2=id+"__"+input.name;270 var value = document.getElementById(id2).value;271 // Check if input string is Array, remove [] and convert it to Array272 if(input.type.includes("[")) {273 value = value.replace(`+/[[\]]/g+`, '').split(",");274 }275 // If it's array of Booleans, convert them to bool as js thinks of all strings > 0 as true value276 if(input.type == "bool[]") {277 for (var i = 0; i < value.length; i++) {278 value[i] = value[i] === 'false' || value[i] == 0 ? false : value[i];279 value[i] = value[i] === 'true' || value[i] == 1 ? true : value[i];280 }281 }282 else if(input.type == "bool") {283 value = value === 'false' || value == 0 ? false : value;284 value = value === 'true' || value == 1 ? true : value;285 }286 args.push(value);287 }288 if(item.constant) {289 }290 else {291 const accounts=(typeof(web3)!="undefined"?web3.eth.accounts:[]);292 if(accounts.length==0) {293 const msg="There is no account available to do the transaction. Unlock the Custom network wallet or unlock Metamask.";294 alert(msg);295 console.warn(msg);296 return;297 }298 var value=0;299 if(item.payable) {300 value=new _web3.BigNumber(document.getElementById(id+"_payable").value||"0");301 }302 var gas=document.getElementById(id+"_gas").value||"300000";303 var gasPrice=document.getElementById(id+"_gasPrice").value||"1000000000";304 args.push({from: accounts[0], value: value, gas: gas, gasPrice: gasPrice});305 }306 const fn=item.name;307 const cb=(err,res)=>{308 var iserr=false;309 if(res && res.error) {310 // Sometimes we get an error in the result, so we copy it over.311 err=res.error;312 }313 if(err) {314 console.error("Could not interact with contract: ", err);315 iserr=true;316 res=[];317 }318 if(item.outputs.length==0 || !item.constant) {319 var id2=id+"_res";320 if(iserr) {321 //322 // Compress error message323 const splitErrorMessages = err.toString().split("Error:");324 const splitErrorMessagesLen = splitErrorMessages.length;325 // If there are multiple splits as result,326 // then only take the very last message into account327 var splitErrorMessage;328 if(splitErrorMessagesLen > 1) {329 splitErrorMessage = splitErrorMessages[splitErrorMessagesLen - 1]330 }331 if(splitErrorMessage) {332 res="Error: " + splitErrorMessage;333 } else {334 res=err;335 }336 }337 var elm = document.getElementById(id2);338 if (elm) elm.textContent=res.toString();339 }340 else {341 if(! (res instanceof Array)) {342 res=[res];343 for(var index=0;index<item.outputs.length;index++) {344 var output=item.outputs[index];345 var id2=id+"_output_"+index;346 var val=res.shift()347 var isBool = typeof val =='boolean'348 var isString = typeof val =='string'349 var value=val || isBool?val:isString?"(Empty)":iserr?"(ERROR)":"(NO DATA)";350 // TODO: Is this really necessary or if it is, is it complete? Why not check for all integer types?351 if(item.type=="uint256") {352 value=res.toNumber();353 }354 var elm = document.getElementById(id2);355 if (elm) elm.textContent=value;356 }357 }358 else {359 for(var index=0;index<item.outputs.length;index++) {360 var output=item.outputs[index];361 var id2=id+"_output_"+index;362 var value = res.length != 0 && res[index] ? res[index].toString() : "(NO DATA)";363 var elm = document.getElementById(id2);364 if (elm) elm.textContent=value;365 }366 }367 }368 };369 args.push(cb);370 try {371 const res=instance[fn].apply(instance, args);372 }373 catch(e) {374 console.error("Error interacting with contract:", e);375 }376 };377 module.handler=handler;378})(module, Contracts['` +379 contractName +380 `'].abi, Contracts['` +381 contractName +382 `'].address,383 (function(endpoint) {384 if(typeof(web3)!="undefined" && web3.currentProvider) return web3.currentProvider;385 return new Web3.providers.HttpProvider(endpoint);386})(Contracts['` +387 contractName +388 `'].endpoint));389var ` +390 prefix +391 `Handler=module.handler;392`;393 js_snippets.unshift(js);394 return { html: html_snippets.join('\n'), js: js_snippets.join('\n') };395};396module.exports = {397 render: render,...
ErrorTracebackObjectFactory.js
Source:ErrorTracebackObjectFactory.js
1// Copyright 2017 The TIE Authors. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS-IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14/**15 * @fileoverview Factory for creating new frontend instances of ErrorTraceback16 * domain objects.17 */18tie.factory('ErrorTracebackObjectFactory', [19 'TracebackCoordinatesObjectFactory',20 function(TracebackCoordinatesObjectFactory) {21 /**22 * ErrorTraceback objects encapsulate the error message and traceback23 * coordinates for a given Error in a student's submission.24 */25 var LINE_DELIMITER_PYTHON = ', line ';26 /**27 * A generic server error message.28 */29 var SERVER_ERROR_MESSAGE = (30 'A server error occurred. Please refresh the page.');31 /**32 * Constructor for ErrorTraceback33 *34 * @param {string} errorMessage string describing the error35 * @param {Array} tracebackCoordinates Array of ErrorTracebackCoordinates36 * objects describing the sources of each error37 * @constructor38 */39 var ErrorTraceback = function(errorMessage, tracebackCoordinates) {40 /**41 * The error message as a string, e.g. "ZeroDivisionError: integer42 * division or modulo by zero".43 *44 * @type {string}45 * @private46 * */47 this._errorMessage = errorMessage;48 /**49 * A list of ErrorTracebackCoordinates objects. Each object contains a50 * lineNumber and columnNumber (both 1-indexed), representing the51 * locations described in the error trace.52 *53 * @type {Array}54 * @private55 */56 this._tracebackCoordinates = tracebackCoordinates;57 };58 // Instance methods.59 /**60 * Returns the line number in the first error traceback coordinates. This61 * generally means the line in the student code where the error is coming62 * from.63 * If no TracebackCoordinates are available, this will return null.64 *65 * @returns {ErrorTraceback}66 * @private67 */68 ErrorTraceback.prototype.getErrorLineNumber = function() {69 if (!this._tracebackCoordinates) {70 return null;71 }72 return this._tracebackCoordinates[0].getLineNumber();73 };74 /**75 * Returns the error string from the error message.76 * Line number is not included by this method, just the error text.77 *78 * @returns {string}79 */80 ErrorTraceback.prototype.getErrorString = function() {81 return this._errorMessage;82 };83 // Static class methods.84 /**85 * Returns an ErrorTraceback object built from the specified params.86 *87 * @param {string} errorMessage string describing error88 * @param {Array} tracebackCoordinates list of ErrorTracebackCoordinates89 * objects90 * @returns {ErrorTraceback}91 */92 ErrorTraceback.create = function(errorMessage, tracebackCoordinates) {93 return new ErrorTraceback(errorMessage, tracebackCoordinates);94 };95 /**96 * Returns an ErrorTraceback object from a server error.97 *98 * @returns {ErrorTraceback}99 */100 ErrorTraceback.fromServerError = function() {101 return ErrorTraceback.create(SERVER_ERROR_MESSAGE, null);102 };103 /**104 * Returns an ErrorTraceback object from a SkulptError105 *106 * @param {SkulptError} skulptError107 * @returns {ErrorTraceback}108 */109 ErrorTraceback.fromSkulptError = function(skulptError) {110 var errorMessage = String(skulptError).slice(111 0, String(skulptError).indexOf(' on line'));112 var tracebackCoordinates = skulptError.traceback.map(function(traceLine) {113 return TracebackCoordinatesObjectFactory.create(114 traceLine.lineno, traceLine.colno);115 });116 return ErrorTraceback.create(errorMessage, tracebackCoordinates);117 };118 /**119 * Returns an ErrorTraceback object from a standard Python error120 *121 * @param {string} pythonError122 * @returns {ErrorTraceback}123 */124 ErrorTraceback.fromPythonError = function(pythonError) {125 // Split the error string by newlines for easier processing.126 var splitErrorMessage = pythonError.trim().split(/\r?\n/);127 var errorMessage = splitErrorMessage[splitErrorMessage.length - 1];128 if (pythonError.trim().match(/line \d+/) === null) {129 // There's no line or column number included in this error.130 return ErrorTraceback.create(errorMessage, null);131 }132 var lineNumber = null;133 // Python error tracebacks use the last two lines to show the line of code134 // and the error (and sometimes a ^ indicating where the error occurred.135 // Therefore, we need to start at the second from the last line and work136 // backwards to find the most relevant line number.137 for (var i = splitErrorMessage.length - 3; i >= 0; i--) {138 if (splitErrorMessage[i].indexOf(LINE_DELIMITER_PYTHON) !== -1) {139 lineNumber = parseInt(splitErrorMessage[i].slice(140 splitErrorMessage[i].indexOf(LINE_DELIMITER_PYTHON) +141 LINE_DELIMITER_PYTHON.length), 10);142 break;143 }144 }145 var colNumber = null;146 // This is used to grab the column number of an error, if one is present.147 // Python will use a ' ^' to indicate where on the line an error148 // occurred, allowing us to isolate that and use it as the column number.149 if (splitErrorMessage[splitErrorMessage.length - 2].indexOf('^') !== -1) {150 colNumber = splitErrorMessage[splitErrorMessage.length - 2].length;151 }152 var tracebackCoordinates = [TracebackCoordinatesObjectFactory.create(153 lineNumber, colNumber)];154 return ErrorTraceback.create(errorMessage, tracebackCoordinates);155 };156 return ErrorTraceback;157 }...
bulk-action-responding-modal.js
Source:bulk-action-responding-modal.js
1'use strict';2angular.module('conceptRequestServiceApp.request')3 .controller('BulkActionRespondingModalCtrl', [4 '$rootScope',5 '$scope',6 '$uibModalInstance',7 'bulkActionId',8 'requestService',9 'BULK_ACTION_STATUS',10 '$interval',11 'actionLangKey',12 'notificationService',13 '$timeout',14 function ($rootScope, $scope, $uibModalInstance, bulkActionId, requestService, BULK_ACTION_STATUS, $interval, actionLangKey, notificationService, $timeout) {15 var vm = this;16 var intervalGetBulkAction;17 var closeModal = function () {18 $uibModalInstance.close();19 $scope.$on('$destroy', function(){20 $timeout.cancel(intervalGetBulkAction);21 });22 };23 var getBulkActionStatus = function(){24 requestService.getBulkActionStatus(bulkActionId).then(function(data){25 if(data.status === BULK_ACTION_STATUS.STATUS_COMPLETED.value || data.status === BULK_ACTION_STATUS.STATUS_ERROR.value){26 vm.bulkActionLoading = !vm.bulkActionLoading;27 vm.bulkActionRespondingData = data;28 extractError(data.errorMessages);29 // $interval.cancel(bulkActionCurrentStatus);30 }else{31 intervalGetBulkAction = $timeout(function () {32 getBulkActionStatus(bulkActionId);33 }, 5000);34 }35 }, function(error){36 notificationService.sendMessage(error.message, 5000);37 });38 };39 var extractError = function(error){40 vm.splitErrorMessage = error.split(";");41 if(vm.actionLangKey === "crs.request.bulkAction.action.submit"){42 vm.listMsgHtml = [];43 for(var i in vm.splitErrorMessage){44 var splitMsg = vm.splitErrorMessage[i].split(": ");45 if(splitMsg[2]){46 var substringMsg = splitMsg[2].substring(1, splitMsg[2].indexOf("]"));47 if(substringMsg){48 var listId = substringMsg.split(", ");49 if(listId){50 var htmlTemplate;51 for(var j in listId){52 if(splitMsg[1].indexOf("request") !== -1){53 htmlTemplate = (htmlTemplate? htmlTemplate + ', ':'') + '<a class="alert-primary" href="/#/requests/preview/' + listId[j] + '" target="_blank">' + listId[j] + '</a>';54 }else{55 htmlTemplate = (htmlTemplate? htmlTemplate + ', ':'') + '<a class="alert-primary" href="' + ($rootScope.link.snomedInfo? $rootScope.link.snomedInfo:"http://snomed.info/id/") + listId[j] + '" target="_blank">' + listId[j] + '</a>';56 }57 } 58 htmlTemplate = '<span style="display: table; margin-left: 30px; margin-top: -28px; margin-bottom: 28px">' + splitMsg[0] + ': ' + splitMsg[1] + ' ' + htmlTemplate + ']</span>';59 vm.listMsgHtml.push(htmlTemplate);60 htmlTemplate = '';61 }62 }63 }else if(splitMsg[1]){64 var htmlTemplate1 = '<span style="display: table; margin-left: 30px; margin-top: -28px; margin-bottom: 28px">' + splitMsg[0] + ': ' + splitMsg[1] +'</span>';65 vm.listMsgHtml.push(htmlTemplate1);66 }67 }68 }69 };70 getBulkActionStatus();71 vm.actionLangKey = actionLangKey;72 vm.closeModal = closeModal;73 }]...
stackTrace.js
Source:stackTrace.js
...82 const isLocalPlaywright = isTesting && (fileName.includes(runnerSrc) || fileName.includes(runnerLib));83 const isInPlaywright = includesFileInPlaywrightSubDir('src', fileName) || includesFileInPlaywrightSubDir('lib', fileName);84 return !isPlaywrightTest && !isLocalPlaywright && isInPlaywright;85}86function splitErrorMessage(message) {87 const separationIdx = message.indexOf(':');88 return {89 name: separationIdx !== -1 ? message.slice(0, separationIdx) : '',90 message: separationIdx !== -1 && separationIdx + 2 <= message.length ? message.substring(separationIdx + 2) : message91 };...
crProtocolHelper.js
Source:crProtocolHelper.js
1"use strict";2Object.defineProperty(exports, "__esModule", {3 value: true4});5exports.exceptionToError = exceptionToError;6exports.getExceptionMessage = getExceptionMessage;7exports.readProtocolStream = readProtocolStream;8exports.releaseObject = releaseObject;9exports.toConsoleMessageLocation = toConsoleMessageLocation;10exports.toModifiersMask = toModifiersMask;11var _fs = _interopRequireDefault(require("fs"));12var _utils = require("../../utils/utils");13var _stackTrace = require("../../utils/stackTrace");14function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }15/**16 * Copyright 2017 Google Inc. All rights reserved.17 * Modifications copyright (c) Microsoft Corporation.18 *19 * Licensed under the Apache License, Version 2.0 (the "License");20 * you may not use this file except in compliance with the License.21 * You may obtain a copy of the License at22 *23 * http://www.apache.org/licenses/LICENSE-2.024 *25 * Unless required by applicable law or agreed to in writing, software26 * distributed under the License is distributed on an "AS IS" BASIS,27 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.28 * See the License for the specific language governing permissions and29 * limitations under the License.30 */31function getExceptionMessage(exceptionDetails) {32 if (exceptionDetails.exception) return exceptionDetails.exception.description || String(exceptionDetails.exception.value);33 let message = exceptionDetails.text;34 if (exceptionDetails.stackTrace) {35 for (const callframe of exceptionDetails.stackTrace.callFrames) {36 const location = callframe.url + ':' + callframe.lineNumber + ':' + callframe.columnNumber;37 const functionName = callframe.functionName || '<anonymous>';38 message += `\n at ${functionName} (${location})`;39 }40 }41 return message;42}43async function releaseObject(client, objectId) {44 await client.send('Runtime.releaseObject', {45 objectId46 }).catch(error => {});47}48async function readProtocolStream(client, handle, path) {49 let eof = false;50 let fd;51 if (path) {52 await (0, _utils.mkdirIfNeeded)(path);53 fd = await _fs.default.promises.open(path, 'w');54 }55 const bufs = [];56 while (!eof) {57 const response = await client.send('IO.read', {58 handle59 });60 eof = response.eof;61 const buf = Buffer.from(response.data, response.base64Encoded ? 'base64' : undefined);62 bufs.push(buf);63 if (fd) await fd.write(buf);64 }65 if (fd) await fd.close();66 await client.send('IO.close', {67 handle68 });69 return Buffer.concat(bufs);70}71function toConsoleMessageLocation(stackTrace) {72 return stackTrace && stackTrace.callFrames.length ? {73 url: stackTrace.callFrames[0].url,74 lineNumber: stackTrace.callFrames[0].lineNumber,75 columnNumber: stackTrace.callFrames[0].columnNumber76 } : {77 url: '',78 lineNumber: 0,79 columnNumber: 080 };81}82function exceptionToError(exceptionDetails) {83 const messageWithStack = getExceptionMessage(exceptionDetails);84 const lines = messageWithStack.split('\n');85 const firstStackTraceLine = lines.findIndex(line => line.startsWith(' at'));86 let messageWithName = '';87 let stack = '';88 if (firstStackTraceLine === -1) {89 messageWithName = messageWithStack;90 } else {91 messageWithName = lines.slice(0, firstStackTraceLine).join('\n');92 stack = messageWithStack;93 }94 const {95 name,96 message97 } = (0, _stackTrace.splitErrorMessage)(messageWithName);98 const err = new Error(message);99 err.stack = stack;100 err.name = name;101 return err;102}103function toModifiersMask(modifiers) {104 let mask = 0;105 if (modifiers.has('Alt')) mask |= 1;106 if (modifiers.has('Control')) mask |= 2;107 if (modifiers.has('Meta')) mask |= 4;108 if (modifiers.has('Shift')) mask |= 8;109 return mask;...
com.nokia.device.utility.js
Source:com.nokia.device.utility.js
...28function concatenate()29{30 return (this.name+":"+" "+this.message+" "+this.code);31}32function splitErrorMessage(errmessage)33{34 if(errmessage.search(/:/)!=-1)35 {36 if((errmessage.split(":").length)==2)37 {38 return errmessage.split(":")[1];39 }40 if((errmessage.split(":").length)>2)41 {42 return errmessage.split(":")[2];43 }44 }45 return errmessage;46}...
Using AI Code Generation
1const { splitErrorMessage } = require('playwright/lib/utils/stackTrace');2const playwright = require('playwright');3const { chromium } = playwright;4(async () => {5 const browser = await chromium.launch();6 const page = await browser.newPage();7 await page.click('text=Test');8 await browser.close();9})();10const express = require('express');11const app = express();12const port = 8080;13app.get('/', (req, res) => {14 res.sendFile(__dirname + '/index.html');15});16app.listen(port, () => {17});18{19 "scripts": {20 },21 "dependencies": {22 }23}24 at Object.splitErrorMessage (node_modules/playwright/lib/utils/stackTrace.js:22:19)25 at Object.internalError (node_modules/playwright/lib/utils/stackTrace.js:29:23)26 at ElementHandle._clickablePoint (node_modules/playwright/lib/server/dom.js:359:15)27 at ElementHandle._clickablePoint (node_modules/playwright/lib/server/dom.js:363:23)28 at ElementHandle._clickablePoint (node_modules/playwright/lib/server/dom.js:363:23)
Using AI Code Generation
1const { InternalError } = require('playwright/lib/utils/errors');2const { parse } = require('playwright/lib/utils/stackTrace');3const { splitErrorMessage } = require('playwright/lib/utils/errorUtils');4const err = new InternalError('Some error message');5const { message, stack } = splitErrorMessage(err);6const parsedStack = parse(stack);7console.log(message);8console.log(stack);9console.log(parsedStack);10 at Object.<anonymous> (C:\Users\user\Documents\test.js:8:15)11 at Module._compile (internal/modules/cjs/loader.js:999:30)12 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)13 at Module.load (internal/modules/cjs/loader.js:863:32)14 at Function.Module._load (internal/modules/cjs/loader.js:708:14)15 at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)16 at Object.<anonymous> (C:\Users\user\Documents\test.js:1:1)17 at Module._compile (internal/modules/cjs/loader.js:999:30)18 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)19 at Module.load (internal/modules/cjs/loader.js:863:32)20 at Function.Module._load (internal/modules/cjs/loader.js:708:14)21 at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)22 at Object.<anonymous> (C:\Users\user\Documents\test.js:1:1)23 at Module._compile (internal/modules/cjs/loader.js:999:30)24 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)25 at Module.load (internal/modules/cjs/loader.js:863:32)26 at Function.Module._load (internal/modules/cjs/loader.js:708:14)27 at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)28 at Object.<anonymous> (C:\Users\user\Documents\test.js
Using AI Code Generation
1const { InternalError } = require('@playwright/test/lib/utils/stackTrace');2const { error } = require('console');3const internalError = new InternalError('error message');4const splitErrorMessage = internalError.splitErrorMessage();5console.log(splitErrorMessage);6const { InternalError } = require('@playwright/test/lib/utils/stackTrace');7const { error } = require('console');8const internalError = new InternalError('error message');9const splitErrorMessage = internalError.splitErrorMessage();10console.log(splitErrorMessage);11const { InternalError } = require('@playwright/test/lib/utils/stackTrace');12const { error } = require('console');13const internalError = new InternalError('error message');14const splitErrorMessage = internalError.splitErrorMessage();15console.log(splitErrorMessage);
Using AI Code Generation
1const { splitErrorMessage } = require('playwright-core/lib/utils/stackTrace');2const err = new Error('This is a test error');3const stack = splitErrorMessage(err);4console.log(stack);5const { splitErrorMessage } = require('playwright-core/lib/utils/stackTrace');6const err = new Error('This is a test error');7const stack = splitErrorMessage(err);8console.log(stack);9const { splitErrorMessage } = require('playwright-core/lib/utils/stackTrace');10const err = new Error('This is a test error');11const stack = splitErrorMessage(err);12console.log(stack);13const { splitErrorMessage } = require('playwright-core/lib/utils/stackTrace');14const err = new Error('This is a test error');15const stack = splitErrorMessage(err);16console.log(stack);17const { splitErrorMessage } = require('playwright-core/lib/utils/stackTrace');18const err = new Error('This is a test error');19const stack = splitErrorMessage(err);20console.log(stack);21const { splitErrorMessage } = require('playwright-core/lib/utils/stackTrace');22const err = new Error('This is a test error');23const stack = splitErrorMessage(err);24console.log(stack);25const { splitErrorMessage } = require('playwright-core/lib/utils/stackTrace');26const err = new Error('This is a test error');27const stack = splitErrorMessage(err);28console.log(stack);29const { splitErrorMessage } = require('playwright-core/lib/utils/stackTrace');30const err = new Error('This is a test error');31const stack = splitErrorMessage(err);32console.log(stack);33const { splitErrorMessage } = require('playwright-core/lib/utils/stackTrace');
Using AI Code Generation
1const { splitErrorMessage } = require('playwright/lib/server/frames');2const error = new Error('Error message');3splitErrorMessage(error);4const { splitErrorMessage } = require('playwright/lib/server/frames');5const error = new Error('Error message');6at <anonymous>:1:11';7splitErrorMessage(error);8at <anonymous>:1:11' }9const { splitErrorMessage } = require('playwright/lib/server/frames');10const error = new Error('Error message');11at <anonymous>:1:11';12splitErrorMessage(error);13at <anonymous>:1:11' }14const { splitErrorMessage } = require('playwright/lib/server/frames');15const error = new Error('Error message');16at <anonymous>:1:11';17splitErrorMessage(error);18at <anonymous>:1:11' }19const { splitErrorMessage } = require('playwright/lib/server/frames');20const error = new Error('Error message');21at <anonymous>:1:11';22splitErrorMessage(error);23at <anonymous>:1:11' }24const { splitErrorMessage } = require('playwright/lib/server/frames');25const error = new Error('Error message');
Using AI Code Generation
1const { splitErrorMessage } = require('playwright/lib/utils/utils');2const error = new Error('Error message');3 at Object.<anonymous> (/Users/suraj/Projects/playwright-test/test.js:2:15)4 at Module._compile (internal/modules/cjs/loader.js:1137:30)5 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)6 at Module.load (internal/modules/cjs/loader.js:985:32)7 at Function.Module._load (internal/modules/cjs/loader.js:878:14)8 at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)9`;10const [message, stack] = splitErrorMessage(error);11console.log('message', message);12console.log('stack', stack);13 at Object.<anonymous> (/Users/suraj/Projects/playwright-test/test.js:2:15)14 at Module._compile (internal/modules/cjs/loader.js:1137:30)15 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)16 at Module.load (internal/modules/cjs/loader.js:985:32)17 at Function.Module._load (internal/modules/cjs/loader.js:878:14)18 at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!