diff options
author | Anton Tananaev <anton@traccar.org> | 2023-02-25 16:12:31 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-02-25 16:12:31 -0800 |
commit | dfc546a26f5b7b9486df31ccce812f44bd41168f (patch) | |
tree | 9a6fc2d84659af286685b62b5441a8c9a32c8a41 /src | |
parent | 5b77d6297eaf171595ca0eedb50e434eb073c8ac (diff) | |
download | trackermap-server-dfc546a26f5b7b9486df31ccce812f44bd41168f.tar.gz trackermap-server-dfc546a26f5b7b9486df31ccce812f44bd41168f.tar.bz2 trackermap-server-dfc546a26f5b7b9486df31ccce812f44bd41168f.zip |
Meitrack TA255 battery level
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java | 5 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/MeitrackProtocolDecoderTest.java | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java index 5c5ba4be4..3acd87b8f 100644 --- a/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -553,6 +553,11 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedByte(); // alarm type buf.skipBytes(length - 2); break; + case 0xFEA8: + buf.readUnsignedByte(); // battery status + position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte()); + buf.readUnsignedByte(); // battery alert + break; default: buf.skipBytes(length); break; diff --git a/src/test/java/org/traccar/protocol/MeitrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MeitrackProtocolDecoderTest.java index 419eddf63..853345521 100644 --- a/src/test/java/org/traccar/protocol/MeitrackProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/MeitrackProtocolDecoderTest.java @@ -12,6 +12,10 @@ public class MeitrackProtocolDecoderTest extends ProtocolTest { var decoder = inject(new MeitrackProtocolDecoder(null)); verifyAttribute(decoder, binary( + "2424663137302c3836353431333035303839313733372c4343452c00000000010088001800050501060907101400150008080000091c000a18000b1e001606001a0000402300fe9000000602d5fe5ffe038f2a1f0904102c8d2b0cd23f02000df03203001c01000000050e0cf90101003170017ac80892ff4b16010113464444204c5445284c54452042414e44203329fea50601ffffff7ffffea807024d0000000000feb20501010000002a36430d0a"), + Position.KEY_BATTERY_LEVEL, 77); + + verifyAttribute(decoder, binary( "24245b3131342c3836343630363034343939333938372c4343452c0000000001005000130006012305000600070f1b004702060800000900000a00000b0000199d011a00000602d179570103b25ccc0604cf04862b0cc65b01000da4090d001c01000000010e0ccc010000b627be11000000002a41300d0a"), Position.KEY_LOCK, true); |