aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/model/Command.java4
-rw-r--r--src/org/traccar/protocol/TotemProtocolEncoder.java22
2 files changed, 17 insertions, 9 deletions
diff --git a/src/org/traccar/model/Command.java b/src/org/traccar/model/Command.java
index 8c4e3f0f1..defa904f7 100644
--- a/src/org/traccar/model/Command.java
+++ b/src/org/traccar/model/Command.java
@@ -25,11 +25,11 @@ public class Command implements Factory {
public static final String TYPE_POSITION_STOP = "positionStop";
public static final String TYPE_POSITION_FIX = "positionFix";
public static final String TYPE_ENGINE_STOP = "engineStop";
- public static final String TYPE_ENGINE_RESUME = "engineResume";
+ public static final String TYPE_ENGINE_RESUME = "engineResume";
public static final String KEY_UNIQUE_ID = "uniqueId";
public static final String KEY_FREQUENCY = "frequency";
- public static final String KEY_GPS_PASSWORD = "gpsPassword";
+ public static final String KEY_DEVICE_PASSWORD = "devicePassword";
}
diff --git a/src/org/traccar/protocol/TotemProtocolEncoder.java b/src/org/traccar/protocol/TotemProtocolEncoder.java
index d236a7e2c..39e3214cc 100644
--- a/src/org/traccar/protocol/TotemProtocolEncoder.java
+++ b/src/org/traccar/protocol/TotemProtocolEncoder.java
@@ -1,5 +1,6 @@
/*
- * Copyright 2015 alexis.
+ * Copyright 2015 Irving Gonzalez
+ * Copyright 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.
@@ -18,21 +19,28 @@ package org.traccar.protocol;
import org.traccar.StringProtocolEncoder;
import org.traccar.model.Command;
-/**
- *
- * @author Irving Gonzalez [ialexis93@gmail.com]
- */
+import java.util.HashMap;
+import java.util.Map;
+
public class TotemProtocolEncoder extends StringProtocolEncoder{
@Override
protected Object encodeCommand(Command command) {
+
+ // Temporary put default password
+ Map<String, Object> other = command.getOther();
+ if (other == null) {
+ other = new HashMap<>();
+ command.setOther(other);
+ }
+ other.put(Command.KEY_DEVICE_PASSWORD, "000000");
switch (command.getType()) {
//Assuming PIN 8 (Output C) is the power wire, like manual says but it can be PIN 5,7,8
case Command.TYPE_ENGINE_STOP:
- return formatCommand(command, "*{%s},025,C,1#", Command.KEY_GPS_PASSWORD);
+ return formatCommand(command, "*{%s},025,C,1#", Command.KEY_DEVICE_PASSWORD);
case Command.TYPE_ENGINE_RESUME:
- return formatCommand(command, "*{%s},025,C,0#", Command.KEY_GPS_PASSWORD);
+ return formatCommand(command, "*{%s},025,C,0#", Command.KEY_DEVICE_PASSWORD);
}
return null;