diff options
-rw-r--r-- | default.cfg | 4 | ||||
-rw-r--r-- | src/org/traccar/ServerManager.java | 14 | ||||
-rw-r--r-- | src/org/traccar/protocol/SyrusProtocolDecoder.java | 7 | ||||
-rw-r--r-- | test/org/traccar/protocol/SyrusProtocolDecoderTest.java | 3 |
4 files changed, 22 insertions, 6 deletions
diff --git a/default.cfg b/default.cfg index 76c680d35..a583a8f8b 100644 --- a/default.cfg +++ b/default.cfg @@ -290,4 +290,8 @@ <entry key='easytrack.enable'>true</entry> <entry key='easytrack.port'>5056</entry> + <!-- TAIP server configuration --> + <entry key='taip.enable'>true</entry> + <entry key='taip.port'>5057</entry> + </properties> diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index 56a5a1c08..74debb35b 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2013 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2012 - 2014 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -158,6 +158,7 @@ public class ServerManager { initM2mServer("m2m"); initOsmAndServer("osmand"); initEasyTrackServer("easytrack"); + initTaipServer("taip"); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -1018,4 +1019,15 @@ public class ServerManager { } } + private void initTaipServer(String protocol) throws SQLException { + if (isProtocolEnabled(properties, protocol)) { + serverList.add(new TrackerServer(this, new ConnectionlessBootstrap(), protocol) { + @Override + protected void addSpecificHandlers(ChannelPipeline pipeline) { + pipeline.addLast("objectDecoder", new SyrusProtocolDecoder(ServerManager.this)); + } + }); + } + } + } diff --git a/src/org/traccar/protocol/SyrusProtocolDecoder.java b/src/org/traccar/protocol/SyrusProtocolDecoder.java index 66d6872e4..b20e16bcb 100644 --- a/src/org/traccar/protocol/SyrusProtocolDecoder.java +++ b/src/org/traccar/protocol/SyrusProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2013 - 2014 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,10 +34,7 @@ public class SyrusProtocolDecoder extends BaseProtocolDecoder { super(serverManager); } - /** - * Regular expressions pattern - */ - static private Pattern pattern = Pattern.compile( + private static final Pattern pattern = Pattern.compile( "R[EP]V" + // Type "(?:\\d{2}" + // Event index "(\\d{4})" + // Week diff --git a/test/org/traccar/protocol/SyrusProtocolDecoderTest.java b/test/org/traccar/protocol/SyrusProtocolDecoderTest.java index fa48ce286..35d79d587 100644 --- a/test/org/traccar/protocol/SyrusProtocolDecoderTest.java +++ b/test/org/traccar/protocol/SyrusProtocolDecoderTest.java @@ -23,6 +23,9 @@ public class SyrusProtocolDecoderTest { verify(decoder.decode(null, null, ">REV131756153215+3359479-0075299001031332;VO=10568798;IO=310;SV=10;BL=4190;CV09=0;AD=0;AL=+47;ID=356612021059680")); + + verify(decoder.decode(null, null, + ">RPV02138+4555512-0735478000000032;ID=1005;*76<")); } |