Пример #1
0
        private void DownButton_Click(object sender, EventArgs e)
        {
            int NewIndex, OldIndex;

            OldIndex = TestProgramListBox.SelectedIndex;
            MTKTest temp = TestProgram[OldIndex];

            TestProgram.RemoveAt(OldIndex);
            NewIndex = OldIndex + 1;
            if (NewIndex >= TestProgram.Count)
            {
                TestProgram.Add(temp);
            }
            else
            {
                TestProgram.Insert(NewIndex, temp);
            }

            TestProgramListBox.Items.Clear();
            foreach (MTKTest Tests in TestProgram)
            {
                TestProgramListBox.Items.Add(Tests.GetDisplayText());
            }

            if (NewIndex >= TestProgram.Count)
            {
                TestProgramListBox.SelectedIndex = NewIndex - 1;
            }
            else
            {
                TestProgramListBox.SelectedIndex = NewIndex;
            }
        }
Пример #2
0
        public MTKTestError RunTest(int TestIndex)
        {
            Log.PrintLog(this, "Running test program " + (TestIndex + 1).ToString() + "/" +
                         TestProgram.Count.ToString(), LogDetailLevel.LogRelevant);

            TestProgram[TestIndex].UpdateDUTPort(DUTSerialPort);
            TestProgram[TestIndex].DUTConnectionMode = MTKTest.GetConnectionModeFromText(DUTConnectionType);

            string       TestType = TestProgram[TestIndex].ToString();
            MTKTestError ReturnError;

            if (CheckPorts(TestType, out ReturnError) == false)
            {
                return(ReturnError);
            }

            if (TestType == "MTKTestProgramAll")
            {
                ((MTKTestProgramAll)TestProgram[TestIndex]).NumberOfDUTs   = NumberOfDUTs;
                ((MTKTestProgramAll)TestProgram[TestIndex]).CurrentDUT     = _CurrentDUT;
                ((MTKTestProgramAll)TestProgram[TestIndex]).DUTProgrammers = DUTProgrammers;
                ((MTKTestProgramAll)TestProgram[TestIndex]).DUTSerialPorts = DUTSerialPorts;
            }

            if (TestType == "MTKTestAnritsu")
            {
                ((MTKTestAnritsu)TestProgram[TestIndex]).AnritsuPort = AnritsuSerialPort;
            }

            MTKTestError RetVal;

            OnNextTest(TestIndex);
            if (TestType == "MTKPSoCProgrammer")
            {
                if (((MTKPSoCProgrammer)TestProgram[TestIndex]).GlobalProgrammerSelected)
                {
                    RetVal = DUTProgrammers[_CurrentDUT].RunTest();
                }
                else
                {
                    RetVal = TestProgram[TestIndex].RunTest();
                }
            }
            else
            {
                RetVal = TestProgram[TestIndex].RunTest();
            }
            OnTestComplete();
            return(RetVal);
        }
Пример #3
0
 private void UpdateTestProgramWithNewTest(MTKTest NewTest)
 {
     if (TestProgramListBox.SelectedIndex >= 0)
     {
         TestProgram.Insert(TestProgramListBox.SelectedIndex, NewTest);
         TestProgramListBox.Items.Insert(TestProgramListBox.SelectedIndex, NewTest.GetDisplayText());
     }
     else
     {
         TestProgram.Add(NewTest);
         TestProgramListBox.Items.Add(NewTest.GetDisplayText());
     }
     Log.PrintLog(this, "Adding " + NewTest.ToString() + " to the test list.",
                  LogDetailLevel.LogEverything);
 }
        private bool LoadTestParameters(MTKTest TempTest, XmlNode TestNode)
        {
            if (TempTest.TestParameterCount != Int32.Parse(TestNode["NumberOfParamerters"].InnerText))
            {
                Log.PrintLog(this, "Test " + TestNode["TestIndex"].InnerText + ": Number of parameters don't match.",
                             LogDetailLevel.LogRelevant);
                Log.PrintLog(this, "Cannot load file.", LogDetailLevel.LogRelevant);
                return(false);
            }

            for (int i = 0; i < TempTest.TestParameterCount; i++)
            {
                if (TempTest.SetTestParameter(i, TestNode[TempTest.GetTestParameterName(i)].InnerText) == false)
                {
                    Log.PrintLog(this, "Test " + TestNode["TestIndex"].InnerText + ": Unexpected value \"" +
                                 TestNode[TempTest.GetTestParameterName(i)].InnerText + "\" for parameter \"" +
                                 TempTest.GetTestParameterName(i) + "\".", LogDetailLevel.LogEverything);
                    Log.PrintLog(this, "Cannot load file.", LogDetailLevel.LogRelevant);
                    return(false);
                }
            }

            return(true);
        }
