aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/helper/ChannelBufferTools.java6
-rw-r--r--src/org/traccar/protocol/BoxProtocolDecoder.java6
-rw-r--r--src/org/traccar/protocol/CityeasyProtocolDecoder.java20
-rw-r--r--src/org/traccar/protocol/XexunFrameDecoder.java8
-rw-r--r--test/org/traccar/protocol/BoxProtocolDecoderTest.java30
-rw-r--r--web/app/view/command/CommandDialogController.js2
-rw-r--r--web/l10n/de.js48
-rw-r--r--web/l10n/pl.js48
-rw-r--r--web/l10n/pt.js64
9 files changed, 133 insertions, 99 deletions
diff --git a/src/org/traccar/helper/ChannelBufferTools.java b/src/org/traccar/helper/ChannelBufferTools.java
index ef9384138..1ebe89666 100644
--- a/src/org/traccar/helper/ChannelBufferTools.java
+++ b/src/org/traccar/helper/ChannelBufferTools.java
@@ -24,7 +24,11 @@ import org.traccar.protocol.IntellitracFrameDecoder;
* ChannelBuffer helper methods
*/
public class ChannelBufferTools {
-
+
+ public static Integer find(ChannelBuffer buf, int start, String subString) {
+ return find(buf, start, buf.readerIndex() + buf.readableBytes(), subString);
+ }
+
/**
* Find string in network buffer
*/
diff --git a/src/org/traccar/protocol/BoxProtocolDecoder.java b/src/org/traccar/protocol/BoxProtocolDecoder.java
index ffc9f9bd0..2230b1356 100644
--- a/src/org/traccar/protocol/BoxProtocolDecoder.java
+++ b/src/org/traccar/protocol/BoxProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2014 - 2015 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.
@@ -43,7 +43,7 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder {
"(-?\\d+\\.\\d+)," + // Longitude
"(\\d+\\.?\\d*)," + // Speed
"(\\d+\\.?\\d*)," + // Course
- "(\\d+)," + // Distance
+ "(\\d+\\.?\\d*)," + // Distance
"(\\d+)," + // Event
"(\\d+)" + // Status
".*");
@@ -62,7 +62,7 @@ public class BoxProtocolDecoder extends BaseProtocolDecoder {
identify(id, channel);
}
- else if (sentence.startsWith("L,")) {
+ else if (hasDeviceId() && sentence.startsWith("L,")) {
// Parse message
Matcher parser = pattern.matcher(sentence);
diff --git a/src/org/traccar/protocol/CityeasyProtocolDecoder.java b/src/org/traccar/protocol/CityeasyProtocolDecoder.java
index ba6a3e62d..c0288a8d5 100644
--- a/src/org/traccar/protocol/CityeasyProtocolDecoder.java
+++ b/src/org/traccar/protocol/CityeasyProtocolDecoder.java
@@ -15,6 +15,12 @@
*/
package org.traccar.protocol;
+import java.net.SocketAddress;
+import java.nio.charset.Charset;
+import java.util.Calendar;
+import java.util.TimeZone;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
@@ -23,13 +29,6 @@ import org.traccar.helper.Crc;
import org.traccar.model.Event;
import org.traccar.model.Position;
-import java.net.SocketAddress;
-import java.nio.charset.Charset;
-import java.util.Calendar;
-import java.util.TimeZone;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
public class CityeasyProtocolDecoder extends BaseProtocolDecoder {
public CityeasyProtocolDecoder(CityeasyProtocol protocol) {
@@ -66,9 +65,10 @@ public class CityeasyProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // length
String imei = ChannelBufferTools.readHexString(buf, 14);
- imei += Crc.luhnChecksum(Long.valueOf(imei));
- if (!identify(imei, channel)) {
- return null;
+ if (!identify(imei, channel, null, false)) {
+ if (!identify(imei + Crc.luhnChecksum(Long.valueOf(imei)), channel)) {
+ return null;
+ }
}
int type = buf.readUnsignedShort();
diff --git a/src/org/traccar/protocol/XexunFrameDecoder.java b/src/org/traccar/protocol/XexunFrameDecoder.java
index 1b3446ff9..60fa02696 100644
--- a/src/org/traccar/protocol/XexunFrameDecoder.java
+++ b/src/org/traccar/protocol/XexunFrameDecoder.java
@@ -36,22 +36,22 @@ public class XexunFrameDecoder extends FrameDecoder {
}
// Find start
- Integer beginIndex = ChannelBufferTools.find(buf, 0, length, "GPRMC");
+ Integer beginIndex = ChannelBufferTools.find(buf, buf.readerIndex(), "GPRMC");
if (beginIndex == null) {
- beginIndex = ChannelBufferTools.find(buf, 0, length, "GNRMC");
+ beginIndex = ChannelBufferTools.find(buf, buf.readerIndex(), "GNRMC");
if (beginIndex == null) {
return null;
}
}
// Find identifier
- Integer idIndex = ChannelBufferTools.find(buf, beginIndex, length, "imei:");
+ Integer idIndex = ChannelBufferTools.find(buf, beginIndex, "imei:");
if (idIndex == null) {
return null;
}
// Find end
- Integer endIndex = ChannelBufferTools.find(buf, idIndex, length, ",");
+ Integer endIndex = ChannelBufferTools.find(buf, idIndex, ",");
if (endIndex == null) {
return null;
}
diff --git a/test/org/traccar/protocol/BoxProtocolDecoderTest.java b/test/org/traccar/protocol/BoxProtocolDecoderTest.java
index 8355f5068..e83b2090a 100644
--- a/test/org/traccar/protocol/BoxProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/BoxProtocolDecoderTest.java
@@ -30,6 +30,36 @@ public class BoxProtocolDecoderTest extends ProtocolDecoderTest {
assertNull(decoder.decode(null, null,
"E,1"));
+ verify(decoder.decode(null, null,
+ "L,150728150130,G,24.68312,46.67526,0,140,0,3,20;A,0;D,0;I,0"));
+
+ verify(decoder.decode(null, null,
+ "L,150728155815,G,24.68311,46.67528,0,140,0,6,21;A,0;D,0;I,0"));
+
+ verify(decoder.decode(null, null,
+ "L,150728155833,G,24.68311,46.67528,11,140,0,52,23;A,0.79;D,0;I,0"));
+
+ verify(decoder.decode(null, null,
+ "L,150728155934,G,24.68396,46.67489,0,282,0.12,1,21;A,1.27;D,1.23;I,0"));
+
+ verify(decoder.decode(null, null,
+ "L,150728160033,G,24.68414,46.67485,0,282,0.12,1,21;A,0;D,0;I,0"));
+
+ verify(decoder.decode(null, null,
+ "L,150728160133,G,24.68388,46.675,0,282,0.12,1,21;A,0;D,0;I,0"));
+
+ verify(decoder.decode(null, null,
+ "L,150728160233,G,24.68377,46.67501,0,282,0.12,1,21;A,0;D,0;I,0"));
+
+ verify(decoder.decode(null, null,
+ "L,150728160333,G,24.684,46.67488,0,282,0.12,1,21;A,0;D,0;I,0"));
+
+ verify(decoder.decode(null, null,
+ "L,150728155855,G,24.68413,46.67482,0,282,0.14,53,21;A,0;D,0;I,0"));
+
+ verify(decoder.decode(null, null,
+ "L,150728160400,G,24.68413,46.67482,0,282,0.14,7,20;A,0;D,0;I,0;END,25,326,150728155814"));
+
}
}
diff --git a/web/app/view/command/CommandDialogController.js b/web/app/view/command/CommandDialogController.js
index 14d4ba2e0..e6275024a 100644
--- a/web/app/view/command/CommandDialogController.js
+++ b/web/app/view/command/CommandDialogController.js
@@ -49,7 +49,7 @@ Ext.define('Traccar.view.command.CommandDialogController', {
onSendReturn: function(options, success, response) {
if (Traccar.ErrorManager.check(success, response)) {
this.closeView();
- Ext.toast(strings.login_created);
+ //TODO toast Ext.toast(strings.login_created);
}
},
diff --git a/web/l10n/de.js b/web/l10n/de.js
index 115d1957e..4991dc1cd 100644
--- a/web/l10n/de.js
+++ b/web/l10n/de.js
@@ -6,13 +6,13 @@ var strings = {
shared_edit: 'Bearbeiten',
shared_remove: 'Entfernen',
shared_remove_confirm: 'Objekt entfernen?',
- shared_km: 'km (*)',
- shared_mi: 'mi (*)',
- shared_kph: 'km/h (*)',
- shared_mph: 'mph (*)',
- shared_hour: 'Hour (*)',
- shared_minute: 'Minute (*)',
- shared_second: 'Second (*)',
+ shared_km: 'km',
+ shared_mi: 'mi',
+ shared_kph: 'km/h',
+ shared_mph: 'mph',
+ shared_hour: 'Stunde',
+ shared_minute: 'Minute',
+ shared_second: 'Sekunde',
error_title: 'Fehler',
error_unknown: 'Unbekannter Fehler',
@@ -23,7 +23,7 @@ var strings = {
user_admin: 'Admin',
login_title: 'Anmeldung',
- login_language: 'Language (*)',
+ login_language: 'Sprache',
login_register: 'Registrieren',
login_login: 'Anmelden',
login_failed: 'Falsche Emailadresse oder Passwort',
@@ -34,14 +34,14 @@ var strings = {
device_title: 'Geräte',
device_name: 'Name',
device_identifier: 'Kennung',
- device_command: 'Command (*)',
+ device_command: 'Befehl',
settings_title: 'Einstellungen',
settings_user: 'Benutzerkonto',
settings_server: 'Server',
settings_users: 'Benutzer',
- settings_distance_unit: 'Distance (*)',
- settings_speed_unit: 'Speed (*)',
+ settings_distance_unit: 'Entfernung',
+ settings_speed_unit: 'Geschwindigkeit',
report_title: 'Berichte',
report_device: 'Gerät',
@@ -65,22 +65,22 @@ var strings = {
server_registration: 'Registrierung zulassen',
map_title: 'Karte',
- map_layer: 'Map Layer (*)',
- map_osm: 'Open Street Map (*)',
- map_bing_road: 'Bing Maps Road (*)',
- map_bing_aerial: 'Bing Maps Aerial (*)',
+ map_layer: 'Karten Layer',
+ map_osm: 'Open Street Map',
+ map_bing_road: 'Bing Strassenkarte',
+ map_bing_aerial: 'Bing Luftbilder',
state_title: 'Status',
state_name: 'Parameter',
state_value: 'Wert',
- command_title: 'Command (*)',
- command_send: 'Send (*)',
- command_type: 'Type (*)',
- command_position_stop: 'Position Stop (*)',
- command_position_fix: 'Position Fix (*)',
- command_engine_stop: 'Engine Stop (*)',
- command_engine_resume: 'Engine Resume (*)',
- command_frequency: 'Frequency (*)',
- command_unit: 'Unit (*)'
+ command_title: 'Befehl',
+ command_send: 'Senden',
+ command_type: 'Typ',
+ command_position_stop: 'Position Stop',
+ command_position_fix: 'Position Fix',
+ command_engine_stop: 'Motor Stop',
+ command_engine_resume: 'Motor fortsetzen',
+ command_frequency: 'Frequenz',
+ command_unit: 'Einheit'
};
diff --git a/web/l10n/pl.js b/web/l10n/pl.js
index ebbe21151..8338435c2 100644
--- a/web/l10n/pl.js
+++ b/web/l10n/pl.js
@@ -6,13 +6,13 @@ var strings = {
shared_edit: 'Edytuj',
shared_remove: 'Usuń',
shared_remove_confirm: 'Usuń obiekt?',
- shared_km: 'km (*)',
- shared_mi: 'mi (*)',
- shared_kph: 'km/h (*)',
- shared_mph: 'mph (*)',
- shared_hour: 'Hour (*)',
- shared_minute: 'Minute (*)',
- shared_second: 'Second (*)',
+ shared_km: 'km',
+ shared_mi: 'mi',
+ shared_kph: 'km/h',
+ shared_mph: 'mph',
+ shared_hour: 'Godzina',
+ shared_minute: 'Minuta',
+ shared_second: 'Sekunda',
error_title: 'Bląd',
error_unknown: 'Nieznany błąd',
@@ -23,7 +23,7 @@ var strings = {
user_admin: 'Administrator',
login_title: 'Logowanie',
- login_language: 'Language (*)',
+ login_language: 'Język',
login_register: 'Rejestracja',
login_login: 'Zaloguj',
login_failed: 'Nieprawidłowy adres e-mail lub hasło',
@@ -34,14 +34,14 @@ var strings = {
device_title: 'Urządzenia',
device_name: 'Nazwa',
device_identifier: 'Identyfikator',
- device_command: 'Command (*)',
+ device_command: 'Zdarzenie',
settings_title: 'Ustawienia',
settings_user: 'Konto',
settings_server: 'Serwer',
settings_users: 'Użytkownicy',
- settings_distance_unit: 'Distance (*)',
- settings_speed_unit: 'Speed (*)',
+ settings_distance_unit: 'Dystans',
+ settings_speed_unit: 'Prędkość',
report_title: 'Raporty',
report_device: 'Urządzenie',
@@ -65,22 +65,22 @@ var strings = {
server_registration: 'Rejestracja',
map_title: 'Mapa',
- map_layer: 'Map Layer (*)',
- map_osm: 'Open Street Map (*)',
- map_bing_road: 'Bing Maps Road (*)',
- map_bing_aerial: 'Bing Maps Aerial (*)',
+ map_layer: 'Map Layer',
+ map_osm: 'Open Street Map',
+ map_bing_road: 'Bing Maps Road',
+ map_bing_aerial: 'Bing Maps Aerial',
state_title: 'Lokalizacja',
state_name: 'Właściwości',
state_value: 'Wartość',
- command_title: 'Command (*)',
- command_send: 'Send (*)',
- command_type: 'Type (*)',
- command_position_stop: 'Position Stop (*)',
- command_position_fix: 'Position Fix (*)',
- command_engine_stop: 'Engine Stop (*)',
- command_engine_resume: 'Engine Resume (*)',
- command_frequency: 'Frequency (*)',
- command_unit: 'Unit (*)'
+ command_title: 'Zdarzenie',
+ command_send: 'Wyślij',
+ command_type: 'Typ',
+ command_position_stop: 'Pozycja - Stop',
+ command_position_fix: 'Pozycja - Fix',
+ command_engine_stop: 'Silnik - Stop',
+ command_engine_resume: 'Silnik - Praca',
+ command_frequency: 'Częstotliwość',
+ command_unit: 'Jednostka'
};
diff --git a/web/l10n/pt.js b/web/l10n/pt.js
index 436e20952..a862165a9 100644
--- a/web/l10n/pt.js
+++ b/web/l10n/pt.js
@@ -6,13 +6,13 @@ var strings = {
shared_edit: 'Editar',
shared_remove: 'Remover',
shared_remove_confirm: 'Remove item?',
- shared_km: 'km (*)',
- shared_mi: 'mi (*)',
- shared_kph: 'km/h (*)',
- shared_mph: 'mph (*)',
- shared_hour: 'Hour (*)',
- shared_minute: 'Minute (*)',
- shared_second: 'Second (*)',
+ shared_km: 'Km',
+ shared_mi: 'mi',
+ shared_kph: 'Km/h',
+ shared_mph: 'Mph',
+ shared_hour: 'Hora',
+ shared_minute: 'Minuto',
+ shared_second: 'Segundo',
error_title: 'Erro',
error_unknown: 'Erro desconhecido',
@@ -22,26 +22,26 @@ var strings = {
user_password: 'Senha',
user_admin: 'Admin',
- login_title: 'Login (*)',
- login_language: 'Language (*)',
- login_register: 'Register (*)',
- login_login: 'Login (*)',
- login_failed: 'Incorrect email address or password (*)',
- login_created: 'New user has been registered (*)',
- login_logout: 'Logout (*)',
+ login_title: 'Entrar',
+ login_language: 'Idioma',
+ login_register: 'Registrar',
+ login_login: 'Entrar',
+ login_failed: 'Endereço de e-mail ou senha incorreta',
+ login_created: 'Novo usuário foi registrado',
+ login_logout: 'Sair',
device_dialog: 'Dispositivo',
device_title: 'Devices',
device_name: 'Nome',
device_identifier: 'Identificador',
- device_command: 'Command (*)',
+ device_command: 'Comando',
settings_title: 'Configurações',
settings_user: 'Conta',
settings_server: 'Servidor',
settings_users: 'Usuário',
- settings_distance_unit: 'Distance (*)',
- settings_speed_unit: 'Speed (*)',
+ settings_distance_unit: 'Distância',
+ settings_speed_unit: 'Velocidade',
report_title: 'Relatórios',
report_device: 'Dispositivo',
@@ -64,23 +64,23 @@ var strings = {
server_zoom: 'Zoom',
server_registration: 'Registro',
- map_title: 'Map',
- map_layer: 'Map Layer (*)',
- map_osm: 'Open Street Map (*)',
- map_bing_road: 'Bing Maps Road (*)',
- map_bing_aerial: 'Bing Maps Aerial (*)',
+ map_title: 'Mapa',
+ map_layer: 'Camada Mapa',
+ map_osm: 'Open Street Mapa',
+ map_bing_road: 'Bing Mapas Estrada',
+ map_bing_aerial: 'Bing Mapas Aérea',
state_title: 'Estado',
state_name: 'Parâmetro',
- state_value: 'Value (*)',
+ state_value: 'Valor',
- command_title: 'Command (*)',
- command_send: 'Send (*)',
- command_type: 'Type (*)',
- command_position_stop: 'Position Stop (*)',
- command_position_fix: 'Position Fix (*)',
- command_engine_stop: 'Engine Stop (*)',
- command_engine_resume: 'Engine Resume (*)',
- command_frequency: 'Frequency (*)',
- command_unit: 'Unit (*)'
+ command_title: 'Comando',
+ command_send: 'Enviar',
+ command_type: 'Tipo' ,
+ command_position_stop: 'Parar Posição' ,
+ command_position_fix: 'Posição Tempo' ,
+ command_engine_stop: 'Bloqueio Veículo' ,
+ command_engine_resume: 'Desbloqueio Veículo' ,
+ command_frequency: 'Frequência' ,
+ command_unit: 'Unidade'
};