platformservices.js 228 KB

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