1

Simple sample wanted using the Wialon Java Script API. Please help!

Тема: Simple sample wanted using the Wialon Java Script API. Please help!

I would like to initiate a session, log into my account with my login and password and then obtain the list of my Units.

I did find some VB.NET code that does what I want to do, using the ActiveX API. It is right here.

Can you please provide exactly the same functionality and with the same level of simplicity, but using Java Script instead?

Thanks a lot in advance!

PS: My question above might seem stupid, but while the ActiveX API is very well documented and full of straightforward samples, the Java Script API doc is quite fragmented, IMHO. I'm actually having a hard time to put together a working HTML page that does what I want to do, using the Wialon Java Script SDK. So guys, your help on that will be really appreciated. Thanks again!

2

Simple sample wanted using the Wialon Java Script API. Please help!

Re: Simple sample wanted using the Wialon Java Script API. Please help!

Examples based on JS API is available here: http://sdk.wialon.com/

Denis Strakh, Gurtam
3

Simple sample wanted using the Wialon Java Script API. Please help!

Re: Simple sample wanted using the Wialon Java Script API. Please help!

stde пишет:

Examples based on JS API is available here: http://sdk.wialon.com/

I did see those examples. Most of them seem to use the low level Remote API. They aren't simple neither. They are more like chunks of code which one needs to compose together and try really hard to make them work. In addition, most of those chunks are mixed with UI (HTML) stuff, which hampers their reuse value.

So, the examples I would like to have would be those documenting the higher-level Java Script SDK -I mean this one: http://docs.gurtam.com/en/hosting/sdk/jsapi/jsapi

I tried for example something like this -which doesn't work, BTW:

       // Set your user name and password:
    var login = "user";
    var pwd = "password";
    // Create a session and log into it:
    var mySession = wialon.core.Session.getInstance();
        mySession.initSession("http://hosting.wialon.com");
        mySession.login(login, pwd);
    // Retrieve all units:
    var items = getItems("avl_unit");
    // For each unit, just show an alert with the last message: 
    items.forEach(function (item, idx, container) {
            alert(item.lastMessage);
              });

What do I need to make the code above work?