aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-29 11:38:49 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-29 11:38:49 +1200
commita10e925a97cf839a5c30fb7891af12bc111b14c4 (patch)
tree2f81727373e22058c16fb4d9cf48ad374c20f10e /src/org/traccar
parent411f631b6a9dd898476b43d342180db02e45dd9c (diff)
downloadtraccar-server-a10e925a97cf839a5c30fb7891af12bc111b14c4.tar.gz
traccar-server-a10e925a97cf839a5c30fb7891af12bc111b14c4.tar.bz2
traccar-server-a10e925a97cf839a5c30fb7891af12bc111b14c4.zip
Update Totem commands
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;