1

JS API: Getting Unit list unknow error

(20/10/2012 14:54:10 отредактировано unitedsecurity)

Тема: JS API: Getting Unit list unknow error

function mappos() {
    
     var mySession = wialon.core.Session.getInstance();
        mySession.initSession("http://testing.wialon.com");
        mySession.login(login, pwd,"",function(code){
        if(code){ 
        alert(wialon.core.Errors.getErrorText(code));
        }else{
    
 var flags2 = wialon.item.Item.dataFlag.base |    // name, ID,...
          wialon.item.Item.dataFlag.customProps |    // custom properties
          wialon.item.Item.dataFlag.customFields |  //  custom fields
          wialon.item.Item.dataFlag.messages |    //    get last msg on position msg
          wialon.item.Item.dataFlag.image |      //     unit icon
          wialon.item.Unit.dataFlag.restricted |    //  UID, HW, phone
          wialon.item.Unit.dataFlag.lastMessage |    // last message
          wialon.item.Unit.dataFlag.driverCode |    //  driver code
          wialon.item.Unit.dataFlag.sensors |      //   sensor info
          wialon.item.Unit.dataFlag.counters;      //   counters info
          
          mySession.loadLibrary('itemCustomFields');
          mySession.loadLibrary('unitSensors');
          mySession.loadLibrary('itemIcon');
  var spec2 = {type:'type',data:'avl_unit', flags:flags2, mode:0};
  
  wialon.core.Session.getInstance().updateDataFlags([spec2], qx.lang.Function.bind(function(code) {
            
      
      
  
    var units2 = wialon.core.Session.getInstance().getItems("avl_unit");      

    console.log(units2);
    
    }));  }

this code gives me unknow error. please fix me problem ... thanks.
United Security

Великий и ужасный Гиоргий Каладзе
2

JS API: Getting Unit list unknow error

Re: JS API: Getting Unit list unknow error

Logic is ok. If you've sent the whole code there are some syntax mistakes in it (you miss });} at the end). Or your problem comes from wrong login or password.

Development Department
Gurtam
3

JS API: Getting Unit list unknow error

Re: JS API: Getting Unit list unknow error

no i fix my problem. problem is that: js Code was runing before html dom page is loaded. i was insert my functions into page load :

$(window).load(function() { 
setInterval("loadpage()",500);
mappos();
 });
Великий и ужасный Гиоргий Каладзе