Exemplo n.º 1
0
        public static TSBKMessage getMessage(int system, RadioLog.Common.SafeBitArray buffer)
        {
            int opcode = buffer.getInt(TSBKMessage.OPCODE);
            int vendor = buffer.getInt(TSBKMessage.VENDOR_ID);

            switch (vendor)
            {
            case 0:     //STANDARD
            {
                return(new TSBKMessage(system, buffer));
            }

            case 144:     //MOTOROLA
            {
                return(new TSBKMessage(system, buffer));
            }

            default:
            {
                return(new TSBKMessage(system, buffer));
            }
            }
        }
Exemplo n.º 2
0
            private void checkComplete()
            {
                if (mDUID.Equals(Decoders.P25.Reference.DataUnitID.NID))
                {
                    int value = mMessage.getInt(Decoders.P25.Message.P25Message.DUID);

                    Decoders.P25.Reference.DataUnitID duid = Decoders.P25.Reference.DataUnitID.fromValue(value);

                    if (duid != Decoders.P25.Reference.DataUnitID.UNKN)
                    {
                        setDUID(duid);
                    }
                    else
                    {
                        mComplete = true;
                    }
                }
                else if (mDUID.Equals(Decoders.P25.Reference.DataUnitID.HDU) ||
                         mDUID.Equals(Decoders.P25.Reference.DataUnitID.LDU1) ||
                         mDUID.Equals(Decoders.P25.Reference.DataUnitID.LDU2) ||
                         mDUID.Equals(Decoders.P25.Reference.DataUnitID.PDU2) ||
                         mDUID.Equals(Decoders.P25.Reference.DataUnitID.PDU3) ||
                         mDUID.Equals(Decoders.P25.Reference.DataUnitID.TDU) ||
                         mDUID.Equals(Decoders.P25.Reference.DataUnitID.TDULC) ||
                         mDUID.Equals(Decoders.P25.Reference.DataUnitID.UNKN))
                {
                    mComplete = true;
                    mFramer.dispatch(new Decoders.P25.Message.P25Message(mMessage.Clone(), mDUID));
                }
                else if (mDUID.Equals(Decoders.P25.Reference.DataUnitID.PDU1))
                {
                    int blocks    = mMessage.getInt(Decoders.P25.Message.PDUMessage.PDU_HEADER_BLOCKS_TO_FOLLOW);
                    int padBlocks = mMessage.getInt(Decoders.P25.Message.PDUMessage.PDU_HEADER_PAD_BLOCKS);

                    int blockCount = blocks + padBlocks;

                    if (blockCount == 24 || blockCount == 32)
                    {
                        setDUID(Decoders.P25.Reference.DataUnitID.PDU2);
                    }
                    else if (blockCount == 36 || blockCount == 48)
                    {
                        setDUID(Decoders.P25.Reference.DataUnitID.PDU3);
                    }
                    else
                    {
                        mFramer.dispatch(new Decoders.P25.Message.PDUMessage(mMessage.Clone(), mDUID));
                        mComplete = true;
                    }
                }
                else if (mDUID.Equals(Decoders.P25.Reference.DataUnitID.TSBK1))
                {
                    /* Remove interleaving */
                    Decoders.P25.P25Interleave.deinterleave(mMessage, TSBK_BEGIN, TSBK_END);

                    /* Remove trellis encoding */
                    mFramer.mHalfRate.decode(mMessage, TSBK_BEGIN, TSBK_END);

                    /* Construct the message */
                    int tsbkSystem1 = mMessage.getInt(Decoders.P25.Message.P25Message.NAC);

                    RadioLog.Common.SafeBitArray tsbkBuffer1 = new RadioLog.Common.SafeBitArray(mMessage.CloneFromIndexToIndex(TSBK_BEGIN, TSBK_DECODED_END), 96);

                    Decoders.P25.Message.TSBKMessage tsbkMessage1 = Decoders.P25.Message.TSBKMessageFactory.getMessage(tsbkSystem1, tsbkBuffer1);

                    if (tsbkMessage1.isLastBlock())
                    {
                        mComplete = true;
                    }
                    else
                    {
                        setDUID(Decoders.P25.Reference.DataUnitID.TSBK2);
                        mMessage.SetPointer(TSBK_BEGIN);
                    }

                    mFramer.dispatch(tsbkMessage1);
                }
                else if (mDUID.Equals(Decoders.P25.Reference.DataUnitID.TSBK2))
                {
                    /* Remove interleaving */
                    Decoders.P25.P25Interleave.deinterleave(mMessage, TSBK_BEGIN, TSBK_END);

                    /* Remove trellis encoding */
                    mFramer.mHalfRate.decode(mMessage, TSBK_BEGIN, TSBK_END);

                    /* Construct the message */
                    int tsbkSystem2 = mMessage.getInt(Decoders.P25.Message.P25Message.NAC);

                    RadioLog.Common.SafeBitArray tsbkBuffer2 = new RadioLog.Common.SafeBitArray(mMessage.CloneFromIndexToIndex(TSBK_BEGIN, TSBK_DECODED_END), 98);

                    Decoders.P25.Message.TSBKMessage tsbkMessage2 = Decoders.P25.Message.TSBKMessageFactory.getMessage(tsbkSystem2, tsbkBuffer2);

                    if (tsbkMessage2.isLastBlock())
                    {
                        mComplete = true;
                    }
                    else
                    {
                        setDUID(Decoders.P25.Reference.DataUnitID.TSBK3);
                        mMessage.SetPointer(TSBK_BEGIN);
                    }

                    mFramer.dispatch(tsbkMessage2);
                }
                else if (mDUID.Equals(Decoders.P25.Reference.DataUnitID.TSBK3))
                {
                    /* Remove interleaving */
                    Decoders.P25.P25Interleave.deinterleave(mMessage, TSBK_BEGIN, TSBK_END);

                    /* Remove trellis encoding */
                    mFramer.mHalfRate.decode(mMessage, TSBK_BEGIN, TSBK_END);

                    /* Construct the message */
                    int tsbkSystem3 = mMessage.getInt(Decoders.P25.Message.P25Message.NAC);

                    RadioLog.Common.SafeBitArray tsbkBuffer3 = new RadioLog.Common.SafeBitArray(mMessage.CloneFromIndexToIndex(TSBK_BEGIN, TSBK_DECODED_END), 96);

                    Decoders.P25.Message.TSBKMessage tsbkMessage3 = Decoders.P25.Message.TSBKMessageFactory.getMessage(tsbkSystem3, tsbkBuffer3);

                    mComplete = true;

                    mFramer.dispatch(tsbkMessage3);
                }
                else
                {
                    mComplete = true;
                }
            }