aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol/CarscopProtocolDecoderTest.java
blob: ab64ddd3cb5501bd1efc778c600ce9eb8d6d78d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package org.traccar.protocol;

import org.junit.Test;
import org.traccar.ProtocolTest;

public class CarscopProtocolDecoderTest extends ProtocolTest {

    @Test
    public void testDecode() throws Exception {

        CarscopProtocolDecoder decoder = new CarscopProtocolDecoder(new CarscopProtocol());

        verifyNothing(decoder, text(
                "*160618233129UB00HSO"));

        verifyNothing(decoder, text(
                "*160618232614UD00232614A5009.1747N01910.3829E0.000160618298.2811000000L000000"));

        verifyNothing(decoder, text(
                "*160618232529UB05CW9999C00000538232529A5009.1747N01910.3829E0.000160618298.2811000000L000000"));

        verifyPosition(decoder, text(
                "*040331141830UB05123456789012345061825A2934.0133N10627.2544E000.0040331309.6200000000L000000"),
                position("2004-03-31 06:18:25.000", true, 29.56689, 106.45424));

        verifyPosition(decoder, text(
                "*040331141830UB04999999984061825A2934.0133N10627.2544E000.0040331309.6200000000L000000"));

        verifyPosition(decoder, text(
                "*040331141830UA012Hi-jack061825A2934.0133N10627.2544E000.0040331309.6200000000L000000"));

        verifyPosition(decoder, text(
                "*150817160254UB05CC8011400042499160254A2106.8799S14910.2583E000.0150817158.3511111111L000000"));

    }

}