package org.traccar.protocol;

import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import org.traccar.helper.ChannelBufferTools;
import static org.traccar.helper.DecoderVerifier.verify;

public class CastelProtocolDecoderTest extends ProtocolDecoderTest {

    @Test
    public void testDecode() throws Exception {

        CastelProtocolDecoder decoder = new CastelProtocolDecoder(null);

        assertNull(decoder.decode(null, null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
                "40401F00043130303131313235323939383700000000000000100303320D0A"))));

        verify(decoder.decode(null, null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
                "40407F000431303031313132353239393837000000000000001001C1F06952FDF069529C91110000000000698300000C0000000000036401014C00030001190A0D04121A1480D60488C5721800000000AF4944445F3231364730325F532056312E322E31004944445F3231364730325F482056312E322E31000000DF640D0A"))));

        //verify(decoder.decode(null, null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
        //        "404057000431303031313132353239393837000000000000004002C1F06952F0F169529C9111000000000069830000470000000400036401014C01030078000505210C210D210F21102101073BE8030064280AEB930D0A"))));

    }

}

@@ -1126,18 +1126,16 @@
         
-//
 verify(d
@@ -1269,10 +1269,8 @@
     
-//
     
@@ -1279,17 +1279,17 @@
   %2240405
-7
+9
 00043130
@@ -1331,17 +1331,19 @@
 0400
-2
+101
 C1F06952
 F0F1
@@ -1342,12 +1342,12 @@
 6952
+E7
 F0
-F1
 6952
@@ -1370,17 +1370,17 @@
 69830000
-4
+0
 70000000
@@ -1397,61 +1397,63 @@
 14C0
-1
+0
 0300
-78000505210C210D210F21102101073BE8030064280AEB93
+01190A0D0412041480D60488C57218000000009F01E803ED9A
 0D0A

Add GPS message to unit test