diff options
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r-- | src/org/traccar/database/ActiveDevice.java | 2 | ||||
-rw-r--r-- | src/org/traccar/database/DeviceManager.java | 16 |
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)); } |