Re-start regular position reports of 'gps103' after a connection loss

marc7 years ago

Normally a gps103 GPS device resumes regular reporting when a connection is broken and restored. I've noticed reporting resumes fine even after a connection loss of some weeks.

However I've got a 'gps103' example (IMEI 35971004xxxxxx) that quite often doesn't resume reporting, it does nothing more until commanded to report again. All it does is announce itself (heartbeat) to keep the server connection alive every 90 seconds. If the connection break time is quite short (a few seconds), this device resumes regular reporting.

I would have posted this is the GPS devices forum, but I'm reasonably sure there's nothing can be done with the device itself, unless there is some undocumented command I don't know about. So this is why the posting is in the server forum.

Is there anything can be done easily at the server to fix this problem? Examples:

  1. The server to send a defined command after a new connection received.
  2. A Trigger set up which sends the command should criteria be met = no position report received > xx minutes
  3. Send the command at a predetermined interval

Here's the log file entries showing the problem. With HEX: decoded for ease of reading.


YYYY-MM-DD HH:MM:SS DEBUG: [823D236B: 11675 < 82.132.238.178] HEX: 359710040103591;
YYYY-MM-DD HH:MM:SS DEBUG: [823D236B: 11675 > 82.132.238.178] HEX: ON

(repeating every 90 secs the whole time while connected)

(normal reporting) 
2017-04-20 18:11:35 DEBUG: [823D236B: 11675 < 82.132.238.178] HEX: imei:359710040103591,tracker,1704201811,,F,171120.000,A,5154.6775,N,00031.1158,W,0.10,135.26;
2017-04-20 18:11:35  INFO: [823D236B] id: 359710040103591, time: 2017-04-20 18:11:20, lat: 51.91129, lon: -0.51860, speed: 0.1, course: 135.3

2017-04-20 18:12:05 DEBUG: [823D236B: 11675 < 82.132.238.178] HEX: imei:359710040103591,tracker,1704201811,,F,171149.000,A,5154.6785,N,00031.1138,W,0.09,149.84;
2017-04-20 18:12:05  INFO: [823D236B] id: 359710040103591, time: 2017-04-20 18:11:49, lat: 51.91131, lon: -0.51856, speed: 0.1, course: 149.8
(Connection loss duration 7.5 minutes)

(Reconnect from different IP address) 
2017-04-20 18:19:46  INFO: [CD4AAEC5] connected
2017-04-20 18:19:46 DEBUG: [CD4AAEC5: 11675 < 82.132.186.237] HEX: ##,imei:359710040103591,A;
2017-04-20 18:19:46 DEBUG: [CD4AAEC5: 11675 > 82.132.186.237] HEX: LOAD

(Device didn't resume and continue reporting)

2017-04-20 18:21:17 DEBUG: [CD4AAEC5: 11675 < 82.132.186.237] HEX: 359710040103591;
2017-04-20 18:21:17 DEBUG: [CD4AAEC5: 11675 > 82.132.186.237] HEX: ON

2017-04-20 18:22:46 DEBUG: [CD4AAEC5: 11675 < 82.132.186.237] HEX: 359710040103591;
2017-04-20 18:22:46 DEBUG: [CD4AAEC5: 11675 > 82.132.186.237] HEX: ON
Anton Tananaev7 years ago

It's possible to implement a workaround with some small modifications to the protocol decoder.

marc7 years ago

An idea..... If while the time a device is disconnected, somehow a Command is sent (impossible from the user interface, button is grayed-out), what happens to this Command? Does it get buffered and then sent on the next connection?

If so that could solve the problem, in conjunction with a Trigger of some kind. Perhaps trigger being connection loss.

Incidentally I'd like to see on Traccar if possible user-definable triggering of Commands. Useful in conjunction with Geofences for example.

Anton Tananaev7 years ago

You can send commands only if device is connected, unless SMS commands are supported for the protocol.

For any feature requests use GitHub.

marc7 years ago

Yes, by definition a command can only get through when there's a connection. I meant what happens if a command message is created anyway (independently of the grayed out button) and it's sent towards a disconnected device. Is it queued on server side awaiting the next connection to the destination device?

I don't know how to request features with Github.

Anton Tananaev7 years ago

Commands are not queued. If device is disconnected, you get a failure result.

You can post feature requests here:

https://github.com/tananaev/traccar/issues

Just make sure it's not already there, in which case just comment on existing thread.

marc7 years ago

Is there any easy way of queuing commands to wait for the device?

Anton Tananaev7 years ago

What do you mean by "easy"? You would have to implement it in the code. If you are comfortable with Java, it should be fairly easy.

marc7 years ago

"Easy" for me is microcontroller assembler (20 years experience), but to me Java would be "quite impossible" with zero years experience.

marc7 years ago
It’s possible to implement a workaround with some small modifications to the protocol decoder.

OK. I'd just searched github tananaev/traccar source code for "Protocol Decoder" and got 474 search results. Although every single search result displayed on the first page had the word "protocol decoder" in it, none of them seemed to have relevance, to me. I didn't check any of the other 48 pages as I didn't know what I'm supposed to be looking for.

I know exactly what I want to do: At the time a new connection is made to specific device, send this 'refresh' command:
**,imei:xxxxxxxxxxx,C,01m

I then searched the folder on the hard drive where Traccar Server is installed to, searching within every single file for the text: "protocol decoder" , but all I got was "search is complete, there are no results to display"

So therefore it seems to me there's no Protocol Decoder in my version of Traccar. I think implementing such a small modification will be about as impossible as me coding Java!

Anton Tananaev7 years ago
marc7 years ago

In above link there appears to be three .java sources relevant to the device in question:

Gps103Protocol.java
Gps103ProtocolDecoder.java
Gps103ProtocolEncoder.java

My guess is it's Gps103ProtocolDecoder.java

Meanwhile, I searched the Traccar installation on the server's HDD again and I still think this could be impossible to implement. There are no .java files at all, and no Gps103ProtocolDecoder file of any file type within the Traccar folder. I didn't try searching the rest of the hard drive.

marc7 years ago
All protocol decoders are here:

https://github.com/tananaev/traccar/tree/master/src/org/traccar/protocol

Do I need to download one of these 'protocol decoders' and install it to where the server is installed?

Anton Tananaev7 years ago

You would have to have at least some basic Java knowledge if you want to do the modifications.

marc7 years ago

What basic Java knowledge do I need because all I want to do is send the command: **,imei:xxxxxxxxxxx,C,01m to the device right after it connects. As a 'hello' greeting from server. Surely it's just a case of strategically pasting the command into a file somewhere.

I would try pasting the command into this 'protocol decoder' you mentioned earlier, but there is no sign of any .java files at all on the server installation, and I really can't see how changing a file located on Github (even if I had access) could have any effect on the server program I'm running.