From d045c1e2174146ddc8ad8b2ef4442863f3d84a11 Mon Sep 17 00:00:00 2001 From: ninioe Date: Tue, 12 Jul 2016 16:04:40 +0300 Subject: Added support for Alarm popup & positions history cleaner 1. added support for Alarm and Alarm Type in popup and also in history records. can be muted with a toggle button in the UI 2. added a timer to clear positions history once a day. the default is to save positions history for 7 days if not defined in the configuration file. 3. prevent the lock of the UI files (js, html, css, etc..) for wondows developers in debug mode. It's easier to do changes to the UI without stopping the app each time. 4. tools: added support in test-generator.py to simulate Alert, also added minify.bat file to compile new js files for the UI using sencha SDK for windows developers --- web/app/AttributeFormatter.js | 32 +++++++++++++++++++++++++++ web/app/view/Devices.js | 20 +++++++++++++++++ web/app/view/Report.js | 10 +++++++++ web/app/view/StateController.js | 49 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+) (limited to 'web') diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index 3432ca1e0..51b479b9a 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -34,6 +34,34 @@ Ext.define('Traccar.AttributeFormatter', { return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit')); }, + //added by Erez + alarmFormatter: function (attributes) { + if (attributes instanceof Object) { + if (attributes.hasOwnProperty('alarm')){ + var value = attributes.alarm; + if (typeof value === 'boolean') { + value = (value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no); + } + return '' + value + ''; + } + } + return ''; + }, + + //added by Erez + alarmTypeFormatter: function (attributes) { + var alatmType = ''; + if (attributes instanceof Object) { + for (key in attributes) { + if (attributes.hasOwnProperty(key) && key.toLowerCase()=='alarm-type') { + alatmType = attributes[key]; + break; + } + } + } + return '' + alatmType + ''; + }, + defaultFormatter: function (value) { if (typeof value === 'number') { return Number(value.toFixed(Traccar.Style.numberPrecision)); @@ -58,6 +86,10 @@ Ext.define('Traccar.AttributeFormatter', { return this.courseFormatter; } else if (key === 'distance' || key === 'odometer') { return this.distanceFormatter; + } else if (key === 'alarm') {//added by Erez + return this.alarmFormatter; + } else if (key === 'alarm-type') {//added by Erez + return this.alarmTypeFormatter; } else { return this.defaultFormatter; } diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js index 1a70dfef8..4227fd1fb 100644 --- a/web/app/view/Devices.js +++ b/web/app/view/Devices.js @@ -57,6 +57,26 @@ Ext.define('Traccar.view.Devices', { tooltipType: 'title' }, { xtype: 'tbfill' + },{ + id: 'showAlarmButton',//added by Erez + glyph: 'xf0a2@FontAwesome', + tooltip: 'Show Alarms', + tooltipType: 'title', + pressed : true, + enableToggle: true, + listeners:{ + toggle: function(button, pressed){ + if(pressed){ + button.setGlyph('xf0a2@FontAwesome'); + //Ext.getCmp('useAlarmSoundButton').enable(); + } + else { + button.setGlyph('xf1f7@FontAwesome'); + //Ext.getCmp('useAlarmSoundButton').disable(); + } + }, + scope:this + } }, { id: 'deviceFollowButton', glyph: 'xf05b@FontAwesome', diff --git a/web/app/view/Report.js b/web/app/view/Report.js index 4261b9040..fcbd5c028 100644 --- a/web/app/view/Report.js +++ b/web/app/view/Report.js @@ -115,5 +115,15 @@ Ext.define('Traccar.view.Report', { dataIndex: 'address', flex: 1, renderer: Traccar.AttributeFormatter.getFormatter('address') + }, { + text: 'Alarm',//added by Erez + dataIndex: 'attributes', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('alarm') + }, { + text: 'Alarm Type',//added by Erez + dataIndex: 'attributes', + flex: 1, + renderer: Traccar.AttributeFormatter.getFormatter('alarm-type') }] }); diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js index 01df6645d..20b6145ec 100644 --- a/web/app/view/StateController.js +++ b/web/app/view/StateController.js @@ -62,6 +62,11 @@ Ext.define('Traccar.view.StateController', { if (this.deviceId === data[i].get('deviceId')) { this.updatePosition(data[i]); } + var position = data[i]; //added by Erez + var attributes = position.get('attributes'); + if (attributes instanceof Object){ + if (attributes.hasOwnProperty('alarm') && this.showAlarmSelected()) this.onAlarm(position.get('deviceId'), attributes); + } } }, @@ -104,6 +109,50 @@ Ext.define('Traccar.view.StateController', { } }, + showAlarmSelected: function () {//added by Erez + return Ext.getCmp('showAlarmButton') && Ext.getCmp('showAlarmButton').pressed; + }, + + onAlarm: function(deviceId, attributes){//added by Erez + var alatmType = ''; + for (key in attributes) { + if (attributes.hasOwnProperty(key) && key.toLowerCase()=='alarm-type') { + alatmType = ' of type ' + attributes[key]; + break; + } + } + + var device = Ext.getStore('Devices').findRecord('id', deviceId, 0, false, false, true); + if(device){ + var deviceName = device.get('name'); + var msg = 'Alarm'+alatmType+' on device '+deviceName+'!'; + this.showAlarmMsg(msg); + } + }, + + showAlarmMsg: function(msg){//added by Erez + this.beep(); + var alarmMsg = Ext.Msg.show({ + title:'Alarm', + message: msg, + modal: false, + buttons: Ext.Msg.YES, + icon: Ext.Msg.WARNING + }); + + window.setTimeout(function(){ + alarmMsg.close(); + }, 10000) + + }, + + beep: function() {//added by Erez + if(this.snd == null){ + this.snd = new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3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rUmOQNpJFa/r+sa4e/pBlAABoAAAAA3CUgShLdGIxsY7AUABPRrgCABdDuQ5GC7DqPQCgbbJUAoRSUj+NIEig0YfyWUho1VBBBA//uQZB4ABZx5zfMakeAAAAmwAAAAF5F3P0w9GtAAACfAAAAAwLhMDmAYWMgVEG1U0FIGCBgXBXAtfMH10000EEEEEECUBYln03TTTdNBDZopopYvrTTdNa325mImNg3TTPV9q3pmY0xoO6bv3r00y+IDGid/9aaaZTGMuj9mpu9Mpio1dXrr5HERTZSmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU="); + } + this.snd.play(); + }, + selectDevice: function (device) { var position; this.deviceId = device.get('id'); -- cgit v1.2.3 From 0e7cb81693a1067af81b6d74544f16d01fce8b6e Mon Sep 17 00:00:00 2001 From: ninioe Date: Wed, 13 Jul 2016 15:29:39 +0300 Subject: changes Anton asked me --- debug.xml | 13 ++++----- schema/changelog-3.7.xml | 35 ++++++++++++++++++++++++ schema/changelog-master.xml | 1 + src/org/traccar/BaseProtocol.java | 2 +- src/org/traccar/Main.java | 7 +++-- src/org/traccar/database/DataManager.java | 16 ++++++----- src/org/traccar/model/Position.java | 2 +- src/org/traccar/protocol/AquilaProtocol.java | 2 ++ src/org/traccar/protocol/Ardi01Protocol.java | 2 ++ src/org/traccar/protocol/ArknavProtocol.java | 2 ++ src/org/traccar/protocol/ArnaviProtocol.java | 2 ++ src/org/traccar/protocol/AuroProtocol.java | 2 ++ src/org/traccar/protocol/CarTrackProtocol.java | 2 ++ src/org/traccar/protocol/DishaProtocol.java | 2 ++ src/org/traccar/protocol/EasyTrackProtocol.java | 2 ++ src/org/traccar/protocol/FoxProtocol.java | 2 ++ src/org/traccar/protocol/FreedomProtocol.java | 2 ++ src/org/traccar/protocol/GnxProtocol.java | 2 ++ src/org/traccar/protocol/GotopProtocol.java | 2 ++ src/org/traccar/protocol/GpsMarkerProtocol.java | 2 ++ src/org/traccar/protocol/H02ProtocolDecoder.java | 14 +++++----- src/org/traccar/protocol/HaicomProtocol.java | 2 ++ src/org/traccar/protocol/HomtecsProtocol.java | 2 ++ src/org/traccar/protocol/KenjiProtocol.java | 2 ++ src/org/traccar/protocol/SanavProtocol.java | 2 ++ src/org/traccar/protocol/Stl060Protocol.java | 2 ++ src/org/traccar/protocol/SupermateProtocol.java | 2 ++ src/org/traccar/protocol/T55Protocol.java | 4 +-- src/org/traccar/protocol/TaipProtocol.java | 4 +-- src/org/traccar/protocol/TelicProtocol.java | 2 ++ src/org/traccar/protocol/Tk103Protocol.java | 4 +-- src/org/traccar/protocol/Tlt2hProtocol.java | 2 +- src/org/traccar/protocol/TopflytechProtocol.java | 2 ++ src/org/traccar/protocol/Tt8850Protocol.java | 2 ++ src/org/traccar/protocol/UproProtocol.java | 2 ++ src/org/traccar/protocol/V680Protocol.java | 3 ++ src/org/traccar/protocol/VisiontekProtocol.java | 2 ++ src/org/traccar/protocol/XexunProtocol.java | 2 ++ src/org/traccar/protocol/Xt013Protocol.java | 2 ++ src/org/traccar/web/WebServer.java | 8 ++---- tools/minify.bat | 4 +-- tools/test-generator.py | 3 +- web/app/AttributeFormatter.js | 6 ++-- web/app/view/Devices.js | 2 +- web/app/view/Report.js | 4 +-- web/app/view/StateController.js | 10 +++---- 46 files changed, 141 insertions(+), 55 deletions(-) create mode 100644 schema/changelog-3.7.xml (limited to 'web') diff --git a/debug.xml b/debug.xml index 20287587b..60e2c65e8 100644 --- a/debug.xml +++ b/debug.xml @@ -65,15 +65,10 @@ - - - com.mysql.jdbc.Driver - jdbc:mysql://127.0.0.1:3306/traccar?allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=ANSI_QUOTES - traccar - ########### + true @@ -320,6 +315,10 @@ DELETE FROM notifications WHERE id = :id; + + DELETE FROM positions WHERE deviceid = :deviceId and servertime < :serverTime; + + 5001 diff --git a/schema/changelog-3.7.xml b/schema/changelog-3.7.xml new file mode 100644 index 000000000..5e836a99c --- /dev/null +++ b/schema/changelog-3.7.xml @@ -0,0 +1,35 @@ + + + + + + + + groupid NOT IN (SELECT id FROM groups) + + + + + + + groupid NOT IN (SELECT id FROM (SELECT id FROM groups) AS groups_ids) + + + + + + + + + + + + + + + diff --git a/schema/changelog-master.xml b/schema/changelog-master.xml index 399cd3c8d..3b62537d0 100644 --- a/schema/changelog-master.xml +++ b/schema/changelog-master.xml @@ -8,4 +8,5 @@ + diff --git a/src/org/traccar/BaseProtocol.java b/src/org/traccar/BaseProtocol.java index 352895629..4a3e63db4 100644 --- a/src/org/traccar/BaseProtocol.java +++ b/src/org/traccar/BaseProtocol.java @@ -33,6 +33,7 @@ public abstract class BaseProtocol implements Protocol { public BaseProtocol(String name) { this.name = name; + supportedCommands.add(Command.TYPE_CUSTOM); } @Override @@ -42,7 +43,6 @@ public abstract class BaseProtocol implements Protocol { public void setSupportedCommands(String... commands) { supportedCommands.addAll(Arrays.asList(commands)); - supportedCommands.add(Command.TYPE_CUSTOM); } @Override diff --git a/src/org/traccar/Main.java b/src/org/traccar/Main.java index eb3114210..0070904ab 100644 --- a/src/org/traccar/Main.java +++ b/src/org/traccar/Main.java @@ -21,6 +21,8 @@ import java.util.TimerTask; import java.util.Locale; public final class Main { + static final long cleanDelay = 10*1000; //10 sec + static final long cleanPeriod = 24*60*60*1000; //24 hr private Main() { } @@ -36,19 +38,18 @@ public final class Main { Context.getWebServer().start(); } - //added by Erez Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { - // Clean positions history every day + // Clean positions history try { Context.getDataManager().clearPositionsHistory(); } catch (Exception error) { Log.warning(error); } } - }, 10*1000, 24*60*60*1000); + }, cleanDelay, cleanPeriod); Runtime.getRuntime().addShutdownHook(new Thread() { @Override diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 7fd672849..a9fc09448 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -521,22 +521,24 @@ public class DataManager implements IdentityManager { .executeQuery(Position.class); } - //added by Erez public void clearPositionsHistory() throws SQLException { //SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd"); - String histDays = config.getString("database.positionsHistoryDays"); - if (histDays == null) { - histDays = "7"; + int histDays = config.getInteger("database.positionsHistoryDays"); + if (histDays == 0) { + return; + } + + String sql = getQuery("database.clearPositionsHistory"); + if (sql == null) { + return; } - int n = Integer.parseInt(histDays); for (Device device : getAllDevices()) { Date lastUpdate = device.getLastUpdate(); if(lastUpdate != null){ - Date dateBefore = new Date(lastUpdate.getTime() - n * 24 * 3600 * 1000 ); //Subtract n days + Date dateBefore = new Date(lastUpdate.getTime() - histDays * 24 * 3600 * 1000 ); //Subtract histDays days //String dt = s.format(dateBefore); - String sql = "DELETE FROM positions WHERE deviceid=:deviceId and servertime<:serverTime"; QueryBuilder.create(dataSource, sql) .setLong("deviceId", device.getId()) diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index c548c542f..c5a7889bd 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -28,7 +28,7 @@ public class Position extends Message { public static final String KEY_GPS = "gps"; public static final String KEY_EVENT = "event"; public static final String KEY_ALARM = "alarm"; - public static final String KEY_ALARM_TYPE = "alarm-type"; //added by Erez + public static final String KEY_ALARM_TYPE = "alarm-type"; public static final String KEY_STATUS = "status"; public static final String KEY_ODOMETER = "odometer"; public static final String KEY_HOURS = "hours"; diff --git a/src/org/traccar/protocol/AquilaProtocol.java b/src/org/traccar/protocol/AquilaProtocol.java index 851efc40c..1bf5f4ee7 100644 --- a/src/org/traccar/protocol/AquilaProtocol.java +++ b/src/org/traccar/protocol/AquilaProtocol.java @@ -19,6 +19,7 @@ import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class AquilaProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new AquilaProtocolDecoder(AquilaProtocol.this)); } }); diff --git a/src/org/traccar/protocol/Ardi01Protocol.java b/src/org/traccar/protocol/Ardi01Protocol.java index 3bbb489f9..595692cc5 100644 --- a/src/org/traccar/protocol/Ardi01Protocol.java +++ b/src/org/traccar/protocol/Ardi01Protocol.java @@ -19,6 +19,7 @@ import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class Ardi01Protocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new Ardi01ProtocolDecoder(Ardi01Protocol.this)); } }); diff --git a/src/org/traccar/protocol/ArknavProtocol.java b/src/org/traccar/protocol/ArknavProtocol.java index 13cb2572f..3b288b5ab 100644 --- a/src/org/traccar/protocol/ArknavProtocol.java +++ b/src/org/traccar/protocol/ArknavProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class ArknavProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, '\r')); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new ArknavProtocolDecoder(ArknavProtocol.this)); } }); diff --git a/src/org/traccar/protocol/ArnaviProtocol.java b/src/org/traccar/protocol/ArnaviProtocol.java index 6afd0282d..5bdb68e86 100644 --- a/src/org/traccar/protocol/ArnaviProtocol.java +++ b/src/org/traccar/protocol/ArnaviProtocol.java @@ -19,6 +19,7 @@ import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class ArnaviProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new ArnaviProtocolDecoder(ArnaviProtocol.this)); } }); diff --git a/src/org/traccar/protocol/AuroProtocol.java b/src/org/traccar/protocol/AuroProtocol.java index cada65f72..e8fad85fd 100644 --- a/src/org/traccar/protocol/AuroProtocol.java +++ b/src/org/traccar/protocol/AuroProtocol.java @@ -19,6 +19,7 @@ import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class AuroProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new AuroProtocolDecoder(AuroProtocol.this)); } }); diff --git a/src/org/traccar/protocol/CarTrackProtocol.java b/src/org/traccar/protocol/CarTrackProtocol.java index e202ab65a..8a60e3ebb 100644 --- a/src/org/traccar/protocol/CarTrackProtocol.java +++ b/src/org/traccar/protocol/CarTrackProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class CarTrackProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, "##")); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new CarTrackProtocolDecoder(CarTrackProtocol.this)); } }); diff --git a/src/org/traccar/protocol/DishaProtocol.java b/src/org/traccar/protocol/DishaProtocol.java index cdb3ed0ac..bb0d6cdf1 100644 --- a/src/org/traccar/protocol/DishaProtocol.java +++ b/src/org/traccar/protocol/DishaProtocol.java @@ -19,6 +19,7 @@ import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class DishaProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new DishaProtocolDecoder(DishaProtocol.this)); } }); diff --git a/src/org/traccar/protocol/EasyTrackProtocol.java b/src/org/traccar/protocol/EasyTrackProtocol.java index 5a0a65ca2..d8bebeb5e 100644 --- a/src/org/traccar/protocol/EasyTrackProtocol.java +++ b/src/org/traccar/protocol/EasyTrackProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class EasyTrackProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, '#')); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new EasyTrackProtocolDecoder(EasyTrackProtocol.this)); } }); diff --git a/src/org/traccar/protocol/FoxProtocol.java b/src/org/traccar/protocol/FoxProtocol.java index cc069692b..bcda1e433 100644 --- a/src/org/traccar/protocol/FoxProtocol.java +++ b/src/org/traccar/protocol/FoxProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class FoxProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, "")); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new FoxProtocolDecoder(FoxProtocol.this)); } }); diff --git a/src/org/traccar/protocol/FreedomProtocol.java b/src/org/traccar/protocol/FreedomProtocol.java index 22d7792bc..2eb510cdb 100644 --- a/src/org/traccar/protocol/FreedomProtocol.java +++ b/src/org/traccar/protocol/FreedomProtocol.java @@ -19,6 +19,7 @@ import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class FreedomProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new FreedomProtocolDecoder(FreedomProtocol.this)); } }); diff --git a/src/org/traccar/protocol/GnxProtocol.java b/src/org/traccar/protocol/GnxProtocol.java index 7cbc14916..ff2976286 100644 --- a/src/org/traccar/protocol/GnxProtocol.java +++ b/src/org/traccar/protocol/GnxProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class GnxProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, "\n\r")); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new GnxProtocolDecoder(GnxProtocol.this)); } }); diff --git a/src/org/traccar/protocol/GotopProtocol.java b/src/org/traccar/protocol/GotopProtocol.java index 5cec8f73c..303001756 100644 --- a/src/org/traccar/protocol/GotopProtocol.java +++ b/src/org/traccar/protocol/GotopProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class GotopProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, '#')); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new GotopProtocolDecoder(GotopProtocol.this)); } }); diff --git a/src/org/traccar/protocol/GpsMarkerProtocol.java b/src/org/traccar/protocol/GpsMarkerProtocol.java index 3ac827ea7..69c2637bd 100644 --- a/src/org/traccar/protocol/GpsMarkerProtocol.java +++ b/src/org/traccar/protocol/GpsMarkerProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class GpsMarkerProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, "\r")); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new GpsMarkerProtocolDecoder(GpsMarkerProtocol.this)); } }); diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java index 6e1bb2d9d..ffe16e975 100644 --- a/src/org/traccar/protocol/H02ProtocolDecoder.java +++ b/src/org/traccar/protocol/H02ProtocolDecoder.java @@ -64,19 +64,19 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { private void processStatus(Position position, long status) { if (!BitUtil.check(status, 0) || !BitUtil.check(status, 1) - || !BitUtil.check(status, 3) || !BitUtil.check(status, 4) || !BitUtil.check(status, 7)) {//added by Erez + || !BitUtil.check(status, 3) || !BitUtil.check(status, 4) || !BitUtil.check(status, 7)) { position.set(Position.KEY_ALARM, true); - if (!BitUtil.check(status, 0)){//added by Erez - position.set(Position.KEY_ALARM_TYPE, "theft alarm"); + if (!BitUtil.check(status, 0)){ + position.set(Position.KEY_ALARM_TYPE, "theft"); } else if (!BitUtil.check(status, 1)){ - position.set(Position.KEY_ALARM_TYPE, "robbery alarm"); + position.set(Position.KEY_ALARM_TYPE, "robbery"); } else if (!BitUtil.check(status, 3)){ - position.set(Position.KEY_ALARM_TYPE, "illegal ignition alarm"); + position.set(Position.KEY_ALARM_TYPE, "illegal ignition"); } else if (!BitUtil.check(status, 4)){ - position.set(Position.KEY_ALARM_TYPE, "entering alarm"); + position.set(Position.KEY_ALARM_TYPE, "entering"); } else if (!BitUtil.check(status, 7)){ - position.set(Position.KEY_ALARM_TYPE, "out alarm"); + position.set(Position.KEY_ALARM_TYPE, "out"); } } diff --git a/src/org/traccar/protocol/HaicomProtocol.java b/src/org/traccar/protocol/HaicomProtocol.java index de9e3ebb1..344f9c1ae 100644 --- a/src/org/traccar/protocol/HaicomProtocol.java +++ b/src/org/traccar/protocol/HaicomProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class HaicomProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, '*')); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new HaicomProtocolDecoder(HaicomProtocol.this)); } }); diff --git a/src/org/traccar/protocol/HomtecsProtocol.java b/src/org/traccar/protocol/HomtecsProtocol.java index 1a2e98565..8e65f8572 100644 --- a/src/org/traccar/protocol/HomtecsProtocol.java +++ b/src/org/traccar/protocol/HomtecsProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ConnectionlessBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.TrackerServer; @@ -35,6 +36,7 @@ public class HomtecsProtocol extends BaseProtocol { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new HomtecsProtocolDecoder(HomtecsProtocol.this)); } }); diff --git a/src/org/traccar/protocol/KenjiProtocol.java b/src/org/traccar/protocol/KenjiProtocol.java index 6639021cb..8b196a9ed 100755 --- a/src/org/traccar/protocol/KenjiProtocol.java +++ b/src/org/traccar/protocol/KenjiProtocol.java @@ -19,6 +19,7 @@ import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.TrackerServer; @@ -38,6 +39,7 @@ public class KenjiProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new KenjiProtocolDecoder(KenjiProtocol.this)); } }); diff --git a/src/org/traccar/protocol/SanavProtocol.java b/src/org/traccar/protocol/SanavProtocol.java index 29c0533ea..bb329ab70 100644 --- a/src/org/traccar/protocol/SanavProtocol.java +++ b/src/org/traccar/protocol/SanavProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class SanavProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, '*')); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new SanavProtocolDecoder(SanavProtocol.this)); } }); diff --git a/src/org/traccar/protocol/Stl060Protocol.java b/src/org/traccar/protocol/Stl060Protocol.java index 49e59e240..e37f94b00 100644 --- a/src/org/traccar/protocol/Stl060Protocol.java +++ b/src/org/traccar/protocol/Stl060Protocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.TrackerServer; @@ -36,6 +37,7 @@ public class Stl060Protocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new Stl060FrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new Stl060ProtocolDecoder(Stl060Protocol.this)); } }); diff --git a/src/org/traccar/protocol/SupermateProtocol.java b/src/org/traccar/protocol/SupermateProtocol.java index 12e773b9a..bcc2bed16 100755 --- a/src/org/traccar/protocol/SupermateProtocol.java +++ b/src/org/traccar/protocol/SupermateProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class SupermateProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, "#")); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new SupermateProtocolDecoder(SupermateProtocol.this)); } }); diff --git a/src/org/traccar/protocol/T55Protocol.java b/src/org/traccar/protocol/T55Protocol.java index 3fa0f6a9e..86f927e41 100644 --- a/src/org/traccar/protocol/T55Protocol.java +++ b/src/org/traccar/protocol/T55Protocol.java @@ -38,16 +38,16 @@ public class T55Protocol extends BaseProtocol { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); - pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new T55ProtocolDecoder(T55Protocol.this)); } }); serverList.add(new TrackerServer(new ConnectionlessBootstrap(), this.getName()) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { - pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new T55ProtocolDecoder(T55Protocol.this)); } }); diff --git a/src/org/traccar/protocol/TaipProtocol.java b/src/org/traccar/protocol/TaipProtocol.java index a3b744e70..e72639099 100644 --- a/src/org/traccar/protocol/TaipProtocol.java +++ b/src/org/traccar/protocol/TaipProtocol.java @@ -38,16 +38,16 @@ public class TaipProtocol extends BaseProtocol { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, '<')); - pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new TaipProtocolDecoder(TaipProtocol.this, true)); } }); serverList.add(new TrackerServer(new ConnectionlessBootstrap(), this.getName()) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { - pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new TaipProtocolDecoder(TaipProtocol.this, false)); } }); diff --git a/src/org/traccar/protocol/TelicProtocol.java b/src/org/traccar/protocol/TelicProtocol.java index 464892431..1e27620ba 100644 --- a/src/org/traccar/protocol/TelicProtocol.java +++ b/src/org/traccar/protocol/TelicProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class TelicProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new TelicFrameDecoder()); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new TelicProtocolDecoder(TelicProtocol.this)); } }; diff --git a/src/org/traccar/protocol/Tk103Protocol.java b/src/org/traccar/protocol/Tk103Protocol.java index 324c01a31..b14264091 100644 --- a/src/org/traccar/protocol/Tk103Protocol.java +++ b/src/org/traccar/protocol/Tk103Protocol.java @@ -38,16 +38,16 @@ public class Tk103Protocol extends BaseProtocol { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, ')')); - pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new Tk103ProtocolDecoder(Tk103Protocol.this)); } }); serverList.add(new TrackerServer(new ConnectionlessBootstrap(), this.getName()) { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { - pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new Tk103ProtocolDecoder(Tk103Protocol.this)); } }); diff --git a/src/org/traccar/protocol/Tlt2hProtocol.java b/src/org/traccar/protocol/Tlt2hProtocol.java index 14787537d..3a1bf99ff 100644 --- a/src/org/traccar/protocol/Tlt2hProtocol.java +++ b/src/org/traccar/protocol/Tlt2hProtocol.java @@ -37,8 +37,8 @@ public class Tlt2hProtocol extends BaseProtocol { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(32 * 1024, "##\r\n")); - pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new Tlt2hProtocolDecoder(Tlt2hProtocol.this)); } }); diff --git a/src/org/traccar/protocol/TopflytechProtocol.java b/src/org/traccar/protocol/TopflytechProtocol.java index 42fa36c10..ae250ad02 100644 --- a/src/org/traccar/protocol/TopflytechProtocol.java +++ b/src/org/traccar/protocol/TopflytechProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class TopflytechProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, ')')); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new TopflytechProtocolDecoder(TopflytechProtocol.this)); } }); diff --git a/src/org/traccar/protocol/Tt8850Protocol.java b/src/org/traccar/protocol/Tt8850Protocol.java index a409205c7..db41fae9f 100644 --- a/src/org/traccar/protocol/Tt8850Protocol.java +++ b/src/org/traccar/protocol/Tt8850Protocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class Tt8850Protocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, "$")); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new Tt8850ProtocolDecoder(Tt8850Protocol.this)); } }); diff --git a/src/org/traccar/protocol/UproProtocol.java b/src/org/traccar/protocol/UproProtocol.java index 36115edb4..b62247761 100644 --- a/src/org/traccar/protocol/UproProtocol.java +++ b/src/org/traccar/protocol/UproProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class UproProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, '#')); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new UproProtocolDecoder(UproProtocol.this)); } }); diff --git a/src/org/traccar/protocol/V680Protocol.java b/src/org/traccar/protocol/V680Protocol.java index d2ceb207b..4edff3772 100644 --- a/src/org/traccar/protocol/V680Protocol.java +++ b/src/org/traccar/protocol/V680Protocol.java @@ -19,6 +19,7 @@ import org.jboss.netty.bootstrap.ConnectionlessBootstrap; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -38,6 +39,7 @@ public class V680Protocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, "##")); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new V680ProtocolDecoder(V680Protocol.this)); } }); @@ -45,6 +47,7 @@ public class V680Protocol extends BaseProtocol { @Override protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new V680ProtocolDecoder(V680Protocol.this)); } }); diff --git a/src/org/traccar/protocol/VisiontekProtocol.java b/src/org/traccar/protocol/VisiontekProtocol.java index 53d02c478..2d2a41e89 100644 --- a/src/org/traccar/protocol/VisiontekProtocol.java +++ b/src/org/traccar/protocol/VisiontekProtocol.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class VisiontekProtocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, '#')); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new VisiontekProtocolDecoder(VisiontekProtocol.this)); } }); diff --git a/src/org/traccar/protocol/XexunProtocol.java b/src/org/traccar/protocol/XexunProtocol.java index f99a3a9ee..14afaf4cb 100644 --- a/src/org/traccar/protocol/XexunProtocol.java +++ b/src/org/traccar/protocol/XexunProtocol.java @@ -19,6 +19,7 @@ import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.Context; import org.traccar.TrackerServer; @@ -43,6 +44,7 @@ public class XexunProtocol extends BaseProtocol { pipeline.addLast("frameDecoder", new XexunFrameDecoder()); } pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new XexunProtocolDecoder(XexunProtocol.this, full)); } }); diff --git a/src/org/traccar/protocol/Xt013Protocol.java b/src/org/traccar/protocol/Xt013Protocol.java index 14e0d3b9f..b11256b7d 100644 --- a/src/org/traccar/protocol/Xt013Protocol.java +++ b/src/org/traccar/protocol/Xt013Protocol.java @@ -19,6 +19,7 @@ import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder; import org.jboss.netty.handler.codec.string.StringDecoder; +import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; import org.traccar.TrackerServer; @@ -37,6 +38,7 @@ public class Xt013Protocol extends BaseProtocol { protected void addSpecificHandlers(ChannelPipeline pipeline) { pipeline.addLast("frameDecoder", new LineBasedFrameDecoder(1024)); pipeline.addLast("stringDecoder", new StringDecoder()); + pipeline.addLast("stringEncoder", new StringEncoder()); pipeline.addLast("objectDecoder", new Xt013ProtocolDecoder(Xt013Protocol.this)); } }); diff --git a/src/org/traccar/web/WebServer.java b/src/org/traccar/web/WebServer.java index 73702cc3d..4ef31b1df 100644 --- a/src/org/traccar/web/WebServer.java +++ b/src/org/traccar/web/WebServer.java @@ -118,13 +118,9 @@ public class WebServer { resourceHandler.setResourceBase(config.getString("web.path")); if (config.getBoolean("web.debug")) { resourceHandler.setWelcomeFiles(new String[] {"debug.html"}); - //Troubleshooting Locked Files on Windows (changed by Erez) + //Troubleshooting Locked UI Files on Windows while app is running (like html, js, css, etc...), + //you can make changes to the UI Files and refresh the page in the browser without stopping the app first resourceHandler.setMinMemoryMappedContentLength(-1); - - /*DefaultServlet defaultServlet = new DefaultServlet(); - ServletHolder holder = new ServletHolder(defaultServlet); - holder.setInitParameter("useFileMappedBuffer", "false"); - handler.addServlet(holder, "/");*/ } else { resourceHandler.setWelcomeFiles(new String[] {"release.html", "index.html"}); } diff --git a/tools/minify.bat b/tools/minify.bat index dfa9c5895..6ab8fd94b 100644 --- a/tools/minify.bat +++ b/tools/minify.bat @@ -1,5 +1,5 @@ @echo off -cd C:\Users\Erez\Documents\traccar\web -set SDK=C:\inetpub\wwwroot\ext-6.0.0 +cd C:\[traccar path]\traccar\web +set SDK=C:\[sencha path]\ext-6.0.0 sencha -sdk %SDK% compile -classpath=app.js,app,%SDK%\packages\core\src,%SDK%\packages\core\overrides,%SDK%\classic\classic\src,%SDK%\classic\classic\overrides exclude -all and include -recursive -file app.js and exclude -namespace=Ext and concatenate -closure app.min.js diff --git a/tools/test-generator.py b/tools/test-generator.py index 4beadc375..09fb65611 100755 --- a/tools/test-generator.py +++ b/tools/test-generator.py @@ -32,7 +32,6 @@ for i in range(0, len(waypoints)): lon = lon1 + (lon2 - lon1) * j / count points.append((lat, lon)) -#changed by Erez def send(lat, lon, course, alarm): params = (('id', id), ('timestamp', int(time.time())), ('lat', lat), ('lon', lon), ('bearing', course)) if alarm: @@ -53,7 +52,7 @@ index = 0 while True: (lat1, lon1) = points[index % len(points)] (lat2, lon2) = points[(index + 1) % len(points)] - alarm = ((index % 10) == 0)#added by Erez + alarm = False #((index % 10) == 0) send(lat1, lon1, course(lat1, lon1, lat2, lon2), alarm) time.sleep(period) index += 1 diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index 51b479b9a..253dadb53 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -34,7 +34,6 @@ Ext.define('Traccar.AttributeFormatter', { return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit')); }, - //added by Erez alarmFormatter: function (attributes) { if (attributes instanceof Object) { if (attributes.hasOwnProperty('alarm')){ @@ -48,7 +47,6 @@ Ext.define('Traccar.AttributeFormatter', { return ''; }, - //added by Erez alarmTypeFormatter: function (attributes) { var alatmType = ''; if (attributes instanceof Object) { @@ -86,9 +84,9 @@ Ext.define('Traccar.AttributeFormatter', { return this.courseFormatter; } else if (key === 'distance' || key === 'odometer') { return this.distanceFormatter; - } else if (key === 'alarm') {//added by Erez + } else if (key === 'alarm') { return this.alarmFormatter; - } else if (key === 'alarm-type') {//added by Erez + } else if (key === 'alarm-type') { return this.alarmTypeFormatter; } else { return this.defaultFormatter; diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js index 4227fd1fb..b6e7d6ffd 100644 --- a/web/app/view/Devices.js +++ b/web/app/view/Devices.js @@ -58,7 +58,7 @@ Ext.define('Traccar.view.Devices', { }, { xtype: 'tbfill' },{ - id: 'showAlarmButton',//added by Erez + id: 'showAlarmButton', glyph: 'xf0a2@FontAwesome', tooltip: 'Show Alarms', tooltipType: 'title', diff --git a/web/app/view/Report.js b/web/app/view/Report.js index fcbd5c028..95f8144f2 100644 --- a/web/app/view/Report.js +++ b/web/app/view/Report.js @@ -116,12 +116,12 @@ Ext.define('Traccar.view.Report', { flex: 1, renderer: Traccar.AttributeFormatter.getFormatter('address') }, { - text: 'Alarm',//added by Erez + text: 'Alarm', dataIndex: 'attributes', flex: 1, renderer: Traccar.AttributeFormatter.getFormatter('alarm') }, { - text: 'Alarm Type',//added by Erez + text: 'Alarm Type', dataIndex: 'attributes', flex: 1, renderer: Traccar.AttributeFormatter.getFormatter('alarm-type') diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js index 20b6145ec..68ec3466d 100644 --- a/web/app/view/StateController.js +++ b/web/app/view/StateController.js @@ -62,7 +62,7 @@ Ext.define('Traccar.view.StateController', { if (this.deviceId === data[i].get('deviceId')) { this.updatePosition(data[i]); } - var position = data[i]; //added by Erez + var position = data[i]; var attributes = position.get('attributes'); if (attributes instanceof Object){ if (attributes.hasOwnProperty('alarm') && this.showAlarmSelected()) this.onAlarm(position.get('deviceId'), attributes); @@ -109,11 +109,11 @@ Ext.define('Traccar.view.StateController', { } }, - showAlarmSelected: function () {//added by Erez + showAlarmSelected: function () { return Ext.getCmp('showAlarmButton') && Ext.getCmp('showAlarmButton').pressed; }, - onAlarm: function(deviceId, attributes){//added by Erez + onAlarm: function(deviceId, attributes){ var alatmType = ''; for (key in attributes) { if (attributes.hasOwnProperty(key) && key.toLowerCase()=='alarm-type') { @@ -130,7 +130,7 @@ Ext.define('Traccar.view.StateController', { } }, - showAlarmMsg: function(msg){//added by Erez + showAlarmMsg: function(msg){ this.beep(); var alarmMsg = Ext.Msg.show({ title:'Alarm', @@ -146,7 +146,7 @@ Ext.define('Traccar.view.StateController', { }, - beep: function() {//added by Erez + beep: function() { if(this.snd == null){ this.snd = new Audio("data:audio/wav;base64,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SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU="); } -- cgit v1.2.3 From 4d55b911bd252c90d1d0ec4053d8502154192676 Mon Sep 17 00:00:00 2001 From: ninioe Date: Sun, 17 Jul 2016 09:54:15 +0300 Subject: Added AlertEventHandler & Mute button for all notifications --- debug.xml | 1 + src/org/traccar/BasePipelineFactory.java | 13 +++++-- src/org/traccar/events/AlertEventHandler.java | 46 ++++++++++++++++++++++ src/org/traccar/model/Event.java | 5 +++ src/org/traccar/model/Position.java | 1 - src/org/traccar/protocol/H02ProtocolDecoder.java | 12 +++--- tools/test-generator.py | 4 +- web/app/AttributeFormatter.js | 29 ++------------ web/app/controller/Root.js | 16 +++++++- web/app/view/Report.js | 5 --- web/app/view/StateController.js | 49 ------------------------ web/l10n/ar.json | 4 ++ web/l10n/bg.json | 4 ++ web/l10n/cs.json | 4 ++ web/l10n/da.json | 4 ++ web/l10n/de.json | 4 ++ web/l10n/el.json | 4 ++ web/l10n/en.json | 4 ++ web/l10n/es.json | 4 ++ web/l10n/fa.json | 4 ++ web/l10n/fi.json | 4 ++ web/l10n/fr.json | 4 ++ web/l10n/he.json | 4 ++ web/l10n/hu.json | 4 ++ web/l10n/id.json | 4 ++ web/l10n/it.json | 4 ++ web/l10n/ka.json | 4 ++ web/l10n/lo.json | 4 ++ web/l10n/lt.json | 4 ++ web/l10n/ml.json | 4 ++ web/l10n/ms.json | 4 ++ web/l10n/nb.json | 4 ++ web/l10n/ne.json | 4 ++ web/l10n/nl.json | 4 ++ web/l10n/nn.json | 4 ++ web/l10n/pl.json | 4 ++ web/l10n/pt.json | 4 ++ web/l10n/pt_BR.json | 4 ++ web/l10n/ro.json | 4 ++ web/l10n/ru.json | 4 ++ web/l10n/si.json | 4 ++ web/l10n/sk.json | 4 ++ web/l10n/sl.json | 4 ++ web/l10n/sr.json | 4 ++ web/l10n/ta.json | 4 ++ web/l10n/th.json | 4 ++ web/l10n/tr.json | 4 ++ web/l10n/uk.json | 4 ++ web/l10n/vi.json | 4 ++ web/l10n/zh.json | 4 ++ 50 files changed, 244 insertions(+), 93 deletions(-) create mode 100644 src/org/traccar/events/AlertEventHandler.java (limited to 'web') diff --git a/debug.xml b/debug.xml index 5c6a59f27..cf310fd04 100644 --- a/debug.xml +++ b/debug.xml @@ -47,6 +47,7 @@ 90 true true + true diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 691c31643..710eceebb 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -416,6 +416,7 @@ public class DataManager { Date dateBefore = new Date(lastUpdate.getTime() - histDays * 24 * 3600 * 1000); QueryBuilder.create(dataSource, sql) + .setLong("positionId", device.getPositionId()) .setLong("deviceId", device.getId()) .setDate("serverTime", dateBefore) .executeUpdate(); diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index 90923fe53..fd30fe7c9 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -81,7 +81,7 @@ Ext.define('Traccar.controller.Root', { this.asyncUpdate(true); } }); - Ext.get('attribution').remove(); + if (Ext.get('attribution') !== null) Ext.get('attribution').remove(); if (this.isPhone) { Ext.create('widget.mainMobile'); } else { -- cgit v1.2.3 From 729f34a34c4b3f857823293c8a46661f606cb03b Mon Sep 17 00:00:00 2001 From: ninioe Date: Sun, 24 Jul 2016 08:53:00 +0300 Subject: more fixes --- src/org/traccar/Main.java | 2 +- web/app/controller/Root.js | 20 ++++++++++---------- web/app/view/Devices.js | 4 ++-- web/l10n/en.json | 1 + 4 files changed, 14 insertions(+), 13 deletions(-) (limited to 'web') diff --git a/src/org/traccar/Main.java b/src/org/traccar/Main.java index 454124fbf..570becc2d 100644 --- a/src/org/traccar/Main.java +++ b/src/org/traccar/Main.java @@ -23,7 +23,7 @@ import java.util.TimerTask; import java.util.Locale; public final class Main { - static final long CLEAN_DELAY = 10 * 1000; + static final long CLEAN_DELAY = 500; static final long CLEAN_PERIOD = 24 * 60 * 60 * 1000; private Main() { diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index fd30fe7c9..367b98d88 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -90,14 +90,14 @@ Ext.define('Traccar.controller.Root', { }, beep: function () { - if (this.snd === null) { - this.snd = new Audio('beep.wav'); + if (this.beepSound === null) { + this.beepSound = new Audio('beep.wav'); } - this.snd.play(); + this.beepSound.play(); }, - showAlarmSelected: function () { - return Ext.getCmp('showAlarmButton') && Ext.getCmp('showAlarmButton').pressed; + showNotificationsSelected: function () { + return Ext.getCmp('showNotificationsButton') && Ext.getCmp('showNotificationsButton').pressed; }, asyncUpdate: function (first) { @@ -159,7 +159,7 @@ Ext.define('Traccar.controller.Root', { } else if (array[i].type === 'alarm' && data.positions) { alarmKey = 'alarm'; text = Strings[alarmKey]; - if (typeof text === 'undefined') { + if (!text) { text = alarmKey; } for (j = 0; j < data.positions.length; j++) { @@ -167,7 +167,7 @@ Ext.define('Traccar.controller.Root', { if (typeof data.positions[j].attributes.alarm === 'string' && data.positions[j].attributes.alarm.length >= 2) { alarmKey = 'alarm' + data.positions[j].attributes.alarm.charAt(0).toUpperCase() + data.positions[j].attributes.alarm.slice(1); text = Strings[alarmKey]; - if (typeof text === 'undefined') { + if (!text) { text = alarmKey; } } @@ -177,7 +177,7 @@ Ext.define('Traccar.controller.Root', { } else { typeKey = 'event' + array[i].type.charAt(0).toUpperCase() + array[i].type.slice(1); text = Strings[typeKey]; - if (typeof text === 'undefined') { + if (!text) { text = typeKey; } } @@ -189,9 +189,9 @@ Ext.define('Traccar.controller.Root', { } device = Ext.getStore('Devices').getById(array[i].deviceId); if (typeof device !== 'undefined') { - if (self.showAlarmSelected()) { + if (self.showNotificationsSelected()) { self.beep(); - Ext.toast(text, device.getData().name); + Ext.toast(text, device.get('name')); } } } diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js index 31d22ed2a..212aa7f96 100644 --- a/web/app/view/Devices.js +++ b/web/app/view/Devices.js @@ -58,9 +58,9 @@ Ext.define('Traccar.view.Devices', { }, { xtype: 'tbfill' },{ - id: 'showAlarmButton', + id: 'showNotificationsButton', glyph: 'xf0a2@FontAwesome', - tooltip: 'Show Alarms', + tooltip: Strings.showNotifications, tooltipType: 'title', pressed : true, enableToggle: true, diff --git a/web/l10n/en.json b/web/l10n/en.json index c5d67e8c1..d8dd016b5 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -19,6 +19,7 @@ "sharedSearch": "Search", "sharedGeofence": "Geofence", "sharedGeofences": "Geofences", + "showNotifications": "Show Notifications", "sharedNotifications": "Notifications", "sharedAttributes": "Attributes", "sharedAttribute": "Attribute", -- cgit v1.2.3 From fd3a695813f511d1b94775bd4e8a4c57053fc66d Mon Sep 17 00:00:00 2001 From: ninioe Date: Sun, 24 Jul 2016 09:34:41 +0300 Subject: more fix --- web/app/controller/Root.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web') diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index 367b98d88..53f3b83df 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -90,7 +90,7 @@ Ext.define('Traccar.controller.Root', { }, beep: function () { - if (this.beepSound === null) { + if (!this.beepSound) { this.beepSound = new Audio('beep.wav'); } this.beepSound.play(); -- cgit v1.2.3 From 3e1e90ef327102f5942884b8ba517971a47b2673 Mon Sep 17 00:00:00 2001 From: ninioe Date: Sun, 24 Jul 2016 11:56:46 +0300 Subject: more fixes --- src/org/traccar/Main.java | 2 +- web/app/controller/Root.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'web') diff --git a/src/org/traccar/Main.java b/src/org/traccar/Main.java index 570becc2d..e7e8d8ab9 100644 --- a/src/org/traccar/Main.java +++ b/src/org/traccar/Main.java @@ -23,7 +23,7 @@ import java.util.TimerTask; import java.util.Locale; public final class Main { - static final long CLEAN_DELAY = 500; + static final long CLEAN_DELAY = 0; static final long CLEAN_PERIOD = 24 * 60 * 60 * 1000; private Main() { diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index 53f3b83df..c8e708c09 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -81,7 +81,10 @@ Ext.define('Traccar.controller.Root', { this.asyncUpdate(true); } }); - if (Ext.get('attribution') !== null) Ext.get('attribution').remove(); + var attribution = Ext.get('attribution'); + if (attribution) { + attribution.remove(); + } if (this.isPhone) { Ext.create('widget.mainMobile'); } else { -- cgit v1.2.3 From 1e39c3dbf2078dbe9a99bdf25b944fbe05b8a40d Mon Sep 17 00:00:00 2001 From: ninioe Date: Sun, 24 Jul 2016 12:14:40 +0300 Subject: turn the toggle button into mute button default is muted --- web/app/controller/Root.js | 9 +++++---- web/app/view/Devices.js | 10 +++++----- web/l10n/en.json | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) (limited to 'web') diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index c8e708c09..7070c48b0 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -99,8 +99,9 @@ Ext.define('Traccar.controller.Root', { this.beepSound.play(); }, - showNotificationsSelected: function () { - return Ext.getCmp('showNotificationsButton') && Ext.getCmp('showNotificationsButton').pressed; + mutePressed: function () { + var muteButton = Ext.getCmp('nuteButton'); + return muteButton && !muteButton.pressed; }, asyncUpdate: function (first) { @@ -192,10 +193,10 @@ Ext.define('Traccar.controller.Root', { } device = Ext.getStore('Devices').getById(array[i].deviceId); if (typeof device !== 'undefined') { - if (self.showNotificationsSelected()) { + if (self.mutePressed()) { self.beep(); - Ext.toast(text, device.get('name')); } + Ext.toast(text, device.get('name')); } } } diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js index 212aa7f96..63569bd95 100644 --- a/web/app/view/Devices.js +++ b/web/app/view/Devices.js @@ -58,18 +58,18 @@ Ext.define('Traccar.view.Devices', { }, { xtype: 'tbfill' },{ - id: 'showNotificationsButton', - glyph: 'xf0a2@FontAwesome', - tooltip: Strings.showNotifications, + id: 'nuteButton', + glyph: 'xf1f7@FontAwesome', + tooltip: Strings.nuteButton, tooltipType: 'title', pressed : true, enableToggle: true, listeners: { toggle: function (button, pressed) { if (pressed) { - button.setGlyph('xf0a2@FontAwesome'); - } else { button.setGlyph('xf1f7@FontAwesome'); + } else { + button.setGlyph('xf0a2@FontAwesome'); } }, scope: this diff --git a/web/l10n/en.json b/web/l10n/en.json index d8dd016b5..4e0f42fe3 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -19,7 +19,7 @@ "sharedSearch": "Search", "sharedGeofence": "Geofence", "sharedGeofences": "Geofences", - "showNotifications": "Show Notifications", + "nuteButton": "Mute", "sharedNotifications": "Notifications", "sharedAttributes": "Attributes", "sharedAttribute": "Attribute", -- cgit v1.2.3 From b4841fa0a6293c0b895cf6bb65c6c2d871c78397 Mon Sep 17 00:00:00 2001 From: ninioe Date: Sun, 24 Jul 2016 14:01:30 +0300 Subject: typo mistake fix --- web/app/view/Devices.js | 2 +- web/l10n/en.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'web') diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js index 63569bd95..da7695229 100644 --- a/web/app/view/Devices.js +++ b/web/app/view/Devices.js @@ -60,7 +60,7 @@ Ext.define('Traccar.view.Devices', { },{ id: 'nuteButton', glyph: 'xf1f7@FontAwesome', - tooltip: Strings.nuteButton, + tooltip: Strings.muteButton, tooltipType: 'title', pressed : true, enableToggle: true, diff --git a/web/l10n/en.json b/web/l10n/en.json index 4e0f42fe3..32a2a45a4 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -19,7 +19,7 @@ "sharedSearch": "Search", "sharedGeofence": "Geofence", "sharedGeofences": "Geofences", - "nuteButton": "Mute", + "muteButton": "Mute", "sharedNotifications": "Notifications", "sharedAttributes": "Attributes", "sharedAttribute": "Attribute", -- cgit v1.2.3