diff options
-rw-r--r-- | src/org/traccar/protocol/OsmAndProtocolDecoder.java | 7 | ||||
-rwxr-xr-x | tools/hex.sh | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/OsmAndProtocolDecoder.java b/src/org/traccar/protocol/OsmAndProtocolDecoder.java index 50903f52a..5cb6e6455 100644 --- a/src/org/traccar/protocol/OsmAndProtocolDecoder.java +++ b/src/org/traccar/protocol/OsmAndProtocolDecoder.java @@ -15,6 +15,7 @@ */ package org.traccar.protocol; +import java.nio.charset.Charset; import java.util.Date; import java.util.List; import java.util.Map; @@ -47,6 +48,11 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder { HttpRequest request = (HttpRequest) msg; QueryStringDecoder decoder = new QueryStringDecoder(request.getUri()); Map<String, List<String>> params = decoder.getParameters(); + if (params.isEmpty()) { + decoder = new QueryStringDecoder( + request.getContent().toString(Charset.defaultCharset()), false); + params = decoder.getParameters(); + } // Create new position Position position = new Position(); @@ -58,6 +64,7 @@ public class OsmAndProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(getDataManager().getDeviceByImei(id).getId()); } catch(Exception error) { Log.warning("Unknown device - " + id); + return null; } // Decode position diff --git a/tools/hex.sh b/tools/hex.sh index ddff34834..7571531fe 100755 --- a/tools/hex.sh +++ b/tools/hex.sh @@ -1,2 +1,2 @@ -echo 242442323335363839353033373537383531387c4141244750524d432c3230333832332e3030302c412c333734302e333238352c4e2c30323132392e393239352c452c302e30302c2c3131313131332c2c2c412a37397c30312e357c30312e307c30312e317c3030303030303030303030307c32303133313131313230333832337c31343034313235317c30303030303030307c30303245304444377c303030307c302e303030307c363337317c333832340d0a | perl -ne 's/([0-9a-f]{2})/print chr hex $1/gie' | nc -v -w 10 localhost 5007 +echo 504f5354202f20485454502f312e310d0a436f6e74656e742d4c656e6774683a203133330d0a436f6e74656e742d547970653a206170706c69636174696f6e2f782d7777772d666f726d2d75726c656e636f6465640d0a486f73743a2064656d6f2e747261636361722e6f72673a353035350d0a436f6e6e656374696f6e3a204b6565702d416c6976650d0a557365722d4167656e743a20416e64726f69640d0a0d0a6c61743d33342e303532323334266c6f6e3d2d3131382e3234333638322674696d657374616d703d31333936383334373930267265715f74696d657374616d703d313339363833343739302661636375726163793d312e3026616c7469747564653d36352e302669643d313233343536373839266f66667365743d25324231322533413030 | perl -ne 's/([0-9a-f]{2})/print chr hex $1/gie' | nc -v -w 10 localhost 5055 #echo -n -e "\x0f\x00\x00\x00\x4e\x52\x30\x39\x46\x30\x34\x31\x35\x35\x00" >/dev/udp/localhost/5053 |