1

empty last location in sdk if unit is not moving?

Topic: empty last location in sdk if unit is not moving?

Hi dear Gurtam SDK Team,

we made a little programm which reads last location and stores it as a txt file on a ftp server location.
now we experiencing the problem that if unit is not moving the last location is always empty.
can i configure wialon somewhere to answer always with last position even if last position is old?

Thanks
Wolf

Politeness dictates it to write his name on a post
2

empty last location in sdk if unit is not moving?

Re: empty last location in sdk if unit is not moving?

Wolf, this is not true, latest message and position are always avaible.

At the dark side of telematics...
3

empty last location in sdk if unit is not moving?

Re: empty last location in sdk if unit is not moving?

Hi Wolf

It seems like a problem in your code logic.
Can you provide a code sample where you get last unit location?

4

empty last location in sdk if unit is not moving?

Re: empty last location in sdk if unit is not moving?

ok, going to organize the code :-)
Wolf.

Politeness dictates it to write his name on a post
5

empty last location in sdk if unit is not moving?

Re: empty last location in sdk if unit is not moving?

ok, thats what Venelin coded:
[25.08.14 15:03:43] Venelin Vasilev: urlGetAUs =
                   wialonurlfix + "/ajax.html?svc=messages/load_last&sid=" + eID +
                   "&params={" +
                           "\"itemId\":" + node.Tag.ToString() + "," +
                           "\"lastTime\":" + DateTimeToUnixTimestamp(MyTimeInWesternEurope) + "," +
                           "\"lastCount\":1," +
                           "\"flags\":0," +
                           "\"flagsMask\":0x0000," +
                           "\"loadCount\":1" +

                   "}";

results is always empty if unit is not moving...

Wolf.

Politeness dictates it to write his name on a post
6

empty last location in sdk if unit is not moving?

Re: empty last location in sdk if unit is not moving?

It seems to be ok

Try the following:
Specify future time for "lastTime" param, e.g tommorow. Since you ask the latest message - its best solution.

And can you provide response of this request? Cause there are many variants of "empty" result wink

7

empty last location in sdk if unit is not moving?

Re: empty last location in sdk if unit is not moving?

Hi, thanks for your cooperation on this matter smile
Let me try with using future period but I dont think that will help , we dont have a problem of random messages missing. Problem is that only inactive units are not included into result
Above request seen in Wolf's reply will return below data. There are 12 units in this group, but as you can see there are 10 into reply.

My question is if it there is any other way to check unit last position - this is what we actually need. We decided to use messages as one way to get last position, but if you have any other idea how to fetch last unit position - please let us know, thanks smile

{"count":1,"messages":[{"t":1408895940,"f":4096,"tp":"xx","p":{"user":"hilltronicservice","action":"update_unit_bytecounter","host":"job","p1":"0","p2":"319","p3":"avl_unit"}}]}

{"count":1,"messages":[{"t":1408957204,"f":2,"tp":"ud","pos":null,"i":0,"p":"param179":0,"param180":0,"adc1":0.168,"param182":14,"hdop":1.4,"pwr_ext":12.366,"param24":0,"param199":0,"battery_charge":0}}]}

{"count":1,"messages":[{"t":1408954095,"f":3,"tp":"ud","pos":{"y":43.4365728,"x":24.591128,"z":85,"s":0,"c":0,"sc":7},"i":0,"p":{"param179":0,"param180":0,"adc1":0.175,"param182":11,"hdop":1.1,"pwr_ext":12.778,"param24":0,"param199":0,"battery_charge":0}}]}

{"count":1,"messages":[{"t":1408955027,"f":3,"tp":"ud","pos":{"y":43.4377664,"x":24.5901904,"z":78,"s":0,"c":0,"sc":8},"i":0,"p":{"param179":0,"param180":0,"adc1":0.168,"param182":10,"hdop":1,"pwr_ext":12.921,"param24":0,"param199":0,"battery_charge":0}}]}

{"count":1,"messages":[{"t":1408952528,"f":3,"tp":"ud","pos":{"y":43.4368032,"x":24.5910848,"z":87,"s":0,"c":0,"sc":9},"i":0,"p":{"param179":0,"param180":0,"adc1":0.161,"param182":11,"hdop":1.1,"pwr_ext":12.692,"param24":0,"param199":0,"battery_charge":0}}]}

{"count":1,"messages":[{"t":1408961101,"f":3,"tp":"ud","pos":{"y":43.4368224,"x":24.5912672,"z":102,"s":0,"c":0,"sc":8},"i":0,"p":{"param179":0,"param180":0,"adc1":0.162,"param182":10,"hdop":1,"pwr_ext":13.39,"param24":0,"param199":0,"battery_charge":0}}]}

