Beispiel #1
0
        private int getSignalStrength(Wwan_TestCaseInfo.SimSlot sim)
        {
            int signalStrength = -999;

            if (sim.Equals(Wwan_TestCaseInfo.SimSlot.SIM2))
            {
                androidDevice.SIM2.RefreshState();
                signalStrength = androidDevice.SIM2.SignalStrength;
            }
            else
            {
                androidDevice.SIM1.RefreshState();
                signalStrength = androidDevice.SIM1.SignalStrength;
            }
            return(signalStrength);
        }
Beispiel #2
0
        private bool setDutSignalStrength(Wwan_TestCaseInfo.SimSlot sim, int strengthInDb, int timeoutInSeconds, int inaccuracy)
        {
            bool     result                     = false;
            bool     isTimeout                  = false;
            int      signalStrength             = -999;
            int      cellPowerInStationEmulator = -999;
            int      diff                 = 999;
            int      passTimesCount       = 0;
            int      passingTimesCriteria = 2;//取樣有n次singnal strength誤差在容許範圍內,才算pass;
            int      meetTargetRetryCount = 0;
            int      meetTargetRetryLimit = 3;
            int      checkSignalInterval  = 5000;
            int      modifyCellPowerDelay = 5000;
            DateTime startTime            = DateTime.Now;

            inaccuracy = Math.Abs(inaccuracy);

            Logger.WriteLog(Logger.LogLevels.Debug, Logger.LogTags.Action.ToString(), "Try to set DUT signal strength to " + strengthInDb + " db");
            do
            {
                #region Check if current signal strength meet to the target strength
                meetTargetRetryCount = 0;
                do
                {
                    meetTargetRetryCount++;
                    signalStrength = getSignalStrength(sim); //Get Signal Strength
                    showCurrentSignalStrength(signalStrength);
                    if (signalStrength <= -999)
                    {
                        result    = false;
                        isTimeout = true;
                        break;
                    }
                    else
                    {
                        diff = strengthInDb - signalStrength;
                        Logger.WriteLog(Logger.LogLevels.Debug, Logger.LogTags.Detail.ToString(), "Difference between current signal strength and target = " + diff + " db");
                        if (Math.Abs(diff) <= inaccuracy)
                        {
                            passTimesCount++;
                        }
                        if (passTimesCount >= passingTimesCriteria)
                        {
                            result = true;
                        }
                        else
                        {
                            isTimeout = DateTime.Now.Subtract(startTime).TotalSeconds > timeoutInSeconds;
                            Thread.Sleep(checkSignalInterval);
                        }
                    }
                } while (!(result || isTimeout || (meetTargetRetryCount >= meetTargetRetryLimit)));
                #endregion Check if current signal strength meet to the target strength
                if (result || isTimeout)
                {
                    break;
                }
                else
                {
                    //cellPowerInStationEmulator = (int)currentConnector.GetCellPower();
                    cellPowerInStationEmulator = se8960.CellPower;
                    int newCellPower = cellPowerInStationEmulator + diff;
                    se8960.SetCellPower(newCellPower);
                    //currentConnector.SetCellPower(newCellPower);
                    Logger.WriteLog(Logger.LogLevels.Debug, Logger.LogTags.Action.ToString(), "Auto adjust the cell power to = " + newCellPower + " db");
                    Thread.Sleep(modifyCellPowerDelay);
                }
            } while (!(result || isTimeout));
            Logger.WriteLog("Check", "Set DUT signal strength result = " + (result ? "Pass" : "Fail") + ", timeout = " + isTimeout);
            return(result);
        }
Beispiel #3
0
 private bool setDutSignalStrength(Wwan_TestCaseInfo.SimSlot sim, int strengthInDb, int timeoutInSeconds)
 {
     timeoutInSeconds = timeoutInSeconds >= 30 ? timeoutInSeconds : 30;
     return(setDutSignalStrength(sim, strengthInDb, timeoutInSeconds, 2));
 }