diff --git a/src/bits/SyncPattern.java b/src/bits/SyncPattern.java index afafed55..4b4547bc 100644 --- a/src/bits/SyncPattern.java +++ b/src/bits/SyncPattern.java @@ -75,19 +75,18 @@ public enum SyncPattern }), /** - * French variant of MPT-1327. This variant uses the following reversal - * pattern and sync pattern: + * French variant of MPT-1327. This variant uses the following a different + * sync pattern: * - * REV: 0101 0101 0100 1011 - * SYNC: 1100 1100 0111 1111 + * SYNC: 1011 0100 0011 0011 */ MPT1327_CONTROL_FRENCH( new boolean[] { - true, false, true, true, //Includes final 4 of 16 rev bits - true, true, false, false, //1100 0xA - true, true, false, false, //1100 0xA - false, true, true, true, //0111 0x7 - true, true, true, true, //1111 0xF + true, false, true, false, //Includes final 4 of 16 rev bits + true, false, true, true, //1011 0xB + false, true, false, false, //0100 0x4 + false, false, true, true, //0011 0x3 + false, false, true, true //0011 0x3 }), /* Revs (0xA) and Sync(0x3B28) = 1010 0011101100101000 */ @@ -100,6 +99,21 @@ public enum SyncPattern true, false, false, false //1000 0x8 }), + /** + * French variant of MPT-1327. This variant uses the following a different + * sync pattern: + * + * SYNT: 0100 1011 1100 1100 + */ + MPT1327_TRAFFIC_FRENCH( new boolean[] + { + true, false, true, false, //Includes final 4 of 16 rev bits + false, true, false, false, //0100 0x4 + true, false, true, true, //1011 0xB + true, true, false, false, //1100 0xC + true, true, false, false //1100 0xC + }), + /* Sync (0x158) = 1101011000 */ PASSPORT( new boolean[] { diff --git a/src/crc/CRCFleetsync.java b/src/crc/CRCFleetsync.java index 742bf682..49da9cbf 100644 --- a/src/crc/CRCFleetsync.java +++ b/src/crc/CRCFleetsync.java @@ -19,6 +19,8 @@ package crc; import java.util.BitSet; +import log.Log; + /** * Fleetsync CRC checksum utility * @@ -204,4 +206,47 @@ public class CRCFleetsync return retVal; } + + public static void main( String[] args ) + { + BitSet test = new BitSet(); + + int[] msg = new int[] + { 1,1,0,1,1,1,0,1,0,1,1,1,0,1,1,0, + 0,0,1,1,1,1,1,1,1,1,0,1,0,1,1,0, + 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1, + 0,1,0,0,1,0,1,1,1,1,0,0,1,1,0,0 }; + + for( int x = 0; x < msg.length; x++ ) + { + if( msg[ x ] == 0 ) + { + test.clear( x ); + } + else if( msg[ x ] == 1 ) + { + test.set( x ); + } + } + CRC result = check( test ); + + Log.info( "CRC:" + result.toString() ); + +// for( int y = 0; y < 64; y++ ) +// { +// BitSet test2 = test.get( y, y + 63 ); +// +// if( test2.get( 63 ) ) +// { +// test2.clear( 63 ); +// } +// else +// { +// test2.set( 63 ); +// } +// CRC result = check( test2 ); +// +// Log.info( y + " crc:" + result.toString() ); +// } + } } diff --git a/src/decode/mpt1327/MPT1327Decoder.java b/src/decode/mpt1327/MPT1327Decoder.java index 9c43df9f..689b0d06 100644 --- a/src/decode/mpt1327/MPT1327Decoder.java +++ b/src/decode/mpt1327/MPT1327Decoder.java @@ -127,8 +127,22 @@ public class MPT1327Decoder extends Decoder implements Instrumentable , 2.0 ); //Gain mDecimationFilter.setListener( mLowPassFilter ); - /* 2FSK Decoder with output inverted */ - mFSKDecoder = new FSK2Decoder( 24000, 1200, Output.INVERTED ); + /** + * Normal: 2FSK Decoder with inverted output + * French: 2FSK Decoder with normal output + */ + if( sync == Sync.NORMAL ) + { + mFSKDecoder = new FSK2Decoder( 24000, 1200, Output.INVERTED ); + } + else if( sync == Sync.FRENCH ) + { + mFSKDecoder = new FSK2Decoder( 24000, 1200, Output.NORMAL ); + } + else + { + throw new IllegalArgumentException( "MPT1327 Decoder - unrecognized Sync type" ); + } mLowPassFilter.setListener( mFSKDecoder ); mSymbolBroadcaster = new Broadcaster(); @@ -290,7 +304,7 @@ public class MPT1327Decoder extends Decoder implements Instrumentable SyncPattern.MPT1327_TRAFFIC ), FRENCH( "French", SyncPattern.MPT1327_CONTROL_FRENCH, - SyncPattern.MPT1327_TRAFFIC ); + SyncPattern.MPT1327_TRAFFIC_FRENCH ); private String mLabel; private SyncPattern mControlSyncPattern; diff --git a/src/decode/mpt1327/MPT1327Message.java b/src/decode/mpt1327/MPT1327Message.java index 2e618ece..806a4603 100644 --- a/src/decode/mpt1327/MPT1327Message.java +++ b/src/decode/mpt1327/MPT1327Message.java @@ -109,7 +109,7 @@ public class MPT1327Message extends Message checkParity( 1, BLOCK_2_START, BLOCK_3_START ); checkParity( 2, BLOCK_3_START, BLOCK_4_START ); checkParity( 3, BLOCK_4_START, BLOCK_5_START ); - checkParity( 3, BLOCK_5_START, BLOCK_5_END ); + checkParity( 4, BLOCK_5_START, BLOCK_5_END ); break; case ACK: case ACKB: