Beispiel #1
0
        /// <summary>
        /// Create a single packet MDC1200 data array.
        /// </summary>
        /// <param name="packet">MDC packet to create</param>
        public void CreateSingle(MDCPacket packet)
        {
            Messages.Trace("Creating single-length MDC1200 packet " + packet.ToString());

            // initialize MDC1200 header
            GenerateHeader(ref dataArray, ref dataLoaded, NumberOfPreambles, true);

            // create a temporary array DATA_SIZE - 12 (stripping the size used by
            // the header)
            byte[] dp = new byte[CODEWORD_LENGTH];

            // fill the first bytes with the proper opcode and argument data
            dp[0] = packet.Operation;
            dp[1] = packet.Argument;
            dp[2] = (byte)((packet.UnitID >> 8) & 0x00FF);
            dp[3] = (byte)(packet.UnitID & 0x00FF);

            // pack data
            PackData(dp);

            // block copy new data into MDC1200 data array
            Buffer.BlockCopy(dp, 0, this.dataArray, dataLoaded, dp.Length);
            this.dataLoaded += 14;

            // dump output data for debug purposes
            Messages.TraceHex("Raw Data Dump", dataArray);
        }
Beispiel #2
0
        /// <summary>
        /// Internal function to reset any internal data fields before doing any operations.
        /// </summary>
        private void Clear()
        {
            this.frameCount = 0;

            // clear old packet data
            first  = new MDCPacket();
            second = new MDCPacket();

            // wipe all arrays
            this.th = new double[MDC_ND];

            this.shstate = new int[MDC_ND];
            this.shcount = new int[MDC_ND];

            this.nlstep = new int[MDC_ND];
            this.nlevel = new double[MDC_ND, 14];

            this.bits = new int[MDC_ND, MAX_MDC1200_BITS];

            this.xorBit    = new bool[MDC_ND];
            this.invertBit = new bool[MDC_ND];

            this.syncLow  = new uint[MDC_ND];
            this.syncHigh = new uint[MDC_ND];

            // iterate through decoders setting up fields
            for (int i = 0; i < MDC_ND; i++)
            {
                this.th[i] = 0.0 + (i * (TWOPI / MDC_ND));

                this.xorBit[i]    = false;
                this.invertBit[i] = false;

                this.shstate[i] = 0;
                this.shcount[i] = 0;

                this.nlstep[i] = i;

                // ensure all bit arrays are cleared to zero
                ClearBits(i);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Translates a MDC1200 operation to a string
        /// </summary>
        /// <param name="packet">MDC Packet to decode</param>
        /// <returns>String containing parsed MDC1200 operation</returns>
        public string ToString(MDCPacket packet)
        {
            string ret  = string.Empty;
            string unit = packet.UnitID.ToString("X4");

            // check operation
            switch (packet.Operation)
            {
            /**
             * Single Packet Operations
             */
            case OpType.PTT_ID:
            {
                // check argument
                switch (packet.Argument)
                {
                case ArgType.NO_ARG:
                    ret += "PTT ID: " + unit + " [Post- ID]";
                    break;

                case ArgType.PTT_PRE:
                    ret += "PTT ID: " + unit + " [ Pre- ID]";
                    break;

                default:
                    ret += "PTT ID: " + unit + " [Unkw- ID]";
                    break;
                }
            }
            break;

            case OpType.EMERGENCY:
                ret += "!!! EMERGENCY " + unit;
                break;

            case OpType.EMERGENCY_ACK:
                ret += "!!! EMERGENCY Acknowledge: " + unit;
                break;

            case OpType.RADIO_CHECK:
                ret += "Radio Check Unit: " + unit;
                break;

            case OpType.RADIO_CHECK_ACK:
                ret += "Radio Check Acknowledge: " + unit;
                break;

            case OpType.REMOTE_MONITOR:
                ret += "Remote Monitor Unit: " + unit;
                break;

            case OpType.RAC:
                ret += "Repeater Access Repeater ID: " + unit;
                break;

            case OpType.RTT_1:
            case OpType.RTT_2:
                ret += "RTT From: " + unit;
                break;

            case OpType.RTT_ACK:     // also OpType.MESSAGE_ACK
                ret += "RTT/Message Acknowledge: " + unit;
                break;

            case OpType.STATUS_REQUEST:
                ret += "Status Request To: " + unit;
                break;

            case OpType.STATUS_RESPONSE:
                ret += "Status Response From: " + unit + " Status: " + packet.Argument.ToString("X2");
                break;

            case OpType.MESSAGE:
                ret += "Message Request To: " + unit + " Message: " + packet.Argument.ToString("X2");
                break;

            case OpType.RADIO_INHIBIT:
            {
                // check argument
                switch (packet.Argument)
                {
                case ArgType.NO_ARG:
                    ret += "Stun/Inhibit Target: " + unit;
                    break;

                case ArgType.CANCEL_INHIBIT:
                    ret += "Revive/Uninhibit Target: " + unit;
                    break;

                default:
                    ret += "UNK Inhibit Target: " + unit;
                    break;
                }
            }
            break;

            case OpType.RADIO_INHIBIT_ACK:
            {
                // check argument
                switch (packet.Argument)
                {
                case ArgType.NO_ARG:
                    ret += "Stun/Inhibit: Acknowlege: " + unit;
                    break;

                case ArgType.CANCEL_INHIBIT:
                    ret += "Revive/Uninhibit Acknowledge: " + unit;
                    break;

                default:
                    ret += "UNK Inhibit Acknowledge: " + unit;
                    break;
                }
            }
            break;

            /**
             * Double Packet Operations
             */
            case OpType.DOUBLE_PACKET_TYPE1:
            case OpType.DOUBLE_PACKET_TYPE2:
                ret += "Request To: " + unit;
                break;

            case OpType.CALL_ALERT_ACK_EXPECTED:
            case OpType.CALL_ALERT_NOACK_EXPECTED:
                ret += "Call Alert/Page From: " + unit;
                break;

            case OpType.CALL_ALERT_ACK:
                ret += "Call Alert/Page Acknowledge: " + unit;
                break;

            case OpType.SELECTIVE_CALL_1:
            case OpType.SELECTIVE_CALL_2:
                ret += "Sel-Call: From: " + unit;
                break;

            default:
                ret += "UNK Op " + packet.Operation.ToString("X2") + " Arg " + packet.Argument.ToString("X2") + " Unit ID " + unit;
                break;
            }

            return(ret);
        }