{"count":1,"messages":[{"t":1408966524,"f":3,"tp":"ud","pos":{"y":43.436624,"x":24.5916464,"z":68,"s":0,"c":0,"sc":6},"i":0,"p":{"param179":0,"param180":0,"adc1":0.16,"param182":13,"hdop":1.3,"pwr_ext":12.644,"param24":0,"param199":0,"battery_charge":0}}]}

{"count":1,"messages":[{"t":1408951874,"f":3,"tp":"ud","pos":{"y":42.9822784,"x":24.679816,"z":320,"s":0,"c":0,"sc":7},"i":0,"p":{"param179":0,"param180":0,"adc1":0.174,"param182":12,"hdop":1.2,"pwr_ext":13.112,"param24":0,"param199":0,"battery_charge":0}}]}

{"count":1,"messages":[{"t":1408960095,"f":3,"tp":"ud","pos":{"y":43.4366336,"x":24.5908416,"z":93,"s":0,"c":0,"sc":7},"i":0,"p":{"param179":0,"param180":0,"adc1":0.161,"param182":14,"hdop":1.4,"pwr_ext":13.103,"param24":0,"param199":0,"battery_charge":0}}]}

{"count":1,"messages":[{"t":1408969391,"f":3,"tp":"ud","pos":{"y":43.437024,"x":24.5913376,"z":103,"s":0,"c":0,"sc":7},"i":0,"p":{"param179":0,"param180":0,"adc1":0.168,"param182":9,"hdop":0.9,"pwr_ext":12.912,"param24":0,"param199":0,"battery_charge":0}}]}

{"count":1,"messages":[{"t":1408956619,"f":3,"tp":"ud","pos":{"y":43.436784,"x":24.5908352,"z":105,"s":0,"c":0,"sc":6},"i":0,"p":{"param179":0,"param180":0,"adc1":0.162,"param182":14,"hdop":1.4,"pwr_ext":13.045,"param24":0,"param199":38,"battery_charge":0}}]}

{"count":1,"messages":[{"t":1408955400,"f":3,"tp":"ud","pos":{"y":43.4366496,"x":24.5911408,"z":88,"s":0,"c":0,"sc":8},"i":0,"p":{"param179":0,"param180":0,"adc1":0.174,"param182":11,"hdop":1.1,"pwr_ext":12.988,"param24":0,"param199":0,"battery_charge":0}}]}

8

empty last location in sdk if unit is not moving?

Re: empty last location in sdk if unit is not moving?

Hi there!

As i see, you already have units and use its id. How did you get it? Using core/search_items you can just add 0x00000400 flag and get last message and position for unit.

Another way - use core/update_data_flags and handle change position event.

How often are you planning to run your app (once in minute/ 10 minutes/ hour /day)?

9

empty last location in sdk if unit is not moving?

Re: empty last location in sdk if unit is not moving?

"... Using core/search_items you can just add 0x00000400 flag..."
hmm, that might do the trick, thanks smile it seems will return unit pos every time no matter unit active or not, seems just what we need, have to test it a bit more though...

"How often are you planning to run your app (once in minute/ 10 minutes/ hour /day)?"
this is configurable , 1 min or more

"As i see, you already have units and use its id. How did you get it?"
I use below code to list available units, I use flag 1 as I only need unit name with this query

urlGetAUs =
            wialonurlfix + "/ajax.html?svc=core/update_data_flags&sid=" + eID +
            "&params={" +
                "\"spec\":[" +
                "{" +
                    "\"type\":\"type\"," +
                    "\"data\":\"avl_unit\"," +
                    "\"flags\":1," +
                   "\"mode\":0" +             
                "}" +
                "]" +
            "}";

10

empty last location in sdk if unit is not moving?

Re: empty last location in sdk if unit is not moving?

Another one trick to get "live" app

Since you already have update_data_flags, you can do following:
1) use flags:0x401 in it (that means, get last message and position and listen events about its changes)
2) info about all units from response save to variable in your app
3) every calc interval (for example, 1 minute) call requests/avl_evts (since you're listenning last msg events it give you all info about new messages for each units)
4) update your stored units data with info from avl_events
5) after all - save data from local variable whenever you want

11

empty last location in sdk if unit is not moving?

Re: empty last location in sdk if unit is not moving?

Shmi and Shal,

thanks for help, seems that we (Venellin) can fix it and our customer = happy.

Wolf.

Politeness dictates it to write his name on a post