Esempio n. 1
0
 public void Process(CNTRL_MSG controlParam, IQ inData)
 {
     if (controlParam == CNTRL_MSG.DATA_IN)
     {
         Process(inData);
     }
 }
Esempio n. 2
0
 public void Process(CNTRL_MSG controlEvent)
 {
     if (ProcessFunc != null)
     {
         this.ProcessFunc(controlEvent, default(T));
     }
 }
Esempio n. 3
0
        public void Process(CNTRL_MSG controlParam, IQ inData)
        {
            if (controlParam == CNTRL_MSG.DATA_IN)
            {
                if (IsSyncReady)
                {
                    DataOut.Process(inData);
                }
                else
                {
                    Process(inData);
                    if (IsSyncReady)
                    {
                        int Start1, Start2;
                        int End1, End2;

                        DataOut.Process(CNTRL_MSG.SYNC_DETECTED);

                        Start1 = CurrentIndex;
                        End1   = DataLength;
                        Start2 = 0;        // initially disable a second run
                        End2   = CurrentIndex;
                        for (int i = Start1; i < End1; i++)
                        {
                            DataOut.Process(Data[i] * this.CorrRotate);
                        }
                        // Do second calculation loop if wrap-around was detected
                        for (int i = Start2; i < End2; i++)
                        {
                            DataOut.Process(Data[i] * this.CorrRotate);
                        }
                    }
                }
            }
        }
Esempio n. 4
0
 public void Process(CNTRL_MSG controlParam, float incomingSample)
 {
     if (controlParam == CNTRL_MSG.DATA_IN)
     {
         IQ  Data;
         IQ  Target;
         IQ  Diff;
         int BitData;
         IQGenerator.Process(incomingSample, out Data);
         IQDemodulator.Process(Data);
         while (IQDemodulator.Count > 0)
         {
             Data = IQDemodulator.GetData();
             if (Data != IQ.ZERO)
             {
                 if (FirstSymbol)
                 {
                     FirstSymbol     = false;
                     Target          = Constellation.IQ_Simple_BPSK[Constellation.Bits_Simple_BPSK[InitialValue]];
                     Diff            = Target / Data;
                     this.CorrRotate = Diff / Data.R2;
                     IQDecoder.StartCorrectionProcess(SymbolsToDetectCorrection);
                     IQDecoder.PreviousIQ = Target;
                 }
                 IQDecoder.Process(Data * CorrRotate, out BitData);
                 DataOut.Process(BitData);
                 // Re-adjust constellation
                 Diff            = IQDecoder.Target / Data;
                 this.CorrRotate = Diff / Data.R2;
             }
         }
     }
 }
Esempio n. 5
0
 public void Process(CNTRL_MSG controlEvent, T inData)
 {
     if (ProcessFunc != null)
     {
         this.ProcessFunc(controlEvent, inData);
     }
 }
Esempio n. 6
0
 public void Process(CNTRL_MSG inControl, T inData)
 {
     foreach (ProcessFunction <T> f in InputProcessFunctions)
     {
         f(inControl, inData);
     }
 }
Esempio n. 7
0
 public void Process(CNTRL_MSG controlParam, float incomingSample)
 {
     if (controlParam == CNTRL_MSG.DATA_IN)
     {
         IQ Data;
         if (SamplesCounter >= 0)
         {
             AccumEnergy += incomingSample * incomingSample;
             FFTInBuffer[SamplesCounter] = new IQ(incomingSample, 0) / InputCorr.Value;
         }
         InputCorr.Next();
         SamplesCounter++;
         if (SamplesCounter >= FFTSize)
         {
             SamplesCounter = FFTSize - BlockSize;
             FFTDemodulator.ProcessFFT(FFTInBuffer, FFTOutBuffer);
             FrameEnergy = (2.0f * AccumEnergy) / FFTSize;
             AccumEnergy = 0;
             for (int i = 0; i < NFREQ; i++)
             {
                 Data = FFTOutBuffer[i + FFT_START_INDEX] * OutputCorr[i];
                 DataOut.Process(Data);
             }
         }
     }
 }
