getLastLocation method

Aleksander 13 days ago

Hello,
I can't find solution on the Forum, so I've created this theme.

Can you explain how this method should work?

If I use it, it change not only the lon and lat and speed and alt, but time of the message as well.
We have devices that send log info without coord, but with correct another time and we need it "correct device time".

So I've tried to modify decoder and it doesn't help.

if (type == PACKET_DATA) { // 0x01

                        if (length >= 4) { // Needs at least timestamp
                            Position position = new Position(getProtocolName());
                            position.setDeviceId(deviceSession.getDeviceId());
                            position.set(Position.KEY_INDEX, packageIndex);
                            position.setValid(true);

                            long time = buf.readUnsignedIntLE();
                            Date finalDate = new Date(time * 1000);
                            LOGGER.warn("ArnaviDEBUG: TimeInt={} FinalDate={}", time, finalDate);
                            position.setTime(finalDate);

                            // Remaining bytes are tags
                            while (buf.readerIndex() + 5 <= endOfSubPacket) {
                                int tagId = buf.readUnsignedByte();
                                int tagValue = buf.readIntLE();
                                decodeArnaviTag(position, tagId, tagValue);
                            }

                            // Check valid coordinates
                            if (position.getLatitude() == 0 && position.getLongitude() == 0) {
                                getLastLocation(position, null);
                                position.setTime(finalDate); // Restore exact packet time
                                position.setValid(true);
                            }
                            LOGGER.warn("ArnaviDEBUG END: Time={}, Valid={}, Lat={}", position.getDeviceTime(),
                                    position.getValid(), position.getLatitude());
                            positions.add(position);
                        }
                    } else if (type == 0xFA) {
                        // Try to augment the last position if exists
                        Position lastPos = positions.isEmpty() ? null : positions.get(positions.size() - 1);
                        if (lastPos != null) {
                            while (buf.readerIndex() + 5 <= endOfSubPacket) {
                                int tagId = buf.readUnsignedByte();
                                int tagValue = buf.readIntLE();
                                decodeArnaviTag(lastPos, tagId, tagValue);
                            }

there is some logs

2026-01-30 10:22:25  INFO: [Tc07d7938: arnavi < 217.118.76.111] 5b2b01d7007b857c690315d65c4204d679124205421456169757000000c963fa001a96d848b70263338212020127106a6c06010100000607005304060701af045b4e0027005c00006d005d00007c0032770000003300601100347a6e0d0036e1031600374b02000039d30200003a4e0000003b26000000410200000043d80300004500000000d200000f00d348e80100d400000000d530110000d7ab6f0800d840130200d9ce790000da460f0000db4a3e0000dc182e0000dd98950000dee0600000df00000000e000000000e1fdf70300e2ec9e0600e4802c0300fa3b010000df01d70082857c6903b1d55c4204917a12420545145710974f000000c963fa001f96de48b7026333821202012610cb6c06010100000607005104060701ad045b4e004e005c000084005d00007c0032770000003300601100347a6e0d0036e1031600374b02000039220200003a4e0000003b17000000410200000043d80300004500080000d200000f00d348e80100d400000000d5a0280000d7810b0500d840130200d9fc780000da4b0f0000db043e0000dcb42d0000dd14590000dee0600000df00000000e0aa050000e1b9f80300e2ec9e0600e4a0030200fa3b0100003f01d70086857c690389d55c4204cd7a1242054214570b9752000000c963fa001f96e048b7026333821202012610356c06010100000607004f04060701ae045b2e002e005c000084005d00008c0032770000003300601100347a6e0d0036e1031600374b02000039250200003a4e0000003b0a000000410000000043d80300004500080000d200000000d348e80100d400000000d550460000d7a2560200d840130200d9f4780000da4e0f0000db723e0000dcc02b0000ddb7290000dee0600000df00000000e0dc050000e194f90300e2ec9e0600e440130200fa3b0100004d01d700a2857c6903e2d45c4204d67b1242053e12580a9749000000c963fa001996e848b7026333821202012610f86c06010100000607005f04060701b2045b4e0038015c0000f1005d0000300132770000003300401100347a6e0d0036e1031600374b020000392c0400003a4d0000003b14000000410000000043d80300004512160000d200000000d348e80100d400000000d500000000d7ff790400d8a0030200d904860000dae40f0000db0e430000dc70300000ddbe4d0000dee0600000df00000000e086240000e143fc0300e2ed9e0600e4c03f0500fa3b010000805d
2026-01-30 10:22:25  WARN: ArnaviDEBUG: TimeInt=1769768315 FinalDate=Fri Jan 30 10:18:35 UTC 2026
2026-01-30 10:22:25  WARN: ArnaviDEBUG END: Time=Fri Jan 30 10:18:35 UTC 2026, Valid=true, Lat=55.20906448364258
2026-01-30 10:22:25  WARN: ArnaviDEBUG: TimeInt=1769768322 FinalDate=Fri Jan 30 10:18:42 UTC 2026
2026-01-30 10:22:25  WARN: ArnaviDEBUG END: Time=Fri Jan 30 10:18:42 UTC 2026, Valid=true, Lat=55.208683013916016
2026-01-30 10:22:25  INFO: [Tc07d7938: arnavi > 217.118.76.111] 7b002b7d
2026-01-30 10:22:25  INFO: [Tc07d7938: arnavi > 217.118.76.111] 7b002e7d

and that's what we actually got in UI https://ibb.co/wNR4FgxJ

can you help me and say what could be the reason and how can I fix it?

Anton Tananaev 13 days ago

Are you talking about fix time or device time? Those are two different things.

Aleksander 13 days ago

I’m talking about fix time.
I mean, if we use getlastposition it is overwrite time from packet to time that was at last known position

Anton Tananaev 13 days ago

Fix time is the location fix time, so when you call getLastPosition, it should use the last fix time.

Aleksander 13 days ago

So the question is how to use last position, but with time from the last packet, where no fix position, just logs?

Aleksander 12 days ago

Or maybe
Is there possibility to use “no coords” (zero), but register it like in Wialon?
Sometimes device send telemetry, that we need, but without coords. We need that telemetry, but don’t want it to “fly” to the ocean.
Is there such possibility?
Wialon, for example, register it like at screen
https://ibb.co/p6yw7c2y

The result is we don’t lose telemetry data and don’t “fly” to the ocean

Anton Tananaev 12 days ago

No, it already records it correctly.

Aleksander 11 days ago

I got that getLastPosition can get just last position. OK.

then question is:
is there possibility to write data without coords? I mean not zero coords, but without, like "----"?
The reason is to get telemetry data (fuel_lvl, pwr, etc) but without flying to 0,0

Anton Tananaev 11 days ago

What do you mean by "possible"? If you mean whether it's already implemented then. If you mean possible to implement, then of course yes.

Aleksander 11 days ago

How does implementation work?
I mean, should I create some topic and others have to vote or it works in another way?

bluelaser 11 days ago

You should be able to effect what you want using computed attributes.

Anton Tananaev 11 days ago

You can create a feature request, but you would need extremely good argumentation to convince us to change this core part of the project.