예제 #1
0
        override public void SetDataBlock(DataBlock db)
        {
            m_db = new DataBlock();
            m_db.Copy(db);

            int time = 0;

            bool oldBit = false;

            for (int i = 0; i < m_db.GetChannelLength(); i++)
            {
                bool bit = m_db.GetVoltage(0, i) > 10;

                if (oldBit == false && bit == true)
                {
                    Process(false, time);
                    time = 0;
                }
                else if (oldBit == true && bit == false)
                {
                    Process(true, time);
                    time = 0;
                }
                else
                {
                    time++;
                }

                oldBit = bit;
            }


            textBox1.Text += "histo\r\n";

            List <int> keys = new List <int>();

            foreach (int i in m_histo.Keys)
            {
                keys.Add(i);
            }

            keys.Sort();

            foreach (int i in keys)
            {
                int v = m_histo[i];
                textBox1.Text += string.Format("{0:000} {1:000} ", i, v) + "\r\n";
            }
        }
예제 #2
0
      override public void SetDataBlock(DataBlock db)
      {
          m_db = new DataBlock();
         m_db.Copy(db);

         int time = 0;

         bool oldBit = false;
         for (int i = 0; i < m_db.GetChannelLength(); i++)
         {
            bool bit = m_db.GetVoltage(0,i)>10;

            if ( oldBit == false && bit == true )
            {
               Process(false, time);
               time=0;
            }
            else if (oldBit == true && bit == false)
            {
               Process(true, time);
               time = 0;
            }
            else
            {
               time++;
            }

            oldBit = bit;
         }


         textBox1.Text += "histo\r\n";

         List<int> keys = new List<int>();
         foreach (int i in m_histo.Keys)
         {
            keys.Add(i);
         }

         keys.Sort();

         foreach (int i in keys)
         {
            int v = m_histo[i];
            textBox1.Text += string.Format("{0:000} {1:000} ", i, v) + "\r\n";
         }

      }
예제 #3
0
        override public void SetDataBlock(DataBlock db)
        {
            dataBlock.Copy(db);

            if (enabled)
            {
                filter.SetSampleRate(db.m_sampleRate);

                //filter a few times the first value to initialize filter
                for (int i = 0; i < 4; i++)
                {
                    double volt = db.GetVoltage(0, 0);
                    filter.DoFilter(volt);
                }

                for (int i = 0; i < db.GetChannelLength(); i++)
                {
                    double volt = db.GetVoltage(0, i);
                    dataBlock.SetVoltage(0, i, (int)filter.DoFilter(volt));
                }
            }
            base.SetDataBlock(dataBlock);
        }
예제 #4
0
        public override void SetDataBlock(DataBlock db)
        {
            m_db = new DataBlock();
             m_db.Copy(db);

             //List<int> PeakOffsets = GetMinMax(m_db);

             List<int> PeakOffsets = new List<int>();
             List<int> deltas = new List<int>();

             PeakFinder.InitLoopThoughWave(db);
             int t = 0;
             for (; ; )
             {
             int v = PeakFinder.LoopThoughWave();
             if (v == 255)
                 break;
             t = t + v;
             PeakOffsets.Add(t);
             deltas.Add(v);
             }

             db.m_Annotations = PeakOffsets.ToArray();

             int offset = 0;

             for (; offset < deltas.Count; offset++)
             {
             if (deltas[offset] != 0)
                 break;
             }

             if (offset >= 0)
             {
            //output.Text += string.Format("Clocked signal found: {0}\r\n", offset);

            string bitstream = ExtractBits(deltas);

            output.Text += bitstream + "\r\n";

            //output.Text += string.Format("Errors as FSK: {0}\r\n", DetectFSK(bitstream));
            output.Text += "\r\nText:\r\n";
            output.Text += Decode4BitsToString(bitstream, false) + "\r\n";
            //output.Text += string.Format("Alternating: \r\n");
            //output.Text += GetBitStreamFromAlternating(bitstream) + "\r\n";

             }
             else
             {
            output.Text += string.Format("Clocked signal not found, dumping timing values\r\n");

            int last = 0;
            foreach (int i in PeakOffsets)
            {
               output.Text += string.Format("{0:0000}: {1}", i, i-last) + "\r\n";
               last = i;
            }
             }
        }
예제 #5
0
 public override bool GetDataBlock(ref DataBlock db)
 {
     db.Copy(m_db);
     return true;
 }
예제 #6
0
        override public void SetDataBlock(DataBlock db)
        {
            m_db = new DataBlock();
            m_db.Copy(db);

            //List<int> PeakOffsets = GetMinMax(m_db);

            List <int> PeakOffsets = new List <int>();
            List <int> deltas      = new List <int>();

            PeakFinder.InitLoopThoughWave(db);
            int t = 0;

            for (; ;)
            {
                int v = PeakFinder.LoopThoughWave();
                if (v == 255)
                {
                    break;
                }
                t = t + v;
                PeakOffsets.Add(t);
                deltas.Add(v);
            }

            db.m_Annotations = PeakOffsets.ToArray();

            int offset = 0;

            for (; offset < deltas.Count; offset++)
            {
                if (deltas[offset] != 0)
                {
                    break;
                }
            }

            if (offset >= 0)
            {
                //output.Text += string.Format("Clocked signal found: {0}\r\n", offset);

                string bitstream = ExtractBits(deltas);

                output.Text += bitstream + "\r\n";

                //output.Text += string.Format("Errors as FSK: {0}\r\n", DetectFSK(bitstream));
                output.Text += "\r\nText:\r\n";
                output.Text += Decode4BitsToString(bitstream, false) + "\r\n";
                //output.Text += string.Format("Alternating: \r\n");
                //output.Text += GetBitStreamFromAlternating(bitstream) + "\r\n";
            }
            else
            {
                output.Text += string.Format("Clocked signal not found, dumping timing values\r\n");

                int last = 0;
                foreach (int i in PeakOffsets)
                {
                    output.Text += string.Format("{0:0000}: {1}", i, i - last) + "\r\n";
                    last         = i;
                }
            }
        }
예제 #7
0
 public void SetDataBlock(DataBlock db)
 {
     m_db.Copy(db);
 }
예제 #8
0
 override public bool GetDataBlock(ref DataBlock db)
 {
     db.Copy(m_db);
     return(true);
 }