Beispiel #1
0
        private void dutPhoneStateChanged(object sender, DutPhoneStateChangedEventArgs param1)
        {
            if (this.InvokeRequired)
            {
                delGenernal del = new delGenernal(dutPhoneStateChanged);
                this.Invoke(del, sender, param1);
            }
            else
            {
                dutController dut = sender as dutController;
                DutPhoneStateChangedEventArgs pscea = param1 as DutPhoneStateChangedEventArgs;
                TextBox txtBox;
                if (dut.Equals(dut1))
                {
                    txtBox = txtDut1PhoneState;
                }
                else
                {
                    txtBox = txtDut2PhoneState;
                }
                txtBox.Text      = pscea.State.ToString();
                txtBox.ForeColor = System.Drawing.Color.White;
                switch (pscea.State)
                {
                case dutController.DutPhoneState.Idle:
                    txtBox.BackColor = System.Drawing.Color.LimeGreen;
                    break;

                case dutController.DutPhoneState.Rejected:
                    txtBox.BackColor = System.Drawing.Color.Purple;
                    break;

                case dutController.DutPhoneState.Answered:
                case dutController.DutPhoneState.Connected:
                    txtBox.BackColor = System.Drawing.Color.Crimson;
                    break;

                case dutController.DutPhoneState.Dialing:
                    txtBox.BackColor = System.Drawing.Color.Orange;
                    break;

                case dutController.DutPhoneState.EndCall:
                    txtBox.BackColor = System.Drawing.Color.Green;
                    break;

                case dutController.DutPhoneState.Offhook:
                    txtBox.BackColor = System.Drawing.Color.Red;
                    break;

                case dutController.DutPhoneState.Ringing:
                    txtBox.BackColor = System.Drawing.Color.OrangeRed;
                    break;

                case dutController.DutPhoneState.Unknow:
                default:
                    txtBox.BackColor = System.Drawing.Color.DarkGray;
                    break;
                }
            }
        }
Beispiel #2
0
        private void cmbDUT1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!dutAutoSelecting)
            {
                if (cmbDUT1.SelectedIndex >= 0)
                {
                    AdbDeviceInfomation devSelected = devList[cmbDUT1.SelectedIndex];
                    if (dev2 == null || !devSelected.ID.Equals(dev2.ID))
                    {
                        txtDut1PhoneState.Text = "Phone number???";
                        dev1 = devSelected;
                        dut1 = new dutController(dev1.ID);
                        dut1.RefreshPhoneNumberByAPI();
                        if (dut1.PhoneNumber != null && dut1.PhoneNumber.Length > 0)
                        {
                            txtDut1PhoneState.Text = dut1.PhoneNumber;
                        }
                    }
                    else
                    {
                        dev1                 = null;
                        dutAutoSelecting     = true;
                        cmbDUT1.SelectedItem = null;
                        dutAutoSelecting     = false;
                        MessageBox.Show(devSelected.ID + " is already selected");
                        return;
                    }
                }
            }

            if (dev1 != null)
            {
                dut1.DutPhoneStateChangedEventHandler += new EventHandler <DutPhoneStateChangedEventArgs>(dutPhoneStateChangedEventHandler);
                txtDut1ConnectStatus.Text              = dev1.ConnectingStatus;
                if (dev1.ConnectingStatus.Equals("Connected"))
                {
                    txtDut1ConnectStatus.BackColor = System.Drawing.Color.LightCoral;
                    txtDut1ConnectStatus.ForeColor = System.Drawing.Color.White;
                }
                else if (dev1.ConnectingStatus.Equals("Ready"))
                {
                    txtDut1ConnectStatus.BackColor = System.Drawing.Color.Green;
                    txtDut1ConnectStatus.ForeColor = System.Drawing.Color.White;
                }
                else if (dev1.ConnectingStatus.Equals("Initializing"))
                {
                    txtDut1ConnectStatus.BackColor = System.Drawing.Color.YellowGreen;
                    txtDut1ConnectStatus.ForeColor = System.Drawing.Color.White;
                }
            }
            else
            {
                txtDut1ConnectStatus.BackColor = System.Drawing.SystemColors.Control;
                txtDut1ConnectStatus.Text      = "";
            }
        }
Beispiel #3
0
 public void Run(bool infinityMode, bool debugMode, ListView.CheckedIndexCollection selectedTCs, dutController dut1, dutController dut2)
 {
     if (tdRun != null)
     {
         Stop();
     }
     _dut1 = dut1;
     _dut2 = dut2;
     Logger.Initialize(System.AppDomain.CurrentDomain.BaseDirectory + "\\Log\\" + dut1.DeviceID + "_" + dut2.DeviceID);
     infinityModeFlag = infinityMode;
     debugModeFlag    = debugMode;
     runFlag          = true;
     prepareTestCases(selectedTCs);
     tdRun = new Thread(testlist_Runnable);
     tdRun.Start();
 }
Beispiel #4
0
 public void Run(ListView.CheckedIndexCollection selectedTCs, dutController dut1, dutController dut2)
 {
     Run(false, false, selectedTCs, dut1, dut2);
 }
