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