How to extend OSMAnd protocol

birdy338 years ago

Dear Support,
I would like extend protocol to send other datas calculated on my smartphone.

Can I simply modify OsmAndProtocolDecoder.java ?

Thank you.

Eric

Anton Tananaev8 years ago

You don't need to modify protocol. It already supports custom attributes. Just add your attribute to the request and it will be handled automatically by the server.

birdy338 years ago

Great !
If I add ...&speed={5}&data1{25}&data2{25}
I will able to have this datas (data1 and data2) in my database ?

Where can I read complete documentation about this protocol ?
I don't find it.
Thank you

Anton Tananaev8 years ago

Yes, if you add data1 and data2 or any other parameter, it would be saved in the database. Note that it has to be a valid HTTP query attribute (you are missing equals sign).

Here is the only documentation available:

https://www.traccar.org/osmand/

birdy338 years ago

Thank!
Traccar is a very good solution.
Have a nice day Anton,

machitza7 years ago

How can i display an additional attribute in main screen when selecting vehicle ? Eg like speed?

Anton Tananaev7 years ago

All additional attributes are always displayed.

machitza7 years ago

Hmm. I did not see any of those i defined per device and group. Fresh install on win2012

Anton Tananaev7 years ago

@machitza, are your talking about OsmAnd protocol attributes? If not, this is not the right place to ask your question, and you have to be provide more context.

machitza7 years ago

hmm.. guess not... but where can i ask these kind of questions?

1.I'm not talking about extending osmand protocol, just want to send from my app additional fields which will be
displayed in main screen (like lat,lang,speed,etc...).

2.How can i disable any of those fields? (like latitude for example)
thanks!

Anton Tananaev7 years ago

I'm confused. If you are talking about protocol attributes, then what do you mean by "I defined per device and group"?

machitza7 years ago

Actually i'm not talking about osmand protocol.... i just want to send from a php page just like this one

https://www.traccar.org/osmand/
http://demo.traccar.org:5055/?id=123456&lat={0}&lon={1}&timestamp={2}&hdop={3}&altitude={4}&speed={5}

i will call the url something like http://demo.traccar.org:5055/?id=123456&lat={0}&lon={1}&timestamp={2}&hdop={3}&altitude={4}&speed={5}&myAttribute={TEST}&my_ZZZZZ={1121215}

and those 2 field should be displayed in the main screen when i select the device under the standard fields

Anton Tananaev7 years ago

First of all, you should not include curly braces in the parameters. Secondly, as I said before, all parameters are automatically decoded by Traccar. You don't need to do anything extra.

machitza7 years ago

I know about the braces...so i do not have to define any parameter?

Anton Tananaev7 years ago

No, you don't need to define anything.