aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-03-07 16:42:14 +1300
committerGitHub <noreply@github.com>2017-03-07 16:42:14 +1300
commit54867872a7e227742418037ce01da675587cd92b (patch)
treed85a3b1360d76223b64488575394517f7111ab13 /src/org/traccar/database
parentdc79a5ce6d9776db30d357dfb16dff624db770dd (diff)
parent679f838e8bd0caaea94b1d4d1cd9b740ea3b9606 (diff)
downloadtrackermap-server-54867872a7e227742418037ce01da675587cd92b.tar.gz
trackermap-server-54867872a7e227742418037ce01da675587cd92b.tar.bz2
trackermap-server-54867872a7e227742418037ce01da675587cd92b.zip
Merge pull request #2982 from Abyss777/rename_data_and_text
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));
}