diff options
author | Abraham Toriz <awonderfulcode@gmail.com> | 2017-11-29 11:03:16 -0600 |
---|---|---|
committer | Abraham Toriz <awonderfulcode@gmail.com> | 2017-11-29 11:07:49 -0600 |
commit | f8ccdd8345b010310e45f80608ef2937002231a2 (patch) | |
tree | 2cfafdab5a1436af478068bbd7d6683d54f88517 | |
parent | e12632548a71345acc0349ba9db1321cfa628911 (diff) | |
download | traccar-server-f8ccdd8345b010310e45f80608ef2937002231a2.tar.gz traccar-server-f8ccdd8345b010310e45f80608ef2937002231a2.tar.bz2 traccar-server-f8ccdd8345b010310e45f80608ef2937002231a2.zip |
handle cut power alarm for pt502
-rw-r--r-- | src/org/traccar/protocol/Pt502ProtocolDecoder.java | 2 | ||||
-rw-r--r-- | test/org/traccar/protocol/Pt502ProtocolDecoderTest.java | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/Pt502ProtocolDecoder.java b/src/org/traccar/protocol/Pt502ProtocolDecoder.java index 1d976dcd5..330ba7643 100644 --- a/src/org/traccar/protocol/Pt502ProtocolDecoder.java +++ b/src/org/traccar/protocol/Pt502ProtocolDecoder.java @@ -78,6 +78,8 @@ public class Pt502ProtocolDecoder extends BaseProtocolDecoder { return Position.ALARM_VIBRATION;
case "PMA":
return Position.ALARM_MOVEMENT;
+ case "CPA":
+ return Position.ALARM_POWER_CUT;
default:
return null;
}
diff --git a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java index fe66876ed..8fd1b4ff7 100644 --- a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java @@ -2,6 +2,7 @@ package org.traccar.protocol; import org.junit.Test; import org.traccar.ProtocolTest; +import org.traccar.model.Position; public class Pt502ProtocolDecoderTest extends ProtocolTest { @@ -39,7 +40,10 @@ public class Pt502ProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, text( "$FDA,40456789,083125.000,A,2232.0971,N,11400.9504,E,0.0,5.00,090714,,,A/00000,00/0,0/200076//FE7/")); - + + verifyAttribute(decoder, text( + "$CPA,40456789,083125.000,A,2232.0971,N,11400.9504,E,7.62,265.24,291117,,,A/00000,00000/0/1200//#"), Position.KEY_ALARM, Position.ALARM_POWER_CUT); + verifyPosition(decoder, text( "$POS,216769295715,163237.000,A,3258.1738,S,02755.4350,E,0.00,215.88,100915,,,A/0000,0//232300//5b3/"), position("2015-09-10 16:32:37.000", true, -32.96956, 27.92392)); @@ -61,13 +65,13 @@ public class Pt502ProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, text( "$PHO0,6091,233606.000,A,0902.9855,N,06944.3654,W,0.0,43.8,141112,,,A/00010,00000/0/224000//")); - + verifyPosition(decoder, text( "$POS,353451000164,082405.000,A,1254.8501,N,10051.6752,E,0.00,237.99,160513,,,A/0000,0/0/55000//a71/")); - + verifyPosition(decoder, text( "$POS,012896008586486,154215.000,A,0118.0143,S,03646.9144,E,0.00,83.29,180714,,,A/0000,0/0/29200//644/")); - + verifyPosition(decoder, text( "$POS,1151000,205326.000,A,0901.3037,N,07928.2751,W,48.79,30.55,170814,,,A/00010,10000/0,0,0,0/15986500//fb8/")); |