aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-03-06 10:07:43 +0500
committerAbyss777 <abyss@fox5.ru>2017-03-06 10:25:28 +0500
commit679f838e8bd0caaea94b1d4d1cd9b740ea3b9606 (patch)
tree5615803d51c2c321514f70dd36ae92143e233ac7 /src/org/traccar/database
parentcbb28de69d4da85b3baff9967549d35952164a31 (diff)
downloadtraccar-server-679f838e8bd0caaea94b1d4d1cd9b740ea3b9606.tar.gz
traccar-server-679f838e8bd0caaea94b1d4d1cd9b740ea3b9606.tar.bz2
traccar-server-679f838e8bd0caaea94b1d4d1cd9b740ea3b9606.zip
Introduce terms "data" and "text" commands
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/ActiveDevice.java2
-rw-r--r--src/org/traccar/database/DeviceManager.java16
2 files changed, 9 insertions, 9 deletions
diff --git a/src/org/traccar/database/ActiveDevice.java b/src/org/traccar/database/ActiveDevice.java
index 9c96382fe..f491111e1 100644
--- a/src/org/traccar/database/ActiveDevice.java
+++ b/src/org/traccar/database/ActiveDevice.java
@@ -44,7 +44,7 @@ public class ActiveDevice {
}
public void sendCommand(Command command) {
- protocol.sendCommand(this, command);
+ protocol.sendDataCommand(this, command);
}
public void write(Object message) {
diff --git a/src/org/traccar/database/DeviceManager.java b/src/org/traccar/database/DeviceManager.java
index 8b28bec9d..f5fde9e1f 100644
--- a/src/org/traccar/database/DeviceManager.java
+++ b/src/org/traccar/database/DeviceManager.java
@@ -56,14 +56,14 @@ public class DeviceManager implements IdentityManager {
private final Map<Long, Position> positions = new ConcurrentHashMap<>();
- private boolean fallbackToSms;
+ private boolean fallbackToText;
public DeviceManager(DataManager dataManager) {
this.dataManager = dataManager;
this.config = Context.getConfig();
dataRefreshDelay = config.getLong("database.refreshDelay", DEFAULT_REFRESH_DELAY) * 1000;
lookupGroupsAttribute = config.getBoolean("deviceManager.lookupGroupsAttribute");
- fallbackToSms = config.getBoolean("command.fallbackToSms");
+ fallbackToText = config.getBoolean("command.fallbackToSms");
if (dataManager != null) {
try {
updateGroupCache(true);
@@ -429,11 +429,11 @@ public class DeviceManager implements IdentityManager {
public void sendCommand(Command command) throws Exception {
long deviceId = command.getDeviceId();
- if (command.getSms()) {
+ if (command.getTextChannel()) {
Position lastPosition = getLastPosition(deviceId);
if (lastPosition != null) {
BaseProtocol protocol = Context.getServerManager().getProtocol(lastPosition.getProtocol());
- protocol.sendSmsCommand(devicesById.get(deviceId).getPhone(), command);
+ protocol.sendTextCommand(devicesById.get(deviceId).getPhone(), command);
} else if (command.getType().equals(Command.TYPE_CUSTOM)) {
Context.getSmppManager().sendMessageSync(devicesById.get(deviceId).getPhone(),
command.getString(Command.KEY_DATA), true);
@@ -445,8 +445,8 @@ public class DeviceManager implements IdentityManager {
if (activeDevice != null) {
activeDevice.sendCommand(command);
} else {
- if (fallbackToSms) {
- command.setSms(true);
+ if (fallbackToText) {
+ command.setTextChannel(true);
sendCommand(command);
} else {
throw new RuntimeException("Device is not online");
@@ -455,13 +455,13 @@ public class DeviceManager implements IdentityManager {
}
}
- public Collection<CommandType> getCommandTypes(long deviceId, boolean sms) {
+ public Collection<CommandType> getCommandTypes(long deviceId, boolean textChannel) {
List<CommandType> result = new ArrayList<>();
Position lastPosition = Context.getDeviceManager().getLastPosition(deviceId);
if (lastPosition != null) {
BaseProtocol protocol = Context.getServerManager().getProtocol(lastPosition.getProtocol());
Collection<String> commands;
- commands = sms ? protocol.getSupportedSmsCommands() : protocol.getSupportedCommands();
+ commands = textChannel ? protocol.getSupportedTextCommands() : protocol.getSupportedDataCommands();
for (String commandKey : commands) {
result.add(new CommandType(commandKey));
}