Esempio n. 8
0
        public void Process(CNTRL_MSG controlParam, IQ data)
        {
            if (controlParam == CNTRL_MSG.DATA_IN)
            {
                // encode the I bit
                // encode the Q bit
                FFTInBuffer[CurrFreqIndex + FFT_START_INDEX]             = data;
                FFTInBuffer[FFTSize - (CurrFreqIndex + FFT_START_INDEX)] = data.C;  // Conjugate
                GeneratorsDone[CurrFreqIndex] = true;

                // Advance current frequency index and check for wrap-around
                CurrFreqIndex++; if (CurrFreqIndex >= NFREQ)
                {
                    CurrFreqIndex = 0;
                }
                if (GeneratorsDone[CurrFreqIndex])
                {
                    CalculateOutput();
                    foreach (float samp in OutputBuffer)
                    {
                        DataOut.Process(samp);
                    }
                }
            }
            else if (controlParam == CNTRL_MSG.FINISH)
            {
                CalculateOutput(OutputBuffer, 0);
                foreach (float samp in OutputBuffer)
                {
                    DataOut.Process(samp);
                }
                // re-initialize index
                CurrFreqIndex = 0;
            }
        }
Esempio n. 9
0
        public void Process(CNTRL_MSG controlParam, float incomingSample)
        {
            if (controlParam == CNTRL_MSG.DATA_IN)
            {
                bool  SamplesReady = false;
                float I, Q;
                IQ    Data;

                sE = Coeff1 * sE + Coeff2 * incomingSample * incomingSample;
                for (int idx = 0; idx < NFREQ; idx++)
                {
                    gI[idx].Process(incomingSample, out I);
                    gQ[idx].Process(incomingSample, out Q);

                    if (InSyncProcess && (CorrSymbolIndex == idx))
                    {
                        // If we are in Sync mode for that channel - just pass samples
                        fI[idx].Process(I, out I);
                        fQ[idx].Process(Q, out Q);
                        if (CorrSymbol.Process(new IQ(I, Q)) > 0)
                        {
                            InSyncProcess = false;
                            // Sync mode just ended, and the data is ready
                            int NewIdx = CorrSymbol.SymbolCorrection;
                            for (int i = 0; i < NFREQ; i++)
                            {
                                // Adjust all FIRs/Decimators
                                fI[i].DecimateIndex = NewIdx;
                                fQ[i].DecimateIndex = NewIdx;
                            }
                            // Get all the data from the symbol corrector
                            while (CorrSymbol.Count > 0)
                            {
                                Data = CorrSymbol.GetData() * Correction[idx].Next();
                                DataOut.Process(Data);
                                fE[idx] = Coeff1 * fE[idx] + Coeff2 * Data.R2;
                            }
                        }
                    }
                    else
                    {
                        fI[idx].Decimate(I, out I);
                        SamplesReady = fQ[idx].Decimate(Q, out Q) > 0;
                        if (SamplesReady)
                        {
                            Data = new IQ(I, Q) * Correction[idx].Next();
                            DataOut.Process(Data);
                            fE[idx] = Coeff1 * fE[idx] + Coeff2 * Data.R2;
                        }
                    }
                }
                // All symbols go sequentially in the data queues, and NEW_SYMBOL messages are used
                //  to act as delimiters
                if (SamplesReady && (NFREQ > 1))
                {
                    DataOut.Process(CNTRL_MSG.NEW_SYMBOL);
                }
            }
        }
Esempio n. 10
0
        public void Process(CNTRL_MSG inControl, T inData)
        {
            DataPacket <T> dp;

            dp.Control = inControl; dp.Data = inData;
            lock (Data)
            {
                Data.Enqueue(dp);
            }
        }
Esempio n. 11
0
        public void Process(CNTRL_MSG controlParam, IQ data)
        {
            if (controlParam == CNTRL_MSG.DATA_IN)
            {
                PrepareOutputBuffer(OutputBuffer, 0);
                // encode the I bit
                fI[CurrFreqIndex].Interpolate(data.I, TempModBuffer);
                gI[CurrFreqIndex].GenerateAdd(TempModBuffer, OutputBuffer); // Modulate a carrier with symbol

                // encode the Q bit
                fQ[CurrFreqIndex].Interpolate(data.Q, TempModBuffer);
                gQ[CurrFreqIndex].GenerateAdd(TempModBuffer, OutputBuffer); // Modulate a carrier with symbol
                GeneratorsDone[CurrFreqIndex] = true;

                // Advance current frequency index and check for wrap-around
                CurrFreqIndex++; if (CurrFreqIndex >= NFREQ)
                {
                    CurrFreqIndex = 0;
                }
                if (GeneratorsDone[CurrFreqIndex])
                {
                    foreach (float samp in OutputBuffer)
                    {
                        DataOut.Process(samp);
                    }
                }
            }
            else if (controlParam == CNTRL_MSG.FINISH)
            {
                for (int i = 0; i < NFREQ; i++)
                {
                    if (!GeneratorsDone[i])
                    {
                        // encode the I bit
                        fI[i].Interpolate(0, TempModBuffer);
                        gI[i].GenerateAdd(TempModBuffer, OutputBuffer); // Modulate a carrier with symbol

                        // encode the Q bit
                        fQ[i].Interpolate(0, TempModBuffer);
                        gQ[i].GenerateAdd(TempModBuffer, OutputBuffer); // Modulate a carrier with symbol
                        GeneratorsDone[i] = true;
                    }
                }
                foreach (float samp in OutputBuffer)
                {
                    DataOut.Process(samp);
                }
                // re-initialize index
                CurrFreqIndex = 0;
            }
        }
