diff options
-rw-r--r-- | src/org/traccar/BasePipelineFactory.java | 5 | ||||
-rw-r--r-- | src/org/traccar/Context.java | 7 | ||||
-rw-r--r-- | src/org/traccar/WebDataHandler.java | 4 | ||||
-rw-r--r-- | src/org/traccar/protocol/TotemProtocolDecoder.java | 9 | ||||
-rw-r--r-- | test/org/traccar/protocol/GoSafeProtocolDecoderTest.java | 6 | ||||
-rw-r--r-- | test/org/traccar/protocol/TotemProtocolDecoderTest.java | 5 | ||||
-rw-r--r-- | web/app/view/state/StateController.js | 12 | ||||
-rw-r--r-- | web/l10n/sk.js | 86 | ||||
-rw-r--r-- | web/l10n/sr.js | 86 | ||||
-rw-r--r-- | web/locale.js | 2 |
10 files changed, 208 insertions, 14 deletions
diff --git a/src/org/traccar/BasePipelineFactory.java b/src/org/traccar/BasePipelineFactory.java index 216e48709..0dc0bbb47 100644 --- a/src/org/traccar/BasePipelineFactory.java +++ b/src/org/traccar/BasePipelineFactory.java @@ -34,7 +34,7 @@ import org.traccar.helper.Log; public abstract class BasePipelineFactory implements ChannelPipelineFactory { private final TrackerServer server; - private int resetDelay; + private final int resetDelay; private FilterHandler filterHandler; private DistanceHandler distanceHandler; @@ -54,9 +54,6 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory { } } - /** - * Logging using global logger - */ protected class StandardLoggingHandler extends LoggingHandler { @Override diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java index d50a0c626..f818368d0 100644 --- a/src/org/traccar/Context.java +++ b/src/org/traccar/Context.java @@ -15,6 +15,7 @@ */ package org.traccar; +import com.ning.http.client.AsyncHttpClient; import org.traccar.database.ConnectionManager; import org.traccar.database.DataManager; import org.traccar.database.IdentityManager; @@ -81,6 +82,12 @@ public class Context { public static ServerManager getServerManager() { return serverManager; } + + private static final AsyncHttpClient asyncHttpClient = new AsyncHttpClient(); + + public static AsyncHttpClient getAsyncHttpClient() { + return asyncHttpClient; + } public static void init(String[] arguments) throws Exception { diff --git a/src/org/traccar/WebDataHandler.java b/src/org/traccar/WebDataHandler.java index 5e3626022..e2916d9bc 100644 --- a/src/org/traccar/WebDataHandler.java +++ b/src/org/traccar/WebDataHandler.java @@ -15,7 +15,6 @@ */ package org.traccar; -import com.ning.http.client.AsyncHttpClient; import java.util.Calendar; import java.util.Formatter; import java.util.Locale; @@ -70,8 +69,7 @@ public class WebDataHandler extends BaseDataHandler { replace("{longitude}", String.valueOf(position.getLongitude())). replace("{gprmc}", formatSentence(position)); - AsyncHttpClient asyncHttpClient = new AsyncHttpClient(); - asyncHttpClient.prepareGet(request).execute(); + Context.getAsyncHttpClient().prepareGet(request).execute(); return position; } diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index a22bbf71e..358c5cb67 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -20,10 +20,7 @@ import java.util.Calendar; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; - import org.jboss.netty.channel.Channel; -import org.jboss.netty.channel.ChannelHandlerContext; - import org.traccar.BaseProtocolDecoder; import org.traccar.model.Event; import org.traccar.model.Position; @@ -59,7 +56,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { "(\\d{3})" + // Battery "(\\d{4})\\|" + // External Power "(?:(\\d+)\\|)?" + // ADC - "(\\p{XDigit}{8})\\|" + // Location Code + "(\\p{XDigit}+)\\|" + // Location Code "(\\d+)\\|" + // Temperature "(\\d+.\\d+)\\|" + // Odometer "\\d+\\|" + // Serial Number @@ -315,6 +312,10 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { position.setLongitude(longitude); } + + if (channel != null) { + channel.write("ACK OK\r\n"); + } return position; } diff --git a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java index c1a204b3c..7148a0ab3 100644 --- a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java @@ -16,6 +16,12 @@ public class GoSafeProtocolDecoderTest extends ProtocolDecoderTest { verify(decoder.decode(null, null, "*GS16,351535058709775,100356130215,,SYS:G79W;V1.06;V1.0.2,GPS:A;6;N24.802700;E46.616828;0;0;684;1.35,COT:60,ADC:4.31;0.10,DTT:20000;;0;0;0;1")); + + verify(decoder.decode(null, null, + "*GS16,351535059439208,155750220815,,SYS:G79;V1.10;V1.0.2,GPS:A;4;N31.944198;E35.846644;0;0;923;9.47;1.00,COT:155133,ADC:12.21;0.10,DTT:20002;;0;0;0;1#")); + + verify(decoder.decode(null, null, + "*GS16,351535059439208,070034220815,,SYS:G79;V1.10;V1.0.2,GPS:A;8;N31.945970;E35.859848;29;65;922;1.14;1.68,COT:147528,ADC:14.07;0.11,DTT:27006;;0;0;0;3,OBD:04410C1ECD03410D2D03411C010341057A037F011203411107$070035220815,,SYS:G79;V1.10;V1.0.2,GPS:A;8;N31.945934;E35.859908;29;86;922;1.14;1.68,COT:147528,ADC:13.94;0.15,DTT:27006;;0;0;0;3,OBD:04410C1ECD03410D2D03411C010341057A037F011203411107$070037220815,,SYS:G79;V1.10;V1.0.2,GPS:A;8;N31.945844;E35.859952;29;123;922;1.14;1.68,COT:147625,ADC:13.75;0.11,DTT:27006;;0;0;0;3,OBD:04410C0FE803410D1803411C010341057C037F011203411100$070038220815,,SYS:G79;V1.10;V1.0.2,GPS:A;8;N31.945808;E35.859940;29;145;923;1.14;1.68,COT:147625,ADC:14.00;0.11,DTT:27006;;0;0;0;3,OBD:04410C0FE803410D1803411C010341057C037F011203411100#")); } diff --git a/test/org/traccar/protocol/TotemProtocolDecoderTest.java b/test/org/traccar/protocol/TotemProtocolDecoderTest.java index cdb6be355..c01640241 100644 --- a/test/org/traccar/protocol/TotemProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TotemProtocolDecoderTest.java @@ -11,7 +11,10 @@ public class TotemProtocolDecoderTest extends ProtocolDecoderTest { public void testDecode() throws Exception { TotemProtocolDecoder decoder = new TotemProtocolDecoder(new TotemProtocol()); - + + verify(decoder.decode(null, null, + "$$BE863771024392112|AA$GPRMC,044704.000,A,1439.3334,N,12059.1417,E,0.00,0.00,200815,,,A*67|01.7|00.8|01.4|000000000000|20150820044704|14291265|00000000|4EECBF8B31|0000|0.0000|0002|00000|56E7")); + verify(decoder.decode(null, null, "$$AE860990002922822|AA$GPRMC,051002.00,A,0439.26245,N,10108.94448,E,0.023,,140315,,,A*71|02.98|01.95|02.26|000000000000|20150314051003|13841157|105A3B1C|0000|0.0000|0005|5324")); diff --git a/web/app/view/state/StateController.js b/web/app/view/state/StateController.js index 58bc5c55c..73dc28b50 100644 --- a/web/app/view/state/StateController.js +++ b/web/app/view/state/StateController.js @@ -73,6 +73,14 @@ Ext.define('Traccar.view.state.StateController', { } }, + formatValue: function(value) { + if (typeof(id) === 'number') { + return +value.toFixed(2); + } else { + return value; + } + }, + updatePosition: function(position) { var other; @@ -93,7 +101,7 @@ Ext.define('Traccar.view.state.StateController', { store.add(Ext.create('Traccar.model.Parameter', { priority: this.keys[key].priority, name: this.keys[key].name, - value: value + value: this.formatValue(value) })); } } @@ -119,7 +127,7 @@ Ext.define('Traccar.view.state.StateController', { name: key.replace(/^./, function (match) { return match.toUpperCase(); }), - value: value + value: this.formatValue(value) })); } } diff --git a/web/l10n/sk.js b/web/l10n/sk.js new file mode 100644 index 000000000..0c0fa77c3 --- /dev/null +++ b/web/l10n/sk.js @@ -0,0 +1,86 @@ +var strings = { + sharedLoading: 'Načítava...', + sharedSave: 'Uloženie', + sharedCancel: 'Zrušenie', + sharedAdd: 'Pridať', + sharedEdit: 'Úprava', + sharedRemove: 'Odstrániť', + sharedRemoveConfirm: 'Odstrániť položku?', + sharedKm: 'Km', + sharedMi: 'mi', + sharedKmh: 'Km/h', + sharedMph: 'mph', + sharedHour: 'Hodina', + sharedMinute: 'Minúta', + sharedSecond: 'Druhý', + + errorTitle: 'Chyba', + errorUnknown: 'Neznáma chyba', + + userName: 'Meno', + userEmail: 'E-mail', + userPassword: 'Heslo', + userAdmin: 'Admin', + + loginTitle: 'Prihlásenie', + loginLanguage: 'Jazyk', + loginRegister: 'Registrovať', + loginLogin: 'Prihlásenie', + loginFailed: 'Nesprávna e-mailová adresa alebo heslo', + loginCreated: 'Nový užívateľ sa zaregistroval', + loginLogout: 'Odhlásiť', + + deviceDialog: 'Zariadenie', + deviceTitle: 'Zariadena', + deviceName: 'Meno', + deviceIdentifier: 'Identifikátor', + deviceCommand: 'Príkaz', + + settingsTitle: 'Nastavenia', + settingsUser: 'Účet', + settingsServer: 'Server', + settingsUsers: 'Užívatelia', + settingsDistanceUnit: 'Vzdialenosť', + settingsSpeedUnit: 'Rýchlosť jazdy', + + reportTitle: 'Správy', + reportDevice: 'Zariadenie', + reportFrom: 'Z', + reportTo: 'do', + reportShow: 'Zobraziť', + reportClear: 'Vyčistiť', + + positionTime: 'Čas', + positionValid: 'Platný', + positionLatitude: 'Šírka', + positionLongitude: 'Dĺžka', + positionAltitude: 'Výška', + positionSpeed: 'Rýchlosť jazdy', + positionCourse: 'Kurz', + positionAddress: 'Adresa', + positionProtocol: 'Protokol', + + serverTitle: 'Nastavenie servera', + serverZoom: 'Zoom', + serverRegistration: 'Registrácia', + + mapTitle: 'Mapa', + mapLayer: 'Mapové vrstvy', + mapOsm: 'Open Street Map', + mapBingRoad: 'Bing Maps Road', + mapBingAerial: 'Bing Maps Arial', + + stateTitle: 'Štát', + stateName: 'Parameter', + stateValue: 'Hodnota', + + commandTitle: 'Príkaz', + commandSend: 'Odoslať', + commandType: 'Typ', + commandPositionPeriodic: 'Pravidelné podávanie správ', + commandPositionStop: 'Zastavte podávanie správ', + commandEngineStop: 'Zastavenie motora', + commandEngineResume: 'Spustenie motora', + commandFrequency: 'Frekvencia', + commandUnit: 'Unit' +}; diff --git a/web/l10n/sr.js b/web/l10n/sr.js new file mode 100644 index 000000000..8bfe6f104 --- /dev/null +++ b/web/l10n/sr.js @@ -0,0 +1,86 @@ +var strings = { + sharedLoading: 'Učitava...', + sharedSave: 'Sačuvaj', + sharedCancel: 'Odustani', + sharedAdd: 'Dodaj', + sharedEdit: 'Podesi', + sharedRemove: 'Ukloni', + sharedRemoveConfirm: 'Ukloniti jedinicu?', + sharedKm: 'km', + sharedMi: 'mi', + sharedKmh: 'km/h', + sharedMph: 'mph', + sharedHour: 'Čas', + sharedMinute: 'Minut', + sharedSecond: 'Sekunda', + + errorTitle: 'Greška', + errorUnknown: 'Nepoznata greška', + + userName: 'Ime', + userEmail: 'Email', + userPassword: 'Lozinka', + userAdmin: 'Admin', + + loginTitle: 'Prijava', + loginLanguage: 'Jezik', + loginRegister: 'Registruj se', + loginLogin: 'Prijava', + loginFailed: 'Neispravna email adresa ili lozinka', + loginCreated: 'Novi korisnik je registrovan', + loginLogout: 'Odjava', + + deviceDialog: 'Uređaj', + deviceTitle: 'Uređaji', + deviceName: 'Ime', + deviceIdentifier: 'Identifikator', + deviceCommand: 'Komanda', + + settingsTitle: 'Podešavanja', + settingsUser: 'Nalog', + settingsServer: 'Server', + settingsUsers: 'Korisnici', + settingsDistanceUnit: 'Udaljenost', + settingsSpeedUnit: 'Brzina', + + reportTitle: 'Izveštaji', + reportDevice: 'Uređaj', + reportFrom: 'Od', + reportTo: 'Do', + reportShow: 'Prikaži', + reportClear: 'Izbriši', + + positionTime: 'Vreme', + positionValid: 'Ispravno', + positionLatitude: 'Geografska širina', + positionLongitude: 'Geografska dužina', + positionAltitude: 'Visina', + positionSpeed: 'Brzina', + positionCourse: 'Pravac', + positionAddress: 'Adresa', + positionProtocol: 'Protokol', + + serverTitle: 'Podešavanja Servera', + serverZoom: 'Zumiranje', + serverRegistration: 'Registracija', + + mapTitle: 'Mapa', + mapLayer: 'Vrsta Mape', + mapOsm: 'Open Street Map', + mapBingRoad: 'Bing Maps Road', + mapBingAerial: 'Bing Maps Aerial', + + stateTitle: 'Stanje', + stateName: 'Parametar', + stateValue: 'Vrednost', + + commandTitle: 'Komanda', + commandSend: 'Pošalji', + commandType: 'Tip', + commandPositionPeriodic: 'Periodično izveštavanje', + commandPositionStop: 'Prekini izveštavanja', + commandEngineStop: 'Zaustavi motor', + commandEngineResume: 'Pokreni motor', + commandFrequency: 'Frekvencija', + commandUnit: 'Jedinica' +}; diff --git a/web/locale.js b/web/locale.js index 353f47cbc..f22becb22 100644 --- a/web/locale.js +++ b/web/locale.js @@ -28,6 +28,8 @@ var availableLanguages = { 'pl': { name: 'Polski', code: 'pl' }, 'pt': { name: 'Português', code: 'pt' }, 'ru': { name: 'Русский', code: 'ru' }, + 'sk': { name: 'Slovenčina', code: 'sk' }, + 'sr': { name: 'Srpski', code: 'sr' }, 'th': { name: 'ไทย', code: 'th' }, 'zh': { name: '中文', code: 'zh_CN' } }; |