aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-30 11:49:39 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-30 11:49:39 -0700
commit154ff3b2175e67b3fac531cb9c5c5c68880f5e12 (patch)
treef448a59c75b64deea60b1bd6e79d66790f62a4a8 /src/main/java/org/traccar/protocol
parentb1a971eedb18a11af2cdc70ba5f8004bae89defd (diff)
downloadtrackermap-server-154ff3b2175e67b3fac531cb9c5c5c68880f5e12.tar.gz
trackermap-server-154ff3b2175e67b3fac531cb9c5c5c68880f5e12.tar.bz2
trackermap-server-154ff3b2175e67b3fac531cb9c5c5c68880f5e12.zip
Inject media manager
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r--src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java2
-rw-r--r--src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java3
-rw-r--r--src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java3
-rw-r--r--src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java2
-rw-r--r--src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java3
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java6
-rw-r--r--src/main/java/org/traccar/protocol/MeiligaoProtocolDecoder.java2
-rw-r--r--src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java2
-rw-r--r--src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java2
-rw-r--r--src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java3
-rw-r--r--src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java2
-rw-r--r--src/main/java/org/traccar/protocol/WatchProtocolDecoder.java7
12 files changed, 15 insertions, 22 deletions
diff --git a/src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java
index 186b81470..247a1b696 100644
--- a/src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/AtrackProtocolDecoder.java
@@ -626,7 +626,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, new Date(time * 1000));
- position.set(Position.KEY_IMAGE, Context.getMediaManager().writeFile(String.valueOf(id), photo, "jpg"));
+ position.set(Position.KEY_IMAGE, writeMediaFile(String.valueOf(id), photo, "jpg"));
photo.release();
photo = null;
diff --git a/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java b/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java
index c64b8171f..3c15d41eb 100644
--- a/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/DualcamProtocolDecoder.java
@@ -19,7 +19,6 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.Context;
import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
@@ -98,7 +97,7 @@ public class DualcamProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(deviceSession.getDeviceId());
getLastLocation(position, null);
try {
- position.set(Position.KEY_IMAGE, Context.getMediaManager().writeFile(uniqueId, photo, "jpg"));
+ position.set(Position.KEY_IMAGE, writeMediaFile(uniqueId, photo, "jpg"));
} finally {
photo.release();
photo = null;
diff --git a/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
index 5f9326a61..53f35c3cd 100644
--- a/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/FifotrackProtocolDecoder.java
@@ -19,7 +19,6 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.Context;
import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
@@ -381,7 +380,7 @@ public class FifotrackProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(getDeviceSession(channel, remoteAddress, imei).getDeviceId());
getLastLocation(position, null);
- position.set(Position.KEY_IMAGE, Context.getMediaManager().writeFile(imei, photo, "jpg"));
+ position.set(Position.KEY_IMAGE, writeMediaFile(imei, photo, "jpg"));
photo.release();
photo = null;
return position;
diff --git a/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java b/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java
index f29fb9850..eb553c5a9 100644
--- a/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/GalileoProtocolDecoder.java
@@ -329,7 +329,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
- position.set(Position.KEY_IMAGE, Context.getMediaManager().writeFile(uniqueId, photo, "jpg"));
+ position.set(Position.KEY_IMAGE, writeMediaFile(uniqueId, photo, "jpg"));
photo.release();
photo = null;
diff --git a/src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java
index d74f19179..d5aa45b9c 100644
--- a/src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -19,7 +19,6 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.Context;
import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
@@ -361,7 +360,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
try {
- position.set(Position.KEY_IMAGE, Context.getMediaManager().writeFile(imei, photo, "jpg"));
+ position.set(Position.KEY_IMAGE, writeMediaFile(imei, photo, "jpg"));
} finally {
photoPackets = 0;
photo.release();
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
index 89931f614..832645374 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -1028,8 +1028,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
sendPhotoRequest(channel, pictureId);
} else {
Device device = Context.getDeviceManager().getById(deviceSession.getDeviceId());
- position.set(
- Position.KEY_IMAGE, Context.getMediaManager().writeFile(device.getUniqueId(), photo, "jpg"));
+ position.set(Position.KEY_IMAGE, writeMediaFile(device.getUniqueId(), photo, "jpg"));
photos.remove(pictureId).release();
}
@@ -1265,8 +1264,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(deviceSession.getDeviceId());
getLastLocation(position, new Date(timestamp));
Device device = Context.getDeviceManager().getById(deviceSession.getDeviceId());
- position.set(Position.KEY_IMAGE,
- Context.getMediaManager().writeFile(device.getUniqueId(), photo, "jpg"));
+ position.set(Position.KEY_IMAGE, writeMediaFile(device.getUniqueId(), photo, "jpg"));
photos.remove(mediaId).release();
}
}
diff --git a/src/main/java/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/MeiligaoProtocolDecoder.java
index d38e5d1c3..a25cab06f 100644
--- a/src/main/java/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -472,7 +472,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
String uniqueId = Context.getIdentityManager().getById(deviceSession.getDeviceId()).getUniqueId();
ByteBuf photo = photos.remove(imageIndex);
try {
- position.set(Position.KEY_IMAGE, Context.getMediaManager().writeFile(uniqueId, photo, "jpg"));
+ position.set(Position.KEY_IMAGE, writeMediaFile(uniqueId, photo, "jpg"));
} finally {
photo.release();
}
diff --git a/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java
index 013e297c0..6fed56fb6 100644
--- a/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -589,7 +589,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
- position.set(Position.KEY_IMAGE, Context.getMediaManager().writeFile(imei, photo, "jpg"));
+ position.set(Position.KEY_IMAGE, writeMediaFile(imei, photo, "jpg"));
photo.release();
photo = null;
diff --git a/src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java
index ff92b51f1..5e24cacdc 100644
--- a/src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Pt502ProtocolDecoder.java
@@ -182,7 +182,7 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
- position.set(Position.KEY_IMAGE, Context.getMediaManager().writeFile(uniqueId, photo, "jpg"));
+ position.set(Position.KEY_IMAGE, writeMediaFile(uniqueId, photo, "jpg"));
photo.release();
photo = null;
diff --git a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java
index 5a0383358..7abb52bd0 100644
--- a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java
@@ -19,7 +19,6 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.Context;
import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
@@ -298,7 +297,7 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
getLastLocation(position, null);
- position.set(Position.KEY_IMAGE, Context.getMediaManager().writeFile(imei, photo, "jpg"));
+ position.set(Position.KEY_IMAGE, writeMediaFile(imei, photo, "jpg"));
photo.release();
photo = null;
return position;
diff --git a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
index f83a49941..61a61b900 100644
--- a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -148,7 +148,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
String uniqueId = Context.getIdentityManager().getById(position.getDeviceId()).getUniqueId();
photos.remove(photoId);
try {
- position.set(Position.KEY_IMAGE, Context.getMediaManager().writeFile(uniqueId, photo, "jpg"));
+ position.set(Position.KEY_IMAGE, writeMediaFile(uniqueId, photo, "jpg"));
} finally {
photo.release();
}
diff --git a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java
index 420866578..3967fb804 100644
--- a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java
@@ -19,7 +19,6 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.Context;
import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
@@ -313,7 +312,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
int timeIndex = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) ',');
buf.readerIndex(timeIndex + 12 + 2);
- position.set(Position.KEY_IMAGE, Context.getMediaManager().writeFile(id, buf, "jpg"));
+ position.set(Position.KEY_IMAGE, writeMediaFile(id, buf, "jpg"));
return position;
@@ -339,7 +338,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
getLastLocation(position, null);
- position.set(Position.KEY_AUDIO, Context.getMediaManager().writeFile(id, audio, "amr"));
+ position.set(Position.KEY_AUDIO, writeMediaFile(id, audio, "amr"));
audio.release();
audio = null;
return position;
@@ -356,7 +355,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
- position.set(Position.KEY_AUDIO, Context.getMediaManager().writeFile(id, buf, "amr"));
+ position.set(Position.KEY_AUDIO, writeMediaFile(id, buf, "amr"));
return position;