diff options
author | Gavriel Fleischer <flocsy@gmail.com> | 2019-02-12 03:45:44 +0200 |
---|---|---|
committer | Gavriel Fleischer <flocsy@gmail.com> | 2019-02-12 03:45:44 +0200 |
commit | c1de08db7773eef6b1ed4a6e2b62f15d1df6a2a5 (patch) | |
tree | 7690af5fb65cf4c81c1535a9958f688badf886c8 /test/org/traccar/protocol | |
parent | c37ebc1b07ba7ea6eeccc0b04b2cac72041507e0 (diff) | |
download | traccar-server-c1de08db7773eef6b1ed4a6e2b62f15d1df6a2a5.tar.gz traccar-server-c1de08db7773eef6b1ed4a6e2b62f15d1df6a2a5.tar.bz2 traccar-server-c1de08db7773eef6b1ed4a6e2b62f15d1df6a2a5.zip |
fixed 8bit voice message
Diffstat (limited to 'test/org/traccar/protocol')
-rw-r--r-- | test/org/traccar/protocol/WatchProtocolEncoderTest.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/WatchProtocolEncoderTest.java b/test/org/traccar/protocol/WatchProtocolEncoderTest.java index f55086082..05faa1f53 100644 --- a/test/org/traccar/protocol/WatchProtocolEncoderTest.java +++ b/test/org/traccar/protocol/WatchProtocolEncoderTest.java @@ -4,6 +4,8 @@ import org.junit.Test; import org.traccar.ProtocolTest; import org.traccar.model.Command; +import java.nio.charset.StandardCharsets; + import static org.junit.Assert.assertEquals; public class WatchProtocolEncoderTest extends ProtocolTest { @@ -41,6 +43,18 @@ public class WatchProtocolEncoderTest extends ProtocolTest { command = new Command(); command.setDeviceId(1); + command.setType(Command.TYPE_VOICE_MESSAGE); + command.set(Command.KEY_DATA, "ff"); + assertEquals("[CS*123456789012345*0004*TK," + binary("ff").toString(StandardCharsets.ISO_8859_1) + ']', encoder.encodeCommand(null, command)); + + command = new Command(); + command.setDeviceId(1); + command.setType(Command.TYPE_VOICE_MESSAGE); + command.set(Command.KEY_DATA, "7d5b5d2c2a"); + assertEquals("[CS*123456789012345*000d*TK," + binary("7d017d027d037d047d05").toString(StandardCharsets.ISO_8859_1) + ']', encoder.encodeCommand(null, command)); + + command = new Command(); + command.setDeviceId(1); command.setType(Command.TYPE_MESSAGE); command.set(Command.KEY_MESSAGE, "text"); assertEquals("[CS*123456789012345*0018*MESSAGE,0074006500780074]", encoder.encodeCommand(null, command)); |