Esempio n. 12
0
        public void Process(CNTRL_MSG controlParam, byte incomingBit)
        {
            if (controlParam == CNTRL_MSG.DATA_IN)
            {
                // Initialize the state with first "m - 1" bits of the sequence
                if (TailbitingCounter > 0)
                {
                    if (this.EncoderType == ConvEncoderType.TailBiting_Head)
                    {
                        CurrentState |= (incomingBit & 0x0001) << (m - TailbitingCounter);
                        FirstBits[m - TailbitingCounter] = incomingBit;
                        TailbitingCounter--;
                    }
                    else
                    {
                        TailbitingCounter = 0;
                    }
                }

                if (TailbitingCounter == 0)
                {
                    CurrentState |= (incomingBit & 0x0001) << m;
                    Process();
                }
            }
            else if (controlParam == CNTRL_MSG.INTERLEAVER_FRAME)
            {
                // If zero-terminating sequence - add "m" zero bits at the end
                if (this.EncoderType == ConvEncoderType.ZeroState)
                {
                    for (int BitsCount = 0; BitsCount < this.m; BitsCount++)
                    {
                        Process();
                    }
                }
                else if (this.EncoderType == ConvEncoderType.TailBiting_Head)
                {
                    // If tailbiting sequence - add "m" First bits at the end
                    for (int BitsCount = 0; BitsCount < this.m; BitsCount++)
                    {
                        CurrentState |= (FirstBits[BitsCount] & 0x0001) << m;
                        Process();
                    }
                }
            }
        }
Esempio n. 13
0
 public void Process(CNTRL_MSG controlParam, IQ inData)
 {
     if (controlParam == CNTRL_MSG.DATA_IN)
     {
         if (PutIndex < DataSize)
         {
             DataBuffer[PutIndex] = inData;
         }
         PutIndex++;
         if (PutIndex == DataSize)
         {
             CalculateCorrections();
             foreach (IQ IQData in OutputData)
             {
                 DataOut.Process(IQData);
             }
         }
     }
 }