Пример #5
0
        private bool EditTestAt(int TestIndex)
        {
            if (TestProgram[TestIndex].ToString() == "MTKTestRXPER")
            {
                MTKTestPERDialog TempDialog = new MTKTestPERDialog();
                TempDialog.Text = "RX PER Test Configuration";
                TempDialog.ChannelNumber.SelectedIndex = ((MTKTestRXPER)TestProgram[TestIndex]).ChannelNumber;
                int i = ((MTKTestRXPER)TestProgram[TestIndex]).PowerLevel;
                TempDialog.PowerLevel.Text                     = i.ToString() + " dBm";
                TempDialog.NumberOfPackets.Value               = (decimal)((MTKTestRXPER)TestProgram[TestIndex]).NumberOfPackets;
                TempDialog.PacketTypeComboBox.Text             = ((MTKTestRXPER)TestProgram[TestIndex]).PacketType;
                TempDialog.PacketLengthNumericUpDown.Value     = (decimal)((MTKTestRXPER)TestProgram[TestIndex]).PacketLength;
                TempDialog.PERPassCriterionNumericUpDown.Value = (decimal)((MTKTestRXPER)TestProgram[TestIndex]).PERPassCriterion;
                if (TempDialog.ShowDialog() == DialogResult.OK)
                {
                    ((MTKTestRXPER)TestProgram[TestIndex]).ChannelNumber    = TempDialog.ChannelNumber.SelectedIndex;
                    ((MTKTestRXPER)TestProgram[TestIndex]).PowerLevel       = int.Parse(MTKTest.GetPowerLevel(TempDialog.PowerLevel.Text));
                    ((MTKTestRXPER)TestProgram[TestIndex]).NumberOfPackets  = (int)TempDialog.NumberOfPackets.Value;
                    ((MTKTestRXPER)TestProgram[TestIndex]).PacketType       = TempDialog.PacketTypeComboBox.Text;
                    ((MTKTestRXPER)TestProgram[TestIndex]).PacketLength     = (int)TempDialog.PacketLengthNumericUpDown.Value;
                    ((MTKTestRXPER)TestProgram[TestIndex]).PERPassCriterion = (double)TempDialog.PERPassCriterionNumericUpDown.Value;
                    return(true);
                }
            }
            else if (TestProgram[TestIndex].ToString() == "MTKTestTXPER")
            {
                MTKTestPERDialog TempDialog = new MTKTestPERDialog();
                TempDialog.Text = "TX PER Test Configuration";
                TempDialog.ChannelNumber.SelectedIndex = ((MTKTestTXPER)TestProgram[TestIndex]).ChannelNumber;
                int i = ((MTKTestTXPER)TestProgram[TestIndex]).PowerLevel;
                TempDialog.PowerLevel.Text                     = i.ToString() + " dBm";
                TempDialog.NumberOfPackets.Value               = (decimal)((MTKTestTXPER)TestProgram[TestIndex]).NumberOfPackets;
                TempDialog.PacketTypeComboBox.Text             = ((MTKTestTXPER)TestProgram[TestIndex]).PacketType;
                TempDialog.PacketLengthNumericUpDown.Value     = (decimal)((MTKTestTXPER)TestProgram[TestIndex]).PacketLength;
                TempDialog.PERPassCriterionNumericUpDown.Value = (decimal)((MTKTestTXPER)TestProgram[TestIndex]).PERPassCriterion;
                if (TempDialog.ShowDialog() == DialogResult.OK)
                {
                    ((MTKTestTXPER)TestProgram[TestIndex]).ChannelNumber    = TempDialog.ChannelNumber.SelectedIndex;
                    ((MTKTestTXPER)TestProgram[TestIndex]).PowerLevel       = int.Parse(MTKTest.GetPowerLevel(TempDialog.PowerLevel.Text));
                    ((MTKTestTXPER)TestProgram[TestIndex]).NumberOfPackets  = (int)TempDialog.NumberOfPackets.Value;
                    ((MTKTestTXPER)TestProgram[TestIndex]).PacketType       = TempDialog.PacketTypeComboBox.Text;
                    ((MTKTestTXPER)TestProgram[TestIndex]).PacketLength     = (int)TempDialog.PacketLengthNumericUpDown.Value;
                    ((MTKTestTXPER)TestProgram[TestIndex]).PERPassCriterion = (double)TempDialog.PERPassCriterionNumericUpDown.Value;
                    return(true);
                }
            }
            else if (TestProgram[TestIndex].ToString() == "MTKTestTXP")
            {
                MTKTestRxTxDialog TempDialog = new MTKTestRxTxDialog();
                TempDialog.Text = "TX Packet Test Configuration";
                TempDialog.ChannelNumber.SelectedIndex = ((MTKTestTXP)TestProgram[TestIndex]).ChannelNumber;
                int i = ((MTKTestTXP)TestProgram[TestIndex]).PowerLevel;
                TempDialog.PowerLevel.Text                 = i.ToString() + " dBm";
                TempDialog.NumberOfPackets.Value           = (decimal)((MTKTestTXP)TestProgram[TestIndex]).NumberOfPackets;
                TempDialog.PacketTypeComboBox.Text         = ((MTKTestTXP)TestProgram[TestIndex]).PacketType;
                TempDialog.PacketLengthNumericUpDown.Value = (decimal)((MTKTestTXP)TestProgram[TestIndex]).PacketLength;
                if (TempDialog.ShowDialog() == DialogResult.OK)
                {
                    ((MTKTestTXP)TestProgram[TestIndex]).ChannelNumber   = TempDialog.ChannelNumber.SelectedIndex;
                    ((MTKTestTXP)TestProgram[TestIndex]).PowerLevel      = int.Parse(MTKTest.GetPowerLevel(TempDialog.PowerLevel.Text));
                    ((MTKTestTXP)TestProgram[TestIndex]).NumberOfPackets = (int)TempDialog.NumberOfPackets.Value;
                    ((MTKTestTXP)TestProgram[TestIndex]).PacketType      = TempDialog.PacketTypeComboBox.Text;
                    ((MTKTestTXP)TestProgram[TestIndex]).PacketLength    = (int)TempDialog.PacketLengthNumericUpDown.Value;
                    return(true);
                }
            }
            else if (TestProgram[TestIndex].ToString() == "MTKTestRXP")
            {
                MTKTestRxTxDialog TempDialog = new MTKTestRxTxDialog();
                TempDialog.Text = "RX Packet Test Configuration";
                TempDialog.ChannelNumber.SelectedIndex = ((MTKTestRXP)TestProgram[TestIndex]).ChannelNumber;
                int i = ((MTKTestRXP)TestProgram[TestIndex]).PowerLevel;
                TempDialog.PowerLevel.Text                 = i.ToString() + " dBm";
                TempDialog.NumberOfPackets.Value           = (decimal)((MTKTestRXP)TestProgram[TestIndex]).NumberOfPackets;
                TempDialog.PacketTypeComboBox.Text         = ((MTKTestRXP)TestProgram[TestIndex]).PacketType;
                TempDialog.PacketLengthNumericUpDown.Value = (decimal)((MTKTestRXP)TestProgram[TestIndex]).PacketLength;
                if (TempDialog.ShowDialog() == DialogResult.OK)
                {
                    ((MTKTestRXP)TestProgram[TestIndex]).ChannelNumber   = TempDialog.ChannelNumber.SelectedIndex;
                    ((MTKTestRXP)TestProgram[TestIndex]).PowerLevel      = int.Parse(MTKTest.GetPowerLevel(TempDialog.PowerLevel.Text));
                    ((MTKTestRXP)TestProgram[TestIndex]).NumberOfPackets = (int)TempDialog.NumberOfPackets.Value;
                    ((MTKTestRXP)TestProgram[TestIndex]).PacketType      = TempDialog.PacketTypeComboBox.Text;
                    ((MTKTestRXP)TestProgram[TestIndex]).PacketLength    = (int)TempDialog.PacketLengthNumericUpDown.Value;
                    return(true);
                }
            }
            else if (TestProgram[TestIndex].ToString() == "MTKTestTXCW")
            {
                MTKTestTXCWDialog TempDialog = new MTKTestTXCWDialog();
                TempDialog.Text = "TX CW Test Configuration";
                TempDialog.ChannelNumber.SelectedIndex = ((MTKTestTXCW)TestProgram[TestIndex]).ChannelNumber;
                int i = ((MTKTestTXCW)TestProgram[TestIndex]).PowerLevel;
                TempDialog.PowerLevel.Text       = i.ToString() + " dBm";
                TempDialog.DurationForTXCW.Value = (decimal)((MTKTestTXCW)TestProgram[TestIndex]).DurationForTXCW;
                if (TempDialog.ShowDialog() == DialogResult.OK)
                {
                    ((MTKTestTXCW)TestProgram[TestIndex]).ChannelNumber   = TempDialog.ChannelNumber.SelectedIndex;
                    ((MTKTestTXCW)TestProgram[TestIndex]).PowerLevel      = int.Parse(MTKTest.GetPowerLevel(TempDialog.PowerLevel.Text));
                    ((MTKTestTXCW)TestProgram[TestIndex]).DurationForTXCW = (int)TempDialog.DurationForTXCW.Value;
                    return(true);
                }
            }
            else if (TestProgram[TestIndex].ToString() == "MTKPSoCProgrammer")
            {
                MTKPSoCProgrammerDialog TempDialog = new MTKPSoCProgrammerDialog((MTKPSoCProgrammer)TestProgram[TestIndex]);
                if (TempDialog.ShowDialog() == DialogResult.OK)
                {
                    return(true);
                }
            }
            else if (TestProgram[TestIndex].ToString() == "MTKTestDelay")
            {
                MTKTestDelayDialog TempDialog = new MTKTestDelayDialog();
                TempDialog.DelayNumericUpDown.Value = (decimal)((MTKTestDelay)TestProgram[TestIndex]).DelayInMS;
                if (TempDialog.ShowDialog() == DialogResult.OK)
                {
                    ((MTKTestDelay)TestProgram[TestIndex]).DelayInMS = (int)TempDialog.DelayNumericUpDown.Value;
                    return(true);
                }
            }
            else if (TestProgram[TestIndex].ToString() == "MTKTestBDAProgrammer")
            {
                MTKTestBDADialog TempDialog = new MTKTestBDADialog(BDAProgrammer);
                if (TempDialog.ShowDialog() == DialogResult.OK)
                {
                    CyBLE_MTK_Application.Properties.Settings.Default.BDA              = TempDialog.BDATextBox.GetTextWithoutDelimiters();
                    CyBLE_MTK_Application.Properties.Settings.Default.BDAIncrement     = BDAProgrammer.AutoIncrementBDA;
                    CyBLE_MTK_Application.Properties.Settings.Default.BDAUseProgrammer = BDAProgrammer.UseProgrammer;
                    CyBLE_MTK_Application.Properties.Settings.Default.Save();
                }
            }
            else if (TestProgram[TestIndex].ToString() == "MTKTestProgramAll")
            {
                MTKTestProgramAllDialog temp = new MTKTestProgramAllDialog((MTKTestProgramAll)TestProgram[TestIndex]);
                if (temp.ShowDialog() == DialogResult.OK)
                {
                    return(true);
                }
            }
            else if (TestProgram[TestIndex].ToString() == "MTKTestSTC")
            {
                MTKTestSTCDialog TempDialog = new MTKTestSTCDialog((MTKTestSTC)TestProgram[TestIndex]);
                if (TempDialog.ShowDialog() == DialogResult.OK)
                {
                    return(true);
                }
            }
            else if (TestProgram[TestIndex].ToString() == "MTKTestCUS")
            {
                MTKTestCUSDialog TempDialog = new MTKTestCUSDialog((MTKTestCUS)TestProgram[TestIndex]);
                if (TempDialog.ShowDialog() == DialogResult.OK)
                {
                    return(true);
                }
            }
            else if (TestProgram[TestIndex].ToString() == "MTKTestI2C")
            {
                MTKTestI2CDialog TempDialog = new MTKTestI2CDialog((MTKTestI2C)TestProgram[TestIndex]);
                if (TempDialog.ShowDialog() == DialogResult.OK)
                {
                    return(true);
                }
            }
            else if (TestProgram[TestIndex].ToString() == "MTKTestRSX")
            {
                MTKTestRSXDialog temp = new MTKTestRSXDialog((MTKTestRSX)TestProgram[TestIndex]);
                if (temp.ShowDialog() == DialogResult.OK)
                {
                    return(true);
                }
            }
            else if (TestProgram[TestIndex].ToString() == "MTKTestXOCalibration")
            {
                MTKTestXOCalDialog temp = new MTKTestXOCalDialog((MTKTestXOCalibration)TestProgram[TestIndex]);
                if (temp.ShowDialog() == DialogResult.OK)
                {
                    return(true);
                }
            }
            //add by cysp for MTKTestDUTCurrentMeasure
            else if (TestProgram[TestIndex].ToString() == "MTKTestDUTCurrentMeasure")
            {
                DUTCurrentMeasureDialog temp = new DUTCurrentMeasureDialog();
                if (temp.ShowDialog() == DialogResult.OK)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #6
0
 private void AddTestButton_Click(object sender, EventArgs e)
 {
     if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[0])
     {
         MTKTestRXPER     RXPERTest  = new MTKTestRXPER(Log, MTKPort, DUTPort);
         MTKTestPERDialog TempDialog = new MTKTestPERDialog();
         TempDialog.Text = "RX PER Test Configuration";
         if (TempDialog.ShowDialog() == DialogResult.OK)
         {
             RXPERTest.ChannelNumber    = TempDialog.ChannelNumber.SelectedIndex;
             RXPERTest.PowerLevel       = int.Parse(MTKTest.GetPowerLevel(TempDialog.PowerLevel.Text));
             RXPERTest.NumberOfPackets  = (int)TempDialog.NumberOfPackets.Value;
             RXPERTest.PacketType       = TempDialog.PacketTypeComboBox.Text;
             RXPERTest.PacketLength     = (int)TempDialog.PacketLengthNumericUpDown.Value;
             RXPERTest.PERPassCriterion = (double)TempDialog.PERPassCriterionNumericUpDown.Value;
             UpdateTestProgramWithNewTest(RXPERTest);
         }
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[1])
     {
         MTKTestTXPER     TXPERTest  = new MTKTestTXPER(Log, MTKPort, DUTPort);
         MTKTestPERDialog TempDialog = new MTKTestPERDialog();
         TempDialog.Text = "TX PER Test Configuration";
         if (TempDialog.ShowDialog() == DialogResult.OK)
         {
             TXPERTest.ChannelNumber    = TempDialog.ChannelNumber.SelectedIndex;
             TXPERTest.PowerLevel       = int.Parse(MTKTest.GetPowerLevel(TempDialog.PowerLevel.Text));
             TXPERTest.NumberOfPackets  = (int)TempDialog.NumberOfPackets.Value;
             TXPERTest.PacketType       = TempDialog.PacketTypeComboBox.Text;
             TXPERTest.PacketLength     = (int)TempDialog.PacketLengthNumericUpDown.Value;
             TXPERTest.PERPassCriterion = (double)TempDialog.PERPassCriterionNumericUpDown.Value;
             UpdateTestProgramWithNewTest(TXPERTest);
         }
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[2])
     {
         MTKTestTXCW       TXCWTest   = new MTKTestTXCW(Log, MTKPort, DUTPort);
         MTKTestTXCWDialog TempDialog = new MTKTestTXCWDialog();
         TempDialog.Text = "TX CW Test Configuration";
         if (TempDialog.ShowDialog() == DialogResult.OK)
         {
             TXCWTest.ChannelNumber   = TempDialog.ChannelNumber.SelectedIndex;
             TXCWTest.PowerLevel      = int.Parse(MTKTest.GetPowerLevel(TempDialog.PowerLevel.Text));
             TXCWTest.DurationForTXCW = (int)TempDialog.DurationForTXCW.Value;
             UpdateTestProgramWithNewTest(TXCWTest);
         }
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[3])
     {
         MTKTestTXP        TXPTest    = new MTKTestTXP(Log, MTKPort, DUTPort);
         MTKTestRxTxDialog TempDialog = new MTKTestRxTxDialog();
         TempDialog.Text = "TX Packet Test Configuration";
         if (TempDialog.ShowDialog() == DialogResult.OK)
         {
             TXPTest.ChannelNumber   = TempDialog.ChannelNumber.SelectedIndex;
             TXPTest.PowerLevel      = int.Parse(MTKTest.GetPowerLevel(TempDialog.PowerLevel.Text));
             TXPTest.NumberOfPackets = (int)TempDialog.NumberOfPackets.Value;
             TXPTest.PacketType      = TempDialog.PacketTypeComboBox.Text;
             TXPTest.PacketLength    = (int)TempDialog.PacketLengthNumericUpDown.Value;
             UpdateTestProgramWithNewTest(TXPTest);
         }
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[4])
     {
         MTKTestRXP        RXPTest    = new MTKTestRXP(Log, MTKPort, DUTPort);
         MTKTestRxTxDialog TempDialog = new MTKTestRxTxDialog();
         TempDialog.Text = "RX Packet Test Configuration";
         if (TempDialog.ShowDialog() == DialogResult.OK)
         {
             RXPTest.ChannelNumber   = TempDialog.ChannelNumber.SelectedIndex;
             RXPTest.PowerLevel      = int.Parse(MTKTest.GetPowerLevel(TempDialog.PowerLevel.Text));
             RXPTest.NumberOfPackets = (int)TempDialog.NumberOfPackets.Value;
             RXPTest.PacketType      = TempDialog.PacketTypeComboBox.Text;
             RXPTest.PacketLength    = (int)TempDialog.PacketLengthNumericUpDown.Value;
             UpdateTestProgramWithNewTest(RXPTest);
         }
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[5])
     {
         MTKPSoCProgrammer MTKProgrammer = new MTKPSoCProgrammer(Log);
         if (MTKProgrammer.PSoCProgrammerInstalled && MTKProgrammer.IsCorrectVersion())
         {
             MTKPSoCProgrammerDialog TempDialog = new MTKPSoCProgrammerDialog(MTKProgrammer);
             if (TempDialog.ShowDialog() == DialogResult.OK)
             {
                 UpdateTestProgramWithNewTest(MTKProgrammer);
             }
         }
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[6])
     {
         MTKTestDelay       MTKDelayInMS = new MTKTestDelay(Log);
         MTKTestDelayDialog TempDialog   = new MTKTestDelayDialog();
         if (TempDialog.ShowDialog() == DialogResult.OK)
         {
             MTKDelayInMS.DelayInMS = (int)TempDialog.DelayNumericUpDown.Value;
             UpdateTestProgramWithNewTest(MTKDelayInMS);
         }
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[7])
     {
         if (IsBDAProgrammerPresent())
         {
             MessageBox.Show("Only one instance of BDA Programmer can be added to a test program.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MTKTestBDADialog TempDialog = new MTKTestBDADialog(BDAProgrammer);
             if (BDAProgrammer.BDAProgrammer.PSoCProgrammerInstalled && BDAProgrammer.BDAProgrammer.IsCorrectVersion())
             {
                 if (TempDialog.ShowDialog() == DialogResult.OK)
                 {
                     CyBLE_MTK_Application.Properties.Settings.Default.BDA              = TempDialog.BDATextBox.GetTextWithoutDelimiters();
                     CyBLE_MTK_Application.Properties.Settings.Default.BDAIncrement     = BDAProgrammer.AutoIncrementBDA;
                     CyBLE_MTK_Application.Properties.Settings.Default.BDAUseProgrammer = BDAProgrammer.UseProgrammer;
                     CyBLE_MTK_Application.Properties.Settings.Default.Save();
                 }
                 MTKTestBDAProgrammer MTKBDAProgrammer = new MTKTestBDAProgrammer(Log);
                 UpdateTestProgramWithNewTest(MTKBDAProgrammer);
             }
         }
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[8])
     {
         MTKTestAnritsu AnritsuTest = new MTKTestAnritsu(Log);
         UpdateTestProgramWithNewTest(AnritsuTest);
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[9])
     {
         MTKTestSTC       STCTest = new MTKTestSTC(Log, MTKPort, DUTPort);
         MTKTestSTCDialog temp    = new MTKTestSTCDialog(STCTest);
         if (temp.ShowDialog() == DialogResult.OK)
         {
             UpdateTestProgramWithNewTest(STCTest);
         }
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[10])
     {
         MTKTestCUS       CustomTest = new MTKTestCUS(Log, MTKPort, DUTPort);
         MTKTestCUSDialog temp       = new MTKTestCUSDialog(CustomTest);
         if (temp.ShowDialog() == DialogResult.OK)
         {
             UpdateTestProgramWithNewTest(CustomTest);
         }
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[11])
     {
         MTKPSoCProgrammer MTKProgrammer = new MTKPSoCProgrammer(Log);
         if (MTKProgrammer.PSoCProgrammerInstalled && MTKProgrammer.IsCorrectVersion())
         {
             MTKTestProgramAll       CustomTest = new MTKTestProgramAll(Log, MTKPort, DUTPort);
             MTKTestProgramAllDialog temp       = new MTKTestProgramAllDialog(CustomTest);
             if (temp.ShowDialog() == DialogResult.OK)
             {
                 UpdateTestProgramWithNewTest(CustomTest);
             }
         }
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[12])
     {
         MTKTestI2C       CustomTest = new MTKTestI2C(Log);
         MTKTestI2CDialog temp       = new MTKTestI2CDialog(CustomTest);
         if (temp.ShowDialog() == DialogResult.OK)
         {
             UpdateTestProgramWithNewTest(CustomTest);
         }
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[13])
     {
         MTKTestRSX       GetRSSI = new MTKTestRSX(Log, MTKPort, DUTPort);
         MTKTestRSXDialog temp    = new MTKTestRSXDialog(GetRSSI);
         if (temp.ShowDialog() == DialogResult.OK)
         {
             UpdateTestProgramWithNewTest(GetRSSI);
         }
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[14])
     {
         MTKTestRBA ReadBDA = new MTKTestRBA(Log, MTKPort, DUTPort);
         UpdateTestProgramWithNewTest(ReadBDA);
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[15])
     {
         MTKTestXOCalibration XOCalibration = new MTKTestXOCalibration(Log, MTKPort, DUTPort);
         MTKTestXOCalDialog   temp          = new MTKTestXOCalDialog(XOCalibration);
         if (temp.ShowDialog() == DialogResult.OK)
         {
             UpdateTestProgramWithNewTest(XOCalibration);
         }
     }
     else if (AvailableTestListBox.GetItemText(AvailableTestListBox.SelectedItem) == ListOfAvailableTests[16])
     {
         MTKTestDUTCurrentMeasure dutCurrMeas = new MTKTestDUTCurrentMeasure(Log, MTKPort, DUTPort);
         DUTCurrentMeasureDialog  temp        = new DUTCurrentMeasureDialog();
         if (temp.ShowDialog() == DialogResult.OK)
         {
             UpdateTestProgramWithNewTest(dutCurrMeas);
         }
     }
     else if (ListBoxDoubleClick == false)
     {
         MessageBox.Show("Select a test to add to the program.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     ListBoxDoubleClick = false;
 }
Пример #7
0
        public MTKTestError RunTest(int TestIndex)
        {
            Log.PrintLog(this, "Running test program " + (TestIndex + 1).ToString() + "/" +
                         TestProgram.Count.ToString(), LogDetailLevel.LogRelevant);

            TestProgram[TestIndex].UpdateDUTPort(DUTSerialPort);
            TestProgram[TestIndex].DUTConnectionMode = MTKTest.GetConnectionModeFromText(DUTConnectionType);

            string TestType = TestProgram[TestIndex].ToString();

            if ((TestType == "MTKTestTXP") || (TestType == "MTKTestTXPER") || (TestType == "MTKTestRXP") ||
                (TestType == "MTKTestRXPER") || (TestType == "MTKTestTXCW") || (TestType == "MTKTestAnritsu") ||
                (TestType == "MTKTestCUS") || (TestType == "MTKTestSTC"))
            {
                if (CheckPorts(TestType))
                {
                    if (MTKSerialPort.IsOpen == false)
                    {
                        return(MTKTestError.MissingMTKSerialPort);
                    }

                    if ((DUTSerialPort.IsOpen == false) && (DUTConnectionType == "UART"))
                    {
                        if (_IgnoreDUT)
                        {
                            return(MTKTestError.IgnoringDUT);
                        }
                        else
                        {
                            return(MTKTestError.MissingDUTSerialPort);
                        }
                    }

                    if ((AnritsuSerialPort.IsOpen == false) && (TestType == "MTKTestAnritsu"))
                    {
                        return(MTKTestError.MissingAnritsuSerialPort);
                    }
                }
            }

            if (TestType == "MTKTestProgramAll")
            {
                ((MTKTestProgramAll)TestProgram[TestIndex]).NumberOfDUTs   = NumberOfDUTs;
                ((MTKTestProgramAll)TestProgram[TestIndex]).CurrentDUT     = _CurrentDUT;
                ((MTKTestProgramAll)TestProgram[TestIndex]).DUTProgrammers = DUTProgrammers;
            }

            if (TestType == "MTKTestAnritsu")
            {
                ((MTKTestAnritsu)TestProgram[TestIndex]).AnritsuPort = AnritsuSerialPort;
            }

            MTKTestError RetVal;

            OnNextTest(TestIndex);
            if (TestType == "MTKPSoCProgrammer")
            {
                if (((MTKPSoCProgrammer)TestProgram[TestIndex]).GlobalProgrammerSelected)
                {
                    RetVal = DUTProgrammers[_CurrentDUT].RunTest();
                }
                else
                {
                    RetVal = TestProgram[TestIndex].RunTest();
                }
            }
            else
            {
                RetVal = TestProgram[TestIndex].RunTest();
            }
            OnTestComplete();
            return(RetVal);
        }