diff options
author | Abyss777 <abyss@fox5.ru> | 2017-03-02 17:05:25 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-03-02 17:06:48 +0500 |
commit | 6ff73337236f126839e8ce936ba9d201e8a501c7 (patch) | |
tree | eff0c6fc8b121e528ad80ce2ab573f8e08625b52 /src/org/traccar/BaseProtocol.java | |
parent | 5a964d4adf67d2f49b58f0b14d4388d7aa2353d2 (diff) | |
download | trackermap-server-6ff73337236f126839e8ce936ba9d201e8a501c7.tar.gz trackermap-server-6ff73337236f126839e8ce936ba9d201e8a501c7.tar.bz2 trackermap-server-6ff73337236f126839e8ce936ba9d201e8a501c7.zip |
Remove BaseProtocolSmsEncoder class
Add fallback to SMS if device is not online
Use more variables and ternary operators
Diffstat (limited to 'src/org/traccar/BaseProtocol.java')
-rw-r--r-- | src/org/traccar/BaseProtocol.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/org/traccar/BaseProtocol.java b/src/org/traccar/BaseProtocol.java index e9a8a9713..9a03fbff4 100644 --- a/src/org/traccar/BaseProtocol.java +++ b/src/org/traccar/BaseProtocol.java @@ -37,7 +37,7 @@ public abstract class BaseProtocol implements Protocol { private final Set<String> supportedCommands = new HashSet<>(); private final Set<String> supportedSmsCommands = new HashSet<>(); - private BaseProtocolSmsEncoder smsEncoder = null; + private StringProtocolEncoder smsEncoder = null; public BaseProtocol(String name) { this.name = name; @@ -86,7 +86,7 @@ public abstract class BaseProtocol implements Protocol { } } - public void setSmsEncoder(BaseProtocolSmsEncoder smsEncoder) { + public void setSmsEncoder(StringProtocolEncoder smsEncoder) { this.smsEncoder = smsEncoder; } @@ -97,7 +97,7 @@ public abstract class BaseProtocol implements Protocol { if (command.getType().equals(Command.TYPE_CUSTOM)) { Context.getSmppManager().sendMessageSync(phone, command.getString(Command.KEY_DATA), true); } else if (supportedSmsCommands.contains(command.getType()) && smsEncoder != null) { - Context.getSmppManager().sendMessageSync(phone, smsEncoder.encodeSmsCommand(command), true); + Context.getSmppManager().sendMessageSync(phone, (String) smsEncoder.encodeCommand(command), true); } else { throw new RuntimeException( "Command " + command.getType() + " is not supported in protocol " + getName()); |