Beispiel #5
0
        private void testCase6_Runnable()
        {
            Logger.WriteLog("TC", "============= Test case WA6 start =============");
            tcLoopCounter = 0;
            tcLoopTimes   = 200;
            dutController dialer   = _dut1;
            dutController receiver = _dut2;

            dialer.StartStateMonitor();
            receiver.StartStateMonitor();
            processTimeout = 10000;
            Logger.WriteLog("TcInfo", "Loop times = " + tcLoopTimes + ", " + "duration of each call = " + callDuration_inSeconds + " seconds");
            while (tcLoopCounter < tcLoopTimes && runFlag)
            {
                #region Dialer calls Receiver
                dialer.Dial(receiver.PhoneNumber);
                getTimeDiffInMilliseconds(true);
                do
                {
                    isDialOK         = receiver.CurrentPhoneState.Equals(dutController.DutPhoneState.Ringing);
                    isProcessTimeout = getTimeDiffInMilliseconds() > processTimeout;
                }while (!isDialOK && !isProcessTimeout);
                if (isDialOK)
                {
                    Logger.WriteLog("CheckPoint", "Make a call succefully, result = Pass");
                }
                else if (isProcessTimeout)
                {
                    Logger.WriteLog("CheckPoint", "Make a call unsuccefully, result = Fail");
                    dialer.EndCall();
                    receiver.EndCall();
                    Thread.Sleep(loopDelay);
                    continue;
                }
                #endregion Dialer calls Receiver
                #region End call
                receiver.EndCall();
                processTimeout = 20000;
                getTimeDiffInMilliseconds(true);
                do
                {
                    isEndCallOK = !(dialer.isPhoneConnected || receiver.isPhoneConnected);
                    double timediff = getTimeDiffInMilliseconds();
                    isProcessTimeout = timediff > processTimeout;

                    Thread.Sleep(1000);
                } while (!(isProcessTimeout || isEndCallOK));
                if (isEndCallOK)
                {
                    Logger.WriteLog("CheckPoint", " Hangs up a call succeefully, result = Pass");
                }
                else
                {
                    Logger.WriteLog("CheckPoint", "Fail to hang up a call , result =Fail");
                }
                #endregion End call
            }
            _dut1.StopStateMonitor();
            _dut1.StopStateMonitor();
            waitoneEventHandle.Set();
        }
Beispiel #6
0
        private void testCase1_Runnable()
        {
            Logger.WriteLog("TC", "============= Test case WA1 start =============");
            tcLoopCounter = 0;
            tcLoopTimes   = 200;
            dutController dialer   = _dut1;
            dutController receiver = _dut2;

            dialer.StartStateMonitor();
            receiver.StartStateMonitor();
            Logger.WriteLog("TcInfo", "Loop times = " + tcLoopTimes + ", " + "duration of each call = " + callDuration_inSeconds + " seconds");
            Thread.Sleep(3000);
            while (tcLoopCounter < tcLoopTimes && runFlag)
            {
                tcLoopCounter++;
                getTimeDiffInMilliseconds(true);  //Reset start time
                processTimeout = 10000;
                #region Dialer calls Receiver
                dialer.Dial(receiver.PhoneNumber);
                do
                {
                    isDialOK         = receiver.CurrentPhoneState.Equals(dutController.DutPhoneState.Ringing);
                    isProcessTimeout = getTimeDiffInMilliseconds() > processTimeout;
                }while (!isDialOK && !isProcessTimeout);
                if (isDialOK)
                {
                    Logger.WriteLog("CheckPoint", "Make a call succefully, result = Pass");
                }
                else if (isProcessTimeout)
                {
                    Logger.WriteLog("CheckPoint", "Make a call unsuccefully, result = Fail");
                    dialer.EndCall();
                    receiver.EndCall();
                    Thread.Sleep(loopDelay);
                    continue;
                }
                #endregion Dialer calls Receiver
                #region Receiver Picks up
                isPickupOK = receiver.AnswerCall(10000);
                if (isPickupOK)
                {
                    Logger.WriteLog("CheckPoint", "Pick up the incoming call successfully, result = Pass");
                    dialer.CurrentPhoneState = dutController.DutPhoneState.Connected;
                }
                else
                {
                    Logger.WriteLog("CheckPoint", "Fail to pick up the incoming call, result = Fail");
                    dialer.EndCall();
                    receiver.EndCall();
                    Thread.Sleep(loopDelay);
                    continue;
                }
                #endregion Receiver Picks up
                Thread.Sleep(10000);
                #region Calling state check
                getTimeDiffInMilliseconds(true);  //Reset start time
                do
                {
                    isCallDurationCheckOK = dialer.isPhoneConnected && receiver.isPhoneConnected;
                    isProcessTimeout      = ((int)getTimeDiffInMilliseconds() > (callDuration_inSeconds * 1000));
                    Thread.Sleep(1000);
                } while (isCallDurationCheckOK && !isProcessTimeout);
                if (isCallDurationCheckOK)
                {
                    Logger.WriteLog("CheckPoint", "Callint state check OK, calling duration = " + callDuration_inSeconds + "seconds, result = Pass");
                }
                else
                {
                    Logger.WriteLog("CheckPoint", "Callint state checking is failed, result = Fail");
                    dialer.EndCall();
                    receiver.EndCall();
                    Thread.Sleep(loopDelay);
                    continue;
                }
                #endregion Calling state check
                #region End call
                processTimeout = 5000;
                dialer.EndCall();
                do
                {
                    isEndCallOK      = !(dialer.isPhoneConnected || receiver.isPhoneConnected);
                    isProcessTimeout = processTimeout > getTimeDiffInMilliseconds();
                    Thread.Sleep(1000);
                } while (!isProcessTimeout && !isEndCallOK);
                if (isEndCallOK)
                {
                    Logger.WriteLog("CheckPoint", " Hangs up a call succeefully, result = Pass");
                }
                else
                {
                    Logger.WriteLog("CheckPoint", "Fail to hang up a call , result =Fail");
                }
                #endregion End call
                Thread.Sleep(10000);
            }
            dialer.StopStateMonitor();
            receiver.StopStateMonitor();
            waitoneEventHandle.Set();
        }