Esempio n. 14
0
        public void Process(CNTRL_MSG controlParam, T incomingBit)
        {
            if (controlParam == CNTRL_MSG.DATA_IN)
            {
                DataArray[CurrentInIndex++] = incomingBit; if (CurrentInIndex >= MaxBits)
                {
                    CurrentInIndex = 0;
                }
                CurrentInCounter++;
                if (CurrentInCounter >= NumBitsIn)
                {
                    CurrentInCounter = 0;
                    int CurrentFrame = CurrentInIndex - NumBitsIn; if (CurrentFrame < 0)
                    {
                        CurrentFrame += MaxBits;
                    }
                    // Start from the beginning of the input block

                    int      CurrentOutIndex;
                    int      CurrentOutCounter;
                    BitGroup bg;

                    int CurrentBitGroupIndex = 0;
                    while (CurrentBitGroupIndex < MaxBitGroupIndex)
                    {
                        bg = BGArray[CurrentBitGroupIndex++];
                        CurrentOutIndex = CurrentFrame - bg.Position; if (CurrentOutIndex < 0)
                        {
                            CurrentOutIndex += MaxBits;
                        }
                        CurrentOutCounter = bg.Size;
                        while (CurrentOutCounter-- > 0)
                        {
                            DataOut.Process(DataArray[CurrentOutIndex++]); if (CurrentOutIndex >= MaxBits)
                            {
                                CurrentOutIndex = 0;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 15
0
 public void Process(CNTRL_MSG controlParam, byte bitData)
 {
     if (controlParam == CNTRL_MSG.DATA_IN)
     {
         DataOut.Process(bitData);
         if (MatchFound)
         {
             Index++;
         }
         else
         {
             CurrentData = (CurrentData << 1) | (bitData & 0x01);
             if (((CurrentData ^ Target) & TargetMask) == 0)
             {
                 MatchFound = true;
                 Index      = NumBits;
                 DataOut.Process(CNTRL_MSG.EOM_DETECTED);
             }
         }
     }
 }
Esempio n. 16
0
 public void ProcessEncode(CNTRL_MSG controlParam, byte dataByte)
 {
     if (controlParam == CNTRL_MSG.DATA_IN)
     {
         Storage[PutX, PutY] = dataByte;
         NextPutPos(ref PutX, ref PutY);
         PutCounter--;
         if (PutCounter == 0)
         {
             ProcessEncode();
             EncodeOut.Process(CNTRL_MSG.INTERLEAVER_FRAME);
             while (GetCounter > 0)
             {
                 EncodeOut.Process(Storage[GetX, GetY]);
                 NextGetPos(ref GetX, ref GetY);
                 GetCounter--;
             }
             this.Init();
         }
     }
 }
Esempio n. 17
0
 public void Process(CNTRL_MSG inControl)
 {
     foreach (object conn in ConnectionsArray)
     {
         if (conn is ConnectionEntry <byte> )
         {
             ((ConnectionEntry <byte>)conn).Process(inControl, 0);
         }
         else if (conn is ConnectionEntry <int> )
         {
             ((ConnectionEntry <int>)conn).Process(inControl, 0);
         }
         else if (conn is ConnectionEntry <float> )
         {
             ((ConnectionEntry <float>)conn).Process(inControl, 0);
         }
         else if (conn is ConnectionEntry <IQ> )
         {
             ((ConnectionEntry <IQ>)conn).Process(inControl, IQ.ZERO);
         }
     }
 }
Esempio n. 18
0
 public void Process(CNTRL_MSG controlParam, float incomingSample)
 {
     if (controlParam == CNTRL_MSG.DATA_IN)
     {
         IQ   Data;
         bool DataReady = true;
         for (int idx = 0; idx < NFREQ; idx++)
         {
             IQGens[idx].Process(incomingSample, out Data);
             IQDemod[idx].Process(Data);
             DataReady = DataReady && (IQDemod[idx].Count > 0);
         }
         if (DataReady)
         {
             DataOut.Process(CNTRL_MSG.NEW_SYMBOL);
             for (int idx = 0; idx < NFREQ; idx++)
             {
                 Data = IQDemod[idx].GetData() * CorrRotate[idx];
                 DataOut.Process(Data);
             }
         }
     }
 }
Esempio n. 19
0
 public void Process(CNTRL_MSG controlParam, byte incomingBit)
 {
     if (controlParam == CNTRL_MSG.DATA_IN)
     {
         DataArray[CurrentInIndex++] += (byte)((incomingBit == 0) ? -1 : 1); if (CurrentInIndex >= MaxBits)
         {
             CurrentInIndex = 0;
         }
         CurrentBGCounter--;
         if (CurrentBGCounter <= 0)
         {
             BitGroup bg = BGArray[CurrentBitGroupIndex++]; if (CurrentBitGroupIndex >= MaxBitGroupIndex)
             {
                 CurrentBitGroupIndex = 0;
             }
             CurrentInIndex = CurrentFrame - bg.Position; if (CurrentInIndex < 0)
             {
                 CurrentInIndex += MaxBits;
             }
             CurrentBGCounter = bg.Size;
         }
         CurrentInCounter++;
         if (CurrentInCounter >= NumBitsIn)
         {
             CurrentInCounter = 0;
             // Output data
             for (int i = 0; i < NumBitsOut; i++)
             {
                 DataOut.Process((byte)((DataArray[CurrentFrame++] > 0) ? 1 : 0)); if (CurrentFrame >= MaxBits)
                 {
                     CurrentFrame = 0;
                 }
             }
             Array.Clear(DataArray, CurrentFrame, NumBitsOut);
         }
     }
 }
Esempio n. 20
0
        } /* end of function Process */

        public void Process(CNTRL_MSG controlParam, byte incomingBit)
        {
            if (controlParam == CNTRL_MSG.DATA_IN)
            {
